content
stringlengths
23
1.05M
with Menu,Alumnos,Clases; procedure Lista_Alumnos is Tercero_B : Clases.Clase; Eleccion : Menu.Opcion; Alu : Alumnos.Alumno; Num : Clases.Num_Alumno; begin loop Menu.Pide_Opcion (Eleccion); case Eleccion is when Menu.Insertar => if Clases.Llena(Tercero_B) then Menu.Mensaje_Error("No caben mas alumnos"); else Alumnos.Lee(Alu); Clases.Inserta_Alumno(Alu,Tercero_B); end if; when Menu.Mirar => Menu.Lee_Num_Alumno(Num); if Num>Clases.Numero_Alumnos(Tercero_B) then Menu.Mensaje_Error("Alumno no existe"); else Alu:=Clases.Dame_Alumno(Num,Tercero_B); Alumnos.Escribe(Alu); end if; when Menu.Salir => exit; end case; end loop; end Lista_Alumnos;
-- { dg-do compile } procedure Class_Wide1 is package P is type T is tagged null record; procedure P1 (x : T'Class); procedure P2 (x : access T'Class); end P; package body P is procedure P1 (x : T'Class) is begin null; end; procedure P2 (x : access T'Class) is begin null; end; end P; use P; a : T; type Ptr is access T; b : Ptr := new T; begin A.P1; B.P2; end;
with My_Package; use My_Package; procedure Main is Foo : My_Type; -- Foo is created and initialized to -12 begin Some_Procedure(Foo); -- Foo is doubled Foo := Set(2007); -- Foo.Variable is set to 2007 end Main;
with physics.Joint.DoF6, physics.Joint.cone_twist, physics.Joint.slider, physics.Joint.hinge, physics.Joint.ball, physics.Object, bullet_C.Pointers, lace.Any; package bullet_Physics.Joint -- -- Provides glue between a physics joint and a Bullet3D joint. -- is type Item is abstract limited new physics.Joint.item with record C : bullet_c.Pointers.Joint_pointer; user_Data : access lace.Any.limited_item'Class; end record; type View is access all Item'Class; --------- --- Forge -- use Math; function new_Dof6_Joint (Object_A, Object_B : in physics.Object.view; Frame_A, Frame_B : in Matrix_4x4) return physics.Joint.DoF6.view; function new_ball_Joint (Object_A, Object_B : in physics.Object.view; Pivot_in_A, Pivot_in_B : in Vector_3) return physics.Joint.ball.view; function new_slider_Joint (Object_A, Object_B : in physics.Object.view; Frame_A, Frame_B : in Matrix_4x4) return physics.Joint.slider.view; function new_cone_twist_Joint (Object_A, Object_B : in physics.Object.view; Frame_A, Frame_B : in Matrix_4x4) return physics.Joint.cone_twist.view; function new_hinge_Joint (Object_A, Object_B : in physics.Object.view; Frame_A, Frame_B : in Matrix_4x4) return physics.Joint.hinge.view; function new_hinge_Joint (Object_A : in physics.Object.view; Frame_A : in Matrix_4x4) return physics.Joint.hinge.view; procedure free (the_Joint : in out physics.Joint.view); private use physics.Joint; overriding function reaction_Force (Self : in Item) return Vector_3; overriding function reaction_Torque (Self : in Item) return Real; overriding procedure user_Data_is (Self : in out Item; Now : access lace.Any.limited_item'Class); overriding function user_Data (Self : in Item) return access lace.Any.limited_item'Class; -------- -- DoF6 -- type DoF6 is new Item and physics.Joint.DoF6.item with record null; end record; overriding procedure destruct (Self : in out DoF6); overriding function Object_A (Self : in DoF6) return physics.Object.view; overriding function Object_B (Self : in DoF6) return physics.Object.view; overriding function Frame_A (Self : in DoF6) return Matrix_4x4; overriding function Frame_B (Self : in DoF6) return Matrix_4x4; overriding procedure Frame_A_is (Self : in out DoF6; Now : in Matrix_4x4); overriding procedure Frame_B_is (Self : in out DoF6; Now : in Matrix_4x4); overriding function is_Limited (Self : in DoF6; DoF : in Degree_of_freedom) return Boolean; overriding procedure Velocity_is (Self : in out DoF6; Now : in Real; DoF : in Degree_of_freedom); overriding function Extent (Self : in DoF6; DoF : in Degree_of_freedom) return Real; overriding procedure desired_Extent_is (Self : in out DoF6; Now : in Real; DoF : in Degree_of_freedom); overriding function lower_Limit (Self : in DoF6; DoF : in Degree_of_freedom) return Real; overriding function upper_Limit (Self : in DoF6; DoF : in Degree_of_freedom) return Real; overriding procedure lower_Limit_is (Self : in out DoF6; Now : in Real; DoF : in Degree_of_freedom); overriding procedure upper_Limit_is (Self : in out DoF6; Now : in Real; DoF : in Degree_of_freedom); ---------- -- Slider -- type Slider is new Item and physics.Joint.Slider.item with record null; end record; overriding procedure destruct (Self : in out Slider); overriding function Object_A (Self : in Slider) return physics.Object.view; overriding function Object_B (Self : in Slider) return physics.Object.view; overriding function Frame_A (Self : in Slider) return Matrix_4x4; overriding function Frame_B (Self : in Slider) return Matrix_4x4; overriding procedure Frame_A_is (Self : in out Slider; Now : in Matrix_4x4); overriding procedure Frame_B_is (Self : in out Slider; Now : in Matrix_4x4); overriding function is_Limited (Self : in Slider; DoF : in Degree_of_freedom) return Boolean; overriding procedure Velocity_is (Self : in out Slider; Now : in Real; DoF : in Degree_of_freedom); overriding function Extent (Self : in Slider; DoF : in Degree_of_freedom) return Real; overriding procedure desired_Extent_is (Self : in out Slider; Now : in Real; DoF : in Degree_of_freedom); overriding function lower_Limit (Self : in Slider; DoF : in Degree_of_freedom) return Real; overriding function upper_Limit (Self : in Slider; DoF : in Degree_of_freedom) return Real; overriding procedure lower_Limit_is (Self : in out Slider; Now : in Real; DoF : in Degree_of_freedom); overriding procedure upper_Limit_is (Self : in out Slider; Now : in Real; DoF : in Degree_of_freedom); -------------- -- cone_Twist -- type cone_Twist is new Item and physics.Joint.cone_Twist.item with record null; end record; overriding procedure destruct (Self : in out cone_Twist); overriding function Object_A (Self : in cone_Twist) return physics.Object.view; overriding function Object_B (Self : in cone_Twist) return physics.Object.view; overriding function Frame_A (Self : in cone_Twist) return Matrix_4x4; overriding function Frame_B (Self : in cone_Twist) return Matrix_4x4; overriding procedure Frame_A_is (Self : in out cone_Twist; Now : in Matrix_4x4); overriding procedure Frame_B_is (Self : in out cone_Twist; Now : in Matrix_4x4); overriding function is_Limited (Self : in cone_Twist; DoF : in Degree_of_freedom) return Boolean; overriding procedure Velocity_is (Self : in out cone_Twist; Now : in Real; DoF : in Degree_of_freedom); overriding function Extent (Self : in cone_Twist; DoF : Degree_of_freedom) return Real; overriding procedure desired_Extent_is (Self : in out cone_Twist; Now : in Real; DoF : in Degree_of_freedom); overriding function lower_Limit (Self : in cone_Twist; DoF : in Degree_of_freedom) return Real; overriding function upper_Limit (Self : in cone_Twist; DoF : in Degree_of_freedom) return Real; overriding procedure lower_Limit_is (Self : in out cone_Twist; Now : in Real; DoF : in Degree_of_freedom); overriding procedure upper_Limit_is (Self : in out cone_Twist; Now : in Real; DoF : in Degree_of_freedom); -------- -- Ball -- type Ball is new Item and physics.Joint.Ball.item with record null; end record; overriding procedure destruct (Self : in out Ball); overriding function Object_A (Self : in Ball) return physics.Object.view; overriding function Object_B (Self : in Ball) return physics.Object.view; overriding function Frame_A (Self : in Ball) return Matrix_4x4; overriding function Frame_B (Self : in Ball) return Matrix_4x4; overriding procedure Frame_A_is (Self : in out Ball; Now : in Matrix_4x4); overriding procedure Frame_B_is (Self : in out Ball; Now : in Matrix_4x4); overriding function is_Limited (Self : in Ball; DoF : in Degree_of_freedom) return Boolean; overriding procedure Velocity_is (Self : in out Ball; Now : in Real; DoF : in Degree_of_freedom); overriding function Extent (Self : in Ball; DoF : in Degree_of_freedom) return Real; overriding procedure desired_Extent_is (Self : in out Ball; Now : in Real; DoF : in Degree_of_freedom); overriding function lower_Limit (Self : in Ball; DoF : in Degree_of_freedom) return Real; overriding function upper_Limit (Self : in Ball; DoF : in Degree_of_freedom) return Real; overriding procedure lower_Limit_is (Self : in out Ball; Now : in Real; DoF : in Degree_of_freedom); overriding procedure upper_Limit_is (Self : in out Ball; Now : in Real; DoF : in Degree_of_freedom); --------- -- Hinge -- type Hinge is new Item and physics.Joint.Hinge.item with record null; end record; overriding procedure destruct (Self : in out Hinge); overriding function Object_A (Self : in Hinge) return physics.Object.view; overriding function Object_B (Self : in Hinge) return physics.Object.view; overriding function Frame_A (Self : in Hinge) return Matrix_4x4; overriding function Frame_B (Self : in Hinge) return Matrix_4x4; overriding procedure Frame_A_is (Self : in out Hinge; Now : in Matrix_4x4); overriding procedure Frame_B_is (Self : in out Hinge; Now : in Matrix_4x4); overriding function is_Limited (Self : in Hinge; DoF : in Degree_of_freedom) return Boolean; overriding procedure Velocity_is (Self : in out Hinge; Now : in Real; DoF : in Degree_of_freedom); overriding function Extent (Self : in Hinge; DoF : in Degree_of_freedom) return Real; overriding procedure desired_Extent_is (Self : in out Hinge; Now : in Real; DoF : in Degree_of_freedom); overriding procedure Limits_are (Self : in out Hinge; Low, High : in Real; Softness : in Real := 0.9; biasFactor : in Real := 0.3; relaxationFactor : in Real := 1.0); overriding function lower_Limit (Self : in Hinge) return Real; overriding function upper_Limit (Self : in Hinge) return Real; overriding function Angle (Self : in Hinge) return Real; end bullet_Physics.Joint;
with Ada.Unchecked_Conversion; package body Memory_Set is ------------ -- memset -- ------------ function Memset (M : Address; C : int; Size : size_t) return Address is subtype Mem_Array is char_array (size_t); type Mem_Ptr is access Mem_Array; function To_Memptr is new Ada.Unchecked_Conversion (Address, Mem_Ptr); Dest : constant Mem_Ptr := To_Memptr (M); begin if Size > 0 then for J in 0 .. Size - 1 loop Dest (J) := char'Val (C); end loop; end if; return M; end Memset; end Memory_Set;
-- Copyright (c) 2021 Bartek thindil Jasicki <thindil@laeran.pl> -- -- Licensed under the Apache License, Version 2.0 (the "License"); -- you may not use this file except in compliance with the License. -- You may obtain a copy of the License at -- -- http://www.apache.org/licenses/LICENSE-2.0 -- -- Unless required by applicable law or agreed to in writing, software -- distributed under the License is distributed on an "AS IS" BASIS, -- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -- See the License for the specific language governing permissions and -- limitations under the License. with Ada.Strings.Unbounded; package body Tk.TtkLabel is -- ****if* TtkLabel/TtkLabel.Options_To_String -- FUNCTION -- Convert Ada structure to Tcl command -- PARAMETERS -- Options - Ada Ttk_Label_Options to convert -- RESULT -- String with Tcl command options -- HISTORY -- 8.6.0 - Added -- SOURCE function Options_To_String(Options: Ttk_Label_Options) return String is -- **** use Ada.Strings.Unbounded; Options_String: Unbounded_String := Null_Unbounded_String; begin Option_Image (Name => "anchor", Value => Options.Anchor, Options_String => Options_String); Option_Image (Name => "background", Value => Options.Background, Options_String => Options_String); Option_Image (Name => "class", Value => Options.Class, Options_String => Options_String); Option_Image (Name => "compound", Value => Options.Compound, Options_String => Options_String); Option_Image (Name => "cursor", Value => Options.Cursor, Options_String => Options_String); Option_Image (Name => "font", Value => Options.Font, Options_String => Options_String); Option_Image (Name => "foreground", Value => Options.Foreground, Options_String => Options_String); Option_Image (Name => "image", Value => Options.Image, Options_String => Options_String); Option_Image (Name => "justify", Value => Options.Justify, Options_String => Options_String); Option_Image (Name => "padding", Value => Options.Padding, Options_String => Options_String); Option_Image (Name => "relief", Value => Options.Relief, Options_String => Options_String); Option_Image (Name => "state", Value => Options.State, Options_String => Options_String); Option_Image (Name => "style", Value => Options.Style, Options_String => Options_String); Option_Image (Name => "takefocus", Value => Options.Take_Focus, Options_String => Options_String); Option_Image (Name => "text", Value => Options.Text, Options_String => Options_String); Option_Image (Name => "textvariable", Value => Options.Text_Variable, Options_String => Options_String); Option_Image (Name => "underline", Value => Options.Underline, Options_String => Options_String); Option_Image (Name => "width", Value => Options.Width, Options_String => Options_String); Option_Image (Name => "wraplength", Value => Options.Wrap_Length, Options_String => Options_String); return To_String(Source => Options_String); end Options_To_String; function Create (Path_Name: Tk_Path_String; Options: Ttk_Label_Options; Interpreter: Tcl_Interpreter := Get_Interpreter) return Ttk_Label is begin Tcl_Eval (Tcl_Script => "ttk::label " & Path_Name & " " & Options_To_String(Options => Options), Interpreter => Interpreter); return Get_Widget(Path_Name => Path_Name, Interpreter => Interpreter); end Create; procedure Create (Label: out Ttk_Label; Path_Name: Tk_Path_String; Options: Ttk_Label_Options; Interpreter: Tcl_Interpreter := Get_Interpreter) is begin Label := Create (Path_Name => Path_Name, Options => Options, Interpreter => Interpreter); end Create; function Get_Options(Label: Ttk_Label) return Ttk_Label_Options is begin return Options: Ttk_Label_Options := Default_Ttk_Label_Options do Options.Anchor := Option_Value(Widgt => Label, Name => "anchor"); Options.Background := Option_Value(Widgt => Label, Name => "background"); Options.Class := Option_Value(Widgt => Label, Name => "class"); Options.Compound := Option_Value(Ttk_Widgt => Label, Name => "compound"); Options.Cursor := Option_Value(Widgt => Label, Name => "cursor"); Options.Font := Option_Value(Widgt => Label, Name => "font"); Options.Foreground := Option_Value(Widgt => Label, Name => "foreground"); Options.Image := Option_Value(Ttk_Widgt => Label, Name => "image"); Options.Justify := Option_Value(Widgt => Label, Name => "justify"); Options.Padding := Option_Value(Ttk_Widgt => Label, Name => "padding"); Options.Relief := Option_Value(Widgt => Label, Name => "relief"); Options.State := Option_Value(Ttk_Widgt => Label, Name => "state"); Options.Style := Option_Value(Widgt => Label, Name => "style"); Options.Take_Focus := Option_Value(Widgt => Label, Name => "takefocus"); Options.Text := Option_Value(Widgt => Label, Name => "text"); Options.Text_Variable := Option_Value(Widgt => Label, Name => "textvariable"); Options.Underline := Option_Value(Widgt => Label, Name => "underline"); Options.Width := Option_Value(Widgt => Label, Name => "width"); Options.Wrap_Length := Option_Value(Widgt => Label, Name => "wraplength"); end return; end Get_Options; procedure Configure(Label: Ttk_Label; Options: Ttk_Label_Options) is begin Execute_Widget_Command (Widgt => Label, Command_Name => "configure", Options => Options_To_String(Options => Options)); end Configure; end Tk.TtkLabel;
with openGL, Physics, float_Math.Geometry.D2, float_Math.Geometry.D3, float_Math.Algebra.linear.D2, float_Math.Algebra.linear.D3; package GEL -- -- A game engine library. -- is pragma Pure; Error : exception; -------- --- Math -- package Math renames float_Math; package Geometry renames math.Geometry; package Geometry_2d renames Geometry.D2; package Geometry_3d renames Geometry.D3; package Algebra renames math.Algebra; package linear_Algebra renames Algebra.linear; package linear_Algebra_2D renames linear_Algebra.D2; package linear_Algebra_3D renames linear_Algebra.D3; --------------- --- Constraints -- max_Worlds : constant := 1000; max_Cameras : constant := 1000; max_graphics_Models : constant := 2**32 - 1; -- max_physics_Models : constant := 2**32 - 1; max_Sprites : constant := 2**32 - 1; ------- --- Ids -- type world_Id is range 0 .. max_Worlds; type camera_Id is range 0 .. max_Cameras; subtype graphics_model_Id is openGL.model_Id; -- type physics_model_Id is range 0 .. max_physics_Models; type sprite_Id is range 0 .. max_Sprites; null_graphics_model_Id : constant graphics_model_Id; -- null_physics_model_Id : constant physics.model_Id; null_sprite_Id : constant sprite_Id; type graphics_model_Ids is array (Positive range <>) of graphics_model_Id; type physics_model_Ids is array (Positive range <>) of physics.model_Id; type sprite_Ids is array (Positive range <>) of sprite_Id; ---------- --- Assets -- type asset_Name is new String (1 .. 128); -- TODO: Make private. -- -- Name of a file containing textures, images, fonts, sounds, media or other resources. null_Asset : constant asset_Name; function to_Asset (Self : in String) return asset_Name; function to_String (Self : in asset_Name) return String; private null_graphics_model_Id : constant graphics_model_Id := 0; -- null_physics_model_Id : constant physics.model_Id := 0; null_sprite_Id : constant sprite_Id := 0; null_Asset : constant asset_Name := (others => ' '); end GEL;
------------------------------------------------------------------------------ -- Ada Web Server -- -- -- -- Copyright (C) 2005-2018, 2020, AdaCore -- -- -- -- This library is free software; you can redistribute it and/or modify -- -- it under terms of the GNU General Public License as published by the -- -- Free Software Foundation; either version 3, or (at your option) any -- -- later version. This library is distributed in the hope that it will be -- -- useful, but WITHOUT ANY WARRANTY; without even the implied warranty of -- -- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. -- -- -- -- As a special exception under Section 7 of GPL version 3, you are -- -- granted additional permissions described in the GCC Runtime Library -- -- Exception, version 3.1, as published by the Free Software Foundation. -- -- -- -- You should have received a copy of the GNU General Public License and -- -- a copy of the GCC Runtime Library Exception along with this program; -- -- see the files COPYING3 and COPYING.RUNTIME respectively. If not, see -- -- <http://www.gnu.org/licenses/>. -- -- -- -- As a special exception, if other files instantiate generics from this -- -- unit, or you link this unit with other files to produce an executable, -- -- this unit does not by itself cause the resulting executable to be -- -- covered by the GNU General Public License. This exception does not -- -- however invalidate any other reasons why the executable file might be -- -- covered by the GNU Public License. -- ------------------------------------------------------------------------------ pragma Ada_2012; with AWS.Messages; with AWS.Net.Buffered; with AWS.Translator; with AWS.Client.HTTP_Utils; package body AWS.Client.Ext is procedure Do_Options (Connection : in out HTTP_Connection; Result : out Response.Data; URI : String := No_Data; Headers : Header_List := Empty_Header_List) is begin Send_Request (Connection, OPTIONS, Result, URI, No_Content, Headers); end Do_Options; function Do_Options (URL : String; User : String := No_Data; Pwd : String := No_Data; Proxy : String := No_Data; Proxy_User : String := No_Data; Proxy_Pwd : String := No_Data; Timeouts : Timeouts_Values := No_Timeout; Headers : Header_List := Empty_Header_List; User_Agent : String := Default.User_Agent) return Response.Data is Connection : HTTP_Connection; Result : Response.Data; begin Create (Connection, URL, User, Pwd, Proxy, Proxy_User, Proxy_Pwd, Persistent => False, Timeouts => Timeouts, User_Agent => User_Agent); Do_Options (Connection, Result, Headers => Headers); Close (Connection); return Result; exception when others => Close (Connection); raise; end Do_Options; procedure Do_Patch (Connection : in out HTTP_Connection; Result : out Response.Data; URI : String := No_Data; Data : String; Headers : Header_List := Empty_Header_List) is begin Send_Request (Connection, PATCH, Result, URI, Translator.To_Stream_Element_Array (Data), Headers); end Do_Patch; function Do_Patch (URL : String; Data : String; User : String := No_Data; Pwd : String := No_Data; Proxy : String := No_Data; Proxy_User : String := No_Data; Proxy_Pwd : String := No_Data; Timeouts : Timeouts_Values := No_Timeout; Headers : Header_List := Empty_Header_List; User_Agent : String := Default.User_Agent) return Response.Data is Connection : HTTP_Connection; Result : Response.Data; begin Create (Connection, URL, User, Pwd, Proxy, Proxy_User, Proxy_Pwd, Persistent => False, Timeouts => Timeouts, User_Agent => User_Agent); Do_Patch (Connection, Result, Data => Data, Headers => Headers); Close (Connection); return Result; exception when others => Close (Connection); raise; end Do_Patch; function Do_Delete (URL : String; Data : String; User : String := No_Data; Pwd : String := No_Data; Proxy : String := No_Data; Proxy_User : String := No_Data; Proxy_Pwd : String := No_Data; Timeouts : Timeouts_Values := No_Timeout; Headers : Header_List := Empty_Header_List; User_Agent : String := Default.User_Agent) return Response.Data is Connection : HTTP_Connection; Result : Response.Data; begin Create (Connection, URL, User, Pwd, Proxy, Proxy_User, Proxy_Pwd, Persistent => False, Timeouts => Timeouts, User_Agent => User_Agent); Do_Delete (Connection, Result, Data, Headers => Headers); Close (Connection); return Result; exception when others => Close (Connection); raise; end Do_Delete; procedure Do_Delete (Connection : in out HTTP_Connection; Result : out Response.Data; Data : String; URI : String := No_Data; Headers : Header_List := Empty_Header_List) is begin Send_Request (Connection, DELETE, Result, URI, Translator.To_Stream_Element_Array (Data), Headers); end Do_Delete; ------------------ -- Send_Request -- ------------------ procedure Send_Request (Connection : in out HTTP_Connection; Kind : Method_Kind; Result : out Response.Data; URI : String; Data : Stream_Element_Array := No_Content; Headers : Header_List := Empty_Header_List) is use Ada.Real_Time; Stamp : constant Time := Clock; Try_Count : Natural := Connection.Retry; Auth_Attempts : Auth_Attempts_Count := (others => 2); Auth_Is_Over : Boolean; begin Retry : loop begin HTTP_Utils.Open_Send_Common_Header (Connection, Method_Kind'Image (Kind), URI, Headers); -- If there is some data to send if Data'Length > 0 then HTTP_Utils.Send_Header (Connection.Socket.all, Messages.Content_Length (Data'Length)); Net.Buffered.New_Line (Connection.Socket.all); -- Send message body Net.Buffered.Write (Connection.Socket.all, Data); else Net.Buffered.New_Line (Connection.Socket.all); end if; HTTP_Utils.Get_Response (Connection, Result, Get_Body => Kind /= HEAD and then not Connection.Streaming); HTTP_Utils.Decrement_Authentication_Attempt (Connection, Auth_Attempts, Auth_Is_Over); if Auth_Is_Over then return; elsif Kind /= HEAD and then Connection.Streaming then HTTP_Utils.Read_Body (Connection, Result, Store => False); end if; exception when E : Net.Socket_Error | HTTP_Utils.Connection_Error => Error_Processing (Connection, Try_Count, Result, Method_Kind'Image (Kind), E, Stamp); exit Retry when not Response.Is_Empty (Result); end; end loop Retry; end Send_Request; end AWS.Client.Ext;
------------------------------------------------------------------------------ -- -- -- GNAT COMPILER COMPONENTS -- -- -- -- P R J . N M S C -- -- -- -- B o d y -- -- -- -- Copyright (C) 2000-2006, Free Software Foundation, Inc. -- -- -- -- GNAT is free software; you can redistribute it and/or modify it under -- -- terms of the GNU General Public License as published by the Free Soft- -- -- ware Foundation; either version 2, or (at your option) any later ver- -- -- sion. GNAT is distributed in the hope that it will be useful, but WITH- -- -- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY -- -- or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -- -- for more details. You should have received a copy of the GNU General -- -- Public License distributed with GNAT; see file COPYING. If not, write -- -- to the Free Software Foundation, 51 Franklin Street, Fifth Floor, -- -- Boston, MA 02110-1301, USA. -- -- -- -- GNAT was originally developed by the GNAT team at New York University. -- -- Extensive contributions were provided by Ada Core Technologies Inc. -- -- -- ------------------------------------------------------------------------------ with Err_Vars; use Err_Vars; with Fmap; use Fmap; with Hostparm; with MLib.Tgt; use MLib.Tgt; with Namet; use Namet; with Osint; use Osint; with Output; use Output; with Prj.Env; use Prj.Env; with Prj.Err; with Prj.Util; use Prj.Util; with Sinput.P; with Snames; use Snames; with Table; use Table; with Targparm; use Targparm; with Ada.Characters.Handling; use Ada.Characters.Handling; with Ada.Strings; use Ada.Strings; with Ada.Strings.Fixed; use Ada.Strings.Fixed; with Ada.Strings.Maps.Constants; use Ada.Strings.Maps.Constants; with GNAT.Case_Util; use GNAT.Case_Util; with GNAT.Directory_Operations; use GNAT.Directory_Operations; with GNAT.HTable; package body Prj.Nmsc is Error_Report : Put_Line_Access := null; -- Set to point to error reporting procedure When_No_Sources : Error_Warning := Error; -- Indicates what should be done when there is no Ada sources in a non -- extending Ada project. ALI_Suffix : constant String := ".ali"; -- File suffix for ali files Object_Suffix : constant String := Get_Target_Object_Suffix.all; -- File suffix for object files type Name_Location is record Name : Name_Id; Location : Source_Ptr; Found : Boolean := False; end record; -- Information about file names found in string list attribute -- Source_Files or in a source list file, stored in hash table -- Source_Names, used by procedure Get_Path_Names_And_Record_Sources. No_Name_Location : constant Name_Location := (Name => No_Name, Location => No_Location, Found => False); package Source_Names is new GNAT.HTable.Simple_HTable (Header_Num => Header_Num, Element => Name_Location, No_Element => No_Name_Location, Key => Name_Id, Hash => Hash, Equal => "="); -- Hash table to store file names found in string list attribute -- Source_Files or in a source list file, stored in hash table -- Source_Names, used by procedure Get_Path_Names_And_Record_Sources. package Recursive_Dirs is new GNAT.HTable.Simple_HTable (Header_Num => Header_Num, Element => Boolean, No_Element => False, Key => Name_Id, Hash => Hash, Equal => "="); -- Hash table to store recursive source directories, to avoid looking -- several times, and to avoid cycles that may be introduced by symbolic -- links. type Ada_Naming_Exception_Id is new Nat; No_Ada_Naming_Exception : constant Ada_Naming_Exception_Id := 0; type Unit_Info is record Kind : Spec_Or_Body; Unit : Name_Id; Next : Ada_Naming_Exception_Id := No_Ada_Naming_Exception; end record; -- No_Unit : constant Unit_Info := -- (Specification, No_Name, No_Ada_Naming_Exception); package Ada_Naming_Exception_Table is new Table.Table (Table_Component_Type => Unit_Info, Table_Index_Type => Ada_Naming_Exception_Id, Table_Low_Bound => 1, Table_Initial => 20, Table_Increment => 100, Table_Name => "Prj.Nmsc.Ada_Naming_Exception_Table"); package Ada_Naming_Exceptions is new GNAT.HTable.Simple_HTable (Header_Num => Header_Num, Element => Ada_Naming_Exception_Id, No_Element => No_Ada_Naming_Exception, Key => Name_Id, Hash => Hash, Equal => "="); -- A hash table to store naming exceptions for Ada. For each file name -- there is one or several unit in table Ada_Naming_Exception_Table. function Hash (Unit : Unit_Info) return Header_Num; type Name_And_Index is record Name : Name_Id := No_Name; Index : Int := 0; end record; No_Name_And_Index : constant Name_And_Index := (Name => No_Name, Index => 0); package Reverse_Ada_Naming_Exceptions is new GNAT.HTable.Simple_HTable (Header_Num => Header_Num, Element => Name_And_Index, No_Element => No_Name_And_Index, Key => Unit_Info, Hash => Hash, Equal => "="); -- A table to check if a unit with an exceptional name will hide -- a source with a file name following the naming convention. function ALI_File_Name (Source : String) return String; -- Return the ALI file name corresponding to a source procedure Check_Ada_Name (Name : String; Unit : out Name_Id); -- Check that a name is a valid Ada unit name procedure Check_Naming_Scheme (Data : in out Project_Data; Project : Project_Id; In_Tree : Project_Tree_Ref); -- Check the naming scheme part of Data procedure Check_Ada_Naming_Scheme_Validity (Project : Project_Id; In_Tree : Project_Tree_Ref; Naming : Naming_Data); -- Check that the package Naming is correct procedure Check_For_Source (File_Name : Name_Id; Path_Name : Name_Id; Project : Project_Id; In_Tree : Project_Tree_Ref; Data : in out Project_Data; Location : Source_Ptr; Language : Language_Index; Suffix : String; Naming_Exception : Boolean); -- Check if a file, with name File_Name and path Path_Name, in a source -- directory is a source for language Language in project Project of -- project tree In_Tree. ??? procedure Check_If_Externally_Built (Project : Project_Id; In_Tree : Project_Tree_Ref; Data : in out Project_Data); -- Check attribute Externally_Built of project Project in project tree -- In_Tree and modify its data Data if it has the value "true". procedure Check_Library_Attributes (Project : Project_Id; In_Tree : Project_Tree_Ref; Data : in out Project_Data); -- Check the library attributes of project Project in project tree In_Tree -- and modify its data Data accordingly. procedure Check_Package_Naming (Project : Project_Id; In_Tree : Project_Tree_Ref; Data : in out Project_Data); -- Check package Naming of project Project in project tree In_Tree and -- modify its data Data accordingly. procedure Check_Programming_Languages (In_Tree : Project_Tree_Ref; Data : in out Project_Data); -- Check attribute Languages for the project with data Data in project -- tree In_Tree and set the components of Data for all the programming -- languages indicated in attribute Languages, if any. function Check_Project (P : Project_Id; Root_Project : Project_Id; In_Tree : Project_Tree_Ref; Extending : Boolean) return Boolean; -- Returns True if P is Root_Project or, if Extending is True, a project -- extended by Root_Project. procedure Check_Stand_Alone_Library (Project : Project_Id; In_Tree : Project_Tree_Ref; Data : in out Project_Data; Extending : Boolean); -- Check if project Project in project tree In_Tree is a Stand-Alone -- Library project, and modify its data Data accordingly if it is one. function Compute_Directory_Last (Dir : String) return Natural; -- Return the index of the last significant character in Dir. This is used -- to avoid duplicates '/' at the end of directory names function Body_Suffix_Of (Language : Language_Index; In_Project : Project_Data; In_Tree : Project_Tree_Ref) return String; -- Returns the suffix of sources of language Language in project In_Project -- in project tree In_Tree. procedure Error_Msg (Project : Project_Id; In_Tree : Project_Tree_Ref; Msg : String; Flag_Location : Source_Ptr); -- Output an error message. If Error_Report is null, simply call -- Prj.Err.Error_Msg. Otherwise, disregard Flag_Location and use -- Error_Report. procedure Find_Sources (Project : Project_Id; In_Tree : Project_Tree_Ref; Data : in out Project_Data; For_Language : Language_Index; Follow_Links : Boolean := False); -- Find all the sources in all of the source directories of a project for -- a specified language. procedure Free_Ada_Naming_Exceptions; -- Free the internal hash tables used for checking naming exceptions procedure Get_Directories (Project : Project_Id; In_Tree : Project_Tree_Ref; Data : in out Project_Data); -- Get the object directory, the exec directory and the source directories -- of a project. procedure Get_Mains (Project : Project_Id; In_Tree : Project_Tree_Ref; Data : in out Project_Data); -- Get the mains of a project from attribute Main, if it exists, and put -- them in the project data. procedure Get_Sources_From_File (Path : String; Location : Source_Ptr; Project : Project_Id; In_Tree : Project_Tree_Ref); -- Get the list of sources from a text file and put them in hash table -- Source_Names. procedure Get_Unit (Canonical_File_Name : Name_Id; Naming : Naming_Data; Exception_Id : out Ada_Naming_Exception_Id; Unit_Name : out Name_Id; Unit_Kind : out Spec_Or_Body; Needs_Pragma : out Boolean); -- Find out, from a file name, the unit name, the unit kind and if a -- specific SFN pragma is needed. If the file name corresponds to no -- unit, then Unit_Name will be No_Name. If the file is a multi-unit source -- or an exception to the naming scheme, then Exception_Id is set to -- the unit or units that the source contains. function Is_Illegal_Suffix (Suffix : String; Dot_Replacement_Is_A_Single_Dot : Boolean) return Boolean; -- Returns True if the string Suffix cannot be used as -- a spec suffix, a body suffix or a separate suffix. procedure Locate_Directory (Name : Name_Id; Parent : Name_Id; Dir : out Name_Id; Display : out Name_Id); -- Locate a directory (returns No_Name for Dir and Display if directory -- does not exist). Name is the directory name. Parent is the root -- directory, if Name is a relative path name. Dir is the canonical case -- path name of the directory, Display is the directory path name for -- display purposes. procedure Look_For_Sources (Project : Project_Id; In_Tree : Project_Tree_Ref; Data : in out Project_Data; Follow_Links : Boolean); -- Find all the sources of a project function Path_Name_Of (File_Name : Name_Id; Directory : Name_Id) return String; -- Returns the path name of a (non project) file. -- Returns an empty string if file cannot be found. procedure Prepare_Ada_Naming_Exceptions (List : Array_Element_Id; In_Tree : Project_Tree_Ref; Kind : Spec_Or_Body); -- Prepare the internal hash tables used for checking naming exceptions -- for Ada. Insert all elements of List in the tables. function Project_Extends (Extending : Project_Id; Extended : Project_Id; In_Tree : Project_Tree_Ref) return Boolean; -- Returns True if Extending is extending Extended either directly or -- indirectly. procedure Record_Ada_Source (File_Name : Name_Id; Path_Name : Name_Id; Project : Project_Id; In_Tree : Project_Tree_Ref; Data : in out Project_Data; Location : Source_Ptr; Current_Source : in out String_List_Id; Source_Recorded : in out Boolean; Follow_Links : Boolean); -- Put a unit in the list of units of a project, if the file name -- corresponds to a valid unit name. procedure Record_Other_Sources (Project : Project_Id; In_Tree : Project_Tree_Ref; Data : in out Project_Data; Language : Language_Index; Naming_Exceptions : Boolean); -- Record the sources of a language in a project. -- When Naming_Exceptions is True, mark the found sources as such, to -- later remove those that are not named in a list of sources. procedure Report_No_Ada_Sources (Project : Project_Id; In_Tree : Project_Tree_Ref; Location : Source_Ptr); -- Report an error or a warning depending on the value of When_No_Sources procedure Show_Source_Dirs (Project : Project_Id; In_Tree : Project_Tree_Ref); -- List all the source directories of a project function Suffix_For (Language : Language_Index; Naming : Naming_Data; In_Tree : Project_Tree_Ref) return Name_Id; -- Get the suffix for the source of a language from a package naming. -- If not specified, return the default for the language. procedure Warn_If_Not_Sources (Project : Project_Id; In_Tree : Project_Tree_Ref; Conventions : Array_Element_Id; Specs : Boolean; Extending : Boolean); -- Check that individual naming conventions apply to immediate -- sources of the project; if not, issue a warning. ------------------- -- ALI_File_Name -- ------------------- function ALI_File_Name (Source : String) return String is begin -- If the source name has an extension, then replace it with -- the ALI suffix. for Index in reverse Source'First + 1 .. Source'Last loop if Source (Index) = '.' then return Source (Source'First .. Index - 1) & ALI_Suffix; end if; end loop; -- If there is no dot, or if it is the first character, just add the -- ALI suffix. return Source & ALI_Suffix; end ALI_File_Name; ----------- -- Check -- ----------- procedure Check (Project : Project_Id; In_Tree : Project_Tree_Ref; Report_Error : Put_Line_Access; Follow_Links : Boolean; When_No_Sources : Error_Warning) is Data : Project_Data := In_Tree.Projects.Table (Project); Extending : Boolean := False; begin Nmsc.When_No_Sources := When_No_Sources; Error_Report := Report_Error; Recursive_Dirs.Reset; -- Object, exec and source directories Get_Directories (Project, In_Tree, Data); -- Get the programming languages Check_Programming_Languages (In_Tree, Data); -- Library attributes Check_Library_Attributes (Project, In_Tree, Data); Check_If_Externally_Built (Project, In_Tree, Data); if Current_Verbosity = High then Show_Source_Dirs (Project, In_Tree); end if; Check_Package_Naming (Project, In_Tree, Data); Extending := Data.Extends /= No_Project; Check_Naming_Scheme (Data, Project, In_Tree); Prepare_Ada_Naming_Exceptions (Data.Naming.Bodies, In_Tree, Body_Part); Prepare_Ada_Naming_Exceptions (Data.Naming.Specs, In_Tree, Specification); -- Find the sources if Data.Source_Dirs /= Nil_String then Look_For_Sources (Project, In_Tree, Data, Follow_Links); end if; if Data.Ada_Sources_Present then -- Check that all individual naming conventions apply to sources of -- this project file. Warn_If_Not_Sources (Project, In_Tree, Data.Naming.Bodies, Specs => False, Extending => Extending); Warn_If_Not_Sources (Project, In_Tree, Data.Naming.Specs, Specs => True, Extending => Extending); end if; -- If it is a library project file, check if it is a standalone library if Data.Library then Check_Stand_Alone_Library (Project, In_Tree, Data, Extending); end if; -- Put the list of Mains, if any, in the project data Get_Mains (Project, In_Tree, Data); -- Update the project data in the Projects table In_Tree.Projects.Table (Project) := Data; Free_Ada_Naming_Exceptions; end Check; -------------------- -- Check_Ada_Name -- -------------------- procedure Check_Ada_Name (Name : String; Unit : out Name_Id) is The_Name : String := Name; Real_Name : Name_Id; Need_Letter : Boolean := True; Last_Underscore : Boolean := False; OK : Boolean := The_Name'Length > 0; begin To_Lower (The_Name); Name_Len := The_Name'Length; Name_Buffer (1 .. Name_Len) := The_Name; Real_Name := Name_Find; -- Check first that the given name is not an Ada reserved word if Get_Name_Table_Byte (Real_Name) /= 0 and then Real_Name /= Name_Project and then Real_Name /= Name_Extends and then Real_Name /= Name_External then Unit := No_Name; if Current_Verbosity = High then Write_Str (The_Name); Write_Line (" is an Ada reserved word."); end if; return; end if; for Index in The_Name'Range loop if Need_Letter then -- We need a letter (at the beginning, and following a dot), -- but we don't have one. if Is_Letter (The_Name (Index)) then Need_Letter := False; else OK := False; if Current_Verbosity = High then Write_Int (Types.Int (Index)); Write_Str (": '"); Write_Char (The_Name (Index)); Write_Line ("' is not a letter."); end if; exit; end if; elsif Last_Underscore and then (The_Name (Index) = '_' or else The_Name (Index) = '.') then -- Two underscores are illegal, and a dot cannot follow -- an underscore. OK := False; if Current_Verbosity = High then Write_Int (Types.Int (Index)); Write_Str (": '"); Write_Char (The_Name (Index)); Write_Line ("' is illegal here."); end if; exit; elsif The_Name (Index) = '.' then -- We need a letter after a dot Need_Letter := True; elsif The_Name (Index) = '_' then Last_Underscore := True; else -- We need an letter or a digit Last_Underscore := False; if not Is_Alphanumeric (The_Name (Index)) then OK := False; if Current_Verbosity = High then Write_Int (Types.Int (Index)); Write_Str (": '"); Write_Char (The_Name (Index)); Write_Line ("' is not alphanumeric."); end if; exit; end if; end if; end loop; -- Cannot end with an underscore or a dot OK := OK and then not Need_Letter and then not Last_Underscore; if OK then Unit := Real_Name; else -- Signal a problem with No_Name Unit := No_Name; end if; end Check_Ada_Name; -------------------------------------- -- Check_Ada_Naming_Scheme_Validity -- -------------------------------------- procedure Check_Ada_Naming_Scheme_Validity (Project : Project_Id; In_Tree : Project_Tree_Ref; Naming : Naming_Data) is begin -- Only check if we are not using the Default naming scheme if Naming /= In_Tree.Private_Part.Default_Naming then declare Dot_Replacement : constant String := Get_Name_String (Naming.Dot_Replacement); Spec_Suffix : constant String := Get_Name_String (Naming.Ada_Spec_Suffix); Body_Suffix : constant String := Get_Name_String (Naming.Ada_Body_Suffix); Separate_Suffix : constant String := Get_Name_String (Naming.Separate_Suffix); begin -- Dot_Replacement cannot -- - be empty -- - start or end with an alphanumeric -- - be a single '_' -- - start with an '_' followed by an alphanumeric -- - contain a '.' except if it is "." if Dot_Replacement'Length = 0 or else Is_Alphanumeric (Dot_Replacement (Dot_Replacement'First)) or else Is_Alphanumeric (Dot_Replacement (Dot_Replacement'Last)) or else (Dot_Replacement (Dot_Replacement'First) = '_' and then (Dot_Replacement'Length = 1 or else Is_Alphanumeric (Dot_Replacement (Dot_Replacement'First + 1)))) or else (Dot_Replacement'Length > 1 and then Index (Source => Dot_Replacement, Pattern => ".") /= 0) then Error_Msg (Project, In_Tree, '"' & Dot_Replacement & """ is illegal for Dot_Replacement.", Naming.Dot_Repl_Loc); end if; -- Suffixes cannot -- - be empty if Is_Illegal_Suffix (Spec_Suffix, Dot_Replacement = ".") then Err_Vars.Error_Msg_Name_1 := Naming.Ada_Spec_Suffix; Error_Msg (Project, In_Tree, "{ is illegal for Spec_Suffix", Naming.Spec_Suffix_Loc); end if; if Is_Illegal_Suffix (Body_Suffix, Dot_Replacement = ".") then Err_Vars.Error_Msg_Name_1 := Naming.Ada_Body_Suffix; Error_Msg (Project, In_Tree, "{ is illegal for Body_Suffix", Naming.Body_Suffix_Loc); end if; if Body_Suffix /= Separate_Suffix then if Is_Illegal_Suffix (Separate_Suffix, Dot_Replacement = ".") then Err_Vars.Error_Msg_Name_1 := Naming.Separate_Suffix; Error_Msg (Project, In_Tree, "{ is illegal for Separate_Suffix", Naming.Sep_Suffix_Loc); end if; end if; -- Spec_Suffix cannot have the same termination as -- Body_Suffix or Separate_Suffix if Spec_Suffix'Length <= Body_Suffix'Length and then Body_Suffix (Body_Suffix'Last - Spec_Suffix'Length + 1 .. Body_Suffix'Last) = Spec_Suffix then Error_Msg (Project, In_Tree, "Body_Suffix (""" & Body_Suffix & """) cannot end with" & " Spec_Suffix (""" & Spec_Suffix & """).", Naming.Body_Suffix_Loc); end if; if Body_Suffix /= Separate_Suffix and then Spec_Suffix'Length <= Separate_Suffix'Length and then Separate_Suffix (Separate_Suffix'Last - Spec_Suffix'Length + 1 .. Separate_Suffix'Last) = Spec_Suffix then Error_Msg (Project, In_Tree, "Separate_Suffix (""" & Separate_Suffix & """) cannot end with" & " Spec_Suffix (""" & Spec_Suffix & """).", Naming.Sep_Suffix_Loc); end if; end; end if; end Check_Ada_Naming_Scheme_Validity; ---------------------- -- Check_For_Source -- ---------------------- procedure Check_For_Source (File_Name : Name_Id; Path_Name : Name_Id; Project : Project_Id; In_Tree : Project_Tree_Ref; Data : in out Project_Data; Location : Source_Ptr; Language : Language_Index; Suffix : String; Naming_Exception : Boolean) is Name : String := Get_Name_String (File_Name); Real_Location : Source_Ptr := Location; begin Canonical_Case_File_Name (Name); -- A file is a source of a language if Naming_Exception is True (case -- of naming exceptions) or if its file name ends with the suffix. if Naming_Exception or else (Name'Length > Suffix'Length and then Name (Name'Last - Suffix'Length + 1 .. Name'Last) = Suffix) then if Real_Location = No_Location then Real_Location := Data.Location; end if; declare Path : String := Get_Name_String (Path_Name); Path_Id : Name_Id; -- The path name id (in canonical case) File_Id : Name_Id; -- The file name id (in canonical case) Obj_Id : Name_Id; -- The object file name Obj_Path_Id : Name_Id; -- The object path name Dep_Id : Name_Id; -- The dependency file name Dep_Path_Id : Name_Id; -- The dependency path name Dot_Pos : Natural := 0; -- Position of the last dot in Name Source : Other_Source; Source_Id : Other_Source_Id := Data.First_Other_Source; begin Canonical_Case_File_Name (Path); -- Get the file name id Name_Len := Name'Length; Name_Buffer (1 .. Name_Len) := Name; File_Id := Name_Find; -- Get the path name id Name_Len := Path'Length; Name_Buffer (1 .. Name_Len) := Path; Path_Id := Name_Find; -- Find the position of the last dot for J in reverse Name'Range loop if Name (J) = '.' then Dot_Pos := J; exit; end if; end loop; if Dot_Pos <= Name'First then Dot_Pos := Name'Last + 1; end if; -- Compute the object file name Get_Name_String (File_Id); Name_Len := Dot_Pos - Name'First; for J in Object_Suffix'Range loop Name_Len := Name_Len + 1; Name_Buffer (Name_Len) := Object_Suffix (J); end loop; Obj_Id := Name_Find; -- Compute the object path name Get_Name_String (Data.Object_Directory); if Name_Buffer (Name_Len) /= Directory_Separator and then Name_Buffer (Name_Len) /= '/' then Name_Len := Name_Len + 1; Name_Buffer (Name_Len) := Directory_Separator; end if; Add_Str_To_Name_Buffer (Get_Name_String (Obj_Id)); Obj_Path_Id := Name_Find; -- Compute the dependency file name Get_Name_String (File_Id); Name_Len := Dot_Pos - Name'First + 1; Name_Buffer (Name_Len) := '.'; Name_Len := Name_Len + 1; Name_Buffer (Name_Len) := 'd'; Dep_Id := Name_Find; -- Compute the dependency path name Get_Name_String (Data.Object_Directory); if Name_Buffer (Name_Len) /= Directory_Separator and then Name_Buffer (Name_Len) /= '/' then Name_Len := Name_Len + 1; Name_Buffer (Name_Len) := Directory_Separator; end if; Add_Str_To_Name_Buffer (Get_Name_String (Dep_Id)); Dep_Path_Id := Name_Find; -- Check if source is already in the list of source for this -- project: it may have already been specified as a naming -- exception for the same language or an other language, or -- they may be two identical file names in different source -- directories. while Source_Id /= No_Other_Source loop Source := In_Tree.Other_Sources.Table (Source_Id); if Source.File_Name = File_Id then -- Two sources of different languages cannot have the same -- file name. if Source.Language /= Language then Error_Msg_Name_1 := File_Name; Error_Msg (Project, In_Tree, "{ cannot be a source of several languages", Real_Location); return; -- No problem if a file has already been specified as -- a naming exception of this language. elsif Source.Path_Name = Path_Id then -- Reset the naming exception flag, if this is not a -- naming exception. if not Naming_Exception then In_Tree.Other_Sources.Table (Source_Id).Naming_Exception := False; end if; return; -- There are several files with the same names, but the -- order of the source directories is known (no /**): -- only the first one encountered is kept, the other ones -- are ignored. elsif Data.Known_Order_Of_Source_Dirs then return; -- But it is an error if the order of the source directories -- is not known. else Error_Msg_Name_1 := File_Name; Error_Msg (Project, In_Tree, "{ is found in several source directories", Real_Location); return; end if; -- Two sources with different file names cannot have the same -- object file name. elsif Source.Object_Name = Obj_Id then Error_Msg_Name_1 := File_Id; Error_Msg_Name_2 := Source.File_Name; Error_Msg_Name_3 := Obj_Id; Error_Msg (Project, In_Tree, "{ and { have the same object file {", Real_Location); return; end if; Source_Id := Source.Next; end loop; if Current_Verbosity = High then Write_Str (" found "); Display_Language_Name (Language); Write_Str (" source """); Write_Str (Get_Name_String (File_Name)); Write_Line (""""); Write_Str (" object path = "); Write_Line (Get_Name_String (Obj_Path_Id)); end if; -- Create the Other_Source record Source := (Language => Language, File_Name => File_Id, Path_Name => Path_Id, Source_TS => File_Stamp (Path_Id), Object_Name => Obj_Id, Object_Path => Obj_Path_Id, Object_TS => File_Stamp (Obj_Path_Id), Dep_Name => Dep_Id, Dep_Path => Dep_Path_Id, Dep_TS => File_Stamp (Dep_Path_Id), Naming_Exception => Naming_Exception, Next => No_Other_Source); -- And add it to the Other_Sources table Other_Source_Table.Increment_Last (In_Tree.Other_Sources); In_Tree.Other_Sources.Table (Other_Source_Table.Last (In_Tree.Other_Sources)) := Source; -- There are sources of languages other than Ada in this project Data.Other_Sources_Present := True; -- And there are sources of this language in this project Set (Language, True, Data, In_Tree); -- Add this source to the list of sources of languages other than -- Ada of the project. if Data.First_Other_Source = No_Other_Source then Data.First_Other_Source := Other_Source_Table.Last (In_Tree.Other_Sources); else In_Tree.Other_Sources.Table (Data.Last_Other_Source).Next := Other_Source_Table.Last (In_Tree.Other_Sources); end if; Data.Last_Other_Source := Other_Source_Table.Last (In_Tree.Other_Sources); end; end if; end Check_For_Source; ------------------------------- -- Check_If_Externally_Built -- ------------------------------- procedure Check_If_Externally_Built (Project : Project_Id; In_Tree : Project_Tree_Ref; Data : in out Project_Data) is Externally_Built : constant Variable_Value := Util.Value_Of (Name_Externally_Built, Data.Decl.Attributes, In_Tree); begin if not Externally_Built.Default then Get_Name_String (Externally_Built.Value); To_Lower (Name_Buffer (1 .. Name_Len)); if Name_Buffer (1 .. Name_Len) = "true" then Data.Externally_Built := True; elsif Name_Buffer (1 .. Name_Len) /= "false" then Error_Msg (Project, In_Tree, "Externally_Built may only be true or false", Externally_Built.Location); end if; end if; if Current_Verbosity = High then Write_Str ("Project is "); if not Data.Externally_Built then Write_Str ("not "); end if; Write_Line ("externally built."); end if; end Check_If_Externally_Built; ----------------------------- -- Check_Naming_Scheme -- ----------------------------- procedure Check_Naming_Scheme (Data : in out Project_Data; Project : Project_Id; In_Tree : Project_Tree_Ref) is Naming_Id : constant Package_Id := Util.Value_Of (Name_Naming, Data.Decl.Packages, In_Tree); Naming : Package_Element; procedure Check_Unit_Names (List : Array_Element_Id); -- Check that a list of unit names contains only valid names ---------------------- -- Check_Unit_Names -- ---------------------- procedure Check_Unit_Names (List : Array_Element_Id) is Current : Array_Element_Id := List; Element : Array_Element; Unit_Name : Name_Id; begin -- Loop through elements of the string list while Current /= No_Array_Element loop Element := In_Tree.Array_Elements.Table (Current); -- Put file name in canonical case Get_Name_String (Element.Value.Value); Canonical_Case_File_Name (Name_Buffer (1 .. Name_Len)); Element.Value.Value := Name_Find; -- Check that it contains a valid unit name Get_Name_String (Element.Index); Check_Ada_Name (Name_Buffer (1 .. Name_Len), Unit_Name); if Unit_Name = No_Name then Err_Vars.Error_Msg_Name_1 := Element.Index; Error_Msg (Project, In_Tree, "{ is not a valid unit name.", Element.Value.Location); else if Current_Verbosity = High then Write_Str (" Unit ("""); Write_Str (Get_Name_String (Unit_Name)); Write_Line (""")"); end if; Element.Index := Unit_Name; In_Tree.Array_Elements.Table (Current) := Element; end if; Current := Element.Next; end loop; end Check_Unit_Names; -- Start of processing for Check_Naming_Scheme begin -- If there is a package Naming, we will put in Data.Naming what is in -- this package Naming. if Naming_Id /= No_Package then Naming := In_Tree.Packages.Table (Naming_Id); if Current_Verbosity = High then Write_Line ("Checking ""Naming"" for Ada."); end if; declare Bodies : constant Array_Element_Id := Util.Value_Of (Name_Body, Naming.Decl.Arrays, In_Tree); Specs : constant Array_Element_Id := Util.Value_Of (Name_Spec, Naming.Decl.Arrays, In_Tree); begin if Bodies /= No_Array_Element then -- We have elements in the array Body_Part if Current_Verbosity = High then Write_Line ("Found Bodies."); end if; Data.Naming.Bodies := Bodies; Check_Unit_Names (Bodies); else if Current_Verbosity = High then Write_Line ("No Bodies."); end if; end if; if Specs /= No_Array_Element then -- We have elements in the array Specs if Current_Verbosity = High then Write_Line ("Found Specs."); end if; Data.Naming.Specs := Specs; Check_Unit_Names (Specs); else if Current_Verbosity = High then Write_Line ("No Specs."); end if; end if; end; -- We are now checking if variables Dot_Replacement, Casing, -- Spec_Suffix, Body_Suffix and/or Separate_Suffix -- exist. -- For each variable, if it does not exist, we do nothing, -- because we already have the default. -- Check Dot_Replacement declare Dot_Replacement : constant Variable_Value := Util.Value_Of (Name_Dot_Replacement, Naming.Decl.Attributes, In_Tree); begin pragma Assert (Dot_Replacement.Kind = Single, "Dot_Replacement is not a single string"); if not Dot_Replacement.Default then Get_Name_String (Dot_Replacement.Value); if Name_Len = 0 then Error_Msg (Project, In_Tree, "Dot_Replacement cannot be empty", Dot_Replacement.Location); else Canonical_Case_File_Name (Name_Buffer (1 .. Name_Len)); Data.Naming.Dot_Replacement := Name_Find; Data.Naming.Dot_Repl_Loc := Dot_Replacement.Location; end if; end if; end; if Current_Verbosity = High then Write_Str (" Dot_Replacement = """); Write_Str (Get_Name_String (Data.Naming.Dot_Replacement)); Write_Char ('"'); Write_Eol; end if; -- Check Casing declare Casing_String : constant Variable_Value := Util.Value_Of (Name_Casing, Naming.Decl.Attributes, In_Tree); begin pragma Assert (Casing_String.Kind = Single, "Casing is not a single string"); if not Casing_String.Default then declare Casing_Image : constant String := Get_Name_String (Casing_String.Value); begin declare Casing_Value : constant Casing_Type := Value (Casing_Image); begin Data.Naming.Casing := Casing_Value; end; exception when Constraint_Error => if Casing_Image'Length = 0 then Error_Msg (Project, In_Tree, "Casing cannot be an empty string", Casing_String.Location); else Name_Len := Casing_Image'Length; Name_Buffer (1 .. Name_Len) := Casing_Image; Err_Vars.Error_Msg_Name_1 := Name_Find; Error_Msg (Project, In_Tree, "{ is not a correct Casing", Casing_String.Location); end if; end; end if; end; if Current_Verbosity = High then Write_Str (" Casing = "); Write_Str (Image (Data.Naming.Casing)); Write_Char ('.'); Write_Eol; end if; -- Check Spec_Suffix declare Ada_Spec_Suffix : constant Variable_Value := Prj.Util.Value_Of (Index => Name_Ada, Src_Index => 0, In_Array => Data.Naming.Spec_Suffix, In_Tree => In_Tree); begin if Ada_Spec_Suffix.Kind = Single and then Get_Name_String (Ada_Spec_Suffix.Value) /= "" then Get_Name_String (Ada_Spec_Suffix.Value); Canonical_Case_File_Name (Name_Buffer (1 .. Name_Len)); Data.Naming.Ada_Spec_Suffix := Name_Find; Data.Naming.Spec_Suffix_Loc := Ada_Spec_Suffix.Location; else Data.Naming.Ada_Spec_Suffix := Default_Ada_Spec_Suffix; end if; end; if Current_Verbosity = High then Write_Str (" Spec_Suffix = """); Write_Str (Get_Name_String (Data.Naming.Ada_Spec_Suffix)); Write_Char ('"'); Write_Eol; end if; -- Check Body_Suffix declare Ada_Body_Suffix : constant Variable_Value := Prj.Util.Value_Of (Index => Name_Ada, Src_Index => 0, In_Array => Data.Naming.Body_Suffix, In_Tree => In_Tree); begin if Ada_Body_Suffix.Kind = Single and then Get_Name_String (Ada_Body_Suffix.Value) /= "" then Get_Name_String (Ada_Body_Suffix.Value); Canonical_Case_File_Name (Name_Buffer (1 .. Name_Len)); Data.Naming.Ada_Body_Suffix := Name_Find; Data.Naming.Body_Suffix_Loc := Ada_Body_Suffix.Location; else Data.Naming.Ada_Body_Suffix := Default_Ada_Body_Suffix; end if; end; if Current_Verbosity = High then Write_Str (" Body_Suffix = """); Write_Str (Get_Name_String (Data.Naming.Ada_Body_Suffix)); Write_Char ('"'); Write_Eol; end if; -- Check Separate_Suffix declare Ada_Sep_Suffix : constant Variable_Value := Prj.Util.Value_Of (Variable_Name => Name_Separate_Suffix, In_Variables => Naming.Decl.Attributes, In_Tree => In_Tree); begin if Ada_Sep_Suffix.Default then Data.Naming.Separate_Suffix := Data.Naming.Ada_Body_Suffix; else Get_Name_String (Ada_Sep_Suffix.Value); if Name_Len = 0 then Error_Msg (Project, In_Tree, "Separate_Suffix cannot be empty", Ada_Sep_Suffix.Location); else Canonical_Case_File_Name (Name_Buffer (1 .. Name_Len)); Data.Naming.Separate_Suffix := Name_Find; Data.Naming.Sep_Suffix_Loc := Ada_Sep_Suffix.Location; end if; end if; end; if Current_Verbosity = High then Write_Str (" Separate_Suffix = """); Write_Str (Get_Name_String (Data.Naming.Separate_Suffix)); Write_Char ('"'); Write_Eol; end if; -- Check if Data.Naming is valid Check_Ada_Naming_Scheme_Validity (Project, In_Tree, Data.Naming); else Data.Naming.Ada_Spec_Suffix := Default_Ada_Spec_Suffix; Data.Naming.Ada_Body_Suffix := Default_Ada_Body_Suffix; Data.Naming.Separate_Suffix := Default_Ada_Body_Suffix; end if; end Check_Naming_Scheme; ------------------------------ -- Check_Library_Attributes -- ------------------------------ procedure Check_Library_Attributes (Project : Project_Id; In_Tree : Project_Tree_Ref; Data : in out Project_Data) is Attributes : constant Prj.Variable_Id := Data.Decl.Attributes; Lib_Dir : constant Prj.Variable_Value := Prj.Util.Value_Of (Snames.Name_Library_Dir, Attributes, In_Tree); Lib_Name : constant Prj.Variable_Value := Prj.Util.Value_Of (Snames.Name_Library_Name, Attributes, In_Tree); Lib_Version : constant Prj.Variable_Value := Prj.Util.Value_Of (Snames.Name_Library_Version, Attributes, In_Tree); Lib_ALI_Dir : constant Prj.Variable_Value := Prj.Util.Value_Of (Snames.Name_Library_Ali_Dir, Attributes, In_Tree); The_Lib_Kind : constant Prj.Variable_Value := Prj.Util.Value_Of (Snames.Name_Library_Kind, Attributes, In_Tree); begin -- Special case of extending project if Data.Extends /= No_Project then declare Extended_Data : constant Project_Data := In_Tree.Projects.Table (Data.Extends); begin -- If the project extended is a library project, we inherit -- the library name, if it is not redefined; we check that -- the library directory is specified; and we reset the -- library flag for the extended project. if Extended_Data.Library then if Lib_Name.Default then Data.Library_Name := Extended_Data.Library_Name; end if; if Lib_Dir.Default then if not Data.Virtual then Error_Msg (Project, In_Tree, "a project extending a library project must " & "specify an attribute Library_Dir", Data.Location); end if; end if; In_Tree.Projects.Table (Data.Extends).Library := False; end if; end; end if; pragma Assert (Lib_Dir.Kind = Single); if Lib_Dir.Value = Empty_String then if Current_Verbosity = High then Write_Line ("No library directory"); end if; else -- Find path name, check that it is a directory Locate_Directory (Lib_Dir.Value, Data.Display_Directory, Data.Library_Dir, Data.Display_Library_Dir); if Data.Library_Dir = No_Name then -- Get the absolute name of the library directory that -- does not exist, to report an error. declare Dir_Name : constant String := Get_Name_String (Lib_Dir.Value); begin if Is_Absolute_Path (Dir_Name) then Err_Vars.Error_Msg_Name_1 := Lib_Dir.Value; else Get_Name_String (Data.Display_Directory); if Name_Buffer (Name_Len) /= Directory_Separator then Name_Len := Name_Len + 1; Name_Buffer (Name_Len) := Directory_Separator; end if; Name_Buffer (Name_Len + 1 .. Name_Len + Dir_Name'Length) := Dir_Name; Name_Len := Name_Len + Dir_Name'Length; Err_Vars.Error_Msg_Name_1 := Name_Find; end if; -- Report the error Error_Msg (Project, In_Tree, "library directory { does not exist", Lib_Dir.Location); end; -- The library directory cannot be the same as the Object directory elsif Data.Library_Dir = Data.Object_Directory then Error_Msg (Project, In_Tree, "library directory cannot be the same " & "as object directory", Lib_Dir.Location); Data.Library_Dir := No_Name; Data.Display_Library_Dir := No_Name; else declare OK : Boolean := True; Dirs_Id : String_List_Id; Dir_Elem : String_Element; begin -- The library directory cannot be the same as a source -- directory of the current project. Dirs_Id := Data.Source_Dirs; while Dirs_Id /= Nil_String loop Dir_Elem := In_Tree.String_Elements.Table (Dirs_Id); Dirs_Id := Dir_Elem.Next; if Data.Library_Dir = Dir_Elem.Value then Err_Vars.Error_Msg_Name_1 := Dir_Elem.Value; Error_Msg (Project, In_Tree, "library directory cannot be the same " & "as source directory {", Lib_Dir.Location); OK := False; exit; end if; end loop; if OK then -- The library directory cannot be the same as a source -- directory of another project either. Project_Loop : for Pid in 1 .. Project_Table.Last (In_Tree.Projects) loop if Pid /= Project then Dirs_Id := In_Tree.Projects.Table (Pid).Source_Dirs; Dir_Loop : while Dirs_Id /= Nil_String loop Dir_Elem := In_Tree.String_Elements.Table (Dirs_Id); Dirs_Id := Dir_Elem.Next; if Data.Library_Dir = Dir_Elem.Value then Err_Vars.Error_Msg_Name_1 := Dir_Elem.Value; Err_Vars.Error_Msg_Name_2 := In_Tree.Projects.Table (Pid).Name; Error_Msg (Project, In_Tree, "library directory cannot be the same " & "as source directory { of project {", Lib_Dir.Location); OK := False; exit Project_Loop; end if; end loop Dir_Loop; end if; end loop Project_Loop; end if; if not OK then Data.Library_Dir := No_Name; Data.Display_Library_Dir := No_Name; elsif Current_Verbosity = High then -- Display the Library directory in high verbosity Write_Str ("Library directory ="""); Write_Str (Get_Name_String (Data.Display_Library_Dir)); Write_Line (""""); end if; end; end if; end if; pragma Assert (Lib_Name.Kind = Single); if Lib_Name.Value = Empty_String then if Current_Verbosity = High and then Data.Library_Name = No_Name then Write_Line ("No library name"); end if; else -- There is no restriction on the syntax of library names Data.Library_Name := Lib_Name.Value; end if; if Data.Library_Name /= No_Name and then Current_Verbosity = High then Write_Str ("Library name = """); Write_Str (Get_Name_String (Data.Library_Name)); Write_Line (""""); end if; Data.Library := Data.Library_Dir /= No_Name and then Data.Library_Name /= No_Name; if Data.Library then if MLib.Tgt.Support_For_Libraries = MLib.Tgt.None then Error_Msg (Project, In_Tree, "?libraries are not supported on this platform", Lib_Name.Location); Data.Library := False; else if Lib_ALI_Dir.Value = Empty_String then if Current_Verbosity = High then Write_Line ("No library 'A'L'I directory specified"); end if; Data.Library_ALI_Dir := Data.Library_Dir; Data.Display_Library_ALI_Dir := Data.Display_Library_Dir; else -- Find path name, check that it is a directory Locate_Directory (Lib_ALI_Dir.Value, Data.Display_Directory, Data.Library_ALI_Dir, Data.Display_Library_ALI_Dir); if Data.Library_ALI_Dir = No_Name then -- Get the absolute name of the library ALI directory that -- does not exist, to report an error. declare Dir_Name : constant String := Get_Name_String (Lib_ALI_Dir.Value); begin if Is_Absolute_Path (Dir_Name) then Err_Vars.Error_Msg_Name_1 := Lib_Dir.Value; else Get_Name_String (Data.Display_Directory); if Name_Buffer (Name_Len) /= Directory_Separator then Name_Len := Name_Len + 1; Name_Buffer (Name_Len) := Directory_Separator; end if; Name_Buffer (Name_Len + 1 .. Name_Len + Dir_Name'Length) := Dir_Name; Name_Len := Name_Len + Dir_Name'Length; Err_Vars.Error_Msg_Name_1 := Name_Find; end if; -- Report the error Error_Msg (Project, In_Tree, "library 'A'L'I directory { does not exist", Lib_ALI_Dir.Location); end; end if; if Data.Library_ALI_Dir /= Data.Library_Dir then -- The library ALI directory cannot be the same as the -- Object directory. if Data.Library_ALI_Dir = Data.Object_Directory then Error_Msg (Project, In_Tree, "library 'A'L'I directory cannot be the same " & "as object directory", Lib_ALI_Dir.Location); Data.Library_ALI_Dir := No_Name; Data.Display_Library_ALI_Dir := No_Name; else declare OK : Boolean := True; Dirs_Id : String_List_Id; Dir_Elem : String_Element; begin -- The library ALI directory cannot be the same as -- a source directory of the current project. Dirs_Id := Data.Source_Dirs; while Dirs_Id /= Nil_String loop Dir_Elem := In_Tree.String_Elements.Table (Dirs_Id); Dirs_Id := Dir_Elem.Next; if Data.Library_ALI_Dir = Dir_Elem.Value then Err_Vars.Error_Msg_Name_1 := Dir_Elem.Value; Error_Msg (Project, In_Tree, "library 'A'L'I directory cannot be " & "the same as source directory {", Lib_ALI_Dir.Location); OK := False; exit; end if; end loop; if OK then -- The library ALI directory cannot be the same as -- a source directory of another project either. ALI_Project_Loop : for Pid in 1 .. Project_Table.Last (In_Tree.Projects) loop if Pid /= Project then Dirs_Id := In_Tree.Projects.Table (Pid).Source_Dirs; ALI_Dir_Loop : while Dirs_Id /= Nil_String loop Dir_Elem := In_Tree.String_Elements.Table (Dirs_Id); Dirs_Id := Dir_Elem.Next; if Data.Library_ALI_Dir = Dir_Elem.Value then Err_Vars.Error_Msg_Name_1 := Dir_Elem.Value; Err_Vars.Error_Msg_Name_2 := In_Tree.Projects.Table (Pid).Name; Error_Msg (Project, In_Tree, "library 'A'L'I directory cannot " & "be the same as source directory " & "{ of project {", Lib_ALI_Dir.Location); OK := False; exit ALI_Project_Loop; end if; end loop ALI_Dir_Loop; end if; end loop ALI_Project_Loop; end if; if not OK then Data.Library_ALI_Dir := No_Name; Data.Display_Library_ALI_Dir := No_Name; elsif Current_Verbosity = High then -- Display the Library ALI directory in high -- verbosity. Write_Str ("Library ALI directory ="""); Write_Str (Get_Name_String (Data.Display_Library_ALI_Dir)); Write_Line (""""); end if; end; end if; end if; end if; pragma Assert (Lib_Version.Kind = Single); if Lib_Version.Value = Empty_String then if Current_Verbosity = High then Write_Line ("No library version specified"); end if; else Data.Lib_Internal_Name := Lib_Version.Value; end if; pragma Assert (The_Lib_Kind.Kind = Single); if The_Lib_Kind.Value = Empty_String then if Current_Verbosity = High then Write_Line ("No library kind specified"); end if; else Get_Name_String (The_Lib_Kind.Value); declare Kind_Name : constant String := To_Lower (Name_Buffer (1 .. Name_Len)); OK : Boolean := True; begin if Kind_Name = "static" then Data.Library_Kind := Static; elsif Kind_Name = "dynamic" then Data.Library_Kind := Dynamic; elsif Kind_Name = "relocatable" then Data.Library_Kind := Relocatable; else Error_Msg (Project, In_Tree, "illegal value for Library_Kind", The_Lib_Kind.Location); OK := False; end if; if Current_Verbosity = High and then OK then Write_Str ("Library kind = "); Write_Line (Kind_Name); end if; if Data.Library_Kind /= Static and then MLib.Tgt.Support_For_Libraries = MLib.Tgt.Static_Only then Error_Msg (Project, In_Tree, "only static libraries are supported " & "on this platform", The_Lib_Kind.Location); Data.Library := False; end if; end; end if; if Data.Library and then Current_Verbosity = High then Write_Line ("This is a library project file"); end if; end if; end if; end Check_Library_Attributes; -------------------------- -- Check_Package_Naming -- -------------------------- procedure Check_Package_Naming (Project : Project_Id; In_Tree : Project_Tree_Ref; Data : in out Project_Data) is Naming_Id : constant Package_Id := Util.Value_Of (Name_Naming, Data.Decl.Packages, In_Tree); Naming : Package_Element; begin -- If there is a package Naming, we will put in Data.Naming -- what is in this package Naming. if Naming_Id /= No_Package then Naming := In_Tree.Packages.Table (Naming_Id); if Current_Verbosity = High then Write_Line ("Checking ""Naming""."); end if; -- Check Spec_Suffix declare Spec_Suffixs : Array_Element_Id := Util.Value_Of (Name_Spec_Suffix, Naming.Decl.Arrays, In_Tree); Suffix : Array_Element_Id; Element : Array_Element; Suffix2 : Array_Element_Id; begin -- If some suffixs have been specified, we make sure that -- for each language for which a default suffix has been -- specified, there is a suffix specified, either the one -- in the project file or if there were none, the default. if Spec_Suffixs /= No_Array_Element then Suffix := Data.Naming.Spec_Suffix; while Suffix /= No_Array_Element loop Element := In_Tree.Array_Elements.Table (Suffix); Suffix2 := Spec_Suffixs; while Suffix2 /= No_Array_Element loop exit when In_Tree.Array_Elements.Table (Suffix2).Index = Element.Index; Suffix2 := In_Tree.Array_Elements.Table (Suffix2).Next; end loop; -- There is a registered default suffix, but no -- suffix specified in the project file. -- Add the default to the array. if Suffix2 = No_Array_Element then Array_Element_Table.Increment_Last (In_Tree.Array_Elements); In_Tree.Array_Elements.Table (Array_Element_Table.Last (In_Tree.Array_Elements)) := (Index => Element.Index, Src_Index => Element.Src_Index, Index_Case_Sensitive => False, Value => Element.Value, Next => Spec_Suffixs); Spec_Suffixs := Array_Element_Table.Last (In_Tree.Array_Elements); end if; Suffix := Element.Next; end loop; -- Put the resulting array as the specification suffixs Data.Naming.Spec_Suffix := Spec_Suffixs; end if; end; declare Current : Array_Element_Id := Data.Naming.Spec_Suffix; Element : Array_Element; begin while Current /= No_Array_Element loop Element := In_Tree.Array_Elements.Table (Current); Get_Name_String (Element.Value.Value); if Name_Len = 0 then Error_Msg (Project, In_Tree, "Spec_Suffix cannot be empty", Element.Value.Location); end if; In_Tree.Array_Elements.Table (Current) := Element; Current := Element.Next; end loop; end; -- Check Body_Suffix declare Impl_Suffixs : Array_Element_Id := Util.Value_Of (Name_Body_Suffix, Naming.Decl.Arrays, In_Tree); Suffix : Array_Element_Id; Element : Array_Element; Suffix2 : Array_Element_Id; begin -- If some suffixes have been specified, we make sure that -- for each language for which a default suffix has been -- specified, there is a suffix specified, either the one -- in the project file or if there were noe, the default. if Impl_Suffixs /= No_Array_Element then Suffix := Data.Naming.Body_Suffix; while Suffix /= No_Array_Element loop Element := In_Tree.Array_Elements.Table (Suffix); Suffix2 := Impl_Suffixs; while Suffix2 /= No_Array_Element loop exit when In_Tree.Array_Elements.Table (Suffix2).Index = Element.Index; Suffix2 := In_Tree.Array_Elements.Table (Suffix2).Next; end loop; -- There is a registered default suffix, but no suffix was -- specified in the project file. Add the default to the -- array. if Suffix2 = No_Array_Element then Array_Element_Table.Increment_Last (In_Tree.Array_Elements); In_Tree.Array_Elements.Table (Array_Element_Table.Last (In_Tree.Array_Elements)) := (Index => Element.Index, Src_Index => Element.Src_Index, Index_Case_Sensitive => False, Value => Element.Value, Next => Impl_Suffixs); Impl_Suffixs := Array_Element_Table.Last (In_Tree.Array_Elements); end if; Suffix := Element.Next; end loop; -- Put the resulting array as the implementation suffixs Data.Naming.Body_Suffix := Impl_Suffixs; end if; end; declare Current : Array_Element_Id := Data.Naming.Body_Suffix; Element : Array_Element; begin while Current /= No_Array_Element loop Element := In_Tree.Array_Elements.Table (Current); Get_Name_String (Element.Value.Value); if Name_Len = 0 then Error_Msg (Project, In_Tree, "Body_Suffix cannot be empty", Element.Value.Location); end if; In_Tree.Array_Elements.Table (Current) := Element; Current := Element.Next; end loop; end; -- Get the exceptions, if any Data.Naming.Specification_Exceptions := Util.Value_Of (Name_Specification_Exceptions, In_Arrays => Naming.Decl.Arrays, In_Tree => In_Tree); Data.Naming.Implementation_Exceptions := Util.Value_Of (Name_Implementation_Exceptions, In_Arrays => Naming.Decl.Arrays, In_Tree => In_Tree); end if; end Check_Package_Naming; --------------------------------- -- Check_Programming_Languages -- --------------------------------- procedure Check_Programming_Languages (In_Tree : Project_Tree_Ref; Data : in out Project_Data) is Languages : Variable_Value := Nil_Variable_Value; begin Languages := Prj.Util.Value_Of (Name_Languages, Data.Decl.Attributes, In_Tree); Data.Ada_Sources_Present := Data.Source_Dirs /= Nil_String; Data.Other_Sources_Present := Data.Source_Dirs /= Nil_String; if Data.Source_Dirs /= Nil_String then -- Check if languages are specified in this project if Languages.Default then -- Attribute Languages is not specified. So, it defaults to -- a project of language Ada only. Data.Languages (Ada_Language_Index) := True; -- No sources of languages other than Ada Data.Other_Sources_Present := False; else declare Current : String_List_Id := Languages.Values; Element : String_Element; Lang_Name : Name_Id; Index : Language_Index; begin -- Assume that there is no language specified yet Data.Other_Sources_Present := False; Data.Ada_Sources_Present := False; -- Look through all the languages specified in attribute -- Languages, if any while Current /= Nil_String loop Element := In_Tree.String_Elements.Table (Current); Get_Name_String (Element.Value); To_Lower (Name_Buffer (1 .. Name_Len)); Lang_Name := Name_Find; Index := Language_Indexes.Get (Lang_Name); if Index = No_Language_Index then Add_Language_Name (Lang_Name); Index := Last_Language_Index; end if; Set (Index, True, Data, In_Tree); Set (Language_Processing => Default_Language_Processing_Data, For_Language => Index, In_Project => Data, In_Tree => In_Tree); if Index = Ada_Language_Index then Data.Ada_Sources_Present := True; else Data.Other_Sources_Present := True; end if; Current := Element.Next; end loop; end; end if; end if; end Check_Programming_Languages; ------------------- -- Check_Project -- ------------------- function Check_Project (P : Project_Id; Root_Project : Project_Id; In_Tree : Project_Tree_Ref; Extending : Boolean) return Boolean is begin if P = Root_Project then return True; elsif Extending then declare Data : Project_Data := In_Tree.Projects.Table (Root_Project); begin while Data.Extends /= No_Project loop if P = Data.Extends then return True; end if; Data := In_Tree.Projects.Table (Data.Extends); end loop; end; end if; return False; end Check_Project; ------------------------------- -- Check_Stand_Alone_Library -- ------------------------------- procedure Check_Stand_Alone_Library (Project : Project_Id; In_Tree : Project_Tree_Ref; Data : in out Project_Data; Extending : Boolean) is Lib_Interfaces : constant Prj.Variable_Value := Prj.Util.Value_Of (Snames.Name_Library_Interface, Data.Decl.Attributes, In_Tree); Lib_Auto_Init : constant Prj.Variable_Value := Prj.Util.Value_Of (Snames.Name_Library_Auto_Init, Data.Decl.Attributes, In_Tree); Lib_Src_Dir : constant Prj.Variable_Value := Prj.Util.Value_Of (Snames.Name_Library_Src_Dir, Data.Decl.Attributes, In_Tree); Lib_Symbol_File : constant Prj.Variable_Value := Prj.Util.Value_Of (Snames.Name_Library_Symbol_File, Data.Decl.Attributes, In_Tree); Lib_Symbol_Policy : constant Prj.Variable_Value := Prj.Util.Value_Of (Snames.Name_Library_Symbol_Policy, Data.Decl.Attributes, In_Tree); Lib_Ref_Symbol_File : constant Prj.Variable_Value := Prj.Util.Value_Of (Snames.Name_Library_Reference_Symbol_File, Data.Decl.Attributes, In_Tree); Auto_Init_Supported : constant Boolean := MLib.Tgt. Standalone_Library_Auto_Init_Is_Supported; OK : Boolean := True; begin pragma Assert (Lib_Interfaces.Kind = List); -- It is a stand-alone library project file if attribute -- Library_Interface is defined. if not Lib_Interfaces.Default then SAL_Library : declare Interfaces : String_List_Id := Lib_Interfaces.Values; Interface_ALIs : String_List_Id := Nil_String; Unit : Name_Id; The_Unit_Id : Unit_Id; The_Unit_Data : Unit_Data; procedure Add_ALI_For (Source : Name_Id); -- Add an ALI file name to the list of Interface ALIs ----------------- -- Add_ALI_For -- ----------------- procedure Add_ALI_For (Source : Name_Id) is begin Get_Name_String (Source); declare ALI : constant String := ALI_File_Name (Name_Buffer (1 .. Name_Len)); ALI_Name_Id : Name_Id; begin Name_Len := ALI'Length; Name_Buffer (1 .. Name_Len) := ALI; ALI_Name_Id := Name_Find; String_Element_Table.Increment_Last (In_Tree.String_Elements); In_Tree.String_Elements.Table (String_Element_Table.Last (In_Tree.String_Elements)) := (Value => ALI_Name_Id, Index => 0, Display_Value => ALI_Name_Id, Location => In_Tree.String_Elements.Table (Interfaces).Location, Flag => False, Next => Interface_ALIs); Interface_ALIs := String_Element_Table.Last (In_Tree.String_Elements); end; end Add_ALI_For; -- Start of processing for SAL_Library begin Data.Standalone_Library := True; -- Library_Interface cannot be an empty list if Interfaces = Nil_String then Error_Msg (Project, In_Tree, "Library_Interface cannot be an empty list", Lib_Interfaces.Location); end if; -- Process each unit name specified in the attribute -- Library_Interface. while Interfaces /= Nil_String loop Get_Name_String (In_Tree.String_Elements.Table (Interfaces).Value); To_Lower (Name_Buffer (1 .. Name_Len)); if Name_Len = 0 then Error_Msg (Project, In_Tree, "an interface cannot be an empty string", In_Tree.String_Elements.Table (Interfaces).Location); else Unit := Name_Find; Error_Msg_Name_1 := Unit; The_Unit_Id := Units_Htable.Get (In_Tree.Units_HT, Unit); if The_Unit_Id = No_Unit then Error_Msg (Project, In_Tree, "unknown unit {", In_Tree.String_Elements.Table (Interfaces).Location); else -- Check that the unit is part of the project The_Unit_Data := In_Tree.Units.Table (The_Unit_Id); if The_Unit_Data.File_Names (Body_Part).Name /= No_Name and then The_Unit_Data.File_Names (Body_Part).Path /= Slash then if Check_Project (The_Unit_Data.File_Names (Body_Part).Project, Project, In_Tree, Extending) then -- There is a body for this unit. -- If there is no spec, we need to check -- that it is not a subunit. if The_Unit_Data.File_Names (Specification).Name = No_Name then declare Src_Ind : Source_File_Index; begin Src_Ind := Sinput.P.Load_Project_File (Get_Name_String (The_Unit_Data.File_Names (Body_Part).Path)); if Sinput.P.Source_File_Is_Subunit (Src_Ind) then Error_Msg (Project, In_Tree, "{ is a subunit; " & "it cannot be an interface", In_Tree. String_Elements.Table (Interfaces).Location); end if; end; end if; -- The unit is not a subunit, so we add -- to the Interface ALIs the ALI file -- corresponding to the body. Add_ALI_For (The_Unit_Data.File_Names (Body_Part).Name); else Error_Msg (Project, In_Tree, "{ is not an unit of this project", In_Tree.String_Elements.Table (Interfaces).Location); end if; elsif The_Unit_Data.File_Names (Specification).Name /= No_Name and then The_Unit_Data.File_Names (Specification).Path /= Slash and then Check_Project (The_Unit_Data.File_Names (Specification).Project, Project, In_Tree, Extending) then -- The unit is part of the project, it has -- a spec, but no body. We add to the Interface -- ALIs the ALI file corresponding to the spec. Add_ALI_For (The_Unit_Data.File_Names (Specification).Name); else Error_Msg (Project, In_Tree, "{ is not an unit of this project", In_Tree.String_Elements.Table (Interfaces).Location); end if; end if; end if; Interfaces := In_Tree.String_Elements.Table (Interfaces).Next; end loop; -- Put the list of Interface ALIs in the project data Data.Lib_Interface_ALIs := Interface_ALIs; -- Check value of attribute Library_Auto_Init and set -- Lib_Auto_Init accordingly. if Lib_Auto_Init.Default then -- If no attribute Library_Auto_Init is declared, then -- set auto init only if it is supported. Data.Lib_Auto_Init := Auto_Init_Supported; else Get_Name_String (Lib_Auto_Init.Value); To_Lower (Name_Buffer (1 .. Name_Len)); if Name_Buffer (1 .. Name_Len) = "false" then Data.Lib_Auto_Init := False; elsif Name_Buffer (1 .. Name_Len) = "true" then if Auto_Init_Supported then Data.Lib_Auto_Init := True; else -- Library_Auto_Init cannot be "true" if auto init -- is not supported Error_Msg (Project, In_Tree, "library auto init not supported " & "on this platform", Lib_Auto_Init.Location); end if; else Error_Msg (Project, In_Tree, "invalid value for attribute Library_Auto_Init", Lib_Auto_Init.Location); end if; end if; end SAL_Library; -- If attribute Library_Src_Dir is defined and not the -- empty string, check if the directory exist and is not -- the object directory or one of the source directories. -- This is the directory where copies of the interface -- sources will be copied. Note that this directory may be -- the library directory. if Lib_Src_Dir.Value /= Empty_String then declare Dir_Id : constant Name_Id := Lib_Src_Dir.Value; begin Locate_Directory (Dir_Id, Data.Display_Directory, Data.Library_Src_Dir, Data.Display_Library_Src_Dir); -- If directory does not exist, report an error if Data.Library_Src_Dir = No_Name then -- Get the absolute name of the library directory -- that does not exist, to report an error. declare Dir_Name : constant String := Get_Name_String (Dir_Id); begin if Is_Absolute_Path (Dir_Name) then Err_Vars.Error_Msg_Name_1 := Dir_Id; else Get_Name_String (Data.Directory); if Name_Buffer (Name_Len) /= Directory_Separator then Name_Len := Name_Len + 1; Name_Buffer (Name_Len) := Directory_Separator; end if; Name_Buffer (Name_Len + 1 .. Name_Len + Dir_Name'Length) := Dir_Name; Name_Len := Name_Len + Dir_Name'Length; Err_Vars.Error_Msg_Name_1 := Name_Find; end if; -- Report the error Error_Msg (Project, In_Tree, "Directory { does not exist", Lib_Src_Dir.Location); end; -- Report an error if it is the same as the object -- directory. elsif Data.Library_Src_Dir = Data.Object_Directory then Error_Msg (Project, In_Tree, "directory to copy interfaces cannot be " & "the object directory", Lib_Src_Dir.Location); Data.Library_Src_Dir := No_Name; else declare Src_Dirs : String_List_Id; Src_Dir : String_Element; begin -- Interface copy directory cannot be one of the source -- directory of the current project. Src_Dirs := Data.Source_Dirs; while Src_Dirs /= Nil_String loop Src_Dir := In_Tree.String_Elements.Table (Src_Dirs); -- Report error if it is one of the source directories if Data.Library_Src_Dir = Src_Dir.Value then Error_Msg (Project, In_Tree, "directory to copy interfaces cannot " & "be one of the source directories", Lib_Src_Dir.Location); Data.Library_Src_Dir := No_Name; exit; end if; Src_Dirs := Src_Dir.Next; end loop; if Data.Library_Src_Dir /= No_Name then -- It cannot be a source directory of any other -- project either. Project_Loop : for Pid in 1 .. Project_Table.Last (In_Tree.Projects) loop Src_Dirs := In_Tree.Projects.Table (Pid).Source_Dirs; Dir_Loop : while Src_Dirs /= Nil_String loop Src_Dir := In_Tree.String_Elements.Table (Src_Dirs); -- Report error if it is one of the source -- directories if Data.Library_Src_Dir = Src_Dir.Value then Error_Msg_Name_1 := Src_Dir.Value; Error_Msg_Name_2 := In_Tree.Projects.Table (Pid).Name; Error_Msg (Project, In_Tree, "directory to copy interfaces cannot " & "be the same as source directory { of " & "project {", Lib_Src_Dir.Location); Data.Library_Src_Dir := No_Name; exit Project_Loop; end if; Src_Dirs := Src_Dir.Next; end loop Dir_Loop; end loop Project_Loop; end if; end; -- In high verbosity, if there is a valid Library_Src_Dir, -- display its path name. if Data.Library_Src_Dir /= No_Name and then Current_Verbosity = High then Write_Str ("Directory to copy interfaces ="""); Write_Str (Get_Name_String (Data.Library_Src_Dir)); Write_Line (""""); end if; end if; end; end if; -- Check the symbol related attributes -- First, the symbol policy if not Lib_Symbol_Policy.Default then declare Value : constant String := To_Lower (Get_Name_String (Lib_Symbol_Policy.Value)); begin -- Symbol policy must hove one of a limited number of values if Value = "autonomous" or else Value = "default" then Data.Symbol_Data.Symbol_Policy := Autonomous; elsif Value = "compliant" then Data.Symbol_Data.Symbol_Policy := Compliant; elsif Value = "controlled" then Data.Symbol_Data.Symbol_Policy := Controlled; elsif Value = "restricted" then Data.Symbol_Data.Symbol_Policy := Restricted; else Error_Msg (Project, In_Tree, "illegal value for Library_Symbol_Policy", Lib_Symbol_Policy.Location); end if; end; end if; -- If attribute Library_Symbol_File is not specified, symbol policy -- cannot be Restricted. if Lib_Symbol_File.Default then if Data.Symbol_Data.Symbol_Policy = Restricted then Error_Msg (Project, In_Tree, "Library_Symbol_File needs to be defined when " & "symbol policy is Restricted", Lib_Symbol_Policy.Location); end if; else -- Library_Symbol_File is defined. Check that the file exists Data.Symbol_Data.Symbol_File := Lib_Symbol_File.Value; Get_Name_String (Lib_Symbol_File.Value); if Name_Len = 0 then Error_Msg (Project, In_Tree, "symbol file name cannot be an empty string", Lib_Symbol_File.Location); else OK := not Is_Absolute_Path (Name_Buffer (1 .. Name_Len)); if OK then for J in 1 .. Name_Len loop if Name_Buffer (J) = '/' or else Name_Buffer (J) = Directory_Separator then OK := False; exit; end if; end loop; end if; if not OK then Error_Msg_Name_1 := Lib_Symbol_File.Value; Error_Msg (Project, In_Tree, "symbol file name { is illegal. " & "Name canot include directory info.", Lib_Symbol_File.Location); end if; end if; end if; -- If attribute Library_Reference_Symbol_File is not defined, -- symbol policy cannot be Compilant or Controlled. if Lib_Ref_Symbol_File.Default then if Data.Symbol_Data.Symbol_Policy = Compliant or else Data.Symbol_Data.Symbol_Policy = Controlled then Error_Msg (Project, In_Tree, "a reference symbol file need to be defined", Lib_Symbol_Policy.Location); end if; else -- Library_Reference_Symbol_File is defined, check file exists Data.Symbol_Data.Reference := Lib_Ref_Symbol_File.Value; Get_Name_String (Lib_Ref_Symbol_File.Value); if Name_Len = 0 then Error_Msg (Project, In_Tree, "reference symbol file name cannot be an empty string", Lib_Symbol_File.Location); else OK := not Is_Absolute_Path (Name_Buffer (1 .. Name_Len)); if OK then for J in 1 .. Name_Len loop if Name_Buffer (J) = '/' or else Name_Buffer (J) = Directory_Separator then OK := False; exit; end if; end loop; end if; if not OK then Error_Msg_Name_1 := Lib_Ref_Symbol_File.Value; Error_Msg (Project, In_Tree, "reference symbol file { name is illegal. " & "Name canot include directory info.", Lib_Ref_Symbol_File.Location); end if; if not Is_Regular_File (Get_Name_String (Data.Object_Directory) & Directory_Separator & Get_Name_String (Lib_Ref_Symbol_File.Value)) then Error_Msg_Name_1 := Lib_Ref_Symbol_File.Value; -- For controlled symbol policy, it is an error if the -- reference symbol file does not exist. For other symbol -- policies, this is just a warning Error_Msg_Warn := Data.Symbol_Data.Symbol_Policy /= Controlled; Error_Msg (Project, In_Tree, "<library reference symbol file { does not exist", Lib_Ref_Symbol_File.Location); -- In addition in the non-controlled case, if symbol policy -- is Compliant, it is changed to Autonomous, because there -- is no reference to check against, and we don't want to -- fail in this case. if Data.Symbol_Data.Symbol_Policy /= Controlled then if Data.Symbol_Data.Symbol_Policy = Compliant then Data.Symbol_Data.Symbol_Policy := Autonomous; end if; end if; end if; end if; end if; end if; end Check_Stand_Alone_Library; ---------------------------- -- Compute_Directory_Last -- ---------------------------- function Compute_Directory_Last (Dir : String) return Natural is begin if Dir'Length > 1 and then (Dir (Dir'Last - 1) = Directory_Separator or else Dir (Dir'Last - 1) = '/') then return Dir'Last - 1; else return Dir'Last; end if; end Compute_Directory_Last; -------------------- -- Body_Suffix_Of -- -------------------- function Body_Suffix_Of (Language : Language_Index; In_Project : Project_Data; In_Tree : Project_Tree_Ref) return String is Suffix_Id : constant Name_Id := Suffix_Of (Language, In_Project, In_Tree); begin if Suffix_Id /= No_Name then return Get_Name_String (Suffix_Id); else return "." & Get_Name_String (Language_Names.Table (Language)); end if; end Body_Suffix_Of; --------------- -- Error_Msg -- --------------- procedure Error_Msg (Project : Project_Id; In_Tree : Project_Tree_Ref; Msg : String; Flag_Location : Source_Ptr) is Real_Location : Source_Ptr := Flag_Location; Error_Buffer : String (1 .. 5_000); Error_Last : Natural := 0; Msg_Name : Natural := 0; First : Positive := Msg'First; procedure Add (C : Character); -- Add a character to the buffer procedure Add (S : String); -- Add a string to the buffer procedure Add (Id : Name_Id); -- Add a name to the buffer --------- -- Add -- --------- procedure Add (C : Character) is begin Error_Last := Error_Last + 1; Error_Buffer (Error_Last) := C; end Add; procedure Add (S : String) is begin Error_Buffer (Error_Last + 1 .. Error_Last + S'Length) := S; Error_Last := Error_Last + S'Length; end Add; procedure Add (Id : Name_Id) is begin Get_Name_String (Id); Add (Name_Buffer (1 .. Name_Len)); end Add; -- Start of processing for Error_Msg begin -- If location of error is unknown, use the location of the project if Real_Location = No_Location then Real_Location := In_Tree.Projects.Table (Project).Location; end if; if Error_Report = null then Prj.Err.Error_Msg (Msg, Real_Location); return; end if; -- Ignore continuation character if Msg (First) = '\' then First := First + 1; -- Warniung character is always the first one in this package -- this is an undoocumented kludge!!! elsif Msg (First) = '?' then First := First + 1; Add ("Warning: "); elsif Msg (First) = '<' then First := First + 1; if Err_Vars.Error_Msg_Warn then Add ("Warning: "); end if; end if; for Index in First .. Msg'Last loop if Msg (Index) = '{' or else Msg (Index) = '%' then -- Include a name between double quotes Msg_Name := Msg_Name + 1; Add ('"'); case Msg_Name is when 1 => Add (Err_Vars.Error_Msg_Name_1); when 2 => Add (Err_Vars.Error_Msg_Name_2); when 3 => Add (Err_Vars.Error_Msg_Name_3); when others => null; end case; Add ('"'); else Add (Msg (Index)); end if; end loop; Error_Report (Error_Buffer (1 .. Error_Last), Project, In_Tree); end Error_Msg; ------------------ -- Find_Sources -- ------------------ procedure Find_Sources (Project : Project_Id; In_Tree : Project_Tree_Ref; Data : in out Project_Data; For_Language : Language_Index; Follow_Links : Boolean := False) is Source_Dir : String_List_Id := Data.Source_Dirs; Element : String_Element; Dir : Dir_Type; Current_Source : String_List_Id := Nil_String; Source_Recorded : Boolean := False; begin if Current_Verbosity = High then Write_Line ("Looking for sources:"); end if; -- For each subdirectory while Source_Dir /= Nil_String loop begin Source_Recorded := False; Element := In_Tree.String_Elements.Table (Source_Dir); if Element.Value /= No_Name then Get_Name_String (Element.Display_Value); declare Source_Directory : constant String := Name_Buffer (1 .. Name_Len) & Directory_Separator; Dir_Last : constant Natural := Compute_Directory_Last (Source_Directory); begin if Current_Verbosity = High then Write_Str ("Source_Dir = "); Write_Line (Source_Directory); end if; -- We look to every entry in the source directory Open (Dir, Source_Directory (Source_Directory'First .. Dir_Last)); loop Read (Dir, Name_Buffer, Name_Len); if Current_Verbosity = High then Write_Str (" Checking "); Write_Line (Name_Buffer (1 .. Name_Len)); end if; exit when Name_Len = 0; declare File_Name : constant Name_Id := Name_Find; Path : constant String := Normalize_Pathname (Name => Name_Buffer (1 .. Name_Len), Directory => Source_Directory (Source_Directory'First .. Dir_Last), Resolve_Links => Follow_Links, Case_Sensitive => True); Path_Name : Name_Id; begin Name_Len := Path'Length; Name_Buffer (1 .. Name_Len) := Path; Path_Name := Name_Find; if For_Language = Ada_Language_Index then -- We attempt to register it as a source. However, -- there is no error if the file does not contain -- a valid source. But there is an error if we have -- a duplicate unit name. Record_Ada_Source (File_Name => File_Name, Path_Name => Path_Name, Project => Project, In_Tree => In_Tree, Data => Data, Location => No_Location, Current_Source => Current_Source, Source_Recorded => Source_Recorded, Follow_Links => Follow_Links); else Check_For_Source (File_Name => File_Name, Path_Name => Path_Name, Project => Project, In_Tree => In_Tree, Data => Data, Location => No_Location, Language => For_Language, Suffix => Body_Suffix_Of (For_Language, Data, In_Tree), Naming_Exception => False); end if; end; end loop; Close (Dir); end; end if; exception when Directory_Error => null; end; if Source_Recorded then In_Tree.String_Elements.Table (Source_Dir).Flag := True; end if; Source_Dir := Element.Next; end loop; if Current_Verbosity = High then Write_Line ("end Looking for sources."); end if; if For_Language = Ada_Language_Index then -- If we have looked for sources and found none, then -- it is an error, except if it is an extending project. -- If a non extending project is not supposed to contain -- any source, then we never call Find_Sources. if Current_Source /= Nil_String then Data.Ada_Sources_Present := True; elsif Data.Extends = No_Project then Report_No_Ada_Sources (Project, In_Tree, Data.Location); end if; end if; end Find_Sources; -------------------------------- -- Free_Ada_Naming_Exceptions -- -------------------------------- procedure Free_Ada_Naming_Exceptions is begin Ada_Naming_Exception_Table.Set_Last (0); Ada_Naming_Exceptions.Reset; Reverse_Ada_Naming_Exceptions.Reset; end Free_Ada_Naming_Exceptions; --------------------- -- Get_Directories -- --------------------- procedure Get_Directories (Project : Project_Id; In_Tree : Project_Tree_Ref; Data : in out Project_Data) is Object_Dir : constant Variable_Value := Util.Value_Of (Name_Object_Dir, Data.Decl.Attributes, In_Tree); Exec_Dir : constant Variable_Value := Util.Value_Of (Name_Exec_Dir, Data.Decl.Attributes, In_Tree); Source_Dirs : constant Variable_Value := Util.Value_Of (Name_Source_Dirs, Data.Decl.Attributes, In_Tree); Last_Source_Dir : String_List_Id := Nil_String; procedure Find_Source_Dirs (From : Name_Id; Location : Source_Ptr); -- Find one or several source directories, and add them -- to the list of source directories of the project. ---------------------- -- Find_Source_Dirs -- ---------------------- procedure Find_Source_Dirs (From : Name_Id; Location : Source_Ptr) is Directory : constant String := Get_Name_String (From); Element : String_Element; procedure Recursive_Find_Dirs (Path : Name_Id); -- Find all the subdirectories (recursively) of Path and add them -- to the list of source directories of the project. ------------------------- -- Recursive_Find_Dirs -- ------------------------- procedure Recursive_Find_Dirs (Path : Name_Id) is Dir : Dir_Type; Name : String (1 .. 250); Last : Natural; List : String_List_Id := Data.Source_Dirs; Element : String_Element; Found : Boolean := False; Non_Canonical_Path : Name_Id := No_Name; Canonical_Path : Name_Id := No_Name; The_Path : constant String := Normalize_Pathname (Get_Name_String (Path)) & Directory_Separator; The_Path_Last : constant Natural := Compute_Directory_Last (The_Path); begin Name_Len := The_Path_Last - The_Path'First + 1; Name_Buffer (1 .. Name_Len) := The_Path (The_Path'First .. The_Path_Last); Non_Canonical_Path := Name_Find; Get_Name_String (Non_Canonical_Path); Canonical_Case_File_Name (Name_Buffer (1 .. Name_Len)); Canonical_Path := Name_Find; -- To avoid processing the same directory several times, check -- if the directory is already in Recursive_Dirs. If it is, -- then there is nothing to do, just return. If it is not, put -- it there and continue recursive processing. if Recursive_Dirs.Get (Canonical_Path) then return; else Recursive_Dirs.Set (Canonical_Path, True); end if; -- Check if directory is already in list while List /= Nil_String loop Element := In_Tree.String_Elements.Table (List); if Element.Value /= No_Name then Found := Element.Value = Canonical_Path; exit when Found; end if; List := Element.Next; end loop; -- If directory is not already in list, put it there if not Found then if Current_Verbosity = High then Write_Str (" "); Write_Line (The_Path (The_Path'First .. The_Path_Last)); end if; String_Element_Table.Increment_Last (In_Tree.String_Elements); Element := (Value => Canonical_Path, Display_Value => Non_Canonical_Path, Location => No_Location, Flag => False, Next => Nil_String, Index => 0); -- Case of first source directory if Last_Source_Dir = Nil_String then Data.Source_Dirs := String_Element_Table.Last (In_Tree.String_Elements); -- Here we already have source directories else -- Link the previous last to the new one In_Tree.String_Elements.Table (Last_Source_Dir).Next := String_Element_Table.Last (In_Tree.String_Elements); end if; -- And register this source directory as the new last Last_Source_Dir := String_Element_Table.Last (In_Tree.String_Elements); In_Tree.String_Elements.Table (Last_Source_Dir) := Element; end if; -- Now look for subdirectories. We do that even when this -- directory is already in the list, because some of its -- subdirectories may not be in the list yet. Open (Dir, The_Path (The_Path'First .. The_Path_Last)); loop Read (Dir, Name, Last); exit when Last = 0; if Name (1 .. Last) /= "." and then Name (1 .. Last) /= ".." then -- Avoid . and .. directories if Current_Verbosity = High then Write_Str (" Checking "); Write_Line (Name (1 .. Last)); end if; declare Path_Name : constant String := Normalize_Pathname (Name => Name (1 .. Last), Directory => The_Path (The_Path'First .. The_Path_Last), Resolve_Links => False, Case_Sensitive => True); begin if Is_Directory (Path_Name) then -- We have found a new subdirectory, call self Name_Len := Path_Name'Length; Name_Buffer (1 .. Name_Len) := Path_Name; Recursive_Find_Dirs (Name_Find); end if; end; end if; end loop; Close (Dir); exception when Directory_Error => null; end Recursive_Find_Dirs; -- Start of processing for Find_Source_Dirs begin if Current_Verbosity = High then Write_Str ("Find_Source_Dirs ("""); Write_Str (Directory); Write_Line (""")"); end if; -- First, check if we are looking for a directory tree, -- indicated by "/**" at the end. if Directory'Length >= 3 and then Directory (Directory'Last - 1 .. Directory'Last) = "**" and then (Directory (Directory'Last - 2) = '/' or else Directory (Directory'Last - 2) = Directory_Separator) then Data.Known_Order_Of_Source_Dirs := False; Name_Len := Directory'Length - 3; if Name_Len = 0 then -- This is the case of "/**": all directories -- in the file system. Name_Len := 1; Name_Buffer (1) := Directory (Directory'First); else Name_Buffer (1 .. Name_Len) := Directory (Directory'First .. Directory'Last - 3); end if; if Current_Verbosity = High then Write_Str ("Looking for all subdirectories of """); Write_Str (Name_Buffer (1 .. Name_Len)); Write_Line (""""); end if; declare Base_Dir : constant Name_Id := Name_Find; Root_Dir : constant String := Normalize_Pathname (Name => Get_Name_String (Base_Dir), Directory => Get_Name_String (Data.Display_Directory), Resolve_Links => False, Case_Sensitive => True); begin if Root_Dir'Length = 0 then Err_Vars.Error_Msg_Name_1 := Base_Dir; if Location = No_Location then Error_Msg (Project, In_Tree, "{ is not a valid directory.", Data.Location); else Error_Msg (Project, In_Tree, "{ is not a valid directory.", Location); end if; else -- We have an existing directory, we register it and all -- of its subdirectories. if Current_Verbosity = High then Write_Line ("Looking for source directories:"); end if; Name_Len := Root_Dir'Length; Name_Buffer (1 .. Name_Len) := Root_Dir; Recursive_Find_Dirs (Name_Find); if Current_Verbosity = High then Write_Line ("End of looking for source directories."); end if; end if; end; -- We have a single directory else declare Path_Name : Name_Id; Display_Path_Name : Name_Id; begin Locate_Directory (From, Data.Display_Directory, Path_Name, Display_Path_Name); if Path_Name = No_Name then Err_Vars.Error_Msg_Name_1 := From; if Location = No_Location then Error_Msg (Project, In_Tree, "{ is not a valid directory", Data.Location); else Error_Msg (Project, In_Tree, "{ is not a valid directory", Location); end if; else -- As it is an existing directory, we add it to -- the list of directories. String_Element_Table.Increment_Last (In_Tree.String_Elements); Element.Value := Path_Name; Element.Display_Value := Display_Path_Name; if Last_Source_Dir = Nil_String then -- This is the first source directory Data.Source_Dirs := String_Element_Table.Last (In_Tree.String_Elements); else -- We already have source directories, -- link the previous last to the new one. In_Tree.String_Elements.Table (Last_Source_Dir).Next := String_Element_Table.Last (In_Tree.String_Elements); end if; -- And register this source directory as the new last Last_Source_Dir := String_Element_Table.Last (In_Tree.String_Elements); In_Tree.String_Elements.Table (Last_Source_Dir) := Element; end if; end; end if; end Find_Source_Dirs; -- Start of processing for Get_Directories begin if Current_Verbosity = High then Write_Line ("Starting to look for directories"); end if; -- Check the object directory pragma Assert (Object_Dir.Kind = Single, "Object_Dir is not a single string"); -- We set the object directory to its default Data.Object_Directory := Data.Directory; Data.Display_Object_Dir := Data.Display_Directory; if Object_Dir.Value /= Empty_String then Get_Name_String (Object_Dir.Value); if Name_Len = 0 then Error_Msg (Project, In_Tree, "Object_Dir cannot be empty", Object_Dir.Location); else -- We check that the specified object directory does exist Locate_Directory (Object_Dir.Value, Data.Display_Directory, Data.Object_Directory, Data.Display_Object_Dir); if Data.Object_Directory = No_Name then -- The object directory does not exist, report an error Err_Vars.Error_Msg_Name_1 := Object_Dir.Value; Error_Msg (Project, In_Tree, "the object directory { cannot be found", Data.Location); -- Do not keep a nil Object_Directory. Set it to the specified -- (relative or absolute) path. This is for the benefit of -- tools that recover from errors; for example, these tools -- could create the non existent directory. Data.Display_Object_Dir := Object_Dir.Value; Get_Name_String (Object_Dir.Value); Canonical_Case_File_Name (Name_Buffer (1 .. Name_Len)); Data.Object_Directory := Name_Find; end if; end if; end if; if Current_Verbosity = High then if Data.Object_Directory = No_Name then Write_Line ("No object directory"); else Write_Str ("Object directory: """); Write_Str (Get_Name_String (Data.Display_Object_Dir)); Write_Line (""""); end if; end if; -- Check the exec directory pragma Assert (Exec_Dir.Kind = Single, "Exec_Dir is not a single string"); -- We set the object directory to its default Data.Exec_Directory := Data.Object_Directory; Data.Display_Exec_Dir := Data.Display_Object_Dir; if Exec_Dir.Value /= Empty_String then Get_Name_String (Exec_Dir.Value); if Name_Len = 0 then Error_Msg (Project, In_Tree, "Exec_Dir cannot be empty", Exec_Dir.Location); else -- We check that the specified object directory -- does exist. Locate_Directory (Exec_Dir.Value, Data.Directory, Data.Exec_Directory, Data.Display_Exec_Dir); if Data.Exec_Directory = No_Name then Err_Vars.Error_Msg_Name_1 := Exec_Dir.Value; Error_Msg (Project, In_Tree, "the exec directory { cannot be found", Data.Location); end if; end if; end if; if Current_Verbosity = High then if Data.Exec_Directory = No_Name then Write_Line ("No exec directory"); else Write_Str ("Exec directory: """); Write_Str (Get_Name_String (Data.Display_Exec_Dir)); Write_Line (""""); end if; end if; -- Look for the source directories if Current_Verbosity = High then Write_Line ("Starting to look for source directories"); end if; pragma Assert (Source_Dirs.Kind = List, "Source_Dirs is not a list"); if Source_Dirs.Default then -- No Source_Dirs specified: the single source directory -- is the one containing the project file String_Element_Table.Increment_Last (In_Tree.String_Elements); Data.Source_Dirs := String_Element_Table.Last (In_Tree.String_Elements); In_Tree.String_Elements.Table (Data.Source_Dirs) := (Value => Data.Directory, Display_Value => Data.Display_Directory, Location => No_Location, Flag => False, Next => Nil_String, Index => 0); if Current_Verbosity = High then Write_Line ("Single source directory:"); Write_Str (" """); Write_Str (Get_Name_String (Data.Display_Directory)); Write_Line (""""); end if; elsif Source_Dirs.Values = Nil_String then -- If Source_Dirs is an empty string list, this means -- that this project contains no source. For projects that -- don't extend other projects, this also means that there is no -- need for an object directory, if not specified. if Data.Extends = No_Project and then Data.Object_Directory = Data.Directory then Data.Object_Directory := No_Name; end if; Data.Source_Dirs := Nil_String; Data.Ada_Sources_Present := False; Data.Other_Sources_Present := False; else declare Source_Dir : String_List_Id := Source_Dirs.Values; Element : String_Element; begin -- We will find the source directories for each -- element of the list while Source_Dir /= Nil_String loop Element := In_Tree.String_Elements.Table (Source_Dir); Find_Source_Dirs (Element.Value, Element.Location); Source_Dir := Element.Next; end loop; end; end if; if Current_Verbosity = High then Write_Line ("Putting source directories in canonical cases"); end if; declare Current : String_List_Id := Data.Source_Dirs; Element : String_Element; begin while Current /= Nil_String loop Element := In_Tree.String_Elements.Table (Current); if Element.Value /= No_Name then Get_Name_String (Element.Value); Canonical_Case_File_Name (Name_Buffer (1 .. Name_Len)); Element.Value := Name_Find; In_Tree.String_Elements.Table (Current) := Element; end if; Current := Element.Next; end loop; end; end Get_Directories; --------------- -- Get_Mains -- --------------- procedure Get_Mains (Project : Project_Id; In_Tree : Project_Tree_Ref; Data : in out Project_Data) is Mains : constant Variable_Value := Prj.Util.Value_Of (Name_Main, Data.Decl.Attributes, In_Tree); begin Data.Mains := Mains.Values; -- If no Mains were specified, and if we are an extending -- project, inherit the Mains from the project we are extending. if Mains.Default then if Data.Extends /= No_Project then Data.Mains := In_Tree.Projects.Table (Data.Extends).Mains; end if; -- In a library project file, Main cannot be specified elsif Data.Library then Error_Msg (Project, In_Tree, "a library project file cannot have Main specified", Mains.Location); end if; end Get_Mains; --------------------------- -- Get_Sources_From_File -- --------------------------- procedure Get_Sources_From_File (Path : String; Location : Source_Ptr; Project : Project_Id; In_Tree : Project_Tree_Ref) is File : Prj.Util.Text_File; Line : String (1 .. 250); Last : Natural; Source_Name : Name_Id; begin Source_Names.Reset; if Current_Verbosity = High then Write_Str ("Opening """); Write_Str (Path); Write_Line ("""."); end if; -- Open the file Prj.Util.Open (File, Path); if not Prj.Util.Is_Valid (File) then Error_Msg (Project, In_Tree, "file does not exist", Location); else -- Read the lines one by one while not Prj.Util.End_Of_File (File) loop Prj.Util.Get_Line (File, Line, Last); -- A non empty, non comment line should contain a file name if Last /= 0 and then (Last = 1 or else Line (1 .. 2) /= "--") then -- ??? we should check that there is no directory information Name_Len := Last; Name_Buffer (1 .. Name_Len) := Line (1 .. Last); Canonical_Case_File_Name (Name_Buffer (1 .. Name_Len)); Source_Name := Name_Find; Source_Names.Set (K => Source_Name, E => (Name => Source_Name, Location => Location, Found => False)); end if; end loop; Prj.Util.Close (File); end if; end Get_Sources_From_File; -------------- -- Get_Unit -- -------------- procedure Get_Unit (Canonical_File_Name : Name_Id; Naming : Naming_Data; Exception_Id : out Ada_Naming_Exception_Id; Unit_Name : out Name_Id; Unit_Kind : out Spec_Or_Body; Needs_Pragma : out Boolean) is Info_Id : Ada_Naming_Exception_Id := Ada_Naming_Exceptions.Get (Canonical_File_Name); VMS_Name : Name_Id; begin if Info_Id = No_Ada_Naming_Exception then if Hostparm.OpenVMS then VMS_Name := Canonical_File_Name; Get_Name_String (VMS_Name); if Name_Buffer (Name_Len) = '.' then Name_Len := Name_Len - 1; VMS_Name := Name_Find; end if; Info_Id := Ada_Naming_Exceptions.Get (VMS_Name); end if; end if; if Info_Id /= No_Ada_Naming_Exception then Exception_Id := Info_Id; Unit_Name := No_Name; Unit_Kind := Specification; Needs_Pragma := True; return; end if; Needs_Pragma := False; Exception_Id := No_Ada_Naming_Exception; Get_Name_String (Canonical_File_Name); declare File : String := Name_Buffer (1 .. Name_Len); First : constant Positive := File'First; Last : Natural := File'Last; Standard_GNAT : Boolean; begin Standard_GNAT := Naming.Ada_Spec_Suffix = Default_Ada_Spec_Suffix and then Naming.Ada_Body_Suffix = Default_Ada_Body_Suffix; -- Check if the end of the file name is Specification_Append Get_Name_String (Naming.Ada_Spec_Suffix); if File'Length > Name_Len and then File (Last - Name_Len + 1 .. Last) = Name_Buffer (1 .. Name_Len) then -- We have a spec Unit_Kind := Specification; Last := Last - Name_Len; if Current_Verbosity = High then Write_Str (" Specification: "); Write_Line (File (First .. Last)); end if; else Get_Name_String (Naming.Ada_Body_Suffix); -- Check if the end of the file name is Body_Append if File'Length > Name_Len and then File (Last - Name_Len + 1 .. Last) = Name_Buffer (1 .. Name_Len) then -- We have a body Unit_Kind := Body_Part; Last := Last - Name_Len; if Current_Verbosity = High then Write_Str (" Body: "); Write_Line (File (First .. Last)); end if; elsif Naming.Separate_Suffix /= Naming.Ada_Spec_Suffix then Get_Name_String (Naming.Separate_Suffix); -- Check if the end of the file name is Separate_Append if File'Length > Name_Len and then File (Last - Name_Len + 1 .. Last) = Name_Buffer (1 .. Name_Len) then -- We have a separate (a body) Unit_Kind := Body_Part; Last := Last - Name_Len; if Current_Verbosity = High then Write_Str (" Separate: "); Write_Line (File (First .. Last)); end if; else Last := 0; end if; else Last := 0; end if; end if; if Last = 0 then -- This is not a source file Unit_Name := No_Name; Unit_Kind := Specification; if Current_Verbosity = High then Write_Line (" Not a valid file name."); end if; return; end if; Get_Name_String (Naming.Dot_Replacement); Standard_GNAT := Standard_GNAT and then Name_Buffer (1 .. Name_Len) = "-"; if Name_Buffer (1 .. Name_Len) /= "." then -- If Dot_Replacement is not a single dot, then there should -- not be any dot in the name. for Index in First .. Last loop if File (Index) = '.' then if Current_Verbosity = High then Write_Line (" Not a valid file name (some dot not replaced)."); end if; Unit_Name := No_Name; return; end if; end loop; -- Replace the substring Dot_Replacement with dots declare Index : Positive := First; begin while Index <= Last - Name_Len + 1 loop if File (Index .. Index + Name_Len - 1) = Name_Buffer (1 .. Name_Len) then File (Index) := '.'; if Name_Len > 1 and then Index < Last then File (Index + 1 .. Last - Name_Len + 1) := File (Index + Name_Len .. Last); end if; Last := Last - Name_Len + 1; end if; Index := Index + 1; end loop; end; end if; -- Check if the casing is right declare Src : String := File (First .. Last); begin case Naming.Casing is when All_Lower_Case => Fixed.Translate (Source => Src, Mapping => Lower_Case_Map); when All_Upper_Case => Fixed.Translate (Source => Src, Mapping => Upper_Case_Map); when Mixed_Case | Unknown => null; end case; if Src /= File (First .. Last) then if Current_Verbosity = High then Write_Line (" Not a valid file name (casing)."); end if; Unit_Name := No_Name; return; end if; -- We put the name in lower case Fixed.Translate (Source => Src, Mapping => Lower_Case_Map); -- In the standard GNAT naming scheme, check for special cases: -- children or separates of A, G, I or S, and run time sources. if Standard_GNAT and then Src'Length >= 3 then declare S1 : constant Character := Src (Src'First); S2 : constant Character := Src (Src'First + 1); S3 : constant Character := Src (Src'First + 2); begin if S1 = 'a' or else S1 = 'g' or else S1 = 'i' or else S1 = 's' then -- Children or separates of packages A, G, I or S if (OpenVMS_On_Target and then S2 = '_' and then S3 = '_') or else S2 = '~' then Src (Src'First + 1) := '.'; -- If it is potentially a run time source, disable -- filling of the mapping file to avoid warnings. elsif S2 = '.' then Set_Mapping_File_Initial_State_To_Empty; end if; end if; end; end if; if Current_Verbosity = High then Write_Str (" "); Write_Line (Src); end if; -- Now, we check if this name is a valid unit name Check_Ada_Name (Name => Src, Unit => Unit_Name); end; end; end Get_Unit; ---------- -- Hash -- ---------- function Hash (Unit : Unit_Info) return Header_Num is begin return Header_Num (Unit.Unit mod 2048); end Hash; ----------------------- -- Is_Illegal_Suffix -- ----------------------- function Is_Illegal_Suffix (Suffix : String; Dot_Replacement_Is_A_Single_Dot : Boolean) return Boolean is begin if Suffix'Length = 0 or else Index (Suffix, ".") = 0 then return True; end if; -- If dot replacement is a single dot, and first character of -- suffix is also a dot if Dot_Replacement_Is_A_Single_Dot and then Suffix (Suffix'First) = '.' then for Index in Suffix'First + 1 .. Suffix'Last loop -- If there is another dot if Suffix (Index) = '.' then -- It is illegal to have a letter following the initial dot return Is_Letter (Suffix (Suffix'First + 1)); end if; end loop; end if; -- Everything is OK return False; end Is_Illegal_Suffix; ---------------------- -- Locate_Directory -- ---------------------- procedure Locate_Directory (Name : Name_Id; Parent : Name_Id; Dir : out Name_Id; Display : out Name_Id) is The_Name : constant String := Get_Name_String (Name); The_Parent : constant String := Get_Name_String (Parent) & Directory_Separator; The_Parent_Last : constant Natural := Compute_Directory_Last (The_Parent); begin if Current_Verbosity = High then Write_Str ("Locate_Directory ("""); Write_Str (The_Name); Write_Str (""", """); Write_Str (The_Parent); Write_Line (""")"); end if; Dir := No_Name; Display := No_Name; if Is_Absolute_Path (The_Name) then if Is_Directory (The_Name) then declare Normed : constant String := Normalize_Pathname (The_Name, Resolve_Links => False, Case_Sensitive => True); Canonical_Path : constant String := Normalize_Pathname (Normed, Resolve_Links => True, Case_Sensitive => False); begin Name_Len := Normed'Length; Name_Buffer (1 .. Name_Len) := Normed; Display := Name_Find; Name_Len := Canonical_Path'Length; Name_Buffer (1 .. Name_Len) := Canonical_Path; Dir := Name_Find; end; end if; else declare Full_Path : constant String := The_Parent (The_Parent'First .. The_Parent_Last) & The_Name; begin if Is_Directory (Full_Path) then declare Normed : constant String := Normalize_Pathname (Full_Path, Resolve_Links => False, Case_Sensitive => True); Canonical_Path : constant String := Normalize_Pathname (Normed, Resolve_Links => True, Case_Sensitive => False); begin Name_Len := Normed'Length; Name_Buffer (1 .. Name_Len) := Normed; Display := Name_Find; Name_Len := Canonical_Path'Length; Name_Buffer (1 .. Name_Len) := Canonical_Path; Dir := Name_Find; end; end if; end; end if; end Locate_Directory; ---------------------- -- Look_For_Sources -- ---------------------- procedure Look_For_Sources (Project : Project_Id; In_Tree : Project_Tree_Ref; Data : in out Project_Data; Follow_Links : Boolean) is procedure Get_Path_Names_And_Record_Sources (Follow_Links : Boolean); -- Find the path names of the source files in the Source_Names table -- in the source directories and record those that are Ada sources. procedure Get_Sources_From_File (Path : String; Location : Source_Ptr); -- Get the sources of a project from a text file --------------------------------------- -- Get_Path_Names_And_Record_Sources -- --------------------------------------- procedure Get_Path_Names_And_Record_Sources (Follow_Links : Boolean) is Source_Dir : String_List_Id := Data.Source_Dirs; Element : String_Element; Path : Name_Id; Dir : Dir_Type; Name : Name_Id; Canonical_Name : Name_Id; Name_Str : String (1 .. 1_024); Last : Natural := 0; NL : Name_Location; Current_Source : String_List_Id := Nil_String; First_Error : Boolean := True; Source_Recorded : Boolean := False; begin -- We look in all source directories for the file names in the -- hash table Source_Names while Source_Dir /= Nil_String loop Source_Recorded := False; Element := In_Tree.String_Elements.Table (Source_Dir); declare Dir_Path : constant String := Get_Name_String (Element.Value); begin if Current_Verbosity = High then Write_Str ("checking directory """); Write_Str (Dir_Path); Write_Line (""""); end if; Open (Dir, Dir_Path); loop Read (Dir, Name_Str, Last); exit when Last = 0; Name_Len := Last; Name_Buffer (1 .. Name_Len) := Name_Str (1 .. Last); Name := Name_Find; Canonical_Case_File_Name (Name_Str (1 .. Last)); Name_Len := Last; Name_Buffer (1 .. Name_Len) := Name_Str (1 .. Last); Canonical_Name := Name_Find; NL := Source_Names.Get (Canonical_Name); if NL /= No_Name_Location and then not NL.Found then NL.Found := True; Source_Names.Set (Canonical_Name, NL); Name_Len := Dir_Path'Length; Name_Buffer (1 .. Name_Len) := Dir_Path; if Name_Buffer (Name_Len) /= Directory_Separator then Add_Char_To_Name_Buffer (Directory_Separator); end if; Add_Str_To_Name_Buffer (Name_Str (1 .. Last)); Path := Name_Find; if Current_Verbosity = High then Write_Str (" found "); Write_Line (Get_Name_String (Name)); end if; -- Register the source if it is an Ada compilation unit Record_Ada_Source (File_Name => Name, Path_Name => Path, Project => Project, In_Tree => In_Tree, Data => Data, Location => NL.Location, Current_Source => Current_Source, Source_Recorded => Source_Recorded, Follow_Links => Follow_Links); end if; end loop; Close (Dir); end; if Source_Recorded then In_Tree.String_Elements.Table (Source_Dir).Flag := True; end if; Source_Dir := Element.Next; end loop; -- It is an error if a source file name in a source list or -- in a source list file is not found. NL := Source_Names.Get_First; while NL /= No_Name_Location loop if not NL.Found then Err_Vars.Error_Msg_Name_1 := NL.Name; if First_Error then Error_Msg (Project, In_Tree, "source file { cannot be found", NL.Location); First_Error := False; else Error_Msg (Project, In_Tree, "\source file { cannot be found", NL.Location); end if; end if; NL := Source_Names.Get_Next; end loop; end Get_Path_Names_And_Record_Sources; --------------------------- -- Get_Sources_From_File -- --------------------------- procedure Get_Sources_From_File (Path : String; Location : Source_Ptr) is begin -- Get the list of sources from the file and put them in hash table -- Source_Names. Get_Sources_From_File (Path, Location, Project, In_Tree); -- Look in the source directories to find those sources Get_Path_Names_And_Record_Sources (Follow_Links); -- We should have found at least one source. -- If not, report an error/warning. if Data.Sources = Nil_String then Report_No_Ada_Sources (Project, In_Tree, Location); end if; end Get_Sources_From_File; begin if Data.Ada_Sources_Present then declare Sources : constant Variable_Value := Util.Value_Of (Name_Source_Files, Data.Decl.Attributes, In_Tree); Source_List_File : constant Variable_Value := Util.Value_Of (Name_Source_List_File, Data.Decl.Attributes, In_Tree); Locally_Removed : constant Variable_Value := Util.Value_Of (Name_Locally_Removed_Files, Data.Decl.Attributes, In_Tree); begin pragma Assert (Sources.Kind = List, "Source_Files is not a list"); pragma Assert (Source_List_File.Kind = Single, "Source_List_File is not a single string"); if not Sources.Default then if not Source_List_File.Default then Error_Msg (Project, In_Tree, "?both variables source_files and " & "source_list_file are present", Source_List_File.Location); end if; -- Sources is a list of file names declare Current : String_List_Id := Sources.Values; Element : String_Element; Location : Source_Ptr; Name : Name_Id; begin Source_Names.Reset; Data.Ada_Sources_Present := Current /= Nil_String; while Current /= Nil_String loop Element := In_Tree.String_Elements.Table (Current); Get_Name_String (Element.Value); Canonical_Case_File_Name (Name_Buffer (1 .. Name_Len)); Name := Name_Find; -- If the element has no location, then use the -- location of Sources to report possible errors. if Element.Location = No_Location then Location := Sources.Location; else Location := Element.Location; end if; Source_Names.Set (K => Name, E => (Name => Name, Location => Location, Found => False)); Current := Element.Next; end loop; Get_Path_Names_And_Record_Sources (Follow_Links); end; -- No source_files specified -- We check Source_List_File has been specified elsif not Source_List_File.Default then -- Source_List_File is the name of the file -- that contains the source file names declare Source_File_Path_Name : constant String := Path_Name_Of (Source_List_File.Value, Data.Directory); begin if Source_File_Path_Name'Length = 0 then Err_Vars.Error_Msg_Name_1 := Source_List_File.Value; Error_Msg (Project, In_Tree, "file with sources { does not exist", Source_List_File.Location); else Get_Sources_From_File (Source_File_Path_Name, Source_List_File.Location); end if; end; else -- Neither Source_Files nor Source_List_File has been -- specified. Find all the files that satisfy the naming -- scheme in all the source directories. Find_Sources (Project, In_Tree, Data, Ada_Language_Index, Follow_Links); end if; -- If there are sources that are locally removed, mark them as -- such in the Units table. if not Locally_Removed.Default then -- Sources can be locally removed only in extending -- project files. if Data.Extends = No_Project then Error_Msg (Project, In_Tree, "Locally_Removed_Files can only be used " & "in an extending project file", Locally_Removed.Location); else declare Current : String_List_Id := Locally_Removed.Values; Element : String_Element; Location : Source_Ptr; OK : Boolean; Unit : Unit_Data; Name : Name_Id; Extended : Project_Id; begin while Current /= Nil_String loop Element := In_Tree.String_Elements.Table (Current); Get_Name_String (Element.Value); Canonical_Case_File_Name (Name_Buffer (1 .. Name_Len)); Name := Name_Find; -- If the element has no location, then use the -- location of Locally_Removed to report -- possible errors. if Element.Location = No_Location then Location := Locally_Removed.Location; else Location := Element.Location; end if; OK := False; for Index in Unit_Table.First .. Unit_Table.Last (In_Tree.Units) loop Unit := In_Tree.Units.Table (Index); if Unit.File_Names (Specification).Name = Name then OK := True; -- Check that this is from a project that -- the current project extends, but not the -- current project. Extended := Unit.File_Names (Specification).Project; if Extended = Project then Error_Msg (Project, In_Tree, "cannot remove a source " & "of the same project", Location); elsif Project_Extends (Project, Extended, In_Tree) then Unit.File_Names (Specification).Path := Slash; Unit.File_Names (Specification).Needs_Pragma := False; In_Tree.Units.Table (Index) := Unit; Add_Forbidden_File_Name (Unit.File_Names (Specification).Name); exit; else Error_Msg (Project, In_Tree, "cannot remove a source from " & "another project", Location); end if; elsif Unit.File_Names (Body_Part).Name = Name then OK := True; -- Check that this is from a project that -- the current project extends, but not the -- current project. Extended := Unit.File_Names (Body_Part).Project; if Extended = Project then Error_Msg (Project, In_Tree, "cannot remove a source " & "of the same project", Location); elsif Project_Extends (Project, Extended, In_Tree) then Unit.File_Names (Body_Part).Path := Slash; Unit.File_Names (Body_Part).Needs_Pragma := False; In_Tree.Units.Table (Index) := Unit; Add_Forbidden_File_Name (Unit.File_Names (Body_Part).Name); exit; end if; end if; end loop; if not OK then Err_Vars.Error_Msg_Name_1 := Name; Error_Msg (Project, In_Tree, "unknown file {", Location); end if; Current := Element.Next; end loop; end; end if; end if; end; end if; if Data.Other_Sources_Present then -- Set Source_Present to False. It will be set back to True -- whenever a source is found. Data.Other_Sources_Present := False; for Lang in Ada_Language_Index + 1 .. Last_Language_Index loop -- For each language (other than Ada) in the project file if Is_Present (Lang, Data, In_Tree) then -- Reset the indication that there are sources of this -- language. It will be set back to True whenever we find a -- source of the language. Set (Lang, False, Data, In_Tree); -- First, get the source suffix for the language Set (Suffix => Suffix_For (Lang, Data.Naming, In_Tree), For_Language => Lang, In_Project => Data, In_Tree => In_Tree); -- Then, deal with the naming exceptions, if any Source_Names.Reset; declare Naming_Exceptions : constant Variable_Value := Value_Of (Index => Language_Names.Table (Lang), Src_Index => 0, In_Array => Data.Naming.Implementation_Exceptions, In_Tree => In_Tree); Element_Id : String_List_Id; Element : String_Element; File_Id : Name_Id; Source_Found : Boolean := False; begin -- If there are naming exceptions, look through them one -- by one. if Naming_Exceptions /= Nil_Variable_Value then Element_Id := Naming_Exceptions.Values; while Element_Id /= Nil_String loop Element := In_Tree.String_Elements.Table (Element_Id); Get_Name_String (Element.Value); Canonical_Case_File_Name (Name_Buffer (1 .. Name_Len)); File_Id := Name_Find; -- Put each naming exception in the Source_Names -- hash table, but if there are repetition, don't -- bother after the first instance. if Source_Names.Get (File_Id) = No_Name_Location then Source_Found := True; Source_Names.Set (File_Id, (Name => File_Id, Location => Element.Location, Found => False)); end if; Element_Id := Element.Next; end loop; -- If there is at least one naming exception, record -- those that are found in the source directories. if Source_Found then Record_Other_Sources (Project => Project, In_Tree => In_Tree, Data => Data, Language => Lang, Naming_Exceptions => True); end if; end if; end; -- Now, check if a list of sources is declared either through -- a string list (attribute Source_Files) or a text file -- (attribute Source_List_File). If a source list is declared, -- we will consider only those naming exceptions that are -- on the list. declare Sources : constant Variable_Value := Util.Value_Of (Name_Source_Files, Data.Decl.Attributes, In_Tree); Source_List_File : constant Variable_Value := Util.Value_Of (Name_Source_List_File, Data.Decl.Attributes, In_Tree); begin pragma Assert (Sources.Kind = List, "Source_Files is not a list"); pragma Assert (Source_List_File.Kind = Single, "Source_List_File is not a single string"); if not Sources.Default then if not Source_List_File.Default then Error_Msg (Project, In_Tree, "?both variables source_files and " & "source_list_file are present", Source_List_File.Location); end if; -- Sources is a list of file names declare Current : String_List_Id := Sources.Values; Element : String_Element; Location : Source_Ptr; Name : Name_Id; begin Source_Names.Reset; -- Put all the sources in the Source_Names hash table while Current /= Nil_String loop Element := In_Tree.String_Elements.Table (Current); Get_Name_String (Element.Value); Canonical_Case_File_Name (Name_Buffer (1 .. Name_Len)); Name := Name_Find; -- If the element has no location, then use the -- location of Sources to report possible errors. if Element.Location = No_Location then Location := Sources.Location; else Location := Element.Location; end if; Source_Names.Set (K => Name, E => (Name => Name, Location => Location, Found => False)); Current := Element.Next; end loop; -- And look for their directories Record_Other_Sources (Project => Project, In_Tree => In_Tree, Data => Data, Language => Lang, Naming_Exceptions => False); end; -- No source_files specified -- We check if Source_List_File has been specified elsif not Source_List_File.Default then -- Source_List_File is the name of the file -- that contains the source file names declare Source_File_Path_Name : constant String := Path_Name_Of (Source_List_File.Value, Data.Directory); begin if Source_File_Path_Name'Length = 0 then Err_Vars.Error_Msg_Name_1 := Source_List_File.Value; Error_Msg (Project, In_Tree, "file with sources { does not exist", Source_List_File.Location); else -- Read the file, putting each source in the -- Source_Names hash table. Get_Sources_From_File (Source_File_Path_Name, Source_List_File.Location, Project, In_Tree); -- And look for their directories Record_Other_Sources (Project => Project, In_Tree => In_Tree, Data => Data, Language => Lang, Naming_Exceptions => False); end if; end; -- Neither Source_Files nor Source_List_File was specified else -- Find all the files that satisfy the naming scheme in -- all the source directories. All the naming exceptions -- that effectively exist are also part of the source -- of this language. Find_Sources (Project, In_Tree, Data, Lang); end if; end; end if; end loop; end if; end Look_For_Sources; ------------------ -- Path_Name_Of -- ------------------ function Path_Name_Of (File_Name : Name_Id; Directory : Name_Id) return String is Result : String_Access; The_Directory : constant String := Get_Name_String (Directory); begin Get_Name_String (File_Name); Result := Locate_Regular_File (File_Name => Name_Buffer (1 .. Name_Len), Path => The_Directory); if Result = null then return ""; else Canonical_Case_File_Name (Result.all); return Result.all; end if; end Path_Name_Of; ------------------------------- -- Prepare_Ada_Naming_Exceptions -- ------------------------------- procedure Prepare_Ada_Naming_Exceptions (List : Array_Element_Id; In_Tree : Project_Tree_Ref; Kind : Spec_Or_Body) is Current : Array_Element_Id := List; Element : Array_Element; Unit : Unit_Info; begin -- Traverse the list while Current /= No_Array_Element loop Element := In_Tree.Array_Elements.Table (Current); if Element.Index /= No_Name then Unit := (Kind => Kind, Unit => Element.Index, Next => No_Ada_Naming_Exception); Reverse_Ada_Naming_Exceptions.Set (Unit, (Element.Value.Value, Element.Value.Index)); Unit.Next := Ada_Naming_Exceptions.Get (Element.Value.Value); Ada_Naming_Exception_Table.Increment_Last; Ada_Naming_Exception_Table.Table (Ada_Naming_Exception_Table.Last) := Unit; Ada_Naming_Exceptions.Set (Element.Value.Value, Ada_Naming_Exception_Table.Last); end if; Current := Element.Next; end loop; end Prepare_Ada_Naming_Exceptions; --------------------- -- Project_Extends -- --------------------- function Project_Extends (Extending : Project_Id; Extended : Project_Id; In_Tree : Project_Tree_Ref) return Boolean is Current : Project_Id := Extending; begin loop if Current = No_Project then return False; elsif Current = Extended then return True; end if; Current := In_Tree.Projects.Table (Current).Extends; end loop; end Project_Extends; ----------------------- -- Record_Ada_Source -- ----------------------- procedure Record_Ada_Source (File_Name : Name_Id; Path_Name : Name_Id; Project : Project_Id; In_Tree : Project_Tree_Ref; Data : in out Project_Data; Location : Source_Ptr; Current_Source : in out String_List_Id; Source_Recorded : in out Boolean; Follow_Links : Boolean) is Canonical_File_Name : Name_Id; Canonical_Path_Name : Name_Id; Exception_Id : Ada_Naming_Exception_Id; Unit_Name : Name_Id; Unit_Kind : Spec_Or_Body; Unit_Index : Int := 0; Info : Unit_Info; Name_Index : Name_And_Index; Needs_Pragma : Boolean; The_Location : Source_Ptr := Location; Previous_Source : constant String_List_Id := Current_Source; Except_Name : Name_And_Index := No_Name_And_Index; Unit_Prj : Unit_Project; File_Name_Recorded : Boolean := False; begin Get_Name_String (File_Name); Canonical_Case_File_Name (Name_Buffer (1 .. Name_Len)); Canonical_File_Name := Name_Find; declare Canonical_Path : constant String := Normalize_Pathname (Get_Name_String (Path_Name), Resolve_Links => Follow_Links, Case_Sensitive => False); begin Name_Len := 0; Add_Str_To_Name_Buffer (Canonical_Path); Canonical_Path_Name := Name_Find; end; -- Find out the unit name, the unit kind and if it needs -- a specific SFN pragma. Get_Unit (Canonical_File_Name => Canonical_File_Name, Naming => Data.Naming, Exception_Id => Exception_Id, Unit_Name => Unit_Name, Unit_Kind => Unit_Kind, Needs_Pragma => Needs_Pragma); if Exception_Id = No_Ada_Naming_Exception and then Unit_Name = No_Name then if Current_Verbosity = High then Write_Str (" """); Write_Str (Get_Name_String (Canonical_File_Name)); Write_Line (""" is not a valid source file name (ignored)."); end if; else -- Check to see if the source has been hidden by an exception, -- but only if it is not an exception. if not Needs_Pragma then Except_Name := Reverse_Ada_Naming_Exceptions.Get ((Unit_Kind, Unit_Name, No_Ada_Naming_Exception)); if Except_Name /= No_Name_And_Index then if Current_Verbosity = High then Write_Str (" """); Write_Str (Get_Name_String (Canonical_File_Name)); Write_Str (""" contains a unit that is found in """); Write_Str (Get_Name_String (Except_Name.Name)); Write_Line (""" (ignored)."); end if; -- The file is not included in the source of the project, -- because it is hidden by the exception. -- So, there is nothing else to do. return; end if; end if; loop if Exception_Id /= No_Ada_Naming_Exception then Info := Ada_Naming_Exception_Table.Table (Exception_Id); Exception_Id := Info.Next; Info.Next := No_Ada_Naming_Exception; Name_Index := Reverse_Ada_Naming_Exceptions.Get (Info); Unit_Name := Info.Unit; Unit_Index := Name_Index.Index; Unit_Kind := Info.Kind; end if; -- Put the file name in the list of sources of the project if not File_Name_Recorded then String_Element_Table.Increment_Last (In_Tree.String_Elements); In_Tree.String_Elements.Table (String_Element_Table.Last (In_Tree.String_Elements)) := (Value => Canonical_File_Name, Display_Value => File_Name, Location => No_Location, Flag => False, Next => Nil_String, Index => Unit_Index); end if; if Current_Source = Nil_String then Data.Sources := String_Element_Table.Last (In_Tree.String_Elements); else In_Tree.String_Elements.Table (Current_Source).Next := String_Element_Table.Last (In_Tree.String_Elements); end if; Current_Source := String_Element_Table.Last (In_Tree.String_Elements); -- Put the unit in unit list declare The_Unit : Unit_Id := Units_Htable.Get (In_Tree.Units_HT, Unit_Name); The_Unit_Data : Unit_Data; begin if Current_Verbosity = High then Write_Str ("Putting "); Write_Str (Get_Name_String (Unit_Name)); Write_Line (" in the unit list."); end if; -- The unit is already in the list, but may be it is -- only the other unit kind (spec or body), or what is -- in the unit list is a unit of a project we are extending. if The_Unit /= No_Unit then The_Unit_Data := In_Tree.Units.Table (The_Unit); if The_Unit_Data.File_Names (Unit_Kind).Name = No_Name or else Project_Extends (Data.Extends, The_Unit_Data.File_Names (Unit_Kind).Project, In_Tree) then if The_Unit_Data.File_Names (Unit_Kind).Path = Slash then Remove_Forbidden_File_Name (The_Unit_Data.File_Names (Unit_Kind).Name); end if; -- Record the file name in the hash table Files_Htable Unit_Prj := (Unit => The_Unit, Project => Project); Files_Htable.Set (In_Tree.Files_HT, Canonical_File_Name, Unit_Prj); The_Unit_Data.File_Names (Unit_Kind) := (Name => Canonical_File_Name, Index => Unit_Index, Display_Name => File_Name, Path => Canonical_Path_Name, Display_Path => Path_Name, Project => Project, Needs_Pragma => Needs_Pragma); In_Tree.Units.Table (The_Unit) := The_Unit_Data; Source_Recorded := True; elsif The_Unit_Data.File_Names (Unit_Kind).Project = Project and then (Data.Known_Order_Of_Source_Dirs or else The_Unit_Data.File_Names (Unit_Kind).Path = Canonical_Path_Name) then if Previous_Source = Nil_String then Data.Sources := Nil_String; else In_Tree.String_Elements.Table (Previous_Source).Next := Nil_String; String_Element_Table.Decrement_Last (In_Tree.String_Elements); end if; Current_Source := Previous_Source; else -- It is an error to have two units with the same name -- and the same kind (spec or body). if The_Location = No_Location then The_Location := In_Tree.Projects.Table (Project).Location; end if; Err_Vars.Error_Msg_Name_1 := Unit_Name; Error_Msg (Project, In_Tree, "duplicate source {", The_Location); Err_Vars.Error_Msg_Name_1 := In_Tree.Projects.Table (The_Unit_Data.File_Names (Unit_Kind).Project).Name; Err_Vars.Error_Msg_Name_2 := The_Unit_Data.File_Names (Unit_Kind).Path; Error_Msg (Project, In_Tree, "\ project file {, {", The_Location); Err_Vars.Error_Msg_Name_1 := In_Tree.Projects.Table (Project).Name; Err_Vars.Error_Msg_Name_2 := Canonical_Path_Name; Error_Msg (Project, In_Tree, "\ project file {, {", The_Location); end if; -- It is a new unit, create a new record else -- First, check if there is no other unit with this file -- name in another project. If it is, report an error. -- Of course, we do that only for the first unit in the -- source file. Unit_Prj := Files_Htable.Get (In_Tree.Files_HT, Canonical_File_Name); if not File_Name_Recorded and then Unit_Prj /= No_Unit_Project then Error_Msg_Name_1 := File_Name; Error_Msg_Name_2 := In_Tree.Projects.Table (Unit_Prj.Project).Name; Error_Msg (Project, In_Tree, "{ is already a source of project {", Location); else Unit_Table.Increment_Last (In_Tree.Units); The_Unit := Unit_Table.Last (In_Tree.Units); Units_Htable.Set (In_Tree.Units_HT, Unit_Name, The_Unit); Unit_Prj := (Unit => The_Unit, Project => Project); Files_Htable.Set (In_Tree.Files_HT, Canonical_File_Name, Unit_Prj); The_Unit_Data.Name := Unit_Name; The_Unit_Data.File_Names (Unit_Kind) := (Name => Canonical_File_Name, Index => Unit_Index, Display_Name => File_Name, Path => Canonical_Path_Name, Display_Path => Path_Name, Project => Project, Needs_Pragma => Needs_Pragma); In_Tree.Units.Table (The_Unit) := The_Unit_Data; Source_Recorded := True; end if; end if; end; exit when Exception_Id = No_Ada_Naming_Exception; File_Name_Recorded := True; end loop; end if; end Record_Ada_Source; -------------------------- -- Record_Other_Sources -- -------------------------- procedure Record_Other_Sources (Project : Project_Id; In_Tree : Project_Tree_Ref; Data : in out Project_Data; Language : Language_Index; Naming_Exceptions : Boolean) is Source_Dir : String_List_Id := Data.Source_Dirs; Element : String_Element; Path : Name_Id; Dir : Dir_Type; Canonical_Name : Name_Id; Name_Str : String (1 .. 1_024); Last : Natural := 0; NL : Name_Location; First_Error : Boolean := True; Suffix : constant String := Body_Suffix_Of (Language, Data, In_Tree); begin while Source_Dir /= Nil_String loop Element := In_Tree.String_Elements.Table (Source_Dir); declare Dir_Path : constant String := Get_Name_String (Element.Value); begin if Current_Verbosity = High then Write_Str ("checking directory """); Write_Str (Dir_Path); Write_Str (""" for "); if Naming_Exceptions then Write_Str ("naming exceptions"); else Write_Str ("sources"); end if; Write_Str (" of Language "); Display_Language_Name (Language); end if; Open (Dir, Dir_Path); loop Read (Dir, Name_Str, Last); exit when Last = 0; if Is_Regular_File (Dir_Path & Directory_Separator & Name_Str (1 .. Last)) then Name_Len := Last; Name_Buffer (1 .. Name_Len) := Name_Str (1 .. Last); Canonical_Case_File_Name (Name_Buffer (1 .. Name_Len)); Canonical_Name := Name_Find; NL := Source_Names.Get (Canonical_Name); if NL /= No_Name_Location then if NL.Found then if not Data.Known_Order_Of_Source_Dirs then Error_Msg_Name_1 := Canonical_Name; Error_Msg (Project, In_Tree, "{ is found in several source directories", NL.Location); end if; else NL.Found := True; Source_Names.Set (Canonical_Name, NL); Name_Len := Dir_Path'Length; Name_Buffer (1 .. Name_Len) := Dir_Path; Add_Char_To_Name_Buffer (Directory_Separator); Add_Str_To_Name_Buffer (Name_Str (1 .. Last)); Path := Name_Find; Check_For_Source (File_Name => Canonical_Name, Path_Name => Path, Project => Project, In_Tree => In_Tree, Data => Data, Location => NL.Location, Language => Language, Suffix => Suffix, Naming_Exception => Naming_Exceptions); end if; end if; end if; end loop; Close (Dir); end; Source_Dir := Element.Next; end loop; if not Naming_Exceptions then NL := Source_Names.Get_First; -- It is an error if a source file name in a source list or -- in a source list file is not found. while NL /= No_Name_Location loop if not NL.Found then Err_Vars.Error_Msg_Name_1 := NL.Name; if First_Error then Error_Msg (Project, In_Tree, "source file { cannot be found", NL.Location); First_Error := False; else Error_Msg (Project, In_Tree, "\source file { cannot be found", NL.Location); end if; end if; NL := Source_Names.Get_Next; end loop; -- Any naming exception of this language that is not in a list -- of sources must be removed. declare Source_Id : Other_Source_Id := Data.First_Other_Source; Prev_Id : Other_Source_Id := No_Other_Source; Source : Other_Source; begin while Source_Id /= No_Other_Source loop Source := In_Tree.Other_Sources.Table (Source_Id); if Source.Language = Language and then Source.Naming_Exception then if Current_Verbosity = High then Write_Str ("Naming exception """); Write_Str (Get_Name_String (Source.File_Name)); Write_Str (""" is not in the list of sources,"); Write_Line (" so it is removed."); end if; if Prev_Id = No_Other_Source then Data.First_Other_Source := Source.Next; else In_Tree.Other_Sources.Table (Prev_Id).Next := Source.Next; end if; Source_Id := Source.Next; if Source_Id = No_Other_Source then Data.Last_Other_Source := Prev_Id; end if; else Prev_Id := Source_Id; Source_Id := Source.Next; end if; end loop; end; end if; end Record_Other_Sources; --------------------------- -- Report_No_Ada_Sources -- --------------------------- procedure Report_No_Ada_Sources (Project : Project_Id; In_Tree : Project_Tree_Ref; Location : Source_Ptr) is begin case When_No_Sources is when Silent => null; when Warning | Error => Error_Msg_Warn := When_No_Sources = Warning; Error_Msg (Project, In_Tree, "<there are no Ada sources in this project", Location); end case; end Report_No_Ada_Sources; ---------------------- -- Show_Source_Dirs -- ---------------------- procedure Show_Source_Dirs (Project : Project_Id; In_Tree : Project_Tree_Ref) is Current : String_List_Id; Element : String_Element; begin Write_Line ("Source_Dirs:"); Current := In_Tree.Projects.Table (Project).Source_Dirs; while Current /= Nil_String loop Element := In_Tree.String_Elements.Table (Current); Write_Str (" "); Write_Line (Get_Name_String (Element.Value)); Current := Element.Next; end loop; Write_Line ("end Source_Dirs."); end Show_Source_Dirs; ---------------- -- Suffix_For -- ---------------- function Suffix_For (Language : Language_Index; Naming : Naming_Data; In_Tree : Project_Tree_Ref) return Name_Id is Suffix : constant Variable_Value := Value_Of (Index => Language_Names.Table (Language), Src_Index => 0, In_Array => Naming.Body_Suffix, In_Tree => In_Tree); begin -- If no suffix for this language in package Naming, use the default if Suffix = Nil_Variable_Value then Name_Len := 0; case Language is when Ada_Language_Index => Add_Str_To_Name_Buffer (".adb"); when C_Language_Index => Add_Str_To_Name_Buffer (".c"); when C_Plus_Plus_Language_Index => Add_Str_To_Name_Buffer (".cpp"); when others => return No_Name; end case; -- Otherwise use the one specified else Get_Name_String (Suffix.Value); end if; Canonical_Case_File_Name (Name_Buffer (1 .. Name_Len)); return Name_Find; end Suffix_For; ------------------------- -- Warn_If_Not_Sources -- ------------------------- -- comments needed in this body ??? procedure Warn_If_Not_Sources (Project : Project_Id; In_Tree : Project_Tree_Ref; Conventions : Array_Element_Id; Specs : Boolean; Extending : Boolean) is Conv : Array_Element_Id := Conventions; Unit : Name_Id; The_Unit_Id : Unit_Id; The_Unit_Data : Unit_Data; Location : Source_Ptr; begin while Conv /= No_Array_Element loop Unit := In_Tree.Array_Elements.Table (Conv).Index; Error_Msg_Name_1 := Unit; Get_Name_String (Unit); To_Lower (Name_Buffer (1 .. Name_Len)); Unit := Name_Find; The_Unit_Id := Units_Htable.Get (In_Tree.Units_HT, Unit); Location := In_Tree.Array_Elements.Table (Conv).Value.Location; if The_Unit_Id = No_Unit then Error_Msg (Project, In_Tree, "?unknown unit {", Location); else The_Unit_Data := In_Tree.Units.Table (The_Unit_Id); Error_Msg_Name_2 := In_Tree.Array_Elements.Table (Conv).Value.Value; if Specs then if not Check_Project (The_Unit_Data.File_Names (Specification).Project, Project, In_Tree, Extending) then Error_Msg (Project, In_Tree, "?source of spec of unit { ({)" & " cannot be found in this project", Location); end if; else if not Check_Project (The_Unit_Data.File_Names (Body_Part).Project, Project, In_Tree, Extending) then Error_Msg (Project, In_Tree, "?source of body of unit { ({)" & " cannot be found in this project", Location); end if; end if; end if; Conv := In_Tree.Array_Elements.Table (Conv).Next; end loop; end Warn_If_Not_Sources; end Prj.Nmsc;
with Ada.Text_IO; use Ada.Text_IO; with Blade; with C3GA_Utilities; with GA_Maths; with Multivector; use Multivector; with Multivector_Type; procedure Test_Mv is no_bv : Multivector.Multivector := Get_Basis_Vector (Blade.no); e1_bv : Multivector.Multivector := Get_Basis_Vector (Blade.e1); e2_bv : Multivector.Multivector := Get_Basis_Vector (Blade.e2); e3_bv : Multivector.Multivector := Get_Basis_Vector (Blade.e3); ni_bv : Multivector.Multivector := Get_Basis_Vector (Blade.ni); MV : Multivector.Multivector; MV1 : Multivector.Multivector; MV12 : Multivector.Multivector; MV1p2 : Multivector.Multivector; MV13 : Multivector.Multivector; Op23 : Multivector.Multivector; Op23_1 : Multivector.Multivector; Add_1_Op23_1 : Multivector.Multivector; MV_Info : Multivector_Type.MV_Type_Record; begin -- MV_Info := Multivector_Type.Init (MV); -- C3GA_Utilities.Print_Multivector ("New", MV); -- Multivector_Type.Print_Multivector_Info ("Null MV", MV_Info); -- New_Line; -- -- C3GA_Utilities.Print_Multivector ("no", no_bv); -- MV_Info := Multivector_Type.Init (no_bv); -- Put_Line ("Bit count: " & GA_Maths.Unsigned_32 -- 'Image (1) & -- Natural'Image (GA_Maths.Bit_Count (1))); -- Multivector_Type.Print_Multivector_Info ("no", MV_Info); -- -- MV_Info := Multivector_Type.Init (e1_bv); -- C3GA_Utilities.Print_Multivector ("e1", e1_bv); -- Multivector_Type.Print_Multivector_Info ("e1", MV_Info); -- -- C3GA_Utilities.Print_Multivector ("e2", e2_bv); -- MV_Info := Multivector_Type.Init (e2_bv); -- Multivector_Type.Print_Multivector_Info ("e2", MV_Info); -- -- MV_Info := Multivector_Type.Init (e3_bv); -- C3GA_Utilities.Print_Multivector ("e3", e3_bv); -- Multivector_Type.Print_Multivector_Info ("e3", MV_Info); -- -- C3GA_Utilities.Print_Multivector ("ni", ni_bv); -- MV_Info := Multivector_Type.Init (ni_bv); -- Multivector_Type.Print_Multivector_Info ("ni", MV_Info); -- MV1 := e1_bv; C3GA_Utilities.Print_Multivector ("MV = e1", MV1); MV_Info := Multivector_Type.Init (MV1); Multivector_Type.Print_Multivector_Info ("MV = e1", MV_Info); MV1p2 := Add (e1_bv, e2_bv); C3GA_Utilities.Print_Multivector ("e1 + e2", MV1p2); MV_Info := Multivector_Type.Init (MV1p2); Multivector_Type.Print_Multivector_Info ("e1 + e2", MV_Info); MV12 := Outer_Product (e1_bv, e2_bv); C3GA_Utilities.Print_Multivector ("e1 ^ e2", MV12); MV_Info := Multivector_Type.Init (MV12); Multivector_Type.Print_Multivector_Info ("e1 ^ e2", MV_Info); MV13 := Outer_Product (e1_bv, e3_bv); C3GA_Utilities.Print_Multivector ("e1 ^ e3", MV13); MV_Info := Multivector_Type.Init (MV12); Multivector_Type.Print_Multivector_Info ("e1 ^ e3", MV_Info); -- Multivector A = e1.add(e2.op(e3).op(e1)); -- = e1 + (e2^e3)^e1) Op23 := Outer_Product (e2_bv, e3_bv); Op23_1 := Outer_Product (Op23, e1_bv); Add_1_Op23_1 := Add (e1_bv, Op23_1); C3GA_Utilities.Print_Multivector ("e1 + ((e2 ^ e3) ^ e1", Add_1_Op23_1); MV_Info := Multivector_Type.Init (Add_1_Op23_1); Multivector_Type.Print_Multivector_Info ("e1 + ((e2 ^ e3) ^ e1", MV_Info); end Test_Mv;
------------------------------------------------------------------------------ -- -- -- Copyright (C) 2016, AdaCore -- -- -- -- Redistribution and use in source and binary forms, with or without -- -- modification, are permitted provided that the following conditions are -- -- met: -- -- 1. Redistributions of source code must retain the above copyright -- -- notice, this list of conditions and the following disclaimer. -- -- 2. Redistributions in binary form must reproduce the above copyright -- -- notice, this list of conditions and the following disclaimer in -- -- the documentation and/or other materials provided with the -- -- distribution. -- -- 3. Neither the name of STMicroelectronics nor the names of its -- -- contributors may be used to endorse or promote products derived -- -- from this software without specific prior written permission. -- -- -- -- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -- -- "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -- -- LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -- -- A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -- -- HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -- -- SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -- -- LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -- -- DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -- -- THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -- -- (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -- -- OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -- -- -- -- This file is based on: -- -- @file stm32f469i_discovery_audio.c -- -- @author MCD Application Team -- ------------------------------------------------------------------------------ with Ada.Real_Time; use Ada.Real_Time; with HAL; use HAL; with STM32; use STM32; with STM32.Board; use STM32.Board; with STM32.Device; use STM32.Device; with STM32.GPIO; use STM32.GPIO; with STM32.DMA; use STM32.DMA; with STM32.SAI; use STM32.SAI; with STM32.Setup; package body Audio is SAI1_MCLK_A : GPIO_Point renames PG7; SAI1_SCK_A : GPIO_Point renames PE5; SAI1_SD_A : GPIO_Point renames PE6; SAI1_FS_A : GPIO_Point renames PE4; SAI_Pins : constant GPIO_Points := (SAI1_MCLK_A, SAI1_SCK_A, SAI1_SD_A, SAI1_FS_A); SAI_Pins_AF : GPIO_Alternate_Function renames GPIO_AF_SAI1_6; Audio_Reset_Pin : GPIO_Point renames PE2; -- SAI in/out conf SAI_Out_Block : SAI_Block renames Block_A; procedure Set_Audio_Clock (Freq : Audio_Frequency); procedure Initialize_Audio_Out_Pins; procedure Initialize_SAI_Out (Freq : Audio_Frequency); procedure Initialize_Audio_I2C; procedure Reset (This : in out CS43L22_Audio_Device); --------------------- -- Set_Audio_Clock -- --------------------- procedure Set_Audio_Clock (Freq : Audio_Frequency) is begin -- Two groups of frequencies: the 44kHz family and the 48kHz family -- The Actual audio frequency is calculated then with the following -- formula: -- Master_Clock = 256 * FS = SAI_CK / Master_Clock_Divider -- We need to find a value of SAI_CK that allows such integer master -- clock divider case Freq is when Audio_Freq_11kHz | Audio_Freq_22kHz | Audio_Freq_32kHz | Audio_Freq_44kHz => -- HSE/PLLM = 1MHz = PLLI2S VCO Input Configure_SAI_I2S_Clock (Audio_SAI, PLLI2SN => 429, -- VCO Output = 429MHz PLLI2SQ => 2, -- SAI Clk(First level) = 214.5 MHz PLLI2SDIVQ => 19); -- I2S Clk = 215.4 / 19 = 11.289 MHz when Audio_Freq_8kHz | Audio_Freq_16kHz | Audio_Freq_48kHz | Audio_Freq_96kHz => Configure_SAI_I2S_Clock (Audio_SAI, PLLI2SN => 344, -- VCO Output = 344MHz PLLI2SQ => 7, -- SAI Clk(First level) = 49.142 MHz PLLI2SDIVQ => 1); -- I2S Clk = 49.142 MHz end case; end Set_Audio_Clock; ------------------------------- -- Initialize_Audio_Out_Pins -- ------------------------------- procedure Initialize_Audio_Out_Pins is begin Enable_Clock (Audio_Reset_Pin); Configure_IO (Audio_Reset_Pin, (Mode => Mode_Out, Output_Type => Push_Pull, Speed => Speed_High, Resistors => Floating)); Set (Audio_Reset_Pin); Enable_Clock (Audio_SAI); Enable_Clock (SAI_Pins); Configure_IO (SAI_Pins, (Mode => Mode_AF, AF => SAI_Pins_AF, AF_Output_Type => Push_Pull, AF_Speed => Speed_High, Resistors => Floating)); Enable_Clock (Audio_DMA); -- Configure the DMA channel to the SAI peripheral Disable (Audio_DMA, Audio_DMA_Out_Stream); Configure (Audio_DMA, Audio_DMA_Out_Stream, (Channel => Audio_DMA_Out_Channel, Direction => Memory_To_Peripheral, Increment_Peripheral_Address => False, Increment_Memory_Address => True, Peripheral_Data_Format => HalfWords, Memory_Data_Format => HalfWords, Operation_Mode => Circular_Mode, Priority => Priority_High, FIFO_Enabled => True, FIFO_Threshold => FIFO_Threshold_Full_Configuration, Memory_Burst_Size => Memory_Burst_Single, Peripheral_Burst_Size => Peripheral_Burst_Single)); Clear_All_Status (Audio_DMA, Audio_DMA_Out_Stream); end Initialize_Audio_Out_Pins; ------------------------ -- Initialize_SAI_Out -- ------------------------ procedure Initialize_SAI_Out (Freq : Audio_Frequency) is begin STM32.SAI.Disable (Audio_SAI, SAI_Out_Block); STM32.SAI.Configure_Audio_Block (Audio_SAI, SAI_Out_Block, Frequency => Audio_Frequency'Enum_Rep (Freq), Stereo_Mode => Stereo, Mode => Master_Transmitter, MCD_Enabled => True, Protocol => Free_Protocol, Data_Size => Data_16b, Endianness => Data_MSB_First, Clock_Strobing => Clock_Strobing_Falling_Edge, Synchronization => Asynchronous_Mode, Output_Drive => Drive_Immediate, FIFO_Threshold => FIFO_1_Quarter_Full); STM32.SAI.Configure_Block_Frame (Audio_SAI, SAI_Out_Block, Frame_Length => 64, Frame_Active => 32, Frame_Sync => FS_Frame_And_Channel_Identification, FS_Polarity => FS_Active_Low, FS_Offset => Before_First_Bit); STM32.SAI.Configure_Block_Slot (Audio_SAI, SAI_Out_Block, First_Bit_Offset => 0, Slot_Size => Data_Size, Number_Of_Slots => 4, Enabled_Slots => Slot_0 or Slot_2); STM32.SAI.Enable (Audio_SAI, SAI_Out_Block); end Initialize_SAI_Out; -------------------------- -- Initialize_Audio_I2C -- -------------------------- procedure Initialize_Audio_I2C is begin Initialize_I2C_GPIO (Audio_I2C); STM32.Setup.Setup_I2C_Master (Port => Audio_I2C, SDA => Audio_I2C_SDA, SCL => Audio_I2C_SCL, SDA_AF => Audio_I2C_AF, SCL_AF => Audio_I2C_AF, Clock_Speed => 100_000); end Initialize_Audio_I2C; ---------------- -- Initialize -- ---------------- procedure Initialize_Audio_Out (This : in out CS43L22_Audio_Device; Volume : Audio_Volume; Frequency : Audio_Frequency) is begin STM32.SAI.Deinitialize (Audio_SAI, SAI_Out_Block); Set_Audio_Clock (Frequency); -- Initialize the SAI Initialize_Audio_Out_Pins; Initialize_SAI_Out (Frequency); -- Initialize the I2C Port to send commands to the driver Initialize_Audio_I2C; if This.Device.Read_ID /= CS43L22.CS43L22_ID then raise Constraint_Error with "Invalid ID received from the Audio Code"; end if; This.Reset; This.Device.Init (Output => CS43L22.Auto, Volume => UInt8 (Volume), Frequency => HAL.Audio.Audio_Frequency'Enum_Val (Audio_Frequency'Enum_Rep (Frequency))); end Initialize_Audio_Out; ----------- -- Reset -- ----------- procedure Reset (This : in out CS43L22_Audio_Device) is pragma Unreferenced (This); begin Clear (Audio_Reset_Pin); delay until Clock + Milliseconds (5); Set (Audio_Reset_Pin); delay until Clock + Milliseconds (5); end Reset; ---------- -- Play -- ---------- procedure Play (This : in out CS43L22_Audio_Device; Buffer : Audio_Buffer) is begin This.Device.Play; Start_Transfer_with_Interrupts (This => Audio_DMA, Stream => Audio_DMA_Out_Stream, Source => Buffer (Buffer'First)'Address, Destination => Audio_SAI.ADR'Address, Data_Count => Buffer'Length, Enabled_Interrupts => (Half_Transfer_Complete_Interrupt => True, Transfer_Complete_Interrupt => True, others => False)); Enable (Audio_SAI, SAI_Out_Block); Enable_DMA (Audio_SAI, SAI_Out_Block); end Play; ----------- -- Pause -- ----------- procedure Pause (This : in out CS43L22_Audio_Device) is begin This.Device.Pause; DMA_Pause (Audio_SAI, SAI_Out_Block); end Pause; ------------ -- Resume -- ------------ procedure Resume (This : in out CS43L22_Audio_Device) is begin This.Device.Resume; DMA_Resume (Audio_SAI, SAI_Out_Block); end Resume; ---------- -- Stop -- ---------- procedure Stop (This : in out CS43L22_Audio_Device) is begin This.Device.Stop; DMA_Stop (Audio_SAI, SAI_Out_Block); STM32.DMA.Disable (Audio_DMA, Audio_DMA_Out_Stream); STM32.DMA.Clear_All_Status (Audio_DMA, Audio_DMA_Out_Stream); end Stop; ---------------- -- Set_Volume -- ---------------- procedure Set_Volume (This : in out CS43L22_Audio_Device; Volume : Audio_Volume) is begin This.Device.Set_Volume (UInt8 (Volume)); end Set_Volume; ------------------- -- Set_Frequency -- ------------------- procedure Set_Frequency (This : in out CS43L22_Audio_Device; Frequency : Audio_Frequency) is pragma Unreferenced (This); begin Set_Audio_Clock (Frequency); STM32.SAI.Disable (Audio_SAI, SAI_Out_Block); Initialize_SAI_Out (Frequency); STM32.SAI.Enable (Audio_SAI, SAI_Out_Block); end Set_Frequency; end Audio;
package Memory.Transform.Shift is type Shift_Type is new Transform_Type with private; type Shift_Pointer is access all Shift_Type'Class; function Create_Shift return Shift_Pointer; function Random_Shift(next : access Memory_Type'Class; generator : Distribution_Type; max_cost : Cost_Type) return Memory_Pointer; overriding function Clone(mem : Shift_Type) return Memory_Pointer; overriding procedure Permute(mem : in out Shift_Type; generator : in Distribution_Type; max_cost : in Cost_Type); overriding function Is_Empty(mem : Shift_Type) return Boolean; overriding function Get_Name(mem : Shift_Type) return String; private type Shift_Type is new Transform_Type with null record; overriding function Apply(mem : Shift_Type; address : Address_Type; dir : Boolean) return Address_Type; overriding function Get_Alignment(mem : Shift_Type) return Positive; overriding function Get_Transform_Length(mem : Shift_Type) return Natural; end Memory.Transform.Shift;
with agar.core.object; with agar.core.slist; with agar.core.threads; with agar.core.types; with agar.gui.colors; with agar.gui.rect; with agar.gui.surface; with interfaces.c.strings; package agar.gui.widget is package cs renames interfaces.c.strings; -- -- forward declarations -- type widget_t; type widget_access_t is access all widget_t; pragma convention (c, widget_access_t); type binding_t; type binding_access_t is access all binding_t; pragma convention (c, binding_access_t); -- this is necessary because of a circular dependency issue -- (widget -> menu -> widget) type fake_popup_menu_access_t is access all agar.core.types.void_ptr_t; pragma convention (c, fake_popup_menu_access_t); package binding_slist is new agar.core.slist (entry_type => binding_access_t); package menu_slist is new agar.core.slist (entry_type => fake_popup_menu_access_t); -- -- constants -- binding_name_max : constant c.unsigned := 16; -- -- types -- type size_req_t is record w : c.int; h : c.int; end record; type size_req_access_t is access all size_req_t; pragma convention (c, size_req_t); pragma convention (c, size_req_access_t); type size_alloc_t is record w : c.int; h : c.int; x : c.int; y : c.int; end record; type size_alloc_access_t is access all size_alloc_t; pragma convention (c, size_alloc_t); pragma convention (c, size_alloc_access_t); type class_t is record inherit : agar.core.object.class_t; draw : access procedure (vp : agar.core.types.void_ptr_t); size_request : access procedure (vp : agar.core.types.void_ptr_t; req : size_req_access_t); size_allocate : access function (vp : agar.core.types.void_ptr_t; alloc : size_alloc_access_t) return c.int; end record; type class_access_t is access all class_t; pragma convention (c, class_t); pragma convention (c, class_access_t); type binding_type_t is ( WIDGET_NONE, WIDGET_BOOL, WIDGET_UINT, WIDGET_INT, WIDGET_UINT8, WIDGET_SINT8, WIDGET_UINT16, WIDGET_SINT16, WIDGET_UINT32, WIDGET_SINT32, WIDGET_UINT64, WIDGET_SINT64, WIDGET_FLOAT, WIDGET_DOUBLE, WIDGET_LONG_DOUBLE, WIDGET_STRING, WIDGET_POINTER, WIDGET_PROP, WIDGET_FLAG, WIDGET_FLAG8, WIDGET_FLAG16, WIDGET_FLAG32 ); for binding_type_t use ( WIDGET_NONE => 0, WIDGET_BOOL => 1, WIDGET_UINT => 2, WIDGET_INT => 3, WIDGET_UINT8 => 4, WIDGET_SINT8 => 5, WIDGET_UINT16 => 6, WIDGET_SINT16 => 7, WIDGET_UINT32 => 8, WIDGET_SINT32 => 9, WIDGET_UINT64 => 10, WIDGET_SINT64 => 11, WIDGET_FLOAT => 12, WIDGET_DOUBLE => 13, WIDGET_LONG_DOUBLE => 14, WIDGET_STRING => 15, WIDGET_POINTER => 16, WIDGET_PROP => 17, WIDGET_FLAG => 18, WIDGET_FLAG8 => 19, WIDGET_FLAG16 => 20, WIDGET_FLAG32 => 21 ); for binding_type_t'size use c.unsigned'size; pragma convention (c, binding_type_t); type size_spec_t is ( WIDGET_BAD_SPEC, WIDGET_PIXELS, WIDGET_PERCENT, WIDGET_STRINGLEN, WIDGET_FILL ); for size_spec_t use ( WIDGET_BAD_SPEC => 0, WIDGET_PIXELS => 1, WIDGET_PERCENT => 2, WIDGET_STRINGLEN => 3, WIDGET_FILL => 4 ); for size_spec_t'size use c.unsigned'size; pragma convention (c, size_spec_t); type flag_descr_t is record bitmask : c.unsigned; descr : cs.chars_ptr; writeable : c.int; end record; type flag_descr_access_t is access all flag_descr_t; pragma convention (c, flag_descr_t); pragma convention (c, flag_descr_access_t); type binding_name_t is array (1 .. binding_name_max) of aliased c.char; pragma convention (c, binding_name_t); type binding_data_prop_t is array (1 .. agar.core.object.prop_key_max) of aliased c.char; pragma convention (c, binding_data_prop_t); type binding_data_union_selector_t is (prop, size, mask); type binding_data_union_t (selector : binding_data_union_selector_t := prop) is record case selector is when prop => prop : binding_data_prop_t; when size => size : c.size_t; when mask => mask : agar.core.types.uint32_t; end case; end record; pragma convention (c, binding_data_union_t); pragma unchecked_union (binding_data_union_t); type binding_t is record name : binding_name_t; binding_type : c.int; mutex : agar.core.threads.mutex_t; p1 : agar.core.types.void_ptr_t; data : binding_data_union_t; bindings : binding_slist.entry_t; end record; pragma convention (c, binding_t); type color_t is array (1 .. 4) of aliased agar.core.types.uint8_t; pragma convention (c, color_t); type surface_id_t is new c.int; pragma convention (c, surface_id_t); subtype flags_t is c.unsigned; -- widget type type widget_private_t is limited private; type widget_t is record object : aliased agar.core.object.object_t; flags : c.unsigned; x : c.int; y : c.int; w : c.int; h : c.int; privdata : widget_private_t; end record; pragma convention (c, widget_t); -- -- API -- procedure expand (widget : widget_access_t); pragma import (c, expand, "agar_widget_expand"); procedure expand_horizontal (widget : widget_access_t); pragma import (c, expand_horizontal, "agar_widget_expand_horizontal"); procedure expand_vertical (widget : widget_access_t); pragma import (c, expand_vertical, "agar_widget_expand_vertical"); procedure size_request (widget : widget_access_t; request : size_req_t); pragma import (c, size_request, "AG_WidgetSizeReq"); function size_allocate (widget : widget_access_t; alloc : size_alloc_t) return boolean; pragma inline (size_allocate); -- input state procedure enable (widget : widget_access_t); pragma import (c, enable, "agar_widget_enable"); procedure disable (widget : widget_access_t); pragma import (c, disable, "agar_widget_disable"); function enabled (widget : widget_access_t) return boolean; pragma inline (enabled); function disabled (widget : widget_access_t) return boolean; pragma inline (disabled); -- focus function focused (widget : widget_access_t) return boolean; pragma inline (focused); procedure focus (widget : widget_access_t); pragma import (c, focus, "AG_WidgetFocus"); procedure unfocus (widget : widget_access_t); pragma import (c, unfocus, "AG_WidgetUnfocus"); -- missing: find_focused moved to agar.gui.window -- blitting function map_surface (widget : widget_access_t; surface : agar.gui.surface.surface_access_t) return surface_id_t; pragma import (c, map_surface, "AG_WidgetMapSurface"); function map_surface_no_copy (widget : widget_access_t; surface : agar.gui.surface.surface_access_t) return surface_id_t; pragma import (c, map_surface_no_copy, "AG_WidgetMapSurfaceNODUP"); procedure replace_surface (widget : widget_access_t; surface_id : surface_id_t; surface : agar.gui.surface.surface_access_t); pragma import (c, replace_surface, "AG_WidgetReplaceSurface"); procedure replace_surface_no_copy (widget : widget_access_t; surface_id : surface_id_t; surface : agar.gui.surface.surface_access_t); pragma import (c, replace_surface_no_copy, "AG_WidgetReplaceSurfaceNODUP"); procedure unmap_surface (widget : widget_access_t; surface_id : surface_id_t); pragma import (c, unmap_surface, "agar_widget_unmap_surface"); procedure update_surface (widget : widget_access_t; surface_id : surface_id_t); pragma import (c, update_surface, "agar_widget_update_surface"); procedure blit (widget : widget_access_t; surface : agar.gui.surface.surface_access_t; x : natural; y : natural); pragma inline (blit); procedure blit_from (dest_widget : widget_access_t; src_widget : widget_access_t; surface_id : surface_id_t; rect : agar.gui.rect.rect_access_t; x : integer; y : integer); pragma inline (blit_from); procedure blit_surface (widget : widget_access_t; surface_id : surface_id_t; x : integer; y : integer); pragma inline (blit_surface); -- rendering procedure push_clip_rect (widget : widget_access_t; rect : agar.gui.rect.rect_t); pragma import (c, push_clip_rect, "AG_PushClipRect"); procedure pop_clip_rect (widget : widget_access_t); pragma import (c, pop_clip_rect, "AG_PopClipRect"); -- missing: push_cursor - documented but apparently not implemented -- missing: pop_cursor procedure put_pixel (widget : widget_access_t; x : natural; y : natural; color : agar.core.types.color_t); pragma inline (put_pixel); procedure put_pixel32 (widget : widget_access_t; x : natural; y : natural; color : agar.core.types.uint32_t); pragma inline (put_pixel32); procedure put_pixel_rgb (widget : widget_access_t; x : natural; y : natural; r : agar.core.types.uint8_t; g : agar.core.types.uint8_t; b : agar.core.types.uint8_t); pragma inline (put_pixel_rgb); procedure blend_pixel_rgba (widget : widget_access_t; x : natural; y : natural; color : color_t; func : agar.gui.colors.blend_func_t); pragma inline (blend_pixel_rgba); procedure blend_pixel_32 (widget : widget_access_t; x : natural; y : natural; color : agar.core.types.uint32_t; func : agar.gui.colors.blend_func_t); pragma inline (blend_pixel_32); -- misc function find_point (class_mask : string; x : natural; y : natural) return widget_access_t; pragma inline (find_point); function find_rect (class_mask : string; x : natural; y : natural; w : positive; h : positive) return widget_access_t; pragma inline (find_rect); -- coordinates function absolute_coords_inside (widget : widget_access_t; x : natural; y : natural) return boolean; pragma inline (absolute_coords_inside); function relative_coords_inside (widget : widget_access_t; x : natural; y : natural) return boolean; pragma inline (relative_coords_inside); -- position and size setting procedure set_position (widget : widget_access_t; x : natural; y : natural); pragma inline (set_position); procedure modify_position (widget : widget_access_t; x : integer := 0; y : integer := 0); pragma inline (modify_position); procedure set_size (widget : widget_access_t; width : positive; height : positive); pragma inline (set_size); procedure modify_size (widget : widget_access_t; width : integer := 0; height : integer := 0); pragma inline (modify_size); -- 'casting' function object (widget : widget_access_t) return agar.core.object.object_access_t; pragma inline (object); -- bindings package bindings is procedure bind_pointer (widget : widget_access_t; binding : string; variable : agar.core.types.void_ptr_t); pragma inline (bind_pointer); procedure bind_property (widget : widget_access_t; binding : string; object : agar.core.object.object_access_t; name : string); pragma inline (bind_property); procedure bind_boolean (widget : widget_access_t; binding : string; variable : agar.core.types.boolean_access_t); pragma inline (bind_boolean); procedure bind_integer (widget : widget_access_t; binding : string; variable : agar.core.types.integer_access_t); pragma inline (bind_integer); procedure bind_unsigned (widget : widget_access_t; binding : string; variable : agar.core.types.unsigned_access_t); pragma inline (bind_unsigned); procedure bind_float (widget : widget_access_t; binding : string; variable : agar.core.types.float_access_t); pragma inline (bind_float); procedure bind_double (widget : widget_access_t; binding : string; variable : agar.core.types.double_access_t); pragma inline (bind_double); procedure bind_uint8 (widget : widget_access_t; binding : string; variable : agar.core.types.uint8_ptr_t); pragma inline (bind_uint8); procedure bind_int8 (widget : widget_access_t; binding : string; variable : agar.core.types.int8_ptr_t); pragma inline (bind_int8); procedure bind_flag8 (widget : widget_access_t; binding : string; variable : agar.core.types.uint8_ptr_t; mask : agar.core.types.uint8_t); pragma inline (bind_flag8); procedure bind_uint16 (widget : widget_access_t; binding : string; variable : agar.core.types.uint16_ptr_t); pragma inline (bind_uint16); procedure bind_int16 (widget : widget_access_t; binding : string; variable : agar.core.types.int16_ptr_t); pragma inline (bind_int16); procedure bind_flag16 (widget : widget_access_t; binding : string; variable : agar.core.types.uint16_ptr_t; mask : agar.core.types.uint16_t); pragma inline (bind_flag16); procedure bind_uint32 (widget : widget_access_t; binding : string; variable : agar.core.types.uint32_ptr_t); pragma inline (bind_uint32); procedure bind_int32 (widget : widget_access_t; binding : string; variable : agar.core.types.int32_ptr_t); pragma inline (bind_int32); procedure bind_flag32 (widget : widget_access_t; binding : string; variable : agar.core.types.uint32_ptr_t; mask : agar.core.types.uint32_t); pragma inline (bind_flag32); -- get function get_pointer (widget : widget_access_t; binding : string) return agar.core.types.void_ptr_t; pragma inline (get_pointer); function get_boolean (widget : widget_access_t; binding : string) return agar.core.types.boolean_t; pragma inline (get_boolean); function get_integer (widget : widget_access_t; binding : string) return agar.core.types.integer_t; pragma inline (get_integer); function get_unsigned (widget : widget_access_t; binding : string) return agar.core.types.unsigned_t; pragma inline (get_unsigned); function get_float (widget : widget_access_t; binding : string) return agar.core.types.float_t; pragma inline (get_float); function get_double (widget : widget_access_t; binding : string) return agar.core.types.double_t; pragma inline (get_double); function get_uint8 (widget : widget_access_t; binding : string) return agar.core.types.uint8_t; pragma inline (get_uint8); function get_int8 (widget : widget_access_t; binding : string) return agar.core.types.int8_t; pragma inline (get_int8); function get_uint16 (widget : widget_access_t; binding : string) return agar.core.types.uint16_t; pragma inline (get_uint16); function get_int16 (widget : widget_access_t; binding : string) return agar.core.types.int16_t; pragma inline (get_int16); function get_uint32 (widget : widget_access_t; binding : string) return agar.core.types.uint32_t; pragma inline (get_uint32); function get_int32 (widget : widget_access_t; binding : string) return agar.core.types.int32_t; pragma inline (get_int32); -- set procedure set_pointer (widget : widget_access_t; binding : string; variable : agar.core.types.void_ptr_t); pragma inline (set_pointer); procedure set_boolean (widget : widget_access_t; binding : string; variable : agar.core.types.boolean_t); pragma inline (set_boolean); procedure set_integer (widget : widget_access_t; binding : string; variable : agar.core.types.integer_t); pragma inline (set_integer); procedure set_unsigned (widget : widget_access_t; binding : string; variable : agar.core.types.unsigned_t); pragma inline (set_unsigned); procedure set_float (widget : widget_access_t; binding : string; variable : agar.core.types.float_t); pragma inline (set_float); procedure set_double (widget : widget_access_t; binding : string; variable : agar.core.types.double_t); pragma inline (set_double); procedure set_uint8 (widget : widget_access_t; binding : string; variable : agar.core.types.uint8_t); pragma inline (set_uint8); procedure set_int8 (widget : widget_access_t; binding : string; variable : agar.core.types.int8_t); pragma inline (set_int8); procedure set_uint16 (widget : widget_access_t; binding : string; variable : agar.core.types.uint16_t); pragma inline (set_uint16); procedure set_int16 (widget : widget_access_t; binding : string; variable : agar.core.types.int16_t); pragma inline (set_int16); procedure set_uint32 (widget : widget_access_t; binding : string; variable : agar.core.types.uint32_t); pragma inline (set_uint32); procedure set_int32 (widget : widget_access_t; binding : string; variable : agar.core.types.int32_t); pragma inline (set_int32); end bindings; private -- widget type type widget_private_t is record r_view : agar.gui.rect.rect2_t; r_sens : agar.gui.rect.rect2_t; surfaces : access agar.gui.surface.surface_access_t; surface_flags : access c.unsigned; nsurfaces : c.unsigned; -- openGL textures : access c.unsigned; texcoords : access c.c_float; texture_gc : access c.unsigned; ntextures_gc : c.unsigned; bindings_lock : agar.core.threads.mutex_t; bindings : binding_slist.head_t; menus : menu_slist.head_t; end record; pragma convention (c, widget_private_t); end agar.gui.widget;
------------------------------------------------------------------------------ -- -- -- GNAT COMPILER COMPONENTS -- -- -- -- E R R O U T -- -- -- -- B o d y -- -- -- -- Copyright (C) 1992-2016, Free Software Foundation, Inc. -- -- -- -- GNAT is free software; you can redistribute it and/or modify it under -- -- terms of the GNU General Public License as published by the Free Soft- -- -- ware Foundation; either version 3, or (at your option) any later ver- -- -- sion. GNAT is distributed in the hope that it will be useful, but WITH- -- -- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY -- -- or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -- -- for more details. You should have received a copy of the GNU General -- -- Public License distributed with GNAT; see file COPYING3. If not, go to -- -- http://www.gnu.org/licenses for a complete copy of the license. -- -- -- -- GNAT was originally developed by the GNAT team at New York University. -- -- Extensive contributions were provided by Ada Core Technologies Inc. -- -- -- ------------------------------------------------------------------------------ -- Warning: Error messages can be generated during Gigi processing by direct -- calls to error message routines, so it is essential that the processing -- in this body be consistent with the requirements for the Gigi processing -- environment, and that in particular, no disallowed table expansion is -- allowed to occur. with Atree; use Atree; with Casing; use Casing; with Csets; use Csets; with Debug; use Debug; with Einfo; use Einfo; with Erroutc; use Erroutc; with Fname; use Fname; with Gnatvsn; use Gnatvsn; with Lib; use Lib; with Opt; use Opt; with Nlists; use Nlists; with Output; use Output; with Scans; use Scans; with Sem_Aux; use Sem_Aux; with Sinput; use Sinput; with Sinfo; use Sinfo; with Snames; use Snames; with Stand; use Stand; with Stylesw; use Stylesw; with Uname; use Uname; package body Errout 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). Finalize_Called : Boolean := False; -- Set True if the Finalize routine has been called Record_Compilation_Errors : Boolean := False; -- Record that a compilation error was witnessed during a given phase of -- analysis for gnat2why. This is needed as Warning_Mode is modified twice -- in gnat2why, hence Erroutc.Compilation_Errors can only return a suitable -- value for each phase of analysis separately. This is updated at each -- call to Compilation_Errors. Warn_On_Instance : Boolean; -- Flag set true for warning message to be posted on instance ------------------------------------ -- Table of Non-Instance Messages -- ------------------------------------ -- This table contains an entry for every error message processed by the -- Error_Msg routine that is not posted on generic (or inlined) instance. -- As explained in further detail in the Error_Msg procedure body, this -- table is used to avoid posting redundant messages on instances. type NIM_Record is record Msg : String_Ptr; Loc : Source_Ptr; end record; -- Type used to store text and location of one message package Non_Instance_Msgs is new Table.Table ( Table_Component_Type => NIM_Record, Table_Index_Type => Int, Table_Low_Bound => 1, Table_Initial => 100, Table_Increment => 100, Table_Name => "Non_Instance_Msgs"); ----------------------- -- Local Subprograms -- ----------------------- procedure Error_Msg_Internal (Msg : String; Sptr : Source_Ptr; Optr : Source_Ptr; Msg_Cont : Boolean); -- This is the low level routine used to post messages after dealing with -- the issue of messages placed on instantiations (which get broken up -- into separate calls in Error_Msg). Sptr is the location on which the -- flag will be placed in the output. In the case where the flag is on -- the template, this points directly to the template, not to one of the -- instantiation copies of the template. Optr is the original location -- used to flag the error, and this may indeed point to an instantiation -- copy. So typically we can see Optr pointing to the template location -- in an instantiation copy when Sptr points to the source location of -- the actual instantiation (i.e the line with the new). Msg_Cont is -- set true if this is a continuation message. function No_Warnings (N : Node_Or_Entity_Id) return Boolean; -- Determines if warnings should be suppressed for the given node function OK_Node (N : Node_Id) return Boolean; -- Determines if a node is an OK node to place an error message on (return -- True) or if the error message should be suppressed (return False). A -- message is suppressed if the node already has an error posted on it, -- or if it refers to an Etype that has an error posted on it, or if -- it references an Entity that has an error posted on it. procedure Output_Source_Line (L : Physical_Line_Number; Sfile : Source_File_Index; Errs : Boolean); -- 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_Insertion_Node; -- Handle node (name from node) insertion (& insertion character) procedure Set_Msg_Insertion_Type_Reference (Flag : Source_Ptr); -- Handle type reference (right brace insertion character). Flag is the -- location of the flag, which is provided for the internal call to -- Set_Msg_Insertion_Line_Number, procedure Set_Msg_Insertion_Unit_Name (Suffix : Boolean := True); -- Handle unit name insertion ($ insertion character). Depending on Boolean -- parameter Suffix, (spec) or (body) is appended after the unit name. procedure Set_Msg_Node (Node : Node_Id); -- Add the sequence of characters for the name associated with the given -- node to the current message. For N_Designator, N_Selected_Component, -- N_Defining_Program_Unit_Name, and N_Expanded_Name, the Prefix is -- included as well. 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 are set on return Msglen. procedure Set_Posted (N : Node_Id); -- Sets the Error_Posted flag on the given node, and all its parents that -- are subexpressions and then on the parent non-subexpression construct -- that contains the original expression. If that parent is a named -- association, the flag is further propagated to its parent. This is done -- in order to guard against cascaded errors. Note that this call has an -- effect for a serious error only. procedure Set_Qualification (N : Nat; E : Entity_Id); -- Outputs up to N levels of qualification for the given entity. For -- example, the entity A.B.C.D will output B.C. if N = 2. function Special_Msg_Delete (Msg : String; N : Node_Or_Entity_Id; E : Node_Or_Entity_Id) return Boolean; -- This function is called from Error_Msg_NEL, passing the message Msg, -- node N on which the error is to be posted, and the entity or node E -- to be used for an & insertion in the message if any. The job of this -- procedure is to test for certain cascaded messages that we would like -- to suppress. If the message is to be suppressed then we return True. -- If the message should be generated (the normal case) False is returned. procedure Unwind_Internal_Type (Ent : in out Entity_Id); -- This procedure is given an entity id for an internal type, i.e. a type -- with an internal name. It unwinds the type to try to get to something -- reasonably printable, generating prefixes like "subtype of", "access -- to", etc along the way in the buffer. The value in Ent on return is the -- final name to be printed. Hopefully this is not an internal name, but in -- some internal name cases, it is an internal name, and has to be printed -- anyway (although in this case the message has been killed if possible). -- The global variable Class_Flag is set to True if the resulting entity -- should have 'Class appended to its name (see Add_Class procedure), and -- is otherwise unchanged. function Warn_Insertion return String; -- This is called for warning messages only (so Warning_Msg_Char is set) -- and returns a corresponding string to use at the beginning of generated -- auxiliary messages, such as "in instantiation at ...". -- 'a' .. 'z' returns "?x?" -- 'A' .. 'Z' returns "?X?" -- '*' returns "?*?" -- '$' returns "?$?info: " -- ' ' returns " " -- No other settings are valid ----------------------- -- Change_Error_Text -- ----------------------- procedure Change_Error_Text (Error_Id : Error_Msg_Id; New_Msg : String) is Save_Next : Error_Msg_Id; Err_Id : Error_Msg_Id := Error_Id; begin Set_Msg_Text (New_Msg, Errors.Table (Error_Id).Sptr); Errors.Table (Error_Id).Text := new String'(Msg_Buffer (1 .. Msglen)); -- If in immediate error message mode, output modified error message now -- This is just a bit tricky, because we want to output just a single -- message, and the messages we modified is already linked in. We solve -- this by temporarily resetting its forward pointer to empty. if Debug_Flag_OO then Save_Next := Errors.Table (Error_Id).Next; Errors.Table (Error_Id).Next := No_Error_Msg; Write_Eol; Output_Source_Line (Errors.Table (Error_Id).Line, Errors.Table (Error_Id).Sfile, True); Output_Error_Msgs (Err_Id); Errors.Table (Error_Id).Next := Save_Next; end if; end Change_Error_Text; ------------------------ -- Compilation_Errors -- ------------------------ function Compilation_Errors return Boolean is begin if not Finalize_Called then raise Program_Error; -- Record that a compilation error was witnessed during a given phase of -- analysis for gnat2why. This is needed as Warning_Mode is modified -- twice in gnat2why, hence Erroutc.Compilation_Errors can only return a -- suitable value for each phase of analysis separately. else Record_Compilation_Errors := Record_Compilation_Errors or else Erroutc.Compilation_Errors; return Record_Compilation_Errors; end if; end Compilation_Errors; -------------------------------------- -- Delete_Warning_And_Continuations -- -------------------------------------- procedure Delete_Warning_And_Continuations (Msg : Error_Msg_Id) is Id : Error_Msg_Id; begin pragma Assert (not Errors.Table (Msg).Msg_Cont); Id := Msg; loop declare M : Error_Msg_Object renames Errors.Table (Id); begin if not M.Deleted then M.Deleted := True; Warnings_Detected := Warnings_Detected - 1; if M.Info then Info_Messages := Info_Messages - 1; end if; if M.Warn_Err then Warnings_Treated_As_Errors := Warnings_Treated_As_Errors - 1; end if; end if; Id := M.Next; exit when Id = No_Error_Msg; exit when not Errors.Table (Id).Msg_Cont; end; end loop; end Delete_Warning_And_Continuations; --------------- -- Error_Msg -- --------------- -- Error_Msg posts a flag at the given location, except that if the -- Flag_Location points within a generic template and corresponds to an -- instantiation of this generic template, then the actual message will be -- posted on the generic instantiation, along with additional messages -- referencing the generic declaration. procedure Error_Msg (Msg : String; Flag_Location : Source_Ptr) is Sindex : Source_File_Index; -- Source index for flag location Orig_Loc : Source_Ptr; -- Original location of Flag_Location (i.e. location in original -- template in instantiation case, otherwise unchanged). begin -- It is a fatal error to issue an error message when scanning from the -- internal source buffer (see Sinput for further documentation) pragma Assert (Sinput.Source /= Internal_Source_Ptr); -- Return if all errors are to be ignored if Errors_Must_Be_Ignored then return; end if; -- If we already have messages, and we are trying to place a message at -- No_Location, then just ignore the attempt since we assume that what -- is happening is some cascaded junk. Note that this is safe in the -- sense that proceeding will surely bomb. We will also bomb if the flag -- location is No_Location and we don't have any messages so far, but -- that is a real bug and a legitimate bomb, so we go ahead. if Flag_Location = No_Location and then Total_Errors_Detected > 0 then return; end if; -- Start of processing for new message Sindex := Get_Source_File_Index (Flag_Location); Prescan_Message (Msg); Orig_Loc := Original_Location (Flag_Location); -- If the current location is in an instantiation, the issue arises of -- whether to post the message on the template or the instantiation. -- The way we decide is to see if we have posted the same message on -- the template when we compiled the template (the template is always -- compiled before any instantiations). For this purpose, we use a -- separate table of messages. The reason we do this is twofold: -- First, the messages can get changed by various processing -- including the insertion of tokens etc, making it hard to -- do the comparison. -- Second, we will suppress a warning on a template if it is not in -- the current extended source unit. That's reasonable and means we -- don't want the warning on the instantiation here either, but it -- does mean that the main error table would not in any case include -- the message. if Flag_Location = Orig_Loc then Non_Instance_Msgs.Append ((new String'(Msg), Flag_Location)); Warn_On_Instance := False; -- Here we have an instance message else -- Delete if debug flag off, and this message duplicates a message -- already posted on the corresponding template if not Debug_Flag_GG then for J in Non_Instance_Msgs.First .. Non_Instance_Msgs.Last loop if Msg = Non_Instance_Msgs.Table (J).Msg.all and then Non_Instance_Msgs.Table (J).Loc = Orig_Loc then return; end if; end loop; end if; -- No duplicate, so error/warning will be posted on instance Warn_On_Instance := Is_Warning_Msg; end if; -- Ignore warning message that is suppressed for this location. Note -- that style checks are not considered warning messages for this -- purpose. if Is_Warning_Msg and then Warnings_Suppressed (Orig_Loc) /= No_String then return; -- For style messages, check too many messages so far elsif Is_Style_Msg and then Maximum_Messages /= 0 and then Warnings_Detected >= Maximum_Messages then return; end if; -- The idea at this stage is that we have two kinds of messages -- First, we have those messages that are to be placed as requested at -- Flag_Location. This includes messages that have nothing to do with -- generics, and also messages placed on generic templates that reflect -- an error in the template itself. For such messages we simply call -- Error_Msg_Internal to place the message in the requested location. if Instantiation (Sindex) = No_Location then Error_Msg_Internal (Msg, Flag_Location, Flag_Location, False); return; end if; -- If we are trying to flag an error in an instantiation, we may have -- a generic contract violation. What we generate in this case is: -- instantiation error at ... -- original error message -- or -- warning: in instantiation at -- warning: original warning message -- All these messages are posted at the location of the top level -- instantiation. If there are nested instantiations, then the -- instantiation error message can be repeated, pointing to each -- of the relevant instantiations. -- Note: the instantiation mechanism is also shared for inlining of -- subprogram bodies when front end inlining is done. In this case the -- messages have the form: -- in inlined body at ... -- original error message -- or -- warning: in inlined body at -- warning: original warning message -- OK, here we have an instantiation error, and we need to generate the -- error on the instantiation, rather than on the template. declare Actual_Error_Loc : Source_Ptr; -- Location of outer level instantiation in instantiation case, or -- just a copy of Flag_Location in the normal case. This is the -- location where all error messages will actually be posted. Save_Error_Msg_Sloc : constant Source_Ptr := Error_Msg_Sloc; -- Save possible location set for caller's message. We need to use -- Error_Msg_Sloc for the location of the instantiation error but we -- have to preserve a possible original value. X : Source_File_Index; Msg_Cont_Status : Boolean; -- Used to label continuation lines in instantiation case with -- proper Msg_Cont status. begin -- Loop to find highest level instantiation, where all error -- messages will be placed. X := Sindex; loop Actual_Error_Loc := Instantiation (X); X := Get_Source_File_Index (Actual_Error_Loc); exit when Instantiation (X) = No_Location; end loop; -- Since we are generating the messages at the instantiation point in -- any case, we do not want the references to the bad lines in the -- instance to be annotated with the location of the instantiation. Suppress_Instance_Location := True; Msg_Cont_Status := False; -- Loop to generate instantiation messages Error_Msg_Sloc := Flag_Location; X := Get_Source_File_Index (Flag_Location); while Instantiation (X) /= No_Location loop -- Suppress instantiation message on continuation lines if Msg (Msg'First) /= '\' then -- Case of inlined body if Inlined_Body (X) then if Is_Warning_Msg or Is_Style_Msg then Error_Msg_Internal (Warn_Insertion & "in inlined body #", Actual_Error_Loc, Flag_Location, Msg_Cont_Status); else Error_Msg_Internal ("error in inlined body #", Actual_Error_Loc, Flag_Location, Msg_Cont_Status); end if; -- Case of generic instantiation else if Is_Warning_Msg or else Is_Style_Msg then Error_Msg_Internal (Warn_Insertion & "in instantiation #", Actual_Error_Loc, Flag_Location, Msg_Cont_Status); else Error_Msg_Internal ("instantiation error #", Actual_Error_Loc, Flag_Location, Msg_Cont_Status); end if; end if; end if; Error_Msg_Sloc := Instantiation (X); X := Get_Source_File_Index (Error_Msg_Sloc); Msg_Cont_Status := True; end loop; Suppress_Instance_Location := False; Error_Msg_Sloc := Save_Error_Msg_Sloc; -- Here we output the original message on the outer instantiation Error_Msg_Internal (Msg, Actual_Error_Loc, Flag_Location, Msg_Cont_Status); end; end Error_Msg; -------------------------------- -- Error_Msg_Ada_2012_Feature -- -------------------------------- procedure Error_Msg_Ada_2012_Feature (Feature : String; Loc : Source_Ptr) is begin if Ada_Version < Ada_2012 then Error_Msg (Feature & " is an Ada 2012 feature", Loc); if No (Ada_Version_Pragma) then Error_Msg ("\unit must be compiled with -gnat2012 switch", Loc); else Error_Msg_Sloc := Sloc (Ada_Version_Pragma); Error_Msg ("\incompatible with Ada version set#", Loc); end if; end if; end Error_Msg_Ada_2012_Feature; ------------------ -- 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: since this is an error recovery issue anyway, it is not worth -- worrying about special UTF_32 line terminator characters here. 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). -- Again, it is not worth worrying about UTF_32 special line terminator -- characters in this context, since this is only for error recovery. 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_BC -- ------------------ procedure Error_Msg_BC (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); -- If we are at start of file, post the flag at the current token elsif Token_Ptr = Source_First (Current_Source_File) then Error_Msg_SC (Msg); -- If the character before the current token is a space or a horizontal -- tab, then we place the flag on this character (in the case of a tab -- we would really like to place it in the "last" character of the tab -- space, but that it too much trouble to worry about). elsif Source (Token_Ptr - 1) = ' ' or else Source (Token_Ptr - 1) = ASCII.HT then Error_Msg (Msg, Token_Ptr - 1); -- If there is no space or tab before the current token, then there is -- no room to place the flag before the token, so we place it on the -- token instead (this happens for example at the start of a line). else Error_Msg (Msg, Token_Ptr); end if; end Error_Msg_BC; ------------------- -- Error_Msg_CRT -- ------------------- procedure Error_Msg_CRT (Feature : String; N : Node_Id) is CNRT : constant String := " not allowed in no run time mode"; CCRT : constant String := " not supported by configuration>"; S : String (1 .. Feature'Length + 1 + CCRT'Length); L : Natural; begin S (1) := '|'; S (2 .. Feature'Length + 1) := Feature; L := Feature'Length + 2; if No_Run_Time_Mode then S (L .. L + CNRT'Length - 1) := CNRT; L := L + CNRT'Length - 1; else pragma Assert (Configurable_Run_Time_Mode); S (L .. L + CCRT'Length - 1) := CCRT; L := L + CCRT'Length - 1; end if; Error_Msg_N (S (1 .. L), N); Configurable_Run_Time_Violations := Configurable_Run_Time_Violations + 1; end Error_Msg_CRT; ------------------ -- Error_Msg_PT -- ------------------ procedure Error_Msg_PT (E : Entity_Id; Iface_Prim : Entity_Id) is begin Error_Msg_N ("illegal overriding of subprogram inherited from interface", E); Error_Msg_Sloc := Sloc (Iface_Prim); if Ekind (E) = E_Function then Error_Msg_N ("\first formal of & declared # must be of mode `IN` " & "or access-to-constant", E); else Error_Msg_N ("\first formal of & declared # must be of mode `OUT`, `IN OUT` " & "or access-to-variable", E); end if; end Error_Msg_PT; ----------------- -- Error_Msg_F -- ----------------- procedure Error_Msg_F (Msg : String; N : Node_Id) is begin Error_Msg_NEL (Msg, N, N, Sloc (First_Node (N))); end Error_Msg_F; ------------------ -- Error_Msg_FE -- ------------------ procedure Error_Msg_FE (Msg : String; N : Node_Id; E : Node_Or_Entity_Id) is begin Error_Msg_NEL (Msg, N, E, Sloc (First_Node (N))); end Error_Msg_FE; ------------------------ -- Error_Msg_Internal -- ------------------------ procedure Error_Msg_Internal (Msg : String; Sptr : Source_Ptr; Optr : Source_Ptr; Msg_Cont : Boolean) 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 Temp_Msg : Error_Msg_Id; Warn_Err : Boolean; -- Set if warning to be treated as error procedure Handle_Serious_Error; -- Internal procedure to do all error message handling for a serious -- error message, other than bumping the error counts and arranging -- for the message to be output. -------------------------- -- Handle_Serious_Error -- -------------------------- procedure Handle_Serious_Error is begin -- Turn off code generation if not done already if Operating_Mode = Generate_Code then Operating_Mode := Check_Semantics; Expander_Active := False; end if; -- Set the fatal error flag in the unit table unless we are in -- Try_Semantics mode (in which case we set ignored mode if not -- currently set. This stops the semantics from being performed -- if we find a serious error. This is skipped if we are currently -- dealing with the configuration pragma file. if Current_Source_Unit /= No_Unit then declare U : constant Unit_Number_Type := Get_Source_Unit (Sptr); begin if Try_Semantics then if Fatal_Error (U) = None then Set_Fatal_Error (U, Error_Ignored); end if; else Set_Fatal_Error (U, Error_Detected); end if; end; end if; end Handle_Serious_Error; -- Start of processing for Error_Msg_Internal begin if Raise_Exception_On_Error /= 0 then raise Error_Msg_Exception; end if; Continuation := Msg_Cont; Continuation_New_Line := False; Suppress_Message := False; Kill_Message := False; 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 suppressed if Suppress_Message and then not All_Errors_Mode and then not Is_Warning_Msg and then not Is_Unconditional_Msg then if not Continuation then Last_Killed := True; end if; 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 if Kill_Message and then not All_Errors_Mode and then Total_Errors_Detected /= 0 then if not Continuation then Last_Killed := True; end if; return; end if; -- Special check for warning message to see if it should be output if Is_Warning_Msg then -- Immediate return if warning message and warnings are suppressed if Warnings_Suppressed (Optr) /= No_String or else Warnings_Suppressed (Sptr) /= No_String then Cur_Msg := No_Error_Msg; return; end if; -- If the flag location is in the main extended source unit then for -- sure we want the warning since it definitely belongs if In_Extended_Main_Source_Unit (Sptr) then null; -- If the main unit has not been read yet. the warning must be on -- a configuration file: gnat.adc or user-defined. This means we -- are not parsing the main unit yet, so skip following checks. elsif No (Cunit (Main_Unit)) then null; -- If the flag location is not in the main extended source unit, then -- we want to eliminate the warning, unless it is in the extended -- main code unit and we want warnings on the instance. elsif In_Extended_Main_Code_Unit (Sptr) and then Warn_On_Instance then null; -- Keep warning if debug flag G set elsif Debug_Flag_GG then null; -- Keep warning if message text contains !! elsif Has_Double_Exclam then null; -- Here is where we delete a warning from a with'ed unit else Cur_Msg := No_Error_Msg; if not Continuation then Last_Killed := True; end if; return; end if; end if; -- If message is to be ignored in special ignore message mode, this is -- where we do this special processing, bypassing message output. if Ignore_Errors_Enable > 0 then if Is_Serious_Error then Handle_Serious_Error; end if; return; end if; -- If error message line length set, and this is a continuation message -- then all we do is to append the text to the text of the last message -- with a comma space separator (eliminating a possible (style) or -- info prefix). if Error_Msg_Line_Length /= 0 and then Continuation then Cur_Msg := Errors.Last; declare Oldm : String_Ptr := Errors.Table (Cur_Msg).Text; Newm : String (1 .. Oldm'Last + 2 + Msglen); Newl : Natural; M : Natural; begin -- First copy old message to new one and free it Newm (Oldm'Range) := Oldm.all; Newl := Oldm'Length; Free (Oldm); -- Remove (style) or info: at start of message if Msglen > 8 and then Msg_Buffer (1 .. 8) = "(style) " then M := 9; elsif Msglen > 6 and then Msg_Buffer (1 .. 6) = "info: " then M := 7; else M := 1; end if; -- Now deal with separation between messages. Normally this is -- simply comma space, but there are some special cases. -- If continuation new line, then put actual NL character in msg if Continuation_New_Line then Newl := Newl + 1; Newm (Newl) := ASCII.LF; -- If continuation message is enclosed in parentheses, then -- special treatment (don't need a comma, and we want to combine -- successive parenthetical remarks into a single one with -- separating commas). elsif Msg_Buffer (M) = '(' and then Msg_Buffer (Msglen) = ')' then -- Case where existing message ends in right paren, remove -- and separate parenthetical remarks with a comma. if Newm (Newl) = ')' then Newm (Newl) := ','; Msg_Buffer (M) := ' '; -- Case where we are adding new parenthetical comment else Newl := Newl + 1; Newm (Newl) := ' '; end if; -- Case where continuation not in parens and no new line else Newm (Newl + 1 .. Newl + 2) := ", "; Newl := Newl + 2; end if; -- Append new message Newm (Newl + 1 .. Newl + Msglen - M + 1) := Msg_Buffer (M .. Msglen); Newl := Newl + Msglen - M + 1; Errors.Table (Cur_Msg).Text := new String'(Newm (1 .. Newl)); -- Update warning msg flag and message doc char if needed if Is_Warning_Msg then if not Errors.Table (Cur_Msg).Warn then Errors.Table (Cur_Msg).Warn := True; Errors.Table (Cur_Msg).Warn_Chr := Warning_Msg_Char; elsif Warning_Msg_Char /= ' ' then Errors.Table (Cur_Msg).Warn_Chr := Warning_Msg_Char; end if; end if; end; return; end if; -- Here we build a new error object Errors.Append ((Text => new String'(Msg_Buffer (1 .. Msglen)), Next => No_Error_Msg, Prev => No_Error_Msg, Sptr => Sptr, Optr => Optr, Sfile => Get_Source_File_Index (Sptr), 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 => False, -- reset below 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; -- Test if warning to be treated as error Warn_Err := Is_Warning_Msg and then (Warning_Treated_As_Error (Msg_Buffer (1 .. Msglen)) or else Warning_Treated_As_Error (Get_Warning_Tag (Cur_Msg))); -- Propagate Warn_Err to this message and preceding continuations for J in reverse 1 .. Errors.Last loop Errors.Table (J).Warn_Err := Warn_Err; exit when not Errors.Table (J).Msg_Cont; end loop; -- If immediate errors mode set, output error message now. Also output -- now if the -d1 debug flag is set (so node number message comes out -- just before actual error message) if Debug_Flag_OO or else Debug_Flag_1 then Write_Eol; Output_Source_Line (Errors.Table (Cur_Msg).Line, Errors.Table (Cur_Msg).Sfile, True); Temp_Msg := Cur_Msg; Output_Error_Msgs (Temp_Msg); -- If not in immediate errors mode, then we insert the message in the -- error chain for later output by Finalize. The messages are sorted -- first by unit (main unit comes first), and within a unit by source -- location (earlier flag location first in the chain). else -- First a quick check, does this belong at the very end of the chain -- of error messages. This saves a lot of time in the normal case if -- there are lots of messages. if Last_Error_Msg /= No_Error_Msg and then Errors.Table (Cur_Msg).Sfile = Errors.Table (Last_Error_Msg).Sfile and then (Sptr > Errors.Table (Last_Error_Msg).Sptr or else (Sptr = Errors.Table (Last_Error_Msg).Sptr and then Optr > Errors.Table (Last_Error_Msg).Optr)) then Prev_Msg := Last_Error_Msg; Next_Msg := No_Error_Msg; -- Otherwise do a full sequential search for the insertion point else 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 or else (Sptr = Errors.Table (Next_Msg).Sptr and then Optr < Errors.Table (Next_Msg).Optr); end if; Prev_Msg := Next_Msg; Next_Msg := Errors.Table (Next_Msg).Next; end loop; end if; -- Now we insert the new message in the error chain. -- 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 and then Compiler_State = Parsing and then not All_Errors_Mode 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. pragma Assert (not Continuation); Last_Killed := True; 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; if Next_Msg = No_Error_Msg then Last_Error_Msg := Cur_Msg; end if; end if; -- 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; Handle_Serious_Error; -- If not serious error, set Fatal_Error to indicate ignored error else declare U : constant Unit_Number_Type := Get_Source_Unit (Sptr); begin if Fatal_Error (U) = None then Set_Fatal_Error (U, Error_Ignored); end if; end; end if; end if; -- Record warning message issued if Errors.Table (Cur_Msg).Warn and then not Errors.Table (Cur_Msg).Msg_Cont then Warning_Msg := Cur_Msg; end if; -- If too many warnings turn off warnings if Maximum_Messages /= 0 then if Warnings_Detected = Maximum_Messages then Warning_Mode := Suppress; end if; -- If too many errors abandon compilation if Total_Errors_Detected = Maximum_Messages then raise Unrecoverable_Error; end if; end if; end Error_Msg_Internal; ----------------- -- Error_Msg_N -- ----------------- procedure Error_Msg_N (Msg : String; N : Node_Or_Entity_Id) is begin Error_Msg_NEL (Msg, N, N, Sloc (N)); end Error_Msg_N; ------------------ -- Error_Msg_NE -- ------------------ procedure Error_Msg_NE (Msg : String; N : Node_Or_Entity_Id; E : Node_Or_Entity_Id) is begin Error_Msg_NEL (Msg, N, E, Sloc (N)); end Error_Msg_NE; ------------------- -- Error_Msg_NEL -- ------------------- procedure Error_Msg_NEL (Msg : String; N : Node_Or_Entity_Id; E : Node_Or_Entity_Id; Flag_Location : Source_Ptr) is begin if Special_Msg_Delete (Msg, N, E) then return; end if; Prescan_Message (Msg); -- Special handling for warning messages if Is_Warning_Msg then -- Suppress if no warnings set for either entity or node if No_Warnings (N) or else No_Warnings (E) then -- Disable any continuation messages as well Last_Killed := True; return; end if; -- Suppress if inside loop that is known to be null or is probably -- null (case where loop executes only if invalid values present). -- In either case warnings in the loop are likely to be junk. declare P : Node_Id; begin P := Parent (N); while Present (P) loop if Nkind (P) = N_Loop_Statement and then Suppress_Loop_Warnings (P) then return; end if; P := Parent (P); end loop; end; end if; -- Test for message to be output if All_Errors_Mode or else Is_Unconditional_Msg or else Is_Warning_Msg or else OK_Node (N) or else (Msg (Msg'First) = '\' and then not Last_Killed) then Debug_Output (N); Error_Msg_Node_1 := E; Error_Msg (Msg, Flag_Location); else Last_Killed := True; end if; Set_Posted (N); end Error_Msg_NEL; ------------------ -- Error_Msg_NW -- ------------------ procedure Error_Msg_NW (Eflag : Boolean; Msg : String; N : Node_Or_Entity_Id) is begin if Eflag and then In_Extended_Main_Source_Unit (N) and then Comes_From_Source (N) then Error_Msg_NEL (Msg, N, N, Sloc (N)); end if; end Error_Msg_NW; ----------------- -- 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 (Last_Call : Boolean) is Cur : Error_Msg_Id; Nxt : Error_Msg_Id; F : Error_Msg_Id; procedure Delete_Warning (E : Error_Msg_Id); -- Delete a warning msg if not already deleted and adjust warning count -------------------- -- Delete_Warning -- -------------------- procedure Delete_Warning (E : Error_Msg_Id) is begin if not Errors.Table (E).Deleted then Errors.Table (E).Deleted := True; Warnings_Detected := Warnings_Detected - 1; if Errors.Table (E).Info then Info_Messages := Info_Messages - 1; end if; if Errors.Table (E).Warn_Err then Warnings_Treated_As_Errors := Warnings_Treated_As_Errors - 1; end if; end if; end Delete_Warning; -- Start of processing for Finalize begin -- Set Prev pointers Cur := First_Error_Msg; while Cur /= No_Error_Msg loop Nxt := Errors.Table (Cur).Next; exit when Nxt = No_Error_Msg; Errors.Table (Nxt).Prev := Cur; Cur := Nxt; end loop; -- 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; -- Mark any messages suppressed by specific warnings as Deleted Cur := First_Error_Msg; while Cur /= No_Error_Msg loop declare CE : Error_Msg_Object renames Errors.Table (Cur); Tag : constant String := Get_Warning_Tag (Cur); begin if (CE.Warn and not CE.Deleted) and then (Warning_Specifically_Suppressed (CE.Sptr, CE.Text, Tag) /= No_String or else Warning_Specifically_Suppressed (CE.Optr, CE.Text, Tag) /= No_String) then Delete_Warning (Cur); -- If this is a continuation, delete previous parts of message F := Cur; while Errors.Table (F).Msg_Cont loop F := Errors.Table (F).Prev; exit when F = No_Error_Msg; Delete_Warning (F); end loop; -- Delete any following continuations F := Cur; loop F := Errors.Table (F).Next; exit when F = No_Error_Msg; exit when not Errors.Table (F).Msg_Cont; Delete_Warning (F); end loop; end if; end; Cur := Errors.Table (Cur).Next; end loop; Finalize_Called := True; -- Check consistency of specific warnings (may add warnings). We only -- do this on the last call, after all possible warnings are posted. if Last_Call then Validate_Specific_Warnings (Error_Msg'Access); end if; end Finalize; ---------------- -- First_Node -- ---------------- function First_Node (C : Node_Id) return Node_Id is Orig : constant Node_Id := Original_Node (C); Loc : constant Source_Ptr := Sloc (Orig); Sfile : constant Source_File_Index := Get_Source_File_Index (Loc); Earliest : Node_Id; Eloc : Source_Ptr; function Test_Earlier (N : Node_Id) return Traverse_Result; -- Function applied to every node in the construct procedure Search_Tree_First is new Traverse_Proc (Test_Earlier); -- Create traversal procedure ------------------ -- Test_Earlier -- ------------------ function Test_Earlier (N : Node_Id) return Traverse_Result is Norig : constant Node_Id := Original_Node (N); Loc : constant Source_Ptr := Sloc (Norig); begin -- Check for earlier if Loc < Eloc -- Ignore nodes with no useful location information and then Loc /= Standard_Location and then Loc /= No_Location -- Ignore nodes from a different file. This ensures against cases -- of strange foreign code somehow being present. We don't want -- wild placement of messages if that happens. and then Get_Source_File_Index (Loc) = Sfile then Earliest := Norig; Eloc := Loc; end if; return OK_Orig; end Test_Earlier; -- Start of processing for First_Node begin if Nkind (Orig) in N_Subexpr then Earliest := Orig; Eloc := Loc; Search_Tree_First (Orig); return Earliest; else return Orig; end if; end First_Node; ---------------- -- First_Sloc -- ---------------- function First_Sloc (N : Node_Id) return Source_Ptr is SI : constant Source_File_Index := Source_Index (Get_Source_Unit (N)); SF : constant Source_Ptr := Source_First (SI); F : Node_Id; S : Source_Ptr; begin F := First_Node (N); S := Sloc (F); -- The following circuit is a bit subtle. When we have parenthesized -- expressions, then the Sloc will not record the location of the paren, -- but we would like to post the flag on the paren. So what we do is to -- crawl up the tree from the First_Node, adjusting the Sloc value for -- any parentheses we know are present. Yes, we know this circuit is not -- 100% reliable (e.g. because we don't record all possible paren level -- values), but this is only for an error message so it is good enough. Node_Loop : loop Paren_Loop : for J in 1 .. Paren_Count (F) loop -- We don't look more than 12 characters behind the current -- location, and in any case not past the front of the source. Search_Loop : for K in 1 .. 12 loop exit Search_Loop when S = SF; if Source_Text (SI) (S - 1) = '(' then S := S - 1; exit Search_Loop; elsif Source_Text (SI) (S - 1) <= ' ' then S := S - 1; else exit Search_Loop; end if; end loop Search_Loop; end loop Paren_Loop; exit Node_Loop when F = N; F := Parent (F); exit Node_Loop when Nkind (F) not in N_Subexpr; end loop Node_Loop; return S; end First_Sloc; ----------------------- -- Get_Ignore_Errors -- ----------------------- function Get_Ignore_Errors return Boolean is begin return Errors_Must_Be_Ignored; end Get_Ignore_Errors; ---------------- -- 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; Cur_Msg := No_Error_Msg; List_Pragmas.Init; -- Reset counts for warnings Reset_Warnings; -- Initialize warnings tables Warnings.Init; Specific_Warnings.Init; end Initialize; ----------------- -- No_Warnings -- ----------------- function No_Warnings (N : Node_Or_Entity_Id) return Boolean is begin if Error_Posted (N) then return True; elsif Nkind (N) in N_Entity and then Has_Warnings_Off (N) then return True; elsif Is_Entity_Name (N) and then Present (Entity (N)) and then Has_Warnings_Off (Entity (N)) then return True; else return False; end if; end No_Warnings; ------------- -- OK_Node -- ------------- function OK_Node (N : Node_Id) return Boolean is K : constant Node_Kind := Nkind (N); begin if Error_Posted (N) then return False; elsif K in N_Has_Etype and then Present (Etype (N)) and then Error_Posted (Etype (N)) then return False; elsif (K in N_Op or else K = N_Attribute_Reference or else K = N_Character_Literal or else K = N_Expanded_Name or else K = N_Identifier or else K = N_Operator_Symbol) and then Present (Entity (N)) and then Error_Posted (Entity (N)) then return False; else return True; end if; end OK_Node; --------------------- -- Output_Messages -- --------------------- procedure Output_Messages is E : Error_Msg_Id; Err_Flag : Boolean; procedure Write_Error_Summary; -- Write error summary procedure Write_Header (Sfile : Source_File_Index); -- Write header line (compiling or checking given file) procedure Write_Max_Errors; -- Write message if max errors reached ------------------------- -- Write_Error_Summary -- ------------------------- procedure Write_Error_Summary is begin -- 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. 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. Don't give this message if -- the Main_Source line is unknown (this happens in error situations, -- e.g. when integrated preprocessing fails). if Main_Source_File /= No_Source_File then 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; 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); 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 /= 1 then Write_Char ('s'); end if; Write_Char (')'); elsif Warnings_Treated_As_Errors /= 0 then Write_Str (" ("); Write_Int (Warnings_Treated_As_Errors); Write_Str (" treated as errors)"); end if; end if; if Info_Messages /= 0 then Write_Str (", "); Write_Int (Info_Messages); Write_Str (" info message"); if Info_Messages > 1 then Write_Char ('s'); end if; end if; Write_Eol; Set_Standard_Output; end Write_Error_Summary; ------------------ -- Write_Header -- ------------------ procedure Write_Header (Sfile : Source_File_Index) is begin if Verbose_Mode or Full_List then if Original_Operating_Mode = Generate_Code then Write_Str ("Compiling: "); else Write_Str ("Checking: "); end if; Write_Name (Full_File_Name (Sfile)); if not Debug_Flag_7 then Write_Eol; Write_Str ("Source file time stamp: "); Write_Time_Stamp (Sfile); Write_Eol; Write_Str ("Compiled at: " & Compilation_Time); end if; Write_Eol; end if; end Write_Header; ---------------------- -- Write_Max_Errors -- ---------------------- procedure Write_Max_Errors is begin if Maximum_Messages /= 0 then if Warnings_Detected >= Maximum_Messages then Set_Standard_Error; Write_Line ("maximum number of warnings output"); Write_Line ("any further warnings suppressed"); Set_Standard_Output; end if; -- If too many errors print message if Total_Errors_Detected >= Maximum_Messages then Set_Standard_Error; Write_Line ("fatal error: maximum number of errors detected"); Set_Standard_Output; end if; end if; end Write_Max_Errors; -- Start of processing for Output_Messages begin -- Error if Finalize has not been called if not Finalize_Called then raise Program_Error; end if; -- Reset current error source file if the main unit has a pragma -- Source_Reference. This ensures outputting the proper name of -- the source file in this situation. if Main_Source_File = No_Source_File or else Num_SRef_Pragmas (Main_Source_File) /= 0 then Current_Error_Source_File := No_Source_File; end if; -- Brief Error mode if Brief_Output or (not Full_List and not Verbose_Mode) then Set_Standard_Error; E := First_Error_Msg; while E /= No_Error_Msg loop if not Errors.Table (E).Deleted and then not Debug_Flag_KK 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; -- Normal case, to stdout (copyright notice already output) if Full_List_File_Name = null then if not Debug_Flag_7 then Write_Eol; end if; -- Output to file else Create_List_File_Access.all (Full_List_File_Name.all); Set_Special_Output (Write_List_Info_Access.all'Access); -- Write copyright notice to file if not Debug_Flag_7 then Write_Str ("GNAT "); Write_Str (Gnat_Version_String); Write_Eol; Write_Str ("Copyright 1992-" & Current_Year & ", Free Software Foundation, Inc."); Write_Eol; end if; end if; -- First list extended main source file units with errors for U in Main_Unit .. Last_Unit loop if In_Extended_Main_Source_Unit (Cunit_Entity (U)) -- If debug flag d.m is set, only the main source is listed and then (U = Main_Unit or else not Debug_Flag_Dot_M) -- If the unit of the entity does not come from source, it is -- an implicit subprogram declaration for a child subprogram. -- Do not emit errors for it, they are listed with the body. and then (No (Cunit_Entity (U)) or else Comes_From_Source (Cunit_Entity (U)) or else not Is_Subprogram (Cunit_Entity (U))) -- If the compilation unit associated with this unit does not -- come from source, it means it is an instantiation that should -- not be included in the source listing. and then Comes_From_Source (Cunit (U)) then declare Sfile : constant Source_File_Index := Source_Index (U); begin Write_Eol; -- Only write the header if Sfile is known if Sfile /= No_Source_File then Write_Header (Sfile); Write_Eol; end if; -- Normally, we don't want an "error messages from file" -- message when listing the entire file, so we set the -- current source file as the current error source file. -- However, the old style of doing things was to list this -- message if pragma Source_Reference is present, even for -- the main unit. Since the purpose of the -gnatd.m switch -- is to duplicate the old behavior, we skip the reset if -- this debug flag is set. if not Debug_Flag_Dot_M then Current_Error_Source_File := Sfile; end if; -- Only output the listing if Sfile is known, to avoid -- crashing the compiler. if Sfile /= No_Source_File then for N in 1 .. Last_Source_Line (Sfile) loop while E /= No_Error_Msg and then Errors.Table (E).Deleted loop E := Errors.Table (E).Next; end loop; Err_Flag := E /= No_Error_Msg and then Errors.Table (E).Line = N and then Errors.Table (E).Sfile = Sfile; Output_Source_Line (N, Sfile, Err_Flag); if Err_Flag then Output_Error_Msgs (E); if not Debug_Flag_2 then Write_Eol; end if; end if; end loop; end if; end; end if; end loop; -- Then output errors, if any, for subsidiary units not in the -- main extended unit. -- Note: if debug flag d.m set, include errors for any units other -- than the main unit in the extended source unit (e.g. spec and -- subunits for a body). while E /= No_Error_Msg and then (not In_Extended_Main_Source_Unit (Errors.Table (E).Sptr) or else (Debug_Flag_Dot_M and then Get_Source_Unit (Errors.Table (E).Sptr) /= Main_Unit)) loop if Errors.Table (E).Deleted then E := Errors.Table (E).Next; else Write_Eol; Output_Source_Line (Errors.Table (E).Line, Errors.Table (E).Sfile, True); Output_Error_Msgs (E); end if; end loop; -- If output to file, write extra copy of error summary to the -- output file, and then close it. if Full_List_File_Name /= null then Write_Error_Summary; Write_Max_Errors; Close_List_File_Access.all; Cancel_Special_Output; end if; end if; -- Verbose mode (error lines only with error flags). Normally this is -- ignored in full list mode, unless we are listing to a file, in which -- case we still generate -gnatv output to standard output. if Verbose_Mode and then (not Full_List or else Full_List_File_Name /= null) then Write_Eol; -- Output the header only when Main_Source_File is known if Main_Source_File /= No_Source_File then Write_Header (Main_Source_File); end if; E := First_Error_Msg; -- Loop through error lines while E /= No_Error_Msg loop if Errors.Table (E).Deleted then E := Errors.Table (E).Next; else Write_Eol; Output_Source_Line (Errors.Table (E).Line, Errors.Table (E).Sfile, True); Output_Error_Msgs (E); end if; end loop; end if; -- Output error summary if verbose or full list mode if Verbose_Mode or else Full_List then Write_Error_Summary; end if; Write_Max_Errors; if Warning_Mode = Treat_As_Error then Total_Errors_Detected := Total_Errors_Detected + Warnings_Detected - Info_Messages; Warnings_Detected := Info_Messages; end if; end Output_Messages; ------------------------ -- Output_Source_Line -- ------------------------ procedure Output_Source_Line (L : Physical_Line_Number; Sfile : Source_File_Index; Errs : Boolean) is S : Source_Ptr; C : Character; Line_Number_Output : Boolean := False; -- Set True once line number is output Empty_Line : Boolean := True; -- Set False if line includes at least one character begin if Sfile /= Current_Error_Source_File then Write_Str ("==============Error messages for "); case Sinput.File_Type (Sfile) is when Sinput.Src => Write_Str ("source"); when Sinput.Config => Write_Str ("configuration pragmas"); when Sinput.Def => Write_Str ("symbol definition"); when Sinput.Preproc => Write_Str ("preprocessing data"); end case; Write_Str (" file: "); Write_Name (Full_File_Name (Sfile)); Write_Eol; if Num_SRef_Pragmas (Sfile) > 0 then Write_Str ("--------------Line numbers from file: "); Write_Name (Full_Ref_Name (Sfile)); Write_Str (" (starting at line "); Write_Int (Int (First_Mapped_Line (Sfile))); Write_Char (')'); Write_Eol; end if; Current_Error_Source_File := Sfile; end if; if Errs or List_Pragmas_Mode 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; -- Deal with matching entry in List_Pragmas table if Full_List and then List_Pragmas_Index <= List_Pragmas.Last and then S = List_Pragmas.Table (List_Pragmas_Index).Ploc then case List_Pragmas.Table (List_Pragmas_Index).Ptyp is when Page => Write_Char (C); -- Ignore if on line with errors so that error flags -- get properly listed with the error line . if not Errs then Write_Char (ASCII.FF); end if; when List_On => List_Pragmas_Mode := True; if not Line_Number_Output then Output_Line_Number (Physical_To_Logical (L, Sfile)); Line_Number_Output := True; end if; Write_Char (C); when List_Off => Write_Char (C); List_Pragmas_Mode := False; end case; List_Pragmas_Index := List_Pragmas_Index + 1; -- Normal case (no matching entry in List_Pragmas table) else if Errs or List_Pragmas_Mode then Write_Char (C); end if; end if; Empty_Line := False; S := S + 1; end loop; -- If we have output a source line, then add the line terminator, with -- training spaces preserved (so we output the line exactly as input). if Line_Number_Output then if Empty_Line then Write_Eol; else Write_Eol_Keep_Blanks; end if; end if; end Output_Source_Line; ----------------------------- -- Remove_Warning_Messages -- ----------------------------- procedure Remove_Warning_Messages (N : Node_Id) is function Check_For_Warning (N : Node_Id) return Traverse_Result; -- This function checks one node for a possible warning message function Check_All_Warnings is new Traverse_Func (Check_For_Warning); -- This defines the traversal operation ----------------------- -- Check_For_Warning -- ----------------------- function Check_For_Warning (N : Node_Id) return Traverse_Result is Loc : constant Source_Ptr := Sloc (N); E : Error_Msg_Id; function To_Be_Removed (E : Error_Msg_Id) return Boolean; -- Returns True for a message that is to be removed. Also adjusts -- warning count appropriately. ------------------- -- To_Be_Removed -- ------------------- function To_Be_Removed (E : Error_Msg_Id) return Boolean is begin if E /= No_Error_Msg -- Don't remove if location does not match and then Errors.Table (E).Optr = Loc -- Don't remove if not warning/info message. Note that we do -- not remove style messages here. They are warning messages -- but not ones we want removed in this context. and then Errors.Table (E).Warn -- Don't remove unconditional messages and then not Errors.Table (E).Uncond then Warnings_Detected := Warnings_Detected - 1; if Errors.Table (E).Info then Info_Messages := Info_Messages - 1; end if; return True; -- No removal required else return False; end if; end To_Be_Removed; -- Start of processing for Check_For_Warnings begin while To_Be_Removed (First_Error_Msg) loop First_Error_Msg := Errors.Table (First_Error_Msg).Next; end loop; if First_Error_Msg = No_Error_Msg then Last_Error_Msg := No_Error_Msg; end if; E := First_Error_Msg; while E /= No_Error_Msg loop while To_Be_Removed (Errors.Table (E).Next) loop Errors.Table (E).Next := Errors.Table (Errors.Table (E).Next).Next; if Errors.Table (E).Next = No_Error_Msg then Last_Error_Msg := E; end if; end loop; E := Errors.Table (E).Next; end loop; if Nkind (N) = N_Raise_Constraint_Error and then Original_Node (N) /= N and then No (Condition (N)) then -- Warnings may have been posted on subexpressions of the original -- tree. We place the original node back on the tree to remove -- those warnings, whose sloc do not match those of any node in -- the current tree. Given that we are in unreachable code, this -- modification to the tree is harmless. declare Status : Traverse_Final_Result; begin if Is_List_Member (N) then Set_Condition (N, Original_Node (N)); Status := Check_All_Warnings (Condition (N)); else Rewrite (N, Original_Node (N)); Status := Check_All_Warnings (N); end if; return Status; end; else return OK; end if; end Check_For_Warning; -- Start of processing for Remove_Warning_Messages begin if Warnings_Detected /= 0 then declare Discard : Traverse_Final_Result; pragma Warnings (Off, Discard); begin Discard := Check_All_Warnings (N); end; end if; end Remove_Warning_Messages; procedure Remove_Warning_Messages (L : List_Id) is Stat : Node_Id; begin if Is_Non_Empty_List (L) then Stat := First (L); while Present (Stat) loop Remove_Warning_Messages (Stat); Next (Stat); end loop; end if; end Remove_Warning_Messages; -------------------- -- Reset_Warnings -- -------------------- procedure Reset_Warnings is begin Warnings_Treated_As_Errors := 0; Warnings_Detected := 0; Info_Messages := 0; Warnings_As_Errors_Count := 0; end Reset_Warnings; ---------------------- -- Adjust_Name_Case -- ---------------------- procedure Adjust_Name_Case (Buf : in out Bounded_String; Loc : Source_Ptr) is begin -- We have an all lower case name from Namet, and now we want to set -- the appropriate case. If possible we copy the actual casing from -- the source. If not we use standard identifier casing. declare Src_Ind : constant Source_File_Index := Get_Source_File_Index (Loc); Sbuffer : Source_Buffer_Ptr; Ref_Ptr : Integer; Src_Ptr : Source_Ptr; begin Ref_Ptr := 1; Src_Ptr := Loc; -- For standard locations, always use mixed case if Loc <= No_Location then Set_Casing (Mixed_Case); else -- Determine if the reference we are dealing with corresponds to -- text at the point of the error reference. This will often be -- the case for simple identifier references, and is the case -- where we can copy the casing from the source. Sbuffer := Source_Text (Src_Ind); while Ref_Ptr <= Buf.Length loop exit when Fold_Lower (Sbuffer (Src_Ptr)) /= Fold_Lower (Buf.Chars (Ref_Ptr)); Ref_Ptr := Ref_Ptr + 1; Src_Ptr := Src_Ptr + 1; end loop; -- If we get through the loop without a mismatch, then output the -- name the way it is cased in the source program if Ref_Ptr > Buf.Length then Src_Ptr := Loc; for J in 1 .. Buf.Length loop Buf.Chars (J) := Sbuffer (Src_Ptr); Src_Ptr := Src_Ptr + 1; end loop; -- Otherwise set the casing using the default identifier casing else Set_Casing (Buf, Identifier_Casing (Src_Ind)); end if; end if; end; end Adjust_Name_Case; procedure Adjust_Name_Case (Loc : Source_Ptr) is begin Adjust_Name_Case (Global_Name_Buffer, Loc); end Adjust_Name_Case; --------------------------- -- Set_Identifier_Casing -- --------------------------- procedure Set_Identifier_Casing (Identifier_Name : System.Address; File_Name : System.Address) is Ident : constant Big_String_Ptr := To_Big_String_Ptr (Identifier_Name); File : constant Big_String_Ptr := To_Big_String_Ptr (File_Name); Flen : Natural; Desired_Case : Casing_Type := Mixed_Case; -- Casing required for result. Default value of Mixed_Case is used if -- for some reason we cannot find the right file name in the table. begin -- Get length of file name Flen := 0; while File (Flen + 1) /= ASCII.NUL loop Flen := Flen + 1; end loop; -- Loop through file names to find matching one. This is a bit slow, but -- we only do it in error situations so it is not so terrible. Note that -- if the loop does not exit, then the desired case will be left set to -- Mixed_Case, this can happen if the name was not in canonical form. for J in 1 .. Last_Source_File loop Get_Name_String (Full_Debug_Name (J)); if Name_Len = Flen and then Name_Buffer (1 .. Name_Len) = String (File (1 .. Flen)) then Desired_Case := Identifier_Casing (J); exit; end if; end loop; -- Copy identifier as given to Name_Buffer for J in Name_Buffer'Range loop Name_Buffer (J) := Ident (J); if Name_Buffer (J) = ASCII.NUL then Name_Len := J - 1; exit; end if; end loop; Set_Casing (Desired_Case); end Set_Identifier_Casing; ----------------------- -- 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_Insertion_Node -- ---------------------------- procedure Set_Msg_Insertion_Node is K : Node_Kind; begin Suppress_Message := Error_Msg_Node_1 = Error or else Error_Msg_Node_1 = Any_Type; if Error_Msg_Node_1 = Empty then Set_Msg_Blank_Conditional; Set_Msg_Str ("<empty>"); elsif Error_Msg_Node_1 = Error then Set_Msg_Blank; Set_Msg_Str ("<error>"); elsif Error_Msg_Node_1 = Standard_Void_Type then Set_Msg_Blank; Set_Msg_Str ("procedure name"); elsif Nkind (Error_Msg_Node_1) in N_Entity and then Ekind (Error_Msg_Node_1) = E_Anonymous_Access_Subprogram_Type then Set_Msg_Blank; Set_Msg_Str ("access to subprogram"); else Set_Msg_Blank_Conditional; -- Output name K := Nkind (Error_Msg_Node_1); -- If we have operator case, skip quotes since name of operator -- itself will supply the required quotations. An operator can be an -- applied use in an expression or an explicit operator symbol, or an -- identifier whose name indicates it is an operator. if K in N_Op or else K = N_Operator_Symbol or else K = N_Defining_Operator_Symbol or else ((K = N_Identifier or else K = N_Defining_Identifier) and then Is_Operator_Name (Chars (Error_Msg_Node_1))) then Set_Msg_Node (Error_Msg_Node_1); -- Normal case, not an operator, surround with quotes else Set_Msg_Quote; Set_Qualification (Error_Msg_Qual_Level, Error_Msg_Node_1); Set_Msg_Node (Error_Msg_Node_1); Set_Msg_Quote; end if; end if; -- The following assignment ensures that a second ampersand insertion -- character will correspond to the Error_Msg_Node_2 parameter. We -- suppress possible validity checks in case operating in -gnatVa mode, -- and Error_Msg_Node_2 is not needed and has not been set. declare pragma Suppress (Range_Check); begin Error_Msg_Node_1 := Error_Msg_Node_2; end; end Set_Msg_Insertion_Node; -------------------------------------- -- Set_Msg_Insertion_Type_Reference -- -------------------------------------- procedure Set_Msg_Insertion_Type_Reference (Flag : Source_Ptr) is Ent : Entity_Id; begin Set_Msg_Blank; if Error_Msg_Node_1 = Standard_Void_Type then Set_Msg_Str ("package or procedure name"); return; elsif Error_Msg_Node_1 = Standard_Exception_Type then Set_Msg_Str ("exception name"); return; elsif Error_Msg_Node_1 = Any_Access or else Error_Msg_Node_1 = Any_Array or else Error_Msg_Node_1 = Any_Boolean or else Error_Msg_Node_1 = Any_Character or else Error_Msg_Node_1 = Any_Composite or else Error_Msg_Node_1 = Any_Discrete or else Error_Msg_Node_1 = Any_Fixed or else Error_Msg_Node_1 = Any_Integer or else Error_Msg_Node_1 = Any_Modular or else Error_Msg_Node_1 = Any_Numeric or else Error_Msg_Node_1 = Any_Real or else Error_Msg_Node_1 = Any_Scalar or else Error_Msg_Node_1 = Any_String then Get_Unqualified_Decoded_Name_String (Chars (Error_Msg_Node_1)); Set_Msg_Name_Buffer; return; elsif Error_Msg_Node_1 = Universal_Real then Set_Msg_Str ("type universal real"); return; elsif Error_Msg_Node_1 = Universal_Integer then Set_Msg_Str ("type universal integer"); return; elsif Error_Msg_Node_1 = Universal_Fixed then Set_Msg_Str ("type universal fixed"); return; end if; -- Special case of anonymous array if Nkind (Error_Msg_Node_1) in N_Entity and then Is_Array_Type (Error_Msg_Node_1) and then Present (Related_Array_Object (Error_Msg_Node_1)) then Set_Msg_Str ("type of "); Set_Msg_Node (Related_Array_Object (Error_Msg_Node_1)); Set_Msg_Str (" declared"); Set_Msg_Insertion_Line_Number (Sloc (Related_Array_Object (Error_Msg_Node_1)), Flag); return; end if; -- If we fall through, it is not a special case, so first output -- the name of the type, preceded by private for a private type if Is_Private_Type (Error_Msg_Node_1) then Set_Msg_Str ("private type "); else Set_Msg_Str ("type "); end if; Ent := Error_Msg_Node_1; if Is_Internal_Name (Chars (Ent)) then Unwind_Internal_Type (Ent); end if; -- Types in Standard are displayed as "Standard.name" if Sloc (Ent) <= Standard_Location then Set_Msg_Quote; Set_Msg_Str ("Standard."); Set_Msg_Node (Ent); Add_Class; Set_Msg_Quote; -- Types in other language defined units are displayed as -- "package-name.type-name" elsif Is_Predefined_File_Name (Unit_File_Name (Get_Source_Unit (Ent))) then Get_Unqualified_Decoded_Name_String (Unit_Name (Get_Source_Unit (Ent))); Name_Len := Name_Len - 2; Set_Msg_Blank_Conditional; Set_Msg_Quote; Set_Casing (Mixed_Case); Set_Msg_Name_Buffer; Set_Msg_Char ('.'); Set_Casing (Mixed_Case); Set_Msg_Node (Ent); Add_Class; Set_Msg_Quote; -- All other types display as "type name" defined at line xxx -- possibly qualified if qualification is requested. else Set_Msg_Quote; Set_Qualification (Error_Msg_Qual_Level, Ent); Set_Msg_Node (Ent); Add_Class; -- If we did not print a name (e.g. in the case of an anonymous -- subprogram type), there is no name to print, so remove quotes. if Buffer_Ends_With ('"') then Buffer_Remove ('"'); else Set_Msg_Quote; end if; end if; -- If the original type did not come from a predefined file, add the -- location where the type was defined. if Sloc (Error_Msg_Node_1) > Standard_Location and then not Is_Predefined_File_Name (Unit_File_Name (Get_Source_Unit (Error_Msg_Node_1))) then Set_Msg_Str (" defined"); Set_Msg_Insertion_Line_Number (Sloc (Error_Msg_Node_1), Flag); -- If it did come from a predefined file, deal with the case where -- this was a file with a generic instantiation from elsewhere. else if Sloc (Error_Msg_Node_1) > Standard_Location then declare Iloc : constant Source_Ptr := Instantiation_Location (Sloc (Error_Msg_Node_1)); begin if Iloc /= No_Location and then not Suppress_Instance_Location then Set_Msg_Str (" from instance"); Set_Msg_Insertion_Line_Number (Iloc, Flag); end if; end; end if; end if; end Set_Msg_Insertion_Type_Reference; --------------------------------- -- Set_Msg_Insertion_Unit_Name -- --------------------------------- procedure Set_Msg_Insertion_Unit_Name (Suffix : Boolean := True) is begin if Error_Msg_Unit_1 = No_Unit_Name then null; elsif Error_Msg_Unit_1 = Error_Unit_Name then Set_Msg_Blank; Set_Msg_Str ("<error>"); else Get_Unit_Name_String (Error_Msg_Unit_1, Suffix); Set_Msg_Blank; Set_Msg_Quote; Set_Msg_Name_Buffer; Set_Msg_Quote; end if; -- The following assignment ensures that a second percent insertion -- character will correspond to the Error_Msg_Unit_2 parameter. We -- suppress possible validity checks in case operating in -gnatVa mode, -- and Error_Msg_Unit_2 is not needed and has not been set. declare pragma Suppress (Range_Check); begin Error_Msg_Unit_1 := Error_Msg_Unit_2; end; end Set_Msg_Insertion_Unit_Name; ------------------ -- Set_Msg_Node -- ------------------ procedure Set_Msg_Node (Node : Node_Id) is Loc : Source_Ptr; Ent : Entity_Id; Nam : Name_Id; begin case Nkind (Node) is when N_Designator => Set_Msg_Node (Name (Node)); Set_Msg_Char ('.'); Set_Msg_Node (Identifier (Node)); return; when N_Defining_Program_Unit_Name => Set_Msg_Node (Name (Node)); Set_Msg_Char ('.'); Set_Msg_Node (Defining_Identifier (Node)); return; when N_Expanded_Name | N_Selected_Component => Set_Msg_Node (Prefix (Node)); Set_Msg_Char ('.'); Set_Msg_Node (Selector_Name (Node)); return; when others => null; end case; -- The only remaining possibilities are identifiers, defining -- identifiers, pragmas, and pragma argument associations. if Nkind (Node) = N_Pragma then Nam := Pragma_Name (Node); Loc := Sloc (Node); -- The other cases have Chars fields -- First deal with internal names, which generally represent something -- gone wrong. First attempt: if this is a rewritten node that rewrites -- something with a Chars field that is not an internal name, use that. elsif Is_Internal_Name (Chars (Node)) and then Nkind (Original_Node (Node)) in N_Has_Chars and then not Is_Internal_Name (Chars (Original_Node (Node))) then Nam := Chars (Original_Node (Node)); Loc := Sloc (Original_Node (Node)); -- Another shot for internal names, in the case of internal type names, -- we try to find a reasonable representation for the external name. elsif Is_Internal_Name (Chars (Node)) and then ((Is_Entity_Name (Node) and then Present (Entity (Node)) and then Is_Type (Entity (Node))) or else (Nkind (Node) = N_Defining_Identifier and then Is_Type (Node))) then if Nkind (Node) = N_Identifier then Ent := Entity (Node); else Ent := Node; end if; Loc := Sloc (Ent); -- If the type is the designated type of an access_to_subprogram, -- then there is no name to provide in the call. if Ekind (Ent) = E_Subprogram_Type then return; -- Otherwise, we will be able to find some kind of name to output else Unwind_Internal_Type (Ent); Nam := Chars (Ent); end if; -- If not internal name, or if we could not find a reasonable possible -- substitution for the internal name, just use name in Chars field. else Nam := Chars (Node); Loc := Sloc (Node); end if; -- At this stage, the name to output is in Nam Get_Unqualified_Decoded_Name_String (Nam); -- Remove trailing upper case letters from the name (useful for -- dealing with some cases of internal names). while Name_Len > 1 and then Name_Buffer (Name_Len) in 'A' .. 'Z' loop Name_Len := Name_Len - 1; end loop; -- If we have any of the names from standard that start with the -- characters "any " (e.g. Any_Type), then kill the message since -- almost certainly it is a junk cascaded message. if Name_Len > 4 and then Name_Buffer (1 .. 4) = "any " then Kill_Message := True; end if; -- If we still have an internal name, kill the message (will only -- work if we already had errors!) if Is_Internal_Name then Kill_Message := True; end if; -- Remaining step is to adjust casing and possibly add 'Class Adjust_Name_Case (Global_Name_Buffer, Loc); Set_Msg_Name_Buffer; Add_Class; end Set_Msg_Node; ------------------ -- Set_Msg_Text -- ------------------ procedure Set_Msg_Text (Text : String; Flag : Source_Ptr) is C : Character; -- Current character P : Natural; -- Current index; procedure Skip_Msg_Insertion_Warning (C : Character); -- Deal with ? ?? ?x? ?X? ?*? ?$? insertion sequences (and the same -- sequences using < instead of ?). The caller has already bumped -- the pointer past the initial ? or < and C is set to this initial -- character (? or <). This procedure skips past the rest of the -- sequence. We do not need to set Msg_Insertion_Char, since this -- was already done during the message prescan. -------------------------------- -- Skip_Msg_Insertion_Warning -- -------------------------------- procedure Skip_Msg_Insertion_Warning (C : Character) is begin if P <= Text'Last and then Text (P) = C then P := P + 1; elsif P + 1 <= Text'Last and then (Text (P) in 'a' .. 'z' or else Text (P) in 'A' .. 'Z' or else Text (P) = '*' or else Text (P) = '$') and then Text (P + 1) = C then P := P + 2; end if; end Skip_Msg_Insertion_Warning; -- Start of processing for Set_Msg_Text begin Manual_Quote_Mode := False; Msglen := 0; Flag_Source := Get_Source_File_Index (Flag); -- Skip info: at start, we have recorded this in Is_Info_Msg, and this -- will be used (Info field in error message object) to put back the -- string when it is printed. We need to do this, or we get confused -- with instantiation continuations. if Text'Length > 6 and then Text (Text'First .. Text'First + 5) = "info: " then P := Text'First + 6; else P := Text'First; end if; -- Loop through characters of message while P <= Text'Last loop C := Text (P); P := P + 1; -- Check for insertion character or sequence case C is when '%' => if P <= Text'Last and then Text (P) = '%' then P := P + 1; Set_Msg_Insertion_Name_Literal; else Set_Msg_Insertion_Name; end if; when '$' => if P <= Text'Last and then Text (P) = '$' then P := P + 1; Set_Msg_Insertion_Unit_Name (Suffix => False); else Set_Msg_Insertion_Unit_Name; end if; when '{' => Set_Msg_Insertion_File_Name; when '}' => Set_Msg_Insertion_Type_Reference (Flag); when '*' => Set_Msg_Insertion_Reserved_Name; when '&' => Set_Msg_Insertion_Node; when '#' => Set_Msg_Insertion_Line_Number (Error_Msg_Sloc, Flag); when '\' => Continuation := True; if P <= Text'Last and then Text (P) = '\' then Continuation_New_Line := True; P := P + 1; end if; when '@' => Set_Msg_Insertion_Column; when '>' => Set_Msg_Insertion_Run_Time_Name; when '^' => Set_Msg_Insertion_Uint; when '`' => Manual_Quote_Mode := not Manual_Quote_Mode; Set_Msg_Char ('"'); when '!' => null; -- already dealt with when '?' => Skip_Msg_Insertion_Warning ('?'); when '<' => Skip_Msg_Insertion_Warning ('<'); when '|' => null; -- already dealt with when ''' => Set_Msg_Char (Text (P)); P := P + 1; when '~' => Set_Msg_Str (Error_Msg_String (1 .. Error_Msg_Strlen)); -- Upper case letter when 'A' .. 'Z' => -- Start of reserved word if two or more if P <= Text'Last and then Text (P) in 'A' .. 'Z' then P := P - 1; Set_Msg_Insertion_Reserved_Word (Text, P); -- Single upper case letter is just inserted else Set_Msg_Char (C); end if; -- '[' (will be/would have been raised at run time) when '[' => if Is_Warning_Msg then Set_Msg_Str ("will be raised at run time"); else Set_Msg_Str ("would have been raised at run time"); end if; -- ']' (may be/might have been raised at run time) when ']' => if Is_Warning_Msg then Set_Msg_Str ("may be raised at run time"); else Set_Msg_Str ("might have been raised at run time"); end if; -- Normal character with no special treatment when others => Set_Msg_Char (C); end case; end loop; end Set_Msg_Text; ---------------- -- Set_Posted -- ---------------- procedure Set_Posted (N : Node_Id) is P : Node_Id; begin if Is_Serious_Error then -- We always set Error_Posted on the node itself Set_Error_Posted (N); -- If it is a subexpression, then set Error_Posted on parents up to -- and including the first non-subexpression construct. This helps -- avoid cascaded error messages within a single expression. P := N; loop P := Parent (P); exit when No (P); Set_Error_Posted (P); exit when Nkind (P) not in N_Subexpr; end loop; if Nkind_In (P, N_Pragma_Argument_Association, N_Component_Association, N_Discriminant_Association, N_Generic_Association, N_Parameter_Association) then Set_Error_Posted (Parent (P)); end if; -- A special check, if we just posted an error on an attribute -- definition clause, then also set the entity involved as posted. -- For example, this stops complaining about the alignment after -- complaining about the size, which is likely to be useless. if Nkind (P) = N_Attribute_Definition_Clause then if Is_Entity_Name (Name (P)) then Set_Error_Posted (Entity (Name (P))); end if; end if; end if; end Set_Posted; ----------------------- -- Set_Qualification -- ----------------------- procedure Set_Qualification (N : Nat; E : Entity_Id) is begin if N /= 0 and then Scope (E) /= Standard_Standard then Set_Qualification (N - 1, Scope (E)); Set_Msg_Node (Scope (E)); Set_Msg_Char ('.'); end if; end Set_Qualification; ------------------------ -- Special_Msg_Delete -- ------------------------ -- Is it really right to have all this specialized knowledge in errout? function Special_Msg_Delete (Msg : String; N : Node_Or_Entity_Id; E : Node_Or_Entity_Id) return Boolean is begin -- Never delete messages in -gnatdO mode if Debug_Flag_OO then return False; -- Processing for "atomic access cannot be guaranteed" elsif Msg = "atomic access to & cannot be guaranteed" then -- When an atomic object refers to a non-atomic type in the same -- scope, we implicitly make the type atomic. In the non-error case -- this is surely safe (and in fact prevents an error from occurring -- if the type is not atomic by default). But if the object cannot be -- made atomic, then we introduce an extra junk message by this -- manipulation, which we get rid of here. -- We identify this case by the fact that it references a type for -- which Is_Atomic is set, but there is no Atomic pragma setting it. if Is_Type (E) and then Is_Atomic (E) and then No (Get_Rep_Pragma (E, Name_Atomic)) then return True; end if; -- Similar processing for "volatile full access cannot be guaranteed" elsif Msg = "volatile full access to & cannot be guaranteed" then if Is_Type (E) and then Is_Volatile_Full_Access (E) and then No (Get_Rep_Pragma (E, Name_Volatile_Full_Access)) then return True; end if; -- Processing for "Size too small" messages elsif Msg = "size for& too small, minimum allowed is ^" then -- Suppress "size too small" errors in CodePeer mode, since code may -- be analyzed in a different configuration than the one used for -- compilation. Even when the configurations match, this message -- may be issued on correct code, because pragma Pack is ignored -- in CodePeer mode. if CodePeer_Mode then return True; -- When a size is wrong for a frozen type there is no explicit size -- clause, and other errors have occurred, suppress the message, -- since it is likely that this size error is a cascaded result of -- other errors. The reason we eliminate unfrozen types is that -- messages issued before the freeze type are for sure OK. elsif Is_Frozen (E) and then Serious_Errors_Detected > 0 and then Nkind (N) /= N_Component_Clause and then Nkind (Parent (N)) /= N_Component_Clause and then No (Get_Attribute_Definition_Clause (E, Attribute_Size)) and then No (Get_Attribute_Definition_Clause (E, Attribute_Object_Size)) and then No (Get_Attribute_Definition_Clause (E, Attribute_Value_Size)) then return True; end if; end if; -- All special tests complete, so go ahead with message return False; end Special_Msg_Delete; ----------------- -- SPARK_Msg_N -- ----------------- procedure SPARK_Msg_N (Msg : String; N : Node_Or_Entity_Id) is begin if SPARK_Mode /= Off then Error_Msg_N (Msg, N); end if; end SPARK_Msg_N; ------------------ -- SPARK_Msg_NE -- ------------------ procedure SPARK_Msg_NE (Msg : String; N : Node_Or_Entity_Id; E : Node_Or_Entity_Id) is begin if SPARK_Mode /= Off then Error_Msg_NE (Msg, N, E); end if; end SPARK_Msg_NE; -------------------------- -- Unwind_Internal_Type -- -------------------------- procedure Unwind_Internal_Type (Ent : in out Entity_Id) is Derived : Boolean := False; Mchar : Character; Old_Ent : Entity_Id; begin -- Undo placement of a quote, since we will put it back later Mchar := Msg_Buffer (Msglen); if Mchar = '"' then Msglen := Msglen - 1; end if; -- The loop here deals with recursive types, we are trying to find a -- related entity that is not an implicit type. Note that the check with -- Old_Ent stops us from getting "stuck". Also, we don't output the -- "type derived from" message more than once in the case where we climb -- up multiple levels. Find : loop Old_Ent := Ent; -- Implicit access type, use directly designated type In Ada 2005, -- the designated type may be an anonymous access to subprogram, in -- which case we can only point to its definition. if Is_Access_Type (Ent) then if Ekind (Ent) = E_Access_Subprogram_Type or else Ekind (Ent) = E_Anonymous_Access_Subprogram_Type or else Is_Access_Protected_Subprogram_Type (Ent) then Ent := Directly_Designated_Type (Ent); if not Comes_From_Source (Ent) then if Buffer_Ends_With ("type ") then Buffer_Remove ("type "); end if; end if; if Ekind (Ent) = E_Function then Set_Msg_Str ("access to function "); elsif Ekind (Ent) = E_Procedure then Set_Msg_Str ("access to procedure "); else Set_Msg_Str ("access to subprogram"); end if; exit Find; -- Type is access to object, named or anonymous else Set_Msg_Str ("access to "); Ent := Directly_Designated_Type (Ent); end if; -- Classwide type elsif Is_Class_Wide_Type (Ent) then Class_Flag := True; Ent := Root_Type (Ent); -- Use base type if this is a subtype elsif Ent /= Base_Type (Ent) then Buffer_Remove ("type "); -- Avoid duplication "subtype of subtype of", and also replace -- "derived from subtype of" simply by "derived from" if not Buffer_Ends_With ("subtype of ") and then not Buffer_Ends_With ("derived from ") then Set_Msg_Str ("subtype of "); end if; Ent := Base_Type (Ent); -- If this is a base type with a first named subtype, use the first -- named subtype instead. This is not quite accurate in all cases, -- but it makes too much noise to be accurate and add 'Base in all -- cases. Note that we only do this is the first named subtype is not -- itself an internal name. This avoids the obvious loop (subtype -> -- basetype -> subtype) which would otherwise occur). else declare FST : constant Entity_Id := First_Subtype (Ent); begin if not Is_Internal_Name (Chars (FST)) then Ent := FST; exit Find; -- Otherwise use root type else if not Derived then Buffer_Remove ("type "); -- Test for "subtype of type derived from" which seems -- excessive and is replaced by "type derived from". Buffer_Remove ("subtype of"); -- Avoid duplicated "type derived from type derived from" if not Buffer_Ends_With ("type derived from ") then Set_Msg_Str ("type derived from "); end if; Derived := True; end if; end if; end; Ent := Etype (Ent); end if; -- If we are stuck in a loop, get out and settle for the internal -- name after all. In this case we set to kill the message if it is -- not the first error message (we really try hard not to show the -- dirty laundry of the implementation to the poor user). if Ent = Old_Ent then Kill_Message := True; exit Find; end if; -- Get out if we finally found a non-internal name to use exit Find when not Is_Internal_Name (Chars (Ent)); end loop Find; if Mchar = '"' then Set_Msg_Char ('"'); end if; end Unwind_Internal_Type; -------------------- -- Warn_Insertion -- -------------------- function Warn_Insertion return String is begin case Warning_Msg_Char is when '?' => return "??"; when 'a' .. 'z' | 'A' .. 'Z' | '*' | '$' => return '?' & Warning_Msg_Char & '?'; when ' ' => return "?"; when others => raise Program_Error; end case; end Warn_Insertion; end Errout;
------------------------------------------------------------------------------ -- -- -- GNAT RUN-TIME COMPONENTS -- -- -- -- A D A . T E X T _ I O . D E C I M A L _ A U X -- -- -- -- S p e c -- -- -- -- Copyright (C) 1992-2006, Free Software Foundation, Inc. -- -- -- -- GNAT is free software; you can redistribute it and/or modify it under -- -- terms of the GNU General Public License as published by the Free Soft- -- -- ware Foundation; either version 2, or (at your option) any later ver- -- -- sion. GNAT is distributed in the hope that it will be useful, but WITH- -- -- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY -- -- or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -- -- for more details. You should have received a copy of the GNU General -- -- Public License distributed with GNAT; see file COPYING. If not, write -- -- to the Free Software Foundation, 51 Franklin Street, Fifth Floor, -- -- Boston, MA 02110-1301, USA. -- -- -- -- -- -- -- -- -- -- -- GNAT was originally developed by the GNAT team at New York University. -- -- Extensive contributions were provided by Ada Core Technologies Inc. -- -- -- ------------------------------------------------------------------------------ -- This package contains the routines for Ada.Text_IO.Decimal_IO that are -- shared among separate instantiations of this package. The routines in -- the package are identical semantically to those declared in Text_IO, -- except that default values have been supplied by the generic, and the -- Num parameter has been replaced by Integer or Long_Long_Integer, with -- an additional Scale parameter giving the value of Num'Scale. In addition -- the Get routines return the value rather than store it in an Out parameter. private package Ada.Text_IO.Decimal_Aux is function Get_Dec (File : File_Type; Width : Field; Scale : Integer) return Integer; function Get_LLD (File : File_Type; Width : Field; Scale : Integer) return Long_Long_Integer; procedure Put_Dec (File : File_Type; Item : Integer; Fore : Field; Aft : Field; Exp : Field; Scale : Integer); procedure Put_LLD (File : File_Type; Item : Long_Long_Integer; Fore : Field; Aft : Field; Exp : Field; Scale : Integer); function Gets_Dec (From : String; Last : access Positive; Scale : Integer) return Integer; function Gets_LLD (From : String; Last : access Positive; Scale : Integer) return Long_Long_Integer; procedure Puts_Dec (To : out String; Item : Integer; Aft : Field; Exp : Field; Scale : Integer); procedure Puts_LLD (To : out String; Item : Long_Long_Integer; Aft : Field; Exp : Field; Scale : Integer); end Ada.Text_IO.Decimal_Aux;
pragma License (Unrestricted); private with Ada.Containers.Hashed_Maps; package GNAT.Dynamic_HTables is -- Simple_HTable generic type Header_Num is range <>; type Element is private; No_Element : Element; type Key is private; with function Hash (F : Key) return Header_Num; with function Equal (F1, F2 : Key) return Boolean; package Simple_HTable is type Instance is private; procedure Set (T : in out Instance; K : Key; E : Element); procedure Reset (T : in out Instance); function Get (T : Instance; K : Key) return Element; function Get_First (T : in out Instance) return Element; function Get_Next (T : in out Instance) return Element; private function Hash (Item : Key) return Ada.Containers.Hash_Type; package Maps is new Ada.Containers.Hashed_Maps ( Key_Type => Key, Element_Type => Element, Hash => Hash, Equivalent_Keys => Equal); type Instance is record Map : Maps.Map; Position : Maps.Cursor; end record; end Simple_HTable; end GNAT.Dynamic_HTables;
-- Copyright 2015 Steven Stewart-Gallus -- -- Licensed under the Apache License, Version 2.0 (the "License"); -- you may not use this file except in compliance with the License. -- You may obtain a copy of the License at -- -- http://www.apache.org/licenses/LICENSE-2.0 -- -- Unless required by applicable law or agreed to in writing, software -- distributed under the License is distributed on an "AS IS" BASIS, -- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or -- implied. See the License for the specific language governing -- permissions and limitations under the License. with Interfaces.C; use Interfaces.C; with Libc.Stdint; with XCB.XProto; with System; with Interfaces.C.Strings; package XCB.XKB with Spark_Mode => Off is pragma Preelaborate; pragma Link_With ("-lxcb -lxcb-xkb"); XCB_XKB_MAJOR_VERSION : constant := 1; XCB_XKB_MINOR_VERSION : constant := 0; XCB_XKB_KEYBOARD : constant := 0; -- XCB_XKB_USE_EXTENSION : constant := 0; -- XCB_XKB_SELECT_EVENTS : constant := 1; -- XCB_XKB_BELL : constant := 3; -- XCB_XKB_GET_STATE : constant := 4; -- XCB_XKB_LATCH_LOCK_STATE : constant := 5; -- XCB_XKB_GET_CONTROLS : constant := 6; -- XCB_XKB_SET_CONTROLS : constant := 7; -- XCB_XKB_GET_MAP : constant := 8; -- XCB_XKB_SET_MAP : constant := 9; -- XCB_XKB_GET_COMPAT_MAP : constant := 10; -- XCB_XKB_SET_COMPAT_MAP : constant := 11; -- XCB_XKB_GET_INDICATOR_STATE : constant := 12; -- XCB_XKB_GET_INDICATOR_MAP : constant := 13; -- XCB_XKB_SET_INDICATOR_MAP : constant := 14; -- XCB_XKB_GET_NAMED_INDICATOR : constant := 15; -- XCB_XKB_SET_NAMED_INDICATOR : constant := 16; -- XCB_XKB_GET_NAMES : constant := 17; -- XCB_XKB_SET_NAMES : constant := 18; -- XCB_XKB_PER_CLIENT_FLAGS : constant := 21; -- XCB_XKB_LIST_COMPONENTS : constant := 22; -- XCB_XKB_GET_KBD_BY_NAME : constant := 23; -- XCB_XKB_GET_DEVICE_INFO : constant := 24; -- XCB_XKB_SET_DEVICE_INFO : constant := 25; -- XCB_XKB_SET_DEBUGGING_FLAGS : constant := 101; XCB_XKB_NEW_KEYBOARD_NOTIFY : constant := 0; XCB_XKB_MAP_NOTIFY : constant := 1; XCB_XKB_STATE_NOTIFY : constant := 2; XCB_XKB_CONTROLS_NOTIFY : constant := 3; XCB_XKB_INDICATOR_STATE_NOTIFY : constant := 4; XCB_XKB_INDICATOR_MAP_NOTIFY : constant := 5; XCB_XKB_NAMES_NOTIFY : constant := 6; XCB_XKB_COMPAT_MAP_NOTIFY : constant := 7; XCB_XKB_BELL_NOTIFY : constant := 8; XCB_XKB_ACTION_MESSAGE : constant := 9; XCB_XKB_ACCESS_X_NOTIFY : constant := 10; XCB_XKB_EXTENSION_DEVICE_NOTIFY : constant := 11; xcb_xkb_id : aliased XCB .xcb_extension_t_access; -- /usr/include/xcb/xkb.h:25 pragma Import (C, xcb_xkb_id, "xcb_xkb_id"); subtype xcb_xkb_const_t is unsigned; XCB_XKB_CONST_MAX_LEGAL_KEY_CODE : constant xcb_xkb_const_t := 255; XCB_XKB_CONST_PER_KEY_BIT_ARRAY_SIZE : constant xcb_xkb_const_t := 32; XCB_XKB_CONST_KEY_NAME_LENGTH : constant xcb_xkb_const_t := 4; -- /usr/include/xcb/xkb.h:27 subtype xcb_xkb_event_type_t is unsigned; XCB_XKB_EVENT_TYPE_NEW_KEYBOARD_NOTIFY : constant xcb_xkb_event_type_t := 1; XCB_XKB_EVENT_TYPE_MAP_NOTIFY : constant xcb_xkb_event_type_t := 2; XCB_XKB_EVENT_TYPE_STATE_NOTIFY : constant xcb_xkb_event_type_t := 4; XCB_XKB_EVENT_TYPE_CONTROLS_NOTIFY : constant xcb_xkb_event_type_t := 8; XCB_XKB_EVENT_TYPE_INDICATOR_STATE_NOTIFY : constant xcb_xkb_event_type_t := 16; XCB_XKB_EVENT_TYPE_INDICATOR_MAP_NOTIFY : constant xcb_xkb_event_type_t := 32; XCB_XKB_EVENT_TYPE_NAMES_NOTIFY : constant xcb_xkb_event_type_t := 64; XCB_XKB_EVENT_TYPE_COMPAT_MAP_NOTIFY : constant xcb_xkb_event_type_t := 128; XCB_XKB_EVENT_TYPE_BELL_NOTIFY : constant xcb_xkb_event_type_t := 256; XCB_XKB_EVENT_TYPE_ACTION_MESSAGE : constant xcb_xkb_event_type_t := 512; XCB_XKB_EVENT_TYPE_ACCESS_X_NOTIFY : constant xcb_xkb_event_type_t := 1024; XCB_XKB_EVENT_TYPE_EXTENSION_DEVICE_NOTIFY : constant xcb_xkb_event_type_t := 2048; -- /usr/include/xcb/xkb.h:33 subtype xcb_xkb_nkn_detail_t is unsigned; XCB_XKB_NKN_DETAIL_KEYCODES : constant xcb_xkb_nkn_detail_t := 1; XCB_XKB_NKN_DETAIL_GEOMETRY : constant xcb_xkb_nkn_detail_t := 2; XCB_XKB_NKN_DETAIL_DEVICE_ID : constant xcb_xkb_nkn_detail_t := 4; -- /usr/include/xcb/xkb.h:48 subtype xcb_xkb_axn_detail_t is unsigned; XCB_XKB_AXN_DETAIL_SK_PRESS : constant xcb_xkb_axn_detail_t := 1; XCB_XKB_AXN_DETAIL_SK_ACCEPT : constant xcb_xkb_axn_detail_t := 2; XCB_XKB_AXN_DETAIL_SK_REJECT : constant xcb_xkb_axn_detail_t := 4; XCB_XKB_AXN_DETAIL_SK_RELEASE : constant xcb_xkb_axn_detail_t := 8; XCB_XKB_AXN_DETAIL_BK_ACCEPT : constant xcb_xkb_axn_detail_t := 16; XCB_XKB_AXN_DETAIL_BK_REJECT : constant xcb_xkb_axn_detail_t := 32; XCB_XKB_AXN_DETAIL_AXK_WARNING : constant xcb_xkb_axn_detail_t := 64; -- /usr/include/xcb/xkb.h:54 subtype xcb_xkb_map_part_t is unsigned; XCB_XKB_MAP_PART_KEY_TYPES : constant xcb_xkb_map_part_t := 1; XCB_XKB_MAP_PART_KEY_SYMS : constant xcb_xkb_map_part_t := 2; XCB_XKB_MAP_PART_MODIFIER_MAP : constant xcb_xkb_map_part_t := 4; XCB_XKB_MAP_PART_EXPLICIT_COMPONENTS : constant xcb_xkb_map_part_t := 8; XCB_XKB_MAP_PART_KEY_ACTIONS : constant xcb_xkb_map_part_t := 16; XCB_XKB_MAP_PART_KEY_BEHAVIORS : constant xcb_xkb_map_part_t := 32; XCB_XKB_MAP_PART_VIRTUAL_MODS : constant xcb_xkb_map_part_t := 64; XCB_XKB_MAP_PART_VIRTUAL_MOD_MAP : constant xcb_xkb_map_part_t := 128; -- /usr/include/xcb/xkb.h:64 subtype xcb_xkb_set_map_flags_t is unsigned; XCB_XKB_SET_MAP_FLAGS_RESIZE_TYPES : constant xcb_xkb_set_map_flags_t := 1; XCB_XKB_SET_MAP_FLAGS_RECOMPUTE_ACTIONS : constant xcb_xkb_set_map_flags_t := 2; -- /usr/include/xcb/xkb.h:75 subtype xcb_xkb_state_part_t is unsigned; XCB_XKB_STATE_PART_MODIFIER_STATE : constant xcb_xkb_state_part_t := 1; XCB_XKB_STATE_PART_MODIFIER_BASE : constant xcb_xkb_state_part_t := 2; XCB_XKB_STATE_PART_MODIFIER_LATCH : constant xcb_xkb_state_part_t := 4; XCB_XKB_STATE_PART_MODIFIER_LOCK : constant xcb_xkb_state_part_t := 8; XCB_XKB_STATE_PART_GROUP_STATE : constant xcb_xkb_state_part_t := 16; XCB_XKB_STATE_PART_GROUP_BASE : constant xcb_xkb_state_part_t := 32; XCB_XKB_STATE_PART_GROUP_LATCH : constant xcb_xkb_state_part_t := 64; XCB_XKB_STATE_PART_GROUP_LOCK : constant xcb_xkb_state_part_t := 128; XCB_XKB_STATE_PART_COMPAT_STATE : constant xcb_xkb_state_part_t := 256; XCB_XKB_STATE_PART_GRAB_MODS : constant xcb_xkb_state_part_t := 512; XCB_XKB_STATE_PART_COMPAT_GRAB_MODS : constant xcb_xkb_state_part_t := 1024; XCB_XKB_STATE_PART_LOOKUP_MODS : constant xcb_xkb_state_part_t := 2048; XCB_XKB_STATE_PART_COMPAT_LOOKUP_MODS : constant xcb_xkb_state_part_t := 4096; XCB_XKB_STATE_PART_POINTER_BUTTONS : constant xcb_xkb_state_part_t := 8192; -- /usr/include/xcb/xkb.h:80 subtype xcb_xkb_bool_ctrl_t is unsigned; XCB_XKB_BOOL_CTRL_REPEAT_KEYS : constant xcb_xkb_bool_ctrl_t := 1; XCB_XKB_BOOL_CTRL_SLOW_KEYS : constant xcb_xkb_bool_ctrl_t := 2; XCB_XKB_BOOL_CTRL_BOUNCE_KEYS : constant xcb_xkb_bool_ctrl_t := 4; XCB_XKB_BOOL_CTRL_STICKY_KEYS : constant xcb_xkb_bool_ctrl_t := 8; XCB_XKB_BOOL_CTRL_MOUSE_KEYS : constant xcb_xkb_bool_ctrl_t := 16; XCB_XKB_BOOL_CTRL_MOUSE_KEYS_ACCEL : constant xcb_xkb_bool_ctrl_t := 32; XCB_XKB_BOOL_CTRL_ACCESS_X_KEYS : constant xcb_xkb_bool_ctrl_t := 64; XCB_XKB_BOOL_CTRL_ACCESS_X_TIMEOUT_MASK : constant xcb_xkb_bool_ctrl_t := 128; XCB_XKB_BOOL_CTRL_ACCESS_X_FEEDBACK_MASK : constant xcb_xkb_bool_ctrl_t := 256; XCB_XKB_BOOL_CTRL_AUDIBLE_BELL_MASK : constant xcb_xkb_bool_ctrl_t := 512; XCB_XKB_BOOL_CTRL_OVERLAY_1_MASK : constant xcb_xkb_bool_ctrl_t := 1024; XCB_XKB_BOOL_CTRL_OVERLAY_2_MASK : constant xcb_xkb_bool_ctrl_t := 2048; XCB_XKB_BOOL_CTRL_IGNORE_GROUP_LOCK_MASK : constant xcb_xkb_bool_ctrl_t := 4096; -- /usr/include/xcb/xkb.h:97 subtype xcb_xkb_control_t is unsigned; XCB_XKB_CONTROL_GROUPS_WRAP : constant xcb_xkb_control_t := 134217728; XCB_XKB_CONTROL_INTERNAL_MODS : constant xcb_xkb_control_t := 268435456; XCB_XKB_CONTROL_IGNORE_LOCK_MODS : constant xcb_xkb_control_t := 536870912; XCB_XKB_CONTROL_PER_KEY_REPEAT : constant xcb_xkb_control_t := 1073741824; XCB_XKB_CONTROL_CONTROLS_ENABLED : constant xcb_xkb_control_t := 2147483648; -- /usr/include/xcb/xkb.h:113 subtype xcb_xkb_ax_option_t is unsigned; XCB_XKB_AX_OPTION_SK_PRESS_FB : constant xcb_xkb_ax_option_t := 1; XCB_XKB_AX_OPTION_SK_ACCEPT_FB : constant xcb_xkb_ax_option_t := 2; XCB_XKB_AX_OPTION_FEATURE_FB : constant xcb_xkb_ax_option_t := 4; XCB_XKB_AX_OPTION_SLOW_WARN_FB : constant xcb_xkb_ax_option_t := 8; XCB_XKB_AX_OPTION_INDICATOR_FB : constant xcb_xkb_ax_option_t := 16; XCB_XKB_AX_OPTION_STICKY_KEYS_FB : constant xcb_xkb_ax_option_t := 32; XCB_XKB_AX_OPTION_TWO_KEYS : constant xcb_xkb_ax_option_t := 64; XCB_XKB_AX_OPTION_LATCH_TO_LOCK : constant xcb_xkb_ax_option_t := 128; XCB_XKB_AX_OPTION_SK_RELEASE_FB : constant xcb_xkb_ax_option_t := 256; XCB_XKB_AX_OPTION_SK_REJECT_FB : constant xcb_xkb_ax_option_t := 512; XCB_XKB_AX_OPTION_BK_REJECT_FB : constant xcb_xkb_ax_option_t := 1024; XCB_XKB_AX_OPTION_DUMB_BELL : constant xcb_xkb_ax_option_t := 2048; -- /usr/include/xcb/xkb.h:121 subtype xcb_xkb_device_spec_t is Libc.Stdint.uint16_t; -- /usr/include/xcb/xkb.h:136 type xcb_xkb_device_spec_iterator_t is record data : access xcb_xkb_device_spec_t; -- /usr/include/xcb/xkb.h:142 c_rem : aliased int; -- /usr/include/xcb/xkb.h:143 index : aliased int; -- /usr/include/xcb/xkb.h:144 end record; pragma Convention (C_Pass_By_Copy, xcb_xkb_device_spec_iterator_t); -- /usr/include/xcb/xkb.h:141 subtype xcb_xkb_led_class_result_t is unsigned; XCB_XKB_LED_CLASS_RESULT_KBD_FEEDBACK_CLASS : constant xcb_xkb_led_class_result_t := 0; XCB_XKB_LED_CLASS_RESULT_LED_FEEDBACK_CLASS : constant xcb_xkb_led_class_result_t := 4; -- /usr/include/xcb/xkb.h:147 subtype xcb_xkb_led_class_t is unsigned; XCB_XKB_LED_CLASS_KBD_FEEDBACK_CLASS : constant xcb_xkb_led_class_t := 0; XCB_XKB_LED_CLASS_LED_FEEDBACK_CLASS : constant xcb_xkb_led_class_t := 4; XCB_XKB_LED_CLASS_DFLT_XI_CLASS : constant xcb_xkb_led_class_t := 768; XCB_XKB_LED_CLASS_ALL_XI_CLASSES : constant xcb_xkb_led_class_t := 1280; -- /usr/include/xcb/xkb.h:152 subtype xcb_xkb_led_class_spec_t is Libc.Stdint.uint16_t; -- /usr/include/xcb/xkb.h:159 type xcb_xkb_led_class_spec_iterator_t is record data : access xcb_xkb_led_class_spec_t; -- /usr/include/xcb/xkb.h:165 c_rem : aliased int; -- /usr/include/xcb/xkb.h:166 index : aliased int; -- /usr/include/xcb/xkb.h:167 end record; pragma Convention (C_Pass_By_Copy, xcb_xkb_led_class_spec_iterator_t); -- /usr/include/xcb/xkb.h:164 subtype xcb_xkb_bell_class_result_t is unsigned; XCB_XKB_BELL_CLASS_RESULT_KBD_FEEDBACK_CLASS : constant xcb_xkb_bell_class_result_t := 0; XCB_XKB_BELL_CLASS_RESULT_BELL_FEEDBACK_CLASS : constant xcb_xkb_bell_class_result_t := 5; -- /usr/include/xcb/xkb.h:170 subtype xcb_xkb_bell_class_t is unsigned; XCB_XKB_BELL_CLASS_KBD_FEEDBACK_CLASS : constant xcb_xkb_bell_class_t := 0; XCB_XKB_BELL_CLASS_BELL_FEEDBACK_CLASS : constant xcb_xkb_bell_class_t := 5; XCB_XKB_BELL_CLASS_DFLT_XI_CLASS : constant xcb_xkb_bell_class_t := 768; -- /usr/include/xcb/xkb.h:175 subtype xcb_xkb_bell_class_spec_t is Libc.Stdint.uint16_t; -- /usr/include/xcb/xkb.h:181 type xcb_xkb_bell_class_spec_iterator_t is record data : access xcb_xkb_bell_class_spec_t; -- /usr/include/xcb/xkb.h:187 c_rem : aliased int; -- /usr/include/xcb/xkb.h:188 index : aliased int; -- /usr/include/xcb/xkb.h:189 end record; pragma Convention (C_Pass_By_Copy, xcb_xkb_bell_class_spec_iterator_t); -- /usr/include/xcb/xkb.h:186 subtype xcb_xkb_id_t is unsigned; XCB_XKB_ID_USE_CORE_KBD : constant xcb_xkb_id_t := 256; XCB_XKB_ID_USE_CORE_PTR : constant xcb_xkb_id_t := 512; XCB_XKB_ID_DFLT_XI_CLASS : constant xcb_xkb_id_t := 768; XCB_XKB_ID_DFLT_XI_ID : constant xcb_xkb_id_t := 1024; XCB_XKB_ID_ALL_XI_CLASS : constant xcb_xkb_id_t := 1280; XCB_XKB_ID_ALL_XI_ID : constant xcb_xkb_id_t := 1536; XCB_XKB_ID_XI_NONE : constant xcb_xkb_id_t := 65280; -- /usr/include/xcb/xkb.h:192 subtype xcb_xkb_id_spec_t is Libc.Stdint.uint16_t; -- /usr/include/xcb/xkb.h:202 type xcb_xkb_id_spec_iterator_t is record data : access xcb_xkb_id_spec_t; -- /usr/include/xcb/xkb.h:208 c_rem : aliased int; -- /usr/include/xcb/xkb.h:209 index : aliased int; -- /usr/include/xcb/xkb.h:210 end record; pragma Convention (C_Pass_By_Copy, xcb_xkb_id_spec_iterator_t); -- /usr/include/xcb/xkb.h:207 type xcb_xkb_group_t is (XCB_XKB_GROUP_1, XCB_XKB_GROUP_2, XCB_XKB_GROUP_3, XCB_XKB_GROUP_4); pragma Convention (C, xcb_xkb_group_t); -- /usr/include/xcb/xkb.h:213 subtype xcb_xkb_groups_t is unsigned; XCB_XKB_GROUPS_ANY : constant xcb_xkb_groups_t := 254; XCB_XKB_GROUPS_ALL : constant xcb_xkb_groups_t := 255; -- /usr/include/xcb/xkb.h:220 subtype xcb_xkb_set_of_group_t is unsigned; XCB_XKB_SET_OF_GROUP_GROUP_1 : constant xcb_xkb_set_of_group_t := 1; XCB_XKB_SET_OF_GROUP_GROUP_2 : constant xcb_xkb_set_of_group_t := 2; XCB_XKB_SET_OF_GROUP_GROUP_3 : constant xcb_xkb_set_of_group_t := 4; XCB_XKB_SET_OF_GROUP_GROUP_4 : constant xcb_xkb_set_of_group_t := 8; -- /usr/include/xcb/xkb.h:225 subtype xcb_xkb_set_of_groups_t is unsigned; XCB_XKB_SET_OF_GROUPS_ANY : constant xcb_xkb_set_of_groups_t := 128; -- /usr/include/xcb/xkb.h:232 subtype xcb_xkb_groups_wrap_t is unsigned; XCB_XKB_GROUPS_WRAP_WRAP_INTO_RANGE : constant xcb_xkb_groups_wrap_t := 0; XCB_XKB_GROUPS_WRAP_CLAMP_INTO_RANGE : constant xcb_xkb_groups_wrap_t := 64; XCB_XKB_GROUPS_WRAP_REDIRECT_INTO_RANGE : constant xcb_xkb_groups_wrap_t := 128; -- /usr/include/xcb/xkb.h:236 subtype xcb_xkb_v_mods_high_t is unsigned; XCB_XKB_V_MODS_HIGH_15 : constant xcb_xkb_v_mods_high_t := 128; XCB_XKB_V_MODS_HIGH_14 : constant xcb_xkb_v_mods_high_t := 64; XCB_XKB_V_MODS_HIGH_13 : constant xcb_xkb_v_mods_high_t := 32; XCB_XKB_V_MODS_HIGH_12 : constant xcb_xkb_v_mods_high_t := 16; XCB_XKB_V_MODS_HIGH_11 : constant xcb_xkb_v_mods_high_t := 8; XCB_XKB_V_MODS_HIGH_10 : constant xcb_xkb_v_mods_high_t := 4; XCB_XKB_V_MODS_HIGH_9 : constant xcb_xkb_v_mods_high_t := 2; XCB_XKB_V_MODS_HIGH_8 : constant xcb_xkb_v_mods_high_t := 1; -- /usr/include/xcb/xkb.h:242 subtype xcb_xkb_v_mods_low_t is unsigned; XCB_XKB_V_MODS_LOW_7 : constant xcb_xkb_v_mods_low_t := 128; XCB_XKB_V_MODS_LOW_6 : constant xcb_xkb_v_mods_low_t := 64; XCB_XKB_V_MODS_LOW_5 : constant xcb_xkb_v_mods_low_t := 32; XCB_XKB_V_MODS_LOW_4 : constant xcb_xkb_v_mods_low_t := 16; XCB_XKB_V_MODS_LOW_3 : constant xcb_xkb_v_mods_low_t := 8; XCB_XKB_V_MODS_LOW_2 : constant xcb_xkb_v_mods_low_t := 4; XCB_XKB_V_MODS_LOW_1 : constant xcb_xkb_v_mods_low_t := 2; XCB_XKB_V_MODS_LOW_0 : constant xcb_xkb_v_mods_low_t := 1; -- /usr/include/xcb/xkb.h:253 subtype xcb_xkb_v_mod_t is unsigned; XCB_XKB_V_MOD_15 : constant xcb_xkb_v_mod_t := 32768; XCB_XKB_V_MOD_14 : constant xcb_xkb_v_mod_t := 16384; XCB_XKB_V_MOD_13 : constant xcb_xkb_v_mod_t := 8192; XCB_XKB_V_MOD_12 : constant xcb_xkb_v_mod_t := 4096; XCB_XKB_V_MOD_11 : constant xcb_xkb_v_mod_t := 2048; XCB_XKB_V_MOD_10 : constant xcb_xkb_v_mod_t := 1024; XCB_XKB_V_MOD_9 : constant xcb_xkb_v_mod_t := 512; XCB_XKB_V_MOD_8 : constant xcb_xkb_v_mod_t := 256; XCB_XKB_V_MOD_7 : constant xcb_xkb_v_mod_t := 128; XCB_XKB_V_MOD_6 : constant xcb_xkb_v_mod_t := 64; XCB_XKB_V_MOD_5 : constant xcb_xkb_v_mod_t := 32; XCB_XKB_V_MOD_4 : constant xcb_xkb_v_mod_t := 16; XCB_XKB_V_MOD_3 : constant xcb_xkb_v_mod_t := 8; XCB_XKB_V_MOD_2 : constant xcb_xkb_v_mod_t := 4; XCB_XKB_V_MOD_1 : constant xcb_xkb_v_mod_t := 2; XCB_XKB_V_MOD_0 : constant xcb_xkb_v_mod_t := 1; -- /usr/include/xcb/xkb.h:264 subtype xcb_xkb_explicit_t is unsigned; XCB_XKB_EXPLICIT_V_MOD_MAP : constant xcb_xkb_explicit_t := 128; XCB_XKB_EXPLICIT_BEHAVIOR : constant xcb_xkb_explicit_t := 64; XCB_XKB_EXPLICIT_AUTO_REPEAT : constant xcb_xkb_explicit_t := 32; XCB_XKB_EXPLICIT_INTERPRET : constant xcb_xkb_explicit_t := 16; XCB_XKB_EXPLICIT_KEY_TYPE_4 : constant xcb_xkb_explicit_t := 8; XCB_XKB_EXPLICIT_KEY_TYPE_3 : constant xcb_xkb_explicit_t := 4; XCB_XKB_EXPLICIT_KEY_TYPE_2 : constant xcb_xkb_explicit_t := 2; XCB_XKB_EXPLICIT_KEY_TYPE_1 : constant xcb_xkb_explicit_t := 1; -- /usr/include/xcb/xkb.h:283 type xcb_xkb_sym_interpret_match_t is (XCB_XKB_SYM_INTERPRET_MATCH_NONE_OF, XCB_XKB_SYM_INTERPRET_MATCH_ANY_OF_OR_NONE, XCB_XKB_SYM_INTERPRET_MATCH_ANY_OF, XCB_XKB_SYM_INTERPRET_MATCH_ALL_OF, XCB_XKB_SYM_INTERPRET_MATCH_EXACTLY); pragma Convention (C, xcb_xkb_sym_interpret_match_t); -- /usr/include/xcb/xkb.h:294 subtype xcb_xkb_sym_interp_match_t is unsigned; XCB_XKB_SYM_INTERP_MATCH_LEVEL_ONE_ONLY : constant xcb_xkb_sym_interp_match_t := 128; XCB_XKB_SYM_INTERP_MATCH_OP_MASK : constant xcb_xkb_sym_interp_match_t := 127; -- /usr/include/xcb/xkb.h:302 subtype xcb_xkb_im_flag_t is unsigned; XCB_XKB_IM_FLAG_NO_EXPLICIT : constant xcb_xkb_im_flag_t := 128; XCB_XKB_IM_FLAG_NO_AUTOMATIC : constant xcb_xkb_im_flag_t := 64; XCB_XKB_IM_FLAG_LED_DRIVES_KB : constant xcb_xkb_im_flag_t := 32; -- /usr/include/xcb/xkb.h:307 subtype xcb_xkb_im_mods_which_t is unsigned; XCB_XKB_IM_MODS_WHICH_USE_COMPAT : constant xcb_xkb_im_mods_which_t := 16; XCB_XKB_IM_MODS_WHICH_USE_EFFECTIVE : constant xcb_xkb_im_mods_which_t := 8; XCB_XKB_IM_MODS_WHICH_USE_LOCKED : constant xcb_xkb_im_mods_which_t := 4; XCB_XKB_IM_MODS_WHICH_USE_LATCHED : constant xcb_xkb_im_mods_which_t := 2; XCB_XKB_IM_MODS_WHICH_USE_BASE : constant xcb_xkb_im_mods_which_t := 1; -- /usr/include/xcb/xkb.h:313 subtype xcb_xkb_im_groups_which_t is unsigned; XCB_XKB_IM_GROUPS_WHICH_USE_COMPAT : constant xcb_xkb_im_groups_which_t := 16; XCB_XKB_IM_GROUPS_WHICH_USE_EFFECTIVE : constant xcb_xkb_im_groups_which_t := 8; XCB_XKB_IM_GROUPS_WHICH_USE_LOCKED : constant xcb_xkb_im_groups_which_t := 4; XCB_XKB_IM_GROUPS_WHICH_USE_LATCHED : constant xcb_xkb_im_groups_which_t := 2; XCB_XKB_IM_GROUPS_WHICH_USE_BASE : constant xcb_xkb_im_groups_which_t := 1; -- /usr/include/xcb/xkb.h:321 type xcb_xkb_indicator_map_t is record flags : aliased Libc.Stdint.uint8_t; -- /usr/include/xcb/xkb.h:333 whichGroups : aliased Libc.Stdint.uint8_t; -- /usr/include/xcb/xkb.h:334 groups : aliased Libc.Stdint.uint8_t; -- /usr/include/xcb/xkb.h:335 whichMods : aliased Libc.Stdint.uint8_t; -- /usr/include/xcb/xkb.h:336 mods : aliased Libc.Stdint.uint8_t; -- /usr/include/xcb/xkb.h:337 realMods : aliased Libc.Stdint.uint8_t; -- /usr/include/xcb/xkb.h:338 vmods : aliased Libc.Stdint.uint16_t; -- /usr/include/xcb/xkb.h:339 ctrls : aliased Libc.Stdint.uint32_t; -- /usr/include/xcb/xkb.h:340 end record; pragma Convention (C_Pass_By_Copy, xcb_xkb_indicator_map_t); -- /usr/include/xcb/xkb.h:332 type xcb_xkb_indicator_map_iterator_t is record data : access xcb_xkb_indicator_map_t; -- /usr/include/xcb/xkb.h:347 c_rem : aliased int; -- /usr/include/xcb/xkb.h:348 index : aliased int; -- /usr/include/xcb/xkb.h:349 end record; pragma Convention (C_Pass_By_Copy, xcb_xkb_indicator_map_iterator_t); -- /usr/include/xcb/xkb.h:346 subtype xcb_xkb_cm_detail_t is unsigned; XCB_XKB_CM_DETAIL_SYM_INTERP : constant xcb_xkb_cm_detail_t := 1; XCB_XKB_CM_DETAIL_GROUP_COMPAT : constant xcb_xkb_cm_detail_t := 2; -- /usr/include/xcb/xkb.h:352 subtype xcb_xkb_name_detail_t is unsigned; XCB_XKB_NAME_DETAIL_KEYCODES : constant xcb_xkb_name_detail_t := 1; XCB_XKB_NAME_DETAIL_GEOMETRY : constant xcb_xkb_name_detail_t := 2; XCB_XKB_NAME_DETAIL_SYMBOLS : constant xcb_xkb_name_detail_t := 4; XCB_XKB_NAME_DETAIL_PHYS_SYMBOLS : constant xcb_xkb_name_detail_t := 8; XCB_XKB_NAME_DETAIL_TYPES : constant xcb_xkb_name_detail_t := 16; XCB_XKB_NAME_DETAIL_COMPAT : constant xcb_xkb_name_detail_t := 32; XCB_XKB_NAME_DETAIL_KEY_TYPE_NAMES : constant xcb_xkb_name_detail_t := 64; XCB_XKB_NAME_DETAIL_KT_LEVEL_NAMES : constant xcb_xkb_name_detail_t := 128; XCB_XKB_NAME_DETAIL_INDICATOR_NAMES : constant xcb_xkb_name_detail_t := 256; XCB_XKB_NAME_DETAIL_KEY_NAMES : constant xcb_xkb_name_detail_t := 512; XCB_XKB_NAME_DETAIL_KEY_ALIASES : constant xcb_xkb_name_detail_t := 1024; XCB_XKB_NAME_DETAIL_VIRTUAL_MOD_NAMES : constant xcb_xkb_name_detail_t := 2048; XCB_XKB_NAME_DETAIL_GROUP_NAMES : constant xcb_xkb_name_detail_t := 4096; XCB_XKB_NAME_DETAIL_RG_NAMES : constant xcb_xkb_name_detail_t := 8192; -- /usr/include/xcb/xkb.h:357 subtype xcb_xkb_gbn_detail_t is unsigned; XCB_XKB_GBN_DETAIL_TYPES : constant xcb_xkb_gbn_detail_t := 1; XCB_XKB_GBN_DETAIL_COMPAT_MAP : constant xcb_xkb_gbn_detail_t := 2; XCB_XKB_GBN_DETAIL_CLIENT_SYMBOLS : constant xcb_xkb_gbn_detail_t := 4; XCB_XKB_GBN_DETAIL_SERVER_SYMBOLS : constant xcb_xkb_gbn_detail_t := 8; XCB_XKB_GBN_DETAIL_INDICATOR_MAPS : constant xcb_xkb_gbn_detail_t := 16; XCB_XKB_GBN_DETAIL_KEY_NAMES : constant xcb_xkb_gbn_detail_t := 32; XCB_XKB_GBN_DETAIL_GEOMETRY : constant xcb_xkb_gbn_detail_t := 64; XCB_XKB_GBN_DETAIL_OTHER_NAMES : constant xcb_xkb_gbn_detail_t := 128; -- /usr/include/xcb/xkb.h:374 subtype xcb_xkb_xi_feature_t is unsigned; XCB_XKB_XI_FEATURE_KEYBOARDS : constant xcb_xkb_xi_feature_t := 1; XCB_XKB_XI_FEATURE_BUTTON_ACTIONS : constant xcb_xkb_xi_feature_t := 2; XCB_XKB_XI_FEATURE_INDICATOR_NAMES : constant xcb_xkb_xi_feature_t := 4; XCB_XKB_XI_FEATURE_INDICATOR_MAPS : constant xcb_xkb_xi_feature_t := 8; XCB_XKB_XI_FEATURE_INDICATOR_STATE : constant xcb_xkb_xi_feature_t := 16; -- /usr/include/xcb/xkb.h:385 subtype xcb_xkb_per_client_flag_t is unsigned; XCB_XKB_PER_CLIENT_FLAG_DETECTABLE_AUTO_REPEAT : constant xcb_xkb_per_client_flag_t := 1; XCB_XKB_PER_CLIENT_FLAG_GRABS_USE_XKB_STATE : constant xcb_xkb_per_client_flag_t := 2; XCB_XKB_PER_CLIENT_FLAG_AUTO_RESET_CONTROLS : constant xcb_xkb_per_client_flag_t := 4; XCB_XKB_PER_CLIENT_FLAG_LOOKUP_STATE_WHEN_GRABBED : constant xcb_xkb_per_client_flag_t := 8; XCB_XKB_PER_CLIENT_FLAG_SEND_EVENT_USES_XKB_STATE : constant xcb_xkb_per_client_flag_t := 16; -- /usr/include/xcb/xkb.h:393 type xcb_xkb_mod_def_t is record mask : aliased Libc.Stdint.uint8_t; -- /usr/include/xcb/xkb.h:405 realMods : aliased Libc.Stdint.uint8_t; -- /usr/include/xcb/xkb.h:406 vmods : aliased Libc.Stdint.uint16_t; -- /usr/include/xcb/xkb.h:407 end record; pragma Convention (C_Pass_By_Copy, xcb_xkb_mod_def_t); -- /usr/include/xcb/xkb.h:404 type xcb_xkb_mod_def_iterator_t is record data : access xcb_xkb_mod_def_t; -- /usr/include/xcb/xkb.h:414 c_rem : aliased int; -- /usr/include/xcb/xkb.h:415 index : aliased int; -- /usr/include/xcb/xkb.h:416 end record; pragma Convention (C_Pass_By_Copy, xcb_xkb_mod_def_iterator_t); -- /usr/include/xcb/xkb.h:413 subtype xcb_xkb_key_name_t_name_array is Interfaces.C.char_array (0 .. 3); type xcb_xkb_key_name_t is record name : aliased xcb_xkb_key_name_t_name_array; -- /usr/include/xcb/xkb.h:423 end record; pragma Convention (C_Pass_By_Copy, xcb_xkb_key_name_t); -- /usr/include/xcb/xkb.h:422 type xcb_xkb_key_name_iterator_t is record data : access xcb_xkb_key_name_t; -- /usr/include/xcb/xkb.h:430 c_rem : aliased int; -- /usr/include/xcb/xkb.h:431 index : aliased int; -- /usr/include/xcb/xkb.h:432 end record; pragma Convention (C_Pass_By_Copy, xcb_xkb_key_name_iterator_t); -- /usr/include/xcb/xkb.h:429 subtype xcb_xkb_key_alias_t_real_array is Interfaces.C.char_array (0 .. 3); subtype xcb_xkb_key_alias_t_alias_array is Interfaces.C.char_array (0 .. 3); type xcb_xkb_key_alias_t is record real : aliased xcb_xkb_key_alias_t_real_array; -- /usr/include/xcb/xkb.h:439 alias : aliased xcb_xkb_key_alias_t_alias_array; -- /usr/include/xcb/xkb.h:440 end record; pragma Convention (C_Pass_By_Copy, xcb_xkb_key_alias_t); -- /usr/include/xcb/xkb.h:438 type xcb_xkb_key_alias_iterator_t is record data : access xcb_xkb_key_alias_t; -- /usr/include/xcb/xkb.h:447 c_rem : aliased int; -- /usr/include/xcb/xkb.h:448 index : aliased int; -- /usr/include/xcb/xkb.h:449 end record; pragma Convention (C_Pass_By_Copy, xcb_xkb_key_alias_iterator_t); -- /usr/include/xcb/xkb.h:446 type xcb_xkb_counted_string_16_t is record length : aliased Libc.Stdint.uint16_t; -- /usr/include/xcb/xkb.h:456 end record; pragma Convention (C_Pass_By_Copy, xcb_xkb_counted_string_16_t); -- /usr/include/xcb/xkb.h:455 type xcb_xkb_counted_string_16_iterator_t is record data : access xcb_xkb_counted_string_16_t; -- /usr/include/xcb/xkb.h:463 c_rem : aliased int; -- /usr/include/xcb/xkb.h:464 index : aliased int; -- /usr/include/xcb/xkb.h:465 end record; pragma Convention (C_Pass_By_Copy, xcb_xkb_counted_string_16_iterator_t); -- /usr/include/xcb/xkb.h:462 type xcb_xkb_kt_map_entry_t_pad0_array is array (0 .. 1) of aliased Libc.Stdint.uint8_t; type xcb_xkb_kt_map_entry_t is record active : aliased Libc.Stdint.uint8_t; -- /usr/include/xcb/xkb.h:472 mods_mask : aliased Libc.Stdint.uint8_t; -- /usr/include/xcb/xkb.h:473 level : aliased Libc.Stdint.uint8_t; -- /usr/include/xcb/xkb.h:474 mods_mods : aliased Libc.Stdint.uint8_t; -- /usr/include/xcb/xkb.h:475 mods_vmods : aliased Libc.Stdint.uint16_t; -- /usr/include/xcb/xkb.h:476 pad0 : aliased xcb_xkb_kt_map_entry_t_pad0_array; -- /usr/include/xcb/xkb.h:477 end record; pragma Convention (C_Pass_By_Copy, xcb_xkb_kt_map_entry_t); -- /usr/include/xcb/xkb.h:471 type xcb_xkb_kt_map_entry_iterator_t is record data : access xcb_xkb_kt_map_entry_t; -- /usr/include/xcb/xkb.h:484 c_rem : aliased int; -- /usr/include/xcb/xkb.h:485 index : aliased int; -- /usr/include/xcb/xkb.h:486 end record; pragma Convention (C_Pass_By_Copy, xcb_xkb_kt_map_entry_iterator_t); -- /usr/include/xcb/xkb.h:483 type xcb_xkb_key_type_t is record mods_mask : aliased Libc.Stdint.uint8_t; -- /usr/include/xcb/xkb.h:493 mods_mods : aliased Libc.Stdint.uint8_t; -- /usr/include/xcb/xkb.h:494 mods_vmods : aliased Libc.Stdint.uint16_t; -- /usr/include/xcb/xkb.h:495 numLevels : aliased Libc.Stdint.uint8_t; -- /usr/include/xcb/xkb.h:496 nMapEntries : aliased Libc.Stdint.uint8_t; -- /usr/include/xcb/xkb.h:497 hasPreserve : aliased Libc.Stdint.uint8_t; -- /usr/include/xcb/xkb.h:498 pad0 : aliased Libc.Stdint.uint8_t; -- /usr/include/xcb/xkb.h:499 end record; pragma Convention (C_Pass_By_Copy, xcb_xkb_key_type_t); -- /usr/include/xcb/xkb.h:492 type xcb_xkb_key_type_iterator_t is record data : access xcb_xkb_key_type_t; -- /usr/include/xcb/xkb.h:506 c_rem : aliased int; -- /usr/include/xcb/xkb.h:507 index : aliased int; -- /usr/include/xcb/xkb.h:508 end record; pragma Convention (C_Pass_By_Copy, xcb_xkb_key_type_iterator_t); -- /usr/include/xcb/xkb.h:505 type xcb_xkb_key_sym_map_t_kt_index_array is array (0 .. 3) of aliased Libc.Stdint.uint8_t; type xcb_xkb_key_sym_map_t is record kt_index : aliased xcb_xkb_key_sym_map_t_kt_index_array; -- /usr/include/xcb/xkb.h:515 groupInfo : aliased Libc.Stdint.uint8_t; -- /usr/include/xcb/xkb.h:516 width : aliased Libc.Stdint.uint8_t; -- /usr/include/xcb/xkb.h:517 nSyms : aliased Libc.Stdint.uint16_t; -- /usr/include/xcb/xkb.h:518 end record; pragma Convention (C_Pass_By_Copy, xcb_xkb_key_sym_map_t); -- /usr/include/xcb/xkb.h:514 type xcb_xkb_key_sym_map_iterator_t is record data : access xcb_xkb_key_sym_map_t; -- /usr/include/xcb/xkb.h:525 c_rem : aliased int; -- /usr/include/xcb/xkb.h:526 index : aliased int; -- /usr/include/xcb/xkb.h:527 end record; pragma Convention (C_Pass_By_Copy, xcb_xkb_key_sym_map_iterator_t); -- /usr/include/xcb/xkb.h:524 type xcb_xkb_common_behavior_t is record c_type : aliased Libc.Stdint.uint8_t; -- /usr/include/xcb/xkb.h:534 data : aliased Libc.Stdint.uint8_t; -- /usr/include/xcb/xkb.h:535 end record; pragma Convention (C_Pass_By_Copy, xcb_xkb_common_behavior_t); -- /usr/include/xcb/xkb.h:533 type xcb_xkb_common_behavior_iterator_t is record data : access xcb_xkb_common_behavior_t; -- /usr/include/xcb/xkb.h:542 c_rem : aliased int; -- /usr/include/xcb/xkb.h:543 index : aliased int; -- /usr/include/xcb/xkb.h:544 end record; pragma Convention (C_Pass_By_Copy, xcb_xkb_common_behavior_iterator_t); -- /usr/include/xcb/xkb.h:541 type xcb_xkb_default_behavior_t is record c_type : aliased Libc.Stdint.uint8_t; -- /usr/include/xcb/xkb.h:551 pad0 : aliased Libc.Stdint.uint8_t; -- /usr/include/xcb/xkb.h:552 end record; pragma Convention (C_Pass_By_Copy, xcb_xkb_default_behavior_t); -- /usr/include/xcb/xkb.h:550 type xcb_xkb_default_behavior_iterator_t is record data : access xcb_xkb_default_behavior_t; -- /usr/include/xcb/xkb.h:559 c_rem : aliased int; -- /usr/include/xcb/xkb.h:560 index : aliased int; -- /usr/include/xcb/xkb.h:561 end record; pragma Convention (C_Pass_By_Copy, xcb_xkb_default_behavior_iterator_t); -- /usr/include/xcb/xkb.h:558 type xcb_xkb_lock_behavior_t is record c_type : aliased Libc.Stdint.uint8_t; -- /usr/include/xcb/xkb.h:568 pad0 : aliased Libc.Stdint.uint8_t; -- /usr/include/xcb/xkb.h:569 end record; pragma Convention (C_Pass_By_Copy, xcb_xkb_lock_behavior_t); -- /usr/include/xcb/xkb.h:567 type xcb_xkb_lock_behavior_iterator_t is record data : access xcb_xkb_lock_behavior_t; -- /usr/include/xcb/xkb.h:576 c_rem : aliased int; -- /usr/include/xcb/xkb.h:577 index : aliased int; -- /usr/include/xcb/xkb.h:578 end record; pragma Convention (C_Pass_By_Copy, xcb_xkb_lock_behavior_iterator_t); -- /usr/include/xcb/xkb.h:575 type xcb_xkb_radio_group_behavior_t is record c_type : aliased Libc.Stdint.uint8_t; -- /usr/include/xcb/xkb.h:585 group : aliased Libc.Stdint.uint8_t; -- /usr/include/xcb/xkb.h:586 end record; pragma Convention (C_Pass_By_Copy, xcb_xkb_radio_group_behavior_t); -- /usr/include/xcb/xkb.h:584 type xcb_xkb_radio_group_behavior_iterator_t is record data : access xcb_xkb_radio_group_behavior_t; -- /usr/include/xcb/xkb.h:593 c_rem : aliased int; -- /usr/include/xcb/xkb.h:594 index : aliased int; -- /usr/include/xcb/xkb.h:595 end record; pragma Convention (C_Pass_By_Copy, xcb_xkb_radio_group_behavior_iterator_t); -- /usr/include/xcb/xkb.h:592 type xcb_xkb_overlay_behavior_t is record c_type : aliased Libc.Stdint.uint8_t; -- /usr/include/xcb/xkb.h:602 key : aliased XCB.XProto.xcb_keycode_t; -- /usr/include/xcb/xkb.h:603 end record; pragma Convention (C_Pass_By_Copy, xcb_xkb_overlay_behavior_t); -- /usr/include/xcb/xkb.h:601 type xcb_xkb_overlay_behavior_iterator_t is record data : access xcb_xkb_overlay_behavior_t; -- /usr/include/xcb/xkb.h:610 c_rem : aliased int; -- /usr/include/xcb/xkb.h:611 index : aliased int; -- /usr/include/xcb/xkb.h:612 end record; pragma Convention (C_Pass_By_Copy, xcb_xkb_overlay_behavior_iterator_t); -- /usr/include/xcb/xkb.h:609 type xcb_xkb_permament_lock_behavior_t is record c_type : aliased Libc.Stdint.uint8_t; -- /usr/include/xcb/xkb.h:619 pad0 : aliased Libc.Stdint.uint8_t; -- /usr/include/xcb/xkb.h:620 end record; pragma Convention (C_Pass_By_Copy, xcb_xkb_permament_lock_behavior_t); -- /usr/include/xcb/xkb.h:618 type xcb_xkb_permament_lock_behavior_iterator_t is record data : access xcb_xkb_permament_lock_behavior_t; -- /usr/include/xcb/xkb.h:627 c_rem : aliased int; -- /usr/include/xcb/xkb.h:628 index : aliased int; -- /usr/include/xcb/xkb.h:629 end record; pragma Convention (C_Pass_By_Copy, xcb_xkb_permament_lock_behavior_iterator_t); -- /usr/include/xcb/xkb.h:626 type xcb_xkb_permament_radio_group_behavior_t is record c_type : aliased Libc.Stdint.uint8_t; -- /usr/include/xcb/xkb.h:636 group : aliased Libc.Stdint.uint8_t; -- /usr/include/xcb/xkb.h:637 end record; pragma Convention (C_Pass_By_Copy, xcb_xkb_permament_radio_group_behavior_t); -- /usr/include/xcb/xkb.h:635 type xcb_xkb_permament_radio_group_behavior_iterator_t is record data : access xcb_xkb_permament_radio_group_behavior_t; -- /usr/include/xcb/xkb.h:644 c_rem : aliased int; -- /usr/include/xcb/xkb.h:645 index : aliased int; -- /usr/include/xcb/xkb.h:646 end record; pragma Convention (C_Pass_By_Copy, xcb_xkb_permament_radio_group_behavior_iterator_t); -- /usr/include/xcb/xkb.h:643 type xcb_xkb_permament_overlay_behavior_t is record c_type : aliased Libc.Stdint.uint8_t; -- /usr/include/xcb/xkb.h:653 key : aliased XCB.XProto.xcb_keycode_t; -- /usr/include/xcb/xkb.h:654 end record; pragma Convention (C_Pass_By_Copy, xcb_xkb_permament_overlay_behavior_t); -- /usr/include/xcb/xkb.h:652 type xcb_xkb_permament_overlay_behavior_iterator_t is record data : access xcb_xkb_permament_overlay_behavior_t; -- /usr/include/xcb/xkb.h:661 c_rem : aliased int; -- /usr/include/xcb/xkb.h:662 index : aliased int; -- /usr/include/xcb/xkb.h:663 end record; pragma Convention (C_Pass_By_Copy, xcb_xkb_permament_overlay_behavior_iterator_t); -- /usr/include/xcb/xkb.h:660 type xcb_xkb_behavior_t (discr : unsigned := 0) is record case discr is when 0 => common : aliased xcb_xkb_common_behavior_t; -- /usr/include/xcb/xkb.h:670 when 1 => u_default : aliased xcb_xkb_default_behavior_t; -- /usr/include/xcb/xkb.h:671 when 2 => lock : aliased xcb_xkb_lock_behavior_t; -- /usr/include/xcb/xkb.h:672 when 3 => radioGroup : aliased xcb_xkb_radio_group_behavior_t; -- /usr/include/xcb/xkb.h:673 when 4 => overlay1 : aliased xcb_xkb_overlay_behavior_t; -- /usr/include/xcb/xkb.h:674 when 5 => overlay2 : aliased xcb_xkb_overlay_behavior_t; -- /usr/include/xcb/xkb.h:675 when 6 => permamentLock : aliased xcb_xkb_permament_lock_behavior_t; -- /usr/include/xcb/xkb.h:676 when 7 => permamentRadioGroup : aliased xcb_xkb_permament_radio_group_behavior_t; -- /usr/include/xcb/xkb.h:677 when 8 => permamentOverlay1 : aliased xcb_xkb_permament_overlay_behavior_t; -- /usr/include/xcb/xkb.h:678 when 9 => permamentOverlay2 : aliased xcb_xkb_permament_overlay_behavior_t; -- /usr/include/xcb/xkb.h:679 when others => c_type : aliased Libc.Stdint .uint8_t; -- /usr/include/xcb/xkb.h:680 end case; end record; pragma Convention (C_Pass_By_Copy, xcb_xkb_behavior_t); pragma Unchecked_Union (xcb_xkb_behavior_t); -- /usr/include/xcb/xkb.h:669 type xcb_xkb_behavior_iterator_t is record data : access xcb_xkb_behavior_t; -- /usr/include/xcb/xkb.h:687 c_rem : aliased int; -- /usr/include/xcb/xkb.h:688 index : aliased int; -- /usr/include/xcb/xkb.h:689 end record; pragma Convention (C_Pass_By_Copy, xcb_xkb_behavior_iterator_t); -- /usr/include/xcb/xkb.h:686 subtype xcb_xkb_behavior_type_t is unsigned; XCB_XKB_BEHAVIOR_TYPE_DEFAULT : constant xcb_xkb_behavior_type_t := 0; XCB_XKB_BEHAVIOR_TYPE_LOCK : constant xcb_xkb_behavior_type_t := 1; XCB_XKB_BEHAVIOR_TYPE_RADIO_GROUP : constant xcb_xkb_behavior_type_t := 2; XCB_XKB_BEHAVIOR_TYPE_OVERLAY_1 : constant xcb_xkb_behavior_type_t := 3; XCB_XKB_BEHAVIOR_TYPE_OVERLAY_2 : constant xcb_xkb_behavior_type_t := 4; XCB_XKB_BEHAVIOR_TYPE_PERMAMENT_LOCK : constant xcb_xkb_behavior_type_t := 129; XCB_XKB_BEHAVIOR_TYPE_PERMAMENT_RADIO_GROUP : constant xcb_xkb_behavior_type_t := 130; XCB_XKB_BEHAVIOR_TYPE_PERMAMENT_OVERLAY_1 : constant xcb_xkb_behavior_type_t := 131; XCB_XKB_BEHAVIOR_TYPE_PERMAMENT_OVERLAY_2 : constant xcb_xkb_behavior_type_t := 132; -- /usr/include/xcb/xkb.h:692 type xcb_xkb_set_behavior_t is record keycode : aliased XCB.XProto .xcb_keycode_t; -- /usr/include/xcb/xkb.h:708 behavior : xcb_xkb_behavior_t; -- /usr/include/xcb/xkb.h:709 pad0 : aliased Libc.Stdint.uint8_t; -- /usr/include/xcb/xkb.h:710 end record; pragma Convention (C_Pass_By_Copy, xcb_xkb_set_behavior_t); -- /usr/include/xcb/xkb.h:707 type xcb_xkb_set_behavior_iterator_t is record data : access xcb_xkb_set_behavior_t; -- /usr/include/xcb/xkb.h:717 c_rem : aliased int; -- /usr/include/xcb/xkb.h:718 index : aliased int; -- /usr/include/xcb/xkb.h:719 end record; pragma Convention (C_Pass_By_Copy, xcb_xkb_set_behavior_iterator_t); -- /usr/include/xcb/xkb.h:716 type xcb_xkb_set_explicit_t is record keycode : aliased XCB.XProto .xcb_keycode_t; -- /usr/include/xcb/xkb.h:726 end record; pragma Convention (C_Pass_By_Copy, xcb_xkb_set_explicit_t); -- /usr/include/xcb/xkb.h:725 type xcb_xkb_set_explicit_iterator_t is record data : access xcb_xkb_set_explicit_t; -- /usr/include/xcb/xkb.h:734 c_rem : aliased int; -- /usr/include/xcb/xkb.h:735 index : aliased int; -- /usr/include/xcb/xkb.h:736 end record; pragma Convention (C_Pass_By_Copy, xcb_xkb_set_explicit_iterator_t); -- /usr/include/xcb/xkb.h:733 type xcb_xkb_key_mod_map_t is record keycode : aliased XCB.XProto .xcb_keycode_t; -- /usr/include/xcb/xkb.h:743 mods : aliased Libc.Stdint.uint8_t; -- /usr/include/xcb/xkb.h:744 end record; pragma Convention (C_Pass_By_Copy, xcb_xkb_key_mod_map_t); -- /usr/include/xcb/xkb.h:742 type xcb_xkb_key_mod_map_iterator_t is record data : access xcb_xkb_key_mod_map_t; -- /usr/include/xcb/xkb.h:751 c_rem : aliased int; -- /usr/include/xcb/xkb.h:752 index : aliased int; -- /usr/include/xcb/xkb.h:753 end record; pragma Convention (C_Pass_By_Copy, xcb_xkb_key_mod_map_iterator_t); -- /usr/include/xcb/xkb.h:750 type xcb_xkb_key_v_mod_map_t is record keycode : aliased XCB.XProto .xcb_keycode_t; -- /usr/include/xcb/xkb.h:760 pad0 : aliased Libc.Stdint.uint8_t; -- /usr/include/xcb/xkb.h:761 vmods : aliased Libc.Stdint.uint16_t; -- /usr/include/xcb/xkb.h:762 end record; pragma Convention (C_Pass_By_Copy, xcb_xkb_key_v_mod_map_t); -- /usr/include/xcb/xkb.h:759 type xcb_xkb_key_v_mod_map_iterator_t is record data : access xcb_xkb_key_v_mod_map_t; -- /usr/include/xcb/xkb.h:769 c_rem : aliased int; -- /usr/include/xcb/xkb.h:770 index : aliased int; -- /usr/include/xcb/xkb.h:771 end record; pragma Convention (C_Pass_By_Copy, xcb_xkb_key_v_mod_map_iterator_t); -- /usr/include/xcb/xkb.h:768 type xcb_xkb_kt_set_map_entry_t is record level : aliased Libc.Stdint.uint8_t; -- /usr/include/xcb/xkb.h:778 realMods : aliased Libc.Stdint.uint8_t; -- /usr/include/xcb/xkb.h:779 virtualMods : aliased Libc.Stdint .uint16_t; -- /usr/include/xcb/xkb.h:780 end record; pragma Convention (C_Pass_By_Copy, xcb_xkb_kt_set_map_entry_t); -- /usr/include/xcb/xkb.h:777 type xcb_xkb_kt_set_map_entry_iterator_t is record data : access xcb_xkb_kt_set_map_entry_t; -- /usr/include/xcb/xkb.h:787 c_rem : aliased int; -- /usr/include/xcb/xkb.h:788 index : aliased int; -- /usr/include/xcb/xkb.h:789 end record; pragma Convention (C_Pass_By_Copy, xcb_xkb_kt_set_map_entry_iterator_t); -- /usr/include/xcb/xkb.h:786 type xcb_xkb_set_key_type_t is record mask : aliased Libc.Stdint.uint8_t; -- /usr/include/xcb/xkb.h:796 realMods : aliased Libc.Stdint.uint8_t; -- /usr/include/xcb/xkb.h:797 virtualMods : aliased Libc.Stdint .uint16_t; -- /usr/include/xcb/xkb.h:798 numLevels : aliased Libc.Stdint.uint8_t; -- /usr/include/xcb/xkb.h:799 nMapEntries : aliased Libc.Stdint.uint8_t; -- /usr/include/xcb/xkb.h:800 preserve : aliased Libc.Stdint.uint8_t; -- /usr/include/xcb/xkb.h:801 pad0 : aliased Libc.Stdint.uint8_t; -- /usr/include/xcb/xkb.h:802 end record; pragma Convention (C_Pass_By_Copy, xcb_xkb_set_key_type_t); -- /usr/include/xcb/xkb.h:795 type xcb_xkb_set_key_type_iterator_t is record data : access xcb_xkb_set_key_type_t; -- /usr/include/xcb/xkb.h:809 c_rem : aliased int; -- /usr/include/xcb/xkb.h:810 index : aliased int; -- /usr/include/xcb/xkb.h:811 end record; pragma Convention (C_Pass_By_Copy, xcb_xkb_set_key_type_iterator_t); -- /usr/include/xcb/xkb.h:808 subtype xcb_xkb_string8_t is char; -- /usr/include/xcb/xkb.h:814 type xcb_xkb_string8_iterator_t is record data : access xcb_xkb_string8_t; -- /usr/include/xcb/xkb.h:820 c_rem : aliased int; -- /usr/include/xcb/xkb.h:821 index : aliased int; -- /usr/include/xcb/xkb.h:822 end record; pragma Convention (C_Pass_By_Copy, xcb_xkb_string8_iterator_t); -- /usr/include/xcb/xkb.h:819 type xcb_xkb_outline_t_pad0_array is array (0 .. 1) of aliased Libc.Stdint.uint8_t; type xcb_xkb_outline_t is record nPoints : aliased Libc.Stdint.uint8_t; -- /usr/include/xcb/xkb.h:829 cornerRadius : aliased Libc.Stdint .uint8_t; -- /usr/include/xcb/xkb.h:830 pad0 : aliased xcb_xkb_outline_t_pad0_array; -- /usr/include/xcb/xkb.h:831 end record; pragma Convention (C_Pass_By_Copy, xcb_xkb_outline_t); -- /usr/include/xcb/xkb.h:828 type xcb_xkb_outline_iterator_t is record data : access xcb_xkb_outline_t; -- /usr/include/xcb/xkb.h:838 c_rem : aliased int; -- /usr/include/xcb/xkb.h:839 index : aliased int; -- /usr/include/xcb/xkb.h:840 end record; pragma Convention (C_Pass_By_Copy, xcb_xkb_outline_iterator_t); -- /usr/include/xcb/xkb.h:837 type xcb_xkb_shape_t is record name : aliased XCB.XProto.xcb_atom_t; -- /usr/include/xcb/xkb.h:847 nOutlines : aliased Libc.Stdint.uint8_t; -- /usr/include/xcb/xkb.h:848 primaryNdx : aliased Libc.Stdint.uint8_t; -- /usr/include/xcb/xkb.h:849 approxNdx : aliased Libc.Stdint.uint8_t; -- /usr/include/xcb/xkb.h:850 pad0 : aliased Libc.Stdint.uint8_t; -- /usr/include/xcb/xkb.h:851 end record; pragma Convention (C_Pass_By_Copy, xcb_xkb_shape_t); -- /usr/include/xcb/xkb.h:846 type xcb_xkb_shape_iterator_t is record data : access xcb_xkb_shape_t; -- /usr/include/xcb/xkb.h:858 c_rem : aliased int; -- /usr/include/xcb/xkb.h:859 index : aliased int; -- /usr/include/xcb/xkb.h:860 end record; pragma Convention (C_Pass_By_Copy, xcb_xkb_shape_iterator_t); -- /usr/include/xcb/xkb.h:857 type xcb_xkb_key_t_name_array is array (0 .. 3) of aliased xcb_xkb_string8_t; type xcb_xkb_key_t is record name : aliased xcb_xkb_key_t_name_array; -- /usr/include/xcb/xkb.h:867 gap : aliased Libc.Stdint.int16_t; -- /usr/include/xcb/xkb.h:868 shapeNdx : aliased Libc.Stdint.uint8_t; -- /usr/include/xcb/xkb.h:869 colorNdx : aliased Libc.Stdint.uint8_t; -- /usr/include/xcb/xkb.h:870 end record; pragma Convention (C_Pass_By_Copy, xcb_xkb_key_t); -- /usr/include/xcb/xkb.h:866 type xcb_xkb_key_iterator_t is record data : access xcb_xkb_key_t; -- /usr/include/xcb/xkb.h:877 c_rem : aliased int; -- /usr/include/xcb/xkb.h:878 index : aliased int; -- /usr/include/xcb/xkb.h:879 end record; pragma Convention (C_Pass_By_Copy, xcb_xkb_key_iterator_t); -- /usr/include/xcb/xkb.h:876 type xcb_xkb_overlay_key_t_over_array is array (0 .. 3) of aliased xcb_xkb_string8_t; type xcb_xkb_overlay_key_t_under_array is array (0 .. 3) of aliased xcb_xkb_string8_t; type xcb_xkb_overlay_key_t is record over : aliased xcb_xkb_overlay_key_t_over_array; -- /usr/include/xcb/xkb.h:886 under : aliased xcb_xkb_overlay_key_t_under_array; -- /usr/include/xcb/xkb.h:887 end record; pragma Convention (C_Pass_By_Copy, xcb_xkb_overlay_key_t); -- /usr/include/xcb/xkb.h:885 type xcb_xkb_overlay_key_iterator_t is record data : access xcb_xkb_overlay_key_t; -- /usr/include/xcb/xkb.h:894 c_rem : aliased int; -- /usr/include/xcb/xkb.h:895 index : aliased int; -- /usr/include/xcb/xkb.h:896 end record; pragma Convention (C_Pass_By_Copy, xcb_xkb_overlay_key_iterator_t); -- /usr/include/xcb/xkb.h:893 type xcb_xkb_overlay_row_t_pad0_array is array (0 .. 1) of aliased Libc.Stdint.uint8_t; type xcb_xkb_overlay_row_t is record rowUnder : aliased Libc.Stdint.uint8_t; -- /usr/include/xcb/xkb.h:903 nKeys : aliased Libc.Stdint.uint8_t; -- /usr/include/xcb/xkb.h:904 pad0 : aliased xcb_xkb_overlay_row_t_pad0_array; -- /usr/include/xcb/xkb.h:905 end record; pragma Convention (C_Pass_By_Copy, xcb_xkb_overlay_row_t); -- /usr/include/xcb/xkb.h:902 type xcb_xkb_overlay_row_iterator_t is record data : access xcb_xkb_overlay_row_t; -- /usr/include/xcb/xkb.h:912 c_rem : aliased int; -- /usr/include/xcb/xkb.h:913 index : aliased int; -- /usr/include/xcb/xkb.h:914 end record; pragma Convention (C_Pass_By_Copy, xcb_xkb_overlay_row_iterator_t); -- /usr/include/xcb/xkb.h:911 type xcb_xkb_overlay_t_pad0_array is array (0 .. 2) of aliased Libc.Stdint.uint8_t; type xcb_xkb_overlay_t is record name : aliased XCB.XProto.xcb_atom_t; -- /usr/include/xcb/xkb.h:921 nRows : aliased Libc.Stdint.uint8_t; -- /usr/include/xcb/xkb.h:922 pad0 : aliased xcb_xkb_overlay_t_pad0_array; -- /usr/include/xcb/xkb.h:923 end record; pragma Convention (C_Pass_By_Copy, xcb_xkb_overlay_t); -- /usr/include/xcb/xkb.h:920 type xcb_xkb_overlay_iterator_t is record data : access xcb_xkb_overlay_t; -- /usr/include/xcb/xkb.h:930 c_rem : aliased int; -- /usr/include/xcb/xkb.h:931 index : aliased int; -- /usr/include/xcb/xkb.h:932 end record; pragma Convention (C_Pass_By_Copy, xcb_xkb_overlay_iterator_t); -- /usr/include/xcb/xkb.h:929 type xcb_xkb_row_t_pad0_array is array (0 .. 1) of aliased Libc.Stdint.uint8_t; type xcb_xkb_row_t is record top : aliased Libc.Stdint.int16_t; -- /usr/include/xcb/xkb.h:939 left : aliased Libc.Stdint.int16_t; -- /usr/include/xcb/xkb.h:940 nKeys : aliased Libc.Stdint.uint8_t; -- /usr/include/xcb/xkb.h:941 vertical : aliased Libc.Stdint.uint8_t; -- /usr/include/xcb/xkb.h:942 pad0 : aliased xcb_xkb_row_t_pad0_array; -- /usr/include/xcb/xkb.h:943 end record; pragma Convention (C_Pass_By_Copy, xcb_xkb_row_t); -- /usr/include/xcb/xkb.h:938 type xcb_xkb_row_iterator_t is record data : access xcb_xkb_row_t; -- /usr/include/xcb/xkb.h:950 c_rem : aliased int; -- /usr/include/xcb/xkb.h:951 index : aliased int; -- /usr/include/xcb/xkb.h:952 end record; pragma Convention (C_Pass_By_Copy, xcb_xkb_row_iterator_t); -- /usr/include/xcb/xkb.h:949 subtype xcb_xkb_doodad_type_t is unsigned; XCB_XKB_DOODAD_TYPE_OUTLINE : constant xcb_xkb_doodad_type_t := 1; XCB_XKB_DOODAD_TYPE_SOLID : constant xcb_xkb_doodad_type_t := 2; XCB_XKB_DOODAD_TYPE_TEXT : constant xcb_xkb_doodad_type_t := 3; XCB_XKB_DOODAD_TYPE_INDICATOR : constant xcb_xkb_doodad_type_t := 4; XCB_XKB_DOODAD_TYPE_LOGO : constant xcb_xkb_doodad_type_t := 5; -- /usr/include/xcb/xkb.h:955 type xcb_xkb_listing_t is record flags : aliased Libc.Stdint.uint16_t; -- /usr/include/xcb/xkb.h:967 length : aliased Libc.Stdint.uint16_t; -- /usr/include/xcb/xkb.h:968 end record; pragma Convention (C_Pass_By_Copy, xcb_xkb_listing_t); -- /usr/include/xcb/xkb.h:966 type xcb_xkb_listing_iterator_t is record data : access xcb_xkb_listing_t; -- /usr/include/xcb/xkb.h:975 c_rem : aliased int; -- /usr/include/xcb/xkb.h:976 index : aliased int; -- /usr/include/xcb/xkb.h:977 end record; pragma Convention (C_Pass_By_Copy, xcb_xkb_listing_iterator_t); -- /usr/include/xcb/xkb.h:974 type xcb_xkb_device_led_info_t is record ledClass : aliased xcb_xkb_led_class_spec_t; -- /usr/include/xcb/xkb.h:984 ledID : aliased xcb_xkb_id_spec_t; -- /usr/include/xcb/xkb.h:985 namesPresent : aliased Libc.Stdint .uint32_t; -- /usr/include/xcb/xkb.h:986 mapsPresent : aliased Libc.Stdint .uint32_t; -- /usr/include/xcb/xkb.h:987 physIndicators : aliased Libc.Stdint .uint32_t; -- /usr/include/xcb/xkb.h:988 state : aliased Libc.Stdint.uint32_t; -- /usr/include/xcb/xkb.h:989 end record; pragma Convention (C_Pass_By_Copy, xcb_xkb_device_led_info_t); -- /usr/include/xcb/xkb.h:983 type xcb_xkb_device_led_info_iterator_t is record data : access xcb_xkb_device_led_info_t; -- /usr/include/xcb/xkb.h:996 c_rem : aliased int; -- /usr/include/xcb/xkb.h:997 index : aliased int; -- /usr/include/xcb/xkb.h:998 end record; pragma Convention (C_Pass_By_Copy, xcb_xkb_device_led_info_iterator_t); -- /usr/include/xcb/xkb.h:995 subtype xcb_xkb_error_t is unsigned; XCB_XKB_ERROR_BAD_DEVICE : constant xcb_xkb_error_t := 255; XCB_XKB_ERROR_BAD_CLASS : constant xcb_xkb_error_t := 254; XCB_XKB_ERROR_BAD_ID : constant xcb_xkb_error_t := 253; -- /usr/include/xcb/xkb.h:1001 type xcb_xkb_keyboard_error_t_pad0_array is array (0 .. 20) of aliased Libc.Stdint.uint8_t; type xcb_xkb_keyboard_error_t is record response_type : aliased Libc.Stdint .uint8_t; -- /usr/include/xcb/xkb.h:1014 error_code : aliased Libc.Stdint.uint8_t; -- /usr/include/xcb/xkb.h:1015 sequence : aliased Libc.Stdint.uint16_t; -- /usr/include/xcb/xkb.h:1016 value : aliased Libc.Stdint.uint32_t; -- /usr/include/xcb/xkb.h:1017 minorOpcode : aliased Libc.Stdint .uint16_t; -- /usr/include/xcb/xkb.h:1018 majorOpcode : aliased Libc.Stdint .uint8_t; -- /usr/include/xcb/xkb.h:1019 pad0 : aliased xcb_xkb_keyboard_error_t_pad0_array; -- /usr/include/xcb/xkb.h:1020 end record; pragma Convention (C_Pass_By_Copy, xcb_xkb_keyboard_error_t); -- /usr/include/xcb/xkb.h:1013 subtype xcb_xkb_sa_t is unsigned; XCB_XKB_SA_CLEAR_LOCKS : constant xcb_xkb_sa_t := 1; XCB_XKB_SA_LATCH_TO_LOCK : constant xcb_xkb_sa_t := 2; XCB_XKB_SA_USE_MOD_MAP_MODS : constant xcb_xkb_sa_t := 4; XCB_XKB_SA_GROUP_ABSOLUTE : constant xcb_xkb_sa_t := 4; -- /usr/include/xcb/xkb.h:1023 type xcb_xkb_sa_type_t is (XCB_XKB_SA_TYPE_NO_ACTION, XCB_XKB_SA_TYPE_SET_MODS, XCB_XKB_SA_TYPE_LATCH_MODS, XCB_XKB_SA_TYPE_LOCK_MODS, XCB_XKB_SA_TYPE_SET_GROUP, XCB_XKB_SA_TYPE_LATCH_GROUP, XCB_XKB_SA_TYPE_LOCK_GROUP, XCB_XKB_SA_TYPE_MOVE_PTR, XCB_XKB_SA_TYPE_PTR_BTN, XCB_XKB_SA_TYPE_LOCK_PTR_BTN, XCB_XKB_SA_TYPE_SET_PTR_DFLT, XCB_XKB_SA_TYPE_ISO_LOCK, XCB_XKB_SA_TYPE_TERMINATE, XCB_XKB_SA_TYPE_SWITCH_SCREEN, XCB_XKB_SA_TYPE_SET_CONTROLS, XCB_XKB_SA_TYPE_LOCK_CONTROLS, XCB_XKB_SA_TYPE_ACTION_MESSAGE, XCB_XKB_SA_TYPE_REDIRECT_KEY, XCB_XKB_SA_TYPE_DEVICE_BTN, XCB_XKB_SA_TYPE_LOCK_DEVICE_BTN, XCB_XKB_SA_TYPE_DEVICE_VALUATOR); pragma Convention (C, xcb_xkb_sa_type_t); -- /usr/include/xcb/xkb.h:1030 type xcb_xkb_sa_no_action_t_pad0_array is array (0 .. 6) of aliased Libc.Stdint.uint8_t; type xcb_xkb_sa_no_action_t is record c_type : aliased Libc.Stdint.uint8_t; -- /usr/include/xcb/xkb.h:1058 pad0 : aliased xcb_xkb_sa_no_action_t_pad0_array; -- /usr/include/xcb/xkb.h:1059 end record; pragma Convention (C_Pass_By_Copy, xcb_xkb_sa_no_action_t); -- /usr/include/xcb/xkb.h:1057 type xcb_xkb_sa_no_action_iterator_t is record data : access xcb_xkb_sa_no_action_t; -- /usr/include/xcb/xkb.h:1066 c_rem : aliased int; -- /usr/include/xcb/xkb.h:1067 index : aliased int; -- /usr/include/xcb/xkb.h:1068 end record; pragma Convention (C_Pass_By_Copy, xcb_xkb_sa_no_action_iterator_t); -- /usr/include/xcb/xkb.h:1065 type xcb_xkb_sa_set_mods_t_pad0_array is array (0 .. 1) of aliased Libc.Stdint.uint8_t; type xcb_xkb_sa_set_mods_t is record c_type : aliased Libc.Stdint.uint8_t; -- /usr/include/xcb/xkb.h:1075 flags : aliased Libc.Stdint.uint8_t; -- /usr/include/xcb/xkb.h:1076 mask : aliased Libc.Stdint.uint8_t; -- /usr/include/xcb/xkb.h:1077 realMods : aliased Libc.Stdint.uint8_t; -- /usr/include/xcb/xkb.h:1078 vmodsHigh : aliased Libc.Stdint.uint8_t; -- /usr/include/xcb/xkb.h:1079 vmodsLow : aliased Libc.Stdint.uint8_t; -- /usr/include/xcb/xkb.h:1080 pad0 : aliased xcb_xkb_sa_set_mods_t_pad0_array; -- /usr/include/xcb/xkb.h:1081 end record; pragma Convention (C_Pass_By_Copy, xcb_xkb_sa_set_mods_t); -- /usr/include/xcb/xkb.h:1074 type xcb_xkb_sa_set_mods_iterator_t is record data : access xcb_xkb_sa_set_mods_t; -- /usr/include/xcb/xkb.h:1088 c_rem : aliased int; -- /usr/include/xcb/xkb.h:1089 index : aliased int; -- /usr/include/xcb/xkb.h:1090 end record; pragma Convention (C_Pass_By_Copy, xcb_xkb_sa_set_mods_iterator_t); -- /usr/include/xcb/xkb.h:1087 type xcb_xkb_sa_latch_mods_t_pad0_array is array (0 .. 1) of aliased Libc.Stdint.uint8_t; type xcb_xkb_sa_latch_mods_t is record c_type : aliased Libc.Stdint.uint8_t; -- /usr/include/xcb/xkb.h:1097 flags : aliased Libc.Stdint.uint8_t; -- /usr/include/xcb/xkb.h:1098 mask : aliased Libc.Stdint.uint8_t; -- /usr/include/xcb/xkb.h:1099 realMods : aliased Libc.Stdint.uint8_t; -- /usr/include/xcb/xkb.h:1100 vmodsHigh : aliased Libc.Stdint.uint8_t; -- /usr/include/xcb/xkb.h:1101 vmodsLow : aliased Libc.Stdint.uint8_t; -- /usr/include/xcb/xkb.h:1102 pad0 : aliased xcb_xkb_sa_latch_mods_t_pad0_array; -- /usr/include/xcb/xkb.h:1103 end record; pragma Convention (C_Pass_By_Copy, xcb_xkb_sa_latch_mods_t); -- /usr/include/xcb/xkb.h:1096 type xcb_xkb_sa_latch_mods_iterator_t is record data : access xcb_xkb_sa_latch_mods_t; -- /usr/include/xcb/xkb.h:1110 c_rem : aliased int; -- /usr/include/xcb/xkb.h:1111 index : aliased int; -- /usr/include/xcb/xkb.h:1112 end record; pragma Convention (C_Pass_By_Copy, xcb_xkb_sa_latch_mods_iterator_t); -- /usr/include/xcb/xkb.h:1109 type xcb_xkb_sa_lock_mods_t_pad0_array is array (0 .. 1) of aliased Libc.Stdint.uint8_t; type xcb_xkb_sa_lock_mods_t is record c_type : aliased Libc.Stdint.uint8_t; -- /usr/include/xcb/xkb.h:1119 flags : aliased Libc.Stdint.uint8_t; -- /usr/include/xcb/xkb.h:1120 mask : aliased Libc.Stdint.uint8_t; -- /usr/include/xcb/xkb.h:1121 realMods : aliased Libc.Stdint.uint8_t; -- /usr/include/xcb/xkb.h:1122 vmodsHigh : aliased Libc.Stdint.uint8_t; -- /usr/include/xcb/xkb.h:1123 vmodsLow : aliased Libc.Stdint.uint8_t; -- /usr/include/xcb/xkb.h:1124 pad0 : aliased xcb_xkb_sa_lock_mods_t_pad0_array; -- /usr/include/xcb/xkb.h:1125 end record; pragma Convention (C_Pass_By_Copy, xcb_xkb_sa_lock_mods_t); -- /usr/include/xcb/xkb.h:1118 type xcb_xkb_sa_lock_mods_iterator_t is record data : access xcb_xkb_sa_lock_mods_t; -- /usr/include/xcb/xkb.h:1132 c_rem : aliased int; -- /usr/include/xcb/xkb.h:1133 index : aliased int; -- /usr/include/xcb/xkb.h:1134 end record; pragma Convention (C_Pass_By_Copy, xcb_xkb_sa_lock_mods_iterator_t); -- /usr/include/xcb/xkb.h:1131 type xcb_xkb_sa_set_group_t_pad0_array is array (0 .. 4) of aliased Libc.Stdint.uint8_t; type xcb_xkb_sa_set_group_t is record c_type : aliased Libc.Stdint.uint8_t; -- /usr/include/xcb/xkb.h:1141 flags : aliased Libc.Stdint.uint8_t; -- /usr/include/xcb/xkb.h:1142 group : aliased Libc.Stdint.int8_t; -- /usr/include/xcb/xkb.h:1143 pad0 : aliased xcb_xkb_sa_set_group_t_pad0_array; -- /usr/include/xcb/xkb.h:1144 end record; pragma Convention (C_Pass_By_Copy, xcb_xkb_sa_set_group_t); -- /usr/include/xcb/xkb.h:1140 type xcb_xkb_sa_set_group_iterator_t is record data : access xcb_xkb_sa_set_group_t; -- /usr/include/xcb/xkb.h:1151 c_rem : aliased int; -- /usr/include/xcb/xkb.h:1152 index : aliased int; -- /usr/include/xcb/xkb.h:1153 end record; pragma Convention (C_Pass_By_Copy, xcb_xkb_sa_set_group_iterator_t); -- /usr/include/xcb/xkb.h:1150 type xcb_xkb_sa_latch_group_t_pad0_array is array (0 .. 4) of aliased Libc.Stdint.uint8_t; type xcb_xkb_sa_latch_group_t is record c_type : aliased Libc.Stdint.uint8_t; -- /usr/include/xcb/xkb.h:1160 flags : aliased Libc.Stdint.uint8_t; -- /usr/include/xcb/xkb.h:1161 group : aliased Libc.Stdint.int8_t; -- /usr/include/xcb/xkb.h:1162 pad0 : aliased xcb_xkb_sa_latch_group_t_pad0_array; -- /usr/include/xcb/xkb.h:1163 end record; pragma Convention (C_Pass_By_Copy, xcb_xkb_sa_latch_group_t); -- /usr/include/xcb/xkb.h:1159 type xcb_xkb_sa_latch_group_iterator_t is record data : access xcb_xkb_sa_latch_group_t; -- /usr/include/xcb/xkb.h:1170 c_rem : aliased int; -- /usr/include/xcb/xkb.h:1171 index : aliased int; -- /usr/include/xcb/xkb.h:1172 end record; pragma Convention (C_Pass_By_Copy, xcb_xkb_sa_latch_group_iterator_t); -- /usr/include/xcb/xkb.h:1169 type xcb_xkb_sa_lock_group_t_pad0_array is array (0 .. 4) of aliased Libc.Stdint.uint8_t; type xcb_xkb_sa_lock_group_t is record c_type : aliased Libc.Stdint.uint8_t; -- /usr/include/xcb/xkb.h:1179 flags : aliased Libc.Stdint.uint8_t; -- /usr/include/xcb/xkb.h:1180 group : aliased Libc.Stdint.int8_t; -- /usr/include/xcb/xkb.h:1181 pad0 : aliased xcb_xkb_sa_lock_group_t_pad0_array; -- /usr/include/xcb/xkb.h:1182 end record; pragma Convention (C_Pass_By_Copy, xcb_xkb_sa_lock_group_t); -- /usr/include/xcb/xkb.h:1178 type xcb_xkb_sa_lock_group_iterator_t is record data : access xcb_xkb_sa_lock_group_t; -- /usr/include/xcb/xkb.h:1189 c_rem : aliased int; -- /usr/include/xcb/xkb.h:1190 index : aliased int; -- /usr/include/xcb/xkb.h:1191 end record; pragma Convention (C_Pass_By_Copy, xcb_xkb_sa_lock_group_iterator_t); -- /usr/include/xcb/xkb.h:1188 subtype xcb_xkb_sa_move_ptr_flag_t is unsigned; XCB_XKB_SA_MOVE_PTR_FLAG_NO_ACCELERATION : constant xcb_xkb_sa_move_ptr_flag_t := 1; XCB_XKB_SA_MOVE_PTR_FLAG_MOVE_ABSOLUTE_X : constant xcb_xkb_sa_move_ptr_flag_t := 2; XCB_XKB_SA_MOVE_PTR_FLAG_MOVE_ABSOLUTE_Y : constant xcb_xkb_sa_move_ptr_flag_t := 4; -- /usr/include/xcb/xkb.h:1194 type xcb_xkb_sa_move_ptr_t_pad0_array is array (0 .. 1) of aliased Libc.Stdint.uint8_t; type xcb_xkb_sa_move_ptr_t is record c_type : aliased Libc.Stdint.uint8_t; -- /usr/include/xcb/xkb.h:1204 flags : aliased Libc.Stdint.uint8_t; -- /usr/include/xcb/xkb.h:1205 xHigh : aliased Libc.Stdint.int8_t; -- /usr/include/xcb/xkb.h:1206 xLow : aliased Libc.Stdint.uint8_t; -- /usr/include/xcb/xkb.h:1207 yHigh : aliased Libc.Stdint.int8_t; -- /usr/include/xcb/xkb.h:1208 yLow : aliased Libc.Stdint.uint8_t; -- /usr/include/xcb/xkb.h:1209 pad0 : aliased xcb_xkb_sa_move_ptr_t_pad0_array; -- /usr/include/xcb/xkb.h:1210 end record; pragma Convention (C_Pass_By_Copy, xcb_xkb_sa_move_ptr_t); -- /usr/include/xcb/xkb.h:1203 type xcb_xkb_sa_move_ptr_iterator_t is record data : access xcb_xkb_sa_move_ptr_t; -- /usr/include/xcb/xkb.h:1217 c_rem : aliased int; -- /usr/include/xcb/xkb.h:1218 index : aliased int; -- /usr/include/xcb/xkb.h:1219 end record; pragma Convention (C_Pass_By_Copy, xcb_xkb_sa_move_ptr_iterator_t); -- /usr/include/xcb/xkb.h:1216 type xcb_xkb_sa_ptr_btn_t_pad0_array is array (0 .. 3) of aliased Libc.Stdint.uint8_t; type xcb_xkb_sa_ptr_btn_t is record c_type : aliased Libc.Stdint.uint8_t; -- /usr/include/xcb/xkb.h:1226 flags : aliased Libc.Stdint.uint8_t; -- /usr/include/xcb/xkb.h:1227 count : aliased Libc.Stdint.uint8_t; -- /usr/include/xcb/xkb.h:1228 button : aliased Libc.Stdint.uint8_t; -- /usr/include/xcb/xkb.h:1229 pad0 : aliased xcb_xkb_sa_ptr_btn_t_pad0_array; -- /usr/include/xcb/xkb.h:1230 end record; pragma Convention (C_Pass_By_Copy, xcb_xkb_sa_ptr_btn_t); -- /usr/include/xcb/xkb.h:1225 type xcb_xkb_sa_ptr_btn_iterator_t is record data : access xcb_xkb_sa_ptr_btn_t; -- /usr/include/xcb/xkb.h:1237 c_rem : aliased int; -- /usr/include/xcb/xkb.h:1238 index : aliased int; -- /usr/include/xcb/xkb.h:1239 end record; pragma Convention (C_Pass_By_Copy, xcb_xkb_sa_ptr_btn_iterator_t); -- /usr/include/xcb/xkb.h:1236 type xcb_xkb_sa_lock_ptr_btn_t_pad1_array is array (0 .. 3) of aliased Libc.Stdint.uint8_t; type xcb_xkb_sa_lock_ptr_btn_t is record c_type : aliased Libc.Stdint.uint8_t; -- /usr/include/xcb/xkb.h:1246 flags : aliased Libc.Stdint.uint8_t; -- /usr/include/xcb/xkb.h:1247 pad0 : aliased Libc.Stdint.uint8_t; -- /usr/include/xcb/xkb.h:1248 button : aliased Libc.Stdint.uint8_t; -- /usr/include/xcb/xkb.h:1249 pad1 : aliased xcb_xkb_sa_lock_ptr_btn_t_pad1_array; -- /usr/include/xcb/xkb.h:1250 end record; pragma Convention (C_Pass_By_Copy, xcb_xkb_sa_lock_ptr_btn_t); -- /usr/include/xcb/xkb.h:1245 type xcb_xkb_sa_lock_ptr_btn_iterator_t is record data : access xcb_xkb_sa_lock_ptr_btn_t; -- /usr/include/xcb/xkb.h:1257 c_rem : aliased int; -- /usr/include/xcb/xkb.h:1258 index : aliased int; -- /usr/include/xcb/xkb.h:1259 end record; pragma Convention (C_Pass_By_Copy, xcb_xkb_sa_lock_ptr_btn_iterator_t); -- /usr/include/xcb/xkb.h:1256 subtype xcb_xkb_sa_set_ptr_dflt_flag_t is unsigned; XCB_XKB_SA_SET_PTR_DFLT_FLAG_DFLT_BTN_ABSOLUTE : constant xcb_xkb_sa_set_ptr_dflt_flag_t := 4; XCB_XKB_SA_SET_PTR_DFLT_FLAG_AFFECT_DFLT_BUTTON : constant xcb_xkb_sa_set_ptr_dflt_flag_t := 1; -- /usr/include/xcb/xkb.h:1262 type xcb_xkb_sa_set_ptr_dflt_t_pad0_array is array (0 .. 3) of aliased Libc.Stdint.uint8_t; type xcb_xkb_sa_set_ptr_dflt_t is record c_type : aliased Libc.Stdint.uint8_t; -- /usr/include/xcb/xkb.h:1271 flags : aliased Libc.Stdint.uint8_t; -- /usr/include/xcb/xkb.h:1272 affect : aliased Libc.Stdint.uint8_t; -- /usr/include/xcb/xkb.h:1273 value : aliased Libc.Stdint.int8_t; -- /usr/include/xcb/xkb.h:1274 pad0 : aliased xcb_xkb_sa_set_ptr_dflt_t_pad0_array; -- /usr/include/xcb/xkb.h:1275 end record; pragma Convention (C_Pass_By_Copy, xcb_xkb_sa_set_ptr_dflt_t); -- /usr/include/xcb/xkb.h:1270 type xcb_xkb_sa_set_ptr_dflt_iterator_t is record data : access xcb_xkb_sa_set_ptr_dflt_t; -- /usr/include/xcb/xkb.h:1282 c_rem : aliased int; -- /usr/include/xcb/xkb.h:1283 index : aliased int; -- /usr/include/xcb/xkb.h:1284 end record; pragma Convention (C_Pass_By_Copy, xcb_xkb_sa_set_ptr_dflt_iterator_t); -- /usr/include/xcb/xkb.h:1281 subtype xcb_xkb_sa_iso_lock_flag_t is unsigned; XCB_XKB_SA_ISO_LOCK_FLAG_NO_LOCK : constant xcb_xkb_sa_iso_lock_flag_t := 1; XCB_XKB_SA_ISO_LOCK_FLAG_NO_UNLOCK : constant xcb_xkb_sa_iso_lock_flag_t := 2; XCB_XKB_SA_ISO_LOCK_FLAG_USE_MOD_MAP_MODS : constant xcb_xkb_sa_iso_lock_flag_t := 4; XCB_XKB_SA_ISO_LOCK_FLAG_GROUP_ABSOLUTE : constant xcb_xkb_sa_iso_lock_flag_t := 4; XCB_XKB_SA_ISO_LOCK_FLAG_ISO_DFLT_IS_GROUP : constant xcb_xkb_sa_iso_lock_flag_t := 8; -- /usr/include/xcb/xkb.h:1287 subtype xcb_xkb_sa_iso_lock_no_affect_t is unsigned; XCB_XKB_SA_ISO_LOCK_NO_AFFECT_CTRLS : constant xcb_xkb_sa_iso_lock_no_affect_t := 8; XCB_XKB_SA_ISO_LOCK_NO_AFFECT_PTR : constant xcb_xkb_sa_iso_lock_no_affect_t := 16; XCB_XKB_SA_ISO_LOCK_NO_AFFECT_GROUP : constant xcb_xkb_sa_iso_lock_no_affect_t := 32; XCB_XKB_SA_ISO_LOCK_NO_AFFECT_MODS : constant xcb_xkb_sa_iso_lock_no_affect_t := 64; -- /usr/include/xcb/xkb.h:1295 type xcb_xkb_sa_iso_lock_t is record c_type : aliased Libc.Stdint.uint8_t; -- /usr/include/xcb/xkb.h:1306 flags : aliased Libc.Stdint.uint8_t; -- /usr/include/xcb/xkb.h:1307 mask : aliased Libc.Stdint.uint8_t; -- /usr/include/xcb/xkb.h:1308 realMods : aliased Libc.Stdint.uint8_t; -- /usr/include/xcb/xkb.h:1309 group : aliased Libc.Stdint.int8_t; -- /usr/include/xcb/xkb.h:1310 affect : aliased Libc.Stdint.uint8_t; -- /usr/include/xcb/xkb.h:1311 vmodsHigh : aliased Libc.Stdint.uint8_t; -- /usr/include/xcb/xkb.h:1312 vmodsLow : aliased Libc.Stdint.uint8_t; -- /usr/include/xcb/xkb.h:1313 end record; pragma Convention (C_Pass_By_Copy, xcb_xkb_sa_iso_lock_t); -- /usr/include/xcb/xkb.h:1305 type xcb_xkb_sa_iso_lock_iterator_t is record data : access xcb_xkb_sa_iso_lock_t; -- /usr/include/xcb/xkb.h:1320 c_rem : aliased int; -- /usr/include/xcb/xkb.h:1321 index : aliased int; -- /usr/include/xcb/xkb.h:1322 end record; pragma Convention (C_Pass_By_Copy, xcb_xkb_sa_iso_lock_iterator_t); -- /usr/include/xcb/xkb.h:1319 type xcb_xkb_sa_terminate_t_pad0_array is array (0 .. 6) of aliased Libc.Stdint.uint8_t; type xcb_xkb_sa_terminate_t is record c_type : aliased Libc.Stdint.uint8_t; -- /usr/include/xcb/xkb.h:1329 pad0 : aliased xcb_xkb_sa_terminate_t_pad0_array; -- /usr/include/xcb/xkb.h:1330 end record; pragma Convention (C_Pass_By_Copy, xcb_xkb_sa_terminate_t); -- /usr/include/xcb/xkb.h:1328 type xcb_xkb_sa_terminate_iterator_t is record data : access xcb_xkb_sa_terminate_t; -- /usr/include/xcb/xkb.h:1337 c_rem : aliased int; -- /usr/include/xcb/xkb.h:1338 index : aliased int; -- /usr/include/xcb/xkb.h:1339 end record; pragma Convention (C_Pass_By_Copy, xcb_xkb_sa_terminate_iterator_t); -- /usr/include/xcb/xkb.h:1336 subtype xcb_xkb_switch_screen_flag_t is unsigned; XCB_XKB_SWITCH_SCREEN_FLAG_APPLICATION : constant xcb_xkb_switch_screen_flag_t := 1; XCB_XKB_SWITCH_SCREEN_FLAG_ABSOLUTE : constant xcb_xkb_switch_screen_flag_t := 4; -- /usr/include/xcb/xkb.h:1342 type xcb_xkb_sa_switch_screen_t_pad0_array is array (0 .. 4) of aliased Libc.Stdint.uint8_t; type xcb_xkb_sa_switch_screen_t is record c_type : aliased Libc.Stdint.uint8_t; -- /usr/include/xcb/xkb.h:1351 flags : aliased Libc.Stdint.uint8_t; -- /usr/include/xcb/xkb.h:1352 newScreen : aliased Libc.Stdint.int8_t; -- /usr/include/xcb/xkb.h:1353 pad0 : aliased xcb_xkb_sa_switch_screen_t_pad0_array; -- /usr/include/xcb/xkb.h:1354 end record; pragma Convention (C_Pass_By_Copy, xcb_xkb_sa_switch_screen_t); -- /usr/include/xcb/xkb.h:1350 type xcb_xkb_sa_switch_screen_iterator_t is record data : access xcb_xkb_sa_switch_screen_t; -- /usr/include/xcb/xkb.h:1361 c_rem : aliased int; -- /usr/include/xcb/xkb.h:1362 index : aliased int; -- /usr/include/xcb/xkb.h:1363 end record; pragma Convention (C_Pass_By_Copy, xcb_xkb_sa_switch_screen_iterator_t); -- /usr/include/xcb/xkb.h:1360 subtype xcb_xkb_bool_ctrls_high_t is unsigned; XCB_XKB_BOOL_CTRLS_HIGH_ACCESS_X_FEEDBACK : constant xcb_xkb_bool_ctrls_high_t := 1; XCB_XKB_BOOL_CTRLS_HIGH_AUDIBLE_BELL : constant xcb_xkb_bool_ctrls_high_t := 2; XCB_XKB_BOOL_CTRLS_HIGH_OVERLAY_1 : constant xcb_xkb_bool_ctrls_high_t := 4; XCB_XKB_BOOL_CTRLS_HIGH_OVERLAY_2 : constant xcb_xkb_bool_ctrls_high_t := 8; XCB_XKB_BOOL_CTRLS_HIGH_IGNORE_GROUP_LOCK : constant xcb_xkb_bool_ctrls_high_t := 16; -- /usr/include/xcb/xkb.h:1366 subtype xcb_xkb_bool_ctrls_low_t is unsigned; XCB_XKB_BOOL_CTRLS_LOW_REPEAT_KEYS : constant xcb_xkb_bool_ctrls_low_t := 1; XCB_XKB_BOOL_CTRLS_LOW_SLOW_KEYS : constant xcb_xkb_bool_ctrls_low_t := 2; XCB_XKB_BOOL_CTRLS_LOW_BOUNCE_KEYS : constant xcb_xkb_bool_ctrls_low_t := 4; XCB_XKB_BOOL_CTRLS_LOW_STICKY_KEYS : constant xcb_xkb_bool_ctrls_low_t := 8; XCB_XKB_BOOL_CTRLS_LOW_MOUSE_KEYS : constant xcb_xkb_bool_ctrls_low_t := 16; XCB_XKB_BOOL_CTRLS_LOW_MOUSE_KEYS_ACCEL : constant xcb_xkb_bool_ctrls_low_t := 32; XCB_XKB_BOOL_CTRLS_LOW_ACCESS_X_KEYS : constant xcb_xkb_bool_ctrls_low_t := 64; XCB_XKB_BOOL_CTRLS_LOW_ACCESS_X_TIMEOUT : constant xcb_xkb_bool_ctrls_low_t := 128; -- /usr/include/xcb/xkb.h:1374 type xcb_xkb_sa_set_controls_t_pad0_array is array (0 .. 2) of aliased Libc.Stdint.uint8_t; type xcb_xkb_sa_set_controls_t_pad1_array is array (0 .. 1) of aliased Libc.Stdint.uint8_t; type xcb_xkb_sa_set_controls_t is record c_type : aliased Libc.Stdint.uint8_t; -- /usr/include/xcb/xkb.h:1389 pad0 : aliased xcb_xkb_sa_set_controls_t_pad0_array; -- /usr/include/xcb/xkb.h:1390 boolCtrlsHigh : aliased Libc.Stdint .uint8_t; -- /usr/include/xcb/xkb.h:1391 boolCtrlsLow : aliased Libc.Stdint .uint8_t; -- /usr/include/xcb/xkb.h:1392 pad1 : aliased xcb_xkb_sa_set_controls_t_pad1_array; -- /usr/include/xcb/xkb.h:1393 end record; pragma Convention (C_Pass_By_Copy, xcb_xkb_sa_set_controls_t); -- /usr/include/xcb/xkb.h:1388 type xcb_xkb_sa_set_controls_iterator_t is record data : access xcb_xkb_sa_set_controls_t; -- /usr/include/xcb/xkb.h:1400 c_rem : aliased int; -- /usr/include/xcb/xkb.h:1401 index : aliased int; -- /usr/include/xcb/xkb.h:1402 end record; pragma Convention (C_Pass_By_Copy, xcb_xkb_sa_set_controls_iterator_t); -- /usr/include/xcb/xkb.h:1399 type xcb_xkb_sa_lock_controls_t_pad0_array is array (0 .. 2) of aliased Libc.Stdint.uint8_t; type xcb_xkb_sa_lock_controls_t_pad1_array is array (0 .. 1) of aliased Libc.Stdint.uint8_t; type xcb_xkb_sa_lock_controls_t is record c_type : aliased Libc.Stdint.uint8_t; -- /usr/include/xcb/xkb.h:1409 pad0 : aliased xcb_xkb_sa_lock_controls_t_pad0_array; -- /usr/include/xcb/xkb.h:1410 boolCtrlsHigh : aliased Libc.Stdint .uint8_t; -- /usr/include/xcb/xkb.h:1411 boolCtrlsLow : aliased Libc.Stdint .uint8_t; -- /usr/include/xcb/xkb.h:1412 pad1 : aliased xcb_xkb_sa_lock_controls_t_pad1_array; -- /usr/include/xcb/xkb.h:1413 end record; pragma Convention (C_Pass_By_Copy, xcb_xkb_sa_lock_controls_t); -- /usr/include/xcb/xkb.h:1408 type xcb_xkb_sa_lock_controls_iterator_t is record data : access xcb_xkb_sa_lock_controls_t; -- /usr/include/xcb/xkb.h:1420 c_rem : aliased int; -- /usr/include/xcb/xkb.h:1421 index : aliased int; -- /usr/include/xcb/xkb.h:1422 end record; pragma Convention (C_Pass_By_Copy, xcb_xkb_sa_lock_controls_iterator_t); -- /usr/include/xcb/xkb.h:1419 subtype xcb_xkb_action_message_flag_t is unsigned; XCB_XKB_ACTION_MESSAGE_FLAG_ON_PRESS : constant xcb_xkb_action_message_flag_t := 1; XCB_XKB_ACTION_MESSAGE_FLAG_ON_RELEASE : constant xcb_xkb_action_message_flag_t := 2; XCB_XKB_ACTION_MESSAGE_FLAG_GEN_KEY_EVENT : constant xcb_xkb_action_message_flag_t := 4; -- /usr/include/xcb/xkb.h:1425 type xcb_xkb_sa_action_message_t_message_array is array (0 .. 5) of aliased Libc.Stdint.uint8_t; type xcb_xkb_sa_action_message_t is record c_type : aliased Libc.Stdint.uint8_t; -- /usr/include/xcb/xkb.h:1435 flags : aliased Libc.Stdint.uint8_t; -- /usr/include/xcb/xkb.h:1436 message : aliased xcb_xkb_sa_action_message_t_message_array; -- /usr/include/xcb/xkb.h:1437 end record; pragma Convention (C_Pass_By_Copy, xcb_xkb_sa_action_message_t); -- /usr/include/xcb/xkb.h:1434 type xcb_xkb_sa_action_message_iterator_t is record data : access xcb_xkb_sa_action_message_t; -- /usr/include/xcb/xkb.h:1444 c_rem : aliased int; -- /usr/include/xcb/xkb.h:1445 index : aliased int; -- /usr/include/xcb/xkb.h:1446 end record; pragma Convention (C_Pass_By_Copy, xcb_xkb_sa_action_message_iterator_t); -- /usr/include/xcb/xkb.h:1443 type xcb_xkb_sa_redirect_key_t is record c_type : aliased Libc.Stdint.uint8_t; -- /usr/include/xcb/xkb.h:1453 newkey : aliased XCB.XProto .xcb_keycode_t; -- /usr/include/xcb/xkb.h:1454 mask : aliased Libc.Stdint.uint8_t; -- /usr/include/xcb/xkb.h:1455 realModifiers : aliased Libc.Stdint .uint8_t; -- /usr/include/xcb/xkb.h:1456 vmodsMaskHigh : aliased Libc.Stdint .uint8_t; -- /usr/include/xcb/xkb.h:1457 vmodsMaskLow : aliased Libc.Stdint .uint8_t; -- /usr/include/xcb/xkb.h:1458 vmodsHigh : aliased Libc.Stdint.uint8_t; -- /usr/include/xcb/xkb.h:1459 vmodsLow : aliased Libc.Stdint.uint8_t; -- /usr/include/xcb/xkb.h:1460 end record; pragma Convention (C_Pass_By_Copy, xcb_xkb_sa_redirect_key_t); -- /usr/include/xcb/xkb.h:1452 type xcb_xkb_sa_redirect_key_iterator_t is record data : access xcb_xkb_sa_redirect_key_t; -- /usr/include/xcb/xkb.h:1467 c_rem : aliased int; -- /usr/include/xcb/xkb.h:1468 index : aliased int; -- /usr/include/xcb/xkb.h:1469 end record; pragma Convention (C_Pass_By_Copy, xcb_xkb_sa_redirect_key_iterator_t); -- /usr/include/xcb/xkb.h:1466 type xcb_xkb_sa_device_btn_t_pad0_array is array (0 .. 2) of aliased Libc.Stdint.uint8_t; type xcb_xkb_sa_device_btn_t is record c_type : aliased Libc.Stdint.uint8_t; -- /usr/include/xcb/xkb.h:1476 flags : aliased Libc.Stdint.uint8_t; -- /usr/include/xcb/xkb.h:1477 count : aliased Libc.Stdint.uint8_t; -- /usr/include/xcb/xkb.h:1478 button : aliased Libc.Stdint.uint8_t; -- /usr/include/xcb/xkb.h:1479 device : aliased Libc.Stdint.uint8_t; -- /usr/include/xcb/xkb.h:1480 pad0 : aliased xcb_xkb_sa_device_btn_t_pad0_array; -- /usr/include/xcb/xkb.h:1481 end record; pragma Convention (C_Pass_By_Copy, xcb_xkb_sa_device_btn_t); -- /usr/include/xcb/xkb.h:1475 type xcb_xkb_sa_device_btn_iterator_t is record data : access xcb_xkb_sa_device_btn_t; -- /usr/include/xcb/xkb.h:1488 c_rem : aliased int; -- /usr/include/xcb/xkb.h:1489 index : aliased int; -- /usr/include/xcb/xkb.h:1490 end record; pragma Convention (C_Pass_By_Copy, xcb_xkb_sa_device_btn_iterator_t); -- /usr/include/xcb/xkb.h:1487 subtype xcb_xkb_lock_device_flags_t is unsigned; XCB_XKB_LOCK_DEVICE_FLAGS_NO_LOCK : constant xcb_xkb_lock_device_flags_t := 1; XCB_XKB_LOCK_DEVICE_FLAGS_NO_UNLOCK : constant xcb_xkb_lock_device_flags_t := 2; -- /usr/include/xcb/xkb.h:1493 type xcb_xkb_sa_lock_device_btn_t_pad1_array is array (0 .. 2) of aliased Libc.Stdint.uint8_t; type xcb_xkb_sa_lock_device_btn_t is record c_type : aliased Libc.Stdint.uint8_t; -- /usr/include/xcb/xkb.h:1502 flags : aliased Libc.Stdint.uint8_t; -- /usr/include/xcb/xkb.h:1503 pad0 : aliased Libc.Stdint.uint8_t; -- /usr/include/xcb/xkb.h:1504 button : aliased Libc.Stdint.uint8_t; -- /usr/include/xcb/xkb.h:1505 device : aliased Libc.Stdint.uint8_t; -- /usr/include/xcb/xkb.h:1506 pad1 : aliased xcb_xkb_sa_lock_device_btn_t_pad1_array; -- /usr/include/xcb/xkb.h:1507 end record; pragma Convention (C_Pass_By_Copy, xcb_xkb_sa_lock_device_btn_t); -- /usr/include/xcb/xkb.h:1501 type xcb_xkb_sa_lock_device_btn_iterator_t is record data : access xcb_xkb_sa_lock_device_btn_t; -- /usr/include/xcb/xkb.h:1514 c_rem : aliased int; -- /usr/include/xcb/xkb.h:1515 index : aliased int; -- /usr/include/xcb/xkb.h:1516 end record; pragma Convention (C_Pass_By_Copy, xcb_xkb_sa_lock_device_btn_iterator_t); -- /usr/include/xcb/xkb.h:1513 type xcb_xkb_sa_val_what_t is (XCB_XKB_SA_VAL_WHAT_IGNORE_VAL, XCB_XKB_SA_VAL_WHAT_SET_VAL_MIN, XCB_XKB_SA_VAL_WHAT_SET_VAL_CENTER, XCB_XKB_SA_VAL_WHAT_SET_VAL_MAX, XCB_XKB_SA_VAL_WHAT_SET_VAL_RELATIVE, XCB_XKB_SA_VAL_WHAT_SET_VAL_ABSOLUTE); pragma Convention (C, xcb_xkb_sa_val_what_t); -- /usr/include/xcb/xkb.h:1519 type xcb_xkb_sa_device_valuator_t is record c_type : aliased Libc.Stdint.uint8_t; -- /usr/include/xcb/xkb.h:1532 device : aliased Libc.Stdint.uint8_t; -- /usr/include/xcb/xkb.h:1533 val1what : aliased Libc.Stdint.uint8_t; -- /usr/include/xcb/xkb.h:1534 val1index : aliased Libc.Stdint.uint8_t; -- /usr/include/xcb/xkb.h:1535 val1value : aliased Libc.Stdint.uint8_t; -- /usr/include/xcb/xkb.h:1536 val2what : aliased Libc.Stdint.uint8_t; -- /usr/include/xcb/xkb.h:1537 val2index : aliased Libc.Stdint.uint8_t; -- /usr/include/xcb/xkb.h:1538 val2value : aliased Libc.Stdint.uint8_t; -- /usr/include/xcb/xkb.h:1539 end record; pragma Convention (C_Pass_By_Copy, xcb_xkb_sa_device_valuator_t); -- /usr/include/xcb/xkb.h:1531 type xcb_xkb_sa_device_valuator_iterator_t is record data : access xcb_xkb_sa_device_valuator_t; -- /usr/include/xcb/xkb.h:1546 c_rem : aliased int; -- /usr/include/xcb/xkb.h:1547 index : aliased int; -- /usr/include/xcb/xkb.h:1548 end record; pragma Convention (C_Pass_By_Copy, xcb_xkb_sa_device_valuator_iterator_t); -- /usr/include/xcb/xkb.h:1545 type xcb_xkb_si_action_t_data_array is array (0 .. 6) of aliased Libc.Stdint.uint8_t; type xcb_xkb_si_action_t is record c_type : aliased Libc.Stdint.uint8_t; -- /usr/include/xcb/xkb.h:1555 data : aliased xcb_xkb_si_action_t_data_array; -- /usr/include/xcb/xkb.h:1556 end record; pragma Convention (C_Pass_By_Copy, xcb_xkb_si_action_t); -- /usr/include/xcb/xkb.h:1554 type xcb_xkb_si_action_iterator_t is record data : access xcb_xkb_si_action_t; -- /usr/include/xcb/xkb.h:1563 c_rem : aliased int; -- /usr/include/xcb/xkb.h:1564 index : aliased int; -- /usr/include/xcb/xkb.h:1565 end record; pragma Convention (C_Pass_By_Copy, xcb_xkb_si_action_iterator_t); -- /usr/include/xcb/xkb.h:1562 type xcb_xkb_sym_interpret_t is record sym : aliased XCB.XProto.xcb_keysym_t; -- /usr/include/xcb/xkb.h:1572 mods : aliased Libc.Stdint.uint8_t; -- /usr/include/xcb/xkb.h:1573 match : aliased Libc.Stdint.uint8_t; -- /usr/include/xcb/xkb.h:1574 virtualMod : aliased Libc.Stdint.uint8_t; -- /usr/include/xcb/xkb.h:1575 flags : aliased Libc.Stdint.uint8_t; -- /usr/include/xcb/xkb.h:1576 action : aliased xcb_xkb_si_action_t; -- /usr/include/xcb/xkb.h:1577 end record; pragma Convention (C_Pass_By_Copy, xcb_xkb_sym_interpret_t); -- /usr/include/xcb/xkb.h:1571 type xcb_xkb_sym_interpret_iterator_t is record data : access xcb_xkb_sym_interpret_t; -- /usr/include/xcb/xkb.h:1584 c_rem : aliased int; -- /usr/include/xcb/xkb.h:1585 index : aliased int; -- /usr/include/xcb/xkb.h:1586 end record; pragma Convention (C_Pass_By_Copy, xcb_xkb_sym_interpret_iterator_t); -- /usr/include/xcb/xkb.h:1583 type xcb_xkb_action_t (discr : unsigned := 0) is record case discr is when 0 => noaction : aliased xcb_xkb_sa_no_action_t; -- /usr/include/xcb/xkb.h:1593 when 1 => setmods : aliased xcb_xkb_sa_set_mods_t; -- /usr/include/xcb/xkb.h:1594 when 2 => latchmods : aliased xcb_xkb_sa_latch_mods_t; -- /usr/include/xcb/xkb.h:1595 when 3 => lockmods : aliased xcb_xkb_sa_lock_mods_t; -- /usr/include/xcb/xkb.h:1596 when 4 => setgroup : aliased xcb_xkb_sa_set_group_t; -- /usr/include/xcb/xkb.h:1597 when 5 => latchgroup : aliased xcb_xkb_sa_latch_group_t; -- /usr/include/xcb/xkb.h:1598 when 6 => lockgroup : aliased xcb_xkb_sa_lock_group_t; -- /usr/include/xcb/xkb.h:1599 when 7 => moveptr : aliased xcb_xkb_sa_move_ptr_t; -- /usr/include/xcb/xkb.h:1600 when 8 => ptrbtn : aliased xcb_xkb_sa_ptr_btn_t; -- /usr/include/xcb/xkb.h:1601 when 9 => lockptrbtn : aliased xcb_xkb_sa_lock_ptr_btn_t; -- /usr/include/xcb/xkb.h:1602 when 10 => setptrdflt : aliased xcb_xkb_sa_set_ptr_dflt_t; -- /usr/include/xcb/xkb.h:1603 when 11 => isolock : aliased xcb_xkb_sa_iso_lock_t; -- /usr/include/xcb/xkb.h:1604 when 12 => c_terminate : aliased xcb_xkb_sa_terminate_t; -- /usr/include/xcb/xkb.h:1605 when 13 => switchscreen : aliased xcb_xkb_sa_switch_screen_t; -- /usr/include/xcb/xkb.h:1606 when 14 => setcontrols : aliased xcb_xkb_sa_set_controls_t; -- /usr/include/xcb/xkb.h:1607 when 15 => lockcontrols : aliased xcb_xkb_sa_lock_controls_t; -- /usr/include/xcb/xkb.h:1608 when 16 => message : aliased xcb_xkb_sa_action_message_t; -- /usr/include/xcb/xkb.h:1609 when 17 => redirect : aliased xcb_xkb_sa_redirect_key_t; -- /usr/include/xcb/xkb.h:1610 when 18 => devbtn : aliased xcb_xkb_sa_device_btn_t; -- /usr/include/xcb/xkb.h:1611 when 19 => lockdevbtn : aliased xcb_xkb_sa_lock_device_btn_t; -- /usr/include/xcb/xkb.h:1612 when 20 => devval : aliased xcb_xkb_sa_device_valuator_t; -- /usr/include/xcb/xkb.h:1613 when others => c_type : aliased Libc.Stdint .uint8_t; -- /usr/include/xcb/xkb.h:1614 end case; end record; pragma Convention (C_Pass_By_Copy, xcb_xkb_action_t); pragma Unchecked_Union (xcb_xkb_action_t); -- /usr/include/xcb/xkb.h:1592 type xcb_xkb_action_iterator_t is record data : access xcb_xkb_action_t; -- /usr/include/xcb/xkb.h:1621 c_rem : aliased int; -- /usr/include/xcb/xkb.h:1622 index : aliased int; -- /usr/include/xcb/xkb.h:1623 end record; pragma Convention (C_Pass_By_Copy, xcb_xkb_action_iterator_t); -- /usr/include/xcb/xkb.h:1620 type xcb_xkb_use_extension_cookie_t is record sequence : aliased unsigned; -- /usr/include/xcb/xkb.h:1630 end record; pragma Convention (C_Pass_By_Copy, xcb_xkb_use_extension_cookie_t); -- /usr/include/xcb/xkb.h:1629 type xcb_xkb_use_extension_request_t is record major_opcode : aliased Libc.Stdint .uint8_t; -- /usr/include/xcb/xkb.h:1640 minor_opcode : aliased Libc.Stdint .uint8_t; -- /usr/include/xcb/xkb.h:1641 length : aliased Libc.Stdint.uint16_t; -- /usr/include/xcb/xkb.h:1642 wantedMajor : aliased Libc.Stdint .uint16_t; -- /usr/include/xcb/xkb.h:1643 wantedMinor : aliased Libc.Stdint .uint16_t; -- /usr/include/xcb/xkb.h:1644 end record; pragma Convention (C_Pass_By_Copy, xcb_xkb_use_extension_request_t); -- /usr/include/xcb/xkb.h:1639 type xcb_xkb_use_extension_reply_t_pad0_array is array (0 .. 19) of aliased Libc.Stdint.uint8_t; type xcb_xkb_use_extension_reply_t is record response_type : aliased Libc.Stdint .uint8_t; -- /usr/include/xcb/xkb.h:1651 supported : aliased Libc.Stdint.uint8_t; -- /usr/include/xcb/xkb.h:1652 sequence : aliased Libc.Stdint.uint16_t; -- /usr/include/xcb/xkb.h:1653 length : aliased Libc.Stdint.uint32_t; -- /usr/include/xcb/xkb.h:1654 serverMajor : aliased Libc.Stdint .uint16_t; -- /usr/include/xcb/xkb.h:1655 serverMinor : aliased Libc.Stdint .uint16_t; -- /usr/include/xcb/xkb.h:1656 pad0 : aliased xcb_xkb_use_extension_reply_t_pad0_array; -- /usr/include/xcb/xkb.h:1657 end record; pragma Convention (C_Pass_By_Copy, xcb_xkb_use_extension_reply_t); -- /usr/include/xcb/xkb.h:1650 type xcb_xkb_select_events_details_t is record affectNewKeyboard : aliased Libc.Stdint .uint16_t; -- /usr/include/xcb/xkb.h:1664 newKeyboardDetails : aliased Libc.Stdint .uint16_t; -- /usr/include/xcb/xkb.h:1665 affectState : aliased Libc.Stdint .uint16_t; -- /usr/include/xcb/xkb.h:1666 stateDetails : aliased Libc.Stdint .uint16_t; -- /usr/include/xcb/xkb.h:1667 affectCtrls : aliased Libc.Stdint .uint32_t; -- /usr/include/xcb/xkb.h:1668 ctrlDetails : aliased Libc.Stdint .uint32_t; -- /usr/include/xcb/xkb.h:1669 affectIndicatorState : aliased Libc.Stdint .uint32_t; -- /usr/include/xcb/xkb.h:1670 indicatorStateDetails : aliased Libc.Stdint .uint32_t; -- /usr/include/xcb/xkb.h:1671 affectIndicatorMap : aliased Libc.Stdint .uint32_t; -- /usr/include/xcb/xkb.h:1672 indicatorMapDetails : aliased Libc.Stdint .uint32_t; -- /usr/include/xcb/xkb.h:1673 affectNames : aliased Libc.Stdint .uint16_t; -- /usr/include/xcb/xkb.h:1674 namesDetails : aliased Libc.Stdint .uint16_t; -- /usr/include/xcb/xkb.h:1675 affectCompat : aliased Libc.Stdint .uint8_t; -- /usr/include/xcb/xkb.h:1676 compatDetails : aliased Libc.Stdint .uint8_t; -- /usr/include/xcb/xkb.h:1677 affectBell : aliased Libc.Stdint.uint8_t; -- /usr/include/xcb/xkb.h:1678 bellDetails : aliased Libc.Stdint .uint8_t; -- /usr/include/xcb/xkb.h:1679 affectMsgDetails : aliased Libc.Stdint .uint8_t; -- /usr/include/xcb/xkb.h:1680 msgDetails : aliased Libc.Stdint.uint8_t; -- /usr/include/xcb/xkb.h:1681 affectAccessX : aliased Libc.Stdint .uint16_t; -- /usr/include/xcb/xkb.h:1682 accessXDetails : aliased Libc.Stdint .uint16_t; -- /usr/include/xcb/xkb.h:1683 affectExtDev : aliased Libc.Stdint .uint16_t; -- /usr/include/xcb/xkb.h:1684 extdevDetails : aliased Libc.Stdint .uint16_t; -- /usr/include/xcb/xkb.h:1685 end record; pragma Convention (C_Pass_By_Copy, xcb_xkb_select_events_details_t); -- /usr/include/xcb/xkb.h:1663 type xcb_xkb_select_events_request_t is record major_opcode : aliased Libc.Stdint .uint8_t; -- /usr/include/xcb/xkb.h:1695 minor_opcode : aliased Libc.Stdint .uint8_t; -- /usr/include/xcb/xkb.h:1696 length : aliased Libc.Stdint.uint16_t; -- /usr/include/xcb/xkb.h:1697 deviceSpec : aliased xcb_xkb_device_spec_t; -- /usr/include/xcb/xkb.h:1698 affectWhich : aliased Libc.Stdint .uint16_t; -- /usr/include/xcb/xkb.h:1699 clear : aliased Libc.Stdint.uint16_t; -- /usr/include/xcb/xkb.h:1700 selectAll : aliased Libc.Stdint.uint16_t; -- /usr/include/xcb/xkb.h:1701 affectMap : aliased Libc.Stdint.uint16_t; -- /usr/include/xcb/xkb.h:1702 map : aliased Libc.Stdint.uint16_t; -- /usr/include/xcb/xkb.h:1703 end record; pragma Convention (C_Pass_By_Copy, xcb_xkb_select_events_request_t); -- /usr/include/xcb/xkb.h:1694 type xcb_xkb_bell_request_t_pad1_array is array (0 .. 1) of aliased Libc.Stdint.uint8_t; type xcb_xkb_bell_request_t is record major_opcode : aliased Libc.Stdint .uint8_t; -- /usr/include/xcb/xkb.h:1713 minor_opcode : aliased Libc.Stdint .uint8_t; -- /usr/include/xcb/xkb.h:1714 length : aliased Libc.Stdint.uint16_t; -- /usr/include/xcb/xkb.h:1715 deviceSpec : aliased xcb_xkb_device_spec_t; -- /usr/include/xcb/xkb.h:1716 bellClass : aliased xcb_xkb_bell_class_spec_t; -- /usr/include/xcb/xkb.h:1717 bellID : aliased xcb_xkb_id_spec_t; -- /usr/include/xcb/xkb.h:1718 percent : aliased Libc.Stdint.int8_t; -- /usr/include/xcb/xkb.h:1719 forceSound : aliased Libc.Stdint.uint8_t; -- /usr/include/xcb/xkb.h:1720 eventOnly : aliased Libc.Stdint.uint8_t; -- /usr/include/xcb/xkb.h:1721 pad0 : aliased Libc.Stdint.uint8_t; -- /usr/include/xcb/xkb.h:1722 pitch : aliased Libc.Stdint.int16_t; -- /usr/include/xcb/xkb.h:1723 duration : aliased Libc.Stdint.int16_t; -- /usr/include/xcb/xkb.h:1724 pad1 : aliased xcb_xkb_bell_request_t_pad1_array; -- /usr/include/xcb/xkb.h:1725 name : aliased XCB.XProto.xcb_atom_t; -- /usr/include/xcb/xkb.h:1726 window : aliased XCB.XProto.xcb_window_t; -- /usr/include/xcb/xkb.h:1727 end record; pragma Convention (C_Pass_By_Copy, xcb_xkb_bell_request_t); -- /usr/include/xcb/xkb.h:1712 type xcb_xkb_get_state_cookie_t is record sequence : aliased unsigned; -- /usr/include/xcb/xkb.h:1734 end record; pragma Convention (C_Pass_By_Copy, xcb_xkb_get_state_cookie_t); -- /usr/include/xcb/xkb.h:1733 type xcb_xkb_get_state_request_t_pad0_array is array (0 .. 1) of aliased Libc.Stdint.uint8_t; type xcb_xkb_get_state_request_t is record major_opcode : aliased Libc.Stdint .uint8_t; -- /usr/include/xcb/xkb.h:1744 minor_opcode : aliased Libc.Stdint .uint8_t; -- /usr/include/xcb/xkb.h:1745 length : aliased Libc.Stdint.uint16_t; -- /usr/include/xcb/xkb.h:1746 deviceSpec : aliased xcb_xkb_device_spec_t; -- /usr/include/xcb/xkb.h:1747 pad0 : aliased xcb_xkb_get_state_request_t_pad0_array; -- /usr/include/xcb/xkb.h:1748 end record; pragma Convention (C_Pass_By_Copy, xcb_xkb_get_state_request_t); -- /usr/include/xcb/xkb.h:1743 type xcb_xkb_get_state_reply_t_pad1_array is array (0 .. 5) of aliased Libc.Stdint.uint8_t; type xcb_xkb_get_state_reply_t is record response_type : aliased Libc.Stdint .uint8_t; -- /usr/include/xcb/xkb.h:1755 deviceID : aliased Libc.Stdint.uint8_t; -- /usr/include/xcb/xkb.h:1756 sequence : aliased Libc.Stdint.uint16_t; -- /usr/include/xcb/xkb.h:1757 length : aliased Libc.Stdint.uint32_t; -- /usr/include/xcb/xkb.h:1758 mods : aliased Libc.Stdint.uint8_t; -- /usr/include/xcb/xkb.h:1759 baseMods : aliased Libc.Stdint.uint8_t; -- /usr/include/xcb/xkb.h:1760 latchedMods : aliased Libc.Stdint .uint8_t; -- /usr/include/xcb/xkb.h:1761 lockedMods : aliased Libc.Stdint.uint8_t; -- /usr/include/xcb/xkb.h:1762 group : aliased Libc.Stdint.uint8_t; -- /usr/include/xcb/xkb.h:1763 lockedGroup : aliased Libc.Stdint .uint8_t; -- /usr/include/xcb/xkb.h:1764 baseGroup : aliased Libc.Stdint.int16_t; -- /usr/include/xcb/xkb.h:1765 latchedGroup : aliased Libc.Stdint .int16_t; -- /usr/include/xcb/xkb.h:1766 compatState : aliased Libc.Stdint .uint8_t; -- /usr/include/xcb/xkb.h:1767 grabMods : aliased Libc.Stdint.uint8_t; -- /usr/include/xcb/xkb.h:1768 compatGrabMods : aliased Libc.Stdint .uint8_t; -- /usr/include/xcb/xkb.h:1769 lookupMods : aliased Libc.Stdint.uint8_t; -- /usr/include/xcb/xkb.h:1770 compatLookupMods : aliased Libc.Stdint .uint8_t; -- /usr/include/xcb/xkb.h:1771 pad0 : aliased Libc.Stdint.uint8_t; -- /usr/include/xcb/xkb.h:1772 ptrBtnState : aliased Libc.Stdint .uint16_t; -- /usr/include/xcb/xkb.h:1773 pad1 : aliased xcb_xkb_get_state_reply_t_pad1_array; -- /usr/include/xcb/xkb.h:1774 end record; pragma Convention (C_Pass_By_Copy, xcb_xkb_get_state_reply_t); -- /usr/include/xcb/xkb.h:1754 type xcb_xkb_latch_lock_state_request_t is record major_opcode : aliased Libc.Stdint .uint8_t; -- /usr/include/xcb/xkb.h:1784 minor_opcode : aliased Libc.Stdint .uint8_t; -- /usr/include/xcb/xkb.h:1785 length : aliased Libc.Stdint.uint16_t; -- /usr/include/xcb/xkb.h:1786 deviceSpec : aliased xcb_xkb_device_spec_t; -- /usr/include/xcb/xkb.h:1787 affectModLocks : aliased Libc.Stdint .uint8_t; -- /usr/include/xcb/xkb.h:1788 modLocks : aliased Libc.Stdint.uint8_t; -- /usr/include/xcb/xkb.h:1789 lockGroup : aliased Libc.Stdint.uint8_t; -- /usr/include/xcb/xkb.h:1790 groupLock : aliased Libc.Stdint.uint8_t; -- /usr/include/xcb/xkb.h:1791 affectModLatches : aliased Libc.Stdint .uint8_t; -- /usr/include/xcb/xkb.h:1792 pad0 : aliased Libc.Stdint.uint8_t; -- /usr/include/xcb/xkb.h:1793 latchGroup : aliased Libc.Stdint.uint8_t; -- /usr/include/xcb/xkb.h:1794 groupLatch : aliased Libc.Stdint .uint16_t; -- /usr/include/xcb/xkb.h:1795 end record; pragma Convention (C_Pass_By_Copy, xcb_xkb_latch_lock_state_request_t); -- /usr/include/xcb/xkb.h:1783 type xcb_xkb_get_controls_cookie_t is record sequence : aliased unsigned; -- /usr/include/xcb/xkb.h:1802 end record; pragma Convention (C_Pass_By_Copy, xcb_xkb_get_controls_cookie_t); -- /usr/include/xcb/xkb.h:1801 type xcb_xkb_get_controls_request_t_pad0_array is array (0 .. 1) of aliased Libc.Stdint.uint8_t; type xcb_xkb_get_controls_request_t is record major_opcode : aliased Libc.Stdint .uint8_t; -- /usr/include/xcb/xkb.h:1812 minor_opcode : aliased Libc.Stdint .uint8_t; -- /usr/include/xcb/xkb.h:1813 length : aliased Libc.Stdint.uint16_t; -- /usr/include/xcb/xkb.h:1814 deviceSpec : aliased xcb_xkb_device_spec_t; -- /usr/include/xcb/xkb.h:1815 pad0 : aliased xcb_xkb_get_controls_request_t_pad0_array; -- /usr/include/xcb/xkb.h:1816 end record; pragma Convention (C_Pass_By_Copy, xcb_xkb_get_controls_request_t); -- /usr/include/xcb/xkb.h:1811 type xcb_xkb_get_controls_reply_t_pad1_array is array (0 .. 1) of aliased Libc.Stdint.uint8_t; type xcb_xkb_get_controls_reply_t_perKeyRepeat_array is array (0 .. 31) of aliased Libc.Stdint.uint8_t; type xcb_xkb_get_controls_reply_t is record response_type : aliased Libc.Stdint .uint8_t; -- /usr/include/xcb/xkb.h:1823 deviceID : aliased Libc.Stdint.uint8_t; -- /usr/include/xcb/xkb.h:1824 sequence : aliased Libc.Stdint.uint16_t; -- /usr/include/xcb/xkb.h:1825 length : aliased Libc.Stdint.uint32_t; -- /usr/include/xcb/xkb.h:1826 mouseKeysDfltBtn : aliased Libc.Stdint .uint8_t; -- /usr/include/xcb/xkb.h:1827 numGroups : aliased Libc.Stdint.uint8_t; -- /usr/include/xcb/xkb.h:1828 groupsWrap : aliased Libc.Stdint.uint8_t; -- /usr/include/xcb/xkb.h:1829 internalModsMask : aliased Libc.Stdint .uint8_t; -- /usr/include/xcb/xkb.h:1830 ignoreLockModsMask : aliased Libc.Stdint .uint8_t; -- /usr/include/xcb/xkb.h:1831 internalModsRealMods : aliased Libc.Stdint .uint8_t; -- /usr/include/xcb/xkb.h:1832 ignoreLockModsRealMods : aliased Libc.Stdint .uint8_t; -- /usr/include/xcb/xkb.h:1833 pad0 : aliased Libc.Stdint.uint8_t; -- /usr/include/xcb/xkb.h:1834 internalModsVmods : aliased Libc.Stdint .uint16_t; -- /usr/include/xcb/xkb.h:1835 ignoreLockModsVmods : aliased Libc.Stdint .uint16_t; -- /usr/include/xcb/xkb.h:1836 repeatDelay : aliased Libc.Stdint .uint16_t; -- /usr/include/xcb/xkb.h:1837 repeatInterval : aliased Libc.Stdint .uint16_t; -- /usr/include/xcb/xkb.h:1838 slowKeysDelay : aliased Libc.Stdint .uint16_t; -- /usr/include/xcb/xkb.h:1839 debounceDelay : aliased Libc.Stdint .uint16_t; -- /usr/include/xcb/xkb.h:1840 mouseKeysDelay : aliased Libc.Stdint .uint16_t; -- /usr/include/xcb/xkb.h:1841 mouseKeysInterval : aliased Libc.Stdint .uint16_t; -- /usr/include/xcb/xkb.h:1842 mouseKeysTimeToMax : aliased Libc.Stdint .uint16_t; -- /usr/include/xcb/xkb.h:1843 mouseKeysMaxSpeed : aliased Libc.Stdint .uint16_t; -- /usr/include/xcb/xkb.h:1844 mouseKeysCurve : aliased Libc.Stdint .int16_t; -- /usr/include/xcb/xkb.h:1845 accessXOption : aliased Libc.Stdint .uint16_t; -- /usr/include/xcb/xkb.h:1846 accessXTimeout : aliased Libc.Stdint .uint16_t; -- /usr/include/xcb/xkb.h:1847 accessXTimeoutOptionsMask : aliased Libc.Stdint .uint16_t; -- /usr/include/xcb/xkb.h:1848 accessXTimeoutOptionsValues : aliased Libc.Stdint .uint16_t; -- /usr/include/xcb/xkb.h:1849 pad1 : aliased xcb_xkb_get_controls_reply_t_pad1_array; -- /usr/include/xcb/xkb.h:1850 accessXTimeoutMask : aliased Libc.Stdint .uint32_t; -- /usr/include/xcb/xkb.h:1851 accessXTimeoutValues : aliased Libc.Stdint .uint32_t; -- /usr/include/xcb/xkb.h:1852 enabledControls : aliased Libc.Stdint .uint32_t; -- /usr/include/xcb/xkb.h:1853 perKeyRepeat : aliased xcb_xkb_get_controls_reply_t_perKeyRepeat_array; -- /usr/include/xcb/xkb.h:1854 end record; pragma Convention (C_Pass_By_Copy, xcb_xkb_get_controls_reply_t); -- /usr/include/xcb/xkb.h:1822 type xcb_xkb_set_controls_request_t_pad0_array is array (0 .. 1) of aliased Libc.Stdint.uint8_t; type xcb_xkb_set_controls_request_t_perKeyRepeat_array is array (0 .. 31) of aliased Libc.Stdint.uint8_t; type xcb_xkb_set_controls_request_t is record major_opcode : aliased Libc.Stdint .uint8_t; -- /usr/include/xcb/xkb.h:1864 minor_opcode : aliased Libc.Stdint .uint8_t; -- /usr/include/xcb/xkb.h:1865 length : aliased Libc.Stdint.uint16_t; -- /usr/include/xcb/xkb.h:1866 deviceSpec : aliased xcb_xkb_device_spec_t; -- /usr/include/xcb/xkb.h:1867 affectInternalRealMods : aliased Libc.Stdint .uint8_t; -- /usr/include/xcb/xkb.h:1868 internalRealMods : aliased Libc.Stdint .uint8_t; -- /usr/include/xcb/xkb.h:1869 affectIgnoreLockRealMods : aliased Libc.Stdint .uint8_t; -- /usr/include/xcb/xkb.h:1870 ignoreLockRealMods : aliased Libc.Stdint .uint8_t; -- /usr/include/xcb/xkb.h:1871 affectInternalVirtualMods : aliased Libc.Stdint .uint16_t; -- /usr/include/xcb/xkb.h:1872 internalVirtualMods : aliased Libc.Stdint .uint16_t; -- /usr/include/xcb/xkb.h:1873 affectIgnoreLockVirtualMods : aliased Libc.Stdint .uint16_t; -- /usr/include/xcb/xkb.h:1874 ignoreLockVirtualMods : aliased Libc.Stdint .uint16_t; -- /usr/include/xcb/xkb.h:1875 mouseKeysDfltBtn : aliased Libc.Stdint .uint8_t; -- /usr/include/xcb/xkb.h:1876 groupsWrap : aliased Libc.Stdint.uint8_t; -- /usr/include/xcb/xkb.h:1877 accessXOptions : aliased Libc.Stdint .uint16_t; -- /usr/include/xcb/xkb.h:1878 pad0 : aliased xcb_xkb_set_controls_request_t_pad0_array; -- /usr/include/xcb/xkb.h:1879 affectEnabledControls : aliased Libc.Stdint .uint32_t; -- /usr/include/xcb/xkb.h:1880 enabledControls : aliased Libc.Stdint .uint32_t; -- /usr/include/xcb/xkb.h:1881 changeControls : aliased Libc.Stdint .uint32_t; -- /usr/include/xcb/xkb.h:1882 repeatDelay : aliased Libc.Stdint .uint16_t; -- /usr/include/xcb/xkb.h:1883 repeatInterval : aliased Libc.Stdint .uint16_t; -- /usr/include/xcb/xkb.h:1884 slowKeysDelay : aliased Libc.Stdint .uint16_t; -- /usr/include/xcb/xkb.h:1885 debounceDelay : aliased Libc.Stdint .uint16_t; -- /usr/include/xcb/xkb.h:1886 mouseKeysDelay : aliased Libc.Stdint .uint16_t; -- /usr/include/xcb/xkb.h:1887 mouseKeysInterval : aliased Libc.Stdint .uint16_t; -- /usr/include/xcb/xkb.h:1888 mouseKeysTimeToMax : aliased Libc.Stdint .uint16_t; -- /usr/include/xcb/xkb.h:1889 mouseKeysMaxSpeed : aliased Libc.Stdint .uint16_t; -- /usr/include/xcb/xkb.h:1890 mouseKeysCurve : aliased Libc.Stdint .int16_t; -- /usr/include/xcb/xkb.h:1891 accessXTimeout : aliased Libc.Stdint .uint16_t; -- /usr/include/xcb/xkb.h:1892 accessXTimeoutMask : aliased Libc.Stdint .uint32_t; -- /usr/include/xcb/xkb.h:1893 accessXTimeoutValues : aliased Libc.Stdint .uint32_t; -- /usr/include/xcb/xkb.h:1894 accessXTimeoutOptionsMask : aliased Libc.Stdint .uint16_t; -- /usr/include/xcb/xkb.h:1895 accessXTimeoutOptionsValues : aliased Libc.Stdint .uint16_t; -- /usr/include/xcb/xkb.h:1896 perKeyRepeat : aliased xcb_xkb_set_controls_request_t_perKeyRepeat_array; -- /usr/include/xcb/xkb.h:1897 end record; pragma Convention (C_Pass_By_Copy, xcb_xkb_set_controls_request_t); -- /usr/include/xcb/xkb.h:1863 type xcb_xkb_get_map_cookie_t is record sequence : aliased unsigned; -- /usr/include/xcb/xkb.h:1904 end record; pragma Convention (C_Pass_By_Copy, xcb_xkb_get_map_cookie_t); -- /usr/include/xcb/xkb.h:1903 type xcb_xkb_get_map_request_t_pad0_array is array (0 .. 1) of aliased Libc.Stdint.uint8_t; type xcb_xkb_get_map_request_t is record major_opcode : aliased Libc.Stdint .uint8_t; -- /usr/include/xcb/xkb.h:1914 minor_opcode : aliased Libc.Stdint .uint8_t; -- /usr/include/xcb/xkb.h:1915 length : aliased Libc.Stdint.uint16_t; -- /usr/include/xcb/xkb.h:1916 deviceSpec : aliased xcb_xkb_device_spec_t; -- /usr/include/xcb/xkb.h:1917 full : aliased Libc.Stdint.uint16_t; -- /usr/include/xcb/xkb.h:1918 partial : aliased Libc.Stdint.uint16_t; -- /usr/include/xcb/xkb.h:1919 firstType : aliased Libc.Stdint.uint8_t; -- /usr/include/xcb/xkb.h:1920 nTypes : aliased Libc.Stdint.uint8_t; -- /usr/include/xcb/xkb.h:1921 firstKeySym : aliased XCB.XProto .xcb_keycode_t; -- /usr/include/xcb/xkb.h:1922 nKeySyms : aliased Libc.Stdint.uint8_t; -- /usr/include/xcb/xkb.h:1923 firstKeyAction : aliased XCB.XProto .xcb_keycode_t; -- /usr/include/xcb/xkb.h:1924 nKeyActions : aliased Libc.Stdint .uint8_t; -- /usr/include/xcb/xkb.h:1925 firstKeyBehavior : aliased XCB.XProto .xcb_keycode_t; -- /usr/include/xcb/xkb.h:1926 nKeyBehaviors : aliased Libc.Stdint .uint8_t; -- /usr/include/xcb/xkb.h:1927 virtualMods : aliased Libc.Stdint .uint16_t; -- /usr/include/xcb/xkb.h:1928 firstKeyExplicit : aliased XCB.XProto .xcb_keycode_t; -- /usr/include/xcb/xkb.h:1929 nKeyExplicit : aliased Libc.Stdint .uint8_t; -- /usr/include/xcb/xkb.h:1930 firstModMapKey : aliased XCB.XProto .xcb_keycode_t; -- /usr/include/xcb/xkb.h:1931 nModMapKeys : aliased Libc.Stdint .uint8_t; -- /usr/include/xcb/xkb.h:1932 firstVModMapKey : aliased XCB.XProto .xcb_keycode_t; -- /usr/include/xcb/xkb.h:1933 nVModMapKeys : aliased Libc.Stdint .uint8_t; -- /usr/include/xcb/xkb.h:1934 pad0 : aliased xcb_xkb_get_map_request_t_pad0_array; -- /usr/include/xcb/xkb.h:1935 end record; pragma Convention (C_Pass_By_Copy, xcb_xkb_get_map_request_t); -- /usr/include/xcb/xkb.h:1913 type xcb_xkb_get_map_map_t is record types_rtrn : access xcb_xkb_key_type_t; -- /usr/include/xcb/xkb.h:1942 syms_rtrn : access xcb_xkb_key_sym_map_t; -- /usr/include/xcb/xkb.h:1943 acts_rtrn_count : access Libc.Stdint .uint8_t; -- /usr/include/xcb/xkb.h:1944 alignment_pad : access Libc.Stdint .uint8_t; -- /usr/include/xcb/xkb.h:1945 acts_rtrn_acts : access xcb_xkb_action_t; -- /usr/include/xcb/xkb.h:1946 behaviors_rtrn : access xcb_xkb_set_behavior_t; -- /usr/include/xcb/xkb.h:1947 vmods_rtrn : access Libc.Stdint.uint8_t; -- /usr/include/xcb/xkb.h:1948 alignment_pad2 : access Libc.Stdint .uint8_t; -- /usr/include/xcb/xkb.h:1949 explicit_rtrn : access xcb_xkb_set_explicit_t; -- /usr/include/xcb/xkb.h:1950 alignment_pad3 : access Libc.Stdint .uint16_t; -- /usr/include/xcb/xkb.h:1951 modmap_rtrn : access xcb_xkb_key_mod_map_t; -- /usr/include/xcb/xkb.h:1952 alignment_pad4 : access Libc.Stdint .uint16_t; -- /usr/include/xcb/xkb.h:1953 vmodmap_rtrn : access xcb_xkb_key_v_mod_map_t; -- /usr/include/xcb/xkb.h:1954 end record; pragma Convention (C_Pass_By_Copy, xcb_xkb_get_map_map_t); -- /usr/include/xcb/xkb.h:1941 type xcb_xkb_get_map_reply_t_pad0_array is array (0 .. 1) of aliased Libc.Stdint.uint8_t; type xcb_xkb_get_map_reply_t is record response_type : aliased Libc.Stdint .uint8_t; -- /usr/include/xcb/xkb.h:1961 deviceID : aliased Libc.Stdint.uint8_t; -- /usr/include/xcb/xkb.h:1962 sequence : aliased Libc.Stdint.uint16_t; -- /usr/include/xcb/xkb.h:1963 length : aliased Libc.Stdint.uint32_t; -- /usr/include/xcb/xkb.h:1964 pad0 : aliased xcb_xkb_get_map_reply_t_pad0_array; -- /usr/include/xcb/xkb.h:1965 minKeyCode : aliased XCB.XProto .xcb_keycode_t; -- /usr/include/xcb/xkb.h:1966 maxKeyCode : aliased XCB.XProto .xcb_keycode_t; -- /usr/include/xcb/xkb.h:1967 present : aliased Libc.Stdint.uint16_t; -- /usr/include/xcb/xkb.h:1968 firstType : aliased Libc.Stdint.uint8_t; -- /usr/include/xcb/xkb.h:1969 nTypes : aliased Libc.Stdint.uint8_t; -- /usr/include/xcb/xkb.h:1970 totalTypes : aliased Libc.Stdint.uint8_t; -- /usr/include/xcb/xkb.h:1971 firstKeySym : aliased XCB.XProto .xcb_keycode_t; -- /usr/include/xcb/xkb.h:1972 totalSyms : aliased Libc.Stdint.uint16_t; -- /usr/include/xcb/xkb.h:1973 nKeySyms : aliased Libc.Stdint.uint8_t; -- /usr/include/xcb/xkb.h:1974 firstKeyAction : aliased XCB.XProto .xcb_keycode_t; -- /usr/include/xcb/xkb.h:1975 totalActions : aliased Libc.Stdint .uint16_t; -- /usr/include/xcb/xkb.h:1976 nKeyActions : aliased Libc.Stdint .uint8_t; -- /usr/include/xcb/xkb.h:1977 firstKeyBehavior : aliased XCB.XProto .xcb_keycode_t; -- /usr/include/xcb/xkb.h:1978 nKeyBehaviors : aliased Libc.Stdint .uint8_t; -- /usr/include/xcb/xkb.h:1979 totalKeyBehaviors : aliased Libc.Stdint .uint8_t; -- /usr/include/xcb/xkb.h:1980 firstKeyExplicit : aliased XCB.XProto .xcb_keycode_t; -- /usr/include/xcb/xkb.h:1981 nKeyExplicit : aliased Libc.Stdint .uint8_t; -- /usr/include/xcb/xkb.h:1982 totalKeyExplicit : aliased Libc.Stdint .uint8_t; -- /usr/include/xcb/xkb.h:1983 firstModMapKey : aliased XCB.XProto .xcb_keycode_t; -- /usr/include/xcb/xkb.h:1984 nModMapKeys : aliased Libc.Stdint .uint8_t; -- /usr/include/xcb/xkb.h:1985 totalModMapKeys : aliased Libc.Stdint .uint8_t; -- /usr/include/xcb/xkb.h:1986 firstVModMapKey : aliased XCB.XProto .xcb_keycode_t; -- /usr/include/xcb/xkb.h:1987 nVModMapKeys : aliased Libc.Stdint .uint8_t; -- /usr/include/xcb/xkb.h:1988 totalVModMapKeys : aliased Libc.Stdint .uint8_t; -- /usr/include/xcb/xkb.h:1989 pad1 : aliased Libc.Stdint.uint8_t; -- /usr/include/xcb/xkb.h:1990 virtualMods : aliased Libc.Stdint .uint16_t; -- /usr/include/xcb/xkb.h:1991 end record; pragma Convention (C_Pass_By_Copy, xcb_xkb_get_map_reply_t); -- /usr/include/xcb/xkb.h:1960 type xcb_xkb_set_map_values_t is record types : access xcb_xkb_set_key_type_t; -- /usr/include/xcb/xkb.h:1998 syms : access xcb_xkb_key_sym_map_t; -- /usr/include/xcb/xkb.h:1999 actionsCount : access Libc.Stdint .uint8_t; -- /usr/include/xcb/xkb.h:2000 actions : access xcb_xkb_action_t; -- /usr/include/xcb/xkb.h:2001 behaviors : access xcb_xkb_set_behavior_t; -- /usr/include/xcb/xkb.h:2002 vmods : access Libc.Stdint.uint8_t; -- /usr/include/xcb/xkb.h:2003 modmap : access xcb_xkb_key_mod_map_t; -- /usr/include/xcb/xkb.h:2005 vmodmap : access xcb_xkb_key_v_mod_map_t; -- /usr/include/xcb/xkb.h:2006 end record; pragma Convention (C_Pass_By_Copy, xcb_xkb_set_map_values_t); -- /usr/include/xcb/xkb.h:1997 type xcb_xkb_set_map_request_t is record major_opcode : aliased Libc.Stdint .uint8_t; -- /usr/include/xcb/xkb.h:2016 minor_opcode : aliased Libc.Stdint .uint8_t; -- /usr/include/xcb/xkb.h:2017 length : aliased Libc.Stdint.uint16_t; -- /usr/include/xcb/xkb.h:2018 deviceSpec : aliased xcb_xkb_device_spec_t; -- /usr/include/xcb/xkb.h:2019 present : aliased Libc.Stdint.uint16_t; -- /usr/include/xcb/xkb.h:2020 flags : aliased Libc.Stdint.uint16_t; -- /usr/include/xcb/xkb.h:2021 minKeyCode : aliased XCB.XProto .xcb_keycode_t; -- /usr/include/xcb/xkb.h:2022 maxKeyCode : aliased XCB.XProto .xcb_keycode_t; -- /usr/include/xcb/xkb.h:2023 firstType : aliased Libc.Stdint.uint8_t; -- /usr/include/xcb/xkb.h:2024 nTypes : aliased Libc.Stdint.uint8_t; -- /usr/include/xcb/xkb.h:2025 firstKeySym : aliased XCB.XProto .xcb_keycode_t; -- /usr/include/xcb/xkb.h:2026 nKeySyms : aliased Libc.Stdint.uint8_t; -- /usr/include/xcb/xkb.h:2027 totalSyms : aliased Libc.Stdint.uint16_t; -- /usr/include/xcb/xkb.h:2028 firstKeyAction : aliased XCB.XProto .xcb_keycode_t; -- /usr/include/xcb/xkb.h:2029 nKeyActions : aliased Libc.Stdint .uint8_t; -- /usr/include/xcb/xkb.h:2030 totalActions : aliased Libc.Stdint .uint16_t; -- /usr/include/xcb/xkb.h:2031 firstKeyBehavior : aliased XCB.XProto .xcb_keycode_t; -- /usr/include/xcb/xkb.h:2032 nKeyBehaviors : aliased Libc.Stdint .uint8_t; -- /usr/include/xcb/xkb.h:2033 totalKeyBehaviors : aliased Libc.Stdint .uint8_t; -- /usr/include/xcb/xkb.h:2034 firstKeyExplicit : aliased XCB.XProto .xcb_keycode_t; -- /usr/include/xcb/xkb.h:2035 nKeyExplicit : aliased Libc.Stdint .uint8_t; -- /usr/include/xcb/xkb.h:2036 totalKeyExplicit : aliased Libc.Stdint .uint8_t; -- /usr/include/xcb/xkb.h:2037 firstModMapKey : aliased XCB.XProto .xcb_keycode_t; -- /usr/include/xcb/xkb.h:2038 nModMapKeys : aliased Libc.Stdint .uint8_t; -- /usr/include/xcb/xkb.h:2039 totalModMapKeys : aliased Libc.Stdint .uint8_t; -- /usr/include/xcb/xkb.h:2040 firstVModMapKey : aliased XCB.XProto .xcb_keycode_t; -- /usr/include/xcb/xkb.h:2041 nVModMapKeys : aliased Libc.Stdint .uint8_t; -- /usr/include/xcb/xkb.h:2042 totalVModMapKeys : aliased Libc.Stdint .uint8_t; -- /usr/include/xcb/xkb.h:2043 virtualMods : aliased Libc.Stdint .uint16_t; -- /usr/include/xcb/xkb.h:2044 end record; pragma Convention (C_Pass_By_Copy, xcb_xkb_set_map_request_t); -- /usr/include/xcb/xkb.h:2015 type xcb_xkb_get_compat_map_cookie_t is record sequence : aliased unsigned; -- /usr/include/xcb/xkb.h:2051 end record; pragma Convention (C_Pass_By_Copy, xcb_xkb_get_compat_map_cookie_t); -- /usr/include/xcb/xkb.h:2050 type xcb_xkb_get_compat_map_request_t is record major_opcode : aliased Libc.Stdint .uint8_t; -- /usr/include/xcb/xkb.h:2061 minor_opcode : aliased Libc.Stdint .uint8_t; -- /usr/include/xcb/xkb.h:2062 length : aliased Libc.Stdint.uint16_t; -- /usr/include/xcb/xkb.h:2063 deviceSpec : aliased xcb_xkb_device_spec_t; -- /usr/include/xcb/xkb.h:2064 groups : aliased Libc.Stdint.uint8_t; -- /usr/include/xcb/xkb.h:2065 getAllSI : aliased Libc.Stdint.uint8_t; -- /usr/include/xcb/xkb.h:2066 firstSI : aliased Libc.Stdint.uint16_t; -- /usr/include/xcb/xkb.h:2067 nSI : aliased Libc.Stdint.uint16_t; -- /usr/include/xcb/xkb.h:2068 end record; pragma Convention (C_Pass_By_Copy, xcb_xkb_get_compat_map_request_t); -- /usr/include/xcb/xkb.h:2060 type xcb_xkb_get_compat_map_reply_t_pad1_array is array (0 .. 15) of aliased Libc.Stdint.uint8_t; type xcb_xkb_get_compat_map_reply_t is record response_type : aliased Libc.Stdint .uint8_t; -- /usr/include/xcb/xkb.h:2075 deviceID : aliased Libc.Stdint.uint8_t; -- /usr/include/xcb/xkb.h:2076 sequence : aliased Libc.Stdint.uint16_t; -- /usr/include/xcb/xkb.h:2077 length : aliased Libc.Stdint.uint32_t; -- /usr/include/xcb/xkb.h:2078 groupsRtrn : aliased Libc.Stdint.uint8_t; -- /usr/include/xcb/xkb.h:2079 pad0 : aliased Libc.Stdint.uint8_t; -- /usr/include/xcb/xkb.h:2080 firstSIRtrn : aliased Libc.Stdint .uint16_t; -- /usr/include/xcb/xkb.h:2081 nSIRtrn : aliased Libc.Stdint.uint16_t; -- /usr/include/xcb/xkb.h:2082 nTotalSI : aliased Libc.Stdint.uint16_t; -- /usr/include/xcb/xkb.h:2083 pad1 : aliased xcb_xkb_get_compat_map_reply_t_pad1_array; -- /usr/include/xcb/xkb.h:2084 end record; pragma Convention (C_Pass_By_Copy, xcb_xkb_get_compat_map_reply_t); -- /usr/include/xcb/xkb.h:2074 type xcb_xkb_set_compat_map_request_t_pad1_array is array (0 .. 1) of aliased Libc.Stdint.uint8_t; type xcb_xkb_set_compat_map_request_t is record major_opcode : aliased Libc.Stdint .uint8_t; -- /usr/include/xcb/xkb.h:2094 minor_opcode : aliased Libc.Stdint .uint8_t; -- /usr/include/xcb/xkb.h:2095 length : aliased Libc.Stdint.uint16_t; -- /usr/include/xcb/xkb.h:2096 deviceSpec : aliased xcb_xkb_device_spec_t; -- /usr/include/xcb/xkb.h:2097 pad0 : aliased Libc.Stdint.uint8_t; -- /usr/include/xcb/xkb.h:2098 recomputeActions : aliased Libc.Stdint .uint8_t; -- /usr/include/xcb/xkb.h:2099 truncateSI : aliased Libc.Stdint.uint8_t; -- /usr/include/xcb/xkb.h:2100 groups : aliased Libc.Stdint.uint8_t; -- /usr/include/xcb/xkb.h:2101 firstSI : aliased Libc.Stdint.uint16_t; -- /usr/include/xcb/xkb.h:2102 nSI : aliased Libc.Stdint.uint16_t; -- /usr/include/xcb/xkb.h:2103 pad1 : aliased xcb_xkb_set_compat_map_request_t_pad1_array; -- /usr/include/xcb/xkb.h:2104 end record; pragma Convention (C_Pass_By_Copy, xcb_xkb_set_compat_map_request_t); -- /usr/include/xcb/xkb.h:2093 type xcb_xkb_get_indicator_state_cookie_t is record sequence : aliased unsigned; -- /usr/include/xcb/xkb.h:2111 end record; pragma Convention (C_Pass_By_Copy, xcb_xkb_get_indicator_state_cookie_t); -- /usr/include/xcb/xkb.h:2110 type xcb_xkb_get_indicator_state_request_t_pad0_array is array (0 .. 1) of aliased Libc.Stdint.uint8_t; type xcb_xkb_get_indicator_state_request_t is record major_opcode : aliased Libc.Stdint .uint8_t; -- /usr/include/xcb/xkb.h:2121 minor_opcode : aliased Libc.Stdint .uint8_t; -- /usr/include/xcb/xkb.h:2122 length : aliased Libc.Stdint.uint16_t; -- /usr/include/xcb/xkb.h:2123 deviceSpec : aliased xcb_xkb_device_spec_t; -- /usr/include/xcb/xkb.h:2124 pad0 : aliased xcb_xkb_get_indicator_state_request_t_pad0_array; -- /usr/include/xcb/xkb.h:2125 end record; pragma Convention (C_Pass_By_Copy, xcb_xkb_get_indicator_state_request_t); -- /usr/include/xcb/xkb.h:2120 type xcb_xkb_get_indicator_state_reply_t_pad0_array is array (0 .. 19) of aliased Libc.Stdint.uint8_t; type xcb_xkb_get_indicator_state_reply_t is record response_type : aliased Libc.Stdint .uint8_t; -- /usr/include/xcb/xkb.h:2132 deviceID : aliased Libc.Stdint.uint8_t; -- /usr/include/xcb/xkb.h:2133 sequence : aliased Libc.Stdint.uint16_t; -- /usr/include/xcb/xkb.h:2134 length : aliased Libc.Stdint.uint32_t; -- /usr/include/xcb/xkb.h:2135 state : aliased Libc.Stdint.uint32_t; -- /usr/include/xcb/xkb.h:2136 pad0 : aliased xcb_xkb_get_indicator_state_reply_t_pad0_array; -- /usr/include/xcb/xkb.h:2137 end record; pragma Convention (C_Pass_By_Copy, xcb_xkb_get_indicator_state_reply_t); -- /usr/include/xcb/xkb.h:2131 type xcb_xkb_get_indicator_map_cookie_t is record sequence : aliased unsigned; -- /usr/include/xcb/xkb.h:2144 end record; pragma Convention (C_Pass_By_Copy, xcb_xkb_get_indicator_map_cookie_t); -- /usr/include/xcb/xkb.h:2143 type xcb_xkb_get_indicator_map_request_t_pad0_array is array (0 .. 1) of aliased Libc.Stdint.uint8_t; type xcb_xkb_get_indicator_map_request_t is record major_opcode : aliased Libc.Stdint .uint8_t; -- /usr/include/xcb/xkb.h:2154 minor_opcode : aliased Libc.Stdint .uint8_t; -- /usr/include/xcb/xkb.h:2155 length : aliased Libc.Stdint.uint16_t; -- /usr/include/xcb/xkb.h:2156 deviceSpec : aliased xcb_xkb_device_spec_t; -- /usr/include/xcb/xkb.h:2157 pad0 : aliased xcb_xkb_get_indicator_map_request_t_pad0_array; -- /usr/include/xcb/xkb.h:2158 which : aliased Libc.Stdint.uint32_t; -- /usr/include/xcb/xkb.h:2159 end record; pragma Convention (C_Pass_By_Copy, xcb_xkb_get_indicator_map_request_t); -- /usr/include/xcb/xkb.h:2153 type xcb_xkb_get_indicator_map_reply_t_pad0_array is array (0 .. 14) of aliased Libc.Stdint.uint8_t; type xcb_xkb_get_indicator_map_reply_t is record response_type : aliased Libc.Stdint .uint8_t; -- /usr/include/xcb/xkb.h:2166 deviceID : aliased Libc.Stdint.uint8_t; -- /usr/include/xcb/xkb.h:2167 sequence : aliased Libc.Stdint.uint16_t; -- /usr/include/xcb/xkb.h:2168 length : aliased Libc.Stdint.uint32_t; -- /usr/include/xcb/xkb.h:2169 which : aliased Libc.Stdint.uint32_t; -- /usr/include/xcb/xkb.h:2170 realIndicators : aliased Libc.Stdint .uint32_t; -- /usr/include/xcb/xkb.h:2171 nIndicators : aliased Libc.Stdint .uint8_t; -- /usr/include/xcb/xkb.h:2172 pad0 : aliased xcb_xkb_get_indicator_map_reply_t_pad0_array; -- /usr/include/xcb/xkb.h:2173 end record; pragma Convention (C_Pass_By_Copy, xcb_xkb_get_indicator_map_reply_t); -- /usr/include/xcb/xkb.h:2165 type xcb_xkb_set_indicator_map_request_t_pad0_array is array (0 .. 1) of aliased Libc.Stdint.uint8_t; type xcb_xkb_set_indicator_map_request_t is record major_opcode : aliased Libc.Stdint .uint8_t; -- /usr/include/xcb/xkb.h:2183 minor_opcode : aliased Libc.Stdint .uint8_t; -- /usr/include/xcb/xkb.h:2184 length : aliased Libc.Stdint.uint16_t; -- /usr/include/xcb/xkb.h:2185 deviceSpec : aliased xcb_xkb_device_spec_t; -- /usr/include/xcb/xkb.h:2186 pad0 : aliased xcb_xkb_set_indicator_map_request_t_pad0_array; -- /usr/include/xcb/xkb.h:2187 which : aliased Libc.Stdint.uint32_t; -- /usr/include/xcb/xkb.h:2188 end record; pragma Convention (C_Pass_By_Copy, xcb_xkb_set_indicator_map_request_t); -- /usr/include/xcb/xkb.h:2182 type xcb_xkb_get_named_indicator_cookie_t is record sequence : aliased unsigned; -- /usr/include/xcb/xkb.h:2195 end record; pragma Convention (C_Pass_By_Copy, xcb_xkb_get_named_indicator_cookie_t); -- /usr/include/xcb/xkb.h:2194 type xcb_xkb_get_named_indicator_request_t_pad0_array is array (0 .. 1) of aliased Libc.Stdint.uint8_t; type xcb_xkb_get_named_indicator_request_t is record major_opcode : aliased Libc.Stdint .uint8_t; -- /usr/include/xcb/xkb.h:2205 minor_opcode : aliased Libc.Stdint .uint8_t; -- /usr/include/xcb/xkb.h:2206 length : aliased Libc.Stdint.uint16_t; -- /usr/include/xcb/xkb.h:2207 deviceSpec : aliased xcb_xkb_device_spec_t; -- /usr/include/xcb/xkb.h:2208 ledClass : aliased xcb_xkb_led_class_spec_t; -- /usr/include/xcb/xkb.h:2209 ledID : aliased xcb_xkb_id_spec_t; -- /usr/include/xcb/xkb.h:2210 pad0 : aliased xcb_xkb_get_named_indicator_request_t_pad0_array; -- /usr/include/xcb/xkb.h:2211 indicator : aliased XCB.XProto .xcb_atom_t; -- /usr/include/xcb/xkb.h:2212 end record; pragma Convention (C_Pass_By_Copy, xcb_xkb_get_named_indicator_request_t); -- /usr/include/xcb/xkb.h:2204 type xcb_xkb_get_named_indicator_reply_t_pad0_array is array (0 .. 2) of aliased Libc.Stdint.uint8_t; type xcb_xkb_get_named_indicator_reply_t is record response_type : aliased Libc.Stdint .uint8_t; -- /usr/include/xcb/xkb.h:2219 deviceID : aliased Libc.Stdint.uint8_t; -- /usr/include/xcb/xkb.h:2220 sequence : aliased Libc.Stdint.uint16_t; -- /usr/include/xcb/xkb.h:2221 length : aliased Libc.Stdint.uint32_t; -- /usr/include/xcb/xkb.h:2222 indicator : aliased XCB.XProto .xcb_atom_t; -- /usr/include/xcb/xkb.h:2223 found : aliased Libc.Stdint.uint8_t; -- /usr/include/xcb/xkb.h:2224 on : aliased Libc.Stdint.uint8_t; -- /usr/include/xcb/xkb.h:2225 realIndicator : aliased Libc.Stdint .uint8_t; -- /usr/include/xcb/xkb.h:2226 ndx : aliased Libc.Stdint.uint8_t; -- /usr/include/xcb/xkb.h:2227 map_flags : aliased Libc.Stdint.uint8_t; -- /usr/include/xcb/xkb.h:2228 map_whichGroups : aliased Libc.Stdint .uint8_t; -- /usr/include/xcb/xkb.h:2229 map_groups : aliased Libc.Stdint.uint8_t; -- /usr/include/xcb/xkb.h:2230 map_whichMods : aliased Libc.Stdint .uint8_t; -- /usr/include/xcb/xkb.h:2231 map_mods : aliased Libc.Stdint.uint8_t; -- /usr/include/xcb/xkb.h:2232 map_realMods : aliased Libc.Stdint .uint8_t; -- /usr/include/xcb/xkb.h:2233 map_vmod : aliased Libc.Stdint.uint16_t; -- /usr/include/xcb/xkb.h:2234 map_ctrls : aliased Libc.Stdint.uint32_t; -- /usr/include/xcb/xkb.h:2235 supported : aliased Libc.Stdint.uint8_t; -- /usr/include/xcb/xkb.h:2236 pad0 : aliased xcb_xkb_get_named_indicator_reply_t_pad0_array; -- /usr/include/xcb/xkb.h:2237 end record; pragma Convention (C_Pass_By_Copy, xcb_xkb_get_named_indicator_reply_t); -- /usr/include/xcb/xkb.h:2218 type xcb_xkb_set_named_indicator_request_t_pad0_array is array (0 .. 1) of aliased Libc.Stdint.uint8_t; type xcb_xkb_set_named_indicator_request_t is record major_opcode : aliased Libc.Stdint .uint8_t; -- /usr/include/xcb/xkb.h:2247 minor_opcode : aliased Libc.Stdint .uint8_t; -- /usr/include/xcb/xkb.h:2248 length : aliased Libc.Stdint.uint16_t; -- /usr/include/xcb/xkb.h:2249 deviceSpec : aliased xcb_xkb_device_spec_t; -- /usr/include/xcb/xkb.h:2250 ledClass : aliased xcb_xkb_led_class_spec_t; -- /usr/include/xcb/xkb.h:2251 ledID : aliased xcb_xkb_id_spec_t; -- /usr/include/xcb/xkb.h:2252 pad0 : aliased xcb_xkb_set_named_indicator_request_t_pad0_array; -- /usr/include/xcb/xkb.h:2253 indicator : aliased XCB.XProto .xcb_atom_t; -- /usr/include/xcb/xkb.h:2254 setState : aliased Libc.Stdint.uint8_t; -- /usr/include/xcb/xkb.h:2255 on : aliased Libc.Stdint.uint8_t; -- /usr/include/xcb/xkb.h:2256 setMap : aliased Libc.Stdint.uint8_t; -- /usr/include/xcb/xkb.h:2257 createMap : aliased Libc.Stdint.uint8_t; -- /usr/include/xcb/xkb.h:2258 pad1 : aliased Libc.Stdint.uint8_t; -- /usr/include/xcb/xkb.h:2259 map_flags : aliased Libc.Stdint.uint8_t; -- /usr/include/xcb/xkb.h:2260 map_whichGroups : aliased Libc.Stdint .uint8_t; -- /usr/include/xcb/xkb.h:2261 map_groups : aliased Libc.Stdint.uint8_t; -- /usr/include/xcb/xkb.h:2262 map_whichMods : aliased Libc.Stdint .uint8_t; -- /usr/include/xcb/xkb.h:2263 map_realMods : aliased Libc.Stdint .uint8_t; -- /usr/include/xcb/xkb.h:2264 map_vmods : aliased Libc.Stdint.uint16_t; -- /usr/include/xcb/xkb.h:2265 map_ctrls : aliased Libc.Stdint.uint32_t; -- /usr/include/xcb/xkb.h:2266 end record; pragma Convention (C_Pass_By_Copy, xcb_xkb_set_named_indicator_request_t); -- /usr/include/xcb/xkb.h:2246 type xcb_xkb_get_names_cookie_t is record sequence : aliased unsigned; -- /usr/include/xcb/xkb.h:2273 end record; pragma Convention (C_Pass_By_Copy, xcb_xkb_get_names_cookie_t); -- /usr/include/xcb/xkb.h:2272 type xcb_xkb_get_names_request_t_pad0_array is array (0 .. 1) of aliased Libc.Stdint.uint8_t; type xcb_xkb_get_names_request_t is record major_opcode : aliased Libc.Stdint .uint8_t; -- /usr/include/xcb/xkb.h:2283 minor_opcode : aliased Libc.Stdint .uint8_t; -- /usr/include/xcb/xkb.h:2284 length : aliased Libc.Stdint.uint16_t; -- /usr/include/xcb/xkb.h:2285 deviceSpec : aliased xcb_xkb_device_spec_t; -- /usr/include/xcb/xkb.h:2286 pad0 : aliased xcb_xkb_get_names_request_t_pad0_array; -- /usr/include/xcb/xkb.h:2287 which : aliased Libc.Stdint.uint32_t; -- /usr/include/xcb/xkb.h:2288 end record; pragma Convention (C_Pass_By_Copy, xcb_xkb_get_names_request_t); -- /usr/include/xcb/xkb.h:2282 type xcb_xkb_get_names_value_list_t is record keycodesName : aliased XCB.XProto .xcb_atom_t; -- /usr/include/xcb/xkb.h:2295 geometryName : aliased XCB.XProto .xcb_atom_t; -- /usr/include/xcb/xkb.h:2296 symbolsName : aliased XCB.XProto .xcb_atom_t; -- /usr/include/xcb/xkb.h:2297 physSymbolsName : aliased XCB.XProto .xcb_atom_t; -- /usr/include/xcb/xkb.h:2298 typesName : aliased XCB.XProto .xcb_atom_t; -- /usr/include/xcb/xkb.h:2299 compatName : aliased XCB.XProto .xcb_atom_t; -- /usr/include/xcb/xkb.h:2300 typeNames : access XCB.XProto.xcb_atom_t; -- /usr/include/xcb/xkb.h:2301 nLevelsPerType : access Libc.Stdint .uint8_t; -- /usr/include/xcb/xkb.h:2302 alignment_pad : access Libc.Stdint .uint8_t; -- /usr/include/xcb/xkb.h:2303 ktLevelNames : access XCB.XProto .xcb_atom_t; -- /usr/include/xcb/xkb.h:2304 indicatorNames : access XCB.XProto .xcb_atom_t; -- /usr/include/xcb/xkb.h:2305 virtualModNames : access XCB.XProto .xcb_atom_t; -- /usr/include/xcb/xkb.h:2306 groups : access XCB.XProto.xcb_atom_t; -- /usr/include/xcb/xkb.h:2307 keyNames : access xcb_xkb_key_name_t; -- /usr/include/xcb/xkb.h:2308 keyAliases : access xcb_xkb_key_alias_t; -- /usr/include/xcb/xkb.h:2309 radioGroupNames : access XCB.XProto .xcb_atom_t; -- /usr/include/xcb/xkb.h:2310 end record; pragma Convention (C_Pass_By_Copy, xcb_xkb_get_names_value_list_t); -- /usr/include/xcb/xkb.h:2294 type xcb_xkb_get_names_reply_t_pad0_array is array (0 .. 3) of aliased Libc.Stdint.uint8_t; type xcb_xkb_get_names_reply_t is record response_type : aliased Libc.Stdint .uint8_t; -- /usr/include/xcb/xkb.h:2317 deviceID : aliased Libc.Stdint.uint8_t; -- /usr/include/xcb/xkb.h:2318 sequence : aliased Libc.Stdint.uint16_t; -- /usr/include/xcb/xkb.h:2319 length : aliased Libc.Stdint.uint32_t; -- /usr/include/xcb/xkb.h:2320 which : aliased Libc.Stdint.uint32_t; -- /usr/include/xcb/xkb.h:2321 minKeyCode : aliased XCB.XProto .xcb_keycode_t; -- /usr/include/xcb/xkb.h:2322 maxKeyCode : aliased XCB.XProto .xcb_keycode_t; -- /usr/include/xcb/xkb.h:2323 nTypes : aliased Libc.Stdint.uint8_t; -- /usr/include/xcb/xkb.h:2324 groupNames : aliased Libc.Stdint.uint8_t; -- /usr/include/xcb/xkb.h:2325 virtualMods : aliased Libc.Stdint .uint16_t; -- /usr/include/xcb/xkb.h:2326 firstKey : aliased XCB.XProto .xcb_keycode_t; -- /usr/include/xcb/xkb.h:2327 nKeys : aliased Libc.Stdint.uint8_t; -- /usr/include/xcb/xkb.h:2328 indicators : aliased Libc.Stdint .uint32_t; -- /usr/include/xcb/xkb.h:2329 nRadioGroups : aliased Libc.Stdint .uint8_t; -- /usr/include/xcb/xkb.h:2330 nKeyAliases : aliased Libc.Stdint .uint8_t; -- /usr/include/xcb/xkb.h:2331 nKTLevels : aliased Libc.Stdint.uint16_t; -- /usr/include/xcb/xkb.h:2332 pad0 : aliased xcb_xkb_get_names_reply_t_pad0_array; -- /usr/include/xcb/xkb.h:2333 end record; pragma Convention (C_Pass_By_Copy, xcb_xkb_get_names_reply_t); -- /usr/include/xcb/xkb.h:2316 type xcb_xkb_set_names_values_t is record keycodesName : aliased XCB.XProto .xcb_atom_t; -- /usr/include/xcb/xkb.h:2340 geometryName : aliased XCB.XProto .xcb_atom_t; -- /usr/include/xcb/xkb.h:2341 symbolsName : aliased XCB.XProto .xcb_atom_t; -- /usr/include/xcb/xkb.h:2342 physSymbolsName : aliased XCB.XProto .xcb_atom_t; -- /usr/include/xcb/xkb.h:2343 typesName : aliased XCB.XProto .xcb_atom_t; -- /usr/include/xcb/xkb.h:2344 compatName : aliased XCB.XProto .xcb_atom_t; -- /usr/include/xcb/xkb.h:2345 typeNames : access XCB.XProto.xcb_atom_t; -- /usr/include/xcb/xkb.h:2346 nLevelsPerType : access Libc.Stdint .uint8_t; -- /usr/include/xcb/xkb.h:2347 ktLevelNames : access XCB.XProto .xcb_atom_t; -- /usr/include/xcb/xkb.h:2348 indicatorNames : access XCB.XProto .xcb_atom_t; -- /usr/include/xcb/xkb.h:2349 virtualModNames : access XCB.XProto .xcb_atom_t; -- /usr/include/xcb/xkb.h:2350 groups : access XCB.XProto.xcb_atom_t; -- /usr/include/xcb/xkb.h:2351 keyNames : access xcb_xkb_key_name_t; -- /usr/include/xcb/xkb.h:2352 keyAliases : access xcb_xkb_key_alias_t; -- /usr/include/xcb/xkb.h:2353 radioGroupNames : access XCB.XProto .xcb_atom_t; -- /usr/include/xcb/xkb.h:2354 end record; pragma Convention (C_Pass_By_Copy, xcb_xkb_set_names_values_t); -- /usr/include/xcb/xkb.h:2339 type xcb_xkb_set_names_request_t is record major_opcode : aliased Libc.Stdint .uint8_t; -- /usr/include/xcb/xkb.h:2364 minor_opcode : aliased Libc.Stdint .uint8_t; -- /usr/include/xcb/xkb.h:2365 length : aliased Libc.Stdint.uint16_t; -- /usr/include/xcb/xkb.h:2366 deviceSpec : aliased xcb_xkb_device_spec_t; -- /usr/include/xcb/xkb.h:2367 virtualMods : aliased Libc.Stdint .uint16_t; -- /usr/include/xcb/xkb.h:2368 which : aliased Libc.Stdint.uint32_t; -- /usr/include/xcb/xkb.h:2369 firstType : aliased Libc.Stdint.uint8_t; -- /usr/include/xcb/xkb.h:2370 nTypes : aliased Libc.Stdint.uint8_t; -- /usr/include/xcb/xkb.h:2371 firstKTLevelt : aliased Libc.Stdint .uint8_t; -- /usr/include/xcb/xkb.h:2372 nKTLevels : aliased Libc.Stdint.uint8_t; -- /usr/include/xcb/xkb.h:2373 indicators : aliased Libc.Stdint .uint32_t; -- /usr/include/xcb/xkb.h:2374 groupNames : aliased Libc.Stdint.uint8_t; -- /usr/include/xcb/xkb.h:2375 nRadioGroups : aliased Libc.Stdint .uint8_t; -- /usr/include/xcb/xkb.h:2376 firstKey : aliased XCB.XProto .xcb_keycode_t; -- /usr/include/xcb/xkb.h:2377 nKeys : aliased Libc.Stdint.uint8_t; -- /usr/include/xcb/xkb.h:2378 nKeyAliases : aliased Libc.Stdint .uint8_t; -- /usr/include/xcb/xkb.h:2379 pad0 : aliased Libc.Stdint.uint8_t; -- /usr/include/xcb/xkb.h:2380 totalKTLevelNames : aliased Libc.Stdint .uint16_t; -- /usr/include/xcb/xkb.h:2381 end record; pragma Convention (C_Pass_By_Copy, xcb_xkb_set_names_request_t); -- /usr/include/xcb/xkb.h:2363 type xcb_xkb_per_client_flags_cookie_t is record sequence : aliased unsigned; -- /usr/include/xcb/xkb.h:2388 end record; pragma Convention (C_Pass_By_Copy, xcb_xkb_per_client_flags_cookie_t); -- /usr/include/xcb/xkb.h:2387 type xcb_xkb_per_client_flags_request_t_pad0_array is array (0 .. 1) of aliased Libc.Stdint.uint8_t; type xcb_xkb_per_client_flags_request_t is record major_opcode : aliased Libc.Stdint .uint8_t; -- /usr/include/xcb/xkb.h:2398 minor_opcode : aliased Libc.Stdint .uint8_t; -- /usr/include/xcb/xkb.h:2399 length : aliased Libc.Stdint.uint16_t; -- /usr/include/xcb/xkb.h:2400 deviceSpec : aliased xcb_xkb_device_spec_t; -- /usr/include/xcb/xkb.h:2401 pad0 : aliased xcb_xkb_per_client_flags_request_t_pad0_array; -- /usr/include/xcb/xkb.h:2402 change : aliased Libc.Stdint.uint32_t; -- /usr/include/xcb/xkb.h:2403 value : aliased Libc.Stdint.uint32_t; -- /usr/include/xcb/xkb.h:2404 ctrlsToChange : aliased Libc.Stdint .uint32_t; -- /usr/include/xcb/xkb.h:2405 autoCtrls : aliased Libc.Stdint.uint32_t; -- /usr/include/xcb/xkb.h:2406 autoCtrlsValues : aliased Libc.Stdint .uint32_t; -- /usr/include/xcb/xkb.h:2407 end record; pragma Convention (C_Pass_By_Copy, xcb_xkb_per_client_flags_request_t); -- /usr/include/xcb/xkb.h:2397 type xcb_xkb_per_client_flags_reply_t_pad0_array is array (0 .. 7) of aliased Libc.Stdint.uint8_t; type xcb_xkb_per_client_flags_reply_t is record response_type : aliased Libc.Stdint .uint8_t; -- /usr/include/xcb/xkb.h:2414 deviceID : aliased Libc.Stdint.uint8_t; -- /usr/include/xcb/xkb.h:2415 sequence : aliased Libc.Stdint.uint16_t; -- /usr/include/xcb/xkb.h:2416 length : aliased Libc.Stdint.uint32_t; -- /usr/include/xcb/xkb.h:2417 supported : aliased Libc.Stdint.uint32_t; -- /usr/include/xcb/xkb.h:2418 value : aliased Libc.Stdint.uint32_t; -- /usr/include/xcb/xkb.h:2419 autoCtrls : aliased Libc.Stdint.uint32_t; -- /usr/include/xcb/xkb.h:2420 autoCtrlsValues : aliased Libc.Stdint .uint32_t; -- /usr/include/xcb/xkb.h:2421 pad0 : aliased xcb_xkb_per_client_flags_reply_t_pad0_array; -- /usr/include/xcb/xkb.h:2422 end record; pragma Convention (C_Pass_By_Copy, xcb_xkb_per_client_flags_reply_t); -- /usr/include/xcb/xkb.h:2413 type xcb_xkb_list_components_cookie_t is record sequence : aliased unsigned; -- /usr/include/xcb/xkb.h:2429 end record; pragma Convention (C_Pass_By_Copy, xcb_xkb_list_components_cookie_t); -- /usr/include/xcb/xkb.h:2428 type xcb_xkb_list_components_request_t is record major_opcode : aliased Libc.Stdint .uint8_t; -- /usr/include/xcb/xkb.h:2439 minor_opcode : aliased Libc.Stdint .uint8_t; -- /usr/include/xcb/xkb.h:2440 length : aliased Libc.Stdint.uint16_t; -- /usr/include/xcb/xkb.h:2441 deviceSpec : aliased xcb_xkb_device_spec_t; -- /usr/include/xcb/xkb.h:2442 maxNames : aliased Libc.Stdint.uint16_t; -- /usr/include/xcb/xkb.h:2443 end record; pragma Convention (C_Pass_By_Copy, xcb_xkb_list_components_request_t); -- /usr/include/xcb/xkb.h:2438 type xcb_xkb_list_components_reply_t_pad0_array is array (0 .. 9) of aliased Libc.Stdint.uint8_t; type xcb_xkb_list_components_reply_t is record response_type : aliased Libc.Stdint .uint8_t; -- /usr/include/xcb/xkb.h:2450 deviceID : aliased Libc.Stdint.uint8_t; -- /usr/include/xcb/xkb.h:2451 sequence : aliased Libc.Stdint.uint16_t; -- /usr/include/xcb/xkb.h:2452 length : aliased Libc.Stdint.uint32_t; -- /usr/include/xcb/xkb.h:2453 nKeymaps : aliased Libc.Stdint.uint16_t; -- /usr/include/xcb/xkb.h:2454 nKeycodes : aliased Libc.Stdint.uint16_t; -- /usr/include/xcb/xkb.h:2455 nTypes : aliased Libc.Stdint.uint16_t; -- /usr/include/xcb/xkb.h:2456 nCompatMaps : aliased Libc.Stdint .uint16_t; -- /usr/include/xcb/xkb.h:2457 nSymbols : aliased Libc.Stdint.uint16_t; -- /usr/include/xcb/xkb.h:2458 nGeometries : aliased Libc.Stdint .uint16_t; -- /usr/include/xcb/xkb.h:2459 extra : aliased Libc.Stdint.uint16_t; -- /usr/include/xcb/xkb.h:2460 pad0 : aliased xcb_xkb_list_components_reply_t_pad0_array; -- /usr/include/xcb/xkb.h:2461 end record; pragma Convention (C_Pass_By_Copy, xcb_xkb_list_components_reply_t); -- /usr/include/xcb/xkb.h:2449 type xcb_xkb_get_kbd_by_name_cookie_t is record sequence : aliased unsigned; -- /usr/include/xcb/xkb.h:2468 end record; pragma Convention (C_Pass_By_Copy, xcb_xkb_get_kbd_by_name_cookie_t); -- /usr/include/xcb/xkb.h:2467 type xcb_xkb_get_kbd_by_name_request_t is record major_opcode : aliased Libc.Stdint .uint8_t; -- /usr/include/xcb/xkb.h:2478 minor_opcode : aliased Libc.Stdint .uint8_t; -- /usr/include/xcb/xkb.h:2479 length : aliased Libc.Stdint.uint16_t; -- /usr/include/xcb/xkb.h:2480 deviceSpec : aliased xcb_xkb_device_spec_t; -- /usr/include/xcb/xkb.h:2481 need : aliased Libc.Stdint.uint16_t; -- /usr/include/xcb/xkb.h:2482 want : aliased Libc.Stdint.uint16_t; -- /usr/include/xcb/xkb.h:2483 load : aliased Libc.Stdint.uint8_t; -- /usr/include/xcb/xkb.h:2484 pad0 : aliased Libc.Stdint.uint8_t; -- /usr/include/xcb/xkb.h:2485 end record; pragma Convention (C_Pass_By_Copy, xcb_xkb_get_kbd_by_name_request_t); -- /usr/include/xcb/xkb.h:2477 type xcb_xkb_get_kbd_by_name_replies_types_map_t is record types_rtrn : access xcb_xkb_key_type_t; -- /usr/include/xcb/xkb.h:2492 syms_rtrn : access xcb_xkb_key_sym_map_t; -- /usr/include/xcb/xkb.h:2493 acts_rtrn_count : access Libc.Stdint .uint8_t; -- /usr/include/xcb/xkb.h:2494 acts_rtrn_acts : access xcb_xkb_action_t; -- /usr/include/xcb/xkb.h:2495 behaviors_rtrn : access xcb_xkb_set_behavior_t; -- /usr/include/xcb/xkb.h:2496 vmods_rtrn : access Libc.Stdint.uint8_t; -- /usr/include/xcb/xkb.h:2497 explicit_rtrn : access xcb_xkb_set_explicit_t; -- /usr/include/xcb/xkb.h:2498 modmap_rtrn : access xcb_xkb_key_mod_map_t; -- /usr/include/xcb/xkb.h:2499 vmodmap_rtrn : access xcb_xkb_key_v_mod_map_t; -- /usr/include/xcb/xkb.h:2500 end record; pragma Convention (C_Pass_By_Copy, xcb_xkb_get_kbd_by_name_replies_types_map_t); -- /usr/include/xcb/xkb.h:2491 type xcb_xkb_get_kbd_by_name_replies_key_names_value_list_t is record keycodesName : aliased XCB.XProto .xcb_atom_t; -- /usr/include/xcb/xkb.h:2507 geometryName : aliased XCB.XProto .xcb_atom_t; -- /usr/include/xcb/xkb.h:2508 symbolsName : aliased XCB.XProto .xcb_atom_t; -- /usr/include/xcb/xkb.h:2509 physSymbolsName : aliased XCB.XProto .xcb_atom_t; -- /usr/include/xcb/xkb.h:2510 typesName : aliased XCB.XProto .xcb_atom_t; -- /usr/include/xcb/xkb.h:2511 compatName : aliased XCB.XProto .xcb_atom_t; -- /usr/include/xcb/xkb.h:2512 typeNames : access XCB.XProto.xcb_atom_t; -- /usr/include/xcb/xkb.h:2513 nLevelsPerType : access Libc.Stdint .uint8_t; -- /usr/include/xcb/xkb.h:2514 ktLevelNames : access XCB.XProto .xcb_atom_t; -- /usr/include/xcb/xkb.h:2515 indicatorNames : access XCB.XProto .xcb_atom_t; -- /usr/include/xcb/xkb.h:2516 virtualModNames : access XCB.XProto .xcb_atom_t; -- /usr/include/xcb/xkb.h:2517 groups : access XCB.XProto.xcb_atom_t; -- /usr/include/xcb/xkb.h:2518 keyNames : access xcb_xkb_key_name_t; -- /usr/include/xcb/xkb.h:2519 keyAliases : access xcb_xkb_key_alias_t; -- /usr/include/xcb/xkb.h:2520 radioGroupNames : access XCB.XProto .xcb_atom_t; -- /usr/include/xcb/xkb.h:2521 end record; pragma Convention (C_Pass_By_Copy, xcb_xkb_get_kbd_by_name_replies_key_names_value_list_t); -- /usr/include/xcb/xkb.h:2506 type xcb_xkb_get_kbd_by_name_replies_t; type xcb_xkb_get_kbd_by_name_replies_t_pad0_array is array (0 .. 1) of aliased Libc.Stdint.uint8_t; type u_types is record getmap_type : aliased Libc.Stdint .uint8_t; -- /usr/include/xcb/xkb.h:2529 typeDeviceID : aliased Libc.Stdint .uint8_t; -- /usr/include/xcb/xkb.h:2530 getmap_sequence : aliased Libc.Stdint .uint16_t; -- /usr/include/xcb/xkb.h:2531 getmap_length : aliased Libc.Stdint .uint32_t; -- /usr/include/xcb/xkb.h:2532 pad0 : aliased xcb_xkb_get_kbd_by_name_replies_t_pad0_array; -- /usr/include/xcb/xkb.h:2533 typeMinKeyCode : aliased XCB.XProto .xcb_keycode_t; -- /usr/include/xcb/xkb.h:2534 typeMaxKeyCode : aliased XCB.XProto .xcb_keycode_t; -- /usr/include/xcb/xkb.h:2535 present : aliased Libc.Stdint.uint16_t; -- /usr/include/xcb/xkb.h:2536 firstType : aliased Libc.Stdint.uint8_t; -- /usr/include/xcb/xkb.h:2537 nTypes : aliased Libc.Stdint.uint8_t; -- /usr/include/xcb/xkb.h:2538 totalTypes : aliased Libc.Stdint.uint8_t; -- /usr/include/xcb/xkb.h:2539 firstKeySym : aliased XCB.XProto .xcb_keycode_t; -- /usr/include/xcb/xkb.h:2540 totalSyms : aliased Libc.Stdint.uint16_t; -- /usr/include/xcb/xkb.h:2541 nKeySyms : aliased Libc.Stdint.uint8_t; -- /usr/include/xcb/xkb.h:2542 firstKeyAction : aliased XCB.XProto .xcb_keycode_t; -- /usr/include/xcb/xkb.h:2543 totalActions : aliased Libc.Stdint .uint16_t; -- /usr/include/xcb/xkb.h:2544 nKeyActions : aliased Libc.Stdint .uint8_t; -- /usr/include/xcb/xkb.h:2545 firstKeyBehavior : aliased XCB.XProto .xcb_keycode_t; -- /usr/include/xcb/xkb.h:2546 nKeyBehaviors : aliased Libc.Stdint .uint8_t; -- /usr/include/xcb/xkb.h:2547 totalKeyBehaviors : aliased Libc.Stdint .uint8_t; -- /usr/include/xcb/xkb.h:2548 firstKeyExplicit : aliased XCB.XProto .xcb_keycode_t; -- /usr/include/xcb/xkb.h:2549 nKeyExplicit : aliased Libc.Stdint .uint8_t; -- /usr/include/xcb/xkb.h:2550 totalKeyExplicit : aliased Libc.Stdint .uint8_t; -- /usr/include/xcb/xkb.h:2551 firstModMapKey : aliased XCB.XProto .xcb_keycode_t; -- /usr/include/xcb/xkb.h:2552 nModMapKeys : aliased Libc.Stdint .uint8_t; -- /usr/include/xcb/xkb.h:2553 totalModMapKeys : aliased Libc.Stdint .uint8_t; -- /usr/include/xcb/xkb.h:2554 firstVModMapKey : aliased XCB.XProto .xcb_keycode_t; -- /usr/include/xcb/xkb.h:2555 nVModMapKeys : aliased Libc.Stdint .uint8_t; -- /usr/include/xcb/xkb.h:2556 totalVModMapKeys : aliased Libc.Stdint .uint8_t; -- /usr/include/xcb/xkb.h:2557 pad1 : aliased Libc.Stdint.uint8_t; -- /usr/include/xcb/xkb.h:2558 virtualMods : aliased Libc.Stdint .uint16_t; -- /usr/include/xcb/xkb.h:2559 map : aliased xcb_xkb_get_kbd_by_name_replies_types_map_t; -- /usr/include/xcb/xkb.h:2560 end record; pragma Convention (C_Pass_By_Copy, u_types); type xcb_xkb_get_kbd_by_name_replies_t_pad1_array is array (0 .. 15) of aliased Libc.Stdint.uint8_t; type u_compat_map is record compatmap_type : aliased Libc.Stdint .uint8_t; -- /usr/include/xcb/xkb.h:2563 compatDeviceID : aliased Libc.Stdint .uint8_t; -- /usr/include/xcb/xkb.h:2564 compatmap_sequence : aliased Libc.Stdint .uint16_t; -- /usr/include/xcb/xkb.h:2565 compatmap_length : aliased Libc.Stdint .uint32_t; -- /usr/include/xcb/xkb.h:2566 groupsRtrn : aliased Libc.Stdint.uint8_t; -- /usr/include/xcb/xkb.h:2567 pad0 : aliased Libc.Stdint.uint8_t; -- /usr/include/xcb/xkb.h:2568 firstSIRtrn : aliased Libc.Stdint .uint16_t; -- /usr/include/xcb/xkb.h:2569 nSIRtrn : aliased Libc.Stdint.uint16_t; -- /usr/include/xcb/xkb.h:2570 nTotalSI : aliased Libc.Stdint.uint16_t; -- /usr/include/xcb/xkb.h:2571 pad1 : aliased xcb_xkb_get_kbd_by_name_replies_t_pad1_array; -- /usr/include/xcb/xkb.h:2572 si_rtrn : access xcb_xkb_sym_interpret_t; -- /usr/include/xcb/xkb.h:2573 group_rtrn : access xcb_xkb_mod_def_t; -- /usr/include/xcb/xkb.h:2574 end record; pragma Convention (C_Pass_By_Copy, u_compat_map); type Xcb_Xkb_Get_Kbd_By_Name_Replies_T_Pad0_Array_1 is array (0 .. 14) of aliased Libc.Stdint.uint8_t; type u_indicator_maps is record indicatormap_type : aliased Libc.Stdint .uint8_t; -- /usr/include/xcb/xkb.h:2577 indicatorDeviceID : aliased Libc.Stdint .uint8_t; -- /usr/include/xcb/xkb.h:2578 indicatormap_sequence : aliased Libc.Stdint .uint16_t; -- /usr/include/xcb/xkb.h:2579 indicatormap_length : aliased Libc.Stdint .uint32_t; -- /usr/include/xcb/xkb.h:2580 which : aliased Libc.Stdint.uint32_t; -- /usr/include/xcb/xkb.h:2581 realIndicators : aliased Libc.Stdint .uint32_t; -- /usr/include/xcb/xkb.h:2582 nIndicators : aliased Libc.Stdint .uint8_t; -- /usr/include/xcb/xkb.h:2583 pad0 : aliased Xcb_Xkb_Get_Kbd_By_Name_Replies_T_Pad0_Array_1; -- /usr/include/xcb/xkb.h:2584 maps : access xcb_xkb_indicator_map_t; -- /usr/include/xcb/xkb.h:2585 end record; pragma Convention (C_Pass_By_Copy, u_indicator_maps); type Xcb_Xkb_Get_Kbd_By_Name_Replies_T_Pad0_Array_2 is array (0 .. 3) of aliased Libc.Stdint.uint8_t; type u_key_names is record keyname_type : aliased Libc.Stdint .uint8_t; -- /usr/include/xcb/xkb.h:2588 keyDeviceID : aliased Libc.Stdint .uint8_t; -- /usr/include/xcb/xkb.h:2589 keyname_sequence : aliased Libc.Stdint .uint16_t; -- /usr/include/xcb/xkb.h:2590 keyname_length : aliased Libc.Stdint .uint32_t; -- /usr/include/xcb/xkb.h:2591 which : aliased Libc.Stdint.uint32_t; -- /usr/include/xcb/xkb.h:2592 keyMinKeyCode : aliased XCB.XProto .xcb_keycode_t; -- /usr/include/xcb/xkb.h:2593 keyMaxKeyCode : aliased XCB.XProto .xcb_keycode_t; -- /usr/include/xcb/xkb.h:2594 nTypes : aliased Libc.Stdint.uint8_t; -- /usr/include/xcb/xkb.h:2595 groupNames : aliased Libc.Stdint.uint8_t; -- /usr/include/xcb/xkb.h:2596 virtualMods : aliased Libc.Stdint .uint16_t; -- /usr/include/xcb/xkb.h:2597 firstKey : aliased XCB.XProto .xcb_keycode_t; -- /usr/include/xcb/xkb.h:2598 nKeys : aliased Libc.Stdint.uint8_t; -- /usr/include/xcb/xkb.h:2599 indicators : aliased Libc.Stdint .uint32_t; -- /usr/include/xcb/xkb.h:2600 nRadioGroups : aliased Libc.Stdint .uint8_t; -- /usr/include/xcb/xkb.h:2601 nKeyAliases : aliased Libc.Stdint .uint8_t; -- /usr/include/xcb/xkb.h:2602 nKTLevels : aliased Libc.Stdint.uint16_t; -- /usr/include/xcb/xkb.h:2603 pad0 : aliased Xcb_Xkb_Get_Kbd_By_Name_Replies_T_Pad0_Array_2; -- /usr/include/xcb/xkb.h:2604 valueList : aliased xcb_xkb_get_kbd_by_name_replies_key_names_value_list_t; -- /usr/include/xcb/xkb.h:2605 end record; pragma Convention (C_Pass_By_Copy, u_key_names); type u_geometry is record geometry_type : aliased Libc.Stdint .uint8_t; -- /usr/include/xcb/xkb.h:2608 geometryDeviceID : aliased Libc.Stdint .uint8_t; -- /usr/include/xcb/xkb.h:2609 geometry_sequence : aliased Libc.Stdint .uint16_t; -- /usr/include/xcb/xkb.h:2610 geometry_length : aliased Libc.Stdint .uint32_t; -- /usr/include/xcb/xkb.h:2611 name : aliased XCB.XProto.xcb_atom_t; -- /usr/include/xcb/xkb.h:2612 geometryFound : aliased Libc.Stdint .uint8_t; -- /usr/include/xcb/xkb.h:2613 pad0 : aliased Libc.Stdint.uint8_t; -- /usr/include/xcb/xkb.h:2614 widthMM : aliased Libc.Stdint.uint16_t; -- /usr/include/xcb/xkb.h:2615 heightMM : aliased Libc.Stdint.uint16_t; -- /usr/include/xcb/xkb.h:2616 nProperties : aliased Libc.Stdint .uint16_t; -- /usr/include/xcb/xkb.h:2617 nColors : aliased Libc.Stdint.uint16_t; -- /usr/include/xcb/xkb.h:2618 nShapes : aliased Libc.Stdint.uint16_t; -- /usr/include/xcb/xkb.h:2619 nSections : aliased Libc.Stdint.uint16_t; -- /usr/include/xcb/xkb.h:2620 nDoodads : aliased Libc.Stdint.uint16_t; -- /usr/include/xcb/xkb.h:2621 nKeyAliases : aliased Libc.Stdint .uint16_t; -- /usr/include/xcb/xkb.h:2622 baseColorNdx : aliased Libc.Stdint .uint8_t; -- /usr/include/xcb/xkb.h:2623 labelColorNdx : aliased Libc.Stdint .uint8_t; -- /usr/include/xcb/xkb.h:2624 labelFont : access xcb_xkb_counted_string_16_t; -- /usr/include/xcb/xkb.h:2625 end record; pragma Convention (C_Pass_By_Copy, u_geometry); type xcb_xkb_get_kbd_by_name_replies_t is record types : aliased u_types; -- /usr/include/xcb/xkb.h:2561 compat_map : aliased u_compat_map; -- /usr/include/xcb/xkb.h:2575 indicator_maps : aliased u_indicator_maps; -- /usr/include/xcb/xkb.h:2586 key_names : aliased u_key_names; -- /usr/include/xcb/xkb.h:2606 geometry : aliased u_geometry; -- /usr/include/xcb/xkb.h:2626 end record; pragma Convention (C_Pass_By_Copy, xcb_xkb_get_kbd_by_name_replies_t); -- /usr/include/xcb/xkb.h:2527 function xcb_xkb_get_kbd_by_name_replies_types_map (R : access xcb_xkb_get_kbd_by_name_replies_t) return access xcb_xkb_get_kbd_by_name_replies_types_map_t; -- /usr/include/xcb/xkb.h:2640 pragma Import (C, xcb_xkb_get_kbd_by_name_replies_types_map, "xcb_xkb_get_kbd_by_name_replies_types_map"); type xcb_xkb_get_kbd_by_name_reply_t_pad0_array is array (0 .. 15) of aliased Libc.Stdint.uint8_t; type xcb_xkb_get_kbd_by_name_reply_t is record response_type : aliased Libc.Stdint .uint8_t; -- /usr/include/xcb/xkb.h:2646 deviceID : aliased Libc.Stdint.uint8_t; -- /usr/include/xcb/xkb.h:2647 sequence : aliased Libc.Stdint.uint16_t; -- /usr/include/xcb/xkb.h:2648 length : aliased Libc.Stdint.uint32_t; -- /usr/include/xcb/xkb.h:2649 minKeyCode : aliased XCB.XProto .xcb_keycode_t; -- /usr/include/xcb/xkb.h:2650 maxKeyCode : aliased XCB.XProto .xcb_keycode_t; -- /usr/include/xcb/xkb.h:2651 loaded : aliased Libc.Stdint.uint8_t; -- /usr/include/xcb/xkb.h:2652 newKeyboard : aliased Libc.Stdint .uint8_t; -- /usr/include/xcb/xkb.h:2653 found : aliased Libc.Stdint.uint16_t; -- /usr/include/xcb/xkb.h:2654 reported : aliased Libc.Stdint.uint16_t; -- /usr/include/xcb/xkb.h:2655 pad0 : aliased xcb_xkb_get_kbd_by_name_reply_t_pad0_array; -- /usr/include/xcb/xkb.h:2656 end record; pragma Convention (C_Pass_By_Copy, xcb_xkb_get_kbd_by_name_reply_t); -- /usr/include/xcb/xkb.h:2645 type xcb_xkb_get_device_info_cookie_t is record sequence : aliased unsigned; -- /usr/include/xcb/xkb.h:2663 end record; pragma Convention (C_Pass_By_Copy, xcb_xkb_get_device_info_cookie_t); -- /usr/include/xcb/xkb.h:2662 type xcb_xkb_get_device_info_request_t is record major_opcode : aliased Libc.Stdint .uint8_t; -- /usr/include/xcb/xkb.h:2673 minor_opcode : aliased Libc.Stdint .uint8_t; -- /usr/include/xcb/xkb.h:2674 length : aliased Libc.Stdint.uint16_t; -- /usr/include/xcb/xkb.h:2675 deviceSpec : aliased xcb_xkb_device_spec_t; -- /usr/include/xcb/xkb.h:2676 wanted : aliased Libc.Stdint.uint16_t; -- /usr/include/xcb/xkb.h:2677 allButtons : aliased Libc.Stdint.uint8_t; -- /usr/include/xcb/xkb.h:2678 firstButton : aliased Libc.Stdint .uint8_t; -- /usr/include/xcb/xkb.h:2679 nButtons : aliased Libc.Stdint.uint8_t; -- /usr/include/xcb/xkb.h:2680 pad0 : aliased Libc.Stdint.uint8_t; -- /usr/include/xcb/xkb.h:2681 ledClass : aliased xcb_xkb_led_class_spec_t; -- /usr/include/xcb/xkb.h:2682 ledID : aliased xcb_xkb_id_spec_t; -- /usr/include/xcb/xkb.h:2683 end record; pragma Convention (C_Pass_By_Copy, xcb_xkb_get_device_info_request_t); -- /usr/include/xcb/xkb.h:2672 type xcb_xkb_get_device_info_reply_t_pad0_array is array (0 .. 1) of aliased Libc.Stdint.uint8_t; type xcb_xkb_get_device_info_reply_t is record response_type : aliased Libc.Stdint .uint8_t; -- /usr/include/xcb/xkb.h:2690 deviceID : aliased Libc.Stdint.uint8_t; -- /usr/include/xcb/xkb.h:2691 sequence : aliased Libc.Stdint.uint16_t; -- /usr/include/xcb/xkb.h:2692 length : aliased Libc.Stdint.uint32_t; -- /usr/include/xcb/xkb.h:2693 present : aliased Libc.Stdint.uint16_t; -- /usr/include/xcb/xkb.h:2694 supported : aliased Libc.Stdint.uint16_t; -- /usr/include/xcb/xkb.h:2695 unsupported : aliased Libc.Stdint .uint16_t; -- /usr/include/xcb/xkb.h:2696 nDeviceLedFBs : aliased Libc.Stdint .uint16_t; -- /usr/include/xcb/xkb.h:2697 firstBtnWanted : aliased Libc.Stdint .uint8_t; -- /usr/include/xcb/xkb.h:2698 nBtnsWanted : aliased Libc.Stdint .uint8_t; -- /usr/include/xcb/xkb.h:2699 firstBtnRtrn : aliased Libc.Stdint .uint8_t; -- /usr/include/xcb/xkb.h:2700 nBtnsRtrn : aliased Libc.Stdint.uint8_t; -- /usr/include/xcb/xkb.h:2701 totalBtns : aliased Libc.Stdint.uint8_t; -- /usr/include/xcb/xkb.h:2702 hasOwnState : aliased Libc.Stdint .uint8_t; -- /usr/include/xcb/xkb.h:2703 dfltKbdFB : aliased Libc.Stdint.uint16_t; -- /usr/include/xcb/xkb.h:2704 dfltLedFB : aliased Libc.Stdint.uint16_t; -- /usr/include/xcb/xkb.h:2705 pad0 : aliased xcb_xkb_get_device_info_reply_t_pad0_array; -- /usr/include/xcb/xkb.h:2706 devType : aliased XCB.XProto.xcb_atom_t; -- /usr/include/xcb/xkb.h:2707 nameLen : aliased Libc.Stdint.uint16_t; -- /usr/include/xcb/xkb.h:2708 end record; pragma Convention (C_Pass_By_Copy, xcb_xkb_get_device_info_reply_t); -- /usr/include/xcb/xkb.h:2689 type xcb_xkb_set_device_info_request_t is record major_opcode : aliased Libc.Stdint .uint8_t; -- /usr/include/xcb/xkb.h:2718 minor_opcode : aliased Libc.Stdint .uint8_t; -- /usr/include/xcb/xkb.h:2719 length : aliased Libc.Stdint.uint16_t; -- /usr/include/xcb/xkb.h:2720 deviceSpec : aliased xcb_xkb_device_spec_t; -- /usr/include/xcb/xkb.h:2721 firstBtn : aliased Libc.Stdint.uint8_t; -- /usr/include/xcb/xkb.h:2722 nBtns : aliased Libc.Stdint.uint8_t; -- /usr/include/xcb/xkb.h:2723 change : aliased Libc.Stdint.uint16_t; -- /usr/include/xcb/xkb.h:2724 nDeviceLedFBs : aliased Libc.Stdint .uint16_t; -- /usr/include/xcb/xkb.h:2725 end record; pragma Convention (C_Pass_By_Copy, xcb_xkb_set_device_info_request_t); -- /usr/include/xcb/xkb.h:2717 type xcb_xkb_set_debugging_flags_cookie_t is record sequence : aliased unsigned; -- /usr/include/xcb/xkb.h:2732 end record; pragma Convention (C_Pass_By_Copy, xcb_xkb_set_debugging_flags_cookie_t); -- /usr/include/xcb/xkb.h:2731 type xcb_xkb_set_debugging_flags_request_t_pad0_array is array (0 .. 1) of aliased Libc.Stdint.uint8_t; type xcb_xkb_set_debugging_flags_request_t is record major_opcode : aliased Libc.Stdint .uint8_t; -- /usr/include/xcb/xkb.h:2742 minor_opcode : aliased Libc.Stdint .uint8_t; -- /usr/include/xcb/xkb.h:2743 length : aliased Libc.Stdint.uint16_t; -- /usr/include/xcb/xkb.h:2744 msgLength : aliased Libc.Stdint.uint16_t; -- /usr/include/xcb/xkb.h:2745 pad0 : aliased xcb_xkb_set_debugging_flags_request_t_pad0_array; -- /usr/include/xcb/xkb.h:2746 affectFlags : aliased Libc.Stdint .uint32_t; -- /usr/include/xcb/xkb.h:2747 flags : aliased Libc.Stdint.uint32_t; -- /usr/include/xcb/xkb.h:2748 affectCtrls : aliased Libc.Stdint .uint32_t; -- /usr/include/xcb/xkb.h:2749 ctrls : aliased Libc.Stdint.uint32_t; -- /usr/include/xcb/xkb.h:2750 end record; pragma Convention (C_Pass_By_Copy, xcb_xkb_set_debugging_flags_request_t); -- /usr/include/xcb/xkb.h:2741 type xcb_xkb_set_debugging_flags_reply_t_pad1_array is array (0 .. 7) of aliased Libc.Stdint.uint8_t; type xcb_xkb_set_debugging_flags_reply_t is record response_type : aliased Libc.Stdint .uint8_t; -- /usr/include/xcb/xkb.h:2757 pad0 : aliased Libc.Stdint.uint8_t; -- /usr/include/xcb/xkb.h:2758 sequence : aliased Libc.Stdint.uint16_t; -- /usr/include/xcb/xkb.h:2759 length : aliased Libc.Stdint.uint32_t; -- /usr/include/xcb/xkb.h:2760 currentFlags : aliased Libc.Stdint .uint32_t; -- /usr/include/xcb/xkb.h:2761 currentCtrls : aliased Libc.Stdint .uint32_t; -- /usr/include/xcb/xkb.h:2762 supportedFlags : aliased Libc.Stdint .uint32_t; -- /usr/include/xcb/xkb.h:2763 supportedCtrls : aliased Libc.Stdint .uint32_t; -- /usr/include/xcb/xkb.h:2764 pad1 : aliased xcb_xkb_set_debugging_flags_reply_t_pad1_array; -- /usr/include/xcb/xkb.h:2765 end record; pragma Convention (C_Pass_By_Copy, xcb_xkb_set_debugging_flags_reply_t); -- /usr/include/xcb/xkb.h:2756 type xcb_xkb_new_keyboard_notify_event_t_pad0_array is array (0 .. 13) of aliased Libc.Stdint.uint8_t; type xcb_xkb_new_keyboard_notify_event_t is record response_type : aliased Libc.Stdint .uint8_t; -- /usr/include/xcb/xkb.h:2775 xkbType : aliased Libc.Stdint.uint8_t; -- /usr/include/xcb/xkb.h:2776 sequence : aliased Libc.Stdint.uint16_t; -- /usr/include/xcb/xkb.h:2777 time : aliased XCB.XProto .xcb_timestamp_t; -- /usr/include/xcb/xkb.h:2778 deviceID : aliased Libc.Stdint.uint8_t; -- /usr/include/xcb/xkb.h:2779 oldDeviceID : aliased Libc.Stdint .uint8_t; -- /usr/include/xcb/xkb.h:2780 minKeyCode : aliased XCB.XProto .xcb_keycode_t; -- /usr/include/xcb/xkb.h:2781 maxKeyCode : aliased XCB.XProto .xcb_keycode_t; -- /usr/include/xcb/xkb.h:2782 oldMinKeyCode : aliased XCB.XProto .xcb_keycode_t; -- /usr/include/xcb/xkb.h:2783 oldMaxKeyCode : aliased XCB.XProto .xcb_keycode_t; -- /usr/include/xcb/xkb.h:2784 requestMajor : aliased Libc.Stdint .uint8_t; -- /usr/include/xcb/xkb.h:2785 requestMinor : aliased Libc.Stdint .uint8_t; -- /usr/include/xcb/xkb.h:2786 changed : aliased Libc.Stdint.uint16_t; -- /usr/include/xcb/xkb.h:2787 pad0 : aliased xcb_xkb_new_keyboard_notify_event_t_pad0_array; -- /usr/include/xcb/xkb.h:2788 end record; pragma Convention (C_Pass_By_Copy, xcb_xkb_new_keyboard_notify_event_t); -- /usr/include/xcb/xkb.h:2774 type xcb_xkb_map_notify_event_t_pad0_array is array (0 .. 1) of aliased Libc.Stdint.uint8_t; type xcb_xkb_map_notify_event_t is record response_type : aliased Libc.Stdint .uint8_t; -- /usr/include/xcb/xkb.h:2798 xkbType : aliased Libc.Stdint.uint8_t; -- /usr/include/xcb/xkb.h:2799 sequence : aliased Libc.Stdint.uint16_t; -- /usr/include/xcb/xkb.h:2800 time : aliased XCB.XProto .xcb_timestamp_t; -- /usr/include/xcb/xkb.h:2801 deviceID : aliased Libc.Stdint.uint8_t; -- /usr/include/xcb/xkb.h:2802 ptrBtnActions : aliased Libc.Stdint .uint8_t; -- /usr/include/xcb/xkb.h:2803 changed : aliased Libc.Stdint.uint16_t; -- /usr/include/xcb/xkb.h:2804 minKeyCode : aliased XCB.XProto .xcb_keycode_t; -- /usr/include/xcb/xkb.h:2805 maxKeyCode : aliased XCB.XProto .xcb_keycode_t; -- /usr/include/xcb/xkb.h:2806 firstType : aliased Libc.Stdint.uint8_t; -- /usr/include/xcb/xkb.h:2807 nTypes : aliased Libc.Stdint.uint8_t; -- /usr/include/xcb/xkb.h:2808 firstKeySym : aliased XCB.XProto .xcb_keycode_t; -- /usr/include/xcb/xkb.h:2809 nKeySyms : aliased Libc.Stdint.uint8_t; -- /usr/include/xcb/xkb.h:2810 firstKeyAct : aliased XCB.XProto .xcb_keycode_t; -- /usr/include/xcb/xkb.h:2811 nKeyActs : aliased Libc.Stdint.uint8_t; -- /usr/include/xcb/xkb.h:2812 firstKeyBehavior : aliased XCB.XProto .xcb_keycode_t; -- /usr/include/xcb/xkb.h:2813 nKeyBehavior : aliased Libc.Stdint .uint8_t; -- /usr/include/xcb/xkb.h:2814 firstKeyExplicit : aliased XCB.XProto .xcb_keycode_t; -- /usr/include/xcb/xkb.h:2815 nKeyExplicit : aliased Libc.Stdint .uint8_t; -- /usr/include/xcb/xkb.h:2816 firstModMapKey : aliased XCB.XProto .xcb_keycode_t; -- /usr/include/xcb/xkb.h:2817 nModMapKeys : aliased Libc.Stdint .uint8_t; -- /usr/include/xcb/xkb.h:2818 firstVModMapKey : aliased XCB.XProto .xcb_keycode_t; -- /usr/include/xcb/xkb.h:2819 nVModMapKeys : aliased Libc.Stdint .uint8_t; -- /usr/include/xcb/xkb.h:2820 virtualMods : aliased Libc.Stdint .uint16_t; -- /usr/include/xcb/xkb.h:2821 pad0 : aliased xcb_xkb_map_notify_event_t_pad0_array; -- /usr/include/xcb/xkb.h:2822 end record; pragma Convention (C_Pass_By_Copy, xcb_xkb_map_notify_event_t); -- /usr/include/xcb/xkb.h:2797 type xcb_xkb_state_notify_event_t is record response_type : aliased Libc.Stdint .uint8_t; -- /usr/include/xcb/xkb.h:2832 xkbType : aliased Libc.Stdint.uint8_t; -- /usr/include/xcb/xkb.h:2833 sequence : aliased Libc.Stdint.uint16_t; -- /usr/include/xcb/xkb.h:2834 time : aliased XCB.XProto .xcb_timestamp_t; -- /usr/include/xcb/xkb.h:2835 deviceID : aliased Libc.Stdint.uint8_t; -- /usr/include/xcb/xkb.h:2836 mods : aliased Libc.Stdint.uint8_t; -- /usr/include/xcb/xkb.h:2837 baseMods : aliased Libc.Stdint.uint8_t; -- /usr/include/xcb/xkb.h:2838 latchedMods : aliased Libc.Stdint .uint8_t; -- /usr/include/xcb/xkb.h:2839 lockedMods : aliased Libc.Stdint.uint8_t; -- /usr/include/xcb/xkb.h:2840 group : aliased Libc.Stdint.uint8_t; -- /usr/include/xcb/xkb.h:2841 baseGroup : aliased Libc.Stdint.int16_t; -- /usr/include/xcb/xkb.h:2842 latchedGroup : aliased Libc.Stdint .int16_t; -- /usr/include/xcb/xkb.h:2843 lockedGroup : aliased Libc.Stdint .uint8_t; -- /usr/include/xcb/xkb.h:2844 compatState : aliased Libc.Stdint .uint8_t; -- /usr/include/xcb/xkb.h:2845 grabMods : aliased Libc.Stdint.uint8_t; -- /usr/include/xcb/xkb.h:2846 compatGrabMods : aliased Libc.Stdint .uint8_t; -- /usr/include/xcb/xkb.h:2847 lookupMods : aliased Libc.Stdint.uint8_t; -- /usr/include/xcb/xkb.h:2848 compatLoockupMods : aliased Libc.Stdint .uint8_t; -- /usr/include/xcb/xkb.h:2849 ptrBtnState : aliased Libc.Stdint .uint16_t; -- /usr/include/xcb/xkb.h:2850 changed : aliased Libc.Stdint.uint16_t; -- /usr/include/xcb/xkb.h:2851 keycode : aliased XCB.XProto .xcb_keycode_t; -- /usr/include/xcb/xkb.h:2852 eventType : aliased Libc.Stdint.uint8_t; -- /usr/include/xcb/xkb.h:2853 requestMajor : aliased Libc.Stdint .uint8_t; -- /usr/include/xcb/xkb.h:2854 requestMinor : aliased Libc.Stdint .uint8_t; -- /usr/include/xcb/xkb.h:2855 end record; pragma Convention (C_Pass_By_Copy, xcb_xkb_state_notify_event_t); -- /usr/include/xcb/xkb.h:2831 type xcb_xkb_controls_notify_event_t_pad0_array is array (0 .. 1) of aliased Libc.Stdint.uint8_t; type xcb_xkb_controls_notify_event_t_pad1_array is array (0 .. 3) of aliased Libc.Stdint.uint8_t; type xcb_xkb_controls_notify_event_t is record response_type : aliased Libc.Stdint .uint8_t; -- /usr/include/xcb/xkb.h:2865 xkbType : aliased Libc.Stdint.uint8_t; -- /usr/include/xcb/xkb.h:2866 sequence : aliased Libc.Stdint.uint16_t; -- /usr/include/xcb/xkb.h:2867 time : aliased XCB.XProto .xcb_timestamp_t; -- /usr/include/xcb/xkb.h:2868 deviceID : aliased Libc.Stdint.uint8_t; -- /usr/include/xcb/xkb.h:2869 numGroups : aliased Libc.Stdint.uint8_t; -- /usr/include/xcb/xkb.h:2870 pad0 : aliased xcb_xkb_controls_notify_event_t_pad0_array; -- /usr/include/xcb/xkb.h:2871 changedControls : aliased Libc.Stdint .uint32_t; -- /usr/include/xcb/xkb.h:2872 enabledControls : aliased Libc.Stdint .uint32_t; -- /usr/include/xcb/xkb.h:2873 enabledControlChanges : aliased Libc.Stdint .uint32_t; -- /usr/include/xcb/xkb.h:2874 keycode : aliased XCB.XProto .xcb_keycode_t; -- /usr/include/xcb/xkb.h:2875 eventType : aliased Libc.Stdint.uint8_t; -- /usr/include/xcb/xkb.h:2876 requestMajor : aliased Libc.Stdint .uint8_t; -- /usr/include/xcb/xkb.h:2877 requestMinor : aliased Libc.Stdint .uint8_t; -- /usr/include/xcb/xkb.h:2878 pad1 : aliased xcb_xkb_controls_notify_event_t_pad1_array; -- /usr/include/xcb/xkb.h:2879 end record; pragma Convention (C_Pass_By_Copy, xcb_xkb_controls_notify_event_t); -- /usr/include/xcb/xkb.h:2864 type xcb_xkb_indicator_state_notify_event_t_pad0_array is array (0 .. 2) of aliased Libc.Stdint.uint8_t; type xcb_xkb_indicator_state_notify_event_t_pad1_array is array (0 .. 11) of aliased Libc.Stdint.uint8_t; type xcb_xkb_indicator_state_notify_event_t is record response_type : aliased Libc.Stdint .uint8_t; -- /usr/include/xcb/xkb.h:2889 xkbType : aliased Libc.Stdint.uint8_t; -- /usr/include/xcb/xkb.h:2890 sequence : aliased Libc.Stdint.uint16_t; -- /usr/include/xcb/xkb.h:2891 time : aliased XCB.XProto .xcb_timestamp_t; -- /usr/include/xcb/xkb.h:2892 deviceID : aliased Libc.Stdint.uint8_t; -- /usr/include/xcb/xkb.h:2893 pad0 : aliased xcb_xkb_indicator_state_notify_event_t_pad0_array; -- /usr/include/xcb/xkb.h:2894 state : aliased Libc.Stdint.uint32_t; -- /usr/include/xcb/xkb.h:2895 stateChanged : aliased Libc.Stdint .uint32_t; -- /usr/include/xcb/xkb.h:2896 pad1 : aliased xcb_xkb_indicator_state_notify_event_t_pad1_array; -- /usr/include/xcb/xkb.h:2897 end record; pragma Convention (C_Pass_By_Copy, xcb_xkb_indicator_state_notify_event_t); -- /usr/include/xcb/xkb.h:2888 type xcb_xkb_indicator_map_notify_event_t_pad0_array is array (0 .. 2) of aliased Libc.Stdint.uint8_t; type xcb_xkb_indicator_map_notify_event_t_pad1_array is array (0 .. 11) of aliased Libc.Stdint.uint8_t; type xcb_xkb_indicator_map_notify_event_t is record response_type : aliased Libc.Stdint .uint8_t; -- /usr/include/xcb/xkb.h:2907 xkbType : aliased Libc.Stdint.uint8_t; -- /usr/include/xcb/xkb.h:2908 sequence : aliased Libc.Stdint.uint16_t; -- /usr/include/xcb/xkb.h:2909 time : aliased XCB.XProto .xcb_timestamp_t; -- /usr/include/xcb/xkb.h:2910 deviceID : aliased Libc.Stdint.uint8_t; -- /usr/include/xcb/xkb.h:2911 pad0 : aliased xcb_xkb_indicator_map_notify_event_t_pad0_array; -- /usr/include/xcb/xkb.h:2912 state : aliased Libc.Stdint.uint32_t; -- /usr/include/xcb/xkb.h:2913 mapChanged : aliased Libc.Stdint .uint32_t; -- /usr/include/xcb/xkb.h:2914 pad1 : aliased xcb_xkb_indicator_map_notify_event_t_pad1_array; -- /usr/include/xcb/xkb.h:2915 end record; pragma Convention (C_Pass_By_Copy, xcb_xkb_indicator_map_notify_event_t); -- /usr/include/xcb/xkb.h:2906 type xcb_xkb_names_notify_event_t_pad2_array is array (0 .. 3) of aliased Libc.Stdint.uint8_t; type xcb_xkb_names_notify_event_t is record response_type : aliased Libc.Stdint .uint8_t; -- /usr/include/xcb/xkb.h:2925 xkbType : aliased Libc.Stdint.uint8_t; -- /usr/include/xcb/xkb.h:2926 sequence : aliased Libc.Stdint.uint16_t; -- /usr/include/xcb/xkb.h:2927 time : aliased XCB.XProto .xcb_timestamp_t; -- /usr/include/xcb/xkb.h:2928 deviceID : aliased Libc.Stdint.uint8_t; -- /usr/include/xcb/xkb.h:2929 pad0 : aliased Libc.Stdint.uint8_t; -- /usr/include/xcb/xkb.h:2930 changed : aliased Libc.Stdint.uint16_t; -- /usr/include/xcb/xkb.h:2931 firstType : aliased Libc.Stdint.uint8_t; -- /usr/include/xcb/xkb.h:2932 nTypes : aliased Libc.Stdint.uint8_t; -- /usr/include/xcb/xkb.h:2933 firstLevelName : aliased Libc.Stdint .uint8_t; -- /usr/include/xcb/xkb.h:2934 nLevelNames : aliased Libc.Stdint .uint8_t; -- /usr/include/xcb/xkb.h:2935 pad1 : aliased Libc.Stdint.uint8_t; -- /usr/include/xcb/xkb.h:2936 nRadioGroups : aliased Libc.Stdint .uint8_t; -- /usr/include/xcb/xkb.h:2937 nKeyAliases : aliased Libc.Stdint .uint8_t; -- /usr/include/xcb/xkb.h:2938 changedGroupNames : aliased Libc.Stdint .uint8_t; -- /usr/include/xcb/xkb.h:2939 changedVirtualMods : aliased Libc.Stdint .uint16_t; -- /usr/include/xcb/xkb.h:2940 firstKey : aliased XCB.XProto .xcb_keycode_t; -- /usr/include/xcb/xkb.h:2941 nKeys : aliased Libc.Stdint.uint8_t; -- /usr/include/xcb/xkb.h:2942 changedIndicators : aliased Libc.Stdint .uint32_t; -- /usr/include/xcb/xkb.h:2943 pad2 : aliased xcb_xkb_names_notify_event_t_pad2_array; -- /usr/include/xcb/xkb.h:2944 end record; pragma Convention (C_Pass_By_Copy, xcb_xkb_names_notify_event_t); -- /usr/include/xcb/xkb.h:2924 type xcb_xkb_compat_map_notify_event_t_pad0_array is array (0 .. 15) of aliased Libc.Stdint.uint8_t; type xcb_xkb_compat_map_notify_event_t is record response_type : aliased Libc.Stdint .uint8_t; -- /usr/include/xcb/xkb.h:2954 xkbType : aliased Libc.Stdint.uint8_t; -- /usr/include/xcb/xkb.h:2955 sequence : aliased Libc.Stdint.uint16_t; -- /usr/include/xcb/xkb.h:2956 time : aliased XCB.XProto .xcb_timestamp_t; -- /usr/include/xcb/xkb.h:2957 deviceID : aliased Libc.Stdint.uint8_t; -- /usr/include/xcb/xkb.h:2958 changedGroups : aliased Libc.Stdint .uint8_t; -- /usr/include/xcb/xkb.h:2959 firstSI : aliased Libc.Stdint.uint16_t; -- /usr/include/xcb/xkb.h:2960 nSI : aliased Libc.Stdint.uint16_t; -- /usr/include/xcb/xkb.h:2961 nTotalSI : aliased Libc.Stdint.uint16_t; -- /usr/include/xcb/xkb.h:2962 pad0 : aliased xcb_xkb_compat_map_notify_event_t_pad0_array; -- /usr/include/xcb/xkb.h:2963 end record; pragma Convention (C_Pass_By_Copy, xcb_xkb_compat_map_notify_event_t); -- /usr/include/xcb/xkb.h:2953 type xcb_xkb_bell_notify_event_t_pad0_array is array (0 .. 6) of aliased Libc.Stdint.uint8_t; type xcb_xkb_bell_notify_event_t is record response_type : aliased Libc.Stdint .uint8_t; -- /usr/include/xcb/xkb.h:2973 xkbType : aliased Libc.Stdint.uint8_t; -- /usr/include/xcb/xkb.h:2974 sequence : aliased Libc.Stdint.uint16_t; -- /usr/include/xcb/xkb.h:2975 time : aliased XCB.XProto .xcb_timestamp_t; -- /usr/include/xcb/xkb.h:2976 deviceID : aliased Libc.Stdint.uint8_t; -- /usr/include/xcb/xkb.h:2977 bellClass : aliased Libc.Stdint.uint8_t; -- /usr/include/xcb/xkb.h:2978 bellID : aliased Libc.Stdint.uint8_t; -- /usr/include/xcb/xkb.h:2979 percent : aliased Libc.Stdint.uint8_t; -- /usr/include/xcb/xkb.h:2980 pitch : aliased Libc.Stdint.uint16_t; -- /usr/include/xcb/xkb.h:2981 duration : aliased Libc.Stdint.uint16_t; -- /usr/include/xcb/xkb.h:2982 name : aliased XCB.XProto.xcb_atom_t; -- /usr/include/xcb/xkb.h:2983 window : aliased XCB.XProto.xcb_window_t; -- /usr/include/xcb/xkb.h:2984 eventOnly : aliased Libc.Stdint.uint8_t; -- /usr/include/xcb/xkb.h:2985 pad0 : aliased xcb_xkb_bell_notify_event_t_pad0_array; -- /usr/include/xcb/xkb.h:2986 end record; pragma Convention (C_Pass_By_Copy, xcb_xkb_bell_notify_event_t); -- /usr/include/xcb/xkb.h:2972 type xcb_xkb_action_message_event_t_message_array is array (0 .. 7) of aliased xcb_xkb_string8_t; type xcb_xkb_action_message_event_t_pad0_array is array (0 .. 9) of aliased Libc.Stdint.uint8_t; type xcb_xkb_action_message_event_t is record response_type : aliased Libc.Stdint .uint8_t; -- /usr/include/xcb/xkb.h:2996 xkbType : aliased Libc.Stdint.uint8_t; -- /usr/include/xcb/xkb.h:2997 sequence : aliased Libc.Stdint.uint16_t; -- /usr/include/xcb/xkb.h:2998 time : aliased XCB.XProto .xcb_timestamp_t; -- /usr/include/xcb/xkb.h:2999 deviceID : aliased Libc.Stdint.uint8_t; -- /usr/include/xcb/xkb.h:3000 keycode : aliased XCB.XProto .xcb_keycode_t; -- /usr/include/xcb/xkb.h:3001 press : aliased Libc.Stdint.uint8_t; -- /usr/include/xcb/xkb.h:3002 keyEventFollows : aliased Libc.Stdint .uint8_t; -- /usr/include/xcb/xkb.h:3003 mods : aliased Libc.Stdint.uint8_t; -- /usr/include/xcb/xkb.h:3004 group : aliased Libc.Stdint.uint8_t; -- /usr/include/xcb/xkb.h:3005 message : aliased xcb_xkb_action_message_event_t_message_array; -- /usr/include/xcb/xkb.h:3006 pad0 : aliased xcb_xkb_action_message_event_t_pad0_array; -- /usr/include/xcb/xkb.h:3007 end record; pragma Convention (C_Pass_By_Copy, xcb_xkb_action_message_event_t); -- /usr/include/xcb/xkb.h:2995 type xcb_xkb_access_x_notify_event_t_pad0_array is array (0 .. 15) of aliased Libc.Stdint.uint8_t; type xcb_xkb_access_x_notify_event_t is record response_type : aliased Libc.Stdint .uint8_t; -- /usr/include/xcb/xkb.h:3017 xkbType : aliased Libc.Stdint.uint8_t; -- /usr/include/xcb/xkb.h:3018 sequence : aliased Libc.Stdint.uint16_t; -- /usr/include/xcb/xkb.h:3019 time : aliased XCB.XProto .xcb_timestamp_t; -- /usr/include/xcb/xkb.h:3020 deviceID : aliased Libc.Stdint.uint8_t; -- /usr/include/xcb/xkb.h:3021 keycode : aliased XCB.XProto .xcb_keycode_t; -- /usr/include/xcb/xkb.h:3022 detailt : aliased Libc.Stdint.uint16_t; -- /usr/include/xcb/xkb.h:3023 slowKeysDelay : aliased Libc.Stdint .uint16_t; -- /usr/include/xcb/xkb.h:3024 debounceDelay : aliased Libc.Stdint .uint16_t; -- /usr/include/xcb/xkb.h:3025 pad0 : aliased xcb_xkb_access_x_notify_event_t_pad0_array; -- /usr/include/xcb/xkb.h:3026 end record; pragma Convention (C_Pass_By_Copy, xcb_xkb_access_x_notify_event_t); -- /usr/include/xcb/xkb.h:3016 type xcb_xkb_extension_device_notify_event_t_pad1_array is array (0 .. 1) of aliased Libc.Stdint.uint8_t; type xcb_xkb_extension_device_notify_event_t is record response_type : aliased Libc.Stdint .uint8_t; -- /usr/include/xcb/xkb.h:3036 xkbType : aliased Libc.Stdint.uint8_t; -- /usr/include/xcb/xkb.h:3037 sequence : aliased Libc.Stdint.uint16_t; -- /usr/include/xcb/xkb.h:3038 time : aliased XCB.XProto .xcb_timestamp_t; -- /usr/include/xcb/xkb.h:3039 deviceID : aliased Libc.Stdint.uint8_t; -- /usr/include/xcb/xkb.h:3040 pad0 : aliased Libc.Stdint.uint8_t; -- /usr/include/xcb/xkb.h:3041 reason : aliased Libc.Stdint.uint16_t; -- /usr/include/xcb/xkb.h:3042 ledClass : aliased Libc.Stdint.uint16_t; -- /usr/include/xcb/xkb.h:3043 ledID : aliased Libc.Stdint.uint16_t; -- /usr/include/xcb/xkb.h:3044 ledsDefined : aliased Libc.Stdint .uint32_t; -- /usr/include/xcb/xkb.h:3045 ledState : aliased Libc.Stdint.uint32_t; -- /usr/include/xcb/xkb.h:3046 firstButton : aliased Libc.Stdint .uint8_t; -- /usr/include/xcb/xkb.h:3047 nButtons : aliased Libc.Stdint.uint8_t; -- /usr/include/xcb/xkb.h:3048 supported : aliased Libc.Stdint.uint16_t; -- /usr/include/xcb/xkb.h:3049 unsupported : aliased Libc.Stdint .uint16_t; -- /usr/include/xcb/xkb.h:3050 pad1 : aliased xcb_xkb_extension_device_notify_event_t_pad1_array; -- /usr/include/xcb/xkb.h:3051 end record; pragma Convention (C_Pass_By_Copy, xcb_xkb_extension_device_notify_event_t); -- /usr/include/xcb/xkb.h:3035 procedure xcb_xkb_device_spec_next (i : access xcb_xkb_device_spec_iterator_t); -- /usr/include/xcb/xkb.h:3073 pragma Import (C, xcb_xkb_device_spec_next, "xcb_xkb_device_spec_next"); function xcb_xkb_device_spec_end (i : xcb_xkb_device_spec_iterator_t) return XCB.xcb_generic_iterator_t; -- /usr/include/xcb/xkb.h:3095 pragma Import (C, xcb_xkb_device_spec_end, "xcb_xkb_device_spec_end"); procedure xcb_xkb_led_class_spec_next (i : access xcb_xkb_led_class_spec_iterator_t); -- /usr/include/xcb/xkb.h:3116 pragma Import (C, xcb_xkb_led_class_spec_next, "xcb_xkb_led_class_spec_next"); function xcb_xkb_led_class_spec_end (i : xcb_xkb_led_class_spec_iterator_t) return XCB.xcb_generic_iterator_t; -- /usr/include/xcb/xkb.h:3138 pragma Import (C, xcb_xkb_led_class_spec_end, "xcb_xkb_led_class_spec_end"); procedure xcb_xkb_bell_class_spec_next (i : access xcb_xkb_bell_class_spec_iterator_t); -- /usr/include/xcb/xkb.h:3159 pragma Import (C, xcb_xkb_bell_class_spec_next, "xcb_xkb_bell_class_spec_next"); function xcb_xkb_bell_class_spec_end (i : xcb_xkb_bell_class_spec_iterator_t) return XCB.xcb_generic_iterator_t; -- /usr/include/xcb/xkb.h:3181 pragma Import (C, xcb_xkb_bell_class_spec_end, "xcb_xkb_bell_class_spec_end"); procedure xcb_xkb_id_spec_next (i : access xcb_xkb_id_spec_iterator_t); -- /usr/include/xcb/xkb.h:3202 pragma Import (C, xcb_xkb_id_spec_next, "xcb_xkb_id_spec_next"); function xcb_xkb_id_spec_end (i : xcb_xkb_id_spec_iterator_t) return XCB.xcb_generic_iterator_t; -- /usr/include/xcb/xkb.h:3224 pragma Import (C, xcb_xkb_id_spec_end, "xcb_xkb_id_spec_end"); procedure xcb_xkb_indicator_map_next (i : access xcb_xkb_indicator_map_iterator_t); -- /usr/include/xcb/xkb.h:3245 pragma Import (C, xcb_xkb_indicator_map_next, "xcb_xkb_indicator_map_next"); function xcb_xkb_indicator_map_end (i : xcb_xkb_indicator_map_iterator_t) return XCB.xcb_generic_iterator_t; -- /usr/include/xcb/xkb.h:3267 pragma Import (C, xcb_xkb_indicator_map_end, "xcb_xkb_indicator_map_end"); procedure xcb_xkb_mod_def_next (i : access xcb_xkb_mod_def_iterator_t); -- /usr/include/xcb/xkb.h:3288 pragma Import (C, xcb_xkb_mod_def_next, "xcb_xkb_mod_def_next"); function xcb_xkb_mod_def_end (i : xcb_xkb_mod_def_iterator_t) return XCB.xcb_generic_iterator_t; -- /usr/include/xcb/xkb.h:3310 pragma Import (C, xcb_xkb_mod_def_end, "xcb_xkb_mod_def_end"); procedure xcb_xkb_key_name_next (i : access xcb_xkb_key_name_iterator_t); -- /usr/include/xcb/xkb.h:3331 pragma Import (C, xcb_xkb_key_name_next, "xcb_xkb_key_name_next"); function xcb_xkb_key_name_end (i : xcb_xkb_key_name_iterator_t) return XCB.xcb_generic_iterator_t; -- /usr/include/xcb/xkb.h:3353 pragma Import (C, xcb_xkb_key_name_end, "xcb_xkb_key_name_end"); procedure xcb_xkb_key_alias_next (i : access xcb_xkb_key_alias_iterator_t); -- /usr/include/xcb/xkb.h:3374 pragma Import (C, xcb_xkb_key_alias_next, "xcb_xkb_key_alias_next"); function xcb_xkb_key_alias_end (i : xcb_xkb_key_alias_iterator_t) return XCB.xcb_generic_iterator_t; -- /usr/include/xcb/xkb.h:3396 pragma Import (C, xcb_xkb_key_alias_end, "xcb_xkb_key_alias_end"); function xcb_xkb_counted_string_16_sizeof (u_buffer : System.Address) return int; -- /usr/include/xcb/xkb.h:3399 pragma Import (C, xcb_xkb_counted_string_16_sizeof, "xcb_xkb_counted_string_16_sizeof"); function xcb_xkb_counted_string_16_string (R : access xcb_xkb_counted_string_16_t) return Interfaces.C.Strings.chars_ptr; -- /usr/include/xcb/xkb.h:3412 pragma Import (C, xcb_xkb_counted_string_16_string, "xcb_xkb_counted_string_16_string"); function xcb_xkb_counted_string_16_string_length (R : access xcb_xkb_counted_string_16_t) return int; -- /usr/include/xcb/xkb.h:3425 pragma Import (C, xcb_xkb_counted_string_16_string_length, "xcb_xkb_counted_string_16_string_length"); function xcb_xkb_counted_string_16_string_end (R : access xcb_xkb_counted_string_16_t) return XCB.xcb_generic_iterator_t; -- /usr/include/xcb/xkb.h:3438 pragma Import (C, xcb_xkb_counted_string_16_string_end, "xcb_xkb_counted_string_16_string_end"); function xcb_xkb_counted_string_16_alignment_pad (R : access xcb_xkb_counted_string_16_t) return System.Address; -- /usr/include/xcb/xkb.h:3451 pragma Import (C, xcb_xkb_counted_string_16_alignment_pad, "xcb_xkb_counted_string_16_alignment_pad"); function xcb_xkb_counted_string_16_alignment_pad_length (R : access xcb_xkb_counted_string_16_t) return int; -- /usr/include/xcb/xkb.h:3464 pragma Import (C, xcb_xkb_counted_string_16_alignment_pad_length, "xcb_xkb_counted_string_16_alignment_pad_length"); function xcb_xkb_counted_string_16_alignment_pad_end (R : access xcb_xkb_counted_string_16_t) return XCB.xcb_generic_iterator_t; -- /usr/include/xcb/xkb.h:3477 pragma Import (C, xcb_xkb_counted_string_16_alignment_pad_end, "xcb_xkb_counted_string_16_alignment_pad_end"); procedure xcb_xkb_counted_string_16_next (i : access xcb_xkb_counted_string_16_iterator_t); -- /usr/include/xcb/xkb.h:3498 pragma Import (C, xcb_xkb_counted_string_16_next, "xcb_xkb_counted_string_16_next"); function xcb_xkb_counted_string_16_end (i : xcb_xkb_counted_string_16_iterator_t) return XCB.xcb_generic_iterator_t; -- /usr/include/xcb/xkb.h:3520 pragma Import (C, xcb_xkb_counted_string_16_end, "xcb_xkb_counted_string_16_end"); procedure xcb_xkb_kt_map_entry_next (i : access xcb_xkb_kt_map_entry_iterator_t); -- /usr/include/xcb/xkb.h:3541 pragma Import (C, xcb_xkb_kt_map_entry_next, "xcb_xkb_kt_map_entry_next"); function xcb_xkb_kt_map_entry_end (i : xcb_xkb_kt_map_entry_iterator_t) return XCB.xcb_generic_iterator_t; -- /usr/include/xcb/xkb.h:3563 pragma Import (C, xcb_xkb_kt_map_entry_end, "xcb_xkb_kt_map_entry_end"); function xcb_xkb_key_type_sizeof (u_buffer : System.Address) return int; -- /usr/include/xcb/xkb.h:3566 pragma Import (C, xcb_xkb_key_type_sizeof, "xcb_xkb_key_type_sizeof"); function xcb_xkb_key_type_map (R : access xcb_xkb_key_type_t) return access xcb_xkb_kt_map_entry_t; -- /usr/include/xcb/xkb.h:3579 pragma Import (C, xcb_xkb_key_type_map, "xcb_xkb_key_type_map"); function xcb_xkb_key_type_map_length (R : access xcb_xkb_key_type_t) return int; -- /usr/include/xcb/xkb.h:3592 pragma Import (C, xcb_xkb_key_type_map_length, "xcb_xkb_key_type_map_length"); function xcb_xkb_key_type_map_iterator (R : access xcb_xkb_key_type_t) return xcb_xkb_kt_map_entry_iterator_t; -- /usr/include/xcb/xkb.h:3605 pragma Import (C, xcb_xkb_key_type_map_iterator, "xcb_xkb_key_type_map_iterator"); function xcb_xkb_key_type_preserve (R : access xcb_xkb_key_type_t) return access xcb_xkb_mod_def_t; -- /usr/include/xcb/xkb.h:3618 pragma Import (C, xcb_xkb_key_type_preserve, "xcb_xkb_key_type_preserve"); function xcb_xkb_key_type_preserve_length (R : access xcb_xkb_key_type_t) return int; -- /usr/include/xcb/xkb.h:3631 pragma Import (C, xcb_xkb_key_type_preserve_length, "xcb_xkb_key_type_preserve_length"); function xcb_xkb_key_type_preserve_iterator (R : access xcb_xkb_key_type_t) return xcb_xkb_mod_def_iterator_t; -- /usr/include/xcb/xkb.h:3644 pragma Import (C, xcb_xkb_key_type_preserve_iterator, "xcb_xkb_key_type_preserve_iterator"); procedure xcb_xkb_key_type_next (i : access xcb_xkb_key_type_iterator_t); -- /usr/include/xcb/xkb.h:3665 pragma Import (C, xcb_xkb_key_type_next, "xcb_xkb_key_type_next"); function xcb_xkb_key_type_end (i : xcb_xkb_key_type_iterator_t) return XCB.xcb_generic_iterator_t; -- /usr/include/xcb/xkb.h:3687 pragma Import (C, xcb_xkb_key_type_end, "xcb_xkb_key_type_end"); function xcb_xkb_key_sym_map_sizeof (u_buffer : System.Address) return int; -- /usr/include/xcb/xkb.h:3690 pragma Import (C, xcb_xkb_key_sym_map_sizeof, "xcb_xkb_key_sym_map_sizeof"); function xcb_xkb_key_sym_map_syms (R : access xcb_xkb_key_sym_map_t) return access XCB.XProto.xcb_keysym_t; -- /usr/include/xcb/xkb.h:3703 pragma Import (C, xcb_xkb_key_sym_map_syms, "xcb_xkb_key_sym_map_syms"); function xcb_xkb_key_sym_map_syms_length (R : access xcb_xkb_key_sym_map_t) return int; -- /usr/include/xcb/xkb.h:3716 pragma Import (C, xcb_xkb_key_sym_map_syms_length, "xcb_xkb_key_sym_map_syms_length"); function xcb_xkb_key_sym_map_syms_end (R : access xcb_xkb_key_sym_map_t) return XCB.xcb_generic_iterator_t; -- /usr/include/xcb/xkb.h:3729 pragma Import (C, xcb_xkb_key_sym_map_syms_end, "xcb_xkb_key_sym_map_syms_end"); procedure xcb_xkb_key_sym_map_next (i : access xcb_xkb_key_sym_map_iterator_t); -- /usr/include/xcb/xkb.h:3750 pragma Import (C, xcb_xkb_key_sym_map_next, "xcb_xkb_key_sym_map_next"); function xcb_xkb_key_sym_map_end (i : xcb_xkb_key_sym_map_iterator_t) return XCB.xcb_generic_iterator_t; -- /usr/include/xcb/xkb.h:3772 pragma Import (C, xcb_xkb_key_sym_map_end, "xcb_xkb_key_sym_map_end"); procedure xcb_xkb_common_behavior_next (i : access xcb_xkb_common_behavior_iterator_t); -- /usr/include/xcb/xkb.h:3793 pragma Import (C, xcb_xkb_common_behavior_next, "xcb_xkb_common_behavior_next"); function xcb_xkb_common_behavior_end (i : xcb_xkb_common_behavior_iterator_t) return XCB.xcb_generic_iterator_t; -- /usr/include/xcb/xkb.h:3815 pragma Import (C, xcb_xkb_common_behavior_end, "xcb_xkb_common_behavior_end"); procedure xcb_xkb_default_behavior_next (i : access xcb_xkb_default_behavior_iterator_t); -- /usr/include/xcb/xkb.h:3836 pragma Import (C, xcb_xkb_default_behavior_next, "xcb_xkb_default_behavior_next"); function xcb_xkb_default_behavior_end (i : xcb_xkb_default_behavior_iterator_t) return XCB.xcb_generic_iterator_t; -- /usr/include/xcb/xkb.h:3858 pragma Import (C, xcb_xkb_default_behavior_end, "xcb_xkb_default_behavior_end"); procedure xcb_xkb_lock_behavior_next (i : access xcb_xkb_lock_behavior_iterator_t); -- /usr/include/xcb/xkb.h:3879 pragma Import (C, xcb_xkb_lock_behavior_next, "xcb_xkb_lock_behavior_next"); function xcb_xkb_lock_behavior_end (i : xcb_xkb_lock_behavior_iterator_t) return XCB.xcb_generic_iterator_t; -- /usr/include/xcb/xkb.h:3901 pragma Import (C, xcb_xkb_lock_behavior_end, "xcb_xkb_lock_behavior_end"); procedure xcb_xkb_radio_group_behavior_next (i : access xcb_xkb_radio_group_behavior_iterator_t); -- /usr/include/xcb/xkb.h:3922 pragma Import (C, xcb_xkb_radio_group_behavior_next, "xcb_xkb_radio_group_behavior_next"); function xcb_xkb_radio_group_behavior_end (i : xcb_xkb_radio_group_behavior_iterator_t) return XCB.xcb_generic_iterator_t; -- /usr/include/xcb/xkb.h:3944 pragma Import (C, xcb_xkb_radio_group_behavior_end, "xcb_xkb_radio_group_behavior_end"); procedure xcb_xkb_overlay_behavior_next (i : access xcb_xkb_overlay_behavior_iterator_t); -- /usr/include/xcb/xkb.h:3965 pragma Import (C, xcb_xkb_overlay_behavior_next, "xcb_xkb_overlay_behavior_next"); function xcb_xkb_overlay_behavior_end (i : xcb_xkb_overlay_behavior_iterator_t) return XCB.xcb_generic_iterator_t; -- /usr/include/xcb/xkb.h:3987 pragma Import (C, xcb_xkb_overlay_behavior_end, "xcb_xkb_overlay_behavior_end"); procedure xcb_xkb_permament_lock_behavior_next (i : access xcb_xkb_permament_lock_behavior_iterator_t); -- /usr/include/xcb/xkb.h:4008 pragma Import (C, xcb_xkb_permament_lock_behavior_next, "xcb_xkb_permament_lock_behavior_next"); function xcb_xkb_permament_lock_behavior_end (i : xcb_xkb_permament_lock_behavior_iterator_t) return XCB.xcb_generic_iterator_t; -- /usr/include/xcb/xkb.h:4030 pragma Import (C, xcb_xkb_permament_lock_behavior_end, "xcb_xkb_permament_lock_behavior_end"); procedure xcb_xkb_permament_radio_group_behavior_next (i : access xcb_xkb_permament_radio_group_behavior_iterator_t); -- /usr/include/xcb/xkb.h:4051 pragma Import (C, xcb_xkb_permament_radio_group_behavior_next, "xcb_xkb_permament_radio_group_behavior_next"); function xcb_xkb_permament_radio_group_behavior_end (i : xcb_xkb_permament_radio_group_behavior_iterator_t) return XCB.xcb_generic_iterator_t; -- /usr/include/xcb/xkb.h:4073 pragma Import (C, xcb_xkb_permament_radio_group_behavior_end, "xcb_xkb_permament_radio_group_behavior_end"); procedure xcb_xkb_permament_overlay_behavior_next (i : access xcb_xkb_permament_overlay_behavior_iterator_t); -- /usr/include/xcb/xkb.h:4094 pragma Import (C, xcb_xkb_permament_overlay_behavior_next, "xcb_xkb_permament_overlay_behavior_next"); function xcb_xkb_permament_overlay_behavior_end (i : xcb_xkb_permament_overlay_behavior_iterator_t) return XCB.xcb_generic_iterator_t; -- /usr/include/xcb/xkb.h:4116 pragma Import (C, xcb_xkb_permament_overlay_behavior_end, "xcb_xkb_permament_overlay_behavior_end"); procedure xcb_xkb_behavior_next (i : access xcb_xkb_behavior_iterator_t); -- /usr/include/xcb/xkb.h:4137 pragma Import (C, xcb_xkb_behavior_next, "xcb_xkb_behavior_next"); function xcb_xkb_behavior_end (i : xcb_xkb_behavior_iterator_t) return XCB.xcb_generic_iterator_t; -- /usr/include/xcb/xkb.h:4159 pragma Import (C, xcb_xkb_behavior_end, "xcb_xkb_behavior_end"); procedure xcb_xkb_set_behavior_next (i : access xcb_xkb_set_behavior_iterator_t); -- /usr/include/xcb/xkb.h:4180 pragma Import (C, xcb_xkb_set_behavior_next, "xcb_xkb_set_behavior_next"); function xcb_xkb_set_behavior_end (i : xcb_xkb_set_behavior_iterator_t) return XCB.xcb_generic_iterator_t; -- /usr/include/xcb/xkb.h:4202 pragma Import (C, xcb_xkb_set_behavior_end, "xcb_xkb_set_behavior_end"); procedure xcb_xkb_set_explicit_next (i : access xcb_xkb_set_explicit_iterator_t); -- /usr/include/xcb/xkb.h:4223 pragma Import (C, xcb_xkb_set_explicit_next, "xcb_xkb_set_explicit_next"); function xcb_xkb_set_explicit_end (i : xcb_xkb_set_explicit_iterator_t) return XCB.xcb_generic_iterator_t; -- /usr/include/xcb/xkb.h:4245 pragma Import (C, xcb_xkb_set_explicit_end, "xcb_xkb_set_explicit_end"); procedure xcb_xkb_key_mod_map_next (i : access xcb_xkb_key_mod_map_iterator_t); -- /usr/include/xcb/xkb.h:4266 pragma Import (C, xcb_xkb_key_mod_map_next, "xcb_xkb_key_mod_map_next"); function xcb_xkb_key_mod_map_end (i : xcb_xkb_key_mod_map_iterator_t) return XCB.xcb_generic_iterator_t; -- /usr/include/xcb/xkb.h:4288 pragma Import (C, xcb_xkb_key_mod_map_end, "xcb_xkb_key_mod_map_end"); procedure xcb_xkb_key_v_mod_map_next (i : access xcb_xkb_key_v_mod_map_iterator_t); -- /usr/include/xcb/xkb.h:4309 pragma Import (C, xcb_xkb_key_v_mod_map_next, "xcb_xkb_key_v_mod_map_next"); function xcb_xkb_key_v_mod_map_end (i : xcb_xkb_key_v_mod_map_iterator_t) return XCB.xcb_generic_iterator_t; -- /usr/include/xcb/xkb.h:4331 pragma Import (C, xcb_xkb_key_v_mod_map_end, "xcb_xkb_key_v_mod_map_end"); procedure xcb_xkb_kt_set_map_entry_next (i : access xcb_xkb_kt_set_map_entry_iterator_t); -- /usr/include/xcb/xkb.h:4352 pragma Import (C, xcb_xkb_kt_set_map_entry_next, "xcb_xkb_kt_set_map_entry_next"); function xcb_xkb_kt_set_map_entry_end (i : xcb_xkb_kt_set_map_entry_iterator_t) return XCB.xcb_generic_iterator_t; -- /usr/include/xcb/xkb.h:4374 pragma Import (C, xcb_xkb_kt_set_map_entry_end, "xcb_xkb_kt_set_map_entry_end"); function xcb_xkb_set_key_type_sizeof (u_buffer : System.Address) return int; -- /usr/include/xcb/xkb.h:4377 pragma Import (C, xcb_xkb_set_key_type_sizeof, "xcb_xkb_set_key_type_sizeof"); function xcb_xkb_set_key_type_entries (R : access xcb_xkb_set_key_type_t) return access xcb_xkb_kt_set_map_entry_t; -- /usr/include/xcb/xkb.h:4390 pragma Import (C, xcb_xkb_set_key_type_entries, "xcb_xkb_set_key_type_entries"); function xcb_xkb_set_key_type_entries_length (R : access xcb_xkb_set_key_type_t) return int; -- /usr/include/xcb/xkb.h:4403 pragma Import (C, xcb_xkb_set_key_type_entries_length, "xcb_xkb_set_key_type_entries_length"); function xcb_xkb_set_key_type_entries_iterator (R : access xcb_xkb_set_key_type_t) return xcb_xkb_kt_set_map_entry_iterator_t; -- /usr/include/xcb/xkb.h:4416 pragma Import (C, xcb_xkb_set_key_type_entries_iterator, "xcb_xkb_set_key_type_entries_iterator"); function xcb_xkb_set_key_type_preserve_entries (R : access xcb_xkb_set_key_type_t) return access xcb_xkb_kt_set_map_entry_t; -- /usr/include/xcb/xkb.h:4429 pragma Import (C, xcb_xkb_set_key_type_preserve_entries, "xcb_xkb_set_key_type_preserve_entries"); function xcb_xkb_set_key_type_preserve_entries_length (R : access xcb_xkb_set_key_type_t) return int; -- /usr/include/xcb/xkb.h:4442 pragma Import (C, xcb_xkb_set_key_type_preserve_entries_length, "xcb_xkb_set_key_type_preserve_entries_length"); function xcb_xkb_set_key_type_preserve_entries_iterator (R : access xcb_xkb_set_key_type_t) return xcb_xkb_kt_set_map_entry_iterator_t; -- /usr/include/xcb/xkb.h:4455 pragma Import (C, xcb_xkb_set_key_type_preserve_entries_iterator, "xcb_xkb_set_key_type_preserve_entries_iterator"); procedure xcb_xkb_set_key_type_next (i : access xcb_xkb_set_key_type_iterator_t); -- /usr/include/xcb/xkb.h:4476 pragma Import (C, xcb_xkb_set_key_type_next, "xcb_xkb_set_key_type_next"); function xcb_xkb_set_key_type_end (i : xcb_xkb_set_key_type_iterator_t) return XCB.xcb_generic_iterator_t; -- /usr/include/xcb/xkb.h:4498 pragma Import (C, xcb_xkb_set_key_type_end, "xcb_xkb_set_key_type_end"); procedure xcb_xkb_string8_next (i : access xcb_xkb_string8_iterator_t); -- /usr/include/xcb/xkb.h:4519 pragma Import (C, xcb_xkb_string8_next, "xcb_xkb_string8_next"); function xcb_xkb_string8_end (i : xcb_xkb_string8_iterator_t) return XCB.xcb_generic_iterator_t; -- /usr/include/xcb/xkb.h:4541 pragma Import (C, xcb_xkb_string8_end, "xcb_xkb_string8_end"); function xcb_xkb_outline_sizeof (u_buffer : System.Address) return int; -- /usr/include/xcb/xkb.h:4544 pragma Import (C, xcb_xkb_outline_sizeof, "xcb_xkb_outline_sizeof"); function xcb_xkb_outline_points (R : access xcb_xkb_outline_t) return access XCB.XProto.xcb_point_t; -- /usr/include/xcb/xkb.h:4557 pragma Import (C, xcb_xkb_outline_points, "xcb_xkb_outline_points"); function xcb_xkb_outline_points_length (R : access xcb_xkb_outline_t) return int; -- /usr/include/xcb/xkb.h:4570 pragma Import (C, xcb_xkb_outline_points_length, "xcb_xkb_outline_points_length"); function xcb_xkb_outline_points_iterator (R : access xcb_xkb_outline_t) return XCB.XProto.xcb_point_iterator_t; -- /usr/include/xcb/xkb.h:4583 pragma Import (C, xcb_xkb_outline_points_iterator, "xcb_xkb_outline_points_iterator"); procedure xcb_xkb_outline_next (i : access xcb_xkb_outline_iterator_t); -- /usr/include/xcb/xkb.h:4604 pragma Import (C, xcb_xkb_outline_next, "xcb_xkb_outline_next"); function xcb_xkb_outline_end (i : xcb_xkb_outline_iterator_t) return XCB.xcb_generic_iterator_t; -- /usr/include/xcb/xkb.h:4626 pragma Import (C, xcb_xkb_outline_end, "xcb_xkb_outline_end"); function xcb_xkb_shape_sizeof (u_buffer : System.Address) return int; -- /usr/include/xcb/xkb.h:4629 pragma Import (C, xcb_xkb_shape_sizeof, "xcb_xkb_shape_sizeof"); function xcb_xkb_shape_outlines_length (R : System.Address) return int; -- /usr/include/xcb/xkb.h:4642 pragma Import (C, xcb_xkb_shape_outlines_length, "xcb_xkb_shape_outlines_length"); function xcb_xkb_shape_outlines_iterator (R : System.Address) return xcb_xkb_outline_iterator_t; -- /usr/include/xcb/xkb.h:4655 pragma Import (C, xcb_xkb_shape_outlines_iterator, "xcb_xkb_shape_outlines_iterator"); procedure xcb_xkb_shape_next (i : access xcb_xkb_shape_iterator_t); -- /usr/include/xcb/xkb.h:4676 pragma Import (C, xcb_xkb_shape_next, "xcb_xkb_shape_next"); function xcb_xkb_shape_end (i : xcb_xkb_shape_iterator_t) return XCB.xcb_generic_iterator_t; -- /usr/include/xcb/xkb.h:4698 pragma Import (C, xcb_xkb_shape_end, "xcb_xkb_shape_end"); procedure xcb_xkb_key_next (i : access xcb_xkb_key_iterator_t); -- /usr/include/xcb/xkb.h:4719 pragma Import (C, xcb_xkb_key_next, "xcb_xkb_key_next"); function xcb_xkb_key_end (i : xcb_xkb_key_iterator_t) return XCB.xcb_generic_iterator_t; -- /usr/include/xcb/xkb.h:4741 pragma Import (C, xcb_xkb_key_end, "xcb_xkb_key_end"); procedure xcb_xkb_overlay_key_next (i : access xcb_xkb_overlay_key_iterator_t); -- /usr/include/xcb/xkb.h:4762 pragma Import (C, xcb_xkb_overlay_key_next, "xcb_xkb_overlay_key_next"); function xcb_xkb_overlay_key_end (i : xcb_xkb_overlay_key_iterator_t) return XCB.xcb_generic_iterator_t; -- /usr/include/xcb/xkb.h:4784 pragma Import (C, xcb_xkb_overlay_key_end, "xcb_xkb_overlay_key_end"); function xcb_xkb_overlay_row_sizeof (u_buffer : System.Address) return int; -- /usr/include/xcb/xkb.h:4787 pragma Import (C, xcb_xkb_overlay_row_sizeof, "xcb_xkb_overlay_row_sizeof"); function xcb_xkb_overlay_row_keys (R : System.Address) return access xcb_xkb_overlay_key_t; -- /usr/include/xcb/xkb.h:4800 pragma Import (C, xcb_xkb_overlay_row_keys, "xcb_xkb_overlay_row_keys"); function xcb_xkb_overlay_row_keys_length (R : System.Address) return int; -- /usr/include/xcb/xkb.h:4813 pragma Import (C, xcb_xkb_overlay_row_keys_length, "xcb_xkb_overlay_row_keys_length"); function xcb_xkb_overlay_row_keys_iterator (R : System.Address) return xcb_xkb_overlay_key_iterator_t; -- /usr/include/xcb/xkb.h:4826 pragma Import (C, xcb_xkb_overlay_row_keys_iterator, "xcb_xkb_overlay_row_keys_iterator"); procedure xcb_xkb_overlay_row_next (i : access xcb_xkb_overlay_row_iterator_t); -- /usr/include/xcb/xkb.h:4847 pragma Import (C, xcb_xkb_overlay_row_next, "xcb_xkb_overlay_row_next"); function xcb_xkb_overlay_row_end (i : xcb_xkb_overlay_row_iterator_t) return XCB.xcb_generic_iterator_t; -- /usr/include/xcb/xkb.h:4869 pragma Import (C, xcb_xkb_overlay_row_end, "xcb_xkb_overlay_row_end"); function xcb_xkb_overlay_sizeof (u_buffer : System.Address) return int; -- /usr/include/xcb/xkb.h:4872 pragma Import (C, xcb_xkb_overlay_sizeof, "xcb_xkb_overlay_sizeof"); function xcb_xkb_overlay_rows_length (R : System.Address) return int; -- /usr/include/xcb/xkb.h:4885 pragma Import (C, xcb_xkb_overlay_rows_length, "xcb_xkb_overlay_rows_length"); function xcb_xkb_overlay_rows_iterator (R : System.Address) return xcb_xkb_overlay_row_iterator_t; -- /usr/include/xcb/xkb.h:4898 pragma Import (C, xcb_xkb_overlay_rows_iterator, "xcb_xkb_overlay_rows_iterator"); procedure xcb_xkb_overlay_next (i : access xcb_xkb_overlay_iterator_t); -- /usr/include/xcb/xkb.h:4919 pragma Import (C, xcb_xkb_overlay_next, "xcb_xkb_overlay_next"); function xcb_xkb_overlay_end (i : xcb_xkb_overlay_iterator_t) return XCB.xcb_generic_iterator_t; -- /usr/include/xcb/xkb.h:4941 pragma Import (C, xcb_xkb_overlay_end, "xcb_xkb_overlay_end"); function xcb_xkb_row_sizeof (u_buffer : System.Address) return int; -- /usr/include/xcb/xkb.h:4944 pragma Import (C, xcb_xkb_row_sizeof, "xcb_xkb_row_sizeof"); function xcb_xkb_row_keys (R : System.Address) return access xcb_xkb_key_t; -- /usr/include/xcb/xkb.h:4957 pragma Import (C, xcb_xkb_row_keys, "xcb_xkb_row_keys"); function xcb_xkb_row_keys_length (R : System.Address) return int; -- /usr/include/xcb/xkb.h:4970 pragma Import (C, xcb_xkb_row_keys_length, "xcb_xkb_row_keys_length"); function xcb_xkb_row_keys_iterator (R : System.Address) return xcb_xkb_key_iterator_t; -- /usr/include/xcb/xkb.h:4983 pragma Import (C, xcb_xkb_row_keys_iterator, "xcb_xkb_row_keys_iterator"); procedure xcb_xkb_row_next (i : access xcb_xkb_row_iterator_t); -- /usr/include/xcb/xkb.h:5004 pragma Import (C, xcb_xkb_row_next, "xcb_xkb_row_next"); function xcb_xkb_row_end (i : xcb_xkb_row_iterator_t) return XCB.xcb_generic_iterator_t; -- /usr/include/xcb/xkb.h:5026 pragma Import (C, xcb_xkb_row_end, "xcb_xkb_row_end"); function xcb_xkb_listing_sizeof (u_buffer : System.Address) return int; -- /usr/include/xcb/xkb.h:5029 pragma Import (C, xcb_xkb_listing_sizeof, "xcb_xkb_listing_sizeof"); function xcb_xkb_listing_string (R : System.Address) return access xcb_xkb_string8_t; -- /usr/include/xcb/xkb.h:5042 pragma Import (C, xcb_xkb_listing_string, "xcb_xkb_listing_string"); function xcb_xkb_listing_string_length (R : System.Address) return int; -- /usr/include/xcb/xkb.h:5055 pragma Import (C, xcb_xkb_listing_string_length, "xcb_xkb_listing_string_length"); function xcb_xkb_listing_string_end (R : System.Address) return XCB.xcb_generic_iterator_t; -- /usr/include/xcb/xkb.h:5068 pragma Import (C, xcb_xkb_listing_string_end, "xcb_xkb_listing_string_end"); procedure xcb_xkb_listing_next (i : access xcb_xkb_listing_iterator_t); -- /usr/include/xcb/xkb.h:5089 pragma Import (C, xcb_xkb_listing_next, "xcb_xkb_listing_next"); function xcb_xkb_listing_end (i : xcb_xkb_listing_iterator_t) return XCB.xcb_generic_iterator_t; -- /usr/include/xcb/xkb.h:5111 pragma Import (C, xcb_xkb_listing_end, "xcb_xkb_listing_end"); function xcb_xkb_device_led_info_sizeof (u_buffer : System.Address) return int; -- /usr/include/xcb/xkb.h:5114 pragma Import (C, xcb_xkb_device_led_info_sizeof, "xcb_xkb_device_led_info_sizeof"); function xcb_xkb_device_led_info_names (R : System.Address) return access XCB.XProto.xcb_atom_t; -- /usr/include/xcb/xkb.h:5127 pragma Import (C, xcb_xkb_device_led_info_names, "xcb_xkb_device_led_info_names"); function xcb_xkb_device_led_info_names_length (R : System.Address) return int; -- /usr/include/xcb/xkb.h:5140 pragma Import (C, xcb_xkb_device_led_info_names_length, "xcb_xkb_device_led_info_names_length"); function xcb_xkb_device_led_info_names_end (R : System.Address) return XCB.xcb_generic_iterator_t; -- /usr/include/xcb/xkb.h:5153 pragma Import (C, xcb_xkb_device_led_info_names_end, "xcb_xkb_device_led_info_names_end"); function xcb_xkb_device_led_info_maps (R : System.Address) return access xcb_xkb_indicator_map_t; -- /usr/include/xcb/xkb.h:5166 pragma Import (C, xcb_xkb_device_led_info_maps, "xcb_xkb_device_led_info_maps"); function xcb_xkb_device_led_info_maps_length (R : System.Address) return int; -- /usr/include/xcb/xkb.h:5179 pragma Import (C, xcb_xkb_device_led_info_maps_length, "xcb_xkb_device_led_info_maps_length"); function xcb_xkb_device_led_info_maps_iterator (R : System.Address) return xcb_xkb_indicator_map_iterator_t; -- /usr/include/xcb/xkb.h:5192 pragma Import (C, xcb_xkb_device_led_info_maps_iterator, "xcb_xkb_device_led_info_maps_iterator"); procedure xcb_xkb_device_led_info_next (i : access xcb_xkb_device_led_info_iterator_t); -- /usr/include/xcb/xkb.h:5213 pragma Import (C, xcb_xkb_device_led_info_next, "xcb_xkb_device_led_info_next"); function xcb_xkb_device_led_info_end (i : xcb_xkb_device_led_info_iterator_t) return XCB.xcb_generic_iterator_t; -- /usr/include/xcb/xkb.h:5235 pragma Import (C, xcb_xkb_device_led_info_end, "xcb_xkb_device_led_info_end"); procedure xcb_xkb_sa_no_action_next (i : access xcb_xkb_sa_no_action_iterator_t); -- /usr/include/xcb/xkb.h:5256 pragma Import (C, xcb_xkb_sa_no_action_next, "xcb_xkb_sa_no_action_next"); function xcb_xkb_sa_no_action_end (i : xcb_xkb_sa_no_action_iterator_t) return XCB.xcb_generic_iterator_t; -- /usr/include/xcb/xkb.h:5278 pragma Import (C, xcb_xkb_sa_no_action_end, "xcb_xkb_sa_no_action_end"); procedure xcb_xkb_sa_set_mods_next (i : access xcb_xkb_sa_set_mods_iterator_t); -- /usr/include/xcb/xkb.h:5299 pragma Import (C, xcb_xkb_sa_set_mods_next, "xcb_xkb_sa_set_mods_next"); function xcb_xkb_sa_set_mods_end (i : xcb_xkb_sa_set_mods_iterator_t) return XCB.xcb_generic_iterator_t; -- /usr/include/xcb/xkb.h:5321 pragma Import (C, xcb_xkb_sa_set_mods_end, "xcb_xkb_sa_set_mods_end"); procedure xcb_xkb_sa_latch_mods_next (i : access xcb_xkb_sa_latch_mods_iterator_t); -- /usr/include/xcb/xkb.h:5342 pragma Import (C, xcb_xkb_sa_latch_mods_next, "xcb_xkb_sa_latch_mods_next"); function xcb_xkb_sa_latch_mods_end (i : xcb_xkb_sa_latch_mods_iterator_t) return XCB.xcb_generic_iterator_t; -- /usr/include/xcb/xkb.h:5364 pragma Import (C, xcb_xkb_sa_latch_mods_end, "xcb_xkb_sa_latch_mods_end"); procedure xcb_xkb_sa_lock_mods_next (i : access xcb_xkb_sa_lock_mods_iterator_t); -- /usr/include/xcb/xkb.h:5385 pragma Import (C, xcb_xkb_sa_lock_mods_next, "xcb_xkb_sa_lock_mods_next"); function xcb_xkb_sa_lock_mods_end (i : xcb_xkb_sa_lock_mods_iterator_t) return XCB.xcb_generic_iterator_t; -- /usr/include/xcb/xkb.h:5407 pragma Import (C, xcb_xkb_sa_lock_mods_end, "xcb_xkb_sa_lock_mods_end"); procedure xcb_xkb_sa_set_group_next (i : access xcb_xkb_sa_set_group_iterator_t); -- /usr/include/xcb/xkb.h:5428 pragma Import (C, xcb_xkb_sa_set_group_next, "xcb_xkb_sa_set_group_next"); function xcb_xkb_sa_set_group_end (i : xcb_xkb_sa_set_group_iterator_t) return XCB.xcb_generic_iterator_t; -- /usr/include/xcb/xkb.h:5450 pragma Import (C, xcb_xkb_sa_set_group_end, "xcb_xkb_sa_set_group_end"); procedure xcb_xkb_sa_latch_group_next (i : access xcb_xkb_sa_latch_group_iterator_t); -- /usr/include/xcb/xkb.h:5471 pragma Import (C, xcb_xkb_sa_latch_group_next, "xcb_xkb_sa_latch_group_next"); function xcb_xkb_sa_latch_group_end (i : xcb_xkb_sa_latch_group_iterator_t) return XCB.xcb_generic_iterator_t; -- /usr/include/xcb/xkb.h:5493 pragma Import (C, xcb_xkb_sa_latch_group_end, "xcb_xkb_sa_latch_group_end"); procedure xcb_xkb_sa_lock_group_next (i : access xcb_xkb_sa_lock_group_iterator_t); -- /usr/include/xcb/xkb.h:5514 pragma Import (C, xcb_xkb_sa_lock_group_next, "xcb_xkb_sa_lock_group_next"); function xcb_xkb_sa_lock_group_end (i : xcb_xkb_sa_lock_group_iterator_t) return XCB.xcb_generic_iterator_t; -- /usr/include/xcb/xkb.h:5536 pragma Import (C, xcb_xkb_sa_lock_group_end, "xcb_xkb_sa_lock_group_end"); procedure xcb_xkb_sa_move_ptr_next (i : access xcb_xkb_sa_move_ptr_iterator_t); -- /usr/include/xcb/xkb.h:5557 pragma Import (C, xcb_xkb_sa_move_ptr_next, "xcb_xkb_sa_move_ptr_next"); function xcb_xkb_sa_move_ptr_end (i : xcb_xkb_sa_move_ptr_iterator_t) return XCB.xcb_generic_iterator_t; -- /usr/include/xcb/xkb.h:5579 pragma Import (C, xcb_xkb_sa_move_ptr_end, "xcb_xkb_sa_move_ptr_end"); procedure xcb_xkb_sa_ptr_btn_next (i : access xcb_xkb_sa_ptr_btn_iterator_t); -- /usr/include/xcb/xkb.h:5600 pragma Import (C, xcb_xkb_sa_ptr_btn_next, "xcb_xkb_sa_ptr_btn_next"); function xcb_xkb_sa_ptr_btn_end (i : xcb_xkb_sa_ptr_btn_iterator_t) return XCB.xcb_generic_iterator_t; -- /usr/include/xcb/xkb.h:5622 pragma Import (C, xcb_xkb_sa_ptr_btn_end, "xcb_xkb_sa_ptr_btn_end"); procedure xcb_xkb_sa_lock_ptr_btn_next (i : access xcb_xkb_sa_lock_ptr_btn_iterator_t); -- /usr/include/xcb/xkb.h:5643 pragma Import (C, xcb_xkb_sa_lock_ptr_btn_next, "xcb_xkb_sa_lock_ptr_btn_next"); function xcb_xkb_sa_lock_ptr_btn_end (i : xcb_xkb_sa_lock_ptr_btn_iterator_t) return XCB.xcb_generic_iterator_t; -- /usr/include/xcb/xkb.h:5665 pragma Import (C, xcb_xkb_sa_lock_ptr_btn_end, "xcb_xkb_sa_lock_ptr_btn_end"); procedure xcb_xkb_sa_set_ptr_dflt_next (i : access xcb_xkb_sa_set_ptr_dflt_iterator_t); -- /usr/include/xcb/xkb.h:5686 pragma Import (C, xcb_xkb_sa_set_ptr_dflt_next, "xcb_xkb_sa_set_ptr_dflt_next"); function xcb_xkb_sa_set_ptr_dflt_end (i : xcb_xkb_sa_set_ptr_dflt_iterator_t) return XCB.xcb_generic_iterator_t; -- /usr/include/xcb/xkb.h:5708 pragma Import (C, xcb_xkb_sa_set_ptr_dflt_end, "xcb_xkb_sa_set_ptr_dflt_end"); procedure xcb_xkb_sa_iso_lock_next (i : access xcb_xkb_sa_iso_lock_iterator_t); -- /usr/include/xcb/xkb.h:5729 pragma Import (C, xcb_xkb_sa_iso_lock_next, "xcb_xkb_sa_iso_lock_next"); function xcb_xkb_sa_iso_lock_end (i : xcb_xkb_sa_iso_lock_iterator_t) return XCB.xcb_generic_iterator_t; -- /usr/include/xcb/xkb.h:5751 pragma Import (C, xcb_xkb_sa_iso_lock_end, "xcb_xkb_sa_iso_lock_end"); procedure xcb_xkb_sa_terminate_next (i : access xcb_xkb_sa_terminate_iterator_t); -- /usr/include/xcb/xkb.h:5772 pragma Import (C, xcb_xkb_sa_terminate_next, "xcb_xkb_sa_terminate_next"); function xcb_xkb_sa_terminate_end (i : xcb_xkb_sa_terminate_iterator_t) return XCB.xcb_generic_iterator_t; -- /usr/include/xcb/xkb.h:5794 pragma Import (C, xcb_xkb_sa_terminate_end, "xcb_xkb_sa_terminate_end"); procedure xcb_xkb_sa_switch_screen_next (i : access xcb_xkb_sa_switch_screen_iterator_t); -- /usr/include/xcb/xkb.h:5815 pragma Import (C, xcb_xkb_sa_switch_screen_next, "xcb_xkb_sa_switch_screen_next"); function xcb_xkb_sa_switch_screen_end (i : xcb_xkb_sa_switch_screen_iterator_t) return XCB.xcb_generic_iterator_t; -- /usr/include/xcb/xkb.h:5837 pragma Import (C, xcb_xkb_sa_switch_screen_end, "xcb_xkb_sa_switch_screen_end"); procedure xcb_xkb_sa_set_controls_next (i : access xcb_xkb_sa_set_controls_iterator_t); -- /usr/include/xcb/xkb.h:5858 pragma Import (C, xcb_xkb_sa_set_controls_next, "xcb_xkb_sa_set_controls_next"); function xcb_xkb_sa_set_controls_end (i : xcb_xkb_sa_set_controls_iterator_t) return XCB.xcb_generic_iterator_t; -- /usr/include/xcb/xkb.h:5880 pragma Import (C, xcb_xkb_sa_set_controls_end, "xcb_xkb_sa_set_controls_end"); procedure xcb_xkb_sa_lock_controls_next (i : access xcb_xkb_sa_lock_controls_iterator_t); -- /usr/include/xcb/xkb.h:5901 pragma Import (C, xcb_xkb_sa_lock_controls_next, "xcb_xkb_sa_lock_controls_next"); function xcb_xkb_sa_lock_controls_end (i : xcb_xkb_sa_lock_controls_iterator_t) return XCB.xcb_generic_iterator_t; -- /usr/include/xcb/xkb.h:5923 pragma Import (C, xcb_xkb_sa_lock_controls_end, "xcb_xkb_sa_lock_controls_end"); procedure xcb_xkb_sa_action_message_next (i : access xcb_xkb_sa_action_message_iterator_t); -- /usr/include/xcb/xkb.h:5944 pragma Import (C, xcb_xkb_sa_action_message_next, "xcb_xkb_sa_action_message_next"); function xcb_xkb_sa_action_message_end (i : xcb_xkb_sa_action_message_iterator_t) return XCB.xcb_generic_iterator_t; -- /usr/include/xcb/xkb.h:5966 pragma Import (C, xcb_xkb_sa_action_message_end, "xcb_xkb_sa_action_message_end"); procedure xcb_xkb_sa_redirect_key_next (i : access xcb_xkb_sa_redirect_key_iterator_t); -- /usr/include/xcb/xkb.h:5987 pragma Import (C, xcb_xkb_sa_redirect_key_next, "xcb_xkb_sa_redirect_key_next"); function xcb_xkb_sa_redirect_key_end (i : xcb_xkb_sa_redirect_key_iterator_t) return XCB.xcb_generic_iterator_t; -- /usr/include/xcb/xkb.h:6009 pragma Import (C, xcb_xkb_sa_redirect_key_end, "xcb_xkb_sa_redirect_key_end"); procedure xcb_xkb_sa_device_btn_next (i : access xcb_xkb_sa_device_btn_iterator_t); -- /usr/include/xcb/xkb.h:6030 pragma Import (C, xcb_xkb_sa_device_btn_next, "xcb_xkb_sa_device_btn_next"); function xcb_xkb_sa_device_btn_end (i : xcb_xkb_sa_device_btn_iterator_t) return XCB.xcb_generic_iterator_t; -- /usr/include/xcb/xkb.h:6052 pragma Import (C, xcb_xkb_sa_device_btn_end, "xcb_xkb_sa_device_btn_end"); procedure xcb_xkb_sa_lock_device_btn_next (i : access xcb_xkb_sa_lock_device_btn_iterator_t); -- /usr/include/xcb/xkb.h:6073 pragma Import (C, xcb_xkb_sa_lock_device_btn_next, "xcb_xkb_sa_lock_device_btn_next"); function xcb_xkb_sa_lock_device_btn_end (i : xcb_xkb_sa_lock_device_btn_iterator_t) return XCB.xcb_generic_iterator_t; -- /usr/include/xcb/xkb.h:6095 pragma Import (C, xcb_xkb_sa_lock_device_btn_end, "xcb_xkb_sa_lock_device_btn_end"); procedure xcb_xkb_sa_device_valuator_next (i : access xcb_xkb_sa_device_valuator_iterator_t); -- /usr/include/xcb/xkb.h:6116 pragma Import (C, xcb_xkb_sa_device_valuator_next, "xcb_xkb_sa_device_valuator_next"); function xcb_xkb_sa_device_valuator_end (i : xcb_xkb_sa_device_valuator_iterator_t) return XCB.xcb_generic_iterator_t; -- /usr/include/xcb/xkb.h:6138 pragma Import (C, xcb_xkb_sa_device_valuator_end, "xcb_xkb_sa_device_valuator_end"); procedure xcb_xkb_si_action_next (i : access xcb_xkb_si_action_iterator_t); -- /usr/include/xcb/xkb.h:6159 pragma Import (C, xcb_xkb_si_action_next, "xcb_xkb_si_action_next"); function xcb_xkb_si_action_end (i : xcb_xkb_si_action_iterator_t) return XCB.xcb_generic_iterator_t; -- /usr/include/xcb/xkb.h:6181 pragma Import (C, xcb_xkb_si_action_end, "xcb_xkb_si_action_end"); procedure xcb_xkb_sym_interpret_next (i : access xcb_xkb_sym_interpret_iterator_t); -- /usr/include/xcb/xkb.h:6202 pragma Import (C, xcb_xkb_sym_interpret_next, "xcb_xkb_sym_interpret_next"); function xcb_xkb_sym_interpret_end (i : xcb_xkb_sym_interpret_iterator_t) return XCB.xcb_generic_iterator_t; -- /usr/include/xcb/xkb.h:6224 pragma Import (C, xcb_xkb_sym_interpret_end, "xcb_xkb_sym_interpret_end"); procedure xcb_xkb_action_next (i : access xcb_xkb_action_iterator_t); -- /usr/include/xcb/xkb.h:6245 pragma Import (C, xcb_xkb_action_next, "xcb_xkb_action_next"); function xcb_xkb_action_end (i : xcb_xkb_action_iterator_t) return XCB.xcb_generic_iterator_t; -- /usr/include/xcb/xkb.h:6267 pragma Import (C, xcb_xkb_action_end, "xcb_xkb_action_end"); function xcb_xkb_use_extension (c : xcb_connection_t_access; wantedMajor : Libc.Stdint.uint16_t; wantedMinor : Libc.Stdint.uint16_t) return xcb_xkb_use_extension_cookie_t; -- /usr/include/xcb/xkb.h:6290 pragma Import (C, xcb_xkb_use_extension, "xcb_xkb_use_extension"); function xcb_xkb_use_extension_unchecked (c : xcb_connection_t_access; wantedMajor : Libc.Stdint.uint16_t; wantedMinor : Libc.Stdint.uint16_t) return xcb_xkb_use_extension_cookie_t; -- /usr/include/xcb/xkb.h:6318 pragma Import (C, xcb_xkb_use_extension_unchecked, "xcb_xkb_use_extension_unchecked"); function xcb_xkb_use_extension_reply (c : xcb_connection_t_access; cookie : xcb_xkb_use_extension_cookie_t; e : access xcb_generic_error_t_access) return access xcb_xkb_use_extension_reply_t; -- /usr/include/xcb/xkb.h:6349 pragma Import (C, xcb_xkb_use_extension_reply, "xcb_xkb_use_extension_reply"); function xcb_xkb_select_events_details_serialize (u_buffer : System.Address; affectWhich : Libc.Stdint.uint16_t; clear : Libc.Stdint.uint16_t; selectAll : Libc.Stdint.uint16_t; u_aux : System.Address) return int; -- /usr/include/xcb/xkb.h:6354 pragma Import (C, xcb_xkb_select_events_details_serialize, "xcb_xkb_select_events_details_serialize"); function xcb_xkb_select_events_details_unpack (u_buffer : System.Address; affectWhich : Libc.Stdint.uint16_t; clear : Libc.Stdint.uint16_t; selectAll : Libc.Stdint.uint16_t; u_aux : access xcb_xkb_select_events_details_t) return int; -- /usr/include/xcb/xkb.h:6361 pragma Import (C, xcb_xkb_select_events_details_unpack, "xcb_xkb_select_events_details_unpack"); function xcb_xkb_select_events_details_sizeof (u_buffer : System.Address; affectWhich : Libc.Stdint.uint16_t; clear : Libc.Stdint.uint16_t; selectAll : Libc.Stdint.uint16_t) return int; -- /usr/include/xcb/xkb.h:6368 pragma Import (C, xcb_xkb_select_events_details_sizeof, "xcb_xkb_select_events_details_sizeof"); function xcb_xkb_select_events_checked (c : xcb_connection_t_access; deviceSpec : xcb_xkb_device_spec_t; affectWhich : Libc.Stdint.uint16_t; clear : Libc.Stdint.uint16_t; selectAll : Libc.Stdint.uint16_t; affectMap : Libc.Stdint.uint16_t; map : Libc.Stdint.uint16_t; details : System.Address) return XCB.xcb_void_cookie_t; -- /usr/include/xcb/xkb.h:6402 pragma Import (C, xcb_xkb_select_events_checked, "xcb_xkb_select_events_checked"); function xcb_xkb_select_events (c : xcb_connection_t_access; deviceSpec : xcb_xkb_device_spec_t; affectWhich : Libc.Stdint.uint16_t; clear : Libc.Stdint.uint16_t; selectAll : Libc.Stdint.uint16_t; affectMap : Libc.Stdint.uint16_t; map : Libc.Stdint.uint16_t; details : System.Address) return XCB.xcb_void_cookie_t; -- /usr/include/xcb/xkb.h:6437 pragma Import (C, xcb_xkb_select_events, "xcb_xkb_select_events"); function xcb_xkb_select_events_aux_checked (c : xcb_connection_t_access; deviceSpec : xcb_xkb_device_spec_t; affectWhich : Libc.Stdint.uint16_t; clear : Libc.Stdint.uint16_t; selectAll : Libc.Stdint.uint16_t; affectMap : Libc.Stdint.uint16_t; map : Libc.Stdint.uint16_t; details : System.Address) return XCB.xcb_void_cookie_t; -- /usr/include/xcb/xkb.h:6475 pragma Import (C, xcb_xkb_select_events_aux_checked, "xcb_xkb_select_events_aux_checked"); function xcb_xkb_select_events_aux (c : xcb_connection_t_access; deviceSpec : xcb_xkb_device_spec_t; affectWhich : Libc.Stdint.uint16_t; clear : Libc.Stdint.uint16_t; selectAll : Libc.Stdint.uint16_t; affectMap : Libc.Stdint.uint16_t; map : Libc.Stdint.uint16_t; details : System.Address) return XCB.xcb_void_cookie_t; -- /usr/include/xcb/xkb.h:6510 pragma Import (C, xcb_xkb_select_events_aux, "xcb_xkb_select_events_aux"); function xcb_xkb_bell_checked (c : xcb_connection_t_access; deviceSpec : xcb_xkb_device_spec_t; bellClass : xcb_xkb_bell_class_spec_t; bellID : xcb_xkb_id_spec_t; percent : Libc.Stdint.int8_t; forceSound : Libc.Stdint.uint8_t; eventOnly : Libc.Stdint.uint8_t; pitch : Libc.Stdint.int16_t; duration : Libc.Stdint.int16_t; name : XCB.XProto.xcb_atom_t; window : XCB.XProto.xcb_window_t) return XCB.xcb_void_cookie_t; -- /usr/include/xcb/xkb.h:6551 pragma Import (C, xcb_xkb_bell_checked, "xcb_xkb_bell_checked"); function xcb_xkb_bell (c : xcb_connection_t_access; deviceSpec : xcb_xkb_device_spec_t; bellClass : xcb_xkb_bell_class_spec_t; bellID : xcb_xkb_id_spec_t; percent : Libc.Stdint.int8_t; forceSound : Libc.Stdint.uint8_t; eventOnly : Libc.Stdint.uint8_t; pitch : Libc.Stdint.int16_t; duration : Libc.Stdint.int16_t; name : XCB.XProto.xcb_atom_t; window : XCB.XProto.xcb_window_t) return XCB.xcb_void_cookie_t; -- /usr/include/xcb/xkb.h:6592 pragma Import (C, xcb_xkb_bell, "xcb_xkb_bell"); function xcb_xkb_get_state (c : xcb_connection_t_access; deviceSpec : xcb_xkb_device_spec_t) return xcb_xkb_get_state_cookie_t; -- /usr/include/xcb/xkb.h:6624 pragma Import (C, xcb_xkb_get_state, "xcb_xkb_get_state"); function xcb_xkb_get_state_unchecked (c : xcb_connection_t_access; deviceSpec : xcb_xkb_device_spec_t) return xcb_xkb_get_state_cookie_t; -- /usr/include/xcb/xkb.h:6650 pragma Import (C, xcb_xkb_get_state_unchecked, "xcb_xkb_get_state_unchecked"); function xcb_xkb_get_state_reply (c : xcb_connection_t_access; cookie : xcb_xkb_get_state_cookie_t; e : access xcb_generic_error_t_access) return access xcb_xkb_get_state_reply_t; -- /usr/include/xcb/xkb.h:6680 pragma Import (C, xcb_xkb_get_state_reply, "xcb_xkb_get_state_reply"); function xcb_xkb_latch_lock_state_checked (c : xcb_connection_t_access; deviceSpec : xcb_xkb_device_spec_t; affectModLocks : Libc.Stdint.uint8_t; modLocks : Libc.Stdint.uint8_t; lockGroup : Libc.Stdint.uint8_t; groupLock : Libc.Stdint.uint8_t; affectModLatches : Libc.Stdint.uint8_t; latchGroup : Libc.Stdint.uint8_t; groupLatch : Libc.Stdint.uint16_t) return XCB.xcb_void_cookie_t; -- /usr/include/xcb/xkb.h:6714 pragma Import (C, xcb_xkb_latch_lock_state_checked, "xcb_xkb_latch_lock_state_checked"); function xcb_xkb_latch_lock_state (c : xcb_connection_t_access; deviceSpec : xcb_xkb_device_spec_t; affectModLocks : Libc.Stdint.uint8_t; modLocks : Libc.Stdint.uint8_t; lockGroup : Libc.Stdint.uint8_t; groupLock : Libc.Stdint.uint8_t; affectModLatches : Libc.Stdint.uint8_t; latchGroup : Libc.Stdint.uint8_t; groupLatch : Libc.Stdint.uint16_t) return XCB.xcb_void_cookie_t; -- /usr/include/xcb/xkb.h:6751 pragma Import (C, xcb_xkb_latch_lock_state, "xcb_xkb_latch_lock_state"); function xcb_xkb_get_controls (c : xcb_connection_t_access; deviceSpec : xcb_xkb_device_spec_t) return xcb_xkb_get_controls_cookie_t; -- /usr/include/xcb/xkb.h:6781 pragma Import (C, xcb_xkb_get_controls, "xcb_xkb_get_controls"); function xcb_xkb_get_controls_unchecked (c : xcb_connection_t_access; deviceSpec : xcb_xkb_device_spec_t) return xcb_xkb_get_controls_cookie_t; -- /usr/include/xcb/xkb.h:6807 pragma Import (C, xcb_xkb_get_controls_unchecked, "xcb_xkb_get_controls_unchecked"); function xcb_xkb_get_controls_reply (c : xcb_connection_t_access; cookie : xcb_xkb_get_controls_cookie_t; e : access xcb_generic_error_t_access) return access xcb_xkb_get_controls_reply_t; -- /usr/include/xcb/xkb.h:6837 pragma Import (C, xcb_xkb_get_controls_reply, "xcb_xkb_get_controls_reply"); function xcb_xkb_set_controls_checked (c : xcb_connection_t_access; deviceSpec : xcb_xkb_device_spec_t; affectInternalRealMods : Libc.Stdint.uint8_t; internalRealMods : Libc.Stdint.uint8_t; affectIgnoreLockRealMods : Libc.Stdint.uint8_t; ignoreLockRealMods : Libc.Stdint.uint8_t; affectInternalVirtualMods : Libc.Stdint.uint16_t; internalVirtualMods : Libc.Stdint.uint16_t; affectIgnoreLockVirtualMods : Libc.Stdint.uint16_t; ignoreLockVirtualMods : Libc.Stdint.uint16_t; mouseKeysDfltBtn : Libc.Stdint.uint8_t; groupsWrap : Libc.Stdint.uint8_t; accessXOptions : Libc.Stdint.uint16_t; affectEnabledControls : Libc.Stdint.uint32_t; enabledControls : Libc.Stdint.uint32_t; changeControls : Libc.Stdint.uint32_t; repeatDelay : Libc.Stdint.uint16_t; repeatInterval : Libc.Stdint.uint16_t; slowKeysDelay : Libc.Stdint.uint16_t; debounceDelay : Libc.Stdint.uint16_t; mouseKeysDelay : Libc.Stdint.uint16_t; mouseKeysInterval : Libc.Stdint.uint16_t; mouseKeysTimeToMax : Libc.Stdint.uint16_t; mouseKeysMaxSpeed : Libc.Stdint.uint16_t; mouseKeysCurve : Libc.Stdint.int16_t; accessXTimeout : Libc.Stdint.uint16_t; accessXTimeoutMask : Libc.Stdint.uint32_t; accessXTimeoutValues : Libc.Stdint.uint32_t; accessXTimeoutOptionsMask : Libc.Stdint.uint16_t; accessXTimeoutOptionsValues : Libc.Stdint.uint16_t; perKeyRepeat : access Libc.Stdint.uint8_t) return XCB.xcb_void_cookie_t; -- /usr/include/xcb/xkb.h:6893 pragma Import (C, xcb_xkb_set_controls_checked, "xcb_xkb_set_controls_checked"); function xcb_xkb_set_controls (c : xcb_connection_t_access; deviceSpec : xcb_xkb_device_spec_t; affectInternalRealMods : Libc.Stdint.uint8_t; internalRealMods : Libc.Stdint.uint8_t; affectIgnoreLockRealMods : Libc.Stdint.uint8_t; ignoreLockRealMods : Libc.Stdint.uint8_t; affectInternalVirtualMods : Libc.Stdint.uint16_t; internalVirtualMods : Libc.Stdint.uint16_t; affectIgnoreLockVirtualMods : Libc.Stdint.uint16_t; ignoreLockVirtualMods : Libc.Stdint.uint16_t; mouseKeysDfltBtn : Libc.Stdint.uint8_t; groupsWrap : Libc.Stdint.uint8_t; accessXOptions : Libc.Stdint.uint16_t; affectEnabledControls : Libc.Stdint.uint32_t; enabledControls : Libc.Stdint.uint32_t; changeControls : Libc.Stdint.uint32_t; repeatDelay : Libc.Stdint.uint16_t; repeatInterval : Libc.Stdint.uint16_t; slowKeysDelay : Libc.Stdint.uint16_t; debounceDelay : Libc.Stdint.uint16_t; mouseKeysDelay : Libc.Stdint.uint16_t; mouseKeysInterval : Libc.Stdint.uint16_t; mouseKeysTimeToMax : Libc.Stdint.uint16_t; mouseKeysMaxSpeed : Libc.Stdint.uint16_t; mouseKeysCurve : Libc.Stdint.int16_t; accessXTimeout : Libc.Stdint.uint16_t; accessXTimeoutMask : Libc.Stdint.uint32_t; accessXTimeoutValues : Libc.Stdint.uint32_t; accessXTimeoutOptionsMask : Libc.Stdint.uint16_t; accessXTimeoutOptionsValues : Libc.Stdint.uint16_t; perKeyRepeat : access Libc.Stdint.uint8_t) return XCB.xcb_void_cookie_t; -- /usr/include/xcb/xkb.h:6974 pragma Import (C, xcb_xkb_set_controls, "xcb_xkb_set_controls"); function xcb_xkb_get_map_map_types_rtrn_length (R : System.Address; S : System.Address) return int; -- /usr/include/xcb/xkb.h:7017 pragma Import (C, xcb_xkb_get_map_map_types_rtrn_length, "xcb_xkb_get_map_map_types_rtrn_length"); function xcb_xkb_get_map_map_types_rtrn_iterator (R : System.Address; S : System.Address) return xcb_xkb_key_type_iterator_t; -- /usr/include/xcb/xkb.h:7031 pragma Import (C, xcb_xkb_get_map_map_types_rtrn_iterator, "xcb_xkb_get_map_map_types_rtrn_iterator"); function xcb_xkb_get_map_map_syms_rtrn_length (R : System.Address; S : System.Address) return int; -- /usr/include/xcb/xkb.h:7045 pragma Import (C, xcb_xkb_get_map_map_syms_rtrn_length, "xcb_xkb_get_map_map_syms_rtrn_length"); function xcb_xkb_get_map_map_syms_rtrn_iterator (R : System.Address; S : System.Address) return xcb_xkb_key_sym_map_iterator_t; -- /usr/include/xcb/xkb.h:7059 pragma Import (C, xcb_xkb_get_map_map_syms_rtrn_iterator, "xcb_xkb_get_map_map_syms_rtrn_iterator"); function xcb_xkb_get_map_map_acts_rtrn_count (S : System.Address) return access Libc.Stdint.uint8_t; -- /usr/include/xcb/xkb.h:7073 pragma Import (C, xcb_xkb_get_map_map_acts_rtrn_count, "xcb_xkb_get_map_map_acts_rtrn_count"); function xcb_xkb_get_map_map_acts_rtrn_count_length (R : System.Address; S : System.Address) return int; -- /usr/include/xcb/xkb.h:7086 pragma Import (C, xcb_xkb_get_map_map_acts_rtrn_count_length, "xcb_xkb_get_map_map_acts_rtrn_count_length"); function xcb_xkb_get_map_map_acts_rtrn_count_end (R : System.Address; S : System.Address) return XCB.xcb_generic_iterator_t; -- /usr/include/xcb/xkb.h:7100 pragma Import (C, xcb_xkb_get_map_map_acts_rtrn_count_end, "xcb_xkb_get_map_map_acts_rtrn_count_end"); function xcb_xkb_get_map_map_alignment_pad (S : System.Address) return access Libc.Stdint.uint8_t; -- /usr/include/xcb/xkb.h:7114 pragma Import (C, xcb_xkb_get_map_map_alignment_pad, "xcb_xkb_get_map_map_alignment_pad"); function xcb_xkb_get_map_map_alignment_pad_length (R : System.Address; S : System.Address) return int; -- /usr/include/xcb/xkb.h:7127 pragma Import (C, xcb_xkb_get_map_map_alignment_pad_length, "xcb_xkb_get_map_map_alignment_pad_length"); function xcb_xkb_get_map_map_alignment_pad_end (R : System.Address; S : System.Address) return XCB.xcb_generic_iterator_t; -- /usr/include/xcb/xkb.h:7141 pragma Import (C, xcb_xkb_get_map_map_alignment_pad_end, "xcb_xkb_get_map_map_alignment_pad_end"); function xcb_xkb_get_map_map_acts_rtrn_acts (S : System.Address) return access xcb_xkb_action_t; -- /usr/include/xcb/xkb.h:7155 pragma Import (C, xcb_xkb_get_map_map_acts_rtrn_acts, "xcb_xkb_get_map_map_acts_rtrn_acts"); function xcb_xkb_get_map_map_acts_rtrn_acts_length (R : System.Address; S : System.Address) return int; -- /usr/include/xcb/xkb.h:7168 pragma Import (C, xcb_xkb_get_map_map_acts_rtrn_acts_length, "xcb_xkb_get_map_map_acts_rtrn_acts_length"); function xcb_xkb_get_map_map_acts_rtrn_acts_iterator (R : System.Address; S : System.Address) return xcb_xkb_action_iterator_t; -- /usr/include/xcb/xkb.h:7182 pragma Import (C, xcb_xkb_get_map_map_acts_rtrn_acts_iterator, "xcb_xkb_get_map_map_acts_rtrn_acts_iterator"); function xcb_xkb_get_map_map_behaviors_rtrn (S : System.Address) return access xcb_xkb_set_behavior_t; -- /usr/include/xcb/xkb.h:7196 pragma Import (C, xcb_xkb_get_map_map_behaviors_rtrn, "xcb_xkb_get_map_map_behaviors_rtrn"); function xcb_xkb_get_map_map_behaviors_rtrn_length (R : System.Address; S : System.Address) return int; -- /usr/include/xcb/xkb.h:7209 pragma Import (C, xcb_xkb_get_map_map_behaviors_rtrn_length, "xcb_xkb_get_map_map_behaviors_rtrn_length"); function xcb_xkb_get_map_map_behaviors_rtrn_iterator (R : System.Address; S : System.Address) return xcb_xkb_set_behavior_iterator_t; -- /usr/include/xcb/xkb.h:7223 pragma Import (C, xcb_xkb_get_map_map_behaviors_rtrn_iterator, "xcb_xkb_get_map_map_behaviors_rtrn_iterator"); function xcb_xkb_get_map_map_vmods_rtrn (S : System.Address) return access Libc.Stdint.uint8_t; -- /usr/include/xcb/xkb.h:7237 pragma Import (C, xcb_xkb_get_map_map_vmods_rtrn, "xcb_xkb_get_map_map_vmods_rtrn"); function xcb_xkb_get_map_map_vmods_rtrn_length (R : System.Address; S : System.Address) return int; -- /usr/include/xcb/xkb.h:7250 pragma Import (C, xcb_xkb_get_map_map_vmods_rtrn_length, "xcb_xkb_get_map_map_vmods_rtrn_length"); function xcb_xkb_get_map_map_vmods_rtrn_end (R : System.Address; S : System.Address) return XCB.xcb_generic_iterator_t; -- /usr/include/xcb/xkb.h:7264 pragma Import (C, xcb_xkb_get_map_map_vmods_rtrn_end, "xcb_xkb_get_map_map_vmods_rtrn_end"); function xcb_xkb_get_map_map_alignment_pad_2 (S : System.Address) return access Libc.Stdint.uint8_t; -- /usr/include/xcb/xkb.h:7278 pragma Import (C, xcb_xkb_get_map_map_alignment_pad_2, "xcb_xkb_get_map_map_alignment_pad_2"); function xcb_xkb_get_map_map_alignment_pad_2_length (R : System.Address; S : System.Address) return int; -- /usr/include/xcb/xkb.h:7291 pragma Import (C, xcb_xkb_get_map_map_alignment_pad_2_length, "xcb_xkb_get_map_map_alignment_pad_2_length"); function xcb_xkb_get_map_map_alignment_pad_2_end (R : System.Address; S : System.Address) return XCB.xcb_generic_iterator_t; -- /usr/include/xcb/xkb.h:7305 pragma Import (C, xcb_xkb_get_map_map_alignment_pad_2_end, "xcb_xkb_get_map_map_alignment_pad_2_end"); function xcb_xkb_get_map_map_explicit_rtrn (S : System.Address) return access xcb_xkb_set_explicit_t; -- /usr/include/xcb/xkb.h:7319 pragma Import (C, xcb_xkb_get_map_map_explicit_rtrn, "xcb_xkb_get_map_map_explicit_rtrn"); function xcb_xkb_get_map_map_explicit_rtrn_length (R : System.Address; S : System.Address) return int; -- /usr/include/xcb/xkb.h:7332 pragma Import (C, xcb_xkb_get_map_map_explicit_rtrn_length, "xcb_xkb_get_map_map_explicit_rtrn_length"); function xcb_xkb_get_map_map_explicit_rtrn_iterator (R : System.Address; S : System.Address) return xcb_xkb_set_explicit_iterator_t; -- /usr/include/xcb/xkb.h:7346 pragma Import (C, xcb_xkb_get_map_map_explicit_rtrn_iterator, "xcb_xkb_get_map_map_explicit_rtrn_iterator"); function xcb_xkb_get_map_map_alignment_pad_3 (S : System.Address) return access Libc.Stdint.uint16_t; -- /usr/include/xcb/xkb.h:7360 pragma Import (C, xcb_xkb_get_map_map_alignment_pad_3, "xcb_xkb_get_map_map_alignment_pad_3"); function xcb_xkb_get_map_map_alignment_pad_3_length (R : System.Address; S : System.Address) return int; -- /usr/include/xcb/xkb.h:7373 pragma Import (C, xcb_xkb_get_map_map_alignment_pad_3_length, "xcb_xkb_get_map_map_alignment_pad_3_length"); function xcb_xkb_get_map_map_alignment_pad_3_end (R : System.Address; S : System.Address) return XCB.xcb_generic_iterator_t; -- /usr/include/xcb/xkb.h:7387 pragma Import (C, xcb_xkb_get_map_map_alignment_pad_3_end, "xcb_xkb_get_map_map_alignment_pad_3_end"); function xcb_xkb_get_map_map_modmap_rtrn (S : System.Address) return access xcb_xkb_key_mod_map_t; -- /usr/include/xcb/xkb.h:7401 pragma Import (C, xcb_xkb_get_map_map_modmap_rtrn, "xcb_xkb_get_map_map_modmap_rtrn"); function xcb_xkb_get_map_map_modmap_rtrn_length (R : System.Address; S : System.Address) return int; -- /usr/include/xcb/xkb.h:7414 pragma Import (C, xcb_xkb_get_map_map_modmap_rtrn_length, "xcb_xkb_get_map_map_modmap_rtrn_length"); function xcb_xkb_get_map_map_modmap_rtrn_iterator (R : System.Address; S : System.Address) return xcb_xkb_key_mod_map_iterator_t; -- /usr/include/xcb/xkb.h:7428 pragma Import (C, xcb_xkb_get_map_map_modmap_rtrn_iterator, "xcb_xkb_get_map_map_modmap_rtrn_iterator"); function xcb_xkb_get_map_map_alignment_pad_4 (S : System.Address) return access Libc.Stdint.uint16_t; -- /usr/include/xcb/xkb.h:7442 pragma Import (C, xcb_xkb_get_map_map_alignment_pad_4, "xcb_xkb_get_map_map_alignment_pad_4"); function xcb_xkb_get_map_map_alignment_pad_4_length (R : System.Address; S : System.Address) return int; -- /usr/include/xcb/xkb.h:7455 pragma Import (C, xcb_xkb_get_map_map_alignment_pad_4_length, "xcb_xkb_get_map_map_alignment_pad_4_length"); function xcb_xkb_get_map_map_alignment_pad_4_end (R : System.Address; S : System.Address) return XCB.xcb_generic_iterator_t; -- /usr/include/xcb/xkb.h:7469 pragma Import (C, xcb_xkb_get_map_map_alignment_pad_4_end, "xcb_xkb_get_map_map_alignment_pad_4_end"); function xcb_xkb_get_map_map_vmodmap_rtrn (S : System.Address) return access xcb_xkb_key_v_mod_map_t; -- /usr/include/xcb/xkb.h:7483 pragma Import (C, xcb_xkb_get_map_map_vmodmap_rtrn, "xcb_xkb_get_map_map_vmodmap_rtrn"); function xcb_xkb_get_map_map_vmodmap_rtrn_length (R : System.Address; S : System.Address) return int; -- /usr/include/xcb/xkb.h:7496 pragma Import (C, xcb_xkb_get_map_map_vmodmap_rtrn_length, "xcb_xkb_get_map_map_vmodmap_rtrn_length"); function xcb_xkb_get_map_map_vmodmap_rtrn_iterator (R : System.Address; S : System.Address) return xcb_xkb_key_v_mod_map_iterator_t; -- /usr/include/xcb/xkb.h:7510 pragma Import (C, xcb_xkb_get_map_map_vmodmap_rtrn_iterator, "xcb_xkb_get_map_map_vmodmap_rtrn_iterator"); function xcb_xkb_get_map_map_serialize (u_buffer : System.Address; nTypes : Libc.Stdint.uint8_t; nKeySyms : Libc.Stdint.uint8_t; nKeyActions : Libc.Stdint.uint8_t; totalActions : Libc.Stdint.uint16_t; totalKeyBehaviors : Libc.Stdint.uint8_t; virtualMods : Libc.Stdint.uint16_t; totalKeyExplicit : Libc.Stdint.uint8_t; totalModMapKeys : Libc.Stdint.uint8_t; totalVModMapKeys : Libc.Stdint.uint8_t; present : Libc.Stdint.uint16_t; u_aux : System.Address) return int; -- /usr/include/xcb/xkb.h:7514 pragma Import (C, xcb_xkb_get_map_map_serialize, "xcb_xkb_get_map_map_serialize"); function xcb_xkb_get_map_map_unpack (u_buffer : System.Address; nTypes : Libc.Stdint.uint8_t; nKeySyms : Libc.Stdint.uint8_t; nKeyActions : Libc.Stdint.uint8_t; totalActions : Libc.Stdint.uint16_t; totalKeyBehaviors : Libc.Stdint.uint8_t; virtualMods : Libc.Stdint.uint16_t; totalKeyExplicit : Libc.Stdint.uint8_t; totalModMapKeys : Libc.Stdint.uint8_t; totalVModMapKeys : Libc.Stdint.uint8_t; present : Libc.Stdint.uint16_t; u_aux : access xcb_xkb_get_map_map_t) return int; -- /usr/include/xcb/xkb.h:7528 pragma Import (C, xcb_xkb_get_map_map_unpack, "xcb_xkb_get_map_map_unpack"); function xcb_xkb_get_map_map_sizeof (u_buffer : System.Address; nTypes : Libc.Stdint.uint8_t; nKeySyms : Libc.Stdint.uint8_t; nKeyActions : Libc.Stdint.uint8_t; totalActions : Libc.Stdint.uint16_t; totalKeyBehaviors : Libc.Stdint.uint8_t; virtualMods : Libc.Stdint.uint16_t; totalKeyExplicit : Libc.Stdint.uint8_t; totalModMapKeys : Libc.Stdint.uint8_t; totalVModMapKeys : Libc.Stdint.uint8_t; present : Libc.Stdint.uint16_t) return int; -- /usr/include/xcb/xkb.h:7542 pragma Import (C, xcb_xkb_get_map_map_sizeof, "xcb_xkb_get_map_map_sizeof"); function xcb_xkb_get_map (c : xcb_connection_t_access; deviceSpec : xcb_xkb_device_spec_t; full : Libc.Stdint.uint16_t; partial : Libc.Stdint.uint16_t; firstType : Libc.Stdint.uint8_t; nTypes : Libc.Stdint.uint8_t; firstKeySym : XCB.XProto.xcb_keycode_t; nKeySyms : Libc.Stdint.uint8_t; firstKeyAction : XCB.XProto.xcb_keycode_t; nKeyActions : Libc.Stdint.uint8_t; firstKeyBehavior : XCB.XProto.xcb_keycode_t; nKeyBehaviors : Libc.Stdint.uint8_t; virtualMods : Libc.Stdint.uint16_t; firstKeyExplicit : XCB.XProto.xcb_keycode_t; nKeyExplicit : Libc.Stdint.uint8_t; firstModMapKey : XCB.XProto.xcb_keycode_t; nModMapKeys : Libc.Stdint.uint8_t; firstVModMapKey : XCB.XProto.xcb_keycode_t; nVModMapKeys : Libc.Stdint.uint8_t) return xcb_xkb_get_map_cookie_t; -- /usr/include/xcb/xkb.h:7591 pragma Import (C, xcb_xkb_get_map, "xcb_xkb_get_map"); function xcb_xkb_get_map_unchecked (c : xcb_connection_t_access; deviceSpec : xcb_xkb_device_spec_t; full : Libc.Stdint.uint16_t; partial : Libc.Stdint.uint16_t; firstType : Libc.Stdint.uint8_t; nTypes : Libc.Stdint.uint8_t; firstKeySym : XCB.XProto.xcb_keycode_t; nKeySyms : Libc.Stdint.uint8_t; firstKeyAction : XCB.XProto.xcb_keycode_t; nKeyActions : Libc.Stdint.uint8_t; firstKeyBehavior : XCB.XProto.xcb_keycode_t; nKeyBehaviors : Libc.Stdint.uint8_t; virtualMods : Libc.Stdint.uint16_t; firstKeyExplicit : XCB.XProto.xcb_keycode_t; nKeyExplicit : Libc.Stdint.uint8_t; firstModMapKey : XCB.XProto.xcb_keycode_t; nModMapKeys : Libc.Stdint.uint8_t; firstVModMapKey : XCB.XProto.xcb_keycode_t; nVModMapKeys : Libc.Stdint.uint8_t) return xcb_xkb_get_map_cookie_t; -- /usr/include/xcb/xkb.h:7651 pragma Import (C, xcb_xkb_get_map_unchecked, "xcb_xkb_get_map_unchecked"); function xcb_xkb_get_map_map (R : System.Address) return System.Address; -- /usr/include/xcb/xkb.h:7682 pragma Import (C, xcb_xkb_get_map_map, "xcb_xkb_get_map_map"); function xcb_xkb_get_map_reply (c : xcb_connection_t_access; cookie : xcb_xkb_get_map_cookie_t; e : access xcb_generic_error_t_access) return access xcb_xkb_get_map_reply_t; -- /usr/include/xcb/xkb.h:7711 pragma Import (C, xcb_xkb_get_map_reply, "xcb_xkb_get_map_reply"); function xcb_xkb_set_map_values_types_length (R : System.Address; S : System.Address) return int; -- /usr/include/xcb/xkb.h:7726 pragma Import (C, xcb_xkb_set_map_values_types_length, "xcb_xkb_set_map_values_types_length"); function xcb_xkb_set_map_values_types_iterator (R : System.Address; S : System.Address) return xcb_xkb_set_key_type_iterator_t; -- /usr/include/xcb/xkb.h:7740 pragma Import (C, xcb_xkb_set_map_values_types_iterator, "xcb_xkb_set_map_values_types_iterator"); function xcb_xkb_set_map_values_syms_length (R : System.Address; S : System.Address) return int; -- /usr/include/xcb/xkb.h:7754 pragma Import (C, xcb_xkb_set_map_values_syms_length, "xcb_xkb_set_map_values_syms_length"); function xcb_xkb_set_map_values_syms_iterator (R : System.Address; S : System.Address) return xcb_xkb_key_sym_map_iterator_t; -- /usr/include/xcb/xkb.h:7768 pragma Import (C, xcb_xkb_set_map_values_syms_iterator, "xcb_xkb_set_map_values_syms_iterator"); function xcb_xkb_set_map_values_actions_count (S : System.Address) return access Libc.Stdint.uint8_t; -- /usr/include/xcb/xkb.h:7782 pragma Import (C, xcb_xkb_set_map_values_actions_count, "xcb_xkb_set_map_values_actions_count"); function xcb_xkb_set_map_values_actions_count_length (R : System.Address; S : System.Address) return int; -- /usr/include/xcb/xkb.h:7795 pragma Import (C, xcb_xkb_set_map_values_actions_count_length, "xcb_xkb_set_map_values_actions_count_length"); function xcb_xkb_set_map_values_actions_count_end (R : System.Address; S : System.Address) return XCB.xcb_generic_iterator_t; -- /usr/include/xcb/xkb.h:7809 pragma Import (C, xcb_xkb_set_map_values_actions_count_end, "xcb_xkb_set_map_values_actions_count_end"); function xcb_xkb_set_map_values_actions (S : System.Address) return access xcb_xkb_action_t; -- /usr/include/xcb/xkb.h:7823 pragma Import (C, xcb_xkb_set_map_values_actions, "xcb_xkb_set_map_values_actions"); function xcb_xkb_set_map_values_actions_length (R : System.Address; S : System.Address) return int; -- /usr/include/xcb/xkb.h:7836 pragma Import (C, xcb_xkb_set_map_values_actions_length, "xcb_xkb_set_map_values_actions_length"); function xcb_xkb_set_map_values_actions_iterator (R : System.Address; S : System.Address) return xcb_xkb_action_iterator_t; -- /usr/include/xcb/xkb.h:7850 pragma Import (C, xcb_xkb_set_map_values_actions_iterator, "xcb_xkb_set_map_values_actions_iterator"); function xcb_xkb_set_map_values_behaviors (S : System.Address) return access xcb_xkb_set_behavior_t; -- /usr/include/xcb/xkb.h:7864 pragma Import (C, xcb_xkb_set_map_values_behaviors, "xcb_xkb_set_map_values_behaviors"); function xcb_xkb_set_map_values_behaviors_length (R : System.Address; S : System.Address) return int; -- /usr/include/xcb/xkb.h:7877 pragma Import (C, xcb_xkb_set_map_values_behaviors_length, "xcb_xkb_set_map_values_behaviors_length"); function xcb_xkb_set_map_values_behaviors_iterator (R : System.Address; S : System.Address) return xcb_xkb_set_behavior_iterator_t; -- /usr/include/xcb/xkb.h:7891 pragma Import (C, xcb_xkb_set_map_values_behaviors_iterator, "xcb_xkb_set_map_values_behaviors_iterator"); function xcb_xkb_set_map_values_vmods (S : System.Address) return access Libc.Stdint.uint8_t; -- /usr/include/xcb/xkb.h:7905 pragma Import (C, xcb_xkb_set_map_values_vmods, "xcb_xkb_set_map_values_vmods"); function xcb_xkb_set_map_values_vmods_length (R : System.Address; S : System.Address) return int; -- /usr/include/xcb/xkb.h:7918 pragma Import (C, xcb_xkb_set_map_values_vmods_length, "xcb_xkb_set_map_values_vmods_length"); function xcb_xkb_set_map_values_vmods_end (R : System.Address; S : System.Address) return XCB.xcb_generic_iterator_t; -- /usr/include/xcb/xkb.h:7932 pragma Import (C, xcb_xkb_set_map_values_vmods_end, "xcb_xkb_set_map_values_vmods_end"); function xcb_xkb_set_map_values_explicit (S : System.Address) return access xcb_xkb_set_explicit_t; -- /usr/include/xcb/xkb.h:7946 pragma Import (C, xcb_xkb_set_map_values_explicit, "xcb_xkb_set_map_values_explicit"); function xcb_xkb_set_map_values_explicit_length (R : System.Address; S : System.Address) return int; -- /usr/include/xcb/xkb.h:7959 pragma Import (C, xcb_xkb_set_map_values_explicit_length, "xcb_xkb_set_map_values_explicit_length"); function xcb_xkb_set_map_values_explicit_iterator (R : System.Address; S : System.Address) return xcb_xkb_set_explicit_iterator_t; -- /usr/include/xcb/xkb.h:7973 pragma Import (C, xcb_xkb_set_map_values_explicit_iterator, "xcb_xkb_set_map_values_explicit_iterator"); function xcb_xkb_set_map_values_modmap (S : System.Address) return access xcb_xkb_key_mod_map_t; -- /usr/include/xcb/xkb.h:7987 pragma Import (C, xcb_xkb_set_map_values_modmap, "xcb_xkb_set_map_values_modmap"); function xcb_xkb_set_map_values_modmap_length (R : System.Address; S : System.Address) return int; -- /usr/include/xcb/xkb.h:8000 pragma Import (C, xcb_xkb_set_map_values_modmap_length, "xcb_xkb_set_map_values_modmap_length"); function xcb_xkb_set_map_values_modmap_iterator (R : System.Address; S : System.Address) return xcb_xkb_key_mod_map_iterator_t; -- /usr/include/xcb/xkb.h:8014 pragma Import (C, xcb_xkb_set_map_values_modmap_iterator, "xcb_xkb_set_map_values_modmap_iterator"); function xcb_xkb_set_map_values_vmodmap (S : System.Address) return access xcb_xkb_key_v_mod_map_t; -- /usr/include/xcb/xkb.h:8028 pragma Import (C, xcb_xkb_set_map_values_vmodmap, "xcb_xkb_set_map_values_vmodmap"); function xcb_xkb_set_map_values_vmodmap_length (R : System.Address; S : System.Address) return int; -- /usr/include/xcb/xkb.h:8041 pragma Import (C, xcb_xkb_set_map_values_vmodmap_length, "xcb_xkb_set_map_values_vmodmap_length"); function xcb_xkb_set_map_values_vmodmap_iterator (R : System.Address; S : System.Address) return xcb_xkb_key_v_mod_map_iterator_t; -- /usr/include/xcb/xkb.h:8055 pragma Import (C, xcb_xkb_set_map_values_vmodmap_iterator, "xcb_xkb_set_map_values_vmodmap_iterator"); function xcb_xkb_set_map_values_serialize (u_buffer : System.Address; nTypes : Libc.Stdint.uint8_t; nKeySyms : Libc.Stdint.uint8_t; nKeyActions : Libc.Stdint.uint8_t; totalActions : Libc.Stdint.uint16_t; totalKeyBehaviors : Libc.Stdint.uint8_t; virtualMods : Libc.Stdint.uint16_t; totalKeyExplicit : Libc.Stdint.uint8_t; totalModMapKeys : Libc.Stdint.uint8_t; totalVModMapKeys : Libc.Stdint.uint8_t; present : Libc.Stdint.uint16_t; u_aux : System.Address) return int; -- /usr/include/xcb/xkb.h:8059 pragma Import (C, xcb_xkb_set_map_values_serialize, "xcb_xkb_set_map_values_serialize"); function xcb_xkb_set_map_values_unpack (u_buffer : System.Address; nTypes : Libc.Stdint.uint8_t; nKeySyms : Libc.Stdint.uint8_t; nKeyActions : Libc.Stdint.uint8_t; totalActions : Libc.Stdint.uint16_t; totalKeyBehaviors : Libc.Stdint.uint8_t; virtualMods : Libc.Stdint.uint16_t; totalKeyExplicit : Libc.Stdint.uint8_t; totalModMapKeys : Libc.Stdint.uint8_t; totalVModMapKeys : Libc.Stdint.uint8_t; present : Libc.Stdint.uint16_t; u_aux : access xcb_xkb_set_map_values_t) return int; -- /usr/include/xcb/xkb.h:8073 pragma Import (C, xcb_xkb_set_map_values_unpack, "xcb_xkb_set_map_values_unpack"); function xcb_xkb_set_map_values_sizeof (u_buffer : System.Address; nTypes : Libc.Stdint.uint8_t; nKeySyms : Libc.Stdint.uint8_t; nKeyActions : Libc.Stdint.uint8_t; totalActions : Libc.Stdint.uint16_t; totalKeyBehaviors : Libc.Stdint.uint8_t; virtualMods : Libc.Stdint.uint16_t; totalKeyExplicit : Libc.Stdint.uint8_t; totalModMapKeys : Libc.Stdint.uint8_t; totalVModMapKeys : Libc.Stdint.uint8_t; present : Libc.Stdint.uint16_t) return int; -- /usr/include/xcb/xkb.h:8087 pragma Import (C, xcb_xkb_set_map_values_sizeof, "xcb_xkb_set_map_values_sizeof"); function xcb_xkb_set_map_checked (c : xcb_connection_t_access; deviceSpec : xcb_xkb_device_spec_t; present : Libc.Stdint.uint16_t; flags : Libc.Stdint.uint16_t; minKeyCode : XCB.XProto.xcb_keycode_t; maxKeyCode : XCB.XProto.xcb_keycode_t; firstType : Libc.Stdint.uint8_t; nTypes : Libc.Stdint.uint8_t; firstKeySym : XCB.XProto.xcb_keycode_t; nKeySyms : Libc.Stdint.uint8_t; totalSyms : Libc.Stdint.uint16_t; firstKeyAction : XCB.XProto.xcb_keycode_t; nKeyActions : Libc.Stdint.uint8_t; totalActions : Libc.Stdint.uint16_t; firstKeyBehavior : XCB.XProto.xcb_keycode_t; nKeyBehaviors : Libc.Stdint.uint8_t; totalKeyBehaviors : Libc.Stdint.uint8_t; firstKeyExplicit : XCB.XProto.xcb_keycode_t; nKeyExplicit : Libc.Stdint.uint8_t; totalKeyExplicit : Libc.Stdint.uint8_t; firstModMapKey : XCB.XProto.xcb_keycode_t; nModMapKeys : Libc.Stdint.uint8_t; totalModMapKeys : Libc.Stdint.uint8_t; firstVModMapKey : XCB.XProto.xcb_keycode_t; nVModMapKeys : Libc.Stdint.uint8_t; totalVModMapKeys : Libc.Stdint.uint8_t; virtualMods : Libc.Stdint.uint16_t; values : System.Address) return XCB.xcb_void_cookie_t; -- /usr/include/xcb/xkb.h:8148 pragma Import (C, xcb_xkb_set_map_checked, "xcb_xkb_set_map_checked"); function xcb_xkb_set_map (c : xcb_connection_t_access; deviceSpec : xcb_xkb_device_spec_t; present : Libc.Stdint.uint16_t; flags : Libc.Stdint.uint16_t; minKeyCode : XCB.XProto.xcb_keycode_t; maxKeyCode : XCB.XProto.xcb_keycode_t; firstType : Libc.Stdint.uint8_t; nTypes : Libc.Stdint.uint8_t; firstKeySym : XCB.XProto.xcb_keycode_t; nKeySyms : Libc.Stdint.uint8_t; totalSyms : Libc.Stdint.uint16_t; firstKeyAction : XCB.XProto.xcb_keycode_t; nKeyActions : Libc.Stdint.uint8_t; totalActions : Libc.Stdint.uint16_t; firstKeyBehavior : XCB.XProto.xcb_keycode_t; nKeyBehaviors : Libc.Stdint.uint8_t; totalKeyBehaviors : Libc.Stdint.uint8_t; firstKeyExplicit : XCB.XProto.xcb_keycode_t; nKeyExplicit : Libc.Stdint.uint8_t; totalKeyExplicit : Libc.Stdint.uint8_t; firstModMapKey : XCB.XProto.xcb_keycode_t; nModMapKeys : Libc.Stdint.uint8_t; totalModMapKeys : Libc.Stdint.uint8_t; firstVModMapKey : XCB.XProto.xcb_keycode_t; nVModMapKeys : Libc.Stdint.uint8_t; totalVModMapKeys : Libc.Stdint.uint8_t; virtualMods : Libc.Stdint.uint16_t; values : System.Address) return XCB.xcb_void_cookie_t; -- /usr/include/xcb/xkb.h:8223 pragma Import (C, xcb_xkb_set_map, "xcb_xkb_set_map"); function xcb_xkb_set_map_aux_checked (c : xcb_connection_t_access; deviceSpec : xcb_xkb_device_spec_t; present : Libc.Stdint.uint16_t; flags : Libc.Stdint.uint16_t; minKeyCode : XCB.XProto.xcb_keycode_t; maxKeyCode : XCB.XProto.xcb_keycode_t; firstType : Libc.Stdint.uint8_t; nTypes : Libc.Stdint.uint8_t; firstKeySym : XCB.XProto.xcb_keycode_t; nKeySyms : Libc.Stdint.uint8_t; totalSyms : Libc.Stdint.uint16_t; firstKeyAction : XCB.XProto.xcb_keycode_t; nKeyActions : Libc.Stdint.uint8_t; totalActions : Libc.Stdint.uint16_t; firstKeyBehavior : XCB.XProto.xcb_keycode_t; nKeyBehaviors : Libc.Stdint.uint8_t; totalKeyBehaviors : Libc.Stdint.uint8_t; firstKeyExplicit : XCB.XProto.xcb_keycode_t; nKeyExplicit : Libc.Stdint.uint8_t; totalKeyExplicit : Libc.Stdint.uint8_t; firstModMapKey : XCB.XProto.xcb_keycode_t; nModMapKeys : Libc.Stdint.uint8_t; totalModMapKeys : Libc.Stdint.uint8_t; firstVModMapKey : XCB.XProto.xcb_keycode_t; nVModMapKeys : Libc.Stdint.uint8_t; totalVModMapKeys : Libc.Stdint.uint8_t; virtualMods : Libc.Stdint.uint16_t; values : System.Address) return XCB.xcb_void_cookie_t; -- /usr/include/xcb/xkb.h:8301 pragma Import (C, xcb_xkb_set_map_aux_checked, "xcb_xkb_set_map_aux_checked"); function xcb_xkb_set_map_aux (c : xcb_connection_t_access; deviceSpec : xcb_xkb_device_spec_t; present : Libc.Stdint.uint16_t; flags : Libc.Stdint.uint16_t; minKeyCode : XCB.XProto.xcb_keycode_t; maxKeyCode : XCB.XProto.xcb_keycode_t; firstType : Libc.Stdint.uint8_t; nTypes : Libc.Stdint.uint8_t; firstKeySym : XCB.XProto.xcb_keycode_t; nKeySyms : Libc.Stdint.uint8_t; totalSyms : Libc.Stdint.uint16_t; firstKeyAction : XCB.XProto.xcb_keycode_t; nKeyActions : Libc.Stdint.uint8_t; totalActions : Libc.Stdint.uint16_t; firstKeyBehavior : XCB.XProto.xcb_keycode_t; nKeyBehaviors : Libc.Stdint.uint8_t; totalKeyBehaviors : Libc.Stdint.uint8_t; firstKeyExplicit : XCB.XProto.xcb_keycode_t; nKeyExplicit : Libc.Stdint.uint8_t; totalKeyExplicit : Libc.Stdint.uint8_t; firstModMapKey : XCB.XProto.xcb_keycode_t; nModMapKeys : Libc.Stdint.uint8_t; totalModMapKeys : Libc.Stdint.uint8_t; firstVModMapKey : XCB.XProto.xcb_keycode_t; nVModMapKeys : Libc.Stdint.uint8_t; totalVModMapKeys : Libc.Stdint.uint8_t; virtualMods : Libc.Stdint.uint16_t; values : System.Address) return XCB.xcb_void_cookie_t; -- /usr/include/xcb/xkb.h:8376 pragma Import (C, xcb_xkb_set_map_aux, "xcb_xkb_set_map_aux"); function xcb_xkb_get_compat_map_sizeof (u_buffer : System.Address) return int; -- /usr/include/xcb/xkb.h:8406 pragma Import (C, xcb_xkb_get_compat_map_sizeof, "xcb_xkb_get_compat_map_sizeof"); function xcb_xkb_get_compat_map (c : xcb_connection_t_access; deviceSpec : xcb_xkb_device_spec_t; groups : Libc.Stdint.uint8_t; getAllSI : Libc.Stdint.uint8_t; firstSI : Libc.Stdint.uint16_t; nSI : Libc.Stdint.uint16_t) return xcb_xkb_get_compat_map_cookie_t; -- /usr/include/xcb/xkb.h:8432 pragma Import (C, xcb_xkb_get_compat_map, "xcb_xkb_get_compat_map"); function xcb_xkb_get_compat_map_unchecked (c : xcb_connection_t_access; deviceSpec : xcb_xkb_device_spec_t; groups : Libc.Stdint.uint8_t; getAllSI : Libc.Stdint.uint8_t; firstSI : Libc.Stdint.uint16_t; nSI : Libc.Stdint.uint16_t) return xcb_xkb_get_compat_map_cookie_t; -- /usr/include/xcb/xkb.h:8466 pragma Import (C, xcb_xkb_get_compat_map_unchecked, "xcb_xkb_get_compat_map_unchecked"); function xcb_xkb_get_compat_map_si_rtrn (R : System.Address) return access xcb_xkb_sym_interpret_t; -- /usr/include/xcb/xkb.h:8484 pragma Import (C, xcb_xkb_get_compat_map_si_rtrn, "xcb_xkb_get_compat_map_si_rtrn"); function xcb_xkb_get_compat_map_si_rtrn_length (R : System.Address) return int; -- /usr/include/xcb/xkb.h:8497 pragma Import (C, xcb_xkb_get_compat_map_si_rtrn_length, "xcb_xkb_get_compat_map_si_rtrn_length"); function xcb_xkb_get_compat_map_si_rtrn_iterator (R : System.Address) return xcb_xkb_sym_interpret_iterator_t; -- /usr/include/xcb/xkb.h:8510 pragma Import (C, xcb_xkb_get_compat_map_si_rtrn_iterator, "xcb_xkb_get_compat_map_si_rtrn_iterator"); function xcb_xkb_get_compat_map_group_rtrn (R : System.Address) return access xcb_xkb_mod_def_t; -- /usr/include/xcb/xkb.h:8523 pragma Import (C, xcb_xkb_get_compat_map_group_rtrn, "xcb_xkb_get_compat_map_group_rtrn"); function xcb_xkb_get_compat_map_group_rtrn_length (R : System.Address) return int; -- /usr/include/xcb/xkb.h:8536 pragma Import (C, xcb_xkb_get_compat_map_group_rtrn_length, "xcb_xkb_get_compat_map_group_rtrn_length"); function xcb_xkb_get_compat_map_group_rtrn_iterator (R : System.Address) return xcb_xkb_mod_def_iterator_t; -- /usr/include/xcb/xkb.h:8549 pragma Import (C, xcb_xkb_get_compat_map_group_rtrn_iterator, "xcb_xkb_get_compat_map_group_rtrn_iterator"); function xcb_xkb_get_compat_map_reply (c : xcb_connection_t_access; cookie : xcb_xkb_get_compat_map_cookie_t; e : access xcb_generic_error_t_access) return access xcb_xkb_get_compat_map_reply_t; -- /usr/include/xcb/xkb.h:8578 pragma Import (C, xcb_xkb_get_compat_map_reply, "xcb_xkb_get_compat_map_reply"); function xcb_xkb_set_compat_map_sizeof (u_buffer : System.Address) return int; -- /usr/include/xcb/xkb.h:8583 pragma Import (C, xcb_xkb_set_compat_map_sizeof, "xcb_xkb_set_compat_map_sizeof"); function xcb_xkb_set_compat_map_checked (c : xcb_connection_t_access; deviceSpec : xcb_xkb_device_spec_t; recomputeActions : Libc.Stdint.uint8_t; truncateSI : Libc.Stdint.uint8_t; groups : Libc.Stdint.uint8_t; firstSI : Libc.Stdint.uint16_t; nSI : Libc.Stdint.uint16_t; si : System.Address; groupMaps : System.Address) return XCB.xcb_void_cookie_t; -- /usr/include/xcb/xkb.h:8615 pragma Import (C, xcb_xkb_set_compat_map_checked, "xcb_xkb_set_compat_map_checked"); function xcb_xkb_set_compat_map (c : xcb_connection_t_access; deviceSpec : xcb_xkb_device_spec_t; recomputeActions : Libc.Stdint.uint8_t; truncateSI : Libc.Stdint.uint8_t; groups : Libc.Stdint.uint8_t; firstSI : Libc.Stdint.uint16_t; nSI : Libc.Stdint.uint16_t; si : System.Address; groupMaps : System.Address) return XCB.xcb_void_cookie_t; -- /usr/include/xcb/xkb.h:8652 pragma Import (C, xcb_xkb_set_compat_map, "xcb_xkb_set_compat_map"); function xcb_xkb_get_indicator_state (c : xcb_connection_t_access; deviceSpec : xcb_xkb_device_spec_t) return xcb_xkb_get_indicator_state_cookie_t; -- /usr/include/xcb/xkb.h:8682 pragma Import (C, xcb_xkb_get_indicator_state, "xcb_xkb_get_indicator_state"); function xcb_xkb_get_indicator_state_unchecked (c : xcb_connection_t_access; deviceSpec : xcb_xkb_device_spec_t) return xcb_xkb_get_indicator_state_cookie_t; -- /usr/include/xcb/xkb.h:8708 pragma Import (C, xcb_xkb_get_indicator_state_unchecked, "xcb_xkb_get_indicator_state_unchecked"); function xcb_xkb_get_indicator_state_reply (c : xcb_connection_t_access; cookie : xcb_xkb_get_indicator_state_cookie_t; e : access xcb_generic_error_t_access) return access xcb_xkb_get_indicator_state_reply_t; -- /usr/include/xcb/xkb.h:8738 pragma Import (C, xcb_xkb_get_indicator_state_reply, "xcb_xkb_get_indicator_state_reply"); function xcb_xkb_get_indicator_map_sizeof (u_buffer : System.Address) return int; -- /usr/include/xcb/xkb.h:8743 pragma Import (C, xcb_xkb_get_indicator_map_sizeof, "xcb_xkb_get_indicator_map_sizeof"); function xcb_xkb_get_indicator_map (c : xcb_connection_t_access; deviceSpec : xcb_xkb_device_spec_t; which : Libc.Stdint.uint32_t) return xcb_xkb_get_indicator_map_cookie_t; -- /usr/include/xcb/xkb.h:8766 pragma Import (C, xcb_xkb_get_indicator_map, "xcb_xkb_get_indicator_map"); function xcb_xkb_get_indicator_map_unchecked (c : xcb_connection_t_access; deviceSpec : xcb_xkb_device_spec_t; which : Libc.Stdint.uint32_t) return xcb_xkb_get_indicator_map_cookie_t; -- /usr/include/xcb/xkb.h:8794 pragma Import (C, xcb_xkb_get_indicator_map_unchecked, "xcb_xkb_get_indicator_map_unchecked"); function xcb_xkb_get_indicator_map_maps (R : System.Address) return access xcb_xkb_indicator_map_t; -- /usr/include/xcb/xkb.h:8809 pragma Import (C, xcb_xkb_get_indicator_map_maps, "xcb_xkb_get_indicator_map_maps"); function xcb_xkb_get_indicator_map_maps_length (R : System.Address) return int; -- /usr/include/xcb/xkb.h:8822 pragma Import (C, xcb_xkb_get_indicator_map_maps_length, "xcb_xkb_get_indicator_map_maps_length"); function xcb_xkb_get_indicator_map_maps_iterator (R : System.Address) return xcb_xkb_indicator_map_iterator_t; -- /usr/include/xcb/xkb.h:8835 pragma Import (C, xcb_xkb_get_indicator_map_maps_iterator, "xcb_xkb_get_indicator_map_maps_iterator"); function xcb_xkb_get_indicator_map_reply (c : xcb_connection_t_access; cookie : xcb_xkb_get_indicator_map_cookie_t; e : access xcb_generic_error_t_access) return access xcb_xkb_get_indicator_map_reply_t; -- /usr/include/xcb/xkb.h:8864 pragma Import (C, xcb_xkb_get_indicator_map_reply, "xcb_xkb_get_indicator_map_reply"); function xcb_xkb_set_indicator_map_sizeof (u_buffer : System.Address) return int; -- /usr/include/xcb/xkb.h:8869 pragma Import (C, xcb_xkb_set_indicator_map_sizeof, "xcb_xkb_set_indicator_map_sizeof"); function xcb_xkb_set_indicator_map_checked (c : xcb_connection_t_access; deviceSpec : xcb_xkb_device_spec_t; which : Libc.Stdint.uint32_t; maps : System.Address) return XCB.xcb_void_cookie_t; -- /usr/include/xcb/xkb.h:8896 pragma Import (C, xcb_xkb_set_indicator_map_checked, "xcb_xkb_set_indicator_map_checked"); function xcb_xkb_set_indicator_map (c : xcb_connection_t_access; deviceSpec : xcb_xkb_device_spec_t; which : Libc.Stdint.uint32_t; maps : System.Address) return XCB.xcb_void_cookie_t; -- /usr/include/xcb/xkb.h:8923 pragma Import (C, xcb_xkb_set_indicator_map, "xcb_xkb_set_indicator_map"); function xcb_xkb_get_named_indicator (c : xcb_connection_t_access; deviceSpec : xcb_xkb_device_spec_t; ledClass : xcb_xkb_led_class_spec_t; ledID : xcb_xkb_id_spec_t; indicator : XCB.XProto.xcb_atom_t) return xcb_xkb_get_named_indicator_cookie_t; -- /usr/include/xcb/xkb.h:8951 pragma Import (C, xcb_xkb_get_named_indicator, "xcb_xkb_get_named_indicator"); function xcb_xkb_get_named_indicator_unchecked (c : xcb_connection_t_access; deviceSpec : xcb_xkb_device_spec_t; ledClass : xcb_xkb_led_class_spec_t; ledID : xcb_xkb_id_spec_t; indicator : XCB.XProto.xcb_atom_t) return xcb_xkb_get_named_indicator_cookie_t; -- /usr/include/xcb/xkb.h:8983 pragma Import (C, xcb_xkb_get_named_indicator_unchecked, "xcb_xkb_get_named_indicator_unchecked"); function xcb_xkb_get_named_indicator_reply (c : xcb_connection_t_access; cookie : xcb_xkb_get_named_indicator_cookie_t; e : access xcb_generic_error_t_access) return access xcb_xkb_get_named_indicator_reply_t; -- /usr/include/xcb/xkb.h:9016 pragma Import (C, xcb_xkb_get_named_indicator_reply, "xcb_xkb_get_named_indicator_reply"); function xcb_xkb_set_named_indicator_checked (c : xcb_connection_t_access; deviceSpec : xcb_xkb_device_spec_t; ledClass : xcb_xkb_led_class_spec_t; ledID : xcb_xkb_id_spec_t; indicator : XCB.XProto.xcb_atom_t; setState : Libc.Stdint.uint8_t; on : Libc.Stdint.uint8_t; setMap : Libc.Stdint.uint8_t; createMap : Libc.Stdint.uint8_t; map_flags : Libc.Stdint.uint8_t; map_whichGroups : Libc.Stdint.uint8_t; map_groups : Libc.Stdint.uint8_t; map_whichMods : Libc.Stdint.uint8_t; map_realMods : Libc.Stdint.uint8_t; map_vmods : Libc.Stdint.uint16_t; map_ctrls : Libc.Stdint.uint32_t) return XCB.xcb_void_cookie_t; -- /usr/include/xcb/xkb.h:9057 pragma Import (C, xcb_xkb_set_named_indicator_checked, "xcb_xkb_set_named_indicator_checked"); function xcb_xkb_set_named_indicator (c : xcb_connection_t_access; deviceSpec : xcb_xkb_device_spec_t; ledClass : xcb_xkb_led_class_spec_t; ledID : xcb_xkb_id_spec_t; indicator : XCB.XProto.xcb_atom_t; setState : Libc.Stdint.uint8_t; on : Libc.Stdint.uint8_t; setMap : Libc.Stdint.uint8_t; createMap : Libc.Stdint.uint8_t; map_flags : Libc.Stdint.uint8_t; map_whichGroups : Libc.Stdint.uint8_t; map_groups : Libc.Stdint.uint8_t; map_whichMods : Libc.Stdint.uint8_t; map_realMods : Libc.Stdint.uint8_t; map_vmods : Libc.Stdint.uint16_t; map_ctrls : Libc.Stdint.uint32_t) return XCB.xcb_void_cookie_t; -- /usr/include/xcb/xkb.h:9108 pragma Import (C, xcb_xkb_set_named_indicator, "xcb_xkb_set_named_indicator"); function xcb_xkb_get_names_value_list_type_names (S : System.Address) return access XCB.XProto.xcb_atom_t; -- /usr/include/xcb/xkb.h:9136 pragma Import (C, xcb_xkb_get_names_value_list_type_names, "xcb_xkb_get_names_value_list_type_names"); function xcb_xkb_get_names_value_list_type_names_length (R : System.Address; S : System.Address) return int; -- /usr/include/xcb/xkb.h:9149 pragma Import (C, xcb_xkb_get_names_value_list_type_names_length, "xcb_xkb_get_names_value_list_type_names_length"); function xcb_xkb_get_names_value_list_type_names_end (R : System.Address; S : System.Address) return XCB.xcb_generic_iterator_t; -- /usr/include/xcb/xkb.h:9163 pragma Import (C, xcb_xkb_get_names_value_list_type_names_end, "xcb_xkb_get_names_value_list_type_names_end"); function xcb_xkb_get_names_value_list_n_levels_per_type (S : System.Address) return access Libc.Stdint.uint8_t; -- /usr/include/xcb/xkb.h:9177 pragma Import (C, xcb_xkb_get_names_value_list_n_levels_per_type, "xcb_xkb_get_names_value_list_n_levels_per_type"); function xcb_xkb_get_names_value_list_n_levels_per_type_length (R : System.Address; S : System.Address) return int; -- /usr/include/xcb/xkb.h:9190 pragma Import (C, xcb_xkb_get_names_value_list_n_levels_per_type_length, "xcb_xkb_get_names_value_list_n_levels_per_type_length"); function xcb_xkb_get_names_value_list_n_levels_per_type_end (R : System.Address; S : System.Address) return XCB.xcb_generic_iterator_t; -- /usr/include/xcb/xkb.h:9204 pragma Import (C, xcb_xkb_get_names_value_list_n_levels_per_type_end, "xcb_xkb_get_names_value_list_n_levels_per_type_end"); function xcb_xkb_get_names_value_list_alignment_pad (S : System.Address) return access Libc.Stdint.uint8_t; -- /usr/include/xcb/xkb.h:9218 pragma Import (C, xcb_xkb_get_names_value_list_alignment_pad, "xcb_xkb_get_names_value_list_alignment_pad"); function xcb_xkb_get_names_value_list_alignment_pad_length (R : System.Address; S : System.Address) return int; -- /usr/include/xcb/xkb.h:9231 pragma Import (C, xcb_xkb_get_names_value_list_alignment_pad_length, "xcb_xkb_get_names_value_list_alignment_pad_length"); function xcb_xkb_get_names_value_list_alignment_pad_end (R : System.Address; S : System.Address) return XCB.xcb_generic_iterator_t; -- /usr/include/xcb/xkb.h:9245 pragma Import (C, xcb_xkb_get_names_value_list_alignment_pad_end, "xcb_xkb_get_names_value_list_alignment_pad_end"); function xcb_xkb_get_names_value_list_kt_level_names (S : System.Address) return access XCB.XProto.xcb_atom_t; -- /usr/include/xcb/xkb.h:9259 pragma Import (C, xcb_xkb_get_names_value_list_kt_level_names, "xcb_xkb_get_names_value_list_kt_level_names"); function xcb_xkb_get_names_value_list_kt_level_names_length (R : System.Address; S : System.Address) return int; -- /usr/include/xcb/xkb.h:9272 pragma Import (C, xcb_xkb_get_names_value_list_kt_level_names_length, "xcb_xkb_get_names_value_list_kt_level_names_length"); function xcb_xkb_get_names_value_list_kt_level_names_end (R : System.Address; S : System.Address) return XCB.xcb_generic_iterator_t; -- /usr/include/xcb/xkb.h:9286 pragma Import (C, xcb_xkb_get_names_value_list_kt_level_names_end, "xcb_xkb_get_names_value_list_kt_level_names_end"); function xcb_xkb_get_names_value_list_indicator_names (S : System.Address) return access XCB.XProto.xcb_atom_t; -- /usr/include/xcb/xkb.h:9300 pragma Import (C, xcb_xkb_get_names_value_list_indicator_names, "xcb_xkb_get_names_value_list_indicator_names"); function xcb_xkb_get_names_value_list_indicator_names_length (R : System.Address; S : System.Address) return int; -- /usr/include/xcb/xkb.h:9313 pragma Import (C, xcb_xkb_get_names_value_list_indicator_names_length, "xcb_xkb_get_names_value_list_indicator_names_length"); function xcb_xkb_get_names_value_list_indicator_names_end (R : System.Address; S : System.Address) return XCB.xcb_generic_iterator_t; -- /usr/include/xcb/xkb.h:9327 pragma Import (C, xcb_xkb_get_names_value_list_indicator_names_end, "xcb_xkb_get_names_value_list_indicator_names_end"); function xcb_xkb_get_names_value_list_virtual_mod_names (S : System.Address) return access XCB.XProto.xcb_atom_t; -- /usr/include/xcb/xkb.h:9341 pragma Import (C, xcb_xkb_get_names_value_list_virtual_mod_names, "xcb_xkb_get_names_value_list_virtual_mod_names"); function xcb_xkb_get_names_value_list_virtual_mod_names_length (R : System.Address; S : System.Address) return int; -- /usr/include/xcb/xkb.h:9354 pragma Import (C, xcb_xkb_get_names_value_list_virtual_mod_names_length, "xcb_xkb_get_names_value_list_virtual_mod_names_length"); function xcb_xkb_get_names_value_list_virtual_mod_names_end (R : System.Address; S : System.Address) return XCB.xcb_generic_iterator_t; -- /usr/include/xcb/xkb.h:9368 pragma Import (C, xcb_xkb_get_names_value_list_virtual_mod_names_end, "xcb_xkb_get_names_value_list_virtual_mod_names_end"); function xcb_xkb_get_names_value_list_groups (S : System.Address) return access XCB.XProto.xcb_atom_t; -- /usr/include/xcb/xkb.h:9382 pragma Import (C, xcb_xkb_get_names_value_list_groups, "xcb_xkb_get_names_value_list_groups"); function xcb_xkb_get_names_value_list_groups_length (R : System.Address; S : System.Address) return int; -- /usr/include/xcb/xkb.h:9395 pragma Import (C, xcb_xkb_get_names_value_list_groups_length, "xcb_xkb_get_names_value_list_groups_length"); function xcb_xkb_get_names_value_list_groups_end (R : System.Address; S : System.Address) return XCB.xcb_generic_iterator_t; -- /usr/include/xcb/xkb.h:9409 pragma Import (C, xcb_xkb_get_names_value_list_groups_end, "xcb_xkb_get_names_value_list_groups_end"); function xcb_xkb_get_names_value_list_key_names (S : System.Address) return access xcb_xkb_key_name_t; -- /usr/include/xcb/xkb.h:9423 pragma Import (C, xcb_xkb_get_names_value_list_key_names, "xcb_xkb_get_names_value_list_key_names"); function xcb_xkb_get_names_value_list_key_names_length (R : System.Address; S : System.Address) return int; -- /usr/include/xcb/xkb.h:9436 pragma Import (C, xcb_xkb_get_names_value_list_key_names_length, "xcb_xkb_get_names_value_list_key_names_length"); function xcb_xkb_get_names_value_list_key_names_iterator (R : System.Address; S : System.Address) return xcb_xkb_key_name_iterator_t; -- /usr/include/xcb/xkb.h:9450 pragma Import (C, xcb_xkb_get_names_value_list_key_names_iterator, "xcb_xkb_get_names_value_list_key_names_iterator"); function xcb_xkb_get_names_value_list_key_aliases (S : System.Address) return access xcb_xkb_key_alias_t; -- /usr/include/xcb/xkb.h:9464 pragma Import (C, xcb_xkb_get_names_value_list_key_aliases, "xcb_xkb_get_names_value_list_key_aliases"); function xcb_xkb_get_names_value_list_key_aliases_length (R : System.Address; S : System.Address) return int; -- /usr/include/xcb/xkb.h:9477 pragma Import (C, xcb_xkb_get_names_value_list_key_aliases_length, "xcb_xkb_get_names_value_list_key_aliases_length"); function xcb_xkb_get_names_value_list_key_aliases_iterator (R : System.Address; S : System.Address) return xcb_xkb_key_alias_iterator_t; -- /usr/include/xcb/xkb.h:9491 pragma Import (C, xcb_xkb_get_names_value_list_key_aliases_iterator, "xcb_xkb_get_names_value_list_key_aliases_iterator"); function xcb_xkb_get_names_value_list_radio_group_names (S : System.Address) return access XCB.XProto.xcb_atom_t; -- /usr/include/xcb/xkb.h:9505 pragma Import (C, xcb_xkb_get_names_value_list_radio_group_names, "xcb_xkb_get_names_value_list_radio_group_names"); function xcb_xkb_get_names_value_list_radio_group_names_length (R : System.Address; S : System.Address) return int; -- /usr/include/xcb/xkb.h:9518 pragma Import (C, xcb_xkb_get_names_value_list_radio_group_names_length, "xcb_xkb_get_names_value_list_radio_group_names_length"); function xcb_xkb_get_names_value_list_radio_group_names_end (R : System.Address; S : System.Address) return XCB.xcb_generic_iterator_t; -- /usr/include/xcb/xkb.h:9532 pragma Import (C, xcb_xkb_get_names_value_list_radio_group_names_end, "xcb_xkb_get_names_value_list_radio_group_names_end"); function xcb_xkb_get_names_value_list_serialize (u_buffer : System.Address; nTypes : Libc.Stdint.uint8_t; indicators : Libc.Stdint.uint32_t; virtualMods : Libc.Stdint.uint16_t; groupNames : Libc.Stdint.uint8_t; nKeys : Libc.Stdint.uint8_t; nKeyAliases : Libc.Stdint.uint8_t; nRadioGroups : Libc.Stdint.uint8_t; which : Libc.Stdint.uint32_t; u_aux : System.Address) return int; -- /usr/include/xcb/xkb.h:9536 pragma Import (C, xcb_xkb_get_names_value_list_serialize, "xcb_xkb_get_names_value_list_serialize"); function xcb_xkb_get_names_value_list_unpack (u_buffer : System.Address; nTypes : Libc.Stdint.uint8_t; indicators : Libc.Stdint.uint32_t; virtualMods : Libc.Stdint.uint16_t; groupNames : Libc.Stdint.uint8_t; nKeys : Libc.Stdint.uint8_t; nKeyAliases : Libc.Stdint.uint8_t; nRadioGroups : Libc.Stdint.uint8_t; which : Libc.Stdint.uint32_t; u_aux : access xcb_xkb_get_names_value_list_t) return int; -- /usr/include/xcb/xkb.h:9548 pragma Import (C, xcb_xkb_get_names_value_list_unpack, "xcb_xkb_get_names_value_list_unpack"); function xcb_xkb_get_names_value_list_sizeof (u_buffer : System.Address; nTypes : Libc.Stdint.uint8_t; indicators : Libc.Stdint.uint32_t; virtualMods : Libc.Stdint.uint16_t; groupNames : Libc.Stdint.uint8_t; nKeys : Libc.Stdint.uint8_t; nKeyAliases : Libc.Stdint.uint8_t; nRadioGroups : Libc.Stdint.uint8_t; which : Libc.Stdint.uint32_t) return int; -- /usr/include/xcb/xkb.h:9560 pragma Import (C, xcb_xkb_get_names_value_list_sizeof, "xcb_xkb_get_names_value_list_sizeof"); function xcb_xkb_get_names (c : xcb_connection_t_access; deviceSpec : xcb_xkb_device_spec_t; which : Libc.Stdint.uint32_t) return xcb_xkb_get_names_cookie_t; -- /usr/include/xcb/xkb.h:9591 pragma Import (C, xcb_xkb_get_names, "xcb_xkb_get_names"); function xcb_xkb_get_names_unchecked (c : xcb_connection_t_access; deviceSpec : xcb_xkb_device_spec_t; which : Libc.Stdint.uint32_t) return xcb_xkb_get_names_cookie_t; -- /usr/include/xcb/xkb.h:9619 pragma Import (C, xcb_xkb_get_names_unchecked, "xcb_xkb_get_names_unchecked"); function xcb_xkb_get_names_value_list (R : System.Address) return System.Address; -- /usr/include/xcb/xkb.h:9634 pragma Import (C, xcb_xkb_get_names_value_list, "xcb_xkb_get_names_value_list"); function xcb_xkb_get_names_reply (c : xcb_connection_t_access; cookie : xcb_xkb_get_names_cookie_t; e : access xcb_generic_error_t_access) return access xcb_xkb_get_names_reply_t; -- /usr/include/xcb/xkb.h:9663 pragma Import (C, xcb_xkb_get_names_reply, "xcb_xkb_get_names_reply"); function xcb_xkb_set_names_values_type_names (S : System.Address) return access XCB.XProto.xcb_atom_t; -- /usr/include/xcb/xkb.h:9678 pragma Import (C, xcb_xkb_set_names_values_type_names, "xcb_xkb_set_names_values_type_names"); function xcb_xkb_set_names_values_type_names_length (R : System.Address; S : System.Address) return int; -- /usr/include/xcb/xkb.h:9691 pragma Import (C, xcb_xkb_set_names_values_type_names_length, "xcb_xkb_set_names_values_type_names_length"); function xcb_xkb_set_names_values_type_names_end (R : System.Address; S : System.Address) return XCB.xcb_generic_iterator_t; -- /usr/include/xcb/xkb.h:9705 pragma Import (C, xcb_xkb_set_names_values_type_names_end, "xcb_xkb_set_names_values_type_names_end"); function xcb_xkb_set_names_values_n_levels_per_type (S : System.Address) return access Libc.Stdint.uint8_t; -- /usr/include/xcb/xkb.h:9719 pragma Import (C, xcb_xkb_set_names_values_n_levels_per_type, "xcb_xkb_set_names_values_n_levels_per_type"); function xcb_xkb_set_names_values_n_levels_per_type_length (R : System.Address; S : System.Address) return int; -- /usr/include/xcb/xkb.h:9732 pragma Import (C, xcb_xkb_set_names_values_n_levels_per_type_length, "xcb_xkb_set_names_values_n_levels_per_type_length"); function xcb_xkb_set_names_values_n_levels_per_type_end (R : System.Address; S : System.Address) return XCB.xcb_generic_iterator_t; -- /usr/include/xcb/xkb.h:9746 pragma Import (C, xcb_xkb_set_names_values_n_levels_per_type_end, "xcb_xkb_set_names_values_n_levels_per_type_end"); function xcb_xkb_set_names_values_kt_level_names (S : System.Address) return access XCB.XProto.xcb_atom_t; -- /usr/include/xcb/xkb.h:9760 pragma Import (C, xcb_xkb_set_names_values_kt_level_names, "xcb_xkb_set_names_values_kt_level_names"); function xcb_xkb_set_names_values_kt_level_names_length (R : System.Address; S : System.Address) return int; -- /usr/include/xcb/xkb.h:9773 pragma Import (C, xcb_xkb_set_names_values_kt_level_names_length, "xcb_xkb_set_names_values_kt_level_names_length"); function xcb_xkb_set_names_values_kt_level_names_end (R : System.Address; S : System.Address) return XCB.xcb_generic_iterator_t; -- /usr/include/xcb/xkb.h:9787 pragma Import (C, xcb_xkb_set_names_values_kt_level_names_end, "xcb_xkb_set_names_values_kt_level_names_end"); function xcb_xkb_set_names_values_indicator_names (S : System.Address) return access XCB.XProto.xcb_atom_t; -- /usr/include/xcb/xkb.h:9801 pragma Import (C, xcb_xkb_set_names_values_indicator_names, "xcb_xkb_set_names_values_indicator_names"); function xcb_xkb_set_names_values_indicator_names_length (R : System.Address; S : System.Address) return int; -- /usr/include/xcb/xkb.h:9814 pragma Import (C, xcb_xkb_set_names_values_indicator_names_length, "xcb_xkb_set_names_values_indicator_names_length"); function xcb_xkb_set_names_values_indicator_names_end (R : System.Address; S : System.Address) return XCB.xcb_generic_iterator_t; -- /usr/include/xcb/xkb.h:9828 pragma Import (C, xcb_xkb_set_names_values_indicator_names_end, "xcb_xkb_set_names_values_indicator_names_end"); function xcb_xkb_set_names_values_virtual_mod_names (S : System.Address) return access XCB.XProto.xcb_atom_t; -- /usr/include/xcb/xkb.h:9842 pragma Import (C, xcb_xkb_set_names_values_virtual_mod_names, "xcb_xkb_set_names_values_virtual_mod_names"); function xcb_xkb_set_names_values_virtual_mod_names_length (R : System.Address; S : System.Address) return int; -- /usr/include/xcb/xkb.h:9855 pragma Import (C, xcb_xkb_set_names_values_virtual_mod_names_length, "xcb_xkb_set_names_values_virtual_mod_names_length"); function xcb_xkb_set_names_values_virtual_mod_names_end (R : System.Address; S : System.Address) return XCB.xcb_generic_iterator_t; -- /usr/include/xcb/xkb.h:9869 pragma Import (C, xcb_xkb_set_names_values_virtual_mod_names_end, "xcb_xkb_set_names_values_virtual_mod_names_end"); function xcb_xkb_set_names_values_groups (S : System.Address) return access XCB.XProto.xcb_atom_t; -- /usr/include/xcb/xkb.h:9883 pragma Import (C, xcb_xkb_set_names_values_groups, "xcb_xkb_set_names_values_groups"); function xcb_xkb_set_names_values_groups_length (R : System.Address; S : System.Address) return int; -- /usr/include/xcb/xkb.h:9896 pragma Import (C, xcb_xkb_set_names_values_groups_length, "xcb_xkb_set_names_values_groups_length"); function xcb_xkb_set_names_values_groups_end (R : System.Address; S : System.Address) return XCB.xcb_generic_iterator_t; -- /usr/include/xcb/xkb.h:9910 pragma Import (C, xcb_xkb_set_names_values_groups_end, "xcb_xkb_set_names_values_groups_end"); function xcb_xkb_set_names_values_key_names (S : System.Address) return access xcb_xkb_key_name_t; -- /usr/include/xcb/xkb.h:9924 pragma Import (C, xcb_xkb_set_names_values_key_names, "xcb_xkb_set_names_values_key_names"); function xcb_xkb_set_names_values_key_names_length (R : System.Address; S : System.Address) return int; -- /usr/include/xcb/xkb.h:9937 pragma Import (C, xcb_xkb_set_names_values_key_names_length, "xcb_xkb_set_names_values_key_names_length"); function xcb_xkb_set_names_values_key_names_iterator (R : System.Address; S : System.Address) return xcb_xkb_key_name_iterator_t; -- /usr/include/xcb/xkb.h:9951 pragma Import (C, xcb_xkb_set_names_values_key_names_iterator, "xcb_xkb_set_names_values_key_names_iterator"); function xcb_xkb_set_names_values_key_aliases (S : System.Address) return access xcb_xkb_key_alias_t; -- /usr/include/xcb/xkb.h:9965 pragma Import (C, xcb_xkb_set_names_values_key_aliases, "xcb_xkb_set_names_values_key_aliases"); function xcb_xkb_set_names_values_key_aliases_length (R : System.Address; S : System.Address) return int; -- /usr/include/xcb/xkb.h:9978 pragma Import (C, xcb_xkb_set_names_values_key_aliases_length, "xcb_xkb_set_names_values_key_aliases_length"); function xcb_xkb_set_names_values_key_aliases_iterator (R : System.Address; S : System.Address) return xcb_xkb_key_alias_iterator_t; -- /usr/include/xcb/xkb.h:9992 pragma Import (C, xcb_xkb_set_names_values_key_aliases_iterator, "xcb_xkb_set_names_values_key_aliases_iterator"); function xcb_xkb_set_names_values_radio_group_names (S : System.Address) return access XCB.XProto.xcb_atom_t; -- /usr/include/xcb/xkb.h:10006 pragma Import (C, xcb_xkb_set_names_values_radio_group_names, "xcb_xkb_set_names_values_radio_group_names"); function xcb_xkb_set_names_values_radio_group_names_length (R : System.Address; S : System.Address) return int; -- /usr/include/xcb/xkb.h:10019 pragma Import (C, xcb_xkb_set_names_values_radio_group_names_length, "xcb_xkb_set_names_values_radio_group_names_length"); function xcb_xkb_set_names_values_radio_group_names_end (R : System.Address; S : System.Address) return XCB.xcb_generic_iterator_t; -- /usr/include/xcb/xkb.h:10033 pragma Import (C, xcb_xkb_set_names_values_radio_group_names_end, "xcb_xkb_set_names_values_radio_group_names_end"); function xcb_xkb_set_names_values_serialize (u_buffer : System.Address; nTypes : Libc.Stdint.uint8_t; nKTLevels : Libc.Stdint.uint8_t; indicators : Libc.Stdint.uint32_t; virtualMods : Libc.Stdint.uint16_t; groupNames : Libc.Stdint.uint8_t; nKeys : Libc.Stdint.uint8_t; nKeyAliases : Libc.Stdint.uint8_t; nRadioGroups : Libc.Stdint.uint8_t; which : Libc.Stdint.uint32_t; u_aux : System.Address) return int; -- /usr/include/xcb/xkb.h:10037 pragma Import (C, xcb_xkb_set_names_values_serialize, "xcb_xkb_set_names_values_serialize"); function xcb_xkb_set_names_values_unpack (u_buffer : System.Address; nTypes : Libc.Stdint.uint8_t; nKTLevels : Libc.Stdint.uint8_t; indicators : Libc.Stdint.uint32_t; virtualMods : Libc.Stdint.uint16_t; groupNames : Libc.Stdint.uint8_t; nKeys : Libc.Stdint.uint8_t; nKeyAliases : Libc.Stdint.uint8_t; nRadioGroups : Libc.Stdint.uint8_t; which : Libc.Stdint.uint32_t; u_aux : access xcb_xkb_set_names_values_t) return int; -- /usr/include/xcb/xkb.h:10050 pragma Import (C, xcb_xkb_set_names_values_unpack, "xcb_xkb_set_names_values_unpack"); function xcb_xkb_set_names_values_sizeof (u_buffer : System.Address; nTypes : Libc.Stdint.uint8_t; nKTLevels : Libc.Stdint.uint8_t; indicators : Libc.Stdint.uint32_t; virtualMods : Libc.Stdint.uint16_t; groupNames : Libc.Stdint.uint8_t; nKeys : Libc.Stdint.uint8_t; nKeyAliases : Libc.Stdint.uint8_t; nRadioGroups : Libc.Stdint.uint8_t; which : Libc.Stdint.uint32_t) return int; -- /usr/include/xcb/xkb.h:10063 pragma Import (C, xcb_xkb_set_names_values_sizeof, "xcb_xkb_set_names_values_sizeof"); function xcb_xkb_set_names_checked (c : xcb_connection_t_access; deviceSpec : xcb_xkb_device_spec_t; virtualMods : Libc.Stdint.uint16_t; which : Libc.Stdint.uint32_t; firstType : Libc.Stdint.uint8_t; nTypes : Libc.Stdint.uint8_t; firstKTLevelt : Libc.Stdint.uint8_t; nKTLevels : Libc.Stdint.uint8_t; indicators : Libc.Stdint.uint32_t; groupNames : Libc.Stdint.uint8_t; nRadioGroups : Libc.Stdint.uint8_t; firstKey : XCB.XProto.xcb_keycode_t; nKeys : Libc.Stdint.uint8_t; nKeyAliases : Libc.Stdint.uint8_t; totalKTLevelNames : Libc.Stdint.uint16_t; values : System.Address) return XCB.xcb_void_cookie_t; -- /usr/include/xcb/xkb.h:10111 pragma Import (C, xcb_xkb_set_names_checked, "xcb_xkb_set_names_checked"); function xcb_xkb_set_names (c : xcb_connection_t_access; deviceSpec : xcb_xkb_device_spec_t; virtualMods : Libc.Stdint.uint16_t; which : Libc.Stdint.uint32_t; firstType : Libc.Stdint.uint8_t; nTypes : Libc.Stdint.uint8_t; firstKTLevelt : Libc.Stdint.uint8_t; nKTLevels : Libc.Stdint.uint8_t; indicators : Libc.Stdint.uint32_t; groupNames : Libc.Stdint.uint8_t; nRadioGroups : Libc.Stdint.uint8_t; firstKey : XCB.XProto.xcb_keycode_t; nKeys : Libc.Stdint.uint8_t; nKeyAliases : Libc.Stdint.uint8_t; totalKTLevelNames : Libc.Stdint.uint16_t; values : System.Address) return XCB.xcb_void_cookie_t; -- /usr/include/xcb/xkb.h:10162 pragma Import (C, xcb_xkb_set_names, "xcb_xkb_set_names"); function xcb_xkb_set_names_aux_checked (c : xcb_connection_t_access; deviceSpec : xcb_xkb_device_spec_t; virtualMods : Libc.Stdint.uint16_t; which : Libc.Stdint.uint32_t; firstType : Libc.Stdint.uint8_t; nTypes : Libc.Stdint.uint8_t; firstKTLevelt : Libc.Stdint.uint8_t; nKTLevels : Libc.Stdint.uint8_t; indicators : Libc.Stdint.uint32_t; groupNames : Libc.Stdint.uint8_t; nRadioGroups : Libc.Stdint.uint8_t; firstKey : XCB.XProto.xcb_keycode_t; nKeys : Libc.Stdint.uint8_t; nKeyAliases : Libc.Stdint.uint8_t; totalKTLevelNames : Libc.Stdint.uint16_t; values : System.Address) return XCB.xcb_void_cookie_t; -- /usr/include/xcb/xkb.h:10216 pragma Import (C, xcb_xkb_set_names_aux_checked, "xcb_xkb_set_names_aux_checked"); function xcb_xkb_set_names_aux (c : xcb_connection_t_access; deviceSpec : xcb_xkb_device_spec_t; virtualMods : Libc.Stdint.uint16_t; which : Libc.Stdint.uint32_t; firstType : Libc.Stdint.uint8_t; nTypes : Libc.Stdint.uint8_t; firstKTLevelt : Libc.Stdint.uint8_t; nKTLevels : Libc.Stdint.uint8_t; indicators : Libc.Stdint.uint32_t; groupNames : Libc.Stdint.uint8_t; nRadioGroups : Libc.Stdint.uint8_t; firstKey : XCB.XProto.xcb_keycode_t; nKeys : Libc.Stdint.uint8_t; nKeyAliases : Libc.Stdint.uint8_t; totalKTLevelNames : Libc.Stdint.uint16_t; values : System.Address) return XCB.xcb_void_cookie_t; -- /usr/include/xcb/xkb.h:10267 pragma Import (C, xcb_xkb_set_names_aux, "xcb_xkb_set_names_aux"); function xcb_xkb_per_client_flags (c : xcb_connection_t_access; deviceSpec : xcb_xkb_device_spec_t; change : Libc.Stdint.uint32_t; value : Libc.Stdint.uint32_t; ctrlsToChange : Libc.Stdint.uint32_t; autoCtrls : Libc.Stdint.uint32_t; autoCtrlsValues : Libc.Stdint.uint32_t) return xcb_xkb_per_client_flags_cookie_t; -- /usr/include/xcb/xkb.h:10309 pragma Import (C, xcb_xkb_per_client_flags, "xcb_xkb_per_client_flags"); function xcb_xkb_per_client_flags_unchecked (c : xcb_connection_t_access; deviceSpec : xcb_xkb_device_spec_t; change : Libc.Stdint.uint32_t; value : Libc.Stdint.uint32_t; ctrlsToChange : Libc.Stdint.uint32_t; autoCtrls : Libc.Stdint.uint32_t; autoCtrlsValues : Libc.Stdint.uint32_t) return xcb_xkb_per_client_flags_cookie_t; -- /usr/include/xcb/xkb.h:10345 pragma Import (C, xcb_xkb_per_client_flags_unchecked, "xcb_xkb_per_client_flags_unchecked"); function xcb_xkb_per_client_flags_reply (c : xcb_connection_t_access; cookie : xcb_xkb_per_client_flags_cookie_t; e : access xcb_generic_error_t_access) return access xcb_xkb_per_client_flags_reply_t; -- /usr/include/xcb/xkb.h:10380 pragma Import (C, xcb_xkb_per_client_flags_reply, "xcb_xkb_per_client_flags_reply"); function xcb_xkb_list_components_sizeof (u_buffer : System.Address) return int; -- /usr/include/xcb/xkb.h:10385 pragma Import (C, xcb_xkb_list_components_sizeof, "xcb_xkb_list_components_sizeof"); function xcb_xkb_list_components (c : xcb_connection_t_access; deviceSpec : xcb_xkb_device_spec_t; maxNames : Libc.Stdint.uint16_t) return xcb_xkb_list_components_cookie_t; -- /usr/include/xcb/xkb.h:10408 pragma Import (C, xcb_xkb_list_components, "xcb_xkb_list_components"); function xcb_xkb_list_components_unchecked (c : xcb_connection_t_access; deviceSpec : xcb_xkb_device_spec_t; maxNames : Libc.Stdint.uint16_t) return xcb_xkb_list_components_cookie_t; -- /usr/include/xcb/xkb.h:10436 pragma Import (C, xcb_xkb_list_components_unchecked, "xcb_xkb_list_components_unchecked"); function xcb_xkb_list_components_keymaps_length (R : System.Address) return int; -- /usr/include/xcb/xkb.h:10451 pragma Import (C, xcb_xkb_list_components_keymaps_length, "xcb_xkb_list_components_keymaps_length"); function xcb_xkb_list_components_keymaps_iterator (R : System.Address) return xcb_xkb_listing_iterator_t; -- /usr/include/xcb/xkb.h:10464 pragma Import (C, xcb_xkb_list_components_keymaps_iterator, "xcb_xkb_list_components_keymaps_iterator"); function xcb_xkb_list_components_keycodes_length (R : System.Address) return int; -- /usr/include/xcb/xkb.h:10477 pragma Import (C, xcb_xkb_list_components_keycodes_length, "xcb_xkb_list_components_keycodes_length"); function xcb_xkb_list_components_keycodes_iterator (R : System.Address) return xcb_xkb_listing_iterator_t; -- /usr/include/xcb/xkb.h:10490 pragma Import (C, xcb_xkb_list_components_keycodes_iterator, "xcb_xkb_list_components_keycodes_iterator"); function xcb_xkb_list_components_types_length (R : System.Address) return int; -- /usr/include/xcb/xkb.h:10503 pragma Import (C, xcb_xkb_list_components_types_length, "xcb_xkb_list_components_types_length"); function xcb_xkb_list_components_types_iterator (R : System.Address) return xcb_xkb_listing_iterator_t; -- /usr/include/xcb/xkb.h:10516 pragma Import (C, xcb_xkb_list_components_types_iterator, "xcb_xkb_list_components_types_iterator"); function xcb_xkb_list_components_compat_maps_length (R : System.Address) return int; -- /usr/include/xcb/xkb.h:10529 pragma Import (C, xcb_xkb_list_components_compat_maps_length, "xcb_xkb_list_components_compat_maps_length"); function xcb_xkb_list_components_compat_maps_iterator (R : System.Address) return xcb_xkb_listing_iterator_t; -- /usr/include/xcb/xkb.h:10542 pragma Import (C, xcb_xkb_list_components_compat_maps_iterator, "xcb_xkb_list_components_compat_maps_iterator"); function xcb_xkb_list_components_symbols_length (R : System.Address) return int; -- /usr/include/xcb/xkb.h:10555 pragma Import (C, xcb_xkb_list_components_symbols_length, "xcb_xkb_list_components_symbols_length"); function xcb_xkb_list_components_symbols_iterator (R : System.Address) return xcb_xkb_listing_iterator_t; -- /usr/include/xcb/xkb.h:10568 pragma Import (C, xcb_xkb_list_components_symbols_iterator, "xcb_xkb_list_components_symbols_iterator"); function xcb_xkb_list_components_geometries_length (R : System.Address) return int; -- /usr/include/xcb/xkb.h:10581 pragma Import (C, xcb_xkb_list_components_geometries_length, "xcb_xkb_list_components_geometries_length"); function xcb_xkb_list_components_geometries_iterator (R : System.Address) return xcb_xkb_listing_iterator_t; -- /usr/include/xcb/xkb.h:10594 pragma Import (C, xcb_xkb_list_components_geometries_iterator, "xcb_xkb_list_components_geometries_iterator"); function xcb_xkb_list_components_reply (c : xcb_connection_t_access; cookie : xcb_xkb_list_components_cookie_t; e : access xcb_generic_error_t_access) return access xcb_xkb_list_components_reply_t; -- /usr/include/xcb/xkb.h:10623 pragma Import (C, xcb_xkb_list_components_reply, "xcb_xkb_list_components_reply"); function xcb_xkb_get_kbd_by_name_replies_types_map_types_rtrn_length (R : System.Address; S : System.Address) return int; -- /usr/include/xcb/xkb.h:10638 pragma Import (C, xcb_xkb_get_kbd_by_name_replies_types_map_types_rtrn_length, "xcb_xkb_get_kbd_by_name_replies_types_map_types_rtrn_length"); function xcb_xkb_get_kbd_by_name_replies_types_map_types_rtrn_iterator (R : System.Address; S : System.Address) return xcb_xkb_key_type_iterator_t; -- /usr/include/xcb/xkb.h:10652 pragma Import (C, xcb_xkb_get_kbd_by_name_replies_types_map_types_rtrn_iterator, "xcb_xkb_get_kbd_by_name_replies_types_map_types_rtrn_iterator"); function xcb_xkb_get_kbd_by_name_replies_types_map_syms_rtrn_length (R : System.Address; S : System.Address) return int; -- /usr/include/xcb/xkb.h:10666 pragma Import (C, xcb_xkb_get_kbd_by_name_replies_types_map_syms_rtrn_length, "xcb_xkb_get_kbd_by_name_replies_types_map_syms_rtrn_length"); function xcb_xkb_get_kbd_by_name_replies_types_map_syms_rtrn_iterator (R : System.Address; S : System.Address) return xcb_xkb_key_sym_map_iterator_t; -- /usr/include/xcb/xkb.h:10680 pragma Import (C, xcb_xkb_get_kbd_by_name_replies_types_map_syms_rtrn_iterator, "xcb_xkb_get_kbd_by_name_replies_types_map_syms_rtrn_iterator"); function xcb_xkb_get_kbd_by_name_replies_types_map_acts_rtrn_count (S : System.Address) return access Libc.Stdint.uint8_t; -- /usr/include/xcb/xkb.h:10694 pragma Import (C, xcb_xkb_get_kbd_by_name_replies_types_map_acts_rtrn_count, "xcb_xkb_get_kbd_by_name_replies_types_map_acts_rtrn_count"); function xcb_xkb_get_kbd_by_name_replies_types_map_acts_rtrn_count_length (R : System.Address; S : System.Address) return int; -- /usr/include/xcb/xkb.h:10707 pragma Import (C, xcb_xkb_get_kbd_by_name_replies_types_map_acts_rtrn_count_length, "xcb_xkb_get_kbd_by_name_replies_types_map_acts_rtrn_count_length"); function xcb_xkb_get_kbd_by_name_replies_types_map_acts_rtrn_count_end (R : System.Address; S : System.Address) return XCB.xcb_generic_iterator_t; -- /usr/include/xcb/xkb.h:10721 pragma Import (C, xcb_xkb_get_kbd_by_name_replies_types_map_acts_rtrn_count_end, "xcb_xkb_get_kbd_by_name_replies_types_map_acts_rtrn_count_end"); function xcb_xkb_get_kbd_by_name_replies_types_map_acts_rtrn_acts (S : System.Address) return access xcb_xkb_action_t; -- /usr/include/xcb/xkb.h:10735 pragma Import (C, xcb_xkb_get_kbd_by_name_replies_types_map_acts_rtrn_acts, "xcb_xkb_get_kbd_by_name_replies_types_map_acts_rtrn_acts"); function xcb_xkb_get_kbd_by_name_replies_types_map_acts_rtrn_acts_length (R : System.Address; S : System.Address) return int; -- /usr/include/xcb/xkb.h:10748 pragma Import (C, xcb_xkb_get_kbd_by_name_replies_types_map_acts_rtrn_acts_length, "xcb_xkb_get_kbd_by_name_replies_types_map_acts_rtrn_acts_length"); function xcb_xkb_get_kbd_by_name_replies_types_map_acts_rtrn_acts_iterator (R : System.Address; S : System.Address) return xcb_xkb_action_iterator_t; -- /usr/include/xcb/xkb.h:10762 pragma Import (C, xcb_xkb_get_kbd_by_name_replies_types_map_acts_rtrn_acts_iterator, "xcb_xkb_get_kbd_by_name_replies_types_map_acts_rtrn_acts_iterator"); function xcb_xkb_get_kbd_by_name_replies_types_map_behaviors_rtrn (S : System.Address) return access xcb_xkb_set_behavior_t; -- /usr/include/xcb/xkb.h:10776 pragma Import (C, xcb_xkb_get_kbd_by_name_replies_types_map_behaviors_rtrn, "xcb_xkb_get_kbd_by_name_replies_types_map_behaviors_rtrn"); function xcb_xkb_get_kbd_by_name_replies_types_map_behaviors_rtrn_length (R : System.Address; S : System.Address) return int; -- /usr/include/xcb/xkb.h:10789 pragma Import (C, xcb_xkb_get_kbd_by_name_replies_types_map_behaviors_rtrn_length, "xcb_xkb_get_kbd_by_name_replies_types_map_behaviors_rtrn_length"); function xcb_xkb_get_kbd_by_name_replies_types_map_behaviors_rtrn_iterator (R : System.Address; S : System.Address) return xcb_xkb_set_behavior_iterator_t; -- /usr/include/xcb/xkb.h:10803 pragma Import (C, xcb_xkb_get_kbd_by_name_replies_types_map_behaviors_rtrn_iterator, "xcb_xkb_get_kbd_by_name_replies_types_map_behaviors_rtrn_iterator"); function xcb_xkb_get_kbd_by_name_replies_types_map_vmods_rtrn (S : System.Address) return access Libc.Stdint.uint8_t; -- /usr/include/xcb/xkb.h:10817 pragma Import (C, xcb_xkb_get_kbd_by_name_replies_types_map_vmods_rtrn, "xcb_xkb_get_kbd_by_name_replies_types_map_vmods_rtrn"); function xcb_xkb_get_kbd_by_name_replies_types_map_vmods_rtrn_length (R : System.Address; S : System.Address) return int; -- /usr/include/xcb/xkb.h:10830 pragma Import (C, xcb_xkb_get_kbd_by_name_replies_types_map_vmods_rtrn_length, "xcb_xkb_get_kbd_by_name_replies_types_map_vmods_rtrn_length"); function xcb_xkb_get_kbd_by_name_replies_types_map_vmods_rtrn_end (R : System.Address; S : System.Address) return XCB.xcb_generic_iterator_t; -- /usr/include/xcb/xkb.h:10844 pragma Import (C, xcb_xkb_get_kbd_by_name_replies_types_map_vmods_rtrn_end, "xcb_xkb_get_kbd_by_name_replies_types_map_vmods_rtrn_end"); function xcb_xkb_get_kbd_by_name_replies_types_map_explicit_rtrn (S : System.Address) return access xcb_xkb_set_explicit_t; -- /usr/include/xcb/xkb.h:10858 pragma Import (C, xcb_xkb_get_kbd_by_name_replies_types_map_explicit_rtrn, "xcb_xkb_get_kbd_by_name_replies_types_map_explicit_rtrn"); function xcb_xkb_get_kbd_by_name_replies_types_map_explicit_rtrn_length (R : System.Address; S : System.Address) return int; -- /usr/include/xcb/xkb.h:10871 pragma Import (C, xcb_xkb_get_kbd_by_name_replies_types_map_explicit_rtrn_length, "xcb_xkb_get_kbd_by_name_replies_types_map_explicit_rtrn_length"); function xcb_xkb_get_kbd_by_name_replies_types_map_explicit_rtrn_iterator (R : System.Address; S : System.Address) return xcb_xkb_set_explicit_iterator_t; -- /usr/include/xcb/xkb.h:10885 pragma Import (C, xcb_xkb_get_kbd_by_name_replies_types_map_explicit_rtrn_iterator, "xcb_xkb_get_kbd_by_name_replies_types_map_explicit_rtrn_iterator"); function xcb_xkb_get_kbd_by_name_replies_types_map_modmap_rtrn (S : System.Address) return access xcb_xkb_key_mod_map_t; -- /usr/include/xcb/xkb.h:10899 pragma Import (C, xcb_xkb_get_kbd_by_name_replies_types_map_modmap_rtrn, "xcb_xkb_get_kbd_by_name_replies_types_map_modmap_rtrn"); function xcb_xkb_get_kbd_by_name_replies_types_map_modmap_rtrn_length (R : System.Address; S : System.Address) return int; -- /usr/include/xcb/xkb.h:10912 pragma Import (C, xcb_xkb_get_kbd_by_name_replies_types_map_modmap_rtrn_length, "xcb_xkb_get_kbd_by_name_replies_types_map_modmap_rtrn_length"); function xcb_xkb_get_kbd_by_name_replies_types_map_modmap_rtrn_iterator (R : System.Address; S : System.Address) return xcb_xkb_key_mod_map_iterator_t; -- /usr/include/xcb/xkb.h:10926 pragma Import (C, xcb_xkb_get_kbd_by_name_replies_types_map_modmap_rtrn_iterator, "xcb_xkb_get_kbd_by_name_replies_types_map_modmap_rtrn_iterator"); function xcb_xkb_get_kbd_by_name_replies_types_map_vmodmap_rtrn (S : System.Address) return access xcb_xkb_key_v_mod_map_t; -- /usr/include/xcb/xkb.h:10940 pragma Import (C, xcb_xkb_get_kbd_by_name_replies_types_map_vmodmap_rtrn, "xcb_xkb_get_kbd_by_name_replies_types_map_vmodmap_rtrn"); function xcb_xkb_get_kbd_by_name_replies_types_map_vmodmap_rtrn_length (R : System.Address; S : System.Address) return int; -- /usr/include/xcb/xkb.h:10953 pragma Import (C, xcb_xkb_get_kbd_by_name_replies_types_map_vmodmap_rtrn_length, "xcb_xkb_get_kbd_by_name_replies_types_map_vmodmap_rtrn_length"); function xcb_xkb_get_kbd_by_name_replies_types_map_vmodmap_rtrn_iterator (R : System.Address; S : System.Address) return xcb_xkb_key_v_mod_map_iterator_t; -- /usr/include/xcb/xkb.h:10967 pragma Import (C, xcb_xkb_get_kbd_by_name_replies_types_map_vmodmap_rtrn_iterator, "xcb_xkb_get_kbd_by_name_replies_types_map_vmodmap_rtrn_iterator"); function xcb_xkb_get_kbd_by_name_replies_types_map_serialize (u_buffer : System.Address; nTypes : Libc.Stdint.uint8_t; nKeySyms : Libc.Stdint.uint8_t; nKeyActions : Libc.Stdint.uint8_t; totalActions : Libc.Stdint.uint16_t; totalKeyBehaviors : Libc.Stdint.uint8_t; virtualMods : Libc.Stdint.uint16_t; totalKeyExplicit : Libc.Stdint.uint8_t; totalModMapKeys : Libc.Stdint.uint8_t; totalVModMapKeys : Libc.Stdint.uint8_t; present : Libc.Stdint.uint16_t; u_aux : System.Address) return int; -- /usr/include/xcb/xkb.h:10971 pragma Import (C, xcb_xkb_get_kbd_by_name_replies_types_map_serialize, "xcb_xkb_get_kbd_by_name_replies_types_map_serialize"); function xcb_xkb_get_kbd_by_name_replies_types_map_unpack (u_buffer : System.Address; nTypes : Libc.Stdint.uint8_t; nKeySyms : Libc.Stdint.uint8_t; nKeyActions : Libc.Stdint.uint8_t; totalActions : Libc.Stdint.uint16_t; totalKeyBehaviors : Libc.Stdint.uint8_t; virtualMods : Libc.Stdint.uint16_t; totalKeyExplicit : Libc.Stdint.uint8_t; totalModMapKeys : Libc.Stdint.uint8_t; totalVModMapKeys : Libc.Stdint.uint8_t; present : Libc.Stdint.uint16_t; u_aux : access xcb_xkb_get_kbd_by_name_replies_types_map_t) return int; -- /usr/include/xcb/xkb.h:10985 pragma Import (C, xcb_xkb_get_kbd_by_name_replies_types_map_unpack, "xcb_xkb_get_kbd_by_name_replies_types_map_unpack"); function xcb_xkb_get_kbd_by_name_replies_types_map_sizeof (u_buffer : System.Address; nTypes : Libc.Stdint.uint8_t; nKeySyms : Libc.Stdint.uint8_t; nKeyActions : Libc.Stdint.uint8_t; totalActions : Libc.Stdint.uint16_t; totalKeyBehaviors : Libc.Stdint.uint8_t; virtualMods : Libc.Stdint.uint16_t; totalKeyExplicit : Libc.Stdint.uint8_t; totalModMapKeys : Libc.Stdint.uint8_t; totalVModMapKeys : Libc.Stdint.uint8_t; present : Libc.Stdint.uint16_t) return int; -- /usr/include/xcb/xkb.h:10999 pragma Import (C, xcb_xkb_get_kbd_by_name_replies_types_map_sizeof, "xcb_xkb_get_kbd_by_name_replies_types_map_sizeof"); function xcb_xkb_get_kbd_by_name_replies_key_names_value_list_type_names (S : System.Address) return access XCB.XProto.xcb_atom_t; -- /usr/include/xcb/xkb.h:11022 pragma Import (C, xcb_xkb_get_kbd_by_name_replies_key_names_value_list_type_names, "xcb_xkb_get_kbd_by_name_replies_key_names_value_list_type_names"); function xcb_xkb_get_kbd_by_name_replies_key_names_value_list_type_names_length (R : System.Address; S : System.Address) return int; -- /usr/include/xcb/xkb.h:11035 pragma Import (C, xcb_xkb_get_kbd_by_name_replies_key_names_value_list_type_names_length, "xcb_xkb_get_kbd_by_name_replies_key_names_value_list_type_names_length"); function xcb_xkb_get_kbd_by_name_replies_key_names_value_list_type_names_end (R : System.Address; S : System.Address) return XCB.xcb_generic_iterator_t; -- /usr/include/xcb/xkb.h:11049 pragma Import (C, xcb_xkb_get_kbd_by_name_replies_key_names_value_list_type_names_end, "xcb_xkb_get_kbd_by_name_replies_key_names_value_list_type_names_end"); function xcb_xkb_get_kbd_by_name_replies_key_names_value_list_n_levels_per_type (S : System.Address) return access Libc.Stdint.uint8_t; -- /usr/include/xcb/xkb.h:11063 pragma Import (C, xcb_xkb_get_kbd_by_name_replies_key_names_value_list_n_levels_per_type, "xcb_xkb_get_kbd_by_name_replies_key_names_value_list_n_levels_per_type"); function xcb_xkb_get_kbd_by_name_replies_key_names_value_list_n_levels_per_type_length (R : System.Address; S : System.Address) return int; -- /usr/include/xcb/xkb.h:11076 pragma Import (C, xcb_xkb_get_kbd_by_name_replies_key_names_value_list_n_levels_per_type_length, "xcb_xkb_get_kbd_by_name_replies_key_names_value_list_n_levels_per_type_length"); function xcb_xkb_get_kbd_by_name_replies_key_names_value_list_n_levels_per_type_end (R : System.Address; S : System.Address) return XCB.xcb_generic_iterator_t; -- /usr/include/xcb/xkb.h:11090 pragma Import (C, xcb_xkb_get_kbd_by_name_replies_key_names_value_list_n_levels_per_type_end, "xcb_xkb_get_kbd_by_name_replies_key_names_value_list_n_levels_per_type_end"); function xcb_xkb_get_kbd_by_name_replies_key_names_value_list_kt_level_names (S : System.Address) return access XCB.XProto.xcb_atom_t; -- /usr/include/xcb/xkb.h:11104 pragma Import (C, xcb_xkb_get_kbd_by_name_replies_key_names_value_list_kt_level_names, "xcb_xkb_get_kbd_by_name_replies_key_names_value_list_kt_level_names"); function xcb_xkb_get_kbd_by_name_replies_key_names_value_list_kt_level_names_length (R : System.Address; S : System.Address) return int; -- /usr/include/xcb/xkb.h:11117 pragma Import (C, xcb_xkb_get_kbd_by_name_replies_key_names_value_list_kt_level_names_length, "xcb_xkb_get_kbd_by_name_replies_key_names_value_list_kt_level_names_length"); function xcb_xkb_get_kbd_by_name_replies_key_names_value_list_kt_level_names_end (R : System.Address; S : System.Address) return XCB.xcb_generic_iterator_t; -- /usr/include/xcb/xkb.h:11131 pragma Import (C, xcb_xkb_get_kbd_by_name_replies_key_names_value_list_kt_level_names_end, "xcb_xkb_get_kbd_by_name_replies_key_names_value_list_kt_level_names_end"); function xcb_xkb_get_kbd_by_name_replies_key_names_value_list_indicator_names (S : System.Address) return access XCB.XProto.xcb_atom_t; -- /usr/include/xcb/xkb.h:11145 pragma Import (C, xcb_xkb_get_kbd_by_name_replies_key_names_value_list_indicator_names, "xcb_xkb_get_kbd_by_name_replies_key_names_value_list_indicator_names"); function xcb_xkb_get_kbd_by_name_replies_key_names_value_list_indicator_names_length (R : System.Address; S : System.Address) return int; -- /usr/include/xcb/xkb.h:11158 pragma Import (C, xcb_xkb_get_kbd_by_name_replies_key_names_value_list_indicator_names_length, "xcb_xkb_get_kbd_by_name_replies_key_names_value_list_indicator_names_length"); function xcb_xkb_get_kbd_by_name_replies_key_names_value_list_indicator_names_end (R : System.Address; S : System.Address) return XCB.xcb_generic_iterator_t; -- /usr/include/xcb/xkb.h:11172 pragma Import (C, xcb_xkb_get_kbd_by_name_replies_key_names_value_list_indicator_names_end, "xcb_xkb_get_kbd_by_name_replies_key_names_value_list_indicator_names_end"); function xcb_xkb_get_kbd_by_name_replies_key_names_value_list_virtual_mod_names (S : System.Address) return access XCB.XProto.xcb_atom_t; -- /usr/include/xcb/xkb.h:11186 pragma Import (C, xcb_xkb_get_kbd_by_name_replies_key_names_value_list_virtual_mod_names, "xcb_xkb_get_kbd_by_name_replies_key_names_value_list_virtual_mod_names"); function xcb_xkb_get_kbd_by_name_replies_key_names_value_list_virtual_mod_names_length (R : System.Address; S : System.Address) return int; -- /usr/include/xcb/xkb.h:11199 pragma Import (C, xcb_xkb_get_kbd_by_name_replies_key_names_value_list_virtual_mod_names_length, "xcb_xkb_get_kbd_by_name_replies_key_names_value_list_virtual_mod_names_length"); function xcb_xkb_get_kbd_by_name_replies_key_names_value_list_virtual_mod_names_end (R : System.Address; S : System.Address) return XCB.xcb_generic_iterator_t; -- /usr/include/xcb/xkb.h:11213 pragma Import (C, xcb_xkb_get_kbd_by_name_replies_key_names_value_list_virtual_mod_names_end, "xcb_xkb_get_kbd_by_name_replies_key_names_value_list_virtual_mod_names_end"); function xcb_xkb_get_kbd_by_name_replies_key_names_value_list_groups (S : System.Address) return access XCB.XProto.xcb_atom_t; -- /usr/include/xcb/xkb.h:11227 pragma Import (C, xcb_xkb_get_kbd_by_name_replies_key_names_value_list_groups, "xcb_xkb_get_kbd_by_name_replies_key_names_value_list_groups"); function xcb_xkb_get_kbd_by_name_replies_key_names_value_list_groups_length (R : System.Address; S : System.Address) return int; -- /usr/include/xcb/xkb.h:11240 pragma Import (C, xcb_xkb_get_kbd_by_name_replies_key_names_value_list_groups_length, "xcb_xkb_get_kbd_by_name_replies_key_names_value_list_groups_length"); function xcb_xkb_get_kbd_by_name_replies_key_names_value_list_groups_end (R : System.Address; S : System.Address) return XCB.xcb_generic_iterator_t; -- /usr/include/xcb/xkb.h:11254 pragma Import (C, xcb_xkb_get_kbd_by_name_replies_key_names_value_list_groups_end, "xcb_xkb_get_kbd_by_name_replies_key_names_value_list_groups_end"); function xcb_xkb_get_kbd_by_name_replies_key_names_value_list_key_names (S : System.Address) return access xcb_xkb_key_name_t; -- /usr/include/xcb/xkb.h:11268 pragma Import (C, xcb_xkb_get_kbd_by_name_replies_key_names_value_list_key_names, "xcb_xkb_get_kbd_by_name_replies_key_names_value_list_key_names"); function xcb_xkb_get_kbd_by_name_replies_key_names_value_list_key_names_length (R : System.Address; S : System.Address) return int; -- /usr/include/xcb/xkb.h:11281 pragma Import (C, xcb_xkb_get_kbd_by_name_replies_key_names_value_list_key_names_length, "xcb_xkb_get_kbd_by_name_replies_key_names_value_list_key_names_length"); function xcb_xkb_get_kbd_by_name_replies_key_names_value_list_key_names_iterator (R : System.Address; S : System.Address) return xcb_xkb_key_name_iterator_t; -- /usr/include/xcb/xkb.h:11295 pragma Import (C, xcb_xkb_get_kbd_by_name_replies_key_names_value_list_key_names_iterator, "xcb_xkb_get_kbd_by_name_replies_key_names_value_list_key_names_iterator"); function xcb_xkb_get_kbd_by_name_replies_key_names_value_list_key_aliases (S : System.Address) return access xcb_xkb_key_alias_t; -- /usr/include/xcb/xkb.h:11309 pragma Import (C, xcb_xkb_get_kbd_by_name_replies_key_names_value_list_key_aliases, "xcb_xkb_get_kbd_by_name_replies_key_names_value_list_key_aliases"); function xcb_xkb_get_kbd_by_name_replies_key_names_value_list_key_aliases_length (R : System.Address; S : System.Address) return int; -- /usr/include/xcb/xkb.h:11322 pragma Import (C, xcb_xkb_get_kbd_by_name_replies_key_names_value_list_key_aliases_length, "xcb_xkb_get_kbd_by_name_replies_key_names_value_list_key_aliases_length"); function xcb_xkb_get_kbd_by_name_replies_key_names_value_list_key_aliases_iterator (R : System.Address; S : System.Address) return xcb_xkb_key_alias_iterator_t; -- /usr/include/xcb/xkb.h:11336 pragma Import (C, xcb_xkb_get_kbd_by_name_replies_key_names_value_list_key_aliases_iterator, "xcb_xkb_get_kbd_by_name_replies_key_names_value_list_key_aliases_iterator"); function xcb_xkb_get_kbd_by_name_replies_key_names_value_list_radio_group_names (S : System.Address) return access XCB.XProto.xcb_atom_t; -- /usr/include/xcb/xkb.h:11350 pragma Import (C, xcb_xkb_get_kbd_by_name_replies_key_names_value_list_radio_group_names, "xcb_xkb_get_kbd_by_name_replies_key_names_value_list_radio_group_names"); function xcb_xkb_get_kbd_by_name_replies_key_names_value_list_radio_group_names_length (R : System.Address; S : System.Address) return int; -- /usr/include/xcb/xkb.h:11363 pragma Import (C, xcb_xkb_get_kbd_by_name_replies_key_names_value_list_radio_group_names_length, "xcb_xkb_get_kbd_by_name_replies_key_names_value_list_radio_group_names_length"); function xcb_xkb_get_kbd_by_name_replies_key_names_value_list_radio_group_names_end (R : System.Address; S : System.Address) return XCB.xcb_generic_iterator_t; -- /usr/include/xcb/xkb.h:11377 pragma Import (C, xcb_xkb_get_kbd_by_name_replies_key_names_value_list_radio_group_names_end, "xcb_xkb_get_kbd_by_name_replies_key_names_value_list_radio_group_names_end"); function xcb_xkb_get_kbd_by_name_replies_key_names_value_list_serialize (u_buffer : System.Address; nTypes : Libc.Stdint.uint8_t; nKTLevels : Libc.Stdint.uint16_t; indicators : Libc.Stdint.uint32_t; virtualMods : Libc.Stdint.uint16_t; groupNames : Libc.Stdint.uint8_t; nKeys : Libc.Stdint.uint8_t; nKeyAliases : Libc.Stdint.uint8_t; nRadioGroups : Libc.Stdint.uint8_t; which : Libc.Stdint.uint32_t; u_aux : System.Address) return int; -- /usr/include/xcb/xkb.h:11381 pragma Import (C, xcb_xkb_get_kbd_by_name_replies_key_names_value_list_serialize, "xcb_xkb_get_kbd_by_name_replies_key_names_value_list_serialize"); function xcb_xkb_get_kbd_by_name_replies_key_names_value_list_unpack (u_buffer : System.Address; nTypes : Libc.Stdint.uint8_t; nKTLevels : Libc.Stdint.uint16_t; indicators : Libc.Stdint.uint32_t; virtualMods : Libc.Stdint.uint16_t; groupNames : Libc.Stdint.uint8_t; nKeys : Libc.Stdint.uint8_t; nKeyAliases : Libc.Stdint.uint8_t; nRadioGroups : Libc.Stdint.uint8_t; which : Libc.Stdint.uint32_t; u_aux : access xcb_xkb_get_kbd_by_name_replies_key_names_value_list_t) return int; -- /usr/include/xcb/xkb.h:11394 pragma Import (C, xcb_xkb_get_kbd_by_name_replies_key_names_value_list_unpack, "xcb_xkb_get_kbd_by_name_replies_key_names_value_list_unpack"); function xcb_xkb_get_kbd_by_name_replies_key_names_value_list_sizeof (u_buffer : System.Address; nTypes : Libc.Stdint.uint8_t; nKTLevels : Libc.Stdint.uint16_t; indicators : Libc.Stdint.uint32_t; virtualMods : Libc.Stdint.uint16_t; groupNames : Libc.Stdint.uint8_t; nKeys : Libc.Stdint.uint8_t; nKeyAliases : Libc.Stdint.uint8_t; nRadioGroups : Libc.Stdint.uint8_t; which : Libc.Stdint.uint32_t) return int; -- /usr/include/xcb/xkb.h:11407 pragma Import (C, xcb_xkb_get_kbd_by_name_replies_key_names_value_list_sizeof, "xcb_xkb_get_kbd_by_name_replies_key_names_value_list_sizeof"); function xcb_xkb_get_kbd_by_name_replies_compat_map_si_rtrn (S : System.Address) return access xcb_xkb_sym_interpret_t; -- /usr/include/xcb/xkb.h:11429 pragma Import (C, xcb_xkb_get_kbd_by_name_replies_compat_map_si_rtrn, "xcb_xkb_get_kbd_by_name_replies_compat_map_si_rtrn"); function xcb_xkb_get_kbd_by_name_replies_compat_map_si_rtrn_length (R : System.Address; S : System.Address) return int; -- /usr/include/xcb/xkb.h:11442 pragma Import (C, xcb_xkb_get_kbd_by_name_replies_compat_map_si_rtrn_length, "xcb_xkb_get_kbd_by_name_replies_compat_map_si_rtrn_length"); function xcb_xkb_get_kbd_by_name_replies_compat_map_si_rtrn_iterator (R : System.Address; S : System.Address) return xcb_xkb_sym_interpret_iterator_t; -- /usr/include/xcb/xkb.h:11456 pragma Import (C, xcb_xkb_get_kbd_by_name_replies_compat_map_si_rtrn_iterator, "xcb_xkb_get_kbd_by_name_replies_compat_map_si_rtrn_iterator"); function xcb_xkb_get_kbd_by_name_replies_compat_map_group_rtrn (S : System.Address) return access xcb_xkb_mod_def_t; -- /usr/include/xcb/xkb.h:11470 pragma Import (C, xcb_xkb_get_kbd_by_name_replies_compat_map_group_rtrn, "xcb_xkb_get_kbd_by_name_replies_compat_map_group_rtrn"); function xcb_xkb_get_kbd_by_name_replies_compat_map_group_rtrn_length (R : System.Address; S : System.Address) return int; -- /usr/include/xcb/xkb.h:11483 pragma Import (C, xcb_xkb_get_kbd_by_name_replies_compat_map_group_rtrn_length, "xcb_xkb_get_kbd_by_name_replies_compat_map_group_rtrn_length"); function xcb_xkb_get_kbd_by_name_replies_compat_map_group_rtrn_iterator (R : System.Address; S : System.Address) return xcb_xkb_mod_def_iterator_t; -- /usr/include/xcb/xkb.h:11497 pragma Import (C, xcb_xkb_get_kbd_by_name_replies_compat_map_group_rtrn_iterator, "xcb_xkb_get_kbd_by_name_replies_compat_map_group_rtrn_iterator"); function xcb_xkb_get_kbd_by_name_replies_indicator_maps_maps (S : System.Address) return access xcb_xkb_indicator_map_t; -- /usr/include/xcb/xkb.h:11511 pragma Import (C, xcb_xkb_get_kbd_by_name_replies_indicator_maps_maps, "xcb_xkb_get_kbd_by_name_replies_indicator_maps_maps"); function xcb_xkb_get_kbd_by_name_replies_indicator_maps_maps_length (R : System.Address; S : System.Address) return int; -- /usr/include/xcb/xkb.h:11524 pragma Import (C, xcb_xkb_get_kbd_by_name_replies_indicator_maps_maps_length, "xcb_xkb_get_kbd_by_name_replies_indicator_maps_maps_length"); function xcb_xkb_get_kbd_by_name_replies_indicator_maps_maps_iterator (R : System.Address; S : System.Address) return xcb_xkb_indicator_map_iterator_t; -- /usr/include/xcb/xkb.h:11538 pragma Import (C, xcb_xkb_get_kbd_by_name_replies_indicator_maps_maps_iterator, "xcb_xkb_get_kbd_by_name_replies_indicator_maps_maps_iterator"); function xcb_xkb_get_kbd_by_name_replies_key_names_value_list (R : System.Address) return access xcb_xkb_get_kbd_by_name_replies_key_names_value_list_t; -- /usr/include/xcb/xkb.h:11552 pragma Import (C, xcb_xkb_get_kbd_by_name_replies_key_names_value_list, "xcb_xkb_get_kbd_by_name_replies_key_names_value_list"); function xcb_xkb_get_kbd_by_name_replies_geometry_label_font (R : System.Address) return access xcb_xkb_counted_string_16_t; -- /usr/include/xcb/xkb.h:11565 pragma Import (C, xcb_xkb_get_kbd_by_name_replies_geometry_label_font, "xcb_xkb_get_kbd_by_name_replies_geometry_label_font"); function xcb_xkb_get_kbd_by_name_replies_serialize (u_buffer : System.Address; reported : Libc.Stdint.uint16_t; u_aux : System.Address) return int; -- /usr/include/xcb/xkb.h:11568 pragma Import (C, xcb_xkb_get_kbd_by_name_replies_serialize, "xcb_xkb_get_kbd_by_name_replies_serialize"); function xcb_xkb_get_kbd_by_name_replies_unpack (u_buffer : System.Address; reported : Libc.Stdint.uint16_t; u_aux : access xcb_xkb_get_kbd_by_name_replies_t) return int; -- /usr/include/xcb/xkb.h:11573 pragma Import (C, xcb_xkb_get_kbd_by_name_replies_unpack, "xcb_xkb_get_kbd_by_name_replies_unpack"); function xcb_xkb_get_kbd_by_name_replies_sizeof (u_buffer : System.Address; reported : Libc.Stdint.uint16_t) return int; -- /usr/include/xcb/xkb.h:11578 pragma Import (C, xcb_xkb_get_kbd_by_name_replies_sizeof, "xcb_xkb_get_kbd_by_name_replies_sizeof"); function xcb_xkb_get_kbd_by_name (c : xcb_connection_t_access; deviceSpec : xcb_xkb_device_spec_t; need : Libc.Stdint.uint16_t; want : Libc.Stdint.uint16_t; load : Libc.Stdint.uint8_t) return xcb_xkb_get_kbd_by_name_cookie_t; -- /usr/include/xcb/xkb.h:11604 pragma Import (C, xcb_xkb_get_kbd_by_name, "xcb_xkb_get_kbd_by_name"); function xcb_xkb_get_kbd_by_name_unchecked (c : xcb_connection_t_access; deviceSpec : xcb_xkb_device_spec_t; need : Libc.Stdint.uint16_t; want : Libc.Stdint.uint16_t; load : Libc.Stdint.uint8_t) return xcb_xkb_get_kbd_by_name_cookie_t; -- /usr/include/xcb/xkb.h:11636 pragma Import (C, xcb_xkb_get_kbd_by_name_unchecked, "xcb_xkb_get_kbd_by_name_unchecked"); function xcb_xkb_get_kbd_by_name_replies (R : System.Address) return System.Address; -- /usr/include/xcb/xkb.h:11653 pragma Import (C, xcb_xkb_get_kbd_by_name_replies, "xcb_xkb_get_kbd_by_name_replies"); function xcb_xkb_get_kbd_by_name_reply (c : xcb_connection_t_access; cookie : xcb_xkb_get_kbd_by_name_cookie_t; e : access xcb_generic_error_t_access) return access xcb_xkb_get_kbd_by_name_reply_t; -- /usr/include/xcb/xkb.h:11682 pragma Import (C, xcb_xkb_get_kbd_by_name_reply, "xcb_xkb_get_kbd_by_name_reply"); function xcb_xkb_get_device_info_sizeof (u_buffer : System.Address) return int; -- /usr/include/xcb/xkb.h:11687 pragma Import (C, xcb_xkb_get_device_info_sizeof, "xcb_xkb_get_device_info_sizeof"); function xcb_xkb_get_device_info (c : xcb_connection_t_access; deviceSpec : xcb_xkb_device_spec_t; wanted : Libc.Stdint.uint16_t; allButtons : Libc.Stdint.uint8_t; firstButton : Libc.Stdint.uint8_t; nButtons : Libc.Stdint.uint8_t; ledClass : xcb_xkb_led_class_spec_t; ledID : xcb_xkb_id_spec_t) return xcb_xkb_get_device_info_cookie_t; -- /usr/include/xcb/xkb.h:11715 pragma Import (C, xcb_xkb_get_device_info, "xcb_xkb_get_device_info"); function xcb_xkb_get_device_info_unchecked (c : xcb_connection_t_access; deviceSpec : xcb_xkb_device_spec_t; wanted : Libc.Stdint.uint16_t; allButtons : Libc.Stdint.uint8_t; firstButton : Libc.Stdint.uint8_t; nButtons : Libc.Stdint.uint8_t; ledClass : xcb_xkb_led_class_spec_t; ledID : xcb_xkb_id_spec_t) return xcb_xkb_get_device_info_cookie_t; -- /usr/include/xcb/xkb.h:11753 pragma Import (C, xcb_xkb_get_device_info_unchecked, "xcb_xkb_get_device_info_unchecked"); function xcb_xkb_get_device_info_name (R : System.Address) return access xcb_xkb_string8_t; -- /usr/include/xcb/xkb.h:11773 pragma Import (C, xcb_xkb_get_device_info_name, "xcb_xkb_get_device_info_name"); function xcb_xkb_get_device_info_name_length (R : System.Address) return int; -- /usr/include/xcb/xkb.h:11786 pragma Import (C, xcb_xkb_get_device_info_name_length, "xcb_xkb_get_device_info_name_length"); function xcb_xkb_get_device_info_name_end (R : System.Address) return XCB.xcb_generic_iterator_t; -- /usr/include/xcb/xkb.h:11799 pragma Import (C, xcb_xkb_get_device_info_name_end, "xcb_xkb_get_device_info_name_end"); function xcb_xkb_get_device_info_btn_actions (R : System.Address) return access xcb_xkb_action_t; -- /usr/include/xcb/xkb.h:11812 pragma Import (C, xcb_xkb_get_device_info_btn_actions, "xcb_xkb_get_device_info_btn_actions"); function xcb_xkb_get_device_info_btn_actions_length (R : System.Address) return int; -- /usr/include/xcb/xkb.h:11825 pragma Import (C, xcb_xkb_get_device_info_btn_actions_length, "xcb_xkb_get_device_info_btn_actions_length"); function xcb_xkb_get_device_info_btn_actions_iterator (R : System.Address) return xcb_xkb_action_iterator_t; -- /usr/include/xcb/xkb.h:11838 pragma Import (C, xcb_xkb_get_device_info_btn_actions_iterator, "xcb_xkb_get_device_info_btn_actions_iterator"); function xcb_xkb_get_device_info_leds_length (R : System.Address) return int; -- /usr/include/xcb/xkb.h:11851 pragma Import (C, xcb_xkb_get_device_info_leds_length, "xcb_xkb_get_device_info_leds_length"); function xcb_xkb_get_device_info_leds_iterator (R : System.Address) return xcb_xkb_device_led_info_iterator_t; -- /usr/include/xcb/xkb.h:11864 pragma Import (C, xcb_xkb_get_device_info_leds_iterator, "xcb_xkb_get_device_info_leds_iterator"); function xcb_xkb_get_device_info_reply (c : xcb_connection_t_access; cookie : xcb_xkb_get_device_info_cookie_t; e : access xcb_generic_error_t_access) return access xcb_xkb_get_device_info_reply_t; -- /usr/include/xcb/xkb.h:11893 pragma Import (C, xcb_xkb_get_device_info_reply, "xcb_xkb_get_device_info_reply"); function xcb_xkb_set_device_info_sizeof (u_buffer : System.Address) return int; -- /usr/include/xcb/xkb.h:11898 pragma Import (C, xcb_xkb_set_device_info_sizeof, "xcb_xkb_set_device_info_sizeof"); function xcb_xkb_set_device_info_checked (c : xcb_connection_t_access; deviceSpec : xcb_xkb_device_spec_t; firstBtn : Libc.Stdint.uint8_t; nBtns : Libc.Stdint.uint8_t; change : Libc.Stdint.uint16_t; nDeviceLedFBs : Libc.Stdint.uint16_t; btnActions : System.Address; leds : System.Address) return XCB.xcb_void_cookie_t; -- /usr/include/xcb/xkb.h:11929 pragma Import (C, xcb_xkb_set_device_info_checked, "xcb_xkb_set_device_info_checked"); function xcb_xkb_set_device_info (c : xcb_connection_t_access; deviceSpec : xcb_xkb_device_spec_t; firstBtn : Libc.Stdint.uint8_t; nBtns : Libc.Stdint.uint8_t; change : Libc.Stdint.uint16_t; nDeviceLedFBs : Libc.Stdint.uint16_t; btnActions : System.Address; leds : System.Address) return XCB.xcb_void_cookie_t; -- /usr/include/xcb/xkb.h:11964 pragma Import (C, xcb_xkb_set_device_info, "xcb_xkb_set_device_info"); function xcb_xkb_set_debugging_flags_sizeof (u_buffer : System.Address) return int; -- /usr/include/xcb/xkb.h:11974 pragma Import (C, xcb_xkb_set_debugging_flags_sizeof, "xcb_xkb_set_debugging_flags_sizeof"); function xcb_xkb_set_debugging_flags (c : xcb_connection_t_access; msgLength : Libc.Stdint.uint16_t; affectFlags : Libc.Stdint.uint32_t; flags : Libc.Stdint.uint32_t; affectCtrls : Libc.Stdint.uint32_t; ctrls : Libc.Stdint.uint32_t; message : access xcb_xkb_string8_t) return xcb_xkb_set_debugging_flags_cookie_t; -- /usr/include/xcb/xkb.h:12001 pragma Import (C, xcb_xkb_set_debugging_flags, "xcb_xkb_set_debugging_flags"); function xcb_xkb_set_debugging_flags_unchecked (c : xcb_connection_t_access; msgLength : Libc.Stdint.uint16_t; affectFlags : Libc.Stdint.uint32_t; flags : Libc.Stdint.uint32_t; affectCtrls : Libc.Stdint.uint32_t; ctrls : Libc.Stdint.uint32_t; message : access xcb_xkb_string8_t) return xcb_xkb_set_debugging_flags_cookie_t; -- /usr/include/xcb/xkb.h:12037 pragma Import (C, xcb_xkb_set_debugging_flags_unchecked, "xcb_xkb_set_debugging_flags_unchecked"); function xcb_xkb_set_debugging_flags_reply (c : xcb_connection_t_access; cookie : xcb_xkb_set_debugging_flags_cookie_t; e : access xcb_generic_error_t_access) return access xcb_xkb_set_debugging_flags_reply_t; -- /usr/include/xcb/xkb.h:12072 pragma Import (C, xcb_xkb_set_debugging_flags_reply, "xcb_xkb_set_debugging_flags_reply"); end XCB.XKB;
package body FunctionX is type Employee is record EmployeeNumber : Integer; FirstName : String(1 .. 8); LastName : String(1 .. 6); HourlySalary : Float; end record; end FunctionX;
-- -- (c) Copyright 1993,1994,1995,1996 Silicon Graphics, Inc. -- ALL RIGHTS RESERVED -- Permission to use, copy, modify, and distribute this software for -- any purpose and without fee is hereby granted, provided that the above -- copyright notice appear in all copies and that both the copyright notice -- and this permission notice appear in supporting documentation, and that -- the name of Silicon Graphics, Inc. not be used in advertising -- or publicity pertaining to distribution of the software without specific, -- written prior permission. -- -- THE MATERIAL EMBODIED ON THIS SOFTWARE IS PROVIDED TO YOU "AS-IS" -- AND WITHOUT WARRANTY OF ANY KIND, EXPRESS, IMPLIED OR OTHERWISE, -- INCLUDING WITHOUT LIMITATION, ANY WARRANTY OF MERCHANTABILITY OR -- FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL SILICON -- GRAPHICS, INC. BE LIABLE TO YOU OR ANYONE ELSE FOR ANY DIRECT, -- SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY -- KIND, OR ANY DAMAGES WHATSOEVER, INCLUDING WITHOUT LIMITATION, -- LOSS OF PROFIT, LOSS OF USE, SAVINGS OR REVENUE, OR THE CLAIMS OF -- THIRD PARTIES, WHETHER OR NOT SILICON GRAPHICS, INC. HAS BEEN -- ADVISED OF THE POSSIBILITY OF SUCH LOSS, HOWEVER CAUSED AND ON -- ANY THEORY OF LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE -- POSSESSION, USE OR PERFORMANCE OF THIS SOFTWARE. -- -- US Government Users Restricted Rights -- Use, duplication, or disclosure by the Government is subject to -- restrictions set forth in FAR 52.227.19(c)(2) or subparagraph -- (c)(1)(ii) of the Rights in Technical Data and Computer Software -- clause at DFARS 252.227-7013 and/or in similar or successor -- clauses in the FAR or the DOD or NASA FAR Supplement. -- Unpublished-- rights reserved under the copyright laws of the -- United States. Contractor/manufacturer is Silicon Graphics, -- Inc., 2011 N. Shoreline Blvd., Mountain View, CA 94039-7311. -- -- OpenGL(TM) is a trademark of Silicon Graphics, Inc. -- with GL; use GL; with GLU; use GLU; with GLUT; use GLUT; with Text_IO; package body PickDepth_Procs is package tio renames Text_IO; procedure DoInit is begin glClearColor (0.0, 0.0, 0.0, 0.0); glDepthFunc (GL_LESS); glEnable (GL_DEPTH_TEST); glShadeModel (GL_FLAT); glDepthRange (0.0, 1.0); end DoInit; procedure DrawRects (mode : RenderingMode) is begin if mode = GL_SELECT then glLoadName (1); end if; glBegin (GL_QUADS); glColor3f (1.0, 1.0, 0.0); glVertex3i (2, 0, 0); glVertex3i (2, 6, 0); glVertex3i (6, 6, 0); glVertex3i (6, 0, 0); glEnd; if mode = GL_SELECT then glLoadName (2); end if; glBegin (GL_QUADS); glColor3f (0.0, 1.0, 1.0); glVertex3i (3, 2, -1); glVertex3i (3, 8, -1); glVertex3i (8, 8, -1); glVertex3i (8, 2, -1); glEnd; if mode = GL_SELECT then glLoadName (3); end if; glBegin (GL_QUADS); glColor3f (1.0, 0.0, 1.0); glVertex3i (0, 2, -2); glVertex3i (0, 7, -2); glVertex3i (5, 7, -2); glVertex3i (5, 2, -2); glEnd; end DrawRects; type int_ar is array (Integer range <>) of aliased GLuint; procedure ProcessHits (hits : GLint; buffer : in int_ar) is j : Integer := buffer'First; begin tio.Put_Line ("Hits = " & GLint'Image (hits)); if hits /= 0 then for i in Integer (buffer'First) .. Integer (buffer'First + Integer (hits) - 1) loop tio.Put_Line (" number of names for hit = " & GLuint'Image (buffer (j))); j := j + 1; tio.Put (" z1 is " & GLuint'Image (buffer (j))); j := j + 1; tio.Put ("; z2 is " & GLuint'Image (buffer (j))); j := j + 1; tio.New_Line; tio.Put (" names:"); for k in 1 .. Integer (buffer (buffer'First)) loop tio.Put (" " & GLuint'Image (buffer (j))); j := j + 1; end loop; tio.New_Line; end loop; end if; end ProcessHits; BUFSIZE : constant := 512; procedure PickRects (btn : Integer; state: Integer; x, y: Integer) is selectBuf : array (1 .. BUFSIZE) of aliased GLuint; hits : GLint; viewport : array (0 .. 3) of aliased GLint; begin if state = GLUT_LEFT_BUTTON then if state = GLUT_DOWN then glGetIntegerv (GL_VIEWPORT, viewport (0)'Access); glSelectBuffer (BUFSIZE, selectBuf (1)'Access); hits := glRenderMode (GL_SELECT); glInitNames; glPushName (-1); glMatrixMode (GL_PROJECTION); glPushMatrix; glLoadIdentity; gluPickMatrix (GLdouble (x), GLdouble (viewport (3) - GLint(y)), 5.0, 5.0, viewport (0)'Access); glOrtho (0.0, 8.0, 0.0, 8.0, -0.5, 2.5); DrawRects (GL_SELECT); glPopMatrix; glFlush; hits := glRenderMode (GL_RENDER); ProcessHits (hits, int_ar (selectBuf)); end if; end if; end PickRects; procedure DoDisplay is begin glClear (GL_COLOR_BUFFER_BIT or GL_DEPTH_BUFFER_BIT); DrawRects (GL_RENDER); glFlush; end DoDisplay; procedure ReshapeCallback (w : Integer; h : Integer) is begin glViewport (0, 0, GLsizei(w), GLsizei(h)); glMatrixMode (GL_PROJECTION); glLoadIdentity; glOrtho (0.0, 8.0, 0.0, 8.0, -0.5, 2.5); glMatrixMode (GL_MODELVIEW); glLoadIdentity; end ReshapeCallback; end PickDepth_Procs;
-- Copyright (c) 2017 Maxim Reznik <reznikmm@gmail.com> -- -- SPDX-License-Identifier: MIT -- License-Filename: LICENSE ------------------------------------------------------------- with GNAT.Sockets; with Interfaces.C; with Ada.Unchecked_Conversion; package body LSP.Stdio_Streams is package C renames Interfaces.C; function To_Ada is new Ada.Unchecked_Conversion (Integer, GNAT.Sockets.Socket_Type); ---------- -- Read -- ---------- procedure Read (Stream : in out Stdio_Stream; Item : out Ada.Streams.Stream_Element_Array; Last : out Ada.Streams.Stream_Element_Offset) is pragma Unreferenced (Stream); use type Ada.Streams.Stream_Element_Offset; function read (fildes : C.int; buf : out Ada.Streams.Stream_Element_Array; nbyte : C.size_t) return C.size_t with Import => True, Convention => C, External_Name => "read"; Stdin : constant GNAT.Sockets.Socket_Type := To_Ada (0); Request : GNAT.Sockets.Request_Type (GNAT.Sockets.N_Bytes_To_Read); Length : Natural; Done : C.size_t; begin GNAT.Sockets.Control_Socket (Stdin, Request); if Request.Size = 0 then Length := 1; else Length := Natural'Min (Item'Length, Request.Size); end if; Done := read (0, Item, C.size_t (Length)); Last := Item'First + Ada.Streams.Stream_Element_Offset (Done) - 1; if Last < Item'First then raise Constraint_Error with "end of file"; end if; end Read; ----------- -- Write -- ----------- procedure Write (Stream : in out Stdio_Stream; Item : Ada.Streams.Stream_Element_Array) is function write (fildes : C.int; buf : Ada.Streams.Stream_Element_Array; nbyte : C.size_t) return C.size_t with Import => True, Convention => C, External_Name => "write"; pragma Unreferenced (Stream); Ignore : C.size_t := write (1, Item, Item'Length); begin null; end Write; end LSP.Stdio_Streams;
with Ada.Text_IO; use Ada.Text_IO; package body Infrastructure is protected body Steering is entry SetNumber(CorrectNumber: in SteeringNumber) when OwnNumber = -1 is begin OwnNumber := CorrectNumber; end; entry Incoming(CurrentTram: in TramNumber) when not CurrentlyOccupied is begin CurrentlyOccupied := True; OccupierNumber := CurrentTram; end; entry Leaving when CurrentlyOccupied is begin CurrentlyOccupied := False; OccupierNumber := -1; end; entry CheckStatus when True is currentOccupierString: String := TramNumber'Image(OccupierNumber); steeringNumberString: String := SteeringNumber'Image(OwnNumber); begin Put("Steering: "); Put(steeringNumberString); if CurrentlyOccupied then Put(" occupied by tram: "); Put_Line(currentOccupierString); else Put_Line(" empty"); end if; end; end Steering; end Infrastructure;
pragma License (Unrestricted); -- extended unit with Ada.IO_Exceptions; with System.Storage_Elements; private with Ada.Finalization; private with System.Reference_Counting; package Ada.Streams.Unbounded_Storage_IO is -- Temporary stream on memory. pragma Preelaborate; type Buffer_Type is private; procedure Reset (Object : in out Buffer_Type); function Size (Object : Buffer_Type) return Stream_Element_Count; procedure Set_Size ( Object : in out Buffer_Type; Size : Stream_Element_Count); pragma Inline (Size); function Capacity (Object : Buffer_Type) return Stream_Element_Count; procedure Reserve_Capacity ( Object : in out Buffer_Type; Capacity : Stream_Element_Count); pragma Inline (Capacity); -- direct storage accessing function Storage_Address (Object : aliased in out Buffer_Type) return System.Address; function Storage_Size (Object : Buffer_Type) return System.Storage_Elements.Storage_Count; pragma Inline (Storage_Size); -- streaming function Stream (Object : Buffer_Type) return not null access Root_Stream_Type'Class; pragma Inline (Stream); procedure Write_To_Stream ( Stream : not null access Root_Stream_Type'Class; Item : Buffer_Type); -- Exceptions End_Error : exception renames IO_Exceptions.End_Error; private type Stream_Element_Array_Access is access Stream_Element_Array; type Data is record -- "limited" prevents No_Elaboration_Code Reference_Count : aliased System.Reference_Counting.Counter; Max_Length : aliased System.Reference_Counting.Length_Type; Capacity : Stream_Element_Count; Storage : System.Address; -- the storage would be allocated in here end record; pragma Suppress_Initialization (Data); type Data_Access is access all Data; Empty_Data : aliased constant Data := ( Reference_Count => System.Reference_Counting.Static, Max_Length => 0, Capacity => 0, Storage => System.Null_Address); type Non_Controlled_Buffer_Type; type Stream_Type is limited new Seekable_Stream_Type with record Buffer : not null access Non_Controlled_Buffer_Type; end record; overriding procedure Read ( Stream : in out Stream_Type; Item : out Stream_Element_Array; Last : out Stream_Element_Offset); overriding procedure Write ( Stream : in out Stream_Type; Item : Stream_Element_Array); overriding procedure Set_Index ( Stream : in out Stream_Type; To : Stream_Element_Positive_Count); overriding function Index (Stream : Stream_Type) return Stream_Element_Positive_Count; overriding function Size (Stream : Stream_Type) return Stream_Element_Count; type Stream_Access is access Stream_Type; type Non_Controlled_Buffer_Type is record Data : aliased not null Data_Access; Last : Stream_Element_Offset; Index : Stream_Element_Offset; Stream : Stream_Access; end record; pragma Suppress_Initialization (Non_Controlled_Buffer_Type); package Controlled is type Buffer_Type is private; function Reference (Object : Unbounded_Storage_IO.Buffer_Type) return not null access Non_Controlled_Buffer_Type; pragma Inline (Reference); private type Buffer_Type is new Finalization.Controlled with record Data : aliased Non_Controlled_Buffer_Type := ( Data => Data_Access'(Empty_Data'Unrestricted_Access), Last => 0, Index => 1, Stream => null); end record; overriding procedure Adjust (Object : in out Buffer_Type); overriding procedure Finalize (Object : in out Buffer_Type); package Streaming is procedure Read ( Stream : not null access Root_Stream_Type'Class; Item : out Buffer_Type); procedure Write ( Stream : not null access Root_Stream_Type'Class; Item : Buffer_Type); end Streaming; for Buffer_Type'Read use Streaming.Read; for Buffer_Type'Write use Streaming.Write; end Controlled; type Buffer_Type is new Controlled.Buffer_Type; end Ada.Streams.Unbounded_Storage_IO;
------------------------------------------------------------------------------ -- -- -- Standard Peripheral Library for STM32 Targets -- -- -- -- Copyright (C) 2014, Free Software Foundation, Inc. -- -- -- -- GNAT is free software; you can redistribute it and/or modify it under -- -- terms of the GNU General Public License as published by the Free Soft- -- -- ware Foundation; either version 3, or (at your option) any later ver- -- -- sion. GNAT is distributed in the hope that it will be useful, but WITH- -- -- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY -- -- or FITNESS FOR A PARTICULAR PURPOSE. -- -- -- -- As a special exception under Section 7 of GPL version 3, you are granted -- -- additional permissions described in the GCC Runtime Library Exception, -- -- version 3.1, as published by the Free Software Foundation. -- -- -- -- You should have received a copy of the GNU General Public License and -- -- a copy of the GCC Runtime Library Exception along with this program; -- -- see the files COPYING3 and COPYING.RUNTIME respectively. If not, see -- -- <http://www.gnu.org/licenses/>. -- -- -- -- GNAT was originally developed by the GNAT team at New York University. -- -- Extensive contributions were provided by Ada Core Technologies Inc. -- -- -- ------------------------------------------------------------------------------ -- This file provides definitions for the STM32F7 (ARM Cortex M7F -- from ST Microelectronics) Inter-Integrated Circuit (I2C) facility. private with STM32_SVD.I2C; with HAL.I2C; package STM32.I2C is type I2C_Direction is (Transmitter, Receiver); type I2C_Addressing_Mode is (Addressing_Mode_7bit, Addressing_Mode_10bit); type I2C_Configuration is record Clock_Speed : Word; Addressing_Mode : I2C_Addressing_Mode; Own_Address : UInt10; -- an I2C general call dispatches the same data to all connected -- devices. General_Call_Enabled : Boolean := False; -- Clock stretching is a mean for a slave device to slow down the -- i2c clock in order to process the communication. Clock_Stretching_Enabled : Boolean := True; end record; subtype I2C_Address is UInt10; I2C_Timeout : exception; I2C_Error : exception; type Internal_I2C_Port is private; type I2C_Port (Periph : not null access Internal_I2C_Port) is new HAL.I2C.I2C_Port with private; function Port_Enabled (Port : I2C_Port) return Boolean with Inline; procedure Configure (Port : in out I2C_Port; Configuration : I2C_Configuration) with Pre => not Is_Configured (Port), Post => Is_Configured (Port); function Is_Configured (Port : I2C_Port) return Boolean; overriding procedure Master_Transmit (Port : in out I2C_Port; Addr : HAL.I2C.I2C_Address; Data : HAL.I2C.I2C_Data; Status : out HAL.I2C.I2C_Status; Timeout : Natural := 1000) with Pre => Is_Configured (Port); overriding procedure Master_Receive (Port : in out I2C_Port; Addr : HAL.I2C.I2C_Address; Data : out HAL.I2C.I2C_Data; Status : out HAL.I2C.I2C_Status; Timeout : Natural := 1000) with Pre => Is_Configured (Port); overriding procedure Mem_Write (Port : in out I2C_Port; Addr : HAL.I2C.I2C_Address; Mem_Addr : Short; Mem_Addr_Size : HAL.I2C.I2C_Memory_Address_Size; Data : HAL.I2C.I2C_Data; Status : out HAL.I2C.I2C_Status; Timeout : Natural := 1000) with Pre => Is_Configured (Port); overriding procedure Mem_Read (Port : in out I2C_Port; Addr : HAL.I2C.I2C_Address; Mem_Addr : Short; Mem_Addr_Size : HAL.I2C.I2C_Memory_Address_Size; Data : out HAL.I2C.I2C_Data; Status : out HAL.I2C.I2C_Status; Timeout : Natural := 1000) with Pre => Is_Configured (Port); private type I2C_State is (Reset, Ready, Master_Busy_Tx, Master_Busy_Rx, Mem_Busy_Tx, Mem_Busy_Rx); type Internal_I2C_Port is new STM32_SVD.I2C.I2C_Peripheral; type I2C_Port (Periph : not null access Internal_I2C_Port) is new HAL.I2C.I2C_Port with record Config : I2C_Configuration; State : I2C_State := Reset; end record; end STM32.I2C;
with MAT.Types; with MAT.Expressions; with Ada.Text_IO; with MAT.Expressions.Lexer_dfa; with MAT.Expressions.Parser_IO; package body MAT.Expressions.Lexer is use Ada.Text_IO; use Ada; use MAT.Expressions.Lexer_dfa; use MAT.Expressions.Parser_IO; Line_Number : Natural := 0; pragma Style_Checks (Off); pragma Warnings (Off); function YYLex return Token is subtype Short is Integer range -32768 .. 32767; yy_act : Integer; yy_c : Short; -- returned upon end-of-file YY_END_TOK : constant Integer := 0; YY_END_OF_BUFFER : constant := 49; subtype yy_state_type is Integer; yy_current_state : yy_state_type; INITIAL : constant := 0; yy_accept : constant array (0 .. 127) of Short := (0, 0, 0, 49, 47, 1, 48, 44, 45, 47, 29, 30, 33, 47, 42, 42, 35, 39, 37, 31, 47, 32, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 1, 45, 0, 34, 0, 42, 0, 36, 38, 28, 41, 45, 45, 45, 45, 17, 45, 16, 45, 45, 45, 45, 18, 23, 45, 45, 45, 3, 45, 45, 45, 25, 45, 46, 43, 40, 45, 45, 22, 4, 45, 45, 45, 45, 45, 27, 45, 45, 45, 5, 45, 45, 45, 45, 20, 45, 45, 45, 45, 12, 24, 14, 45, 45, 45, 19, 45, 2, 6, 45, 45, 21, 45, 45, 45, 45, 45, 7, 26, 11, 15, 45, 10, 8, 13, 45, 45, 45, 45, 9, 0 ); yy_ec : constant array (ASCII.NUL .. Character'Last) of Short := (0, 1, 1, 1, 1, 1, 1, 1, 1, 2, 3, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 1, 4, 1, 5, 1, 1, 6, 7, 8, 1, 1, 9, 1, 10, 1, 11, 12, 12, 12, 12, 12, 12, 12, 13, 13, 1, 1, 14, 15, 16, 1, 1, 17, 17, 17, 17, 17, 17, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 18, 19, 20, 1, 5, 1, 21, 22, 23, 24, 25, 26, 5, 27, 28, 5, 29, 30, 31, 32, 33, 5, 5, 34, 35, 36, 5, 37, 38, 39, 40, 41, 1, 1, 1, 1, 1, others => 1 ); yy_meta : constant array (0 .. 41) of Short := (0, 1, 1, 1, 1, 2, 1, 1, 1, 1, 2, 3, 3, 3, 1, 1, 1, 3, 1, 1, 1, 3, 3, 3, 3, 3, 3, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2 ); yy_base : constant array (0 .. 129) of Short := (0, 0, 0, 152, 153, 149, 153, 153, 0, 147, 153, 153, 153, 139, 32, 36, 133, 153, 132, 153, 47, 153, 30, 27, 118, 108, 110, 122, 29, 117, 120, 107, 105, 113, 109, 24, 108, 133, 0, 128, 153, 57, 62, 0, 153, 153, 153, 65, 109, 96, 101, 106, 0, 103, 0, 94, 102, 30, 91, 0, 0, 104, 94, 52, 0, 102, 81, 87, 0, 84, 153, 68, 0, 85, 93, 0, 0, 84, 91, 83, 89, 82, 0, 83, 81, 76, 0, 79, 83, 82, 79, 0, 71, 70, 80, 66, 0, 0, 0, 68, 75, 69, 0, 77, 69, 0, 71, 59, 0, 71, 68, 59, 67, 55, 0, 0, 0, 0, 63, 0, 0, 64, 48, 55, 49, 33, 0, 153, 87, 50 ); yy_def : constant array (0 .. 129) of Short := (0, 127, 1, 127, 127, 127, 127, 127, 128, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 127, 128, 127, 127, 127, 127, 129, 127, 127, 127, 127, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 127, 127, 129, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 0, 127, 127 ); yy_nxt : constant array (0 .. 194) of Short := (0, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 15, 16, 17, 18, 8, 19, 20, 21, 22, 23, 8, 24, 25, 26, 27, 28, 8, 29, 30, 31, 32, 33, 34, 35, 8, 36, 8, 8, 8, 41, 42, 42, 42, 41, 42, 42, 42, 46, 67, 53, 72, 48, 80, 49, 68, 47, 47, 50, 59, 51, 81, 60, 126, 52, 54, 71, 71, 71, 43, 41, 42, 42, 42, 47, 47, 85, 71, 71, 71, 125, 124, 123, 122, 121, 120, 86, 38, 38, 119, 118, 117, 116, 115, 114, 113, 112, 111, 110, 109, 108, 107, 106, 105, 104, 103, 102, 101, 100, 99, 98, 97, 96, 95, 94, 93, 92, 91, 90, 89, 88, 87, 84, 83, 82, 79, 78, 77, 76, 75, 74, 73, 70, 37, 69, 66, 65, 64, 63, 62, 61, 58, 57, 56, 55, 45, 44, 40, 39, 37, 127, 3, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127 ); yy_chk : constant array (0 .. 194) of Short := (0, 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, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 14, 14, 14, 14, 15, 15, 15, 15, 20, 35, 23, 129, 22, 57, 22, 35, 20, 20, 22, 28, 22, 57, 28, 125, 22, 23, 41, 41, 41, 14, 42, 42, 42, 42, 47, 47, 63, 71, 71, 71, 124, 123, 122, 121, 118, 113, 63, 128, 128, 112, 111, 110, 109, 107, 106, 104, 103, 101, 100, 99, 95, 94, 93, 92, 90, 89, 88, 87, 85, 84, 83, 81, 80, 79, 78, 77, 74, 73, 69, 67, 66, 65, 62, 61, 58, 56, 55, 53, 51, 50, 49, 48, 39, 37, 36, 34, 33, 32, 31, 30, 29, 27, 26, 25, 24, 18, 16, 13, 9, 5, 3, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127 ); -- copy whatever the last rule matched to the standard output -- enter a start condition. -- Using procedure requires a () after the ENTER, but makes everything -- much neater. procedure ENTER (state : Integer) is begin yy_start := 1 + 2 * state; end ENTER; -- action number for EOF rule of a given start state function YY_STATE_EOF (state : Integer) return Integer is begin return YY_END_OF_BUFFER + state + 1; end YY_STATE_EOF; -- return all but the first 'n' matched characters back to the input stream procedure yyless (n : Integer) is begin yy_ch_buf (yy_cp) := yy_hold_char; -- undo effects of setting up yytext yy_cp := yy_bp + n; yy_c_buf_p := yy_cp; YY_DO_BEFORE_ACTION; -- set up yytext again end yyless; -- redefine this if you have something you want each time. procedure YY_USER_ACTION is begin null; end YY_USER_ACTION; -- yy_get_previous_state - get the state just before the EOB char was reached function yy_get_previous_state return yy_state_type is yy_current_state : yy_state_type; yy_c : Short; begin yy_current_state := yy_start; for yy_cp in yytext_ptr .. yy_c_buf_p - 1 loop yy_c := yy_ec (yy_ch_buf (yy_cp)); if yy_accept (yy_current_state) /= 0 then yy_last_accepting_state := yy_current_state; yy_last_accepting_cpos := yy_cp; end if; while yy_chk (yy_base (yy_current_state) + yy_c) /= yy_current_state loop yy_current_state := yy_def (yy_current_state); if yy_current_state >= 128 then yy_c := yy_meta (yy_c); end if; end loop; yy_current_state := yy_nxt (yy_base (yy_current_state) + yy_c); end loop; return yy_current_state; end yy_get_previous_state; procedure yyrestart (input_file : File_Type) is begin Open_Input (Text_IO.Name (input_file)); end yyrestart; begin -- of YYLex <<new_file>> -- this is where we enter upon encountering an end-of-file and -- yyWrap () indicating that we should continue processing if yy_init then if yy_start = 0 then yy_start := 1; -- first start state end if; -- we put in the '\n' and start reading from [1] so that an -- initial match-at-newline will be true. yy_ch_buf (0) := ASCII.LF; yy_n_chars := 1; -- we always need two end-of-buffer characters. The first causes -- a transition to the end-of-buffer state. The second causes -- a jam in that state. yy_ch_buf (yy_n_chars) := YY_END_OF_BUFFER_CHAR; yy_ch_buf (yy_n_chars + 1) := YY_END_OF_BUFFER_CHAR; yy_eof_has_been_seen := False; yytext_ptr := 1; yy_c_buf_p := yytext_ptr; yy_hold_char := yy_ch_buf (yy_c_buf_p); yy_init := False; end if; -- yy_init loop -- loops until end-of-file is reached yy_cp := yy_c_buf_p; -- support of yytext yy_ch_buf (yy_cp) := yy_hold_char; -- yy_bp points to the position in yy_ch_buf of the start of the -- current run. yy_bp := yy_cp; yy_current_state := yy_start; loop yy_c := yy_ec (yy_ch_buf (yy_cp)); if yy_accept (yy_current_state) /= 0 then yy_last_accepting_state := yy_current_state; yy_last_accepting_cpos := yy_cp; end if; while yy_chk (yy_base (yy_current_state) + yy_c) /= yy_current_state loop yy_current_state := yy_def (yy_current_state); if yy_current_state >= 128 then yy_c := yy_meta (yy_c); end if; end loop; yy_current_state := yy_nxt (yy_base (yy_current_state) + yy_c); yy_cp := yy_cp + 1; if yy_current_state = 127 then exit; end if; end loop; yy_cp := yy_last_accepting_cpos; yy_current_state := yy_last_accepting_state; <<next_action>> yy_act := yy_accept (yy_current_state); YY_DO_BEFORE_ACTION; YY_USER_ACTION; if aflex_debug then -- output acceptance info. for (-d) debug mode Text_IO.Put (Standard_Error, "--accepting rule #"); Text_IO.Put (Standard_Error, Integer'Image (yy_act)); Text_IO.Put_Line (Standard_Error, "(""" & YYText & """)"); end if; <<do_action>> -- this label is used only to access EOF actions case yy_act is when 0 => -- must backtrack -- undo the effects of YY_DO_BEFORE_ACTION yy_ch_buf (yy_cp) := yy_hold_char; yy_cp := yy_last_accepting_cpos; yy_current_state := yy_last_accepting_state; goto next_action; when 1 => --# line 4 "mat-expressions-lexer.l" null; when 2 => --# line 6 "mat-expressions-lexer.l" return T_WITH; when 3 => --# line 7 "mat-expressions-lexer.l" return T_OR; when 4 => --# line 8 "mat-expressions-lexer.l" return T_AND; when 5 => --# line 9 "mat-expressions-lexer.l" return T_NOT; when 6 => --# line 10 "mat-expressions-lexer.l" return T_AFTER; when 7 => --# line 11 "mat-expressions-lexer.l" return T_BEFORE; when 8 => --# line 12 "mat-expressions-lexer.l" return T_WITHIN; when 9 => --# line 13 "mat-expressions-lexer.l" return T_REALLOCATION; when 10 => --# line 14 "mat-expressions-lexer.l" return T_THREAD; when 11 => --# line 15 "mat-expressions-lexer.l" return T_MALLOC; when 12 => --# line 16 "mat-expressions-lexer.l" return T_FREE; when 13 => --# line 17 "mat-expressions-lexer.l" return T_REALLOC; when 14 => --# line 18 "mat-expressions-lexer.l" return T_LEAK; when 15 => --# line 19 "mat-expressions-lexer.l" return T_NO_FREE; when 16 => --# line 20 "mat-expressions-lexer.l" return T_BY; when 17 => --# line 21 "mat-expressions-lexer.l" return T_AT; when 18 => --# line 22 "mat-expressions-lexer.l" return T_IN; when 19 => --# line 23 "mat-expressions-lexer.l" return T_SIZE; when 20 => --# line 24 "mat-expressions-lexer.l" return T_ADDR; when 21 => --# line 25 "mat-expressions-lexer.l" return T_EVENT; when 22 => --# line 26 "mat-expressions-lexer.l" return T_ALL; when 23 => --# line 27 "mat-expressions-lexer.l" return T_IS; when 24 => --# line 28 "mat-expressions-lexer.l" return T_FROM; when 25 => --# line 29 "mat-expressions-lexer.l" return T_TO; when 26 => --# line 30 "mat-expressions-lexer.l" return T_DIRECT; when 27 => --# line 31 "mat-expressions-lexer.l" return T_HAS; when 28 => --# line 32 "mat-expressions-lexer.l" Line_Number := Line_Number + 1; when 29 => --# line 33 "mat-expressions-lexer.l" return '('; when 30 => --# line 34 "mat-expressions-lexer.l" return ')'; when 31 => --# line 35 "mat-expressions-lexer.l" return '['; when 32 => --# line 36 "mat-expressions-lexer.l" return ']'; when 33 => --# line 37 "mat-expressions-lexer.l" return ','; when 34 => --# line 38 "mat-expressions-lexer.l" return T_RANGE; when 35 => --# line 39 "mat-expressions-lexer.l" return T_LT; when 36 => --# line 40 "mat-expressions-lexer.l" return T_LE; when 37 => --# line 41 "mat-expressions-lexer.l" return T_GT; when 38 => --# line 42 "mat-expressions-lexer.l" return T_GE; when 39 => --# line 43 "mat-expressions-lexer.l" return T_EQ; when 40 => --# line 45 "mat-expressions-lexer.l" yylval.low := MAT.Types.Hex_Value (YYText (YYText'First + 2 .. YYText'Last)); return T_INT; when 41 => --# line 48 "mat-expressions-lexer.l" yylval.low := MAT.Types.Uint64'Value (YYText); return T_INT; when 42 => --# line 52 "mat-expressions-lexer.l" yylval.low := MAT.Types.Uint64'Value (YYText); return T_INT; when 43 => --# line 56 "mat-expressions-lexer.l" yylval.low := MAT.Types.Uint64 (MAT.Types.Tick_Value (YYText)); return T_TIME; when 44 => --# line 60 "mat-expressions-lexer.l" return T_STRING; when 45 => --# line 63 "mat-expressions-lexer.l" return T_NAME; when 46 => --# line 66 "mat-expressions-lexer.l" Line_Number := Line_Number + 1; when 47 => --# line 67 "mat-expressions-lexer.l" null; when 48 => --# line 68 "mat-expressions-lexer.l" raise AFLEX_SCANNER_JAMMED; when YY_END_OF_BUFFER + INITIAL + 1 => return End_Of_Input; when YY_END_OF_BUFFER => -- undo the effects of YY_DO_BEFORE_ACTION yy_ch_buf (yy_cp) := yy_hold_char; yytext_ptr := yy_bp; case yy_get_next_buffer is when EOB_ACT_END_OF_FILE => if yyWrap then -- note: because we've taken care in -- yy_get_next_buffer() to have set up yytext, -- we can now set up yy_c_buf_p so that if some -- total hoser (like aflex itself) wants -- to call the scanner after we return the -- End_Of_Input, it'll still work - another -- End_Of_Input will get returned. yy_c_buf_p := yytext_ptr; yy_act := YY_STATE_EOF ((yy_start - 1) / 2); goto do_action; else -- start processing a new file yy_init := True; goto new_file; end if; when EOB_ACT_RESTART_SCAN => yy_c_buf_p := yytext_ptr; yy_hold_char := yy_ch_buf (yy_c_buf_p); when EOB_ACT_LAST_MATCH => yy_c_buf_p := yy_n_chars; yy_current_state := yy_get_previous_state; yy_cp := yy_c_buf_p; yy_bp := yytext_ptr; goto next_action; when others => null; end case; -- case yy_get_next_buffer() when others => Text_IO.Put ("action # "); Text_IO.Put (Integer'Image (yy_act)); Text_IO.New_Line; raise AFLEX_INTERNAL_ERROR; end case; -- case (yy_act) end loop; -- end of loop waiting for end of file end YYLex; --# line 68 "mat-expressions-lexer.l" pragma Style_Checks (On); end MAT.Expressions.Lexer;
-- ___ _ ___ _ _ -- -- / __| |/ (_) | | Common SKilL implementation -- -- \__ \ ' <| | | |__ API types for skill types -- -- |___/_|\_\_|_|____| by: Timm Felden, Dennis Przytarski -- -- -- pragma Ada_2012; with Ada.Containers.Doubly_Linked_Lists; with Ada.Containers.Hashed_Sets; with Ada.Containers.Hashed_Maps; with Ada.Tags; with Interfaces; with System; limited with Skill.Field_Declarations; with Skill.Containers; package Skill.Types is -- this is a boxed object; it is required, because one can not mix generic -- and object oriented polymorphism in ada. -- we use size of pointer and store all regular object in it by just abusing -- the space :-] type Box is access String; function Hash (This : Box) return Ada.Containers.Hash_Type; subtype i8 is Interfaces.Integer_8 range Interfaces.Integer_8'Range; subtype i16 is Interfaces.Integer_16 range Interfaces.Integer_16'Range; subtype i32 is Interfaces.Integer_32 range Interfaces.Integer_32'Range; subtype i64 is Interfaces.Integer_64 range Interfaces.Integer_64'Range; subtype v64 is Interfaces.Integer_64 range Interfaces.Integer_64'Range; -- used in places, where v64 values are used as lengths or counts subtype Uv64 is Interfaces.Unsigned_64 range Interfaces.Unsigned_64'Range; -- TF: we can not restrict range, because that would destroy NaNs, right? subtype F32 is Interfaces.IEEE_Float_32; subtype F64 is Interfaces.IEEE_Float_64; type String_Access is access String; type String_Access_Array is array (Integer range <>) of not null String_Access; type String_Access_Array_Access is access all String_Access_Array; subtype Boxed_Array is Skill.Containers.Boxed_Array; subtype Boxed_List is Skill.Containers.Boxed_Array; subtype Boxed_Map is Skill.Containers.Boxed_Map; -- declare skill ids type for later configuration subtype Skill_ID_T is Integer; -- we use integer IDs, because they are smaller and we would -- internal use only! type Skill_Object is tagged record Skill_ID : Skill_ID_T; end record; type Annotation is access all Skill_Object; type Annotation_Dyn is access all Skill_Object'Class; type Annotation_Array_T is array (Positive range <>) of Annotation; type Annotation_Array is access Annotation_Array_T; -- default type conversion for root type function To_Annotation (This : access Skill_Object'Class) return Skill.Types.Annotation; pragma Inline (To_Annotation); pragma Pure_Function (To_Annotation); function Skill_Name (This : access Skill_Object) return String_Access; function Dynamic (This : access Skill_Object) return Annotation_Dyn; pragma Inline (Dynamic); pragma Pure_Function (Dynamic); -- return true, iff the argument object will be deleted on the next flush -- operation -- @note: references to the object carried by other managed skill objects -- will be deleted automatically function Is_Deleted(This : access Skill_Object'Class) return Boolean is (0 = This.Skill_ID); function Tag (This : access Skill_Object'Class) return Ada.Tags.Tag is (This'Tag); pragma Inline (Tag); pragma Pure_Function (Tag); -- reflective getter function Reflective_Get (This : access Skill_Object; F : Skill.Field_Declarations.Field_Declaration) return Box; -- reflective setter procedure Reflective_Set (This : access Skill_Object; F : Field_Declarations.Field_Declaration; V : Box); end Skill.Types;
package body Numerics.Sparse_Matrices is procedure Dense (Sp : in Sparse_Matrix; A : out Real_Matrix) is Offset_1 : constant Integer := A'First (1) - 1; Offset_2 : constant Integer := A'First (2) - 1; begin for X of A loop X := 0.0; end loop; for J in 1 .. N_Col (Sp) loop for P in Sp.P (J) .. Sp.P (J + 1) - 1 loop A (Sp.I (P) + Offset_1, J + Offset_2) := Sp.X (P); end loop; end loop; end Dense; function Dense (Sp : in Sparse_Matrix) return Real_Matrix is A : Real_Matrix (1 .. N_Row (Sp), 1 .. N_Col (Sp)); begin Dense (Sp, A); return A; end Dense; procedure Print (Mat : in Sparse_Matrix) is separate; ------------------------------------------------------------------ ------------------------------------------------------------------ ------- Basic Getter Functions ----------------------------------- function Norm2 (Item : in Sparse_Matrix) return Real is separate; function N_Row (Mat : in Sparse_Matrix) return Pos is separate; function N_Col (Mat : in Sparse_Matrix) return Pos is separate; ------------------------------------------------------------------ ------------------------------------------------------------------ ------- Functions for Creating Sparse Matrices ------------------- function Sparse (X : in Real_Matrix; Tol : in Real := 10.0 * Real'Small) return Sparse_Matrix is use Ada.Containers; Y : Sparse_Matrix; N : constant Count_Type := Count_Type (X'Length (1) * X'Length (2)); Offset_1 : constant Integer := 1 - X'First (1); Offset_2 : constant Integer := 1 - X'First (2); begin Y.N_Row := X'Length (1); Y.N_Col := X'Length (2); Y.Format := Triplet; Y.I.Reserve_Capacity (N); Y.P.Reserve_Capacity (N); Y.X.Reserve_Capacity (N); for I in X'Range (1) loop for J in X'Range (2) loop if abs (X (I, J)) > Tol then Y.X.Append (X (I, J)); Y.I.Append (I + Offset_1); Y.P.Append (J + Offset_2); end if; end loop; end loop; Compress (Y); return Y; end Sparse; function As_Matrix (X : in Sparse_Vector) return Sparse_Matrix is A : Sparse_Matrix; Eps : constant Real := 10.0 * Real'Small; begin A.Format := CSC; A.N_Col := 1; A.N_Row := X.NMax; A.X := X.X; A.I := X.I; A.P.Reserve_Capacity (2); A.P.Append (1); A.P.Append (Pos (X.I.Length) + 1); return A; end As_Matrix; function "*" (Left, Right : in Sparse_Vector) return Sparse_Matrix is A : constant Sparse_Matrix := As_Matrix (Left); B : constant Sparse_Matrix := As_Matrix (Right); begin return A * Transpose (B); end "*"; function Triplet_To_Matrix (I : in Int_Array; J : in Int_Array; X : in Real_Vector; N_Row : in Pos := 0; N_Col : in Pos := 0; Format : in Sparse_Matrix_Format := CSC) return Sparse_Matrix is separate; ------------------------------------------------------------------ ------------------------------------------------------------------ -------- Essential Tools ----------------------------------------- procedure Remove_Duplicates (Mat : in out Sparse_Matrix) is separate; procedure Compress (Mat : in out Sparse_Matrix) is separate; procedure Convert (Mat : in out Sparse_Matrix) is separate; function Convert (Mat : in Sparse_Matrix) return Sparse_Matrix is Result : Sparse_Matrix := Mat; begin Convert (Result); return Result; end Convert; ------------------------------------------------------------------ ------------------------------------------------------------------ ------- Testing Functions ----------------------------------- function Is_Square_Matrix (A : in Sparse_Matrix) return Boolean is separate; function Has_Same_Dimensions (Left, Right : in Sparse_Matrix) return Boolean is separate; ------------------------------------------------------------------ ------------------------------------------------------------------ ------- Matrix Operations ----------------------------------- function Eye (N : in Pos) return Sparse_Matrix is separate; function Zero (N : in Pos) return Sparse_Matrix is separate; function Omega (N : in Nat; M : in Pos := 0) return Sparse_Matrix is separate; procedure Transposed (Mat : in out Sparse_Matrix) is separate; function Transpose (Mat : in Sparse_Matrix) return Sparse_Matrix is separate; function Mult (Left, Right : in Sparse_Matrix) return Sparse_Matrix is separate; function Plus (Left : in Sparse_Matrix; Right : in Sparse_Matrix) return Sparse_Matrix is separate; function Minus (Left : in Sparse_Matrix; Right : in Sparse_Matrix) return Sparse_Matrix is separate; function Kronecker (A, B : in Sparse_Matrix) return Sparse_Matrix is separate; function Direct_Sum (A, B : in Sparse_Matrix) return Sparse_Matrix is separate; function Permute_By_Col (Mat : in Sparse_Matrix; P : in Int_Array) return Sparse_Matrix is separate; function Permute (Mat : in Sparse_Matrix; P : in Int_Array; By : in Permute_By_Type := Column) return Sparse_Matrix is separate; -- function BiCGSTAB (A : in Sparse_Matrix; -- B : in RVector; -- X0 : in RVector; -- Err : out Real; -- Tol : in Real := 1.0e-10) -- return RVector is separate; function Number_Of_Elements (X : in Sparse_Matrix) return Integer is (Pos (X.X.Length)); function Is_Valid (Mat : in Sparse_Matrix) return Boolean is use IV_Package, RV_Package; begin if Mat.I = IV_Package.Empty_Vector or else Mat.P = IV_Package.Empty_Vector or else Mat.X = RV_Package.Empty_Vector or else Mat.N_Row = 0 or else Mat.N_Col = 0 then return False; end if; return True; end Is_Valid; procedure Triplet_To_Matrix (Result : out Sparse_Matrix; I : in IVector; J : in IVector; X : in RVector; N_Row : in Pos := 0; N_Col : in Pos := 0) is begin Result.N_Row := Pos'Max (N_Row, Max (I)); Result.N_Col := Pos'Max (N_Col, Max (J)); Result.Format := Triplet; Result.X := X; Result.I := I; Result.P := J; Compress (Result); -- turns it into CSC format end Triplet_To_Matrix; function Read_Sparse_Triplet (File_Name : in String; Offset : in Integer := 0) return Sparse_Matrix is use Ada.Text_IO, Ada.Containers, Real_IO, Int_IO; N_Lines : Count_Type := 0; I_Vec : IVector; J_Vec : IVector; X_Vec : RVector; Int_Input : Integer; Real_Input : Real; File : File_Type; Result : Sparse_Matrix; begin Open (File => File, Mode => In_File, Name => File_Name); while not End_Of_File (File) loop Get (File, Int_Input); I_Vec.Append (Int_Input + 1 - Offset); Get (File, Int_Input); J_Vec.Append (Int_Input + 1 - Offset); Get (File, Real_Input); X_Vec.Append (Real_Input); N_Lines := N_Lines + 1; end loop; Close (File); I_Vec.Reserve_Capacity (N_Lines); J_Vec.Reserve_Capacity (N_Lines); X_Vec.Reserve_Capacity (N_Lines); Triplet_To_Matrix (Result, I_Vec, J_Vec, X_Vec); IV_Package.Clear (I_Vec); IV_Package.Reserve_Capacity (I_Vec, 0); IV_Package.Clear (J_Vec); IV_Package.Reserve_Capacity (J_Vec, 0); RV_Package.Clear (X_Vec); RV_Package.Reserve_Capacity (X_Vec, 0); return Result; end Read_Sparse_Triplet; procedure Cumulative_Sum (Item : in out Int_Array) is separate; procedure Add (Mat : in out Sparse_Matrix; I, J : in Nat; X : in Real) is use Ada.Containers; Ind : Pos; begin pragma Assert (Mat.Format = CSC); -- Check if Mat (I, J) exists for K in Mat.P (J) .. Mat.P (J + 1) - 1 loop if Mat.I (K) = I then -- If exists, then add X to Mat (I, J) Mat.X (K) := Mat.X (K) + X; return; end if; end loop; -- Reserve space for 1 more element Mat.X.Reserve_Capacity (Mat.X.Length + 1); Mat.I.Reserve_Capacity (Mat.I.Length + 1); Ind := Mat.P (J); -- need this since for-loop may not occur for P in Mat.P (J) .. Mat.P (J + 1) - 1 loop if Mat.I (P) > I then Ind := P; exit; end if; end loop; -- Insert elements into I and X if Ind <= Pos (Mat.X.Length) then Mat.X.Insert (Before => Ind, New_Item => X); Mat.I.Insert (Before => Ind, New_Item => I); else Mat.X.Append (X); Mat.I.Append (I); end if; -- Fix P for P in J + 1 .. Mat.N_Col + 1 loop Mat.P (P) := Mat.P (P) + 1; end loop; end Add; procedure Set (Mat : in out Sparse_Matrix; I, J : in Nat; X : in Real) is use Ada.Containers; Ind : Pos; begin pragma Assert (Mat.Format = CSC); -- Check if Mat (I, J) exists for K in Mat.P (J) .. Mat.P (J + 1) - 1 loop if Mat.I (K) = I then -- If exists, then set Mat (I, J) to X Mat.X (K) := X; return; end if; end loop; -- Reserve space for 1 more element Mat.X.Reserve_Capacity (Mat.X.Length + 1); Mat.I.Reserve_Capacity (Mat.I.Length + 1); Ind := Mat.P (J); -- need this since for-loop may not occur for P in Mat.P (J) .. Mat.P (J + 1) - 1 loop if Mat.I (P) > I then Ind := P; exit; end if; end loop; -- Insert elements into I and X if Ind <= Pos (Mat.X.Length) then Mat.X.Insert (Before => Ind, New_Item => X); Mat.I.Insert (Before => Ind, New_Item => I); else Mat.X.Append (X); Mat.I.Append (I); end if; -- Fix P for P in J + 1 .. Mat.N_Col + 1 loop Mat.P (P) := Mat.P (P) + 1; end loop; end Set; procedure Scatter (A : in Sparse_Matrix; J : in Integer; β : in Real; W : in out Int_Array; X : in out Real_Vector; Mark : in Integer; C : in out Sparse_Matrix; Nz : in out Integer) is use IV_Package; I : Integer; Cur : Cursor; L, R : Pos; begin Cur := To_Cursor (A.P, J); L := A.P (Cur); Next (Cur); R := A.P (Cur) - 1; for P in L .. R loop I := A.I (P); if W (I) < Mark then C.I.Append (I); X (I) := β * A.X (P); Nz := Nz + 1; W (I) := Mark; else X (I) := X (I) + β * A.X (P); end if; end loop; end Scatter; function Mult_M_SV (A : in Sparse_Matrix; X : in Sparse_Vector) return Sparse_Vector is separate; function Diag (X : in Sparse_Matrix) return Sparse_Vector is Y : Sparse_Vector; begin Set_Length (Y, X.N_Col); for P in 1 .. X.N_Col loop for I in X.P (P) .. X.P (P + 1) - 1 loop if X.I (I) = P then Set (Y, P, X.X (I)); exit; end if; end loop; end loop; return Y; end Diag; function Diag (X : in Sparse_Vector) return Sparse_Matrix is Y : Sparse_Matrix; begin Triplet_To_Matrix (Y, X.I, X.I, X.X, X.NMax, X.NMax); return Y; end Diag; procedure Set_Diag (X : in out Sparse_Matrix; To : in Sparse_Vector) is K : Integer; begin for I in 1 .. Integer (To.I.Length) loop K := To.I (I); Set (X, K, K, To.X (I)); end loop; end Set_Diag; function "-" (X : in Sparse_Matrix) return Sparse_Matrix is Y : Sparse_Matrix := X; begin for Item of Y.X loop Item := -Item; end loop; return Y; end "-"; function "*" (Left : in Real; Right : in Sparse_Matrix) return Sparse_Matrix is C : Sparse_Matrix := Right; begin for X of C.X loop X := X * Left; end loop; return C; end "*"; function Add_Column (X : in Sparse_Matrix; V : in Sparse_Vector) return Sparse_Matrix is use Ada.Containers; Y : Sparse_Matrix := X; N : Nat := Nat (X.X.Length); P : Nat := Nat (X.P.Length); M : Nat := Nat (V.X.Length); begin pragma Assert (X.N_Row = V.NMax); Y.N_Col := X.N_Col + 1; Y.X.Reserve_Capacity (Count_Type (N + V.NMax)); Y.I.Reserve_Capacity (Count_Type (N + V.NMax)); Y.P.Reserve_Capacity (Count_Type (P + 1)); Y.P.Append (X.P (P) + M); for J in 1 .. M loop Y.X.Append (V.X (J)); Y.I.Append (V.I (J)); end loop; return Y; end Add_Column; procedure To_Triplet (A : in Sparse_Matrix; I : out IVector; J : out IVector; X : out RVector; N_Row : out Pos; N_Col : out Pos) is use Ada.Containers; N : constant Count_Type := A.X.Length; begin N_Row := A.N_Row; N_Col := A.N_Col; I.Reserve_Capacity (N); J.Reserve_Capacity (N); X.Reserve_Capacity (N); for P in 1 .. N_Col loop for K in A.P (P) .. A.P (P + 1) - 1 loop J.Append (P); I.Append (A.I (K)); X.Append (A.X (K)); end loop; end loop; end To_Triplet; function Remove_1st_N (A : in Sparse_Matrix; N : in Pos) return Sparse_Matrix is use Ada.Containers; B : Sparse_Matrix; K : Pos := 1; begin B.Format := A.Format; pragma Assert (A.N_Col > N); pragma Assert (A.N_Row > N); B.N_Row := A.N_Row - N; B.N_Col := A.N_Col - N; B.P.Reserve_Capacity (A.P.Length - Count_Type (N)); B.I.Reserve_Capacity (A.I.Length); B.X.Reserve_Capacity (A.X.Length); B.P.Append (1); for J in N + 1 .. Pos (A.P.Length) - 1 loop for I in A.P (J) .. A.P (J + 1) - 1 loop if A.I (I) > N then K := K + 1; B.I.Append (A.I (I) - N); B.X.Append (A.X (I)); end if; end loop; B.P.Append (K); end loop; B.P.Reserve_Capacity (B.P.Length); B.I.Reserve_Capacity (B.I.Length); B.X.Reserve_Capacity (B.X.Length); return B; end Remove_1st_N; procedure Testing_Stuff (A : in Sparse_Matrix) is use Real_IO, Int_IO, Ada.Text_IO; I, J : IVector; X : RVector; N_Row, N_Col : Pos; begin New_Line; Put_Line ("Testing stuf . . ."); Put ("N_Row = "); Put (A.N_Row); New_Line; Put ("N_Col = "); Put (A.N_Col); New_Line; Put ("x.length = "); Put (Pos (A.X.Length)); New_Line; Put ("i.length = "); Put (Pos (A.I.Length)); New_Line; Put ("p.length = "); Put (Pos (A.P.Length)); New_Line; New_Line; To_Triplet (A, I, J, X, N_Row, N_Col); for K in 1 .. Pos (I.Length) loop Put (I (K)); Put (" "); Put (J (K)); Put (" "); Put (X (K)); New_Line; end loop; Put_Line ("finished testing stuff."); New_Line; end Testing_Stuff; function "*" (A : in Sparse_Matrix; X : in Real_Vector) return Sparse_Vector is Y : Sparse_Vector := Sparse (X); begin return A * Y; end "*"; end Numerics.Sparse_Matrices;
-- -- Author: Brent Seidel -- Version: V00.01 -- Date: 6-Apr-2016 -- -- This package defines a number of types for physical units. These are -- generally based off of the Float type since in most cases, 6 digits is -- pretty good for a physical measurement. If you need more precision, go -- ahead and change it to whatever you need. -- -- Conversion routines are provided to convert between different units. Due to -- the number of different units, conversion between two may not be directly -- possible, but should be possible through intermediate units. The ones present -- are the ones that I use most. More will probably be added in the future. For -- each type of measurement, there is a base unit. Conversions to and from this -- unit to other units are provided. -- -- While addition and subtraction of units generally provides a meaningful result, -- multiplication and division may not. For example meters*meters should provide -- a result in meters^2. In some cases (ones that I use) multiplication and -- division will be provided. Most of these routines are trivial and can be -- added as needed. -- -- Ada provides Ada.Calendar to cover time related items. Therefor, there is -- not much time support here. -- -- The naming convention of the units is a prefix indicating what kind of unit, -- an underscore, and the the S.I. code for the unit (if applicable) or a common -- abbreviation (eg. vel_mph for velocity in mile per hour). Since "/" is not -- valid in indentifiers, it will be replaced by an underscore (eg vel_m_s) for -- velocity in meters per second. Exponentiation is indicated by a number (eg -- accel_m_s2). -- -- License: -- This is free and unencumbered software released into the public domain. -- -- Anyone is free to copy, modify, publish, use, compile, sell, or -- distribute this software, either in source code form or as a compiled -- binary, for any purpose, commercial or non-commercial, and by any -- means. -- -- In jurisdictions that recognize copyright laws, the author or authors -- of this software dedicate any and all copyright interest in the -- software to the public domain. We make this dedication for the benefit -- of the public at large and to the detriment of our heirs and -- successors. We intend this dedication to be an overt act of -- relinquishment in perpetuity of all present and future rights to this -- software under copyright law. -- -- 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 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. -- -- For more information, please refer to <http://unlicense.org> -- -- with Ada.Numerics; with Ada.Numerics.Generic_Elementary_Functions; package BBS.units with SPARK_Mode => on is pragma Pure; -- -- Index of type prefixes: -- Length types. Prefix := "len". Base unit is meters. -- Area types. Prefix := "area". Base unit is meters^2. -- Volume types. Prefix := "vol". Base unit is liters. -- Mass types. Prefix := "mass". Base unit is kilograms. -- Force types. Prefix := "force". Base unit is newtons. -- Temperature types. Prefix := "temp". Base unit is celsius. -- Pressure types. Prefix := "press". Base unit is pascal. -- Velocity types. Prefix := "vel". Base unit is m/s. -- Acceleration types. Prefix := "accel". Base unit is m/(s^2). -- Angular type. Prefix := "ang". Base unit is radians. -- Rotation rate types. Prefix := "rot". Base unit is radians/second. -- Magnetic types. Prefix := "mag". Base unit is Gauss. -- Electromotive force types. Prefix := "emf". Base unit is Volt. -- Electrical current types. Prefix := "curr". Base unit is Amper. -- Electrical resistance types. Prefix := "res". Base unit is Ohms. -- Frequency types. Prefix := "freq". Base unit is Hertz. -- Time types. Prefix := "time". Base unit is Seconds. -- -- Forward declaration of types, as needed. -- type vel_m_s; type accel_m_s2; -- -- Length types. Prefix := "len". Base unit is meters. -- -- length in meters type len_m is new Float; -- length in feet type len_ft is new Float; -- length in Ångstroms type len_A is new Float; -- feet_to_meter : constant := 3.28084; Angstrom_to_meter : constant := 10_000_000_000.0; function to_feet(dist : len_m) return len_ft is (len_ft(float(dist) * feet_to_meter)) with Global => null; function to_Angstroms(dist : len_m) return len_A is (len_A(Float(dist) * Angstrom_to_meter)) with Global => null; function to_meters(dist : len_ft) return len_m is (len_m(float(dist) / feet_to_meter)) with Global => null; function to_meters(dist : len_A) return len_m is (len_m(dist / Angstrom_to_meter)) with Global => null; -- function "/"(Left : len_m; Right : Duration) return vel_m_s with Global => null, pre => (Right /= 0.0); -- -- Area types. Prefix := "area". Base unit is meters^2. -- -- area in square meters type area_m2 is new Float; -- With only one unit, there are no conversion functions. function "*"(Left, Right : len_m) return area_m2 is (area_m2(Float(Left) * Float(Right))) with Global => null; -- -- Volume types. Prefix := "vol". Base unit is liters. -- -- volume in liters type vol_l is new Float; -- volume in cubic meters type vol_m3 is new Float; -- m3_to_liter : constant := 1000.0; function to_liters(vol : vol_m3) return vol_l is (vol_l(vol * m3_to_liter)) with Global => null; function to_meters3(vol : vol_l) return vol_m3 is (vol_m3(vol / m3_to_liter)) with Global => null; function "*"(Left : len_m; Right : area_m2) return vol_m3 is (vol_m3(Float(Left) * Float(right))) with Global => null; function "*"(Left : area_m2; Right : len_m) return vol_m3 is (vol_m3(Float(Left) * Float(right))) with Global => null; -- -- Mass types. Prefix := "mass". Base unit is kilograms. -- -- mass in kilograms type mass_kg is new Float; -- mass in pounds type mass_lb is new Float; -- pound_to_kilogram : constant := 0.4535924; function to_pounds(mass : mass_kg) return mass_lb is (mass_lb(Float(mass) / pound_to_kilogram)) with Global => null; function to_kilograms(mass : mass_lb) return mass_kg is (mass_kg(Float(mass) * pound_to_kilogram)) with Global => null; -- -- Force types. Prefix := "force". Base unit is newtons. -- -- force in newtons type force_n is new Float; -- with no other units there are no conversion functions -- Newtons law, F=MA function "*"(Left : mass_kg; Right : accel_m_s2) return force_n with Global => null; function "*"(Left : accel_m_s2; Right : mass_kg) return force_n with Global => null; function "/"(Left : force_n; Right : accel_m_s2) return mass_kg with Global => null, pre => (Right /= 0.0); function "/"(Left : force_n; Right : mass_kg) return accel_m_s2 with Global => null, pre => (Right /= 0.0); -- -- Temperature types. Prefix := "temp". Base unit is celsius. -- -- temperature in kelvin type temp_k is new Float; -- temperature in celsius type temp_c is new Float; -- temperature in farenheit type temp_f is new Float; -- function to_Farenheit(temp : temp_c) return temp_f is (temp_f(float(temp)*9.0/5.0 + 32.0)) with Global => null; function to_Kelvin(temp : temp_c) return temp_k is (temp_k(float(temp) + 273.15)) with Global => null; function to_Celsius(temp : temp_f) return temp_c is (temp_c(float(temp - 32.0)*5.0/9.0)) with Global => null; function to_Celsius(temp : temp_k) return temp_c is (temp_c(float(temp) - 273.15)) with Global => null; -- -- Pressure types. Prefix := "press". Base unit is pascal. -- -- pressure in pascals type press_p is new Float; -- pressure in millibars type press_mb is new Float; -- pressure in atmospheres type press_atm is new Float; -- pressure in inches of mercury type press_inHg is new Float; -- millibar_to_pascal : constant := 100.0; atm_to_pascal : constant := 101325.0; inHg_to_pascal : constant := 3386.39; function to_milliBar(pressure : press_p) return press_mb is (press_mb(float(pressure) / millibar_to_pascal)) with Global => null; function to_Atmosphere(pressure : press_p) return press_atm is (press_atm(float(pressure) / atm_to_pascal)) with Global => null; function to_inHg(pressure : press_p) return press_inHg is (press_inHg(float(pressure) / inHg_to_pascal)) with Global => null; function to_Pascal(pressure : press_mb) return press_p is (press_p(float(pressure) * millibar_to_pascal)) with Global => null; function to_Pascal(pressure : press_atm) return press_p is (press_p(float(pressure) * atm_to_pascal)) with Global => null; function to_Pascal(pressure : press_inHg) return press_p is (press_p(float(pressure) * inHg_to_pascal)) with Global => null; -- -- Given local pressure and altimeter setting, determine the pressure -- altitude. Given local pressure and altitude, determine the altimeter -- setting. -- function pressure_altitude(pressure : press_p; altm : press_p) return len_m; function altimeter(pressure : press_p; altitude : len_m) return press_p; -- -- Velocity types. Prefix := "vel". Base unit is m/s. -- -- velocity in meters/second type vel_m_s is new Float; -- velocity in miles per hour type vel_mph is new Float; -- velocity in kilometers/hour type vel_km_h is new Float; -- velocity in knots type vel_knots is new Float; -- m_s_to_mph : constant := 2.2369_3629_11; m_s_to_km_h : constant := 3.6; m_s_to_knots : constant := 1.9438_4449_24; function to_mph(vel : vel_m_s) return vel_mph is (vel_mph(float(vel) * m_s_to_mph)) with Global => null; function to_km_h(vel : vel_m_s) return vel_km_h is (vel_km_h(float(vel) * m_s_to_km_h)) with Global => null; function to_knots(vel : vel_m_s) return vel_knots is (vel_knots(float(vel) * m_s_to_knots)) with Global => null; function to_m_s(vel : vel_knots) return vel_m_s is (vel_m_s(float(vel) / m_s_to_knots)) with Global => null; function to_m_s(vel : vel_km_h) return vel_m_s is (vel_m_s(float(vel) / m_s_to_km_h)) with Global => null; function to_m_s(vel : vel_mph) return vel_m_s is (vel_m_s(float(vel) / m_s_to_mph)) with Global => null; -- function "*"(Left : vel_m_s; Right : Duration) return len_m is (len_m(Float(Left) * Float(Right))) with Global => null; function "*"(Left : Duration; Right : vel_m_s) return len_m is (len_m(Float(Left) * Float(Right))) with Global => null; function "/"(Left : vel_m_s; Right : Duration) return accel_m_s2 with Global => null, pre => (Right /= 0.0); -- -- Acceleration types. Prefix := "accel". Base unit is m/(s^2). -- -- acceleration in meters per second squared type accel_m_s2 is new Float; -- acceleration in units of Earth gravity type accel_g is new Float; -- gravity_to_m_s2 : constant := 9.80665; function to_m_s2(accel : accel_g) return accel_m_s2 is (accel_m_s2(Float(accel) * gravity_to_m_s2)) with Global => null; function to_g(accel : accel_m_s2) return accel_g is (accel_g(Float(accel) / gravity_to_m_s2)) with Global => null; -- function "*"(Left : accel_m_s2; Right : Duration) return vel_m_s is (vel_m_s(Float(Left) * Float(Right))) with Global => null; function "*"(Left : Duration; Right : accel_m_s2) return vel_m_s is (vel_m_s(Float(Left) * Float(Right))) with Global => null; -- -- Angular type. Prefix := "ang". Base unit is radians. -- -- angle in radians type ang_r is new Float; -- angle in degrees type ang_d is new Float; -- function to_degrees(ang : ang_r) return ang_d is (ang_d(float(ang) * 180.0 / Ada.Numerics.Pi)) with Global => null; function to_radians(ang : ang_d) return ang_r is (ang_r(float(ang) * Ada.Numerics.Pi / 180.0)) with Global => null; -- -- Rotation rate types. Prefix := "rot". Base unit is radians/second. -- -- rotation in radians per second type rot_r_s is new Float; -- rotation in degrees per second type rot_d_s is new Float; -- function to_r_s(rot : rot_d_s) return rot_r_s is (rot_r_s(float(rot) * Ada.Numerics.Pi / 180.0)) with Global => null; function to_d_s(rot : rot_r_s) return rot_d_s is (rot_d_s(float(rot) * 180.0 / Ada.Numerics.Pi)) with Global => null; -- function "*"(Left : rot_d_s; Right : Duration) return ang_d is (ang_d(Float(Left) * Float(Right))) with Global => null; function "*"(Left : Duration; Right : rot_d_s) return ang_d is (ang_d(Float(Left) * Float(Right))) with Global => null; -- -- Magnetic types. Prefix := "mag". Base unit is Gauss. -- -- magnetic field in gauss type mag_g is new Float; -- With only one unit, there are no conversions functions. -- -- Electromotive force types. Prefix := "emf". Base unit is Volt. -- -- electromotive force in volts type emf_v is new Float; -- With only one unit, there are no conversion functions. -- -- Electrical current types. Prefix := "curr". Base unit is Amper. -- -- electrical current in amps type curr_a is new Float; -- With only one unit, there are no conversions functions. -- -- Electrical resistance types. Prefix := "res". Base unit is Ohms. type res_o is new Float; -- -- Variations of Ohms law -- function "*"(Left : curr_a; Right : res_o) return emf_v is (emf_v(Float(Left) * Float(Right))) with Global => null; function "*"(Left : res_o; Right : curr_a) return emf_v is (emf_v(Float(Left) * Float(Right))) with Global => null; function "/"(Left : emf_v; Right : curr_a) return res_o is (res_o(Float(Left) / Float(Right))) with Global => null, pre => (Right /= 0.0); function "/"(Left : emf_v; Right : res_o) return curr_a is (curr_a(Float(Left) / Float(Right))) with Global => null, pre => (Right /= 0.0); -- -- Frequency types. Prefix := "freq". Base unit is Hertz. -- Time types. Prefix := "time". Base unit is Seconds. -- -- Note that Ada has a predefined Duration type that is a fixed point type -- Seconds is defined as a subtype of this. The other times (minutes and -- hours) are derivative types so as to maintain similar precision. If needed, -- they could be changed to Float or something else. -- -- frequency in Herts type freq_hz is new Float; -- time in seconds (use subtype because seconds is identical to duration) subtype time_s is Duration; -- time in minutes type time_m is new Duration; -- time in hours type time_h is new Duration; -- function to_hz(period : time_s) return freq_hz is (freq_hz(1.0 / Float(period))) with Global => null, pre => (period /= 0.0); function to_minutes(period : time_s) return time_m is (time_m(period / 60.0)) with Global => null; function to_hours(period : time_s) return time_h is (time_h(period / 3600.0)) with Global => null; function to_seconds(freq : freq_hz) return time_s is (time_s(1.0 / Float(freq))) with Global => null, pre => (freq /= 0.0); function to_seconds(period : time_m) return time_s is (time_s(period * 60.0)) with Global => null; function to_seconds(period : time_h) return time_s is (time_s(period * 3600.0)) with Global => null; -- end;
-- This file is generated by SWIG. Please do *not* modify by hand. -- with fann_c.Pointers; with interfaces.c; with interfaces.C; package fann_c.user_function is -- Item -- type Item is access procedure (arg_5_1 : in interfaces.c.unsigned; arg_5_2 : in interfaces.c.unsigned; arg_5_3 : in interfaces.c.unsigned; arg_5_4 : in fann_c.Pointers.fann_type_Pointer; arg_5_5 : in fann_c.Pointers.fann_type_Pointer); pragma convention (C, Item); -- Items -- type Items is array (interfaces.C.Size_t range <>) of aliased fann_c.user_function.Item; -- Pointer -- type Pointer is access all fann_c.user_function.Item; -- Pointers -- type Pointers is array (interfaces.C.Size_t range <>) of aliased fann_c.user_function.Pointer; -- Pointer_Pointer -- type Pointer_Pointer is access all fann_c.user_function.Pointer; end fann_c.user_function;
with Ada.Containers.Hashed_Maps, Ada.Containers.Vectors, Ada.Execution_Time, Ada.Integer_Text_IO, Ada.Real_Time, Ada.Strings.Fixed, Ada.Text_IO; with Utils; procedure Main is use Ada.Execution_Time, Ada.Real_Time, Ada.Text_IO; use Utils; type Coordinate_2D is record Line : Natural; Column : Natural; end record; type Folding_Kind is (K_Line, K_Column); type Folding_T is record Kind : Folding_Kind; Value : Natural; end record; package Folding_Vectors is new Ada.Containers.Vectors (Natural, Folding_T); -- This Hash function transform a 2 dimensional location to an unique ID using Cantor pairing enumeration. -- @param Coord A 2 dimensional location -- @returns Return the corresponding hash -- @link https://en.wikipedia.org/wiki/Pairing_function#Cantor_pairing_function function Hash (Coord : Coordinate_2D) return Ada.Containers.Hash_Type is (Ada.Containers.Hash_Type (((Coord.Line + Coord.Column) * (Coord.Line + Coord.Column + 1) / 2) + Coord.Column)); function Equivalent_Keys (Left, Right : Coordinate_2D) return Boolean is (Left.Line = Right.Line and Left.Column = Right.Column); package Dots_Maps is new Ada.Containers.Hashed_Maps (Key_Type => Coordinate_2D, Element_Type => Boolean, Hash => Hash, Equivalent_Keys => Equivalent_Keys, "=" => "="); File : File_Type; Start_Time, End_Time : CPU_Time; Execution_Duration : Time_Span; File_Is_Empty : Boolean := True; Max_Lines, Max_Columns : Positive := Positive'First; Folding_Instructions : Folding_Vectors.Vector := Folding_Vectors.Empty_Vector; Dots_Map : Dots_Maps.Map := Dots_Maps.Empty_Map; begin Get_File (File); -- Get all values begin while not End_Of_File (File) loop declare Str : constant String := Get_Line (File); begin if Str'Length = 0 then goto Continue_Next_Line; end if; if Str (Str'First) = 'f' then -- "fold along" instruction declare use Ada.Integer_Text_IO; Separator_Index : constant Integer := Ada.Strings.Fixed.Index (Source => Str (1 .. Str'Last), Pattern => "="); Kind : constant String := Str (Separator_Index - 1 .. Separator_Index - 1); Value_Str : constant String := Str (Separator_Index + 1 .. Str'Last); Last_Index : Positive := Positive'First; Value : Natural; begin Get (Value_Str, Value, Last_Index); Folding_Instructions.Append (((if Kind = "x" then K_Column else K_Line), Value)); end; else -- Point coordinate declare use Ada.Integer_Text_IO; Separator_Index : constant Integer := Ada.Strings.Fixed.Index (Source => Str (1 .. Str'Last), Pattern => ","); Column_Str : constant String := Str (1 .. Separator_Index - 1); Line_Str : constant String := Str (Separator_Index + 1 .. Str'Last); Column, Line : Natural; Last_Index : Positive := Positive'First; begin Get (Column_Str, Column, Last_Index); Get (Line_Str, Line, Last_Index); Dots_Map.Include ((Column => Column, Line => Line), True); if Max_Lines < Line then Max_Lines := Line; end if; if Max_Columns < Column then Max_Columns := Column; end if; end; end if; end; File_Is_Empty := False; <<Continue_Next_Line>> end loop; -- Exit the program if there is no values if File_Is_Empty then Close_If_Open (File); Put_Line ("The input file is empty."); return; end if; end; -- Do the puzzle Start_Time := Ada.Execution_Time.Clock; Solve_Puzzle : declare use Dots_Maps; Coord : Coordinate_2D; Dots : Map := Empty_Map; begin for Fold_Along : Folding_T of Folding_Instructions loop case Fold_Along.Kind is when K_Column => Max_Columns := Fold_Along.Value - 1; for Curs in Dots_Map.Iterate loop Coord := Key (Curs); if Coord.Column < Fold_Along.Value then Dots.Include (Coord, True); else if Fold_Along.Value - (Coord.Column - Fold_Along.Value) >= 0 then Dots.Include ((Column => Fold_Along.Value - (Coord.Column - Fold_Along.Value), Line => Coord.Line ), True); end if; end if; end loop; when K_Line => Max_Lines := Fold_Along.Value - 1; for Curs in Dots_Map.Iterate loop Coord := Key (Curs); if Coord.Line < Fold_Along.Value then Dots.Include (Coord, True); else if Fold_Along.Value - (Coord.Line - Fold_Along.Value) >= 0 then Dots.Include ((Column => Coord.Column, Line => Fold_Along.Value - (Coord.Line - Fold_Along.Value) ), True); end if; end if; end loop; end case; Dots_Map := Dots; end loop; end Solve_Puzzle; End_Time := Ada.Execution_Time.Clock; Execution_Duration := End_Time - Start_Time; Put_Line ("Result: "); for Line in 0 .. Max_Lines loop for Column in 0 .. Max_Columns loop if Dots_Map.Contains ((Column => Column, Line => Line)) then Put ("#"); else Put (" "); end if; end loop; New_Line; end loop; New_Line; Put_Line ("(Took " & Duration'Image (To_Duration (Execution_Duration) * 1_000_000) & "µs)"); exception when others => Close_If_Open (File); raise; end Main;
-- { dg-do compile } -- { dg-options "-gnat12 -gnatct" } limited with Limited_With4; package Limited_With4_Pkg is type Object is tagged null record; type Object_Ref is access all Object; type Class_Ref is access all Object'Class; function Func return Limited_With4.Class_Ref; procedure Proc (Arg : Limited_With4.Class_Ref); end Limited_With4_Pkg;
package sync1 is type Chopstick_Type is synchronized interface; type Chopstick is synchronized new Chopstick_Type with private; private protected type Chopstick is new Chopstick_Type with entry Pick_Up; procedure Put_Down; private Busy : Boolean := False; end Chopstick; end sync1;
package GPR_Tools is VERSION : constant String := "2.0.3"; end GPR_Tools;
package Uninit_Array is function F2 return Integer; end Uninit_Array;
with byte_package; use byte_package; with raiden; package file_crypter is subtype key_s is raiden.key_s; type mode is (encrypt, decrypt); procedure init_key(key : raiden.key_s); procedure file_crypt(in_file : byte_io.File_Type; out_file : out byte_io.File_Type; mode_crypt : mode); end file_crypter;
------------------------------------------------------------------------------- -- This file is part of libsparkcrypto. -- -- Copyright (C) 2018 Componolit GmbH -- Copyright (C) 2011, Adrian-Ken Rueegsegger -- All rights reserved. -- -- Redistribution and use in source and binary forms, with or without -- modification, are permitted provided that the following conditions are met: -- -- * Redistributions of source code must retain the above copyright notice, -- this list of conditions and the following disclaimer. -- -- * Redistributions in binary form must reproduce the above copyright -- notice, this list of conditions and the following disclaimer in the -- documentation and/or other materials provided with the distribution. -- -- * Neither the name of the nor the names of its contributors may be used -- to endorse or promote products derived from this software without -- specific prior written permission. -- -- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" -- AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -- IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE -- ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS -- BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR -- CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF -- SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS -- INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN -- CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) -- ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -- POSSIBILITY OF SUCH DAMAGE. ------------------------------------------------------------------------------- with LSC.Internal.SHA1; with LSC.Internal.Types; with AUnit.Assertions; use AUnit.Assertions; with Util; use Util; pragma Style_Checks ("-s"); pragma Warnings (Off, "formal parameter ""T"" is not referenced"); use type LSC.Internal.Types.Word32_Array_Type; package body LSC_Internal_Test_SHA1 is procedure Test_SHA1_One_Block (T : in out Test_Cases.Test_Case'Class) is SHA1_Ctx : LSC.Internal.SHA1.Context_Type; Hash : LSC.Internal.SHA1.Hash_Type; Message : LSC.Internal.SHA1.Block_Type; begin -- FIPS 180-2, Appendix A: SHA-1 Examples -- A.1 SHA-1 Example (One-Block Message) SHA1_Ctx := LSC.Internal.SHA1.Context_Init; Message := LSC.Internal.SHA1.Block_Type'(M (16#61626300#), others => 16#fedca987#); LSC.Internal.SHA1.Context_Finalize (SHA1_Ctx, Message, 24); Hash := LSC.Internal.SHA1.Get_Hash (SHA1_Ctx); Assert (Hash = LSC.Internal.SHA1.Hash_Type'(M (16#a9993e36#), M (16#4706816a#), M (16#ba3e2571#), M (16#7850c26c#), M (16#9cd0d89d#)), "Hash differs"); end Test_SHA1_One_Block; --------------------------------------------------------------------------- procedure Test_SHA1_Multi_Block (T : in out Test_Cases.Test_Case'Class) is SHA1_Ctx : LSC.Internal.SHA1.Context_Type; Hash : LSC.Internal.SHA1.Hash_Type; Message : LSC.Internal.SHA1.Block_Type; begin -- A.2 SHA-1 Example (Multi-Block Message) SHA1_Ctx := LSC.Internal.SHA1.Context_Init; Message := LSC.Internal.SHA1.Block_Type' (M (16#61626364#), M (16#62636465#), M (16#63646566#), M (16#64656667#), M (16#65666768#), M (16#66676869#), M (16#6768696a#), M (16#68696a6b#), M (16#696a6b6c#), M (16#6a6b6c6d#), M (16#6b6c6d6e#), M (16#6c6d6e6f#), M (16#6d6e6f70#), M (16#6e6f7071#), M (16#0a000000#), others => 16#deadbeef#); LSC.Internal.SHA1.Context_Finalize (SHA1_Ctx, Message, 448); Hash := LSC.Internal.SHA1.Get_Hash (SHA1_Ctx); Assert (Hash = LSC.Internal.SHA1.Hash_Type'(M (16#84983e44#), M (16#1c3bd26e#), M (16#baae4aa1#), M (16#f95129e5#), M (16#e54670f1#)), "Hash differs"); end Test_SHA1_Multi_Block; --------------------------------------------------------------------------- procedure Test_SHA1_Long (T : in out Test_Cases.Test_Case'Class) is SHA1_Ctx : LSC.Internal.SHA1.Context_Type; Hash : LSC.Internal.SHA1.Hash_Type; Message : LSC.Internal.SHA1.Block_Type; begin -- A.3 SHA-1 Example (Long Message) Message := LSC.Internal.SHA1.Block_Type'(others => M (16#61616161#)); SHA1_Ctx := LSC.Internal.SHA1.Context_Init; for I in Natural range 1 .. 15625 loop LSC.Internal.SHA1.Context_Update (SHA1_Ctx, Message); end loop; LSC.Internal.SHA1.Context_Finalize (SHA1_Ctx, Message, 0); Hash := LSC.Internal.SHA1.Get_Hash (SHA1_Ctx); Assert (Hash = LSC.Internal.SHA1.Hash_Type'(M (16#34aa973c#), M (16#d4c4daa4#), M (16#f61eeb2b#), M (16#dbad2731#), M (16#6534016f#)), "Hash differs"); end Test_SHA1_Long; --------------------------------------------------------------------------- procedure Register_Tests (T : in out Test_Case) is use AUnit.Test_Cases.Registration; begin Register_Routine (T, Test_SHA1_One_Block'Access, "SHA1 (One-Block Message)"); Register_Routine (T, Test_SHA1_Multi_Block'Access, "SHA1 (Multi-Block Message)"); Register_Routine (T, Test_SHA1_Long'Access, "SHA1 (Long Message)"); end Register_Tests; --------------------------------------------------------------------------- function Name (T : Test_Case) return Test_String is begin return Format ("SHA1"); end Name; end LSC_Internal_Test_SHA1;
with GESTE; with GESTE.Sprite; with GESTE.Tile_Bank; with Ada.Text_IO; with Console_Char_Screen; with Ada.Exceptions; procedure Layer_Priority is use type GESTE.Pix_Point; package Console_Screen is new Console_Char_Screen (Width => 9, Height => 9, Buffer_Size => 256, Init_Char => ' '); Palette : aliased constant GESTE.Palette_Type := ('1', '2', '3', '4'); Background : Character := '-'; Tiles : aliased constant GESTE.Tile_Array := (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)), 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)), 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)) ); Bank : aliased GESTE.Tile_Bank.Instance (Tiles'Unrestricted_Access, GESTE.No_Collisions, Palette'Unrestricted_Access); Sprite_1 : aliased GESTE.Sprite.Instance (Bank => Bank'Unrestricted_Access, Init_Frame => 1); Sprite_2 : aliased GESTE.Sprite.Instance (Bank => Bank'Unrestricted_Access, Init_Frame => 2); Sprite_3 : aliased GESTE.Sprite.Instance (Bank => Bank'Unrestricted_Access, Init_Frame => 3); Sprite_4 : aliased GESTE.Sprite.Instance (Bank => Bank'Unrestricted_Access, Init_Frame => 4); procedure Update is begin GESTE.Render_Window (Window => Console_Screen.Screen_Rect, Background => Background, Buffer => Console_Screen.Buffer, Push_Pixels => Console_Screen.Push_Pixels'Unrestricted_Access, Set_Drawing_Area => Console_Screen.Set_Drawing_Area'Unrestricted_Access); Console_Screen.Print; end Update; begin Console_Screen.Verbose; Sprite_3.Move ((3, 3)); GESTE.Add (Sprite_3'Unrestricted_Access, 3); -- Insert head on empty list Sprite_4.Move ((4, 4)); GESTE.Add (Sprite_4'Unrestricted_Access, 4); -- Insert head on non empty list Sprite_1.Move ((1, 1)); GESTE.Add (Sprite_1'Unrestricted_Access, 1); -- Insert tail Sprite_2.Move ((2, 2)); GESTE.Add (Sprite_2'Unrestricted_Access, 2); -- Insert mid Update; GESTE.Remove (Sprite_2'Unrestricted_Access); -- Remove mid Update; GESTE.Remove (Sprite_1'Unrestricted_Access); -- Remove tail Update; GESTE.Remove (Sprite_4'Unrestricted_Access); -- Remove head on non empty list Update; GESTE.Remove (Sprite_3'Unrestricted_Access); -- Remove head on empty list Update; declare begin -- Remove a layer not in the list GESTE.Remove (Sprite_3'Unrestricted_Access); exception when E : Program_Error => Ada.Text_IO.Put_Line ("Exception:" & Ada.Exceptions.Exception_Message (E)); end; end Layer_Priority;
------------------------------------------------------------------------------ -- -- -- GNAT COMPILER COMPONENTS -- -- -- -- P R J . D E C T -- -- -- -- B o d y -- -- -- -- $Revision$ -- -- -- Copyright (C) 2001 Free Software Foundation, Inc. -- -- -- -- GNAT is free software; you can redistribute it and/or modify it under -- -- terms of the GNU General Public License as published by the Free Soft- -- -- ware Foundation; either version 2, or (at your option) any later ver- -- -- sion. GNAT is distributed in the hope that it will be useful, but WITH- -- -- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY -- -- or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -- -- for more details. You should have received a copy of the GNU General -- -- Public License distributed with GNAT; see file COPYING. If not, write -- -- to the Free Software Foundation, 59 Temple Place - Suite 330, Boston, -- -- MA 02111-1307, USA. -- -- -- -- GNAT was originally developed by the GNAT team at New York University. -- -- Extensive contributions were provided by Ada Core Technologies Inc. -- -- -- ------------------------------------------------------------------------------ with Errout; use Errout; with Prj.Strt; with Prj.Tree; use Prj.Tree; with Scans; use Scans; with Sinfo; use Sinfo; with Types; use Types; with Prj.Attr; use Prj.Attr; package body Prj.Dect is type Zone is (In_Project, In_Package, In_Case_Construction); procedure Parse_Attribute_Declaration (Attribute : out Project_Node_Id; First_Attribute : Attribute_Node_Id; Current_Project : Project_Node_Id; Current_Package : Project_Node_Id); -- Parse an attribute declaration. procedure Parse_Case_Construction (Case_Construction : out Project_Node_Id; First_Attribute : Attribute_Node_Id; Current_Project : Project_Node_Id; Current_Package : Project_Node_Id); -- Parse a case construction procedure Parse_Declarative_Items (Declarations : out Project_Node_Id; In_Zone : Zone; First_Attribute : Attribute_Node_Id; Current_Project : Project_Node_Id; Current_Package : Project_Node_Id); -- Parse declarative items. Depending on In_Zone, some declarative -- items may be forbiden. procedure Parse_Package_Declaration (Package_Declaration : out Project_Node_Id; Current_Project : Project_Node_Id); -- Parse a package declaration procedure Parse_String_Type_Declaration (String_Type : out Project_Node_Id; Current_Project : Project_Node_Id; First_Attribute : Attribute_Node_Id); -- type <name> is ( <literal_string> { , <literal_string> } ) ; procedure Parse_Variable_Declaration (Variable : out Project_Node_Id; First_Attribute : Attribute_Node_Id; Current_Project : Project_Node_Id; Current_Package : Project_Node_Id); -- Parse a variable assignment -- <variable_Name> := <expression>; OR -- <variable_Name> : <string_type_Name> := <string_expression>; ----------- -- Parse -- ----------- procedure Parse (Declarations : out Project_Node_Id; Current_Project : Project_Node_Id; Extends : Project_Node_Id) is First_Declarative_Item : Project_Node_Id := Empty_Node; begin Declarations := Default_Project_Node (Of_Kind => N_Project_Declaration); Set_Location_Of (Declarations, To => Token_Ptr); Set_Modified_Project_Of (Declarations, To => Extends); Parse_Declarative_Items (Declarations => First_Declarative_Item, In_Zone => In_Project, First_Attribute => Prj.Attr.Attribute_First, Current_Project => Current_Project, Current_Package => Empty_Node); Set_First_Declarative_Item_Of (Declarations, To => First_Declarative_Item); end Parse; --------------------------------- -- Parse_Attribute_Declaration -- --------------------------------- procedure Parse_Attribute_Declaration (Attribute : out Project_Node_Id; First_Attribute : Attribute_Node_Id; Current_Project : Project_Node_Id; Current_Package : Project_Node_Id) is Current_Attribute : Attribute_Node_Id := First_Attribute; begin Attribute := Default_Project_Node (Of_Kind => N_Attribute_Declaration); Set_Location_Of (Attribute, To => Token_Ptr); -- Scan past "for" Scan; Expect (Tok_Identifier, "identifier"); if Token = Tok_Identifier then Set_Name_Of (Attribute, To => Token_Name); Set_Location_Of (Attribute, To => Token_Ptr); if Attributes.Table (Current_Attribute).Kind_2 = Case_Insensitive_Associative_Array then Set_Case_Insensitive (Attribute, To => True); end if; while Current_Attribute /= Empty_Attribute and then Attributes.Table (Current_Attribute).Name /= Token_Name loop Current_Attribute := Attributes.Table (Current_Attribute).Next; end loop; if Current_Attribute = Empty_Attribute then Error_Msg ("undefined attribute", Token_Ptr); end if; Scan; end if; if Token = Tok_Left_Paren then if Current_Attribute /= Empty_Attribute and then Attributes.Table (Current_Attribute).Kind_2 = Single then Error_Msg ("this attribute cannot be an associative array", Location_Of (Attribute)); end if; Scan; Expect (Tok_String_Literal, "literal string"); if Token = Tok_String_Literal then Set_Associative_Array_Index_Of (Attribute, Strval (Token_Node)); Scan; end if; Expect (Tok_Right_Paren, ")"); if Token = Tok_Right_Paren then Scan; end if; else if Current_Attribute /= Empty_Attribute and then Attributes.Table (Current_Attribute).Kind_2 /= Single then Error_Msg ("this attribute need to be an associative array", Location_Of (Attribute)); end if; end if; if Current_Attribute /= Empty_Attribute then Set_Expression_Kind_Of (Attribute, To => Attributes.Table (Current_Attribute).Kind_1); end if; Expect (Tok_Use, "use"); if Token = Tok_Use then Scan; declare Expression_Location : constant Source_Ptr := Token_Ptr; Expression : Project_Node_Id := Empty_Node; begin Prj.Strt.Parse_Expression (Expression => Expression, Current_Project => Current_Project, Current_Package => Current_Package); Set_Expression_Of (Attribute, To => Expression); if Current_Attribute /= Empty_Attribute and then Expression /= Empty_Node and then Attributes.Table (Current_Attribute).Kind_1 /= Expression_Kind_Of (Expression) then Error_Msg ("wrong expression kind for the attribute", Expression_Location); end if; end; end if; end Parse_Attribute_Declaration; ----------------------------- -- Parse_Case_Construction -- ----------------------------- procedure Parse_Case_Construction (Case_Construction : out Project_Node_Id; First_Attribute : Attribute_Node_Id; Current_Project : Project_Node_Id; Current_Package : Project_Node_Id) is Current_Item : Project_Node_Id := Empty_Node; Next_Item : Project_Node_Id := Empty_Node; First_Case_Item : Boolean := True; Variable_Location : Source_Ptr := No_Location; String_Type : Project_Node_Id := Empty_Node; Case_Variable : Project_Node_Id := Empty_Node; First_Declarative_Item : Project_Node_Id := Empty_Node; First_Choice : Project_Node_Id := Empty_Node; begin Case_Construction := Default_Project_Node (Of_Kind => N_Case_Construction); Set_Location_Of (Case_Construction, To => Token_Ptr); -- Scan past "case" Scan; -- Get the switch variable Expect (Tok_Identifier, "identifier"); if Token = Tok_Identifier then Variable_Location := Token_Ptr; Prj.Strt.Parse_Variable_Reference (Variable => Case_Variable, Current_Project => Current_Project, Current_Package => Current_Package); Set_Case_Variable_Reference_Of (Case_Construction, To => Case_Variable); else if Token /= Tok_Is then Scan; end if; end if; if Case_Variable /= Empty_Node then String_Type := String_Type_Of (Case_Variable); if String_Type = Empty_Node then Error_Msg ("this variable is not typed", Variable_Location); end if; end if; Expect (Tok_Is, "is"); if Token = Tok_Is then -- Scan past "is" Scan; end if; Prj.Strt.Start_New_Case_Construction (String_Type); When_Loop : while Token = Tok_When loop if First_Case_Item then Current_Item := Default_Project_Node (Of_Kind => N_Case_Item); Set_First_Case_Item_Of (Case_Construction, To => Current_Item); First_Case_Item := False; else Next_Item := Default_Project_Node (Of_Kind => N_Case_Item); Set_Next_Case_Item (Current_Item, To => Next_Item); Current_Item := Next_Item; end if; Set_Location_Of (Current_Item, To => Token_Ptr); -- Scan past "when" Scan; if Token = Tok_Others then -- Scan past "others" Scan; Expect (Tok_Arrow, "=>"); -- Empty_Node in Field1 of a Case_Item indicates -- the "when others =>" branch. Set_First_Choice_Of (Current_Item, To => Empty_Node); Parse_Declarative_Items (Declarations => First_Declarative_Item, In_Zone => In_Case_Construction, First_Attribute => First_Attribute, Current_Project => Current_Project, Current_Package => Current_Package); -- "when others =>" must be the last branch, so save the -- Case_Item and exit Set_First_Declarative_Item_Of (Current_Item, To => First_Declarative_Item); exit When_Loop; else Prj.Strt.Parse_Choice_List (First_Choice => First_Choice); Set_First_Choice_Of (Current_Item, To => First_Choice); Expect (Tok_Arrow, "=>"); Parse_Declarative_Items (Declarations => First_Declarative_Item, In_Zone => In_Case_Construction, First_Attribute => First_Attribute, Current_Project => Current_Project, Current_Package => Current_Package); Set_First_Declarative_Item_Of (Current_Item, To => First_Declarative_Item); end if; end loop When_Loop; Prj.Strt.End_Case_Construction; Expect (Tok_End, "end case"); if Token = Tok_End then -- Scan past "end" Scan; Expect (Tok_Case, "case"); end if; -- Scan past "case" Scan; Expect (Tok_Semicolon, ";"); end Parse_Case_Construction; ----------------------------- -- Parse_Declarative_Items -- ----------------------------- procedure Parse_Declarative_Items (Declarations : out Project_Node_Id; In_Zone : Zone; First_Attribute : Attribute_Node_Id; Current_Project : Project_Node_Id; Current_Package : Project_Node_Id) is Current_Declarative_Item : Project_Node_Id := Empty_Node; Next_Declarative_Item : Project_Node_Id := Empty_Node; Current_Declaration : Project_Node_Id := Empty_Node; Item_Location : Source_Ptr := No_Location; begin Declarations := Empty_Node; loop -- We are always positioned at the token that precedes -- the first token of the declarative element. -- Scan past it Scan; Item_Location := Token_Ptr; case Token is when Tok_Identifier => if In_Zone = In_Case_Construction then Error_Msg ("a variable cannot be declared here", Token_Ptr); end if; Parse_Variable_Declaration (Current_Declaration, First_Attribute => First_Attribute, Current_Project => Current_Project, Current_Package => Current_Package); when Tok_For => Parse_Attribute_Declaration (Attribute => Current_Declaration, First_Attribute => First_Attribute, Current_Project => Current_Project, Current_Package => Current_Package); when Tok_Package => -- Package declaration if In_Zone /= In_Project then Error_Msg ("a package cannot be declared here", Token_Ptr); end if; Parse_Package_Declaration (Package_Declaration => Current_Declaration, Current_Project => Current_Project); when Tok_Type => -- Type String Declaration if In_Zone /= In_Project then Error_Msg ("a string type cannot be declared here", Token_Ptr); end if; Parse_String_Type_Declaration (String_Type => Current_Declaration, Current_Project => Current_Project, First_Attribute => First_Attribute); when Tok_Case => -- Case construction Parse_Case_Construction (Case_Construction => Current_Declaration, First_Attribute => First_Attribute, Current_Project => Current_Project, Current_Package => Current_Package); when others => exit; -- We are leaving Parse_Declarative_Items positionned -- at the first token after the list of declarative items. -- It could be "end" (for a project, a package declaration or -- a case construction) or "when" (for a case construction) end case; Expect (Tok_Semicolon, "; after declarative items"); if Current_Declarative_Item = Empty_Node then Current_Declarative_Item := Default_Project_Node (Of_Kind => N_Declarative_Item); Declarations := Current_Declarative_Item; else Next_Declarative_Item := Default_Project_Node (Of_Kind => N_Declarative_Item); Set_Next_Declarative_Item (Current_Declarative_Item, To => Next_Declarative_Item); Current_Declarative_Item := Next_Declarative_Item; end if; Set_Current_Item_Node (Current_Declarative_Item, To => Current_Declaration); Set_Location_Of (Current_Declarative_Item, To => Item_Location); end loop; end Parse_Declarative_Items; ------------------------------- -- Parse_Package_Declaration -- ------------------------------- procedure Parse_Package_Declaration (Package_Declaration : out Project_Node_Id; Current_Project : Project_Node_Id) is First_Attribute : Attribute_Node_Id := Empty_Attribute; Current_Package : Package_Node_Id := Empty_Package; First_Declarative_Item : Project_Node_Id := Empty_Node; begin Package_Declaration := Default_Project_Node (Of_Kind => N_Package_Declaration); Set_Location_Of (Package_Declaration, To => Token_Ptr); -- Scan past "package" Scan; Expect (Tok_Identifier, "identifier"); if Token = Tok_Identifier then Set_Name_Of (Package_Declaration, To => Token_Name); for Index in Package_Attributes.First .. Package_Attributes.Last loop if Token_Name = Package_Attributes.Table (Index).Name then First_Attribute := Package_Attributes.Table (Index).First_Attribute; Current_Package := Index; exit; end if; end loop; if Current_Package = Empty_Package then Error_Msg ("not an allowed package name", Token_Ptr); else Set_Package_Id_Of (Package_Declaration, To => Current_Package); declare Current : Project_Node_Id := First_Package_Of (Current_Project); begin while Current /= Empty_Node and then Name_Of (Current) /= Token_Name loop Current := Next_Package_In_Project (Current); end loop; if Current /= Empty_Node then Error_Msg ("package declared twice in the same project", Token_Ptr); else -- Add the package to the project list Set_Next_Package_In_Project (Package_Declaration, To => First_Package_Of (Current_Project)); Set_First_Package_Of (Current_Project, To => Package_Declaration); end if; end; end if; -- Scan past the package name Scan; end if; if Token = Tok_Renames then -- Scan past "renames" Scan; Expect (Tok_Identifier, "identifier"); if Token = Tok_Identifier then declare Project_Name : Name_Id := Token_Name; Clause : Project_Node_Id := First_With_Clause_Of (Current_Project); The_Project : Project_Node_Id := Empty_Node; begin while Clause /= Empty_Node loop The_Project := Project_Node_Of (Clause); exit when Name_Of (The_Project) = Project_Name; Clause := Next_With_Clause_Of (Clause); end loop; if Clause = Empty_Node then Error_Msg ("not an imported project", Token_Ptr); else Set_Project_Of_Renamed_Package_Of (Package_Declaration, To => The_Project); end if; end; Scan; Expect (Tok_Dot, "."); if Token = Tok_Dot then Scan; Expect (Tok_Identifier, "identifier"); if Token = Tok_Identifier then if Name_Of (Package_Declaration) /= Token_Name then Error_Msg ("not the same package name", Token_Ptr); elsif Project_Of_Renamed_Package_Of (Package_Declaration) /= Empty_Node then declare Current : Project_Node_Id := First_Package_Of (Project_Of_Renamed_Package_Of (Package_Declaration)); begin while Current /= Empty_Node and then Name_Of (Current) /= Token_Name loop Current := Next_Package_In_Project (Current); end loop; if Current = Empty_Node then Error_Msg ("not a package declared by the project", Token_Ptr); end if; end; end if; Scan; end if; end if; end if; Expect (Tok_Semicolon, ";"); elsif Token = Tok_Is then Parse_Declarative_Items (Declarations => First_Declarative_Item, In_Zone => In_Package, First_Attribute => First_Attribute, Current_Project => Current_Project, Current_Package => Package_Declaration); Set_First_Declarative_Item_Of (Package_Declaration, To => First_Declarative_Item); Expect (Tok_End, "end"); if Token = Tok_End then -- Scan past "end" Scan; end if; -- We should have the name of the package after "end" Expect (Tok_Identifier, "identifier"); if Token = Tok_Identifier and then Name_Of (Package_Declaration) /= No_Name and then Token_Name /= Name_Of (Package_Declaration) then Error_Msg_Name_1 := Name_Of (Package_Declaration); Error_Msg ("expected {", Token_Ptr); end if; if Token /= Tok_Semicolon then -- Scan past the package name Scan; end if; Expect (Tok_Semicolon, ";"); else Error_Msg ("expected ""is"" or ""renames""", Token_Ptr); end if; end Parse_Package_Declaration; ----------------------------------- -- Parse_String_Type_Declaration -- ----------------------------------- procedure Parse_String_Type_Declaration (String_Type : out Project_Node_Id; Current_Project : Project_Node_Id; First_Attribute : Attribute_Node_Id) is Current : Project_Node_Id := Empty_Node; First_String : Project_Node_Id := Empty_Node; begin String_Type := Default_Project_Node (Of_Kind => N_String_Type_Declaration); Set_Location_Of (String_Type, To => Token_Ptr); -- Scan past "type" Scan; Expect (Tok_Identifier, "identifier"); if Token = Tok_Identifier then Set_Name_Of (String_Type, To => Token_Name); Current := First_String_Type_Of (Current_Project); while Current /= Empty_Node and then Name_Of (Current) /= Token_Name loop Current := Next_String_Type (Current); end loop; if Current /= Empty_Node then Error_Msg ("duplicate string type name", Token_Ptr); else Current := First_Variable_Of (Current_Project); while Current /= Empty_Node and then Name_Of (Current) /= Token_Name loop Current := Next_Variable (Current); end loop; if Current /= Empty_Node then Error_Msg ("already a variable name", Token_Ptr); else Set_Next_String_Type (String_Type, To => First_String_Type_Of (Current_Project)); Set_First_String_Type_Of (Current_Project, To => String_Type); end if; end if; -- Scan past the name Scan; end if; Expect (Tok_Is, "is"); if Token = Tok_Is then Scan; end if; Expect (Tok_Left_Paren, "("); if Token = Tok_Left_Paren then Scan; end if; Prj.Strt.Parse_String_Type_List (First_String => First_String); Set_First_Literal_String (String_Type, To => First_String); Expect (Tok_Right_Paren, ")"); if Token = Tok_Right_Paren then Scan; end if; end Parse_String_Type_Declaration; -------------------------------- -- Parse_Variable_Declaration -- -------------------------------- procedure Parse_Variable_Declaration (Variable : out Project_Node_Id; First_Attribute : Attribute_Node_Id; Current_Project : Project_Node_Id; Current_Package : Project_Node_Id) is Expression_Location : Source_Ptr; String_Type_Name : Name_Id := No_Name; Project_String_Type_Name : Name_Id := No_Name; Type_Location : Source_Ptr := No_Location; Project_Location : Source_Ptr := No_Location; Expression : Project_Node_Id := Empty_Node; Variable_Name : constant Name_Id := Token_Name; begin Variable := Default_Project_Node (Of_Kind => N_Variable_Declaration); Set_Name_Of (Variable, To => Variable_Name); Set_Location_Of (Variable, To => Token_Ptr); -- Scan past the variable name Scan; if Token = Tok_Colon then -- Typed string variable declaration Scan; Set_Kind_Of (Variable, N_Typed_Variable_Declaration); Expect (Tok_Identifier, "identifier"); if Token = Tok_Identifier then String_Type_Name := Token_Name; Type_Location := Token_Ptr; Scan; if Token = Tok_Dot then Project_String_Type_Name := String_Type_Name; Project_Location := Type_Location; -- Scan past the dot Scan; Expect (Tok_Identifier, "identifier"); if Token = Tok_Identifier then String_Type_Name := Token_Name; Type_Location := Token_Ptr; Scan; else String_Type_Name := No_Name; end if; end if; if String_Type_Name /= No_Name then declare Current : Project_Node_Id := First_String_Type_Of (Current_Project); begin if Project_String_Type_Name /= No_Name then declare The_Project_Name_And_Node : constant Tree_Private_Part.Project_Name_And_Node := Tree_Private_Part.Projects_Htable.Get (Project_String_Type_Name); use Tree_Private_Part; begin if The_Project_Name_And_Node = Tree_Private_Part.No_Project_Name_And_Node then Error_Msg ("unknown project", Project_Location); Current := Empty_Node; else Current := First_String_Type_Of (The_Project_Name_And_Node.Node); end if; end; end if; while Current /= Empty_Node and then Name_Of (Current) /= String_Type_Name loop Current := Next_String_Type (Current); end loop; if Current = Empty_Node then Error_Msg ("unknown string type", Type_Location); else Set_String_Type_Of (Variable, To => Current); end if; end; end if; end if; end if; Expect (Tok_Colon_Equal, ":="); if Token = Tok_Colon_Equal then Scan; end if; -- Get the single string or string list value Expression_Location := Token_Ptr; Prj.Strt.Parse_Expression (Expression => Expression, Current_Project => Current_Project, Current_Package => Current_Package); Set_Expression_Of (Variable, To => Expression); if Expression /= Empty_Node then Set_Expression_Kind_Of (Variable, To => Expression_Kind_Of (Expression)); end if; declare The_Variable : Project_Node_Id := Empty_Node; begin if Current_Package /= Empty_Node then The_Variable := First_Variable_Of (Current_Package); elsif Current_Project /= Empty_Node then The_Variable := First_Variable_Of (Current_Project); end if; while The_Variable /= Empty_Node and then Name_Of (The_Variable) /= Variable_Name loop The_Variable := Next_Variable (The_Variable); end loop; if The_Variable = Empty_Node then if Current_Package /= Empty_Node then Set_Next_Variable (Variable, To => First_Variable_Of (Current_Package)); Set_First_Variable_Of (Current_Package, To => Variable); elsif Current_Project /= Empty_Node then Set_Next_Variable (Variable, To => First_Variable_Of (Current_Project)); Set_First_Variable_Of (Current_Project, To => Variable); end if; else if Expression_Kind_Of (Variable) /= Undefined then if Expression_Kind_Of (The_Variable) = Undefined then Set_Expression_Kind_Of (The_Variable, To => Expression_Kind_Of (Variable)); else if Expression_Kind_Of (The_Variable) /= Expression_Kind_Of (Variable) then Error_Msg ("wrong expression kind for the variable", Expression_Location); end if; end if; end if; end if; end; end Parse_Variable_Declaration; end Prj.Dect;
with Ada.Strings.Fixed; with TCG.Utils; use TCG.Utils; with DOM.Core; use DOM.Core; with DOM.Core.Elements; use DOM.Core.Elements; with DOM.Core.Nodes; use DOM.Core.Nodes; package body TCG.Collision_Objects is type Polygon_Access is access all Polygon; function To_Float (Str : String) return Float; function To_Point (Str : String) return Point; function To_Polygon (Offset : Point; Str : String) return not null Polygon_Access; function Create (N : Node) return Collision_Shape; function Inside_Ellipse (Pt : Point; Ellipse : Polygon) return Boolean with Pre => Ellipse'Length = 4 and then Ellipse'First = 1; -------------- -- To_Float -- -------------- function To_Float (Str : String) return Float is (Float'Value (Str)); -------------- -- To_Point -- -------------- function To_Point (Str : String) return Point is Index : constant Natural := Ada.Strings.Fixed.Index (Str, ","); begin return (To_Float (Str (Str'First .. Index - 1)), To_Float (Str (Index + 1 .. Str'Last))); end To_Point; ---------------- -- To_Polygon -- ---------------- function To_Polygon (Offset : Point; Str : String) return not null Polygon_Access is Number_Of_Points : constant Natural := Ada.Strings.Fixed.Count (Str, " ") + 1; Ret : constant not null Polygon_Access := new Polygon (1 .. Number_Of_Points); Index : Natural; Last_Index : Natural := Str'First; begin for Pt of Ret.all loop Index := Ada.Strings.Fixed.Index (Str (Last_Index .. Str'Last), " "); if Index = 0 then -- Last point in the list Pt := To_Point (Str (Last_Index .. Str'Last)); else Pt := To_Point (Str (Last_Index .. Index - 1)); end if; Pt.X := Pt.X + Offset.X; Pt.Y := Pt.Y + Offset.Y; Last_Index := Index + 1; end loop; return Ret; end To_Polygon; ------------ -- Create -- ------------ function Create (N : Node) return Collision_Shape is X : constant Float := To_Float (Item_As_String (N, "x")); Y : constant Float := To_Float (Item_As_String (N, "y")); Has_Width : constant Boolean := Item_Exists (N, "width"); Has_Height : constant Boolean := Item_Exists (N, "height"); Height, Width : Float; Rect : Polygon (1 .. 4); Poly : access Polygon; List : Node_List; begin if Has_Width or else Has_Height then Width := To_Float (Item_As_String (N, "width")); Height := To_Float (Item_As_String (N, "height")); Rect := ((X, Y), (X + Width, Y), (X + Width, Y + Height), (X, Y + Height)); List := Get_Elements_By_Tag_Name (N, "ellipse"); if Length (List) /= 0 then Free (List); return (Ellipse_Shape, Rect); else Free (List); return (Rectangle_Shape, Rect); end if; else List := Get_Elements_By_Tag_Name (N, "polygon"); if Length (List) /= 1 then raise Program_Error with "Invalid number of polygon elements"; end if; Poly := To_Polygon ((X, Y), Item_As_String (Item (List, 0), "points")); Free (List); return (Polygon_Shape, Poly); end if; end Create; ------------------- -- Has_Collision -- ------------------- function Has_Collision (This : Collisions) return Boolean is (not This.List.Is_Empty); ------------ -- Create -- ------------ procedure Load (This : in out Collisions; N : DOM.Core.Node) is List : Node_List; begin List := Elements.Get_Elements_By_Tag_Name (N, "object"); for Index in 1 .. Length (List) loop This.List.Append (Create (Item (List, Index - 1))); end loop; Free (List); end Load; -------------------- -- Inside_Ellipse -- -------------------- function Inside_Ellipse (Pt : Point; Ellipse : Polygon) return Boolean is Diag_1 : constant Geometry.Line := To_Line (Ellipse (1), Ellipse (3)); Diag_2 : constant Geometry.Line := To_Line (Ellipse (2), Ellipse (4)); Center : constant Point := Intersection (Diag_1, Diag_2); H_Axis : constant Vector := To_Vector ((Ellipse (1), Ellipse (2))); V_Axis : constant Vector := To_Vector ((Ellipse (2), Ellipse (3))); H_Semi : constant Distance_Type := Length (H_Axis) / 2.0; V_Semi : constant Distance_Type := Length (V_Axis) / 2.0; begin return ( ((Pt.X - Center.X)**2 / H_Semi**2) + ((Pt.Y - Center.Y)**2 / V_Semi**2) ) <= 1.0; end Inside_Ellipse; ------------- -- Collide -- ------------- function Collide (This : Collisions; X, Y : Float) return Boolean is function Fixed_Inside (P : Point; Poly : Polygon) return Boolean; function Fixed_Inside (P : Point; Poly : Polygon) return Boolean is J : Natural := Poly'Last; C : Boolean := False; Deltay : Float; begin -- See http://www.ecse.rpi.edu/Homepages/wrf/Research -- /Short_Notes/pnpoly.html for S in Poly'Range loop Deltay := P.Y - Poly (S).Y; -- The divide below is mandatory: if you transform it into a -- multiplication on the other side, the sign of the denominator -- will flip the inequality, and thus make the code harder. if ((0.0 <= Deltay and then P.Y < Poly (J).Y) or else (Poly (J).Y <= P.Y and then Deltay < 0.0)) and then (P.X - Poly (S).X < (Poly (J).X - Poly (S).X) * Deltay / (Poly (J).Y - Poly (S).Y)) then C := not C; end if; J := S; end loop; return C; end Fixed_Inside; begin for Shape of This.List loop case Shape.Kind is when Rectangle_Shape => if Fixed_Inside ((X, Y), Shape.Rect) then return True; end if; when Ellipse_Shape => if Inside_Ellipse ((X, Y), Shape.Rect) then return True; end if; when Polygon_Shape => if Fixed_Inside ((X, Y), Shape.Poly.all) then return True; end if; end case; end loop; return False; end Collide; end TCG.Collision_Objects;
----------------------------------------------------------------------- -- awa-wikis-writers-text -- Wiki HTML writer -- Copyright (C) 2011, 2012, 2013, 2015 Stephane Carrez -- Written by Stephane Carrez (Stephane.Carrez@gmail.com) -- -- Licensed under the Apache License, Version 2.0 (the "License"); -- you may not use this file except in compliance with the License. -- You may obtain a copy of the License at -- -- http://www.apache.org/licenses/LICENSE-2.0 -- -- Unless required by applicable law or agreed to in writing, software -- distributed under the License is distributed on an "AS IS" BASIS, -- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -- See the License for the specific language governing permissions and -- limitations under the License. ----------------------------------------------------------------------- package body AWA.Wikis.Writers.Text is use AWA.Wikis.Documents; -- ------------------------------ -- Set the output writer. -- ------------------------------ procedure Set_Writer (Document : in out Text_Writer; Writer : in ASF.Contexts.Writer.Response_Writer_Access) is begin Document.Writer := Writer; end Set_Writer; -- ------------------------------ -- Add a section header in the document. -- ------------------------------ overriding procedure Add_Header (Document : in out Text_Writer; Header : in Unbounded_Wide_Wide_String; Level : in Positive) is pragma Unreferenced (Level); begin Document.Close_Paragraph; if not Document.Empty_Line then Document.Add_Line_Break; end if; Document.Writer.Write (Header); Document.Add_Line_Break; end Add_Header; -- ------------------------------ -- Add a line break (<br>). -- ------------------------------ overriding procedure Add_Line_Break (Document : in out Text_Writer) is begin Document.Writer.Write (ASCII.LF); Document.Empty_Line := True; end Add_Line_Break; -- ------------------------------ -- Add a paragraph (<p>). Close the previous paragraph if any. -- The paragraph must be closed at the next paragraph or next header. -- ------------------------------ overriding procedure Add_Paragraph (Document : in out Text_Writer) is begin Document.Close_Paragraph; Document.Need_Paragraph := True; Document.Add_Line_Break; end Add_Paragraph; -- ------------------------------ -- Add a blockquote (<blockquote>). The level indicates the blockquote nested level. -- The blockquote must be closed at the next header. -- ------------------------------ overriding procedure Add_Blockquote (Document : in out Text_Writer; Level : in Natural) is begin Document.Close_Paragraph; for I in 1 .. Level loop Document.Writer.Write (" "); end loop; end Add_Blockquote; -- ------------------------------ -- Add a list item (<li>). Close the previous paragraph and list item if any. -- The list item will be closed at the next list item, next paragraph or next header. -- ------------------------------ overriding procedure Add_List_Item (Document : in out Text_Writer; Level : in Positive; Ordered : in Boolean) is pragma Unreferenced (Level, Ordered); begin if not Document.Empty_Line then Document.Add_Line_Break; end if; Document.Need_Paragraph := False; Document.Open_Paragraph; end Add_List_Item; procedure Close_Paragraph (Document : in out Text_Writer) is begin if Document.Has_Paragraph then Document.Add_Line_Break; end if; Document.Has_Paragraph := False; end Close_Paragraph; procedure Open_Paragraph (Document : in out Text_Writer) is begin if Document.Need_Paragraph then Document.Has_Paragraph := True; Document.Need_Paragraph := False; end if; end Open_Paragraph; -- ------------------------------ -- Add an horizontal rule (<hr>). -- ------------------------------ overriding procedure Add_Horizontal_Rule (Document : in out Text_Writer) is begin Document.Close_Paragraph; end Add_Horizontal_Rule; -- ------------------------------ -- Add a link. -- ------------------------------ overriding procedure Add_Link (Document : in out Text_Writer; Name : in Unbounded_Wide_Wide_String; Link : in Unbounded_Wide_Wide_String; Language : in Unbounded_Wide_Wide_String; Title : in Unbounded_Wide_Wide_String) is pragma Unreferenced (Language); begin Document.Open_Paragraph; if Length (Title) > 0 then Document.Writer.Write (Title); end if; Document.Writer.Write (Link); Document.Writer.Write (Name); Document.Empty_Line := False; end Add_Link; -- ------------------------------ -- Add an image. -- ------------------------------ overriding procedure Add_Image (Document : in out Text_Writer; Link : in Unbounded_Wide_Wide_String; Alt : in Unbounded_Wide_Wide_String; Position : in Unbounded_Wide_Wide_String; Description : in Unbounded_Wide_Wide_String) is pragma Unreferenced (Position); begin Document.Open_Paragraph; if Length (Alt) > 0 then Document.Writer.Write (Alt); end if; if Length (Description) > 0 then Document.Writer.Write (Description); end if; Document.Writer.Write (Link); Document.Empty_Line := False; end Add_Image; -- ------------------------------ -- Add a quote. -- ------------------------------ overriding procedure Add_Quote (Document : in out Text_Writer; Quote : in Unbounded_Wide_Wide_String; Link : in Unbounded_Wide_Wide_String; Language : in Unbounded_Wide_Wide_String) is pragma Unreferenced (Link, Language); begin Document.Open_Paragraph; Document.Writer.Write (Quote); Document.Empty_Line := False; end Add_Quote; -- ------------------------------ -- Add a text block with the given format. -- ------------------------------ overriding procedure Add_Text (Document : in out Text_Writer; Text : in Unbounded_Wide_Wide_String; Format : in AWA.Wikis.Documents.Format_Map) is pragma Unreferenced (Format); begin Document.Writer.Write (Text); Document.Empty_Line := False; end Add_Text; -- ------------------------------ -- Add a text block that is pre-formatted. -- ------------------------------ procedure Add_Preformatted (Document : in out Text_Writer; Text : in Unbounded_Wide_Wide_String; Format : in Unbounded_Wide_Wide_String) is pragma Unreferenced (Format); begin Document.Close_Paragraph; Document.Writer.Write (Text); Document.Empty_Line := False; end Add_Preformatted; -- ------------------------------ -- Finish the document after complete wiki text has been parsed. -- ------------------------------ overriding procedure Finish (Document : in out Text_Writer) is begin Document.Close_Paragraph; end Finish; end AWA.Wikis.Writers.Text;
-- SPDX-License-Identifier: Apache-2.0 -- -- Copyright (c) 2020 onox <denkpadje@gmail.com> -- -- Licensed under the Apache License, Version 2.0 (the "License"); -- you may not use this file except in compliance with the License. -- You may obtain a copy of the License at -- -- http://www.apache.org/licenses/LICENSE-2.0 -- -- Unless required by applicable law or agreed to in writing, software -- distributed under the License is distributed on an "AS IS" BASIS, -- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -- See the License for the specific language governing permissions and -- limitations under the License. with Interfaces.C; with Ada.Unchecked_Deallocation; package body Canberra is procedure Free is new Ada.Unchecked_Deallocation (Sound_Status, Sound_Status_Access); package API is type Error_Code is (Error_Disconnected, Error_Forked, Error_Disabled, Error_Internal, Error_IO, Error_Access, Error_Not_Available, Error_Canceled, Error_Destroyed, Error_Not_Found, Error_Too_Big, Error_Corrupt, Error_System, Error_No_Driver, Error_Out_Of_Memory, Error_State, Error_Invalid, Error_Not_Supported, Success); for Error_Code use (Error_Disconnected => -18, Error_Forked => -17, Error_Disabled => -16, Error_Internal => -15, Error_IO => -14, Error_Access => -13, Error_Not_Available => -12, Error_Canceled => -11, Error_Destroyed => -10, Error_Not_Found => -9, Error_Too_Big => -8, Error_Corrupt => -7, Error_System => -6, Error_No_Driver => -5, Error_Out_Of_Memory => -4, Error_State => -3, Error_Invalid => -2, Error_Not_Supported => -1, Success => 0); for Error_Code'Size use Interfaces.C.int'Size; -------------------------------------------------------------------------- type Property_List is access System.Address with Storage_Size => 0; function Create (Handle : in out Property_List) return Error_Code with Import, Convention => C, External_Name => "ca_proplist_create"; function Destroy (Handle : Property_List) return Error_Code with Import, Convention => C, External_Name => "ca_proplist_destroy"; function Set (Handle : Property_List; Key : Interfaces.C.char_array; Value : Interfaces.C.char_array) return Error_Code with Import, Convention => C, External_Name => "ca_proplist_sets"; -------------------------------------------------------------------------- function Create (Handle : in out Context_Handle) return Error_Code with Import, Convention => C, External_Name => "ca_context_create"; function Destroy (Handle : Context_Handle) return Error_Code with Import, Convention => C, External_Name => "ca_context_destroy"; function Change_Property (Handle : Context_Handle; Property_0 : Interfaces.C.char_array; Value_0 : Interfaces.C.char_array; None : System.Address) return Error_Code with Import, Convention => C, External_Name => "ca_context_change_props"; function Cancel (Handle : Context_Handle; Identifier : ID) return Error_Code with Import, Convention => C, External_Name => "ca_context_cancel"; type On_Finish_Callback is access procedure (Handle : Context_Handle; Identifier : ID; Error : Error_Code; Status : not null access Sound_Status) with Convention => C; function Play_Full (Handle : Context_Handle; Identifier : ID; Properties : Property_List; On_Finish : On_Finish_Callback; Status : not null access Sound_Status) return Error_Code with Import, Convention => C, External_Name => "ca_context_play_full"; end API; ----------------------------------------------------------------------------- protected body Sound_Status is entry Wait_For_Completion when Current_Status /= Playing is begin null; end Wait_For_Completion; procedure Set_Status (Value : Status_Type) is begin if not (case Current_Status is when Available => Value = Playing, when Playing => Value in Finished | Canceled | Failed, when others => Value in Available | Playing) then raise Constraint_Error with "Cannot change status of sound from " & Current_Status'Image & " to " & Value'Image; end if; Current_Status := Value; end Set_Status; function Status return Status_Type is (Current_Status); procedure Increment_Ref is begin References := References + 1; end Increment_Ref; procedure Decrement_Ref (Is_Zero : out Boolean) is begin References := References - 1; Is_Zero := References = 0; end Decrement_Ref; end Sound_Status; function Status (Object : Sound) return Status_Type is (Object.Status.Status); procedure Await_Finish_Playing (Object : Sound) is begin Object.Status.Wait_For_Completion; end Await_Finish_Playing; function Belongs_To (Object : Sound; Subject : Context'Class) return Boolean is (Object.Handle /= null and Object.Handle = Subject.Handle); ----------------------------------------------------------------------------- procedure Raise_Error_If_No_Success (Error : API.Error_Code) is use type API.Error_Code; begin if Error /= API.Success then raise Program_Error with Error'Image; end if; end Raise_Error_If_No_Success; procedure Set_Property (Object : Context; Property, Value : String) is Error : API.Error_Code; begin Error := API.Change_Property (Object.Handle, Interfaces.C.To_C (Property), Interfaces.C.To_C (Value), System.Null_Address); Raise_Error_If_No_Success (Error); end Set_Property; procedure Set_Property (Properties : API.Property_List; Key, Value : String) is Error : API.Error_Code; begin Error := API.Set (Properties, Interfaces.C.To_C (Key), Interfaces.C.To_C (Value)); Raise_Error_If_No_Success (Error); end Set_Property; procedure On_Finish (Handle : Context_Handle; Identifier : ID; Error : API.Error_Code; Status : not null access Sound_Status) with Convention => C; procedure On_Finish (Handle : Context_Handle; Identifier : ID; Error : API.Error_Code; Status : not null access Sound_Status) is Is_Zero : Boolean; Freeable_Status : Sound_Status_Access := Sound_Status_Access (Status); begin Status.Set_Status (case Error is when API.Success => Finished, when API.Error_Canceled => Canceled, when others => Failed); Status.Decrement_Ref (Is_Zero); if Is_Zero then Free (Freeable_Status); end if; end On_Finish; procedure Cancel (Object : Context; Subject : Sound'Class) is Error : API.Error_Code; begin Error := API.Cancel (Object.Handle, Subject.Identifier); Raise_Error_If_No_Success (Error); end Cancel; procedure Play (Object : in out Context; Event_ID : String) is Event_Sound : Sound; begin Object.Play (Event_ID, Event_Sound, Event, Event_ID); Event_Sound.Status.Wait_For_Completion; end Play; procedure Play_Internal (Object : in out Context; Property_Name : String; Property_Value : String; Kind : Role; Name : String; The_Sound : out Sound'Class) is Error : API.Error_Code; Properties : API.Property_List; use type API.Error_Code; Is_Zero : Boolean; begin Raise_Error_If_No_Success (API.Create (Properties)); Set_Property (Properties, Property_Name, Property_Value); Set_Property (Properties, "media.role", (case Kind is when Event => "event", when Music => "music")); Set_Property (Properties, "media.name", (if Name'Length > 0 then Name else Property_Value)); The_Sound.Status.Increment_Ref; The_Sound.Status.Set_Status (Playing); Error := API.Play_Full (Object.Handle, Object.Next_ID, Properties, On_Finish'Access, The_Sound.Status); if Error /= API.Success then The_Sound.Status.Set_Status (Failed); The_Sound.Status.Decrement_Ref (Is_Zero); end if; Raise_Error_If_No_Success (API.Destroy (Properties)); if Error = API.Error_Not_Found then raise Not_Found_Error with Property_Value; end if; Raise_Error_If_No_Success (Error); The_Sound.Handle := Object.Handle; The_Sound.Identifier := Object.Next_ID; Object.Next_ID := Object.Next_ID + 1; end Play_Internal; procedure Play (Object : in out Context; Event_ID : String; Event_Sound : out Sound'Class; Kind : Role := Event; Name : String := "") is begin Play_Internal (Object => Object, Property_Name => "event.id", Property_Value => Event_ID, Kind => Kind, Name => Name, The_Sound => Event_Sound); end Play; procedure Play_File (Object : in out Context; File_Name : String; File_Sound : out Sound'Class; Kind : Role := Event; Name : String := "") is begin Play_Internal (Object => Object, Property_Name => "media.filename", Property_Value => File_Name, Kind => Kind, Name => Name, The_Sound => File_Sound); end Play_File; function Create (Name, ID, Icon : String := "") return Context is Error : API.Error_Code; begin return Object : Context do Error := API.Create (Object.Handle); Raise_Error_If_No_Success (Error); if Name'Length > 0 then Object.Set_Property ("application.name", Name); end if; if ID'Length > 0 then Object.Set_Property ("application.id", ID); end if; if Icon'Length > 0 then Object.Set_Property ("application.icon_name", Icon); end if; end return; end Create; overriding procedure Finalize (Object : in out Context) is Error : API.Error_Code; begin if Object.Handle /= null then Error := API.Destroy (Object.Handle); Raise_Error_If_No_Success (Error); Object.Handle := null; end if; end Finalize; overriding procedure Initialize (Object : in out Sound) is begin Object.Status := new Sound_Status; Object.Status.Increment_Ref; end Initialize; overriding procedure Finalize (Object : in out Sound) is Is_Zero : Boolean; begin Object.Status.Decrement_Ref (Is_Zero); if Is_Zero then Free (Object.Status); end if; end Finalize; end Canberra;
package body Nilakantha is procedure Iterate(Self : in out NilakanthaSeries) is A : Long_Float; S : Long_Float; begin A := Long_Float(Self.A); S := Long_Float(Self.S); Self.A := Self.A + 2; Self.S := -Self.S; Self.Pi := Self.Pi + S * (4.0 / (A * (A * (A + 3.0) + 2.0))); end Iterate; function GetPi(Self : NilakanthaSeries) return Long_Float is begin return Self.Pi; end GetPi; end Nilakantha;
-- RUN: %llvmgcc -S %s procedure Array_Range_Ref is A : String (1 .. 3); B : String := A (A'RANGE)(1 .. 3); begin null; end;
with Card_Dir; use Card_Dir; with Coords; use Coords; with Ada.Numerics.Discrete_Random; package body Aircraft is procedure Ascend(A: in out Aircraft_Type) is begin A.Is_In_The_Air:=true; end Ascend; procedure Land(A: in out Aircraft_Type) is begin A.Is_In_The_Air:=false; end Land; function Get_Is_In_The_Air(A:Aircraft_Type) return Boolean is begin return A.Is_In_The_Air; end Get_Is_In_The_Air; function Get_Coord(A:Aircraft_Type) return Coord is begin return A.Position; end Get_Coord; procedure Set_Coord(A: in out Aircraft_Type; C:Coord) is begin A.Position:=C; end Set_Coord; procedure Set_Card_Dir_Coord(A: in out Aircraft_Type; C: Cardinal_Direction) is begin Change_To_Direction(A.Position, C); end Set_Card_Dir_Coord; --random coordiantes procedure Start(A: in out Aircraft_Type) is --type Rand_Range is range 0..100; --for ranged random package Rand_Int is new Ada.Numerics.Discrete_Random(Integer); use Rand_Int; seed: Generator; C: Coord; begin Rand_Int.Reset(seed); Set_X(C,Random(seed)); Set_Y(C,Random(seed)); Set_Coord(A,C); end Start; function Compare(A1:Aircraft_Type;A2:Aircraft_Type) return Boolean is begin if(A2.Name > A1.Name) then return true; else return false; end if; end Compare; function Get_Distance(A1:Aircraft_Type;A2:Aircraft_Type) return Integer is begin return Get_Distance(A1.Position, A2.Position); end Get_Distance; procedure Action(A: in out Aircraft_Type) is begin ActionHelp(A.Name, A.Position, A.Is_In_The_Air); end Action; function GetName(A: Aircraft_Type) return Id is begin return A.Name; end GetName; end Aircraft;
procedure Fakedsp.Data_Streams.Wave.Test is Source : constant Wave_Source_Access := Open ("test_data/a.wav"); Dst : constant Wave_Destination_Access := Wave.Open (Filename => "test_data/rumenta/b.wav", Sampling => Source.Sampling_Frequency, Last_Channel => Source.Max_Channel); X : Sample_Type; Eof : Boolean; begin loop Source.Read (Sample => X, End_Of_Stream => Eof); exit when Eof; Dst.Write (X); end loop; Source.Close; Dst.Close; declare Q : Wave_Source_Access := Open ("test_data/rumenta/b.wav"); pragma Unreferenced (Q); begin null; end; end Fakedsp.Data_Streams.Wave.Test;
with System.Synchronous_Objects.Abortable; with System.Tasks; package body Ada.Synchronous_Barriers is procedure Do_Wait ( Object : in out Synchronous_Barrier; Notified : out Boolean; Aborted : out Boolean); procedure Do_Wait ( Object : in out Synchronous_Barrier; Notified : out Boolean; Aborted : out Boolean) is Order : Natural; begin System.Synchronous_Objects.Enter (Object.Mutex); Object.Blocked := Object.Blocked + 1; Order := Object.Blocked rem Object.Release_Threshold; Notified := Order = 1 or else Object.Release_Threshold = 1; -- first one if Order = 0 then System.Synchronous_Objects.Set (Object.Event); Aborted := System.Tasks.Is_Aborted; Object.Unblocked := Object.Unblocked + 1; else loop System.Synchronous_Objects.Leave (Object.Mutex); System.Synchronous_Objects.Abortable.Wait (Object.Event, Aborted); System.Synchronous_Objects.Enter (Object.Mutex); exit when Object.Blocked >= Object.Release_Threshold or else Aborted; end loop; Object.Unblocked := Object.Unblocked + 1; end if; if Object.Unblocked = Object.Release_Threshold then Object.Blocked := Object.Blocked - Object.Release_Threshold; Object.Unblocked := 0; if Object.Blocked < Object.Release_Threshold then System.Synchronous_Objects.Reset (Object.Event); end if; end if; System.Synchronous_Objects.Leave (Object.Mutex); end Do_Wait; -- implementation procedure Wait_For_Release ( The_Barrier : in out Synchronous_Barrier; Notified : out Boolean) is Aborted : Boolean; begin System.Tasks.Enable_Abort; Do_Wait (The_Barrier, Notified, Aborted => Aborted); System.Tasks.Disable_Abort (Aborted); end Wait_For_Release; overriding procedure Initialize (Object : in out Synchronous_Barrier) is begin Object.Blocked := 0; Object.Unblocked := 0; System.Synchronous_Objects.Initialize (Object.Mutex); System.Synchronous_Objects.Initialize (Object.Event); end Initialize; overriding procedure Finalize (Object : in out Synchronous_Barrier) is begin System.Synchronous_Objects.Finalize (Object.Mutex); System.Synchronous_Objects.Finalize (Object.Event); end Finalize; end Ada.Synchronous_Barriers;
package Vect18 is type Sarray is array (1 .. 4) of Long_Float; for Sarray'Alignment use 16; procedure Comp (X, Y : Sarray; R : in out Sarray); end Vect18;
with External; use External; package Receiver is task type ReceiverTask(k: Natural) is entry ReceiveMessage; entry Ended; end ReceiverTask; type pReceiverTask is access ReceiverTask; end Receiver;
package Matrix_Mult is Size: Integer := 10; type Mat is array(1..Size, 1..Size) of Integer; procedure Mat_Mult(A: in Mat; B: in Mat; C: out Mat); end Matrix_Mult;
with ada.Streams.Stream_IO; package openGL.Images -- -- Provides ability to create and manipulate images. -- is function fetch_Image (Stream : in Ada.Streams.Stream_IO.Stream_Access; try_TGA : in Boolean) return openGL.Image; end openGL.Images;
package GESTE_Fonts.FreeMono6pt7b is Font : constant Bitmap_Font_Ref; private FreeMono6pt7bBitmaps : aliased constant Font_Bitmap := ( 16#00#, 16#00#, 16#00#, 16#81#, 16#02#, 16#04#, 16#00#, 16#00#, 16#20#, 16#00#, 16#00#, 16#00#, 16#00#, 16#01#, 16#42#, 16#85#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#42#, 16#8F#, 16#8A#, 16#3E#, 16#30#, 16#60#, 16#00#, 16#00#, 16#00#, 16#00#, 16#41#, 16#E4#, 16#46#, 16#03#, 16#22#, 16#78#, 16#20#, 16#00#, 16#00#, 16#00#, 16#00#, 16#C2#, 16#85#, 16#06#, 16#07#, 16#3C#, 16#24#, 16#30#, 16#00#, 16#00#, 16#00#, 16#00#, 16#01#, 16#C2#, 16#04#, 16#19#, 16#2C#, 16#48#, 16#68#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#81#, 16#02#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#40#, 16#81#, 16#02#, 16#04#, 16#08#, 16#10#, 16#20#, 16#00#, 16#00#, 16#00#, 16#01#, 16#02#, 16#04#, 16#04#, 16#08#, 16#10#, 16#40#, 16#80#, 16#00#, 16#00#, 16#00#, 16#00#, 16#87#, 16#43#, 16#0A#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#01#, 16#02#, 16#1F#, 16#08#, 16#10#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#60#, 16#81#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#1F#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#20#, 16#00#, 16#00#, 16#00#, 16#00#, 16#10#, 16#40#, 16#82#, 16#04#, 16#10#, 16#20#, 16#81#, 16#00#, 16#00#, 16#00#, 16#00#, 16#E2#, 16#24#, 16#48#, 16#91#, 16#22#, 16#24#, 16#70#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#87#, 16#02#, 16#04#, 16#08#, 16#10#, 16#F8#, 16#00#, 16#00#, 16#00#, 16#00#, 16#E2#, 16#44#, 16#41#, 16#04#, 16#10#, 16#40#, 16#F8#, 16#00#, 16#00#, 16#00#, 16#00#, 16#E0#, 16#20#, 16#43#, 16#01#, 16#02#, 16#44#, 16#70#, 16#00#, 16#00#, 16#00#, 16#00#, 16#20#, 16#C2#, 16#85#, 16#12#, 16#3E#, 16#08#, 16#38#, 16#00#, 16#00#, 16#00#, 16#00#, 16#F2#, 16#04#, 16#0B#, 16#09#, 16#02#, 16#44#, 16#70#, 16#00#, 16#00#, 16#00#, 16#00#, 16#71#, 16#82#, 16#07#, 16#09#, 16#12#, 16#24#, 16#30#, 16#00#, 16#00#, 16#00#, 16#01#, 16#F0#, 16#20#, 16#81#, 16#02#, 16#08#, 16#10#, 16#20#, 16#00#, 16#00#, 16#00#, 16#00#, 16#E2#, 16#24#, 16#47#, 16#19#, 16#22#, 16#44#, 16#70#, 16#00#, 16#00#, 16#00#, 16#00#, 16#E1#, 16#22#, 16#45#, 16#8F#, 16#02#, 16#08#, 16#60#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#02#, 16#00#, 16#00#, 16#00#, 16#20#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#06#, 16#00#, 16#00#, 16#30#, 16#40#, 16#80#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#43#, 16#18#, 16#10#, 16#1C#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#0F#, 16#C0#, 16#3F#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#06#, 16#02#, 16#03#, 16#04#, 16#70#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#01#, 16#C0#, 16#40#, 16#82#, 16#08#, 16#00#, 16#20#, 16#00#, 16#00#, 16#00#, 16#00#, 16#E2#, 16#44#, 16#CA#, 16#99#, 16#2E#, 16#40#, 16#80#, 16#E0#, 16#00#, 16#00#, 16#00#, 16#03#, 16#82#, 16#85#, 16#12#, 16#3E#, 16#45#, 16#CC#, 16#00#, 16#00#, 16#00#, 16#00#, 16#03#, 16#C4#, 16#48#, 16#9E#, 16#22#, 16#44#, 16#F8#, 16#00#, 16#00#, 16#00#, 16#00#, 16#01#, 16#C4#, 16#48#, 16#10#, 16#20#, 16#40#, 16#78#, 16#00#, 16#00#, 16#00#, 16#00#, 16#03#, 16#C4#, 16#48#, 16#91#, 16#22#, 16#44#, 16#F0#, 16#00#, 16#00#, 16#00#, 16#00#, 16#03#, 16#E4#, 16#0A#, 16#1C#, 16#28#, 16#40#, 16#F8#, 16#00#, 16#00#, 16#00#, 16#00#, 16#03#, 16#E4#, 16#0A#, 16#1C#, 16#28#, 16#40#, 16#E0#, 16#00#, 16#00#, 16#00#, 16#00#, 16#01#, 16#C4#, 16#48#, 16#10#, 16#27#, 16#44#, 16#78#, 16#00#, 16#00#, 16#00#, 16#00#, 16#03#, 16#64#, 16#48#, 16#8F#, 16#22#, 16#44#, 16#DC#, 16#00#, 16#00#, 16#00#, 16#00#, 16#03#, 16#E1#, 16#02#, 16#04#, 16#08#, 16#10#, 16#F8#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#F0#, 16#40#, 16#81#, 16#22#, 16#48#, 16#70#, 16#00#, 16#00#, 16#00#, 16#00#, 16#03#, 16#74#, 16#8A#, 16#1C#, 16#24#, 16#44#, 16#CC#, 16#00#, 16#00#, 16#00#, 16#00#, 16#03#, 16#82#, 16#04#, 16#08#, 16#10#, 16#20#, 16#F8#, 16#00#, 16#00#, 16#00#, 16#00#, 16#06#, 16#3C#, 16#55#, 16#AB#, 16#4A#, 16#85#, 16#CC#, 16#00#, 16#00#, 16#00#, 16#00#, 16#06#, 16#76#, 16#4C#, 16#95#, 16#26#, 16#4C#, 16#C8#, 16#00#, 16#00#, 16#00#, 16#00#, 16#01#, 16#C4#, 16#48#, 16#90#, 16#A2#, 16#44#, 16#70#, 16#00#, 16#00#, 16#00#, 16#00#, 16#03#, 16#C4#, 16#48#, 16#91#, 16#3C#, 16#40#, 16#E0#, 16#00#, 16#00#, 16#00#, 16#00#, 16#01#, 16#C4#, 16#48#, 16#90#, 16#A2#, 16#44#, 16#70#, 16#E9#, 16#20#, 16#00#, 16#00#, 16#03#, 16#C4#, 16#48#, 16#9E#, 16#24#, 16#44#, 16#C4#, 16#00#, 16#00#, 16#00#, 16#00#, 16#01#, 16#E4#, 16#48#, 16#0E#, 16#02#, 16#44#, 16#F0#, 16#00#, 16#00#, 16#00#, 16#00#, 16#03#, 16#E1#, 16#02#, 16#04#, 16#08#, 16#10#, 16#70#, 16#00#, 16#00#, 16#00#, 16#00#, 16#07#, 16#74#, 16#48#, 16#91#, 16#22#, 16#44#, 16#70#, 16#00#, 16#00#, 16#00#, 16#00#, 16#07#, 16#34#, 16#48#, 16#92#, 16#14#, 16#28#, 16#20#, 16#00#, 16#00#, 16#00#, 16#00#, 16#07#, 16#38#, 16#52#, 16#9B#, 16#36#, 16#64#, 16#88#, 16#00#, 16#00#, 16#00#, 16#00#, 16#03#, 16#34#, 16#45#, 16#04#, 16#14#, 16#45#, 16#DC#, 16#00#, 16#00#, 16#00#, 16#00#, 16#03#, 16#34#, 16#45#, 16#04#, 16#08#, 16#10#, 16#70#, 16#00#, 16#00#, 16#00#, 16#00#, 16#03#, 16#E4#, 16#81#, 16#04#, 16#10#, 16#44#, 16#F8#, 16#00#, 16#00#, 16#00#, 16#00#, 16#60#, 16#81#, 16#02#, 16#04#, 16#08#, 16#10#, 16#20#, 16#60#, 16#00#, 16#00#, 16#01#, 16#02#, 16#02#, 16#04#, 16#04#, 16#08#, 16#08#, 16#10#, 16#10#, 16#00#, 16#00#, 16#00#, 16#C0#, 16#81#, 16#02#, 16#04#, 16#08#, 16#10#, 16#20#, 16#C0#, 16#00#, 16#00#, 16#00#, 16#00#, 16#82#, 16#88#, 16#80#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#07#, 16#F0#, 16#00#, 16#00#, 16#01#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#07#, 16#0F#, 16#22#, 16#44#, 16#F8#, 16#00#, 16#00#, 16#00#, 16#03#, 16#02#, 16#04#, 16#0B#, 16#19#, 16#22#, 16#45#, 16#F0#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#07#, 16#11#, 16#20#, 16#40#, 16#78#, 16#00#, 16#00#, 16#00#, 16#00#, 16#10#, 16#20#, 16#47#, 16#91#, 16#22#, 16#44#, 16#74#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#07#, 16#11#, 16#3E#, 16#40#, 16#78#, 16#00#, 16#00#, 16#00#, 16#00#, 16#71#, 16#02#, 16#0F#, 16#88#, 16#10#, 16#20#, 16#F8#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#07#, 16#D1#, 16#22#, 16#44#, 16#78#, 16#11#, 16#C0#, 16#00#, 16#01#, 16#02#, 16#04#, 16#0B#, 16#19#, 16#22#, 16#44#, 16#DC#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#80#, 16#06#, 16#04#, 16#08#, 16#10#, 16#F8#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#40#, 16#0F#, 16#02#, 16#04#, 16#08#, 16#10#, 16#23#, 16#C0#, 16#00#, 16#01#, 16#02#, 16#04#, 16#09#, 16#94#, 16#18#, 16#48#, 16#98#, 16#00#, 16#00#, 16#00#, 16#00#, 16#C0#, 16#81#, 16#02#, 16#04#, 16#08#, 16#10#, 16#F8#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#15#, 16#B5#, 16#4A#, 16#95#, 16#B4#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#0B#, 16#19#, 16#22#, 16#44#, 16#C8#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#07#, 16#11#, 16#22#, 16#44#, 16#70#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#1F#, 16#11#, 16#22#, 16#44#, 16#F1#, 16#07#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#07#, 16#51#, 16#22#, 16#44#, 16#78#, 16#10#, 16#70#, 16#00#, 16#00#, 16#00#, 16#00#, 16#0D#, 16#8C#, 16#10#, 16#20#, 16#F0#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#07#, 16#99#, 16#0E#, 16#44#, 16#F0#, 16#00#, 16#00#, 16#00#, 16#00#, 16#02#, 16#04#, 16#0F#, 16#10#, 16#20#, 16#40#, 16#70#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#09#, 16#91#, 16#22#, 16#44#, 16#78#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#1D#, 16#D1#, 16#14#, 16#28#, 16#20#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#18#, 16#D1#, 16#2A#, 16#6C#, 16#50#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#0D#, 16#8A#, 16#08#, 16#68#, 16#DC#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#0C#, 16#D1#, 16#14#, 16#28#, 16#20#, 16#83#, 16#80#, 16#00#, 16#00#, 16#00#, 16#00#, 16#0F#, 16#92#, 16#08#, 16#20#, 16#F8#, 16#00#, 16#00#, 16#00#, 16#00#, 16#20#, 16#81#, 16#02#, 16#08#, 16#08#, 16#10#, 16#20#, 16#20#, 16#00#, 16#00#, 16#00#, 16#00#, 16#81#, 16#02#, 16#04#, 16#08#, 16#10#, 16#20#, 16#40#, 16#00#, 16#00#, 16#00#, 16#C0#, 16#81#, 16#02#, 16#02#, 16#08#, 16#10#, 16#20#, 16#C0#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#06#, 16#03#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#); Font_D : aliased constant Bitmap_Font := ( Bytes_Per_Glyph => 11, Glyph_Width => 7, Glyph_Height => 12, Data => FreeMono6pt7bBitmaps'Access); Font : constant Bitmap_Font_Ref := Font_D'Access; end GESTE_Fonts.FreeMono6pt7b;
-- Copyright 2016-2021 Bartek thindil Jasicki -- -- This file is part of Steam Sky. -- -- Steam Sky 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. -- -- Steam Sky 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 Steam Sky. If not, see <http://www.gnu.org/licenses/>. with Ada.Characters.Handling; with DOM.Core; with DOM.Core.Documents; with DOM.Core.Nodes; with DOM.Core.Elements; with Bases; with Crafts; use Crafts; with Factions; use Factions; with Log; with Maps; with Ships.Crew; with ShipModules; use ShipModules; with Utils; use Utils; package body Ships is function Create_Ship (Proto_Index, Name: Unbounded_String; X: Map_X_Range; Y: Map_Y_Range; Speed: Ship_Speed; Random_Upgrades: Boolean := True) return Ship_Record is use Bases; use Maps; Tmp_Ship: Ship_Record := Empty_Ship; Ship_Modules: Modules_Container.Vector := Modules_Container.Empty_Vector; Ship_Crew: Crew_Container.Vector := Crew_Container.Empty_Vector; New_Name: Unbounded_String := Null_Unbounded_String; Hull_Index: Modules_Container.Extended_Index := 0; Amount: Natural := 0; Proto_Ship: constant Proto_Ship_Data := Proto_Ships_List(Proto_Index); Ship_Cargo: Inventory_Container.Vector := Inventory_Container.Empty_Vector; Owners: Natural_Container.Vector := Natural_Container.Empty_Vector; begin -- Set ship modules Set_Modules_Block : declare Weight_Gain: Natural := 0; Max_Upgrade_Value: Positive := 1; Temp_Module: BaseModule_Data := (others => <>); Roll: Positive range 1 .. 100 := 1; Upgrades_Amount: Natural := (if Random_Upgrades then Get_Random(Min => 0, Max => Positive(Proto_Ship.Modules.Length)) else 0); begin Set_Modules_Loop : for Module of Proto_Ship.Modules loop Temp_Module := Modules_List(Module); if Upgrades_Amount = 0 or Get_Random(Min => 1, Max => 100) < 51 then goto End_Of_Setting_Upgrades; end if; Weight_Gain := Modules_List(Module).Weight / Modules_List(Module).Durability; if Weight_Gain < 1 then Weight_Gain := 1; end if; Roll := Get_Random(Min => 1, Max => 100); case Roll is when 1 .. 50 => -- Upgrade durability of module Max_Upgrade_Value := Positive(Float(Modules_List(Module).Durability) * 1.5); Temp_Module.Durability := Get_Random (Min => Modules_List(Module).Durability, Max => Max_Upgrade_Value); --## rule off SIMPLIFIABLE_EXPRESSIONS Temp_Module.Weight := Temp_Module.Weight + (Weight_Gain * (Temp_Module.Durability - Modules_List(Module).Durability)); --## rule on SIMPLIFIABLE_EXPRESSIONS when 51 .. 75 => -- Upgrade value (depends on module) of module if Modules_List(Module).MType = ENGINE then Weight_Gain := Weight_Gain * 10; Max_Upgrade_Value := Positive(Float(Modules_List(Module).Value) / 2.0); Temp_Module.Value := Get_Random (Min => Max_Upgrade_Value, Max => Modules_List(Module).Value); --## rule off SIMPLIFIABLE_EXPRESSIONS Temp_Module.Weight := Temp_Module.Weight + (Weight_Gain * (Modules_List(Module).Value - Temp_Module.Value)); --## rule on SIMPLIFIABLE_EXPRESSIONS end if; when 76 .. 100 => -- Upgrade max_value (depends on module) of module case Modules_List(Module).MType is when HULL => Weight_Gain := Weight_Gain * 10; when ENGINE => Weight_Gain := 1; when others => null; end case; if Temp_Module.MType in ENGINE | CABIN | GUN | BATTERING_RAM | HULL | HARPOON_GUN then Max_Upgrade_Value := Positive(Float(Modules_List(Module).MaxValue) * 1.5); Temp_Module.MaxValue := Get_Random (Min => Modules_List(Module).MaxValue, Max => Max_Upgrade_Value); --## rule off SIMPLIFIABLE_EXPRESSIONS Temp_Module.Weight := Temp_Module.Weight + (Weight_Gain * (Temp_Module.MaxValue - Modules_List(Module).MaxValue)); --## rule on SIMPLIFIABLE_EXPRESSIONS end if; end case; Upgrades_Amount := Upgrades_Amount - 1; <<End_Of_Setting_Upgrades>> Owners.Clear; if Temp_Module.MaxOwners > 0 then Set_Module_Owners_Loop : for I in 1 .. Temp_Module.MaxOwners loop Owners.Append(New_Item => 0); end loop Set_Module_Owners_Loop; end if; case Temp_Module.MType is when ENGINE => Ship_Modules.Append (New_Item => (M_Type => ENGINE, Name => Modules_List(Module).Name, Proto_Index => Module, Weight => Temp_Module.Weight, Durability => Temp_Module.Durability, Max_Durability => Temp_Module.Durability, Owner => Owners, Upgrade_Progress => 0, Upgrade_Action => NONE, Fuel_Usage => Temp_Module.Value, Power => Temp_Module.MaxValue, Disabled => False)); when CABIN => Ship_Modules.Append (New_Item => (M_Type => CABIN, Name => Modules_List(Module).Name, Proto_Index => Module, Weight => Temp_Module.Weight, Durability => Temp_Module.Durability, Max_Durability => Temp_Module.Durability, Owner => Owners, Upgrade_Progress => 0, Upgrade_Action => NONE, Cleanliness => Temp_Module.Value, Quality => Temp_Module.Value)); when ALCHEMY_LAB .. GREENHOUSE => Ship_Modules.Append (New_Item => (M_Type => WORKSHOP, Name => Modules_List(Module).Name, Proto_Index => Module, Weight => Temp_Module.Weight, Durability => Temp_Module.Durability, Max_Durability => Temp_Module.Durability, Owner => Owners, Upgrade_Progress => 0, Upgrade_Action => NONE, Crafting_Index => Null_Unbounded_String, Crafting_Time => 0, Crafting_Amount => 0)); when MEDICAL_ROOM => Ship_Modules.Append (New_Item => (M_Type => MEDICAL_ROOM, Name => Modules_List(Module).Name, Proto_Index => Module, Weight => Temp_Module.Weight, Durability => Temp_Module.Durability, Max_Durability => Temp_Module.Durability, Owner => Owners, Upgrade_Progress => 0, Upgrade_Action => NONE)); when COCKPIT => Ship_Modules.Append (New_Item => (M_Type => COCKPIT, Name => Modules_List(Module).Name, Proto_Index => Module, Weight => Temp_Module.Weight, Durability => Temp_Module.Durability, Max_Durability => Temp_Module.Durability, Owner => Owners, Upgrade_Progress => 0, Upgrade_Action => NONE)); when TRAINING_ROOM => Ship_Modules.Append (New_Item => (M_Type => TRAINING_ROOM, Name => Modules_List(Module).Name, Proto_Index => Module, Weight => Temp_Module.Weight, Durability => Temp_Module.Durability, Max_Durability => Temp_Module.Durability, Owner => Owners, Upgrade_Progress => 0, Upgrade_Action => NONE, Trained_Skill => 0)); when TURRET => Ship_Modules.Append (New_Item => (M_Type => TURRET, Name => Modules_List(Module).Name, Proto_Index => Module, Weight => Temp_Module.Weight, Durability => Temp_Module.Durability, Max_Durability => Temp_Module.Durability, Owner => Owners, Upgrade_Progress => 0, Upgrade_Action => NONE, Gun_Index => 0)); when GUN => Ship_Modules.Append (New_Item => (M_Type => GUN, Name => Modules_List(Module).Name, Proto_Index => Module, Weight => Temp_Module.Weight, Durability => Temp_Module.Durability, Max_Durability => Temp_Module.Durability, Owner => Owners, Upgrade_Progress => 0, Upgrade_Action => NONE, Damage => Temp_Module.MaxValue, Ammo_Index => 0)); when CARGO => Ship_Modules.Append (New_Item => (M_Type => CARGO_ROOM, Name => Modules_List(Module).Name, Proto_Index => Module, Weight => Temp_Module.Weight, Durability => Temp_Module.Durability, Max_Durability => Temp_Module.Durability, Owner => Owners, Upgrade_Progress => 0, Upgrade_Action => NONE)); when HULL => Ship_Modules.Append (New_Item => (M_Type => HULL, Name => Modules_List(Module).Name, Proto_Index => Module, Weight => Temp_Module.Weight, Durability => Temp_Module.Durability, Max_Durability => Temp_Module.Durability, Owner => Owners, Upgrade_Progress => 0, Upgrade_Action => NONE, Installed_Modules => Temp_Module.Value, Max_Modules => Temp_Module.MaxValue)); when ARMOR => Ship_Modules.Append (New_Item => (M_Type => ARMOR, Name => Modules_List(Module).Name, Proto_Index => Module, Weight => Temp_Module.Weight, Durability => Temp_Module.Durability, Max_Durability => Temp_Module.Durability, Owner => Owners, Upgrade_Progress => 0, Upgrade_Action => NONE)); when BATTERING_RAM => Ship_Modules.Append (New_Item => (M_Type => BATTERING_RAM, Name => Modules_List(Module).Name, Proto_Index => Module, Weight => Temp_Module.Weight, Durability => Temp_Module.Durability, Max_Durability => Temp_Module.Durability, Owner => Owners, Upgrade_Progress => 0, Upgrade_Action => NONE, Damage2 => Temp_Module.MaxValue, Cooling_Down => False)); when HARPOON_GUN => Ship_Modules.Append (New_Item => (M_Type => HARPOON_GUN, Name => Modules_List(Module).Name, Proto_Index => Module, Weight => Temp_Module.Weight, Durability => Temp_Module.Durability, Max_Durability => Temp_Module.Durability, Owner => Owners, Upgrade_Progress => 0, Upgrade_Action => NONE, Duration => Temp_Module.MaxValue, Harpoon_Index => 0)); when ANY => null; end case; end loop Set_Modules_Loop; end Set_Modules_Block; -- Set ship name New_Name := (if Name = Null_Unbounded_String then Proto_Ship.Name else Name); -- Set ship crew Set_Ship_Crew_Block : declare Member: Member_Data := Member_Data' (Amount_Of_Attributes => Attributes_Amount, Amount_Of_Skills => Skills_Amount, others => <>); begin Set_Crew_Loop : for ProtoMember of Proto_Ship.Crew loop Amount := (if ProtoMember.Max_Amount = 0 then ProtoMember.Min_Amount else Get_Random (Min => ProtoMember.Min_Amount, Max => ProtoMember.Max_Amount)); Add_Crew_Member_Loop : for I in 1 .. Amount loop Member := GenerateMob (MobIndex => ProtoMember.Proto_Index, FactionIndex => Proto_Ship.Owner); Ship_Crew.Append(New_Item => Member); Modules_Loop : for Module of Ship_Modules loop if Module.M_Type = CABIN then Set_Cabin_Name_Loop : for J in Module.Owner.Iterate loop if Module.Owner(J) = 0 then Module.Owner(J) := Ship_Crew.Last_Index; if Natural_Container.To_Index(Position => J) = 1 then Module.Name := Member.Name & To_Unbounded_String(Source => "'s Cabin"); end if; exit Modules_Loop; end if; end loop Set_Cabin_Name_Loop; end if; end loop Modules_Loop; Set_Module_Owner_Loop : for Module of Ship_Modules loop if Module.Owner.Length > 0 then if Module.Owner(1) = 0 and (Module.M_Type in GUN | HARPOON_GUN and Member.Order = Gunner) then Module.Owner(1) := Ship_Crew.Last_Index; exit Set_Module_Owner_Loop; elsif Module.M_Type = COCKPIT and Member.Order = Pilot then Module.Owner(1) := Ship_Crew.Last_Index; exit Set_Module_Owner_Loop; end if; end if; end loop Set_Module_Owner_Loop; end loop Add_Crew_Member_Loop; end loop Set_Crew_Loop; end Set_Ship_Crew_Block; -- Set ship cargo Set_Cargo_Loop : for I in Proto_Ship.Cargo.Iterate loop Amount := (if Proto_Ship.Cargo(I).MaxAmount > 0 then Get_Random (Min => Proto_Ship.Cargo(I).MinAmount, Max => Proto_Ship.Cargo(I).MaxAmount) else Proto_Ship.Cargo(I).MinAmount); Ship_Cargo.Append (New_Item => (ProtoIndex => Proto_Ship.Cargo(I).ProtoIndex, Amount => Amount, Name => Null_Unbounded_String, Durability => 100, Price => 0)); end loop Set_Cargo_Loop; Tmp_Ship := (Name => New_Name, Sky_X => X, Sky_Y => Y, Speed => Speed, Modules => Ship_Modules, Cargo => Ship_Cargo, Crew => Ship_Crew, Upgrade_Module => 0, Destination_X => 0, Destination_Y => 0, Repair_Module => 0, Description => Proto_Ship.Description, Home_Base => 0); Assing_Gun_Block : declare Gun_Assigned: Boolean := False; begin Amount := 0; Count_Modules_Loop : for I in Tmp_Ship.Modules.Iterate loop if Tmp_Ship.Modules(I).M_Type = TURRET then Count_Guns_Loop : for J in Tmp_Ship.Modules.Iterate loop if Tmp_Ship.Modules(J).M_Type in GUN | HARPOON_GUN then Gun_Assigned := False; Check_Assigned_Guns_Loop : for K in Tmp_Ship.Modules.Iterate loop if Tmp_Ship.Modules(K).M_Type = TURRET and then Tmp_Ship.Modules(K).Gun_Index = Modules_Container.To_Index(Position => J) then Gun_Assigned := True; exit Check_Assigned_Guns_Loop; end if; end loop Check_Assigned_Guns_Loop; if not Gun_Assigned then Tmp_Ship.Modules(I).Gun_Index := Modules_Container.To_Index(Position => J); end if; end if; end loop Count_Guns_Loop; elsif Tmp_Ship.Modules(I).M_Type = HULL then Hull_Index := Modules_Container.To_Index(Position => I); end if; if Modules_List(Tmp_Ship.Modules(I).Proto_Index).MType not in GUN | HARPOON_GUN | ARMOR | HULL then Amount := Amount + Modules_List(Tmp_Ship.Modules(I).Proto_Index).Size; end if; end loop Count_Modules_Loop; Tmp_Ship.Modules(Hull_Index).Installed_Modules := Amount; end Assing_Gun_Block; -- Set known crafting recipes Set_Known_Recipes_Loop : for Recipe of Proto_Ship.Known_Recipes loop Known_Recipes.Append(New_Item => Recipe); end loop Set_Known_Recipes_Loop; -- Set home base for ship if SkyMap(X, Y).BaseIndex > 0 then Tmp_Ship.Home_Base := SkyMap(X, Y).BaseIndex; else Find_Home_Base_Block : declare Start_X, Start_Y, End_X, End_Y: Integer; begin Start_X := X - 100; NormalizeCoord(Coord => Start_X); Start_Y := Y - 100; NormalizeCoord(Coord => Start_Y, IsXAxis => False); End_X := X + 100; NormalizeCoord(Coord => End_X); End_Y := Y + 100; NormalizeCoord(Coord => End_Y, IsXAxis => False); Bases_X_Loop : for Sky_X in Start_X .. End_X loop Bases_Y_Loop : for Sky_Y in Start_Y .. End_Y loop if SkyMap(Sky_X, Sky_Y).BaseIndex > 0 then if Sky_Bases(SkyMap(Sky_X, Sky_Y).BaseIndex).Owner = Proto_Ship.Owner then Tmp_Ship.Home_Base := SkyMap(Sky_X, Sky_Y).BaseIndex; exit Bases_X_Loop; end if; end if; end loop Bases_Y_Loop; end loop Bases_X_Loop; if Tmp_Ship.Home_Base = 0 then Set_Home_Base_Loop : for I in Sky_Bases'Range loop if Sky_Bases(I).Owner = Proto_Ship.Owner then Tmp_Ship.Home_Base := I; exit Set_Home_Base_Loop; end if; end loop Set_Home_Base_Loop; end if; end Find_Home_Base_Block; end if; -- Set home base for crew members Set_Home_For_Members_Loop : for Member of Tmp_Ship.Crew loop Member.HomeBase := (if Get_Random(Min => 1, Max => 100) < 99 then Tmp_Ship.Home_Base else Get_Random(Min => Sky_Bases'First, Max => Sky_Bases'Last)); end loop Set_Home_For_Members_Loop; return Tmp_Ship; end Create_Ship; procedure Load_Ships(Reader: Tree_Reader) is use Ada.Characters.Handling; use DOM.Core; use DOM.Core.Elements; use DOM.Core.Nodes; use Log; Nodes_List: constant Node_List := DOM.Core.Documents.Get_Elements_By_Tag_Name (Doc => Get_Tree(Read => Reader), Tag_Name => "ship"); Child_Nodes: Node_List; --## rule line off IMPROPER_INITIALIZATION Temp_Record: Proto_Ship_Data := Empty_Proto_Ship; Module_Amount, Delete_Index: Positive := 1; Action, Sub_Action: Data_Action := Default_Data_Action; Ship_Node, Child_Node: Node; Item_Index, Recipe_Index, Mob_Index, Module_Index, Ship_Index: Unbounded_String := Null_Unbounded_String; procedure Count_Ammo_Value(Item_Type_Index, Multiple: Positive) is begin Count_Ammo_Value_Loop : for I in Temp_Record.Cargo.Iterate loop if Items_List(Temp_Record.Cargo(I).ProtoIndex).IType = Items_Types(Item_Type_Index) then --## rule off SIMPLIFIABLE_EXPRESSIONS Temp_Record.Combat_Value := Temp_Record.Combat_Value + (Items_List(Temp_Record.Cargo(I).ProtoIndex).Value(1) * Multiple); --## rule on SIMPLIFIABLE_EXPRESSIONS end if; end loop Count_Ammo_Value_Loop; end Count_Ammo_Value; begin Load_Proto_Ships_Loop : for I in 0 .. Length(List => Nodes_List) - 1 loop Temp_Record := (Name => Null_Unbounded_String, Modules => UnboundedString_Container.Empty_Vector, Accuracy => (1 => 0, 2 => 0), Combat_Ai => NONE, Evasion => (1 => 0, 2 => 0), Loot => (1 => 0, 2 => 0), Perception => (1 => 0, 2 => 0), Cargo => MobInventory_Container.Empty_Vector, Combat_Value => 1, Crew => Proto_Crew_Container.Empty_Vector, Description => Null_Unbounded_String, Owner => Factions_Container.Key(Position => Factions_List.First), Known_Recipes => UnboundedString_Container.Empty_Vector); Ship_Node := Item(List => Nodes_List, Index => I); Ship_Index := To_Unbounded_String (Source => Get_Attribute(Elem => Ship_Node, Name => "index")); Action := (if Get_Attribute(Elem => Ship_Node, Name => "action")'Length > 0 then Data_Action'Value (Get_Attribute(Elem => Ship_Node, Name => "action")) else ADD); if Action in UPDATE | REMOVE then if not Proto_Ships_List.Contains(Key => Ship_Index) then raise Data_Loading_Error with "Can't " & To_Lower(Item => Data_Action'Image(Action)) & " ship '" & To_String(Source => Ship_Index) & "', there is no ship with that index."; end if; elsif Proto_Ships_List.Contains(Key => Ship_Index) then raise Data_Loading_Error with "Can't add ship '" & To_String(Source => Ship_Index) & "', there is already a ship with that index."; end if; if Action = REMOVE then Proto_Ships_List.Exclude(Key => Ship_Index); Log_Message (Message => "Ship removed: " & To_String(Source => Ship_Index), Message_Type => EVERYTHING); else if Action = UPDATE then Temp_Record := Proto_Ships_List(Ship_Index); end if; if Get_Attribute(Elem => Ship_Node, Name => "name")'Length > 0 then Temp_Record.Name := To_Unbounded_String (Source => Get_Attribute(Elem => Ship_Node, Name => "name")); end if; Child_Nodes := DOM.Core.Elements.Get_Elements_By_Tag_Name (Elem => Ship_Node, Name => "module"); Load_Modules_Loop : for J in 0 .. Length(List => Child_Nodes) - 1 loop Child_Node := Item(List => Child_Nodes, Index => J); Module_Amount := (if Get_Attribute(Elem => Child_Node, Name => "amount") /= "" then Positive'Value (Get_Attribute(Elem => Child_Node, Name => "amount")) else 1); Module_Index := To_Unbounded_String (Source => Get_Attribute(Elem => Child_Node, Name => "index")); if not Modules_List.Contains(Key => Module_Index) then raise Ships_Invalid_Data with "Invalid module index: |" & Get_Attribute(Elem => Child_Node, Name => "index") & "| in " & To_String(Source => Temp_Record.Name) & "."; end if; Sub_Action := (if Get_Attribute(Elem => Child_Node, Name => "action")' Length > 0 then Data_Action'Value (Get_Attribute(Elem => Child_Node, Name => "action")) else ADD); if Sub_Action = ADD then Temp_Record.Modules.Append (New_Item => Module_Index, Count => Count_Type(Module_Amount)); else Find_Delete_Module_Loop : for K in Temp_Record.Modules.Iterate loop if Temp_Record.Modules(K) = Module_Index then Delete_Index := UnboundedString_Container.To_Index(Position => K); exit Find_Delete_Module_Loop; end if; end loop Find_Delete_Module_Loop; Temp_Record.Modules.Delete (Index => Delete_Index, Count => Count_Type(Module_Amount)); end if; end loop Load_Modules_Loop; if Get_Attribute(Elem => Ship_Node, Name => "accuracy") /= "" then Temp_Record.Accuracy(1) := Integer'Value (Get_Attribute(Elem => Ship_Node, Name => "accuracy")); Temp_Record.Accuracy(2) := 0; elsif Get_Attribute(Elem => Ship_Node, Name => "minaccuracy") /= "" then Temp_Record.Accuracy(1) := Integer'Value (Get_Attribute(Elem => Ship_Node, Name => "minaccuracy")); Temp_Record.Accuracy(2) := Integer'Value (Get_Attribute(Elem => Ship_Node, Name => "maxaccuracy")); if Temp_Record.Accuracy(2) < Temp_Record.Accuracy(1) then raise Ships_Invalid_Data with "Can't add ship '" & To_String(Source => Ship_Index) & "', invalid range for accuracy."; end if; end if; if Get_Attribute(Elem => Ship_Node, Name => "combatai") /= "" then Temp_Record.Combat_Ai := Ship_Combat_Ai'Value (Get_Attribute(Elem => Ship_Node, Name => "combatai")); end if; if Get_Attribute(Elem => Ship_Node, Name => "evasion") /= "" then Temp_Record.Evasion(1) := Integer'Value (Get_Attribute(Elem => Ship_Node, Name => "evasion")); Temp_Record.Evasion(2) := 0; elsif Get_Attribute(Elem => Ship_Node, Name => "minevasion") /= "" then Temp_Record.Evasion(1) := Integer'Value (Get_Attribute(Elem => Ship_Node, Name => "minevasion")); Temp_Record.Evasion(2) := Integer'Value (Get_Attribute(Elem => Ship_Node, Name => "maxevasion")); if Temp_Record.Evasion(2) < Temp_Record.Evasion(1) then raise Ships_Invalid_Data with "Can't add ship '" & To_String(Source => Ship_Index) & "', invalid range for evasion."; end if; end if; if Get_Attribute(Elem => Ship_Node, Name => "loot") /= "" then Temp_Record.Loot(1) := Integer'Value (Get_Attribute(Elem => Ship_Node, Name => "loot")); Temp_Record.Loot(2) := 0; elsif Get_Attribute(Elem => Ship_Node, Name => "minloot") /= "" then Temp_Record.Loot(1) := Integer'Value (Get_Attribute(Elem => Ship_Node, Name => "minloot")); Temp_Record.Loot(2) := Integer'Value (Get_Attribute(Elem => Ship_Node, Name => "maxloot")); if Temp_Record.Loot(2) < Temp_Record.Loot(1) then raise Ships_Invalid_Data with "Can't add ship '" & To_String(Source => Ship_Index) & "', invalid range for loot."; end if; end if; if Get_Attribute(Elem => Ship_Node, Name => "perception") /= "" then Temp_Record.Perception(1) := Integer'Value (Get_Attribute(Elem => Ship_Node, Name => "perception")); Temp_Record.Perception(2) := 0; elsif Get_Attribute(Elem => Ship_Node, Name => "minperception") /= "" then Temp_Record.Perception(1) := Integer'Value (Get_Attribute(Elem => Ship_Node, Name => "minperception")); Temp_Record.Perception(2) := Integer'Value (Get_Attribute(Elem => Ship_Node, Name => "maxperception")); if Temp_Record.Perception(2) < Temp_Record.Perception(1) then raise Ships_Invalid_Data with "Can't add ship '" & To_String(Source => Ship_Index) & "', invalid range for perception."; end if; end if; Child_Nodes := DOM.Core.Elements.Get_Elements_By_Tag_Name (Elem => Ship_Node, Name => "cargo"); Load_Cargo_Loop : for J in 0 .. Length(List => Child_Nodes) - 1 loop Child_Node := Item(List => Child_Nodes, Index => J); Item_Index := To_Unbounded_String (Source => Get_Attribute(Elem => Child_Node, Name => "index")); if not Items_List.Contains(Key => Item_Index) then raise Ships_Invalid_Data with "Invalid item index: |" & Get_Attribute(Elem => Child_Node, Name => "index") & "| in " & To_String(Source => Temp_Record.Name) & "."; end if; Sub_Action := (if Get_Attribute(Elem => Child_Node, Name => "action")' Length > 0 then Data_Action'Value (Get_Attribute(Elem => Child_Node, Name => "action")) else ADD); case Sub_Action is when ADD => if Get_Attribute(Elem => Child_Node, Name => "amount")' Length = 0 then if Integer'Value (Get_Attribute (Elem => Child_Node, Name => "maxamount")) < Integer'Value (Get_Attribute (Elem => Child_Node, Name => "minamount")) then raise Ships_Invalid_Data with "Invalid amount range for item : |" & Get_Attribute (Elem => Child_Node, Name => "index") & "| in " & To_String(Source => Temp_Record.Name) & "."; end if; Temp_Record.Cargo.Append (New_Item => (ProtoIndex => Item_Index, MinAmount => Integer'Value (Get_Attribute (Elem => Child_Node, Name => "minamount")), MaxAmount => Integer'Value (Get_Attribute (Elem => Child_Node, Name => "maxamount")))); else Temp_Record.Cargo.Append (New_Item => (ProtoIndex => Item_Index, MinAmount => Integer'Value (Get_Attribute (Elem => Child_Node, Name => "amount")), MaxAmount => 0)); end if; when UPDATE => Update_Cargo_Loop : for Item of Temp_Record.Cargo loop if Item.ProtoIndex = Item_Index then if Get_Attribute (Elem => Child_Node, Name => "amount")' Length = 0 then if Integer'Value (Get_Attribute (Elem => Child_Node, Name => "maxamount")) < Integer'Value (Get_Attribute (Elem => Child_Node, Name => "minamount")) then raise Ships_Invalid_Data with "Invalid amount range for item : |" & Get_Attribute (Elem => Child_Node, Name => "index") & "| in " & To_String(Source => Temp_Record.Name) & "."; end if; Item := (ProtoIndex => Item_Index, MinAmount => Integer'Value (Get_Attribute (Elem => Child_Node, Name => "minamount")), MaxAmount => Integer'Value (Get_Attribute (Elem => Child_Node, Name => "maxamount"))); else Item := (ProtoIndex => Item_Index, MinAmount => Integer'Value (Get_Attribute (Elem => Child_Node, Name => "amount")), MaxAmount => 0); end if; exit Update_Cargo_Loop; end if; end loop Update_Cargo_Loop; when REMOVE => Remove_Cargo_Block : declare Delete_Cargo_Index: Natural := 0; begin Find_Delete_Cargo_Loop : for K in Temp_Record.Cargo.First_Index .. Temp_Record.Cargo.Last_Index loop if Temp_Record.Cargo(K).ProtoIndex = Item_Index then Delete_Cargo_Index := K; exit Find_Delete_Cargo_Loop; end if; end loop Find_Delete_Cargo_Loop; if Delete_Cargo_Index > 0 then Temp_Record.Cargo.Delete (Index => Delete_Cargo_Index); end if; end Remove_Cargo_Block; end case; end loop Load_Cargo_Loop; if Get_Attribute(Elem => Ship_Node, Name => "owner") /= "" then Temp_Record.Owner := To_Unbounded_String (Source => Get_Attribute(Elem => Ship_Node, Name => "owner")); end if; Child_Nodes := DOM.Core.Elements.Get_Elements_By_Tag_Name (Elem => Ship_Node, Name => "recipe"); Load_Known_Recipes_Loop : for J in 0 .. Length(List => Child_Nodes) - 1 loop Recipe_Index := To_Unbounded_String (Source => Get_Attribute (Elem => Item(List => Child_Nodes, Index => J), Name => "index")); if not Recipes_List.Contains(Key => Recipe_Index) then raise Ships_Invalid_Data with "Invalid recipe index: |" & Get_Attribute (Elem => Item(List => Child_Nodes, Index => J), Name => "index") & "| in " & To_String(Source => Temp_Record.Name) & "."; end if; Sub_Action := (if Get_Attribute(Elem => Child_Node, Name => "action")' Length > 0 then Data_Action'Value (Get_Attribute(Elem => Child_Node, Name => "action")) else ADD); if Sub_Action = ADD then Temp_Record.Known_Recipes.Append(New_Item => Recipe_Index); else Find_Delete_Recipe_Loop : for K in Temp_Record.Known_Recipes.Iterate loop if Temp_Record.Known_Recipes(K) = Recipe_Index then Delete_Index := UnboundedString_Container.To_Index(Position => K); exit Find_Delete_Recipe_Loop; end if; end loop Find_Delete_Recipe_Loop; Temp_Record.Known_Recipes.Delete(Index => Delete_Index); end if; end loop Load_Known_Recipes_Loop; Child_Nodes := DOM.Core.Elements.Get_Elements_By_Tag_Name (Elem => Ship_Node, Name => "member"); Load_Crew_Loop : for J in 0 .. Length(List => Child_Nodes) - 1 loop Child_Node := Item(List => Child_Nodes, Index => J); Mob_Index := To_Unbounded_String (Source => Get_Attribute(Elem => Child_Node, Name => "index")); if not ProtoMobs_List.Contains(Key => Mob_Index) then raise Ships_Invalid_Data with "Invalid mob index: |" & Get_Attribute(Elem => Child_Node, Name => "index") & "| in " & To_String(Source => Temp_Record.Name) & "."; end if; Sub_Action := (if Get_Attribute(Elem => Child_Node, Name => "action")' Length > 0 then Data_Action'Value (Get_Attribute(Elem => Child_Node, Name => "action")) else ADD); case Sub_Action is when ADD => if Get_Attribute(Elem => Child_Node, Name => "amount") /= "" then Temp_Record.Crew.Append (New_Item => (Proto_Index => Mob_Index, Min_Amount => Integer'Value (Get_Attribute (Elem => Child_Node, Name => "amount")), Max_Amount => 0)); elsif Get_Attribute (Elem => Child_Node, Name => "minamount") /= "" then if Integer'Value (Get_Attribute (Elem => Child_Node, Name => "maxamount")) < Integer'Value (Get_Attribute (Elem => Child_Node, Name => "minamount")) then raise Ships_Invalid_Data with "Invalid amount range for member : |" & Get_Attribute (Elem => Child_Node, Name => "index") & "| in " & To_String(Source => Temp_Record.Name) & "."; end if; Temp_Record.Crew.Append (New_Item => (Proto_Index => Mob_Index, Min_Amount => Integer'Value (Get_Attribute (Elem => Child_Node, Name => "minamount")), Max_Amount => Integer'Value (Get_Attribute (Elem => Child_Node, Name => "maxamount")))); else Temp_Record.Crew.Append (New_Item => (Proto_Index => Mob_Index, Min_Amount => 1, Max_Amount => 0)); end if; when UPDATE => Update_Crew_Loop : for Member of Temp_Record.Crew loop if Member.Proto_Index = Mob_Index then if Get_Attribute (Elem => Child_Node, Name => "amount") /= "" then Member.Min_Amount := Integer'Value (Get_Attribute (Elem => Child_Node, Name => "amount")); Member.Max_Amount := 0; elsif Get_Attribute (Elem => Child_Node, Name => "minamount") /= "" then if Integer'Value (Get_Attribute (Elem => Child_Node, Name => "maxamount")) < Integer'Value (Get_Attribute (Elem => Child_Node, Name => "minamount")) then raise Ships_Invalid_Data with "Invalid amount range for member : |" & Get_Attribute (Elem => Child_Node, Name => "index") & "| in " & To_String(Source => Temp_Record.Name) & "."; end if; Member.Min_Amount := Integer'Value (Get_Attribute (Elem => Child_Node, Name => "minamount")); Member.Max_Amount := Integer'Value (Get_Attribute (Elem => Child_Node, Name => "maxamount")); else Member.Min_Amount := 1; Member.Max_Amount := 0; end if; exit Update_Crew_Loop; end if; end loop Update_Crew_Loop; when REMOVE => Find_Delete_Crew_Loop : for K in Temp_Record.Crew.Iterate loop if Temp_Record.Crew(K).Proto_Index = Mob_Index then Delete_Index := Proto_Crew_Container.To_Index(Position => K); exit Find_Delete_Crew_Loop; end if; end loop Find_Delete_Crew_Loop; Temp_Record.Crew.Delete(Index => Delete_Index); end case; end loop Load_Crew_Loop; Child_Nodes := DOM.Core.Elements.Get_Elements_By_Tag_Name (Elem => Ship_Node, Name => "description"); if Length(List => Child_Nodes) > 0 then Temp_Record.Description := To_Unbounded_String (Source => Node_Value (N => First_Child (N => Item(List => Child_Nodes, Index => 0)))); end if; Count_Combat_Value_Loop : for Module_Index2 of Temp_Record.Modules loop case Modules_List(Module_Index2).MType is when HULL | GUN | BATTERING_RAM => --## rule off SIMPLIFIABLE_EXPRESSIONS Temp_Record.Combat_Value := Temp_Record.Combat_Value + Modules_List(Module_Index2).Durability + (Modules_List(Module_Index2).MaxValue * 10); --## rule on SIMPLIFIABLE_EXPRESSIONS if Modules_List(Module_Index2).MType = GUN then Count_Ammo_Value (Item_Type_Index => Modules_List(Module_Index2).Value, Multiple => 10); end if; when ARMOR => Temp_Record.Combat_Value := Temp_Record.Combat_Value + Modules_List(Module_Index2).Durability; when HARPOON_GUN => --## rule off SIMPLIFIABLE_EXPRESSIONS Temp_Record.Combat_Value := Temp_Record.Combat_Value + Modules_List(Module_Index2).Durability + (Modules_List(Module_Index2).MaxValue * 5); --## rule on SIMPLIFIABLE_EXPRESSIONS Count_Ammo_Value (Item_Type_Index => Modules_List(Module_Index2).Value, Multiple => 5); when others => null; end case; end loop Count_Combat_Value_Loop; Temp_Record.Combat_Value := Temp_Record.Combat_Value - 1; if Action = UPDATE then Proto_Ships_List(Ship_Index) := Temp_Record; else Proto_Ships_List.Include (Key => Ship_Index, New_Item => Temp_Record); Log_Message (Message => "Ship added: " & To_String(Source => Temp_Record.Name), Message_Type => EVERYTHING); end if; end if; end loop Load_Proto_Ships_Loop; end Load_Ships; function Count_Ship_Weight(Ship: Ship_Record) return Positive is Weight: Natural := 0; Cargo_Weight: Positive := 1; begin Count_Ship_Weight_Loop : for Module of Ship.Modules loop Weight := Weight + Module.Weight; end loop Count_Ship_Weight_Loop; Count_Cargo_Weight_Loop : for Item of Ship.Cargo loop Cargo_Weight := Item.Amount * Items_List(Item.ProtoIndex).Weight; Weight := Weight + Cargo_Weight; end loop Count_Cargo_Weight_Loop; return Weight; end Count_Ship_Weight; function Generate_Ship_Name (Owner: Unbounded_String) return Unbounded_String is New_Name: Unbounded_String := Null_Unbounded_String; begin Generate_Ship_Name_Loop : for I in Factions_List.Iterate loop if Factions_Container.Key(Position => I) /= Owner then goto End_Of_Generate_Name_Loop; end if; if Factions_List(I).NamesType = ROBOTIC then New_Name := Generate_Robotic_Name; else New_Name := Ship_Syllables_Start (Get_Random (Min => Ship_Syllables_Start.First_Index, Max => Ship_Syllables_Start.Last_Index)); if Get_Random(Min => 1, Max => 100) < 51 then Append (Source => New_Name, New_Item => Ship_Syllables_Middle (Get_Random (Min => Ship_Syllables_Middle.First_Index, Max => Ship_Syllables_Middle.Last_Index))); end if; Append (Source => New_Name, New_Item => Ship_Syllables_End (Get_Random (Min => Ship_Syllables_End.First_Index, Max => Ship_Syllables_End.Last_Index))); end if; exit Generate_Ship_Name_Loop; <<End_Of_Generate_Name_Loop>> end loop Generate_Ship_Name_Loop; return New_Name; end Generate_Ship_Name; function Count_Combat_Value return Natural is Combat_Value: Natural := 0; procedure Count_Ammo_Value(Item_Type_Index, Multiple: Positive) is begin Count_Ammo_Value_Loop : for Item of Player_Ship.Cargo loop if Items_List(Item.ProtoIndex).IType = Items_Types(Item_Type_Index) then --## rule off SIMPLIFIABLE_EXPRESSIONS Combat_Value := Combat_Value + (Items_List(Item.ProtoIndex).Value(1) * Multiple); --## rule on SIMPLIFIABLE_EXPRESSIONS end if; end loop Count_Ammo_Value_Loop; end Count_Ammo_Value; begin Count_Combat_Value_Loop : for Module of Player_Ship.Modules loop case Modules_List(Module.Proto_Index).MType is when BATTERING_RAM => --## rule off SIMPLIFIABLE_EXPRESSIONS Combat_Value := Combat_Value + Module.Max_Durability + (Module.Damage2 * 10); --## rule on SIMPLIFIABLE_EXPRESSIONS when GUN => --## rule off SIMPLIFIABLE_EXPRESSIONS Combat_Value := Combat_Value + Module.Max_Durability + (Module.Damage * 10); --## rule on SIMPLIFIABLE_EXPRESSIONS Count_Ammo_Value (Item_Type_Index => Modules_List(Module.Proto_Index).Value, Multiple => 10); when ARMOR => Combat_Value := Combat_Value + Module.Max_Durability; when HARPOON_GUN => --## rule off SIMPLIFIABLE_EXPRESSIONS Combat_Value := Combat_Value + Module.Max_Durability + (Module.Duration * 5); --## rule on SIMPLIFIABLE_EXPRESSIONS Count_Ammo_Value (Item_Type_Index => Modules_List(Module.Proto_Index).Value, Multiple => 5); when HULL => --## rule off SIMPLIFIABLE_EXPRESSIONS Combat_Value := Combat_Value + Module.Max_Durability + (Module.Max_Modules * 10); --## rule on SIMPLIFIABLE_EXPRESSIONS when others => null; end case; end loop Count_Combat_Value_Loop; return Combat_Value; end Count_Combat_Value; function Get_Cabin_Quality(Quality: Natural) return String is begin case Quality is when 0 .. 10 => return "Empty room"; when 11 .. 20 => return "Minimal quality"; when 21 .. 30 => return "Basic quality"; when 31 .. 40 => return "Second class"; when 41 .. 50 => return "Medium quality"; when 51 .. 60 => return "First class"; when 61 .. 70 => return "Extended quality"; when 71 .. 80 => return "Encrusted room"; when 81 .. 90 => return "Luxury quality"; when others => return "Palace room"; end case; end Get_Cabin_Quality; procedure Damage_Module (Ship: in out Ship_Record; Module_Index: Modules_Container.Extended_Index; Damage: Positive; Death_Reason: String) is use Ships.Crew; Real_Damage: Natural := Damage; Weapon_Index: Natural := 0; procedure Remove_Gun(Module_Index2: Positive) is begin if Ship.Modules(Module_Index2).Owner(1) > 0 then Death (MemberIndex => Ship.Modules(Module_Index2).Owner(1), Reason => To_Unbounded_String(Source => Death_Reason), Ship => Ship); end if; end Remove_Gun; begin if Damage > Ship.Modules(Module_Index).Durability then Real_Damage := Ship.Modules(Module_Index).Durability; end if; Ship.Modules(Module_Index).Durability := Ship.Modules(Module_Index).Durability - Real_Damage; if Ship.Modules(Module_Index).Durability = 0 then case Modules_List(Ship.Modules(Module_Index).Proto_Index).MType is when HULL | ENGINE => if Ship = Player_Ship then Death (MemberIndex => 1, Reason => To_Unbounded_String(Source => Death_Reason), Ship => Player_Ship); end if; when TURRET => Weapon_Index := Ship.Modules(Module_Index).Gun_Index; if Weapon_Index > 0 then Ship.Modules(Weapon_Index).Durability := 0; Remove_Gun(Module_Index2 => Weapon_Index); end if; when GUN => Remove_Gun(Module_Index2 => Module_Index); when CABIN => Kill_Owners_Loop : for Owner of Ship.Modules(Module_Index).Owner loop if Owner > 0 and then Ship.Crew(Owner).Order = Rest then Death (MemberIndex => Owner, Reason => To_Unbounded_String(Source => Death_Reason), Ship => Ship); end if; end loop Kill_Owners_Loop; when others => if Ship.Modules(Module_Index).Owner.Length > 0 then if Ship.Modules(Module_Index).Owner(1) > 0 and then Ship.Crew(Ship.Modules(Module_Index).Owner(1)).Order /= Rest then Death (MemberIndex => Ship.Modules(Module_Index).Owner(1), Reason => To_Unbounded_String(Source => Death_Reason), Ship => Ship); end if; end if; end case; end if; end Damage_Module; end Ships;
with Modem; procedure Main is begin if Modem.Init then Modem.Run; else Modem.Error; end if; end Main;
with Ada.Text_IO; use Ada.Text_IO; with Ada.Float_Text_IO; use Ada.Float_Text_IO; with Ada.Integer_Text_IO; use Ada.Integer_Text_IO; with Ada.Float_Text_IO; use Ada.Float_Text_IO; with Sf.System.Sleep; use Sf, Sf.System, Sf.System.Sleep; with Sf.System.Time; use Sf.System.Time; with Sf.Audio.Music; use Sf.Audio, Sf.Audio.Music; with Sf.Audio.SoundStatus; use Sf.Audio.SoundStatus; with Ada.Command_Line; procedure Main is Music : sfMusic_Ptr; Duration : sfTime; ChCount : sfUint32; SampRate : sfUint32; begin Music := createFromFile (Ada.Command_Line.Argument (1)); if Music = null then Put_Line ("Music file not found!"); return; end if; setLoop (Music, sfFalse); setPitch (Music, 1.0); setVolume (Music, 100.0); Duration := getDuration (Music); ChCount := getChannelCount (Music); SampRate := getSampleRate (Music); Put ("Duration : "); Put (Integer (asMilliseconds (Duration))); Put (" milliseconds"); New_Line; Put ("Channels count : "); Put (Integer (ChCount), 0); Put (" channels"); New_Line; Put ("Sample rate : "); Put (Integer (SampRate), 0); Put (" channels/second"); New_Line; play (Music); Put ("Playing... "); while getStatus (Music) = sfPlaying loop -- Display the playing position Put (Integer (asMilliseconds (getPlayingOffset(Music)))); Put (" "); delay 0.1; end loop; destroy (Music); end Main;
-- -- Copyright (C) 2012 Reto Buerki -- Copyright (C) 2012 Adrian-Ken Rueegsegger -- Hochschule fuer Technik Rapperswil -- -- 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. See <http://www.fsf.org/copyleft/gpl.txt>. -- -- 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 Anet.Sockets.Unix; with Anet.Receivers.Stream; with Tkmrpc.Dispatchers.Ees; with Tkmrpc.Process_Stream; pragma Elaborate_All (Anet.Receivers.Stream); pragma Elaborate_All (Tkmrpc.Process_Stream); package body Esa_Event_Service is package Unix_TCP_Receiver is new Anet.Receivers.Stream (Socket_Type => Anet.Sockets.Unix.TCP_Socket_Type); procedure Dispatch is new Tkmrpc.Process_Stream (Dispatch => Tkmrpc.Dispatchers.Ees.Dispatch); Sock : aliased Anet.Sockets.Unix.TCP_Socket_Type; Receiver : Unix_TCP_Receiver.Receiver_Type (S => Sock'Access); ------------------------------------------------------------------------- procedure Finalize is begin Receiver.Stop; end Finalize; ------------------------------------------------------------------------- procedure Init (Address : Interfaces.C.Strings.chars_ptr) is Path : constant String := Interfaces.C.Strings.Value (Address); begin Sock.Init; Sock.Bind (Path => Anet.Sockets.Unix.Path_Type (Path)); Receiver.Listen (Callback => Dispatch'Access); end Init; end Esa_Event_Service;
with Ada.Text_IO; use Ada.Text_IO; procedure textcat is Input : constant not null File_Access := Standard_Input; Output : constant not null File_Access := Standard_Output; begin while not End_Of_File (Input.all) loop declare Item : Character; End_Of_Line : Boolean; begin Look_Ahead (Input.all, Item, End_Of_Line); if End_Of_Line then if End_Of_Page (Input.all) then New_Page (Output.all); else New_Line (Output.all); end if; else Put (Output.all, Item); end if; Skip_Ahead (Input.all); end; end loop; end textcat;
-- This file is covered by the Internet Software Consortium (ISC) License -- Reference: ../License.txt with Ada.Calendar; package PortScan.Log is package CAL renames Ada.Calendar; overall_log : exception; -- Open log, dump diagnostic data and stop timer. function initialize_log (log_handle : in out TIO.File_Type; head_time : out CAL.Time; seq_id : port_id; slave_root : String; UNAME : String; BENV : String; COPTS : String; PTVAR : String; block_dog : Boolean) return Boolean; -- Stop time, write duration data, close log procedure finalize_log (log_handle : in out TIO.File_Type; head_time : CAL.Time; tail_time : out CAL.Time); -- Helper to format phase/section heading function log_section (title : String) return String; -- Format start of build phase in log procedure log_phase_begin (log_handle : TIO.File_Type; phase : String); -- Format end of build phase in log procedure log_phase_end (log_handle : TIO.File_Type); -- Standard log name based on port origin and variant. function log_name (sid : port_id) return String; -- Returns formatted difference in seconds between two times function elapsed_HH_MM_SS (start, stop : CAL.Time) return String; -- Returns formatted difference in seconds between overall start time and now. function elapsed_now return String; -- Establish times before the start and upon completion of a scan. procedure set_scan_start_time (mark : CAL.Time); procedure set_scan_complete (mark : CAL.Time); -- Establish times before the start and upon completion of a bulk run procedure set_overall_start_time (mark : CAL.Time); procedure set_overall_complete (mark : CAL.Time); -- build log operations procedure start_logging (flavor : count_type); procedure stop_logging (flavor : count_type); procedure scribe (flavor : count_type; line : String; flush_after : Boolean); procedure flush_log (flavor : count_type); -- Establish values of build counters procedure set_build_counters (A, B, C, D, E : Natural); -- Increments the indicated build counter by some quality. procedure increment_build_counter (flavor : count_type; quantity : Natural := 1); -- Open log to document packages that get deleted and the reason why procedure start_obsolete_package_logging; procedure stop_obsolete_package_logging; -- Write to log if open and optionally output a copy to screen. procedure obsolete_notice (message : String; write_to_screen : Boolean); -- Return WWW report-formatted timestamp of start time. function www_timestamp_start_time return String; -- Return current build queue size function ports_remaining_to_build return Integer; -- Return value of individual port counter function port_counter_value (flavor : count_type) return Integer; -- Return number of packages built since build started function hourly_build_rate return Natural; -- Return number of packages built in the last 600 seconds function impulse_rate return Natural; -- Show duration between overall start and stop times. function bulk_run_duration return String; -- Return formatted duration of scan function scan_duration return String; -- Former private function exposed for web page generator function timestamp (hack : CAL.Time; www_format : Boolean := False) return String; private type impulse_rec is record hack : CAL.Time; packages : Natural := 0; virgin : Boolean := True; end record; subtype logname_field is String (1 .. 19); subtype impulse_range is Integer range 1 .. 600; type dim_handlers is array (count_type) of TIO.File_Type; type dim_counters is array (count_type) of Natural; type dim_logname is array (count_type) of logname_field; type dim_impulse is array (impulse_range) of impulse_rec; function log_duration (start, stop : CAL.Time) return String; function split_collection (line : String; title : String) return String; procedure dump_port_variables (log_handle : TIO.File_Type; contents : String); -- Simple time calculation (guts) function get_packages_per_hour (packages_done : Natural; from_when : CAL.Time) return Natural; -- bulk run variables Flog : dim_handlers; start_time : CAL.Time; stop_time : CAL.Time; scan_start : CAL.Time; scan_stop : CAL.Time; bld_counter : dim_counters := (0, 0, 0, 0, 0); impulse_counter : impulse_range := impulse_range'Last; impulse_data : dim_impulse; obsolete_pkg_log : TIO.File_Type; obsolete_log_open : Boolean := False; bailing : constant String := " (ravenadm must exit)"; logname : constant dim_logname := ("00_last_results.log", "01_success_list.log", "02_failure_list.log", "03_ignored_list.log", "04_skipped_list.log"); end PortScan.Log;
----------------------------------------------------------------------- -- wiki-utils -- Wiki utility operations -- Copyright (C) 2015, 2016, 2020 Stephane Carrez -- Written by Stephane Carrez (Stephane.Carrez@gmail.com) -- -- Licensed under the Apache License, Version 2.0 (the "License"); -- you may not use this file except in compliance with the License. -- You may obtain a copy of the License at -- -- http://www.apache.org/licenses/LICENSE-2.0 -- -- Unless required by applicable law or agreed to in writing, software -- distributed under the License is distributed on an "AS IS" BASIS, -- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -- See the License for the specific language governing permissions and -- limitations under the License. ----------------------------------------------------------------------- with Wiki.Parsers; with Wiki.Render.Text; with Wiki.Render.Html; with Wiki.Filters.Html; with Wiki.Filters.TOC; with Wiki.Streams.Builders; with Wiki.Streams.Html.Builders; with Wiki.Documents; package body Wiki.Utils is -- ------------------------------ -- Render the wiki text according to the wiki syntax in HTML into a string. -- ------------------------------ function To_Html (Text : in Wiki.Strings.WString; Syntax : in Wiki.Wiki_Syntax) return String is Stream : aliased Wiki.Streams.Html.Builders.Html_Output_Stream; Renderer : aliased Wiki.Render.Html.Html_Renderer; Doc : Wiki.Documents.Document; Filter : aliased Wiki.Filters.Html.Html_Filter_Type; TOC : aliased Wiki.Filters.TOC.TOC_Filter; Engine : Wiki.Parsers.Parser; begin Renderer.Set_Output_Stream (Stream'Unchecked_Access); Renderer.Set_Render_TOC (True); Engine.Add_Filter (TOC'Unchecked_Access); Engine.Add_Filter (Filter'Unchecked_Access); Engine.Set_Syntax (Syntax); Engine.Parse (Text, Doc); Renderer.Render (Doc); return Stream.To_String; end To_Html; -- ------------------------------ -- Render the wiki text according to the wiki syntax in text into a string. -- Wiki formatting and decoration are removed. -- ------------------------------ function To_Text (Text : in Wiki.Strings.WString; Syntax : in Wiki.Wiki_Syntax) return String is Stream : aliased Wiki.Streams.Builders.Output_Builder_Stream; Doc : Wiki.Documents.Document; Renderer : aliased Wiki.Render.Text.Text_Renderer; Engine : Wiki.Parsers.Parser; begin Renderer.Set_Output_Stream (Stream'Unchecked_Access); Engine.Set_Syntax (Syntax); Engine.Parse (Text, Doc); Renderer.Render (Doc); return Stream.To_String; end To_Text; end Wiki.Utils;
-- ---------------------------------------------------------------- -- -- This file contains some improvements to the gl Ada binding -- -- in order to allow a better programming style. -- -- The prototypes below follow the Implementation advice from -- -- ARM Annex B (B.3). -- -- ---------------------------------------------------------------- -- -- ----------------------------------------------------------------- -- -- Copyright (C) 2001 A.M.F.Vargas -- -- Antonio M. F. Vargas -- -- Ponta Delgada - Azores - Portugal -- -- http://www.adapower.net/~avargas -- -- E-mail: avargas@adapower.net -- -- ----------------------------------------------------------------- -- -- -- -- This library is free software; you can redistribute it and/or -- -- modify it under the terms of the GNU General Public -- -- License as published by the Free Software Foundation; either -- -- version 2 of the License, or (at your option) any later version. -- -- -- -- This library is distributed in the hope that it will be useful, -- -- but WITHOUT ANY WARRANTY; without even the implied warranty of -- -- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -- -- General Public License for more details. -- -- -- -- You should have received a copy of the GNU General Public -- -- License along with this library; if not, write to the -- -- Free Software Foundation, Inc., 59 Temple Place - Suite 330, -- -- Boston, MA 02111-1307, USA. -- -- -- -- As a special exception, if other files instantiate generics from -- -- this unit, or you link this unit with other files to produce an -- -- executable, this unit does not by itself cause the resulting -- -- executable to be covered by the GNU General Public License. This -- -- exception does not however invalidate any other reasons why the -- -- executable file might be covered by the GNU Public License. -- -- ----------------------------------------------------------------- -- with Interfaces.C.Strings; use Interfaces.C.Strings; with Ada.Unchecked_Conversion; package body AdaGL is package CS renames Interfaces.C.Strings; function To_chars_ptr is new Ada.Unchecked_Conversion ( GLubyte_Ptr, CS.chars_ptr); -- ====================================== function Get_chars_ptr (Chars_Ref : GLenum) return CS.chars_ptr is begin return To_chars_ptr (glGetString (Chars_Ref)); end Get_chars_ptr; -- ====================================== function glGetString (Chars_Ref : GLenum) return String is temp_chars_ptr : CS.chars_ptr; begin temp_chars_ptr := Get_chars_ptr (Chars_ref); if temp_chars_ptr /= Cs.Null_Ptr then return CS.Value (Get_chars_ptr (Chars_Ref)); else return ""; end if; end glGetString; -- ====================================== end AdaGL;
package body problem_20 is function Solution_1 return Integer is Num : array( Natural range 0 .. 50 ) of Natural := ( 0 => 1, others => 0); Sum : Integer := 0; Carry : Integer := 1; Temp : Integer; begin for I in 2 .. 100 loop Carry := 0; for J in Num'Range loop Temp := (Num(J) * I) + Carry; Num(J) := Temp mod 10_000_000; Carry := Temp / 10_000_000; end loop; end loop; for I in Num'Range loop While Num(I) > 0 loop Sum := Sum + (Num(I) mod 10); Num(I) := Num(I) / 10; end loop; end loop; return Sum; end Solution_1; procedure Test_Solution_1 is Solution : constant Integer := 648; begin Assert( Solution = Solution_1 ); end Test_Solution_1; function Get_Solutions return Solution_Case is Ret : Solution_Case; begin Set_Name( Ret, "problem 20" ); Add_Test( Ret, Test_Solution_1'Access ); return Ret; end Get_Solutions; end problem_20;
with Interfaces; package PyGamer.Audio is type Data_Array is array (Natural range <>) of aliased Interfaces.Unsigned_16; type Audio_Callback is access procedure (Left, Right : out Data_Array); type Sample_Rate_Kind is (SR_11025, SR_22050, SR_44100, SR_96000); procedure Set_Callback (Callback : Audio_Callback; Sample_Rate : Sample_Rate_Kind); end PyGamer.Audio;
type My_Index is mod 2**8; package My_Big_Numbers is new Big_Number (Index_type => My_Index, Nb_Item => 64); function Int2Big is new My_Big_Numbers.Generic_Conversion.Int_Number2Big_Unsigned (Integer); function Big_Get_Hamming is new Get_Hamming (Int_Type => My_Big_Numbers.Big_Unsigned, Zero => My_Big_Numbers.Big_Unsigned_Zero, One => My_Big_Numbers.Big_Unsigned_One, Two => My_Big_Numbers.Big_Unsigned_Two, Three => Int2Big(3), Five => Int2Big(5), "mod" => My_Big_Numbers.Unsigned_Number."mod", "+" => My_Big_Numbers.Unsigned_Number."+", "/" => My_Big_Numbers.Unsigned_Number."/");
with EU_Projects.Times.Time_Expressions.Solving; private package EU_Projects.Projects.Housekeeping is procedure Link_Milestone_To_Deliverable (Project : in out Project_Descriptor); procedure Check_Node_Table (Project : in out Project_Descriptor); function Collect_Equations (Project : Project_Descriptor) return Times.Time_Expressions.Solving.Time_Equation_System; procedure Assign_Results (Project : in out Project_Descriptor; Values : Times.Time_Expressions.Solving.Variable_Map); Housekeeping_Failed : exception; end EU_Projects.Projects.Housekeeping;
------------------------------------------------------------------------------ -- Copyright (c) 2014-2015, Natacha Porté -- -- -- -- Permission to use, copy, modify, and distribute this software for any -- -- purpose with or without fee is hereby granted, provided that the above -- -- copyright notice and this permission notice appear in all copies. -- -- -- -- THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES -- -- WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF -- -- MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR -- -- ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES -- -- WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN -- -- ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF -- -- OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. -- ------------------------------------------------------------------------------ ------------------------------------------------------------------------------ -- Parts of this file were generated with vim in project root directory, -- -- using the following base: -- -- :r !grep -h function generated/*-t.ads -- -- Transforming base to with list: -- -- :s/^function\(.*\)$/with\1;/ -- -- Transforming base to (part of the) returned expression: -- -- :s/^function/ and/ -- ------------------------------------------------------------------------------ with Natools.Static_Maps.Web.Comments.T; with Natools.Static_Maps.Web.Error_Pages.T; with Natools.Static_Maps.Web.Fallback_Render.T; with Natools.Static_Maps.Web.List_Templates.T; with Natools.Static_Maps.Web.Simple_Pages.T; with Natools.Static_Maps.Web.Sites.T; with Natools.Static_Maps.Web.Tag_Pages.T; with Natools.Static_Maps.Web.Tags.T; function Common.Test_Maps return Boolean is begin return Natools.Static_Maps.Web.Comments.T and Natools.Static_Maps.Web.Error_Pages.T and Natools.Static_Maps.Web.Fallback_Render.T and Natools.Static_Maps.Web.List_Templates.T and Natools.Static_Maps.Web.Simple_Pages.T and Natools.Static_Maps.Web.Sites.T and Natools.Static_Maps.Web.Tag_Pages.T and Natools.Static_Maps.Web.Tags.T; end Common.Test_Maps;
package body aIDE.Palette is procedure dummy is begin null; end dummy; end aIDE.Palette;
------------------------------------------------------------------------------ -- -- -- Copyright (C) 2016, AdaCore -- -- -- -- Redistribution and use in source and binary forms, with or without -- -- modification, are permitted provided that the following conditions are -- -- met: -- -- 1. Redistributions of source code must retain the above copyright -- -- notice, this list of conditions and the following disclaimer. -- -- 2. Redistributions in binary form must reproduce the above copyright -- -- notice, this list of conditions and the following disclaimer in -- -- the documentation and/or other materials provided with the -- -- distribution. -- -- 3. Neither the name of the copyright holder nor the names of its -- -- contributors may be used to endorse or promote products derived -- -- from this software without specific prior written permission. -- -- -- -- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -- -- "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -- -- LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -- -- A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -- -- HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -- -- SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -- -- LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -- -- DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -- -- THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -- -- (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -- -- OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -- -- -- ------------------------------------------------------------------------------ with Cortex_M.Debug; with System.Machine_Code; use System.Machine_Code; with HAL; use HAL; with Ada.Unchecked_Conversion; with Interfaces.C; use Interfaces.C; package body Semihosting is type SH_u32_Array is array (Integer range <>) of SH_Word with Pack, Convention => C, Volatile_Components; function To_SH_u32 is new Ada.Unchecked_Conversion (Source => System.Address, Target => SH_Word); function To_SH_u32 is new Ada.Unchecked_Conversion (Source => Integer, Target => SH_Word); subtype Syscall is SH_Word; SYS_OPEN : constant Syscall := 16#01#; SYS_CLOSE : constant Syscall := 16#02#; SYS_WRITEC : constant Syscall := 16#03#; SYS_WRITE0 : constant Syscall := 16#04#; SYS_WRITE : constant Syscall := 16#05#; SYS_READ : constant Syscall := 16#06#; -- SYS_READC : constant Syscall := 16#07#; -- SYS_ISERROR : constant Syscall := 16#08#; -- SYS_ISTTY : constant Syscall := 16#09#; SYS_SEEK : constant Syscall := 16#0A#; -- SYS_FLEN : constant Syscall := 16#0C#; -- SYS_TMPNAM : constant Syscall := 16#0D#; SYS_REMOVE : constant Syscall := 16#0E#; -- SYS_RENAME : constant Syscall := 16#0E#; -- SYS_CLOCK : constant Syscall := 16#10#; -- SYS_TIME : constant Syscall := 16#11#; SYS_ERRNO : constant Syscall := 16#13#; -- SYS_GET_CMD : constant Syscall := 16#15#; -- SYS_HEAPINFO : constant Syscall := 16#16#; -- SYS_ELAPSED : constant Syscall := 16#30#; -- SYS_TICKFREQ : constant Syscall := 16#31#; function Semihosting_Enabled return Boolean is (Cortex_M.Debug.Halting_Debug_Enabled); function Generic_SH_Call (R0, R1 : SH_Word) return SH_Word; function Generic_SH_Call (R0 : SH_Word; R1 : System.Address) return SH_Word; --------------------- -- Generic_SH_Call -- --------------------- function Generic_SH_Call (R0, R1 : SH_Word) return SH_Word is Ret : SH_Word; begin Asm ("mov r0, %1" & ASCII.LF & ASCII.HT & "mov r1, %2" & ASCII.LF & ASCII.HT & "bkpt #0xAB" & ASCII.LF & ASCII.HT & "mov %0, r0", Outputs => (SH_Word'Asm_Output ("=r", Ret)), Inputs => (SH_Word'Asm_Input ("r", R0), SH_Word'Asm_Input ("r", R1)), Volatile => True, Clobber => ("r1, r0")); return Ret; end Generic_SH_Call; --------------------- -- Generic_SH_Call -- --------------------- function Generic_SH_Call (R0 : SH_Word; R1 : System.Address) return SH_Word is begin return Generic_SH_Call (R0, To_SH_u32 (R1)); end Generic_SH_Call; ----------- -- Close -- ----------- function Close (File_Handle : SH_Word) return SH_Word is Block : SH_u32_Array (0 .. 0); begin if not Semihosting_Enabled then -- No debugger attached return SH_Word'Last; end if; Block (0) := File_Handle; return Generic_SH_Call (SYS_CLOSE, Block'Address); end Close; ---------- -- Open -- ---------- function Open (Filename : String; Mode : Flag) return SH_Word is Block : SH_u32_Array (0 .. 2); C_Name : char_array (0 .. Filename'Length) with Volatile; begin if not Semihosting_Enabled then -- No debugger attached return SH_Word'Last; end if; for J in Filename'Range loop C_Name (size_t (J - Filename'First)) := char'Val (Character'Pos (Filename (J))); end loop; C_Name (C_Name'Last) := nul; Block (0) := To_SH_u32 (C_Name'Address); Block (1) := Mode; Block (2) := Filename'Length; return Generic_SH_Call (SYS_OPEN, Block'Address); end Open; ---------- -- Read -- ---------- function Read (File_Handle : SH_Word; Buffer_Address : System.Address; Buffer_Size : SH_Word) return SH_Word is Block : SH_u32_Array (0 .. 2); begin if not Semihosting_Enabled then -- No debugger attached return Buffer_Size; end if; Block (0) := File_Handle; Block (1) := To_SH_u32 (Buffer_Address); Block (2) := Buffer_Size; return Generic_SH_Call (SYS_READ, Block'Address); end Read; ----------- -- Write -- ----------- function Write (File_Handle : SH_Word; Buffer_Address : System.Address; Buffer_Size : SH_Word) return SH_Word is Block : SH_u32_Array (0 .. 3); begin if not Semihosting_Enabled then -- No debugger attached return Buffer_Size; end if; Block (0) := File_Handle; Block (1) := To_SH_u32 (Buffer_Address); Block (2) := Buffer_Size; return Generic_SH_Call (SYS_WRITE, Block'Address); end Write; ------------ -- Remove -- ------------ function Remove (Filename : String) return SH_Word is Block : SH_u32_Array (0 .. 1); C_Name : char_array (0 .. Filename'Length) with Volatile; begin if not Semihosting_Enabled then -- No debugger attached return SH_Word'Last; end if; for J in Filename'Range loop C_Name (size_t (J - Filename'First)) := char'Val (Character'Pos (Filename (J))); end loop; C_Name (C_Name'Last) := nul; Block (0) := To_SH_u32 (C_Name'Address); Block (1) := To_SH_u32 (Filename'Length); return Generic_SH_Call (SYS_REMOVE, Block'Address); end Remove; ---------- -- Seek -- ---------- function Seek (File_Handle : SH_Word; Absolute_Position : SH_Word) return SH_Word is Block : SH_u32_Array (0 .. 1); begin if not Semihosting_Enabled then -- No debugger attached return SH_Word'Last; end if; Block (0) := File_Handle; Block (1) := Absolute_Position; return Generic_SH_Call (SYS_SEEK, Block'Address); end Seek; ----------- -- Errno -- ----------- function Errno return SH_Word is begin return Generic_SH_Call (SYS_ERRNO, 0); end Errno; ------------- -- Write_C -- ------------- procedure Write_C (C : Character) is Ret : SH_Word with Unreferenced; begin if not Semihosting_Enabled then -- No debugger attached return; end if; Ret := Generic_SH_Call (SYS_WRITEC, C'Address); end Write_C; ------------- -- Write_0 -- ------------- procedure Write_0 (Str : String) is Data : UInt8_Array (Str'First .. Str'Last + 1); Ret : SH_Word with Unreferenced; begin if not Semihosting_Enabled then -- No debugger attached return; end if; for Index in Str'Range loop Data (Index) := Character'Pos (Str (Index)); end loop; -- Add trailing zero Data (Str'Last + 1) := 0; Ret := Generic_SH_Call (SYS_WRITE0, Data'Address); end Write_0; -------------- -- Log_Line -- -------------- procedure Log_Line (Str : String) is begin Log (Str); Log_New_Line; end Log_Line; ------------------ -- Log_New_Line -- ------------------ procedure Log_New_Line is begin Write_C (ASCII.LF); end Log_New_Line; end Semihosting;
-- -- Copyright 2018 The wookey project team <wookey@ssi.gouv.fr> -- - Ryad Benadjila -- - Arnauld Michelizza -- - Mathieu Renard -- - Philippe Thierry -- - Philippe Trebuchet -- -- Licensed under the Apache License, Version 2.0 (the "License"); -- you may not use this file except in compliance with the License. -- You may obtain a copy of the License at -- -- http://www.apache.org/licenses/LICENSE-2.0 -- -- Unless required by applicable law or agreed to in writing, software -- distributed under the License is distributed on an "AS IS" BASIS, -- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -- See the License for the specific language governing permissions and -- limitations under the License. -- -- with applications; use applications; with ewok.exported.sleep; use ewok.exported.sleep; with m4.systick; package ewok.sleep with spark_mode => off is type t_sleep_info is record sleep_until : m4.systick.t_tick; interruptible : boolean; end record; sleep_info : array (t_real_task_id'range) of t_sleep_info := (others => (0, false)); -- -- \brief declare a time to sleep. -- -- This function is called in a syscall context and make the task -- unschedulable for at least the given sleep_until. Only external events -- (ISR, IPC) can awake the task during this period. If no external events -- happend, the task is marked as schedulable at the end of the sleep -- period, which means that the task is schedule *after* the sleep time, -- not exactly at the sleep time end. -- The variation of the time to wait between the end of the sleep time and -- the effective time execution depends on the scheduling policy, the task -- priority and the number of tasks on the system. -- -- \param id -- --e task id requesting to sleep -- \param sleep_until the sleep duration in unit given by unit argument -- \param mode -- sleep mode (preemptible by ISR or IPC, or not) -- procedure sleeping (task_id : in t_real_task_id; ms : in milliseconds; mode : in t_sleep_mode) with global => (Output => sleep_info); -- -- This function is called at each sched time of the systick handler, to -- decrement the sleep_until of each task of 1. -- If the speeptime reaches 0, the task mainthread is awoken. -- -- WARNING: there is case where the task is awoken *before* the end of -- its sleep period: -- - when an ISR arise -- - when an IPC targeting the task is pushed -- -- In theses two cases, the sleep_cancel() function must be called in order -- to cancel the current sleep round. The task is awoken by the corresponding -- kernel module instead. -- procedure check_is_awoke with global => (In_Out => sleep_info); -- -- As explain in sleep_round function explanations, some external events -- may awake the main thread. In that case, the sleep process must be -- canceled as the awoking process is made by another module. -- tasks that have requested locked sleep will continue to sleep -- procedure try_waking_up (task_id : in t_real_task_id) with global => (In_Out => sleep_info); -- -- \brief check if a task is currently sleeping -- -- \param id the task id to check -- -- return true if a task is sleeping, or false -- function is_sleeping (task_id : in t_real_task_id) return boolean with global => (Input => sleep_info); end ewok.sleep;
-- { dg-do compile } procedure Warn7 is procedure Nested; pragma No_Return (Nested); procedure Nested is begin raise Constraint_Error; exception when Constraint_Error => raise; end; begin Nested; end;
-- SPDX-License-Identifier: Apache-2.0 -- -- Copyright (c) 2019 onox <denkpadje@gmail.com> -- -- Licensed under the Apache License, Version 2.0 (the "License"); -- you may not use this file except in compliance with the License. -- You may obtain a copy of the License at -- -- http://www.apache.org/licenses/LICENSE-2.0 -- -- Unless required by applicable law or agreed to in writing, software -- distributed under the License is distributed on an "AS IS" BASIS, -- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -- See the License for the specific language governing permissions and -- limitations under the License. package body Orka.Inputs.Joysticks.Gamepads is function Value (Index : Button_Index) return Button is (Button'Val (Index - Button_Index'First)); function Value (Index : Axis_Index) return Axis is (Axis'Val (Index - Axis_Index'First)); function Index (Value : Button) return Button_Index is (Button_Index'First + Button'Pos (Value)); function Index (Value : Axis) return Axis_Index is (Axis_Index'First + Axis'Pos (Value)); procedure Normalize_Axes (Axes : in out Axis_Positions) is begin -- Let vertical axis go from down to up Axes (2) := -1.0 * Axes (Index (Left_Stick_Y)); Axes (4) := -1.0 * Axes (Index (Right_Stick_Y)); -- Map -1 .. 1 to 0 .. 1 for triggers Axes (5) := (Axes (Index (Left_Trigger)) + 1.0) / 2.0; Axes (6) := (Axes (Index (Right_Trigger)) + 1.0) / 2.0; end Normalize_Axes; end Orka.Inputs.Joysticks.Gamepads;
------------------------------------------------------------------------------ -- -- -- GNAT COMPILER COMPONENTS -- -- -- -- E X P _ P R A G -- -- -- -- B o d y -- -- -- -- $Revision$ -- -- -- Copyright (C) 1992-2001 Free Software Foundation, Inc. -- -- -- -- GNAT is free software; you can redistribute it and/or modify it under -- -- terms of the GNU General Public License as published by the Free Soft- -- -- ware Foundation; either version 2, or (at your option) any later ver- -- -- sion. GNAT is distributed in the hope that it will be useful, but WITH- -- -- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY -- -- or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -- -- for more details. You should have received a copy of the GNU General -- -- Public License distributed with GNAT; see file COPYING. If not, write -- -- to the Free Software Foundation, 59 Temple Place - Suite 330, Boston, -- -- MA 02111-1307, USA. -- -- -- -- 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 Casing; use Casing; with Einfo; use Einfo; with Errout; use Errout; with Exp_Ch11; use Exp_Ch11; with Exp_Tss; use Exp_Tss; with Exp_Util; use Exp_Util; with Expander; use Expander; with Namet; use Namet; with Nlists; use Nlists; with Nmake; use Nmake; with Opt; use Opt; with Rtsfind; use Rtsfind; with Sem; use Sem; with Sem_Eval; use Sem_Eval; with Sem_Res; use Sem_Res; with Sem_Util; use Sem_Util; with Sinfo; use Sinfo; with Sinput; use Sinput; with Snames; use Snames; with Stringt; use Stringt; with Stand; use Stand; with Tbuild; use Tbuild; with Uintp; use Uintp; package body Exp_Prag is ----------------------- -- Local Subprograms -- ----------------------- function Arg1 (N : Node_Id) return Node_Id; function Arg2 (N : Node_Id) return Node_Id; function Arg3 (N : Node_Id) return Node_Id; -- Obtain specified Pragma_Argument_Association procedure Expand_Pragma_Abort_Defer (N : Node_Id); procedure Expand_Pragma_Assert (N : Node_Id); procedure Expand_Pragma_Import (N : Node_Id); procedure Expand_Pragma_Import_Export_Exception (N : Node_Id); procedure Expand_Pragma_Inspection_Point (N : Node_Id); procedure Expand_Pragma_Interrupt_Priority (N : Node_Id); -------------- -- Arg1,2,3 -- -------------- function Arg1 (N : Node_Id) return Node_Id is begin return First (Pragma_Argument_Associations (N)); end Arg1; function Arg2 (N : Node_Id) return Node_Id is begin return Next (Arg1 (N)); end Arg2; function Arg3 (N : Node_Id) return Node_Id is begin return Next (Arg2 (N)); end Arg3; --------------------- -- Expand_N_Pragma -- --------------------- procedure Expand_N_Pragma (N : Node_Id) is begin -- Note: we may have a pragma whose chars field is not a -- recognized pragma, and we must ignore it at this stage. if Is_Pragma_Name (Chars (N)) then case Get_Pragma_Id (Chars (N)) is -- Pragmas requiring special expander action when Pragma_Abort_Defer => Expand_Pragma_Abort_Defer (N); when Pragma_Assert => Expand_Pragma_Assert (N); when Pragma_Export_Exception => Expand_Pragma_Import_Export_Exception (N); when Pragma_Import => Expand_Pragma_Import (N); when Pragma_Import_Exception => Expand_Pragma_Import_Export_Exception (N); when Pragma_Inspection_Point => Expand_Pragma_Inspection_Point (N); when Pragma_Interrupt_Priority => Expand_Pragma_Interrupt_Priority (N); -- All other pragmas need no expander action when others => null; end case; end if; end Expand_N_Pragma; ------------------------------- -- Expand_Pragma_Abort_Defer -- ------------------------------- -- An Abort_Defer pragma appears as the first statement in a handled -- statement sequence (right after the begin). It defers aborts for -- the entire statement sequence, but not for any declarations or -- handlers (if any) associated with this statement sequence. -- The transformation is to transform -- pragma Abort_Defer; -- statements; -- into -- begin -- Abort_Defer.all; -- statements -- exception -- when all others => -- Abort_Undefer.all; -- raise; -- at end -- Abort_Undefer_Direct; -- end; procedure Expand_Pragma_Abort_Defer (N : Node_Id) is Loc : constant Source_Ptr := Sloc (N); Stm : Node_Id; Stms : List_Id; HSS : Node_Id; Blk : constant Entity_Id := New_Internal_Entity (E_Block, Current_Scope, Sloc (N), 'B'); begin Stms := New_List (Build_Runtime_Call (Loc, RE_Abort_Defer)); loop Stm := Remove_Next (N); exit when No (Stm); Append (Stm, Stms); end loop; HSS := Make_Handled_Sequence_Of_Statements (Loc, Statements => Stms, At_End_Proc => New_Occurrence_Of (RTE (RE_Abort_Undefer_Direct), Loc)); Rewrite (N, Make_Block_Statement (Loc, Handled_Statement_Sequence => HSS)); Set_Scope (Blk, Current_Scope); Set_Etype (Blk, Standard_Void_Type); Set_Identifier (N, New_Occurrence_Of (Blk, Sloc (N))); Expand_At_End_Handler (HSS, Blk); Analyze (N); end Expand_Pragma_Abort_Defer; -------------------------- -- Expand_Pragma_Assert -- -------------------------- procedure Expand_Pragma_Assert (N : Node_Id) is Loc : constant Source_Ptr := Sloc (N); Cond : constant Node_Id := Expression (Arg1 (N)); Msg : String_Id; begin -- We already know that assertions are enabled, because otherwise -- the semantic pass dealt with rewriting the assertion (see Sem_Prag) pragma Assert (Assertions_Enabled); -- Since assertions are on, we rewrite the pragma with its -- corresponding if statement, and then analyze the statement -- The expansion transforms: -- pragma Assert (condition [,message]); -- into -- if not condition then -- System.Assertions.Raise_Assert_Failure (Str); -- end if; -- where Str is the message if one is present, or the default of -- file:line if no message is given. -- First, we need to prepare the character literal if Present (Arg2 (N)) then Msg := Strval (Expr_Value_S (Expression (Arg2 (N)))); else Build_Location_String (Loc); Msg := String_From_Name_Buffer; end if; -- Now generate the if statement. Note that we consider this to be -- an explicit conditional in the source, not an implicit if, so we -- do not call Make_Implicit_If_Statement. Rewrite (N, Make_If_Statement (Loc, Condition => Make_Op_Not (Loc, Right_Opnd => Cond), Then_Statements => New_List ( Make_Procedure_Call_Statement (Loc, Name => New_Reference_To (RTE (RE_Raise_Assert_Failure), Loc), Parameter_Associations => New_List ( Make_String_Literal (Loc, Msg)))))); Analyze (N); -- If new condition is always false, give a warning if Nkind (N) = N_Procedure_Call_Statement and then Is_RTE (Entity (Name (N)), RE_Raise_Assert_Failure) then -- If original condition was a Standard.False, we assume -- that this is indeed intented to raise assert error -- and no warning is required. if Is_Entity_Name (Original_Node (Cond)) and then Entity (Original_Node (Cond)) = Standard_False then return; else Error_Msg_N ("?assertion will fail at run-time", N); end if; end if; end Expand_Pragma_Assert; -------------------------- -- Expand_Pragma_Import -- -------------------------- -- When applied to a variable, the default initialization must not be -- done. As it is already done when the pragma is found, we just get rid -- of the call the initialization procedure which followed the object -- declaration. -- We can't use the freezing mechanism for this purpose, since we -- have to elaborate the initialization expression when it is first -- seen (i.e. this elaboration cannot be deferred to the freeze point). procedure Expand_Pragma_Import (N : Node_Id) is Def_Id : constant Entity_Id := Entity (Expression (Arg2 (N))); Typ : Entity_Id; After_Def : Node_Id; begin if Ekind (Def_Id) = E_Variable then Typ := Etype (Def_Id); After_Def := Next (Parent (Def_Id)); if Has_Non_Null_Base_Init_Proc (Typ) and then Nkind (After_Def) = N_Procedure_Call_Statement and then Is_Entity_Name (Name (After_Def)) and then Entity (Name (After_Def)) = Base_Init_Proc (Typ) then Remove (After_Def); elsif Is_Access_Type (Typ) then Set_Expression (Parent (Def_Id), Empty); end if; end if; end Expand_Pragma_Import; ------------------------------------------- -- Expand_Pragma_Import_Export_Exception -- ------------------------------------------- -- For a VMS exception fix up the language field with "VMS" -- instead of "Ada" (gigi needs this), create a constant that will be the -- value of the VMS condition code and stuff the Interface_Name field -- with the unexpanded name of the exception (if not already set). -- For a Ada exception, just stuff the Interface_Name field -- with the unexpanded name of the exception (if not already set). procedure Expand_Pragma_Import_Export_Exception (N : Node_Id) is Id : constant Entity_Id := Entity (Expression (Arg1 (N))); Call : constant Node_Id := Register_Exception_Call (Id); Loc : constant Source_Ptr := Sloc (N); begin if Present (Call) then declare Excep_Internal : constant Node_Id := Make_Defining_Identifier (Loc, New_Internal_Name ('V')); Export_Pragma : Node_Id; Excep_Alias : Node_Id; Excep_Object : Node_Id; Excep_Image : String_Id; Exdata : List_Id; Lang1 : Node_Id; Lang2 : Node_Id; Lang3 : Node_Id; Code : Node_Id; begin if Present (Interface_Name (Id)) then Excep_Image := Strval (Interface_Name (Id)); else Get_Name_String (Chars (Id)); Set_All_Upper_Case; Excep_Image := String_From_Name_Buffer; end if; Exdata := Component_Associations (Expression (Parent (Id))); if Is_VMS_Exception (Id) then Lang1 := Next (First (Exdata)); Lang2 := Next (Lang1); Lang3 := Next (Lang2); Rewrite (Expression (Lang1), Make_Character_Literal (Loc, Name_uV, Get_Char_Code ('V'))); Analyze (Expression (Lang1)); Rewrite (Expression (Lang2), Make_Character_Literal (Loc, Name_uM, Get_Char_Code ('M'))); Analyze (Expression (Lang2)); Rewrite (Expression (Lang3), Make_Character_Literal (Loc, Name_uS, Get_Char_Code ('S'))); Analyze (Expression (Lang3)); if Exception_Code (Id) /= No_Uint then Code := Make_Integer_Literal (Loc, Exception_Code (Id)); Excep_Object := Make_Object_Declaration (Loc, Defining_Identifier => Excep_Internal, Object_Definition => New_Reference_To (Standard_Integer, Loc)); Insert_Action (N, Excep_Object); Analyze (Excep_Object); Start_String; Store_String_Int (UI_To_Int (Exception_Code (Id)) / 8 * 8); Excep_Alias := Make_Pragma (Loc, Name_Linker_Alias, New_List (Make_Pragma_Argument_Association (Sloc => Loc, Expression => New_Reference_To (Excep_Internal, Loc)), Make_Pragma_Argument_Association (Sloc => Loc, Expression => Make_String_Literal (Sloc => Loc, Strval => End_String)))); Insert_Action (N, Excep_Alias); Analyze (Excep_Alias); Export_Pragma := Make_Pragma (Loc, Name_Export, New_List (Make_Pragma_Argument_Association (Sloc => Loc, Expression => Make_Identifier (Loc, Name_C)), Make_Pragma_Argument_Association (Sloc => Loc, Expression => New_Reference_To (Excep_Internal, Loc)), Make_Pragma_Argument_Association (Sloc => Loc, Expression => Make_String_Literal (Sloc => Loc, Strval => Excep_Image)), Make_Pragma_Argument_Association (Sloc => Loc, Expression => Make_String_Literal (Sloc => Loc, Strval => Excep_Image)))); Insert_Action (N, Export_Pragma); Analyze (Export_Pragma); else Code := Unchecked_Convert_To (Standard_Integer, Make_Function_Call (Loc, Name => New_Reference_To (RTE (RE_Import_Value), Loc), Parameter_Associations => New_List (Make_String_Literal (Loc, Strval => Excep_Image)))); end if; Rewrite (Call, Make_Procedure_Call_Statement (Loc, Name => New_Reference_To (RTE (RE_Register_VMS_Exception), Loc), Parameter_Associations => New_List (Code))); Analyze_And_Resolve (Code, Standard_Integer); Analyze (Call); end if; if not Present (Interface_Name (Id)) then Set_Interface_Name (Id, Make_String_Literal (Sloc => Loc, Strval => Excep_Image)); end if; end; end if; end Expand_Pragma_Import_Export_Exception; ------------------------------------ -- Expand_Pragma_Inspection_Point -- ------------------------------------ -- If no argument is given, then we supply a default argument list that -- includes all objects declared at the source level in all subprograms -- that enclose the inspection point pragma. procedure Expand_Pragma_Inspection_Point (N : Node_Id) is Loc : constant Source_Ptr := Sloc (N); A : List_Id; Assoc : Node_Id; S : Entity_Id; E : Entity_Id; begin if No (Pragma_Argument_Associations (N)) then A := New_List; S := Current_Scope; while S /= Standard_Standard loop E := First_Entity (S); while Present (E) loop if Comes_From_Source (E) and then Is_Object (E) and then not Is_Entry_Formal (E) and then Ekind (E) /= E_Component and then Ekind (E) /= E_Discriminant and then Ekind (E) /= E_Generic_In_Parameter and then Ekind (E) /= E_Generic_In_Out_Parameter then Append_To (A, Make_Pragma_Argument_Association (Loc, Expression => New_Occurrence_Of (E, Loc))); end if; Next_Entity (E); end loop; S := Scope (S); end loop; Set_Pragma_Argument_Associations (N, A); end if; -- Expand the arguments of the pragma. Expanding an entity reference -- is a noop, except in a protected operation, where a reference may -- have to be transformed into a reference to the corresponding prival. -- Are there other pragmas that may require this ??? Assoc := First (Pragma_Argument_Associations (N)); while Present (Assoc) loop Expand (Expression (Assoc)); Next (Assoc); end loop; end Expand_Pragma_Inspection_Point; -------------------------------------- -- Expand_Pragma_Interrupt_Priority -- -------------------------------------- -- Supply default argument if none exists (System.Interrupt_Priority'Last) procedure Expand_Pragma_Interrupt_Priority (N : Node_Id) is Loc : constant Source_Ptr := Sloc (N); begin if No (Pragma_Argument_Associations (N)) then Set_Pragma_Argument_Associations (N, New_List ( Make_Pragma_Argument_Association (Loc, Expression => Make_Attribute_Reference (Loc, Prefix => New_Occurrence_Of (RTE (RE_Interrupt_Priority), Loc), Attribute_Name => Name_Last)))); end if; end Expand_Pragma_Interrupt_Priority; end Exp_Prag;
----------------------------------------------------------------------- -- gen-model-mappings -- Type mappings for Code Generator -- Copyright (C) 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 Util.Log.Loggers; -- The <b>Gen.Model.Mappings</b> package controls the mappings to convert an XML -- type into the Ada type. package body Gen.Model.Mappings is use Ada.Strings.Unbounded; use Util.Log; Log : constant Loggers.Logger := Loggers.Create ("Gen.Model.Mappings"); Types : Mapping_Maps.Map; Mapping_Name : Unbounded_String; -- ------------------------------ -- Mapping Definition -- ------------------------------ -- Get the value identified by the name. -- If the name cannot be found, the method should return the Null object. -- ------------------------------ overriding function Get_Value (From : in Mapping_Definition; Name : in String) return Util.Beans.Objects.Object is begin if Name = "name" then return Util.Beans.Objects.To_Object (From.Target); elsif Name = "isBoolean" then return Util.Beans.Objects.To_Object (From.Kind = T_BOOLEAN); elsif Name = "isInteger" then return Util.Beans.Objects.To_Object (From.Kind = T_INTEGER); elsif Name = "isString" then return Util.Beans.Objects.To_Object (From.Kind = T_STRING); elsif Name = "isIdentifier" then return Util.Beans.Objects.To_Object (From.Kind = T_IDENTIFIER); elsif Name = "isDate" then return Util.Beans.Objects.To_Object (From.Kind = T_DATE); elsif Name = "isBlob" then return Util.Beans.Objects.To_Object (From.Kind = T_BLOB); elsif Name = "isEnum" then return Util.Beans.Objects.To_Object (From.Kind = T_ENUM); elsif Name = "isPrimitiveType" then return Util.Beans.Objects.To_Object (From.Kind /= T_TABLE and From.Kind /= T_BLOB); else return Definition (From).Get_Value (Name); end if; end Get_Value; -- ------------------------------ -- Find the mapping for the given type name. -- ------------------------------ function Find_Type (Name : in Ada.Strings.Unbounded.Unbounded_String) return Mapping_Definition_Access is Pos : constant Mapping_Maps.Cursor := Types.Find (Mapping_Name & Name); begin if Mapping_Maps.Has_Element (Pos) then return Mapping_Maps.Element (Pos); else Log.Info ("Type '{0}' not found in mapping table '{1}'", To_String (Name), To_String (Mapping_Name)); return null; end if; end Find_Type; procedure Register_Type (Name : in String; Mapping : in Mapping_Definition_Access; Kind : in Basic_Type) is N : constant Unbounded_String := Mapping_Name & To_Unbounded_String (Name); Pos : constant Mapping_Maps.Cursor := Types.Find (N); begin Log.Debug ("Register type '{0}'", Name); if not Mapping_Maps.Has_Element (Pos) then Mapping.Kind := Kind; Types.Insert (N, Mapping); end if; end Register_Type; -- ------------------------------ -- Register a type mapping <b>From</b> that is mapped to <b>Target</b>. -- ------------------------------ procedure Register_Type (Target : in String; From : in String; Kind : in Basic_Type) is Name : constant Unbounded_String := Mapping_Name & To_Unbounded_String (From); Pos : constant Mapping_Maps.Cursor := Types.Find (Name); Mapping : Mapping_Definition_Access; begin Log.Debug ("Register type '{0}' mapped to '{1}' type {2}", From, Target, Basic_Type'Image (Kind)); if Mapping_Maps.Has_Element (Pos) then Mapping := Mapping_Maps.Element (Pos); else Mapping := new Mapping_Definition; Types.Insert (Name, Mapping); end if; Mapping.Target := To_Unbounded_String (Target); Mapping.Kind := Kind; end Register_Type; -- ------------------------------ -- Setup the type mapping for the language identified by the given name. -- ------------------------------ procedure Set_Mapping_Name (Name : in String) is begin Log.Info ("Using type mapping {0}", Name); Mapping_Name := To_Unbounded_String (Name & "."); end Set_Mapping_Name; end Gen.Model.Mappings;
with Ada.Text_IO; procedure Missing_Permutations is subtype Permutation_Character is Character range 'A' .. 'D'; Character_Count : constant := 1 + Permutation_Character'Pos (Permutation_Character'Last) - Permutation_Character'Pos (Permutation_Character'First); type Permutation_String is array (1 .. Character_Count) of Permutation_Character; procedure Put (Item : Permutation_String) is begin for I in Item'Range loop Ada.Text_IO.Put (Item (I)); end loop; end Put; Given_Permutations : array (Positive range <>) of Permutation_String := ("ABCD", "CABD", "ACDB", "DACB", "BCDA", "ACBD", "ADCB", "CDAB", "DABC", "BCAD", "CADB", "CDBA", "CBAD", "ABDC", "ADBC", "BDCA", "DCBA", "BACD", "BADC", "BDAC", "CBDA", "DBCA", "DCAB"); Count : array (Permutation_Character, 1 .. Character_Count) of Natural := (others => (others => 0)); Max_Count : Positive := 1; Missing_Permutation : Permutation_String; begin for I in Given_Permutations'Range loop for Pos in 1 .. Character_Count loop Count (Given_Permutations (I) (Pos), Pos) := Count (Given_Permutations (I) (Pos), Pos) + 1; if Count (Given_Permutations (I) (Pos), Pos) > Max_Count then Max_Count := Count (Given_Permutations (I) (Pos), Pos); end if; end loop; end loop; for Char in Permutation_Character loop for Pos in 1 .. Character_Count loop if Count (Char, Pos) < Max_Count then Missing_Permutation (Pos) := Char; end if; end loop; end loop; Ada.Text_IO.Put_Line ("Missing Permutation:"); Put (Missing_Permutation); end Missing_Permutations;
-------------------------------------------------------------------------------------------------------------------- -- Copyright (c) 2013-2020, Luke A. Guest -- -- This software is provided 'as-is', without any express or implied -- warranty. In no event will the authors be held liable for any damages -- arising from the use of this software. -- -- Permission is granted to anyone to use this software for any purpose, -- including commercial applications, and to alter it and redistribute it -- freely, subject to the following restrictions: -- -- 1. The origin of this software must not be misrepresented; you must not -- claim that you wrote the original software. If you use this software -- in a product, an acknowledgment in the product documentation would be -- appreciated but is not required. -- -- 2. Altered source versions must be plainly marked as such, and must not be -- misrepresented as being the original software. -- -- 3. This notice may not be removed or altered from any source -- distribution. -------------------------------------------------------------------------------------------------------------------- with SDL.Error; with SDL.Video; package body SDL.Video.Displays is use type C.int; function Total return Display_Indices is -- This function returns a value >= 1, use this as a new lower type bound. function SDL_Get_Num_Video_Displays return C.int with Import => True, Convention => C, External_Name => "SDL_GetNumVideoDisplays"; Num : constant C.int := SDL_Get_Num_Video_Displays; begin if Num <= 0 then raise Video_Error with SDL.Error.Get; end if; return Display_Indices (Num); end Total; function Closest_Mode (Display : in Display_Indices; Wanted : in Mode; Target : out Mode) return Boolean is function SDL_Get_Closest_Display_Mode (D : C.int; W : in Mode; T : out Mode) return Access_Mode with Import => True, Convention => C, External_Name => "SDL_GetClosestDisplayMode"; Result : Access_Mode := SDL_Get_Closest_Display_Mode (C.int (Display - 1), Wanted, Target); begin return (Result = null); end Closest_Mode; function Current_Mode (Display : in Display_Indices; Target : out Mode) return Boolean is function SDL_Get_Current_Display_Mode (D : C.int; M : out Mode) return C.int with Import => True, Convention => C, External_Name => "SDL_GetCurrentDisplayMode"; Result : C.int := SDL_Get_Current_Display_Mode (C.int (Display - 1), Target); begin return (Result = Success); end Current_Mode; function Desktop_Mode (Display : in Display_Indices; Target : out Mode) return Boolean is function SDL_Get_Desktop_Display_Mode (D : C.int; M : out Mode) return C.int with Import => True, Convention => C, External_Name => "SDL_GetDesktopDisplayMode"; Result : C.int := SDL_Get_Desktop_Display_Mode (C.int (Display - 1), Target); begin return (Result = Success); end Desktop_Mode; function Display_Mode (Display : in Display_Indices; Index : in Natural; Target : out Mode) return Boolean is function SDL_Get_Display_Mode (D : in C.int; I : in C.int; T : out Mode) return C.int with Import => True, Convention => C, External_Name => "SDL_GetDisplayMode"; Result : C.int := SDL_Get_Display_Mode (C.int (Display - 1), C.int (Index), Target); begin return (Result = Success); end Display_Mode; function Total_Display_Modes (Display : in Display_Indices; Total : out Positive) return Boolean is function SDL_Get_Num_Display_Modes (I : in C.int) return C.int with Import => True, Convention => C, External_Name => "SDL_GetNumDisplayModes"; Result : C.int := SDL_Get_Num_Display_Modes (C.int (Display - 1)); begin if Result >= 1 then Total := Positive (Result); return True; end if; return False; end Total_Display_Modes; function Display_Bounds (Display : in Display_Indices; Bounds : out Rectangles.Rectangle) return Boolean is function SDL_Get_Display_Bounds (D : in C.int; B : out Rectangles.Rectangle) return C.int with Import => True, Convention => C, External_Name => "SDL_GetDisplayBounds"; Result : C.int := SDL_Get_Display_Bounds (C.int (Display - 1), Bounds); begin return (Result = Success); end Display_Bounds; end SDL.Video.Displays;
------------------------------------------------------------------------------ -- -- -- GNAT COMPILER COMPONENTS -- -- -- -- E X P _ C H 5 -- -- -- -- B o d y -- -- -- -- Copyright (C) 1992-2016, Free Software Foundation, Inc. -- -- -- -- GNAT is free software; you can redistribute it and/or modify it under -- -- terms of the GNU General Public License as published by the Free Soft- -- -- ware Foundation; either version 3, or (at your option) any later ver- -- -- sion. GNAT is distributed in the hope that it will be useful, but WITH- -- -- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY -- -- or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -- -- for more details. You should have received a copy of the GNU General -- -- Public License distributed with GNAT; see file COPYING3. If not, go to -- -- http://www.gnu.org/licenses for a complete copy of the license. -- -- -- -- GNAT was originally developed by the GNAT team at New York University. -- -- Extensive contributions were provided by Ada Core Technologies Inc. -- -- -- ------------------------------------------------------------------------------ with Aspects; use Aspects; with Atree; use Atree; with Checks; use Checks; with Debug; use Debug; with Einfo; use Einfo; with Elists; use Elists; with Errout; use Errout; with Exp_Aggr; use Exp_Aggr; with Exp_Ch6; use Exp_Ch6; with Exp_Ch7; use Exp_Ch7; with Exp_Ch11; use Exp_Ch11; with Exp_Dbug; use Exp_Dbug; with Exp_Pakd; use Exp_Pakd; with Exp_Tss; use Exp_Tss; with Exp_Util; use Exp_Util; with Inline; use Inline; with Namet; use Namet; with Nlists; use Nlists; with Nmake; use Nmake; with Opt; use Opt; with Restrict; use Restrict; with Rident; use Rident; with Rtsfind; use Rtsfind; with Sinfo; use Sinfo; with Sem; use Sem; with Sem_Aux; use Sem_Aux; with Sem_Ch3; use Sem_Ch3; with Sem_Ch8; use Sem_Ch8; with Sem_Ch13; use Sem_Ch13; with Sem_Eval; use Sem_Eval; with Sem_Res; use Sem_Res; with Sem_Util; use Sem_Util; with Snames; use Snames; with Stand; use Stand; with Stringt; use Stringt; with Tbuild; use Tbuild; with Uintp; use Uintp; with Validsw; use Validsw; package body Exp_Ch5 is procedure Build_Formal_Container_Iteration (N : Node_Id; Container : Entity_Id; Cursor : Entity_Id; Init : out Node_Id; Advance : out Node_Id; New_Loop : out Node_Id); -- Utility to create declarations and loop statement for both forms -- of formal container iterators. function Change_Of_Representation (N : Node_Id) return Boolean; -- Determine if the right-hand side of assignment N is a type conversion -- which requires a change of representation. Called only for the array -- and record cases. procedure Expand_Assign_Array (N : Node_Id; Rhs : Node_Id); -- N is an assignment which assigns an array value. This routine process -- the various special cases and checks required for such assignments, -- including change of representation. Rhs is normally simply the right- -- hand side of the assignment, except that if the right-hand side is a -- type conversion or a qualified expression, then the RHS is the actual -- expression inside any such type conversions or qualifications. function Expand_Assign_Array_Loop (N : Node_Id; Larray : Entity_Id; Rarray : Entity_Id; L_Type : Entity_Id; R_Type : Entity_Id; Ndim : Pos; Rev : Boolean) return Node_Id; -- N is an assignment statement which assigns an array value. This routine -- expands the assignment into a loop (or nested loops for the case of a -- multi-dimensional array) to do the assignment component by component. -- Larray and Rarray are the entities of the actual arrays on the left-hand -- and right-hand sides. L_Type and R_Type are the types of these arrays -- (which may not be the same, due to either sliding, or to a change of -- representation case). Ndim is the number of dimensions and the parameter -- Rev indicates if the loops run normally (Rev = False), or reversed -- (Rev = True). The value returned is the constructed loop statement. -- Auxiliary declarations are inserted before node N using the standard -- Insert_Actions mechanism. procedure Expand_Assign_Record (N : Node_Id); -- N is an assignment of an untagged record value. This routine handles -- the case where the assignment must be made component by component, -- either because the target is not byte aligned, or there is a change -- of representation, or when we have a tagged type with a representation -- clause (this last case is required because holes in the tagged type -- might be filled with components from child types). procedure Expand_Assign_With_Target_Names (N : Node_Id); -- (AI12-0125): N is an assignment statement whose RHS contains occurrences -- of @ that designate the value of the LHS of the assignment. If the LHS -- is side-effect free the target names can be replaced with a copy of the -- LHS; otherwise the semantics of the assignment is described in terms of -- a procedure with an in-out parameter, and expanded as such. procedure Expand_Formal_Container_Loop (N : Node_Id); -- Use the primitives specified in an Iterable aspect to expand a loop -- over a so-called formal container, primarily for SPARK usage. procedure Expand_Formal_Container_Element_Loop (N : Node_Id); -- Same, for an iterator of the form " For E of C". In this case the -- iterator provides the name of the element, and the cursor is generated -- internally. procedure Expand_Iterator_Loop (N : Node_Id); -- Expand loop over arrays and containers that uses the form "for X of C" -- with an optional subtype mark, or "for Y in C". procedure Expand_Iterator_Loop_Over_Container (N : Node_Id; Isc : Node_Id; I_Spec : Node_Id; Container : Node_Id; Container_Typ : Entity_Id); -- Expand loop over containers that uses the form "for X of C" with an -- optional subtype mark, or "for Y in C". Isc is the iteration scheme. -- I_Spec is the iterator specification and Container is either the -- Container (for OF) or the iterator (for IN). procedure Expand_Predicated_Loop (N : Node_Id); -- Expand for loop over predicated subtype function Make_Tag_Ctrl_Assignment (N : Node_Id) return List_Id; -- Generate the necessary code for controlled and tagged assignment, that -- is to say, finalization of the target before, adjustment of the target -- after and save and restore of the tag and finalization pointers which -- are not 'part of the value' and must not be changed upon assignment. N -- is the original Assignment node. -------------------------------------- -- Build_Formal_Container_iteration -- -------------------------------------- procedure Build_Formal_Container_Iteration (N : Node_Id; Container : Entity_Id; Cursor : Entity_Id; Init : out Node_Id; Advance : out Node_Id; New_Loop : out Node_Id) is Loc : constant Source_Ptr := Sloc (N); Stats : constant List_Id := Statements (N); Typ : constant Entity_Id := Base_Type (Etype (Container)); First_Op : constant Entity_Id := Get_Iterable_Type_Primitive (Typ, Name_First); Next_Op : constant Entity_Id := Get_Iterable_Type_Primitive (Typ, Name_Next); Has_Element_Op : constant Entity_Id := Get_Iterable_Type_Primitive (Typ, Name_Has_Element); begin -- Declaration for Cursor Init := Make_Object_Declaration (Loc, Defining_Identifier => Cursor, Object_Definition => New_Occurrence_Of (Etype (First_Op), Loc), Expression => Make_Function_Call (Loc, Name => New_Occurrence_Of (First_Op, Loc), Parameter_Associations => New_List ( New_Occurrence_Of (Container, Loc)))); -- Statement that advances cursor in loop Advance := Make_Assignment_Statement (Loc, Name => New_Occurrence_Of (Cursor, Loc), Expression => Make_Function_Call (Loc, Name => New_Occurrence_Of (Next_Op, Loc), Parameter_Associations => New_List ( New_Occurrence_Of (Container, Loc), New_Occurrence_Of (Cursor, Loc)))); -- Iterator is rewritten as a while_loop New_Loop := Make_Loop_Statement (Loc, Iteration_Scheme => Make_Iteration_Scheme (Loc, Condition => Make_Function_Call (Loc, Name => New_Occurrence_Of (Has_Element_Op, Loc), Parameter_Associations => New_List ( New_Occurrence_Of (Container, Loc), New_Occurrence_Of (Cursor, Loc)))), Statements => Stats, End_Label => Empty); end Build_Formal_Container_Iteration; ------------------------------ -- Change_Of_Representation -- ------------------------------ function Change_Of_Representation (N : Node_Id) return Boolean is Rhs : constant Node_Id := Expression (N); begin return Nkind (Rhs) = N_Type_Conversion and then not Same_Representation (Etype (Rhs), Etype (Expression (Rhs))); end Change_Of_Representation; ------------------------- -- Expand_Assign_Array -- ------------------------- -- There are two issues here. First, do we let Gigi do a block move, or -- do we expand out into a loop? Second, we need to set the two flags -- Forwards_OK and Backwards_OK which show whether the block move (or -- corresponding loops) can be legitimately done in a forwards (low to -- high) or backwards (high to low) manner. procedure Expand_Assign_Array (N : Node_Id; Rhs : Node_Id) is Loc : constant Source_Ptr := Sloc (N); Lhs : constant Node_Id := Name (N); Act_Lhs : constant Node_Id := Get_Referenced_Object (Lhs); Act_Rhs : Node_Id := Get_Referenced_Object (Rhs); L_Type : constant Entity_Id := Underlying_Type (Get_Actual_Subtype (Act_Lhs)); R_Type : Entity_Id := Underlying_Type (Get_Actual_Subtype (Act_Rhs)); L_Slice : constant Boolean := Nkind (Act_Lhs) = N_Slice; R_Slice : constant Boolean := Nkind (Act_Rhs) = N_Slice; Crep : constant Boolean := Change_Of_Representation (N); Larray : Node_Id; Rarray : Node_Id; Ndim : constant Pos := Number_Dimensions (L_Type); Loop_Required : Boolean := False; -- This switch is set to True if the array move must be done using -- an explicit front end generated loop. procedure Apply_Dereference (Arg : Node_Id); -- If the argument is an access to an array, and the assignment is -- converted into a procedure call, apply explicit dereference. function Has_Address_Clause (Exp : Node_Id) return Boolean; -- Test if Exp is a reference to an array whose declaration has -- an address clause, or it is a slice of such an array. function Is_Formal_Array (Exp : Node_Id) return Boolean; -- Test if Exp is a reference to an array which is either a formal -- parameter or a slice of a formal parameter. These are the cases -- where hidden aliasing can occur. function Is_Non_Local_Array (Exp : Node_Id) return Boolean; -- Determine if Exp is a reference to an array variable which is other -- than an object defined in the current scope, or a component or a -- slice of such an object. Such objects can be aliased to parameters -- (unlike local array references). ----------------------- -- Apply_Dereference -- ----------------------- procedure Apply_Dereference (Arg : Node_Id) is Typ : constant Entity_Id := Etype (Arg); begin if Is_Access_Type (Typ) then Rewrite (Arg, Make_Explicit_Dereference (Loc, Prefix => Relocate_Node (Arg))); Analyze_And_Resolve (Arg, Designated_Type (Typ)); end if; end Apply_Dereference; ------------------------ -- Has_Address_Clause -- ------------------------ function Has_Address_Clause (Exp : Node_Id) return Boolean is begin return (Is_Entity_Name (Exp) and then Present (Address_Clause (Entity (Exp)))) or else (Nkind (Exp) = N_Slice and then Has_Address_Clause (Prefix (Exp))); end Has_Address_Clause; --------------------- -- Is_Formal_Array -- --------------------- function Is_Formal_Array (Exp : Node_Id) return Boolean is begin return (Is_Entity_Name (Exp) and then Is_Formal (Entity (Exp))) or else (Nkind (Exp) = N_Slice and then Is_Formal_Array (Prefix (Exp))); end Is_Formal_Array; ------------------------ -- Is_Non_Local_Array -- ------------------------ function Is_Non_Local_Array (Exp : Node_Id) return Boolean is begin case Nkind (Exp) is when N_Indexed_Component | N_Selected_Component | N_Slice => return Is_Non_Local_Array (Prefix (Exp)); when others => return not (Is_Entity_Name (Exp) and then Scope (Entity (Exp)) = Current_Scope); end case; end Is_Non_Local_Array; -- Determine if Lhs, Rhs are formal arrays or nonlocal arrays Lhs_Formal : constant Boolean := Is_Formal_Array (Act_Lhs); Rhs_Formal : constant Boolean := Is_Formal_Array (Act_Rhs); Lhs_Non_Local_Var : constant Boolean := Is_Non_Local_Array (Act_Lhs); Rhs_Non_Local_Var : constant Boolean := Is_Non_Local_Array (Act_Rhs); -- Start of processing for Expand_Assign_Array begin -- Deal with length check. Note that the length check is done with -- respect to the right-hand side as given, not a possible underlying -- renamed object, since this would generate incorrect extra checks. Apply_Length_Check (Rhs, L_Type); -- We start by assuming that the move can be done in either direction, -- i.e. that the two sides are completely disjoint. Set_Forwards_OK (N, True); Set_Backwards_OK (N, True); -- Normally it is only the slice case that can lead to overlap, and -- explicit checks for slices are made below. But there is one case -- where the slice can be implicit and invisible to us: when we have a -- one dimensional array, and either both operands are parameters, or -- one is a parameter (which can be a slice passed by reference) and the -- other is a non-local variable. In this case the parameter could be a -- slice that overlaps with the other operand. -- However, if the array subtype is a constrained first subtype in the -- parameter case, then we don't have to worry about overlap, since -- slice assignments aren't possible (other than for a slice denoting -- the whole array). -- Note: No overlap is possible if there is a change of representation, -- so we can exclude this case. if Ndim = 1 and then not Crep and then ((Lhs_Formal and Rhs_Formal) or else (Lhs_Formal and Rhs_Non_Local_Var) or else (Rhs_Formal and Lhs_Non_Local_Var)) and then (not Is_Constrained (Etype (Lhs)) or else not Is_First_Subtype (Etype (Lhs))) then Set_Forwards_OK (N, False); Set_Backwards_OK (N, False); -- Note: the bit-packed case is not worrisome here, since if we have -- a slice passed as a parameter, it is always aligned on a byte -- boundary, and if there are no explicit slices, the assignment -- can be performed directly. end if; -- If either operand has an address clause clear Backwards_OK and -- Forwards_OK, since we cannot tell if the operands overlap. We -- exclude this treatment when Rhs is an aggregate, since we know -- that overlap can't occur. if (Has_Address_Clause (Lhs) and then Nkind (Rhs) /= N_Aggregate) or else Has_Address_Clause (Rhs) then Set_Forwards_OK (N, False); Set_Backwards_OK (N, False); end if; -- We certainly must use a loop for change of representation and also -- we use the operand of the conversion on the right-hand side as the -- effective right-hand side (the component types must match in this -- situation). if Crep then Act_Rhs := Get_Referenced_Object (Rhs); R_Type := Get_Actual_Subtype (Act_Rhs); Loop_Required := True; -- We require a loop if the left side is possibly bit unaligned elsif Possible_Bit_Aligned_Component (Lhs) or else Possible_Bit_Aligned_Component (Rhs) then Loop_Required := True; -- Arrays with controlled components are expanded into a loop to force -- calls to Adjust at the component level. elsif Has_Controlled_Component (L_Type) then Loop_Required := True; -- If object is atomic/VFA, we cannot tolerate a loop elsif Is_Atomic_Or_VFA_Object (Act_Lhs) or else Is_Atomic_Or_VFA_Object (Act_Rhs) then return; -- Loop is required if we have atomic components since we have to -- be sure to do any accesses on an element by element basis. elsif Has_Atomic_Components (L_Type) or else Has_Atomic_Components (R_Type) or else Is_Atomic_Or_VFA (Component_Type (L_Type)) or else Is_Atomic_Or_VFA (Component_Type (R_Type)) then Loop_Required := True; -- Case where no slice is involved elsif not L_Slice and not R_Slice then -- The following code deals with the case of unconstrained bit packed -- arrays. The problem is that the template for such arrays contains -- the bounds of the actual source level array, but the copy of an -- entire array requires the bounds of the underlying array. It would -- be nice if the back end could take care of this, but right now it -- does not know how, so if we have such a type, then we expand out -- into a loop, which is inefficient but works correctly. If we don't -- do this, we get the wrong length computed for the array to be -- moved. The two cases we need to worry about are: -- Explicit dereference of an unconstrained packed array type as in -- the following example: -- procedure C52 is -- type BITS is array(INTEGER range <>) of BOOLEAN; -- pragma PACK(BITS); -- type A is access BITS; -- P1,P2 : A; -- begin -- P1 := new BITS (1 .. 65_535); -- P2 := new BITS (1 .. 65_535); -- P2.ALL := P1.ALL; -- end C52; -- A formal parameter reference with an unconstrained bit array type -- is the other case we need to worry about (here we assume the same -- BITS type declared above): -- procedure Write_All (File : out BITS; Contents : BITS); -- begin -- File.Storage := Contents; -- end Write_All; -- We expand to a loop in either of these two cases -- Question for future thought. Another potentially more efficient -- approach would be to create the actual subtype, and then do an -- unchecked conversion to this actual subtype ??? Check_Unconstrained_Bit_Packed_Array : declare function Is_UBPA_Reference (Opnd : Node_Id) return Boolean; -- Function to perform required test for the first case, above -- (dereference of an unconstrained bit packed array). ----------------------- -- Is_UBPA_Reference -- ----------------------- function Is_UBPA_Reference (Opnd : Node_Id) return Boolean is Typ : constant Entity_Id := Underlying_Type (Etype (Opnd)); P_Type : Entity_Id; Des_Type : Entity_Id; begin if Present (Packed_Array_Impl_Type (Typ)) and then Is_Array_Type (Packed_Array_Impl_Type (Typ)) and then not Is_Constrained (Packed_Array_Impl_Type (Typ)) then return True; elsif Nkind (Opnd) = N_Explicit_Dereference then P_Type := Underlying_Type (Etype (Prefix (Opnd))); if not Is_Access_Type (P_Type) then return False; else Des_Type := Designated_Type (P_Type); return Is_Bit_Packed_Array (Des_Type) and then not Is_Constrained (Des_Type); end if; else return False; end if; end Is_UBPA_Reference; -- Start of processing for Check_Unconstrained_Bit_Packed_Array begin if Is_UBPA_Reference (Lhs) or else Is_UBPA_Reference (Rhs) then Loop_Required := True; -- Here if we do not have the case of a reference to a bit packed -- unconstrained array case. In this case gigi can most certainly -- handle the assignment if a forwards move is allowed. -- (could it handle the backwards case also???) elsif Forwards_OK (N) then return; end if; end Check_Unconstrained_Bit_Packed_Array; -- The back end can always handle the assignment if the right side is a -- string literal (note that overlap is definitely impossible in this -- case). If the type is packed, a string literal is always converted -- into an aggregate, except in the case of a null slice, for which no -- aggregate can be written. In that case, rewrite the assignment as a -- null statement, a length check has already been emitted to verify -- that the range of the left-hand side is empty. -- Note that this code is not executed if we have an assignment of a -- string literal to a non-bit aligned component of a record, a case -- which cannot be handled by the backend. elsif Nkind (Rhs) = N_String_Literal then if String_Length (Strval (Rhs)) = 0 and then Is_Bit_Packed_Array (L_Type) then Rewrite (N, Make_Null_Statement (Loc)); Analyze (N); end if; return; -- If either operand is bit packed, then we need a loop, since we can't -- be sure that the slice is byte aligned. Similarly, if either operand -- is a possibly unaligned slice, then we need a loop (since the back -- end cannot handle unaligned slices). elsif Is_Bit_Packed_Array (L_Type) or else Is_Bit_Packed_Array (R_Type) or else Is_Possibly_Unaligned_Slice (Lhs) or else Is_Possibly_Unaligned_Slice (Rhs) then Loop_Required := True; -- If we are not bit-packed, and we have only one slice, then no overlap -- is possible except in the parameter case, so we can let the back end -- handle things. elsif not (L_Slice and R_Slice) then if Forwards_OK (N) then return; end if; end if; -- If the right-hand side is a string literal, introduce a temporary for -- it, for use in the generated loop that will follow. if Nkind (Rhs) = N_String_Literal then declare Temp : constant Entity_Id := Make_Temporary (Loc, 'T', Rhs); Decl : Node_Id; begin Decl := Make_Object_Declaration (Loc, Defining_Identifier => Temp, Object_Definition => New_Occurrence_Of (L_Type, Loc), Expression => Relocate_Node (Rhs)); Insert_Action (N, Decl); Rewrite (Rhs, New_Occurrence_Of (Temp, Loc)); R_Type := Etype (Temp); end; end if; -- Come here to complete the analysis -- Loop_Required: Set to True if we know that a loop is required -- regardless of overlap considerations. -- Forwards_OK: Set to False if we already know that a forwards -- move is not safe, else set to True. -- Backwards_OK: Set to False if we already know that a backwards -- move is not safe, else set to True -- Our task at this stage is to complete the overlap analysis, which can -- result in possibly setting Forwards_OK or Backwards_OK to False, and -- then generating the final code, either by deciding that it is OK -- after all to let Gigi handle it, or by generating appropriate code -- in the front end. declare L_Index_Typ : constant Node_Id := Etype (First_Index (L_Type)); R_Index_Typ : constant Node_Id := Etype (First_Index (R_Type)); Left_Lo : constant Node_Id := Type_Low_Bound (L_Index_Typ); Left_Hi : constant Node_Id := Type_High_Bound (L_Index_Typ); Right_Lo : constant Node_Id := Type_Low_Bound (R_Index_Typ); Right_Hi : constant Node_Id := Type_High_Bound (R_Index_Typ); Act_L_Array : Node_Id; Act_R_Array : Node_Id; Cleft_Lo : Node_Id; Cright_Lo : Node_Id; Condition : Node_Id; Cresult : Compare_Result; begin -- Get the expressions for the arrays. If we are dealing with a -- private type, then convert to the underlying type. We can do -- direct assignments to an array that is a private type, but we -- cannot assign to elements of the array without this extra -- unchecked conversion. -- Note: We propagate Parent to the conversion nodes to generate -- a well-formed subtree. if Nkind (Act_Lhs) = N_Slice then Larray := Prefix (Act_Lhs); else Larray := Act_Lhs; if Is_Private_Type (Etype (Larray)) then declare Par : constant Node_Id := Parent (Larray); begin Larray := Unchecked_Convert_To (Underlying_Type (Etype (Larray)), Larray); Set_Parent (Larray, Par); end; end if; end if; if Nkind (Act_Rhs) = N_Slice then Rarray := Prefix (Act_Rhs); else Rarray := Act_Rhs; if Is_Private_Type (Etype (Rarray)) then declare Par : constant Node_Id := Parent (Rarray); begin Rarray := Unchecked_Convert_To (Underlying_Type (Etype (Rarray)), Rarray); Set_Parent (Rarray, Par); end; end if; end if; -- If both sides are slices, we must figure out whether it is safe -- to do the move in one direction or the other. It is always safe -- if there is a change of representation since obviously two arrays -- with different representations cannot possibly overlap. if (not Crep) and L_Slice and R_Slice then Act_L_Array := Get_Referenced_Object (Prefix (Act_Lhs)); Act_R_Array := Get_Referenced_Object (Prefix (Act_Rhs)); -- If both left- and right-hand arrays are entity names, and refer -- to different entities, then we know that the move is safe (the -- two storage areas are completely disjoint). if Is_Entity_Name (Act_L_Array) and then Is_Entity_Name (Act_R_Array) and then Entity (Act_L_Array) /= Entity (Act_R_Array) then null; -- Otherwise, we assume the worst, which is that the two arrays -- are the same array. There is no need to check if we know that -- is the case, because if we don't know it, we still have to -- assume it. -- Generally if the same array is involved, then we have an -- overlapping case. We will have to really assume the worst (i.e. -- set neither of the OK flags) unless we can determine the lower -- or upper bounds at compile time and compare them. else Cresult := Compile_Time_Compare (Left_Lo, Right_Lo, Assume_Valid => True); if Cresult = Unknown then Cresult := Compile_Time_Compare (Left_Hi, Right_Hi, Assume_Valid => True); end if; case Cresult is when EQ | LE | LT => Set_Backwards_OK (N, False); when GE | GT => Set_Forwards_OK (N, False); when NE | Unknown => Set_Backwards_OK (N, False); Set_Forwards_OK (N, False); end case; end if; end if; -- If after that analysis Loop_Required is False, meaning that we -- have not discovered some non-overlap reason for requiring a loop, -- then the outcome depends on the capabilities of the back end. if not Loop_Required then -- Assume the back end can deal with all cases of overlap by -- falling back to memmove if it cannot use a more efficient -- approach. return; end if; -- At this stage we have to generate an explicit loop, and we have -- the following cases: -- Forwards_OK = True -- Rnn : right_index := right_index'First; -- for Lnn in left-index loop -- left (Lnn) := right (Rnn); -- Rnn := right_index'Succ (Rnn); -- end loop; -- Note: the above code MUST be analyzed with checks off, because -- otherwise the Succ could overflow. But in any case this is more -- efficient. -- Forwards_OK = False, Backwards_OK = True -- Rnn : right_index := right_index'Last; -- for Lnn in reverse left-index loop -- left (Lnn) := right (Rnn); -- Rnn := right_index'Pred (Rnn); -- end loop; -- Note: the above code MUST be analyzed with checks off, because -- otherwise the Pred could overflow. But in any case this is more -- efficient. -- Forwards_OK = Backwards_OK = False -- This only happens if we have the same array on each side. It is -- possible to create situations using overlays that violate this, -- but we simply do not promise to get this "right" in this case. -- There are two possible subcases. If the No_Implicit_Conditionals -- restriction is set, then we generate the following code: -- declare -- T : constant <operand-type> := rhs; -- begin -- lhs := T; -- end; -- If implicit conditionals are permitted, then we generate: -- if Left_Lo <= Right_Lo then -- <code for Forwards_OK = True above> -- else -- <code for Backwards_OK = True above> -- end if; -- In order to detect possible aliasing, we examine the renamed -- expression when the source or target is a renaming. However, -- the renaming may be intended to capture an address that may be -- affected by subsequent code, and therefore we must recover -- the actual entity for the expansion that follows, not the -- object it renames. In particular, if source or target designate -- a portion of a dynamically allocated object, the pointer to it -- may be reassigned but the renaming preserves the proper location. if Is_Entity_Name (Rhs) and then Nkind (Parent (Entity (Rhs))) = N_Object_Renaming_Declaration and then Nkind (Act_Rhs) = N_Slice then Rarray := Rhs; end if; if Is_Entity_Name (Lhs) and then Nkind (Parent (Entity (Lhs))) = N_Object_Renaming_Declaration and then Nkind (Act_Lhs) = N_Slice then Larray := Lhs; end if; -- Cases where either Forwards_OK or Backwards_OK is true if Forwards_OK (N) or else Backwards_OK (N) then if Needs_Finalization (Component_Type (L_Type)) and then Base_Type (L_Type) = Base_Type (R_Type) and then Ndim = 1 and then not No_Ctrl_Actions (N) then declare Proc : constant Entity_Id := TSS (Base_Type (L_Type), TSS_Slice_Assign); Actuals : List_Id; begin Apply_Dereference (Larray); Apply_Dereference (Rarray); Actuals := New_List ( Duplicate_Subexpr (Larray, Name_Req => True), Duplicate_Subexpr (Rarray, Name_Req => True), Duplicate_Subexpr (Left_Lo, Name_Req => True), Duplicate_Subexpr (Left_Hi, Name_Req => True), Duplicate_Subexpr (Right_Lo, Name_Req => True), Duplicate_Subexpr (Right_Hi, Name_Req => True)); Append_To (Actuals, New_Occurrence_Of ( Boolean_Literals (not Forwards_OK (N)), Loc)); Rewrite (N, Make_Procedure_Call_Statement (Loc, Name => New_Occurrence_Of (Proc, Loc), Parameter_Associations => Actuals)); end; else Rewrite (N, Expand_Assign_Array_Loop (N, Larray, Rarray, L_Type, R_Type, Ndim, Rev => not Forwards_OK (N))); end if; -- Case of both are false with No_Implicit_Conditionals elsif Restriction_Active (No_Implicit_Conditionals) then declare T : constant Entity_Id := Make_Defining_Identifier (Loc, Chars => Name_T); begin Rewrite (N, Make_Block_Statement (Loc, Declarations => New_List ( Make_Object_Declaration (Loc, Defining_Identifier => T, Constant_Present => True, Object_Definition => New_Occurrence_Of (Etype (Rhs), Loc), Expression => Relocate_Node (Rhs))), Handled_Statement_Sequence => Make_Handled_Sequence_Of_Statements (Loc, Statements => New_List ( Make_Assignment_Statement (Loc, Name => Relocate_Node (Lhs), Expression => New_Occurrence_Of (T, Loc)))))); end; -- Case of both are false with implicit conditionals allowed else -- Before we generate this code, we must ensure that the left and -- right side array types are defined. They may be itypes, and we -- cannot let them be defined inside the if, since the first use -- in the then may not be executed. Ensure_Defined (L_Type, N); Ensure_Defined (R_Type, N); -- We normally compare addresses to find out which way round to -- do the loop, since this is reliable, and handles the cases of -- parameters, conversions etc. But we can't do that in the bit -- packed case, because addresses don't work there. if not Is_Bit_Packed_Array (L_Type) then Condition := Make_Op_Le (Loc, Left_Opnd => Unchecked_Convert_To (RTE (RE_Integer_Address), Make_Attribute_Reference (Loc, Prefix => Make_Indexed_Component (Loc, Prefix => Duplicate_Subexpr_Move_Checks (Larray, True), Expressions => New_List ( Make_Attribute_Reference (Loc, Prefix => New_Occurrence_Of (L_Index_Typ, Loc), Attribute_Name => Name_First))), Attribute_Name => Name_Address)), Right_Opnd => Unchecked_Convert_To (RTE (RE_Integer_Address), Make_Attribute_Reference (Loc, Prefix => Make_Indexed_Component (Loc, Prefix => Duplicate_Subexpr_Move_Checks (Rarray, True), Expressions => New_List ( Make_Attribute_Reference (Loc, Prefix => New_Occurrence_Of (R_Index_Typ, Loc), Attribute_Name => Name_First))), Attribute_Name => Name_Address))); -- For the bit packed and VM cases we use the bounds. That's OK, -- because we don't have to worry about parameters, since they -- cannot cause overlap. Perhaps we should worry about weird slice -- conversions ??? else -- Copy the bounds Cleft_Lo := New_Copy_Tree (Left_Lo); Cright_Lo := New_Copy_Tree (Right_Lo); -- If the types do not match we add an implicit conversion -- here to ensure proper match if Etype (Left_Lo) /= Etype (Right_Lo) then Cright_Lo := Unchecked_Convert_To (Etype (Left_Lo), Cright_Lo); end if; -- Reset the Analyzed flag, because the bounds of the index -- type itself may be universal, and must must be reanalyzed -- to acquire the proper type for the back end. Set_Analyzed (Cleft_Lo, False); Set_Analyzed (Cright_Lo, False); Condition := Make_Op_Le (Loc, Left_Opnd => Cleft_Lo, Right_Opnd => Cright_Lo); end if; if Needs_Finalization (Component_Type (L_Type)) and then Base_Type (L_Type) = Base_Type (R_Type) and then Ndim = 1 and then not No_Ctrl_Actions (N) then -- Call TSS procedure for array assignment, passing the -- explicit bounds of right- and left-hand sides. declare Proc : constant Entity_Id := TSS (Base_Type (L_Type), TSS_Slice_Assign); Actuals : List_Id; begin Apply_Dereference (Larray); Apply_Dereference (Rarray); Actuals := New_List ( Duplicate_Subexpr (Larray, Name_Req => True), Duplicate_Subexpr (Rarray, Name_Req => True), Duplicate_Subexpr (Left_Lo, Name_Req => True), Duplicate_Subexpr (Left_Hi, Name_Req => True), Duplicate_Subexpr (Right_Lo, Name_Req => True), Duplicate_Subexpr (Right_Hi, Name_Req => True)); Append_To (Actuals, Make_Op_Not (Loc, Right_Opnd => Condition)); Rewrite (N, Make_Procedure_Call_Statement (Loc, Name => New_Occurrence_Of (Proc, Loc), Parameter_Associations => Actuals)); end; else Rewrite (N, Make_Implicit_If_Statement (N, Condition => Condition, Then_Statements => New_List ( Expand_Assign_Array_Loop (N, Larray, Rarray, L_Type, R_Type, Ndim, Rev => False)), Else_Statements => New_List ( Expand_Assign_Array_Loop (N, Larray, Rarray, L_Type, R_Type, Ndim, Rev => True)))); end if; end if; Analyze (N, Suppress => All_Checks); end; exception when RE_Not_Available => return; end Expand_Assign_Array; ------------------------------ -- Expand_Assign_Array_Loop -- ------------------------------ -- The following is an example of the loop generated for the case of a -- two-dimensional array: -- declare -- R2b : Tm1X1 := 1; -- begin -- for L1b in 1 .. 100 loop -- declare -- R4b : Tm1X2 := 1; -- begin -- for L3b in 1 .. 100 loop -- vm1 (L1b, L3b) := vm2 (R2b, R4b); -- R4b := Tm1X2'succ(R4b); -- end loop; -- end; -- R2b := Tm1X1'succ(R2b); -- end loop; -- end; -- Here Rev is False, and Tm1Xn are the subscript types for the right-hand -- side. The declarations of R2b and R4b are inserted before the original -- assignment statement. function Expand_Assign_Array_Loop (N : Node_Id; Larray : Entity_Id; Rarray : Entity_Id; L_Type : Entity_Id; R_Type : Entity_Id; Ndim : Pos; Rev : Boolean) return Node_Id is Loc : constant Source_Ptr := Sloc (N); Lnn : array (1 .. Ndim) of Entity_Id; Rnn : array (1 .. Ndim) of Entity_Id; -- Entities used as subscripts on left and right sides L_Index_Type : array (1 .. Ndim) of Entity_Id; R_Index_Type : array (1 .. Ndim) of Entity_Id; -- Left and right index types Assign : Node_Id; F_Or_L : Name_Id; S_Or_P : Name_Id; function Build_Step (J : Nat) return Node_Id; -- The increment step for the index of the right-hand side is written -- as an attribute reference (Succ or Pred). This function returns -- the corresponding node, which is placed at the end of the loop body. ---------------- -- Build_Step -- ---------------- function Build_Step (J : Nat) return Node_Id is Step : Node_Id; Lim : Name_Id; begin if Rev then Lim := Name_First; else Lim := Name_Last; end if; Step := Make_Assignment_Statement (Loc, Name => New_Occurrence_Of (Rnn (J), Loc), Expression => Make_Attribute_Reference (Loc, Prefix => New_Occurrence_Of (R_Index_Type (J), Loc), Attribute_Name => S_Or_P, Expressions => New_List ( New_Occurrence_Of (Rnn (J), Loc)))); -- Note that on the last iteration of the loop, the index is increased -- (or decreased) past the corresponding bound. This is consistent with -- the C semantics of the back-end, where such an off-by-one value on a -- dead index variable is OK. However, in CodePeer mode this leads to -- spurious warnings, and thus we place a guard around the attribute -- reference. For obvious reasons we only do this for CodePeer. if CodePeer_Mode then Step := Make_If_Statement (Loc, Condition => Make_Op_Ne (Loc, Left_Opnd => New_Occurrence_Of (Lnn (J), Loc), Right_Opnd => Make_Attribute_Reference (Loc, Prefix => New_Occurrence_Of (L_Index_Type (J), Loc), Attribute_Name => Lim)), Then_Statements => New_List (Step)); end if; return Step; end Build_Step; -- Start of processing for Expand_Assign_Array_Loop begin if Rev then F_Or_L := Name_Last; S_Or_P := Name_Pred; else F_Or_L := Name_First; S_Or_P := Name_Succ; end if; -- Setup index types and subscript entities declare L_Index : Node_Id; R_Index : Node_Id; begin L_Index := First_Index (L_Type); R_Index := First_Index (R_Type); for J in 1 .. Ndim loop Lnn (J) := Make_Temporary (Loc, 'L'); Rnn (J) := Make_Temporary (Loc, 'R'); L_Index_Type (J) := Etype (L_Index); R_Index_Type (J) := Etype (R_Index); Next_Index (L_Index); Next_Index (R_Index); end loop; end; -- Now construct the assignment statement declare ExprL : constant List_Id := New_List; ExprR : constant List_Id := New_List; begin for J in 1 .. Ndim loop Append_To (ExprL, New_Occurrence_Of (Lnn (J), Loc)); Append_To (ExprR, New_Occurrence_Of (Rnn (J), Loc)); end loop; Assign := Make_Assignment_Statement (Loc, Name => Make_Indexed_Component (Loc, Prefix => Duplicate_Subexpr (Larray, Name_Req => True), Expressions => ExprL), Expression => Make_Indexed_Component (Loc, Prefix => Duplicate_Subexpr (Rarray, Name_Req => True), Expressions => ExprR)); -- We set assignment OK, since there are some cases, e.g. in object -- declarations, where we are actually assigning into a constant. -- If there really is an illegality, it was caught long before now, -- and was flagged when the original assignment was analyzed. Set_Assignment_OK (Name (Assign)); -- Propagate the No_Ctrl_Actions flag to individual assignments Set_No_Ctrl_Actions (Assign, No_Ctrl_Actions (N)); end; -- Now construct the loop from the inside out, with the last subscript -- varying most rapidly. Note that Assign is first the raw assignment -- statement, and then subsequently the loop that wraps it up. for J in reverse 1 .. Ndim loop Assign := Make_Block_Statement (Loc, Declarations => New_List ( Make_Object_Declaration (Loc, Defining_Identifier => Rnn (J), Object_Definition => New_Occurrence_Of (R_Index_Type (J), Loc), Expression => Make_Attribute_Reference (Loc, Prefix => New_Occurrence_Of (R_Index_Type (J), Loc), Attribute_Name => F_Or_L))), Handled_Statement_Sequence => Make_Handled_Sequence_Of_Statements (Loc, Statements => New_List ( Make_Implicit_Loop_Statement (N, Iteration_Scheme => Make_Iteration_Scheme (Loc, Loop_Parameter_Specification => Make_Loop_Parameter_Specification (Loc, Defining_Identifier => Lnn (J), Reverse_Present => Rev, Discrete_Subtype_Definition => New_Occurrence_Of (L_Index_Type (J), Loc))), Statements => New_List (Assign, Build_Step (J)))))); end loop; return Assign; end Expand_Assign_Array_Loop; -------------------------- -- Expand_Assign_Record -- -------------------------- procedure Expand_Assign_Record (N : Node_Id) is Lhs : constant Node_Id := Name (N); Rhs : Node_Id := Expression (N); L_Typ : constant Entity_Id := Base_Type (Etype (Lhs)); begin -- If change of representation, then extract the real right-hand side -- from the type conversion, and proceed with component-wise assignment, -- since the two types are not the same as far as the back end is -- concerned. if Change_Of_Representation (N) then Rhs := Expression (Rhs); -- If this may be a case of a large bit aligned component, then proceed -- with component-wise assignment, to avoid possible clobbering of other -- components sharing bits in the first or last byte of the component to -- be assigned. elsif Possible_Bit_Aligned_Component (Lhs) or Possible_Bit_Aligned_Component (Rhs) then null; -- If we have a tagged type that has a complete record representation -- clause, we must do we must do component-wise assignments, since child -- types may have used gaps for their components, and we might be -- dealing with a view conversion. elsif Is_Fully_Repped_Tagged_Type (L_Typ) then null; -- If neither condition met, then nothing special to do, the back end -- can handle assignment of the entire component as a single entity. else return; end if; -- At this stage we know that we must do a component wise assignment declare Loc : constant Source_Ptr := Sloc (N); R_Typ : constant Entity_Id := Base_Type (Etype (Rhs)); Decl : constant Node_Id := Declaration_Node (R_Typ); RDef : Node_Id; F : Entity_Id; function Find_Component (Typ : Entity_Id; Comp : Entity_Id) return Entity_Id; -- Find the component with the given name in the underlying record -- declaration for Typ. We need to use the actual entity because the -- type may be private and resolution by identifier alone would fail. function Make_Component_List_Assign (CL : Node_Id; U_U : Boolean := False) return List_Id; -- Returns a sequence of statements to assign the components that -- are referenced in the given component list. The flag U_U is -- used to force the usage of the inferred value of the variant -- part expression as the switch for the generated case statement. function Make_Field_Assign (C : Entity_Id; U_U : Boolean := False) return Node_Id; -- Given C, the entity for a discriminant or component, build an -- assignment for the corresponding field values. The flag U_U -- signals the presence of an Unchecked_Union and forces the usage -- of the inferred discriminant value of C as the right-hand side -- of the assignment. function Make_Field_Assigns (CI : List_Id) return List_Id; -- Given CI, a component items list, construct series of statements -- for fieldwise assignment of the corresponding components. -------------------- -- Find_Component -- -------------------- function Find_Component (Typ : Entity_Id; Comp : Entity_Id) return Entity_Id is Utyp : constant Entity_Id := Underlying_Type (Typ); C : Entity_Id; begin C := First_Entity (Utyp); while Present (C) loop if Chars (C) = Chars (Comp) then return C; end if; Next_Entity (C); end loop; raise Program_Error; end Find_Component; -------------------------------- -- Make_Component_List_Assign -- -------------------------------- function Make_Component_List_Assign (CL : Node_Id; U_U : Boolean := False) return List_Id is CI : constant List_Id := Component_Items (CL); VP : constant Node_Id := Variant_Part (CL); Alts : List_Id; DC : Node_Id; DCH : List_Id; Expr : Node_Id; Result : List_Id; V : Node_Id; begin Result := Make_Field_Assigns (CI); if Present (VP) then V := First_Non_Pragma (Variants (VP)); Alts := New_List; while Present (V) loop DCH := New_List; DC := First (Discrete_Choices (V)); while Present (DC) loop Append_To (DCH, New_Copy_Tree (DC)); Next (DC); end loop; Append_To (Alts, Make_Case_Statement_Alternative (Loc, Discrete_Choices => DCH, Statements => Make_Component_List_Assign (Component_List (V)))); Next_Non_Pragma (V); end loop; -- If we have an Unchecked_Union, use the value of the inferred -- discriminant of the variant part expression as the switch -- for the case statement. The case statement may later be -- folded. if U_U then Expr := New_Copy (Get_Discriminant_Value ( Entity (Name (VP)), Etype (Rhs), Discriminant_Constraint (Etype (Rhs)))); else Expr := Make_Selected_Component (Loc, Prefix => Duplicate_Subexpr (Rhs), Selector_Name => Make_Identifier (Loc, Chars (Name (VP)))); end if; Append_To (Result, Make_Case_Statement (Loc, Expression => Expr, Alternatives => Alts)); end if; return Result; end Make_Component_List_Assign; ----------------------- -- Make_Field_Assign -- ----------------------- function Make_Field_Assign (C : Entity_Id; U_U : Boolean := False) return Node_Id is A : Node_Id; Expr : Node_Id; begin -- In the case of an Unchecked_Union, use the discriminant -- constraint value as on the right-hand side of the assignment. if U_U then Expr := New_Copy (Get_Discriminant_Value (C, Etype (Rhs), Discriminant_Constraint (Etype (Rhs)))); else Expr := Make_Selected_Component (Loc, Prefix => Duplicate_Subexpr (Rhs), Selector_Name => New_Occurrence_Of (C, Loc)); end if; A := Make_Assignment_Statement (Loc, Name => Make_Selected_Component (Loc, Prefix => Duplicate_Subexpr (Lhs), Selector_Name => New_Occurrence_Of (Find_Component (L_Typ, C), Loc)), Expression => Expr); -- Set Assignment_OK, so discriminants can be assigned Set_Assignment_OK (Name (A), True); if Componentwise_Assignment (N) and then Nkind (Name (A)) = N_Selected_Component and then Chars (Selector_Name (Name (A))) = Name_uParent then Set_Componentwise_Assignment (A); end if; return A; end Make_Field_Assign; ------------------------ -- Make_Field_Assigns -- ------------------------ function Make_Field_Assigns (CI : List_Id) return List_Id is Item : Node_Id; Result : List_Id; begin Item := First (CI); Result := New_List; while Present (Item) loop -- Look for components, but exclude _tag field assignment if -- the special Componentwise_Assignment flag is set. if Nkind (Item) = N_Component_Declaration and then not (Is_Tag (Defining_Identifier (Item)) and then Componentwise_Assignment (N)) then Append_To (Result, Make_Field_Assign (Defining_Identifier (Item))); end if; Next (Item); end loop; return Result; end Make_Field_Assigns; -- Start of processing for Expand_Assign_Record begin -- Note that we use the base types for this processing. This results -- in some extra work in the constrained case, but the change of -- representation case is so unusual that it is not worth the effort. -- First copy the discriminants. This is done unconditionally. It -- is required in the unconstrained left side case, and also in the -- case where this assignment was constructed during the expansion -- of a type conversion (since initialization of discriminants is -- suppressed in this case). It is unnecessary but harmless in -- other cases. if Has_Discriminants (L_Typ) then F := First_Discriminant (R_Typ); while Present (F) loop -- If we are expanding the initialization of a derived record -- that constrains or renames discriminants of the parent, we -- must use the corresponding discriminant in the parent. declare CF : Entity_Id; begin if Inside_Init_Proc and then Present (Corresponding_Discriminant (F)) then CF := Corresponding_Discriminant (F); else CF := F; end if; if Is_Unchecked_Union (Base_Type (R_Typ)) then -- Within an initialization procedure this is the -- assignment to an unchecked union component, in which -- case there is no discriminant to initialize. if Inside_Init_Proc then null; else -- The assignment is part of a conversion from a -- derived unchecked union type with an inferable -- discriminant, to a parent type. Insert_Action (N, Make_Field_Assign (CF, True)); end if; else Insert_Action (N, Make_Field_Assign (CF)); end if; Next_Discriminant (F); end; end loop; end if; -- We know the underlying type is a record, but its current view -- may be private. We must retrieve the usable record declaration. if Nkind_In (Decl, N_Private_Type_Declaration, N_Private_Extension_Declaration) and then Present (Full_View (R_Typ)) then RDef := Type_Definition (Declaration_Node (Full_View (R_Typ))); else RDef := Type_Definition (Decl); end if; if Nkind (RDef) = N_Derived_Type_Definition then RDef := Record_Extension_Part (RDef); end if; if Nkind (RDef) = N_Record_Definition and then Present (Component_List (RDef)) then if Is_Unchecked_Union (R_Typ) then Insert_Actions (N, Make_Component_List_Assign (Component_List (RDef), True)); else Insert_Actions (N, Make_Component_List_Assign (Component_List (RDef))); end if; Rewrite (N, Make_Null_Statement (Loc)); end if; end; end Expand_Assign_Record; ------------------------------------- -- Expand_Assign_With_Target_Names -- ------------------------------------- procedure Expand_Assign_With_Target_Names (N : Node_Id) is LHS : constant Node_Id := Name (N); LHS_Typ : constant Entity_Id := Etype (LHS); Loc : constant Source_Ptr := Sloc (N); RHS : constant Node_Id := Expression (N); Ent : Entity_Id; -- The entity of the left-hand side function Replace_Target (N : Node_Id) return Traverse_Result; -- Replace occurrences of the target name by the proper entity: either -- the entity of the LHS in simple cases, or the formal of the -- constructed procedure otherwise. -------------------- -- Replace_Target -- -------------------- function Replace_Target (N : Node_Id) return Traverse_Result is begin if Nkind (N) = N_Target_Name then Rewrite (N, New_Occurrence_Of (Ent, Sloc (N))); end if; Set_Analyzed (N, False); return OK; end Replace_Target; procedure Replace_Target_Name is new Traverse_Proc (Replace_Target); -- Local variables New_RHS : Node_Id; Proc_Id : Entity_Id; -- Start of processing for Expand_Assign_With_Target_Names begin New_RHS := New_Copy_Tree (RHS); -- The left-hand side is a direct name if Is_Entity_Name (LHS) and then not Is_Renaming_Of_Object (Entity (LHS)) then Ent := Entity (LHS); Replace_Target_Name (New_RHS); -- Generate: -- LHS := ... LHS ...; Rewrite (N, Make_Assignment_Statement (Loc, Name => Relocate_Node (LHS), Expression => New_RHS)); -- The left-hand side is not a direct name, but is side-effect free. -- Capture its value in a temporary to avoid multiple evaluations. elsif Side_Effect_Free (LHS) then Ent := Make_Temporary (Loc, 'T'); Replace_Target_Name (New_RHS); -- Generate: -- T : LHS_Typ := LHS; Insert_Before_And_Analyze (N, Make_Object_Declaration (Loc, Defining_Identifier => Ent, Object_Definition => New_Occurrence_Of (LHS_Typ, Loc), Expression => New_Copy_Tree (LHS))); -- Generate: -- LHS := ... T ...; Rewrite (N, Make_Assignment_Statement (Loc, Name => Relocate_Node (LHS), Expression => New_RHS)); -- Otherwise wrap the whole assignment statement in a procedure with an -- IN OUT parameter. The original assignment then becomes a call to the -- procedure with the left-hand side as an actual. else Ent := Make_Temporary (Loc, 'T'); Replace_Target_Name (New_RHS); -- Generate: -- procedure P (T : in out LHS_Typ) is -- begin -- T := ... T ...; -- end P; Proc_Id := Make_Temporary (Loc, 'P'); Insert_Before_And_Analyze (N, Make_Subprogram_Body (Loc, Specification => Make_Procedure_Specification (Loc, Defining_Unit_Name => Proc_Id, Parameter_Specifications => New_List ( Make_Parameter_Specification (Loc, Defining_Identifier => Ent, In_Present => True, Out_Present => True, Parameter_Type => New_Occurrence_Of (LHS_Typ, Loc)))), Declarations => Empty_List, Handled_Statement_Sequence => Make_Handled_Sequence_Of_Statements (Loc, Statements => New_List ( Make_Assignment_Statement (Loc, Name => New_Occurrence_Of (Ent, Loc), Expression => New_RHS))))); -- Generate: -- P (LHS); Rewrite (N, Make_Procedure_Call_Statement (Loc, Name => New_Occurrence_Of (Proc_Id, Loc), Parameter_Associations => New_List (Relocate_Node (LHS)))); end if; -- Analyze rewritten node, either as assignment or procedure call Analyze (N); end Expand_Assign_With_Target_Names; ----------------------------------- -- Expand_N_Assignment_Statement -- ----------------------------------- -- This procedure implements various cases where an assignment statement -- cannot just be passed on to the back end in untransformed state. procedure Expand_N_Assignment_Statement (N : Node_Id) is Crep : constant Boolean := Change_Of_Representation (N); Lhs : constant Node_Id := Name (N); Loc : constant Source_Ptr := Sloc (N); Rhs : constant Node_Id := Expression (N); Typ : constant Entity_Id := Underlying_Type (Etype (Lhs)); Exp : Node_Id; begin -- Special case to check right away, if the Componentwise_Assignment -- flag is set, this is a reanalysis from the expansion of the primitive -- assignment procedure for a tagged type, and all we need to do is to -- expand to assignment of components, because otherwise, we would get -- infinite recursion (since this looks like a tagged assignment which -- would normally try to *call* the primitive assignment procedure). if Componentwise_Assignment (N) then Expand_Assign_Record (N); return; end if; -- Defend against invalid subscripts on left side if we are in standard -- validity checking mode. No need to do this if we are checking all -- subscripts. -- Note that we do this right away, because there are some early return -- paths in this procedure, and this is required on all paths. if Validity_Checks_On and then Validity_Check_Default and then not Validity_Check_Subscripts then Check_Valid_Lvalue_Subscripts (Lhs); end if; -- Separate expansion if RHS contain target names. Note that assignment -- may already have been expanded if RHS is aggregate. if Nkind (N) = N_Assignment_Statement and then Has_Target_Names (N) then Expand_Assign_With_Target_Names (N); return; end if; -- Ada 2005 (AI-327): Handle assignment to priority of protected object -- Rewrite an assignment to X'Priority into a run-time call -- For example: X'Priority := New_Prio_Expr; -- ...is expanded into Set_Ceiling (X._Object, New_Prio_Expr); -- Note that although X'Priority is notionally an object, it is quite -- deliberately not defined as an aliased object in the RM. This means -- that it works fine to rewrite it as a call, without having to worry -- about complications that would other arise from X'Priority'Access, -- which is illegal, because of the lack of aliasing. if Ada_Version >= Ada_2005 then declare Call : Node_Id; Conctyp : Entity_Id; Ent : Entity_Id; Subprg : Entity_Id; RT_Subprg_Name : Node_Id; begin -- Handle chains of renamings Ent := Name (N); while Nkind (Ent) in N_Has_Entity and then Present (Entity (Ent)) and then Present (Renamed_Object (Entity (Ent))) loop Ent := Renamed_Object (Entity (Ent)); end loop; -- The attribute Priority applied to protected objects has been -- previously expanded into a call to the Get_Ceiling run-time -- subprogram. In restricted profiles this is not available. if Is_Expanded_Priority_Attribute (Ent) then -- Look for the enclosing concurrent type Conctyp := Current_Scope; while not Is_Concurrent_Type (Conctyp) loop Conctyp := Scope (Conctyp); end loop; pragma Assert (Is_Protected_Type (Conctyp)); -- Generate the first actual of the call Subprg := Current_Scope; while not Present (Protected_Body_Subprogram (Subprg)) loop Subprg := Scope (Subprg); end loop; -- Select the appropriate run-time call if Number_Entries (Conctyp) = 0 then RT_Subprg_Name := New_Occurrence_Of (RTE (RE_Set_Ceiling), Loc); else RT_Subprg_Name := New_Occurrence_Of (RTE (RO_PE_Set_Ceiling), Loc); end if; Call := Make_Procedure_Call_Statement (Loc, Name => RT_Subprg_Name, Parameter_Associations => New_List ( New_Copy_Tree (First (Parameter_Associations (Ent))), Relocate_Node (Expression (N)))); Rewrite (N, Call); Analyze (N); return; end if; end; end if; -- Deal with assignment checks unless suppressed if not Suppress_Assignment_Checks (N) then -- First deal with generation of range check if required if Do_Range_Check (Rhs) then Generate_Range_Check (Rhs, Typ, CE_Range_Check_Failed); end if; -- Then generate predicate check if required Apply_Predicate_Check (Rhs, Typ); end if; -- Check for a special case where a high level transformation is -- required. If we have either of: -- P.field := rhs; -- P (sub) := rhs; -- where P is a reference to a bit packed array, then we have to unwind -- the assignment. The exact meaning of being a reference to a bit -- packed array is as follows: -- An indexed component whose prefix is a bit packed array is a -- reference to a bit packed array. -- An indexed component or selected component whose prefix is a -- reference to a bit packed array is itself a reference ot a -- bit packed array. -- The required transformation is -- Tnn : prefix_type := P; -- Tnn.field := rhs; -- P := Tnn; -- or -- Tnn : prefix_type := P; -- Tnn (subscr) := rhs; -- P := Tnn; -- Since P is going to be evaluated more than once, any subscripts -- in P must have their evaluation forced. if Nkind_In (Lhs, N_Indexed_Component, N_Selected_Component) and then Is_Ref_To_Bit_Packed_Array (Prefix (Lhs)) then declare BPAR_Expr : constant Node_Id := Relocate_Node (Prefix (Lhs)); BPAR_Typ : constant Entity_Id := Etype (BPAR_Expr); Tnn : constant Entity_Id := Make_Temporary (Loc, 'T', BPAR_Expr); begin -- Insert the post assignment first, because we want to copy the -- BPAR_Expr tree before it gets analyzed in the context of the -- pre assignment. Note that we do not analyze the post assignment -- yet (we cannot till we have completed the analysis of the pre -- assignment). As usual, the analysis of this post assignment -- will happen on its own when we "run into" it after finishing -- the current assignment. Insert_After (N, Make_Assignment_Statement (Loc, Name => New_Copy_Tree (BPAR_Expr), Expression => New_Occurrence_Of (Tnn, Loc))); -- At this stage BPAR_Expr is a reference to a bit packed array -- where the reference was not expanded in the original tree, -- since it was on the left side of an assignment. But in the -- pre-assignment statement (the object definition), BPAR_Expr -- will end up on the right-hand side, and must be reexpanded. To -- achieve this, we reset the analyzed flag of all selected and -- indexed components down to the actual indexed component for -- the packed array. Exp := BPAR_Expr; loop Set_Analyzed (Exp, False); if Nkind_In (Exp, N_Indexed_Component, N_Selected_Component) then Exp := Prefix (Exp); else exit; end if; end loop; -- Now we can insert and analyze the pre-assignment -- If the right-hand side requires a transient scope, it has -- already been placed on the stack. However, the declaration is -- inserted in the tree outside of this scope, and must reflect -- the proper scope for its variable. This awkward bit is forced -- by the stricter scope discipline imposed by GCC 2.97. declare Uses_Transient_Scope : constant Boolean := Scope_Is_Transient and then N = Node_To_Be_Wrapped; begin if Uses_Transient_Scope then Push_Scope (Scope (Current_Scope)); end if; Insert_Before_And_Analyze (N, Make_Object_Declaration (Loc, Defining_Identifier => Tnn, Object_Definition => New_Occurrence_Of (BPAR_Typ, Loc), Expression => BPAR_Expr)); if Uses_Transient_Scope then Pop_Scope; end if; end; -- Now fix up the original assignment and continue processing Rewrite (Prefix (Lhs), New_Occurrence_Of (Tnn, Loc)); -- We do not need to reanalyze that assignment, and we do not need -- to worry about references to the temporary, but we do need to -- make sure that the temporary is not marked as a true constant -- since we now have a generated assignment to it. Set_Is_True_Constant (Tnn, False); end; end if; -- When we have the appropriate type of aggregate in the expression (it -- has been determined during analysis of the aggregate by setting the -- delay flag), let's perform in place assignment and thus avoid -- creating a temporary. if Is_Delayed_Aggregate (Rhs) then Convert_Aggr_In_Assignment (N); Rewrite (N, Make_Null_Statement (Loc)); Analyze (N); return; end if; -- Apply discriminant check if required. If Lhs is an access type to a -- designated type with discriminants, we must always check. If the -- type has unknown discriminants, more elaborate processing below. if Has_Discriminants (Etype (Lhs)) and then not Has_Unknown_Discriminants (Etype (Lhs)) then -- Skip discriminant check if change of representation. Will be -- done when the change of representation is expanded out. if not Crep then Apply_Discriminant_Check (Rhs, Etype (Lhs), Lhs); end if; -- If the type is private without discriminants, and the full type -- has discriminants (necessarily with defaults) a check may still be -- necessary if the Lhs is aliased. The private discriminants must be -- visible to build the discriminant constraints. -- Only an explicit dereference that comes from source indicates -- aliasing. Access to formals of protected operations and entries -- create dereferences but are not semantic aliasings. elsif Is_Private_Type (Etype (Lhs)) and then Has_Discriminants (Typ) and then Nkind (Lhs) = N_Explicit_Dereference and then Comes_From_Source (Lhs) then declare Lt : constant Entity_Id := Etype (Lhs); Ubt : Entity_Id := Base_Type (Typ); begin -- In the case of an expander-generated record subtype whose base -- type still appears private, Typ will have been set to that -- private type rather than the underlying record type (because -- Underlying type will have returned the record subtype), so it's -- necessary to apply Underlying_Type again to the base type to -- get the record type we need for the discriminant check. Such -- subtypes can be created for assignments in certain cases, such -- as within an instantiation passed this kind of private type. -- It would be good to avoid this special test, but making changes -- to prevent this odd form of record subtype seems difficult. ??? if Is_Private_Type (Ubt) then Ubt := Underlying_Type (Ubt); end if; Set_Etype (Lhs, Ubt); Rewrite (Rhs, OK_Convert_To (Base_Type (Ubt), Rhs)); Apply_Discriminant_Check (Rhs, Ubt, Lhs); Set_Etype (Lhs, Lt); end; -- If the Lhs has a private type with unknown discriminants, it may -- have a full view with discriminants, but those are nameable only -- in the underlying type, so convert the Rhs to it before potential -- checking. Convert Lhs as well, otherwise the actual subtype might -- not be constructible. If the discriminants have defaults the type -- is unconstrained and there is nothing to check. elsif Has_Unknown_Discriminants (Base_Type (Etype (Lhs))) and then Has_Discriminants (Typ) and then not Has_Defaulted_Discriminants (Typ) then Rewrite (Rhs, OK_Convert_To (Base_Type (Typ), Rhs)); Rewrite (Lhs, OK_Convert_To (Base_Type (Typ), Lhs)); Apply_Discriminant_Check (Rhs, Typ, Lhs); -- In the access type case, we need the same discriminant check, and -- also range checks if we have an access to constrained array. elsif Is_Access_Type (Etype (Lhs)) and then Is_Constrained (Designated_Type (Etype (Lhs))) then if Has_Discriminants (Designated_Type (Etype (Lhs))) then -- Skip discriminant check if change of representation. Will be -- done when the change of representation is expanded out. if not Crep then Apply_Discriminant_Check (Rhs, Etype (Lhs)); end if; elsif Is_Array_Type (Designated_Type (Etype (Lhs))) then Apply_Range_Check (Rhs, Etype (Lhs)); if Is_Constrained (Etype (Lhs)) then Apply_Length_Check (Rhs, Etype (Lhs)); end if; if Nkind (Rhs) = N_Allocator then declare Target_Typ : constant Entity_Id := Etype (Expression (Rhs)); C_Es : Check_Result; begin C_Es := Get_Range_Checks (Lhs, Target_Typ, Etype (Designated_Type (Etype (Lhs)))); Insert_Range_Checks (C_Es, N, Target_Typ, Sloc (Lhs), Lhs); end; end if; end if; -- Apply range check for access type case elsif Is_Access_Type (Etype (Lhs)) and then Nkind (Rhs) = N_Allocator and then Nkind (Expression (Rhs)) = N_Qualified_Expression then Analyze_And_Resolve (Expression (Rhs)); Apply_Range_Check (Expression (Rhs), Designated_Type (Etype (Lhs))); end if; -- Ada 2005 (AI-231): Generate the run-time check if Is_Access_Type (Typ) and then Can_Never_Be_Null (Etype (Lhs)) and then not Can_Never_Be_Null (Etype (Rhs)) -- If an actual is an out parameter of a null-excluding access -- type, there is access check on entry, so we set the flag -- Suppress_Assignment_Checks on the generated statement to -- assign the actual to the parameter block, and we do not want -- to generate an additional check at this point. and then not Suppress_Assignment_Checks (N) then Apply_Constraint_Check (Rhs, Etype (Lhs)); end if; -- Ada 2012 (AI05-148): Update current accessibility level if Rhs is a -- stand-alone obj of an anonymous access type. Do not install the check -- when the Lhs denotes a container cursor and the Next function employs -- an access type, because this can never result in a dangling pointer. if Is_Access_Type (Typ) and then Is_Entity_Name (Lhs) and then Ekind (Entity (Lhs)) /= E_Loop_Parameter and then Present (Effective_Extra_Accessibility (Entity (Lhs))) then declare function Lhs_Entity return Entity_Id; -- Look through renames to find the underlying entity. -- For assignment to a rename, we don't care about the -- Enclosing_Dynamic_Scope of the rename declaration. ---------------- -- Lhs_Entity -- ---------------- function Lhs_Entity return Entity_Id is Result : Entity_Id := Entity (Lhs); begin while Present (Renamed_Object (Result)) loop -- Renamed_Object must return an Entity_Name here -- because of preceding "Present (E_E_A (...))" test. Result := Entity (Renamed_Object (Result)); end loop; return Result; end Lhs_Entity; -- Local Declarations Access_Check : constant Node_Id := Make_Raise_Program_Error (Loc, Condition => Make_Op_Gt (Loc, Left_Opnd => Dynamic_Accessibility_Level (Rhs), Right_Opnd => Make_Integer_Literal (Loc, Intval => Scope_Depth (Enclosing_Dynamic_Scope (Lhs_Entity)))), Reason => PE_Accessibility_Check_Failed); Access_Level_Update : constant Node_Id := Make_Assignment_Statement (Loc, Name => New_Occurrence_Of (Effective_Extra_Accessibility (Entity (Lhs)), Loc), Expression => Dynamic_Accessibility_Level (Rhs)); begin if not Accessibility_Checks_Suppressed (Entity (Lhs)) then Insert_Action (N, Access_Check); end if; Insert_Action (N, Access_Level_Update); end; end if; -- Case of assignment to a bit packed array element. If there is a -- change of representation this must be expanded into components, -- otherwise this is a bit-field assignment. if Nkind (Lhs) = N_Indexed_Component and then Is_Bit_Packed_Array (Etype (Prefix (Lhs))) then -- Normal case, no change of representation if not Crep then Expand_Bit_Packed_Element_Set (N); return; -- Change of representation case else -- Generate the following, to force component-by-component -- assignments in an efficient way. Otherwise each component -- will require a temporary and two bit-field manipulations. -- T1 : Elmt_Type; -- T1 := RhS; -- Lhs := T1; declare Tnn : constant Entity_Id := Make_Temporary (Loc, 'T'); Stats : List_Id; begin Stats := New_List ( Make_Object_Declaration (Loc, Defining_Identifier => Tnn, Object_Definition => New_Occurrence_Of (Etype (Lhs), Loc)), Make_Assignment_Statement (Loc, Name => New_Occurrence_Of (Tnn, Loc), Expression => Relocate_Node (Rhs)), Make_Assignment_Statement (Loc, Name => Relocate_Node (Lhs), Expression => New_Occurrence_Of (Tnn, Loc))); Insert_Actions (N, Stats); Rewrite (N, Make_Null_Statement (Loc)); Analyze (N); end; end if; -- Build-in-place function call case. Note that we're not yet doing -- build-in-place for user-written assignment statements (the assignment -- here came from an aggregate.) elsif Ada_Version >= Ada_2005 and then Is_Build_In_Place_Function_Call (Rhs) then Make_Build_In_Place_Call_In_Assignment (N, Rhs); elsif Is_Tagged_Type (Typ) or else (Needs_Finalization (Typ) and then not Is_Array_Type (Typ)) then Tagged_Case : declare L : List_Id := No_List; Expand_Ctrl_Actions : constant Boolean := not No_Ctrl_Actions (N); begin -- In the controlled case, we ensure that function calls are -- evaluated before finalizing the target. In all cases, it makes -- the expansion easier if the side effects are removed first. Remove_Side_Effects (Lhs); Remove_Side_Effects (Rhs); -- Avoid recursion in the mechanism Set_Analyzed (N); -- If dispatching assignment, we need to dispatch to _assign if Is_Class_Wide_Type (Typ) -- If the type is tagged, we may as well use the predefined -- primitive assignment. This avoids inlining a lot of code -- and in the class-wide case, the assignment is replaced -- by a dispatching call to _assign. It is suppressed in the -- case of assignments created by the expander that correspond -- to initializations, where we do want to copy the tag -- (Expand_Ctrl_Actions flag is set False in this case). It is -- also suppressed if restriction No_Dispatching_Calls is in -- force because in that case predefined primitives are not -- generated. or else (Is_Tagged_Type (Typ) and then Chars (Current_Scope) /= Name_uAssign and then Expand_Ctrl_Actions and then not Restriction_Active (No_Dispatching_Calls)) then if Is_Limited_Type (Typ) then -- This can happen in an instance when the formal is an -- extension of a limited interface, and the actual is -- limited. This is an error according to AI05-0087, but -- is not caught at the point of instantiation in earlier -- versions. -- This is wrong, error messages cannot be issued during -- expansion, since they would be missed in -gnatc mode ??? Error_Msg_N ("assignment not available on limited type", N); return; end if; -- Fetch the primitive op _assign and proper type to call it. -- Because of possible conflicts between private and full view, -- fetch the proper type directly from the operation profile. declare Op : constant Entity_Id := Find_Prim_Op (Typ, Name_uAssign); F_Typ : Entity_Id := Etype (First_Formal (Op)); begin -- If the assignment is dispatching, make sure to use the -- proper type. if Is_Class_Wide_Type (Typ) then F_Typ := Class_Wide_Type (F_Typ); end if; L := New_List; -- In case of assignment to a class-wide tagged type, before -- the assignment we generate run-time check to ensure that -- the tags of source and target match. if not Tag_Checks_Suppressed (Typ) and then Is_Class_Wide_Type (Typ) and then Is_Tagged_Type (Typ) and then Is_Tagged_Type (Underlying_Type (Etype (Rhs))) then declare Lhs_Tag : Node_Id; Rhs_Tag : Node_Id; begin if not Is_Interface (Typ) then Lhs_Tag := Make_Selected_Component (Loc, Prefix => Duplicate_Subexpr (Lhs), Selector_Name => Make_Identifier (Loc, Name_uTag)); Rhs_Tag := Make_Selected_Component (Loc, Prefix => Duplicate_Subexpr (Rhs), Selector_Name => Make_Identifier (Loc, Name_uTag)); else -- Displace the pointer to the base of the objects -- applying 'Address, which is later expanded into -- a call to RE_Base_Address. Lhs_Tag := Make_Explicit_Dereference (Loc, Prefix => Unchecked_Convert_To (RTE (RE_Tag_Ptr), Make_Attribute_Reference (Loc, Prefix => Duplicate_Subexpr (Lhs), Attribute_Name => Name_Address))); Rhs_Tag := Make_Explicit_Dereference (Loc, Prefix => Unchecked_Convert_To (RTE (RE_Tag_Ptr), Make_Attribute_Reference (Loc, Prefix => Duplicate_Subexpr (Rhs), Attribute_Name => Name_Address))); end if; Append_To (L, Make_Raise_Constraint_Error (Loc, Condition => Make_Op_Ne (Loc, Left_Opnd => Lhs_Tag, Right_Opnd => Rhs_Tag), Reason => CE_Tag_Check_Failed)); end; end if; declare Left_N : Node_Id := Duplicate_Subexpr (Lhs); Right_N : Node_Id := Duplicate_Subexpr (Rhs); begin -- In order to dispatch the call to _assign the type of -- the actuals must match. Add conversion (if required). if Etype (Lhs) /= F_Typ then Left_N := Unchecked_Convert_To (F_Typ, Left_N); end if; if Etype (Rhs) /= F_Typ then Right_N := Unchecked_Convert_To (F_Typ, Right_N); end if; Append_To (L, Make_Procedure_Call_Statement (Loc, Name => New_Occurrence_Of (Op, Loc), Parameter_Associations => New_List ( Node1 => Left_N, Node2 => Right_N))); end; end; else L := Make_Tag_Ctrl_Assignment (N); -- We can't afford to have destructive Finalization Actions in -- the Self assignment case, so if the target and the source -- are not obviously different, code is generated to avoid the -- self assignment case: -- if lhs'address /= rhs'address then -- <code for controlled and/or tagged assignment> -- end if; -- Skip this if Restriction (No_Finalization) is active if not Statically_Different (Lhs, Rhs) and then Expand_Ctrl_Actions and then not Restriction_Active (No_Finalization) then L := New_List ( Make_Implicit_If_Statement (N, Condition => Make_Op_Ne (Loc, Left_Opnd => Make_Attribute_Reference (Loc, Prefix => Duplicate_Subexpr (Lhs), Attribute_Name => Name_Address), Right_Opnd => Make_Attribute_Reference (Loc, Prefix => Duplicate_Subexpr (Rhs), Attribute_Name => Name_Address)), Then_Statements => L)); end if; -- We need to set up an exception handler for implementing -- 7.6.1(18). The remaining adjustments are tackled by the -- implementation of adjust for record_controllers (see -- s-finimp.adb). -- This is skipped if we have no finalization if Expand_Ctrl_Actions and then not Restriction_Active (No_Finalization) then L := New_List ( Make_Block_Statement (Loc, Handled_Statement_Sequence => Make_Handled_Sequence_Of_Statements (Loc, Statements => L, Exception_Handlers => New_List ( Make_Handler_For_Ctrl_Operation (Loc))))); end if; end if; Rewrite (N, Make_Block_Statement (Loc, Handled_Statement_Sequence => Make_Handled_Sequence_Of_Statements (Loc, Statements => L))); -- If no restrictions on aborts, protect the whole assignment -- for controlled objects as per 9.8(11). if Needs_Finalization (Typ) and then Expand_Ctrl_Actions and then Abort_Allowed then declare Blk : constant Entity_Id := New_Internal_Entity (E_Block, Current_Scope, Sloc (N), 'B'); AUD : constant Entity_Id := RTE (RE_Abort_Undefer_Direct); begin Set_Is_Abort_Block (N); Set_Scope (Blk, Current_Scope); Set_Etype (Blk, Standard_Void_Type); Set_Identifier (N, New_Occurrence_Of (Blk, Sloc (N))); Prepend_To (L, Build_Runtime_Call (Loc, RE_Abort_Defer)); Set_At_End_Proc (Handled_Statement_Sequence (N), New_Occurrence_Of (AUD, Loc)); -- Present the Abort_Undefer_Direct function to the backend -- so that it can inline the call to the function. Add_Inlined_Body (AUD, N); Expand_At_End_Handler (Handled_Statement_Sequence (N), Blk); end; end if; -- N has been rewritten to a block statement for which it is -- known by construction that no checks are necessary: analyze -- it with all checks suppressed. Analyze (N, Suppress => All_Checks); return; end Tagged_Case; -- Array types elsif Is_Array_Type (Typ) then declare Actual_Rhs : Node_Id := Rhs; begin while Nkind_In (Actual_Rhs, N_Type_Conversion, N_Qualified_Expression) loop Actual_Rhs := Expression (Actual_Rhs); end loop; Expand_Assign_Array (N, Actual_Rhs); return; end; -- Record types elsif Is_Record_Type (Typ) then Expand_Assign_Record (N); return; -- Scalar types. This is where we perform the processing related to the -- requirements of (RM 13.9.1(9-11)) concerning the handling of invalid -- scalar values. elsif Is_Scalar_Type (Typ) then -- Case where right side is known valid if Expr_Known_Valid (Rhs) then -- Here the right side is valid, so it is fine. The case to deal -- with is when the left side is a local variable reference whose -- value is not currently known to be valid. If this is the case, -- and the assignment appears in an unconditional context, then -- we can mark the left side as now being valid if one of these -- conditions holds: -- The expression of the right side has Do_Range_Check set so -- that we know a range check will be performed. Note that it -- can be the case that a range check is omitted because we -- make the assumption that we can assume validity for operands -- appearing in the right side in determining whether a range -- check is required -- The subtype of the right side matches the subtype of the -- left side. In this case, even though we have not checked -- the range of the right side, we know it is in range of its -- subtype if the expression is valid. if Is_Local_Variable_Reference (Lhs) and then not Is_Known_Valid (Entity (Lhs)) and then In_Unconditional_Context (N) then if Do_Range_Check (Rhs) or else Etype (Lhs) = Etype (Rhs) then Set_Is_Known_Valid (Entity (Lhs), True); end if; end if; -- Case where right side may be invalid in the sense of the RM -- reference above. The RM does not require that we check for the -- validity on an assignment, but it does require that the assignment -- of an invalid value not cause erroneous behavior. -- The general approach in GNAT is to use the Is_Known_Valid flag -- to avoid the need for validity checking on assignments. However -- in some cases, we have to do validity checking in order to make -- sure that the setting of this flag is correct. else -- Validate right side if we are validating copies if Validity_Checks_On and then Validity_Check_Copies then -- Skip this if left-hand side is an array or record component -- and elementary component validity checks are suppressed. if Nkind_In (Lhs, N_Selected_Component, N_Indexed_Component) and then not Validity_Check_Components then null; else Ensure_Valid (Rhs); end if; -- We can propagate this to the left side where appropriate if Is_Local_Variable_Reference (Lhs) and then not Is_Known_Valid (Entity (Lhs)) and then In_Unconditional_Context (N) then Set_Is_Known_Valid (Entity (Lhs), True); end if; -- Otherwise check to see what should be done -- If left side is a local variable, then we just set its flag to -- indicate that its value may no longer be valid, since we are -- copying a potentially invalid value. elsif Is_Local_Variable_Reference (Lhs) then Set_Is_Known_Valid (Entity (Lhs), False); -- Check for case of a nonlocal variable on the left side which -- is currently known to be valid. In this case, we simply ensure -- that the right side is valid. We only play the game of copying -- validity status for local variables, since we are doing this -- statically, not by tracing the full flow graph. elsif Is_Entity_Name (Lhs) and then Is_Known_Valid (Entity (Lhs)) then -- Note: If Validity_Checking mode is set to none, we ignore -- the Ensure_Valid call so don't worry about that case here. Ensure_Valid (Rhs); -- In all other cases, we can safely copy an invalid value without -- worrying about the status of the left side. Since it is not a -- variable reference it will not be considered -- as being known to be valid in any case. else null; end if; end if; end if; exception when RE_Not_Available => return; end Expand_N_Assignment_Statement; ------------------------------ -- Expand_N_Block_Statement -- ------------------------------ -- Encode entity names defined in block statement procedure Expand_N_Block_Statement (N : Node_Id) is begin Qualify_Entity_Names (N); end Expand_N_Block_Statement; ----------------------------- -- Expand_N_Case_Statement -- ----------------------------- procedure Expand_N_Case_Statement (N : Node_Id) is Loc : constant Source_Ptr := Sloc (N); Expr : constant Node_Id := Expression (N); Alt : Node_Id; Len : Nat; Cond : Node_Id; Choice : Node_Id; Chlist : List_Id; begin -- Check for the situation where we know at compile time which branch -- will be taken. -- If the value is static but its subtype is predicated and the value -- does not obey the predicate, the value is marked non-static, and -- there can be no corresponding static alternative. In that case we -- replace the case statement with an exception, regardless of whether -- assertions are enabled or not, unless predicates are ignored. if Compile_Time_Known_Value (Expr) and then Has_Predicates (Etype (Expr)) and then not Predicates_Ignored (Etype (Expr)) and then not Is_OK_Static_Expression (Expr) then Rewrite (N, Make_Raise_Constraint_Error (Loc, Reason => CE_Invalid_Data)); Analyze (N); return; elsif Compile_Time_Known_Value (Expr) and then (not Has_Predicates (Etype (Expr)) or else Is_Static_Expression (Expr)) then Alt := Find_Static_Alternative (N); -- Do not consider controlled objects found in a case statement which -- actually models a case expression because their early finalization -- will affect the result of the expression. if not From_Conditional_Expression (N) then Process_Statements_For_Controlled_Objects (Alt); end if; -- Move statements from this alternative after the case statement. -- They are already analyzed, so will be skipped by the analyzer. Insert_List_After (N, Statements (Alt)); -- That leaves the case statement as a shell. So now we can kill all -- other alternatives in the case statement. Kill_Dead_Code (Expression (N)); declare Dead_Alt : Node_Id; begin -- Loop through case alternatives, skipping pragmas, and skipping -- the one alternative that we select (and therefore retain). Dead_Alt := First (Alternatives (N)); while Present (Dead_Alt) loop if Dead_Alt /= Alt and then Nkind (Dead_Alt) = N_Case_Statement_Alternative then Kill_Dead_Code (Statements (Dead_Alt), Warn_On_Deleted_Code); end if; Next (Dead_Alt); end loop; end; Rewrite (N, Make_Null_Statement (Loc)); return; end if; -- Here if the choice is not determined at compile time declare Last_Alt : constant Node_Id := Last (Alternatives (N)); Others_Present : Boolean; Others_Node : Node_Id; Then_Stms : List_Id; Else_Stms : List_Id; begin if Nkind (First (Discrete_Choices (Last_Alt))) = N_Others_Choice then Others_Present := True; Others_Node := Last_Alt; else Others_Present := False; end if; -- First step is to worry about possible invalid argument. The RM -- requires (RM 5.4(13)) that if the result is invalid (e.g. it is -- outside the base range), then Constraint_Error must be raised. -- Case of validity check required (validity checks are on, the -- expression is not known to be valid, and the case statement -- comes from source -- no need to validity check internally -- generated case statements). if Validity_Check_Default and then not Predicates_Ignored (Etype (Expr)) then Ensure_Valid (Expr); end if; -- If there is only a single alternative, just replace it with the -- sequence of statements since obviously that is what is going to -- be executed in all cases. Len := List_Length (Alternatives (N)); if Len = 1 then -- We still need to evaluate the expression if it has any side -- effects. Remove_Side_Effects (Expression (N)); Alt := First (Alternatives (N)); -- Do not consider controlled objects found in a case statement -- which actually models a case expression because their early -- finalization will affect the result of the expression. if not From_Conditional_Expression (N) then Process_Statements_For_Controlled_Objects (Alt); end if; Insert_List_After (N, Statements (Alt)); -- That leaves the case statement as a shell. The alternative that -- will be executed is reset to a null list. So now we can kill -- the entire case statement. Kill_Dead_Code (Expression (N)); Rewrite (N, Make_Null_Statement (Loc)); return; -- An optimization. If there are only two alternatives, and only -- a single choice, then rewrite the whole case statement as an -- if statement, since this can result in subsequent optimizations. -- This helps not only with case statements in the source of a -- simple form, but also with generated code (discriminant check -- functions in particular). -- Note: it is OK to do this before expanding out choices for any -- static predicates, since the if statement processing will handle -- the static predicate case fine. elsif Len = 2 then Chlist := Discrete_Choices (First (Alternatives (N))); if List_Length (Chlist) = 1 then Choice := First (Chlist); Then_Stms := Statements (First (Alternatives (N))); Else_Stms := Statements (Last (Alternatives (N))); -- For TRUE, generate "expression", not expression = true if Nkind (Choice) = N_Identifier and then Entity (Choice) = Standard_True then Cond := Expression (N); -- For FALSE, generate "expression" and switch then/else elsif Nkind (Choice) = N_Identifier and then Entity (Choice) = Standard_False then Cond := Expression (N); Else_Stms := Statements (First (Alternatives (N))); Then_Stms := Statements (Last (Alternatives (N))); -- For a range, generate "expression in range" elsif Nkind (Choice) = N_Range or else (Nkind (Choice) = N_Attribute_Reference and then Attribute_Name (Choice) = Name_Range) or else (Is_Entity_Name (Choice) and then Is_Type (Entity (Choice))) then Cond := Make_In (Loc, Left_Opnd => Expression (N), Right_Opnd => Relocate_Node (Choice)); -- A subtype indication is not a legal operator in a membership -- test, so retrieve its range. elsif Nkind (Choice) = N_Subtype_Indication then Cond := Make_In (Loc, Left_Opnd => Expression (N), Right_Opnd => Relocate_Node (Range_Expression (Constraint (Choice)))); -- For any other subexpression "expression = value" else Cond := Make_Op_Eq (Loc, Left_Opnd => Expression (N), Right_Opnd => Relocate_Node (Choice)); end if; -- Now rewrite the case as an IF Rewrite (N, Make_If_Statement (Loc, Condition => Cond, Then_Statements => Then_Stms, Else_Statements => Else_Stms)); Analyze (N); return; end if; end if; -- If the last alternative is not an Others choice, replace it with -- an N_Others_Choice. Note that we do not bother to call Analyze on -- the modified case statement, since it's only effect would be to -- compute the contents of the Others_Discrete_Choices which is not -- needed by the back end anyway. -- The reason for this is that the back end always needs some default -- for a switch, so if we have not supplied one in the processing -- above for validity checking, then we need to supply one here. if not Others_Present then Others_Node := Make_Others_Choice (Sloc (Last_Alt)); -- If Predicates_Ignored is true the value does not satisfy the -- predicate, and there is no Others choice, Constraint_Error -- must be raised (4.5.7 (21/3)). if Predicates_Ignored (Etype (Expr)) then declare Except : constant Node_Id := Make_Raise_Constraint_Error (Loc, Reason => CE_Invalid_Data); New_Alt : constant Node_Id := Make_Case_Statement_Alternative (Loc, Discrete_Choices => New_List ( Make_Others_Choice (Loc)), Statements => New_List (Except)); begin Append (New_Alt, Alternatives (N)); Analyze_And_Resolve (Except); end; else Set_Others_Discrete_Choices (Others_Node, Discrete_Choices (Last_Alt)); Set_Discrete_Choices (Last_Alt, New_List (Others_Node)); end if; end if; -- Deal with possible declarations of controlled objects, and also -- with rewriting choice sequences for static predicate references. Alt := First_Non_Pragma (Alternatives (N)); while Present (Alt) loop -- Do not consider controlled objects found in a case statement -- which actually models a case expression because their early -- finalization will affect the result of the expression. if not From_Conditional_Expression (N) then Process_Statements_For_Controlled_Objects (Alt); end if; if Has_SP_Choice (Alt) then Expand_Static_Predicates_In_Choices (Alt); end if; Next_Non_Pragma (Alt); end loop; end; end Expand_N_Case_Statement; ----------------------------- -- Expand_N_Exit_Statement -- ----------------------------- -- The only processing required is to deal with a possible C/Fortran -- boolean value used as the condition for the exit statement. procedure Expand_N_Exit_Statement (N : Node_Id) is begin Adjust_Condition (Condition (N)); end Expand_N_Exit_Statement; ---------------------------------- -- Expand_Formal_Container_Loop -- ---------------------------------- procedure Expand_Formal_Container_Loop (N : Node_Id) is Loc : constant Source_Ptr := Sloc (N); Isc : constant Node_Id := Iteration_Scheme (N); I_Spec : constant Node_Id := Iterator_Specification (Isc); Cursor : constant Entity_Id := Defining_Identifier (I_Spec); Container : constant Node_Id := Entity (Name (I_Spec)); Stats : constant List_Id := Statements (N); Advance : Node_Id; Blk_Nod : Node_Id; Init : Node_Id; New_Loop : Node_Id; begin -- The expansion resembles the one for Ada containers, but the -- primitives mention the domain of iteration explicitly, and -- function First applied to the container yields a cursor directly. -- Cursor : Cursor_type := First (Container); -- while Has_Element (Cursor, Container) loop -- <original loop statements> -- Cursor := Next (Container, Cursor); -- end loop; Build_Formal_Container_Iteration (N, Container, Cursor, Init, Advance, New_Loop); Set_Ekind (Cursor, E_Variable); Append_To (Stats, Advance); -- Build block to capture declaration of cursor entity. Blk_Nod := Make_Block_Statement (Loc, Declarations => New_List (Init), Handled_Statement_Sequence => Make_Handled_Sequence_Of_Statements (Loc, Statements => New_List (New_Loop))); Rewrite (N, Blk_Nod); Analyze (N); end Expand_Formal_Container_Loop; ------------------------------------------ -- Expand_Formal_Container_Element_Loop -- ------------------------------------------ procedure Expand_Formal_Container_Element_Loop (N : Node_Id) is Loc : constant Source_Ptr := Sloc (N); Isc : constant Node_Id := Iteration_Scheme (N); I_Spec : constant Node_Id := Iterator_Specification (Isc); Element : constant Entity_Id := Defining_Identifier (I_Spec); Container : constant Node_Id := Entity (Name (I_Spec)); Container_Typ : constant Entity_Id := Base_Type (Etype (Container)); Stats : constant List_Id := Statements (N); Cursor : constant Entity_Id := Make_Defining_Identifier (Loc, Chars => New_External_Name (Chars (Element), 'C')); Elmt_Decl : Node_Id; Elmt_Ref : Node_Id; Element_Op : constant Entity_Id := Get_Iterable_Type_Primitive (Container_Typ, Name_Element); Advance : Node_Id; Init : Node_Id; New_Loop : Node_Id; begin -- For an element iterator, the Element aspect must be present, -- (this is checked during analysis) and the expansion takes the form: -- Cursor : Cursor_Type := First (Container); -- Elmt : Element_Type; -- while Has_Element (Cursor, Container) loop -- Elmt := Element (Container, Cursor); -- <original loop statements> -- Cursor := Next (Container, Cursor); -- end loop; -- However this expansion is not legal if the element is indefinite. -- In that case we create a block to hold a variable declaration -- initialized with a call to Element, and generate: -- Cursor : Cursor_Type := First (Container); -- while Has_Element (Cursor, Container) loop -- declare -- Elmt : Element_Type := Element (Container, Cursor); -- begin -- <original loop statements> -- Cursor := Next (Container, Cursor); -- end; -- end loop; Build_Formal_Container_Iteration (N, Container, Cursor, Init, Advance, New_Loop); Append_To (Stats, Advance); Set_Ekind (Cursor, E_Variable); Insert_Action (N, Init); -- Declaration for Element Elmt_Decl := Make_Object_Declaration (Loc, Defining_Identifier => Element, Object_Definition => New_Occurrence_Of (Etype (Element_Op), Loc)); if not Is_Constrained (Etype (Element_Op)) then Set_Expression (Elmt_Decl, Make_Function_Call (Loc, Name => New_Occurrence_Of (Element_Op, Loc), Parameter_Associations => New_List ( New_Occurrence_Of (Container, Loc), New_Occurrence_Of (Cursor, Loc)))); Set_Statements (New_Loop, New_List (Make_Block_Statement (Loc, Declarations => New_List (Elmt_Decl), Handled_Statement_Sequence => Make_Handled_Sequence_Of_Statements (Loc, Statements => Stats)))); else Elmt_Ref := Make_Assignment_Statement (Loc, Name => New_Occurrence_Of (Element, Loc), Expression => Make_Function_Call (Loc, Name => New_Occurrence_Of (Element_Op, Loc), Parameter_Associations => New_List ( New_Occurrence_Of (Container, Loc), New_Occurrence_Of (Cursor, Loc)))); Prepend (Elmt_Ref, Stats); -- The element is assignable in the expanded code Set_Assignment_OK (Name (Elmt_Ref)); -- The loop is rewritten as a block, to hold the element declaration New_Loop := Make_Block_Statement (Loc, Declarations => New_List (Elmt_Decl), Handled_Statement_Sequence => Make_Handled_Sequence_Of_Statements (Loc, Statements => New_List (New_Loop))); end if; -- The element is only modified in expanded code, so it appears as -- unassigned to the warning machinery. We must suppress this spurious -- warning explicitly. Set_Warnings_Off (Element); Rewrite (N, New_Loop); -- The loop parameter is declared by an object declaration, but within -- the loop we must prevent user assignments to it, so we analyze the -- declaration and reset the entity kind, before analyzing the rest of -- the loop; Analyze (Elmt_Decl); Set_Ekind (Defining_Identifier (Elmt_Decl), E_Loop_Parameter); Analyze (N); end Expand_Formal_Container_Element_Loop; ----------------------------- -- Expand_N_Goto_Statement -- ----------------------------- -- Add poll before goto if polling active procedure Expand_N_Goto_Statement (N : Node_Id) is begin Generate_Poll_Call (N); end Expand_N_Goto_Statement; --------------------------- -- Expand_N_If_Statement -- --------------------------- -- First we deal with the case of C and Fortran convention boolean values, -- with zero/non-zero semantics. -- Second, we deal with the obvious rewriting for the cases where the -- condition of the IF is known at compile time to be True or False. -- Third, we remove elsif parts which have non-empty Condition_Actions and -- rewrite as independent if statements. For example: -- if x then xs -- elsif y then ys -- ... -- end if; -- becomes -- -- if x then xs -- else -- <<condition actions of y>> -- if y then ys -- ... -- end if; -- end if; -- This rewriting is needed if at least one elsif part has a non-empty -- Condition_Actions list. We also do the same processing if there is a -- constant condition in an elsif part (in conjunction with the first -- processing step mentioned above, for the recursive call made to deal -- with the created inner if, this deals with properly optimizing the -- cases of constant elsif conditions). procedure Expand_N_If_Statement (N : Node_Id) is Loc : constant Source_Ptr := Sloc (N); Hed : Node_Id; E : Node_Id; New_If : Node_Id; Warn_If_Deleted : constant Boolean := Warn_On_Deleted_Code and then Comes_From_Source (N); -- Indicates whether we want warnings when we delete branches of the -- if statement based on constant condition analysis. We never want -- these warnings for expander generated code. begin -- Do not consider controlled objects found in an if statement which -- actually models an if expression because their early finalization -- will affect the result of the expression. if not From_Conditional_Expression (N) then Process_Statements_For_Controlled_Objects (N); end if; Adjust_Condition (Condition (N)); -- The following loop deals with constant conditions for the IF. We -- need a loop because as we eliminate False conditions, we grab the -- first elsif condition and use it as the primary condition. while Compile_Time_Known_Value (Condition (N)) loop -- If condition is True, we can simply rewrite the if statement now -- by replacing it by the series of then statements. if Is_True (Expr_Value (Condition (N))) then -- All the else parts can be killed Kill_Dead_Code (Elsif_Parts (N), Warn_If_Deleted); Kill_Dead_Code (Else_Statements (N), Warn_If_Deleted); Hed := Remove_Head (Then_Statements (N)); Insert_List_After (N, Then_Statements (N)); Rewrite (N, Hed); return; -- If condition is False, then we can delete the condition and -- the Then statements else -- We do not delete the condition if constant condition warnings -- are enabled, since otherwise we end up deleting the desired -- warning. Of course the backend will get rid of this True/False -- test anyway, so nothing is lost here. if not Constant_Condition_Warnings then Kill_Dead_Code (Condition (N)); end if; Kill_Dead_Code (Then_Statements (N), Warn_If_Deleted); -- If there are no elsif statements, then we simply replace the -- entire if statement by the sequence of else statements. if No (Elsif_Parts (N)) then if No (Else_Statements (N)) or else Is_Empty_List (Else_Statements (N)) then Rewrite (N, Make_Null_Statement (Sloc (N))); else Hed := Remove_Head (Else_Statements (N)); Insert_List_After (N, Else_Statements (N)); Rewrite (N, Hed); end if; return; -- If there are elsif statements, the first of them becomes the -- if/then section of the rebuilt if statement This is the case -- where we loop to reprocess this copied condition. else Hed := Remove_Head (Elsif_Parts (N)); Insert_Actions (N, Condition_Actions (Hed)); Set_Condition (N, Condition (Hed)); Set_Then_Statements (N, Then_Statements (Hed)); -- Hed might have been captured as the condition determining -- the current value for an entity. Now it is detached from -- the tree, so a Current_Value pointer in the condition might -- need to be updated. Set_Current_Value_Condition (N); if Is_Empty_List (Elsif_Parts (N)) then Set_Elsif_Parts (N, No_List); end if; end if; end if; end loop; -- Loop through elsif parts, dealing with constant conditions and -- possible condition actions that are present. if Present (Elsif_Parts (N)) then E := First (Elsif_Parts (N)); while Present (E) loop -- Do not consider controlled objects found in an if statement -- which actually models an if expression because their early -- finalization will affect the result of the expression. if not From_Conditional_Expression (N) then Process_Statements_For_Controlled_Objects (E); end if; Adjust_Condition (Condition (E)); -- If there are condition actions, then rewrite the if statement -- as indicated above. We also do the same rewrite for a True or -- False condition. The further processing of this constant -- condition is then done by the recursive call to expand the -- newly created if statement if Present (Condition_Actions (E)) or else Compile_Time_Known_Value (Condition (E)) then New_If := Make_If_Statement (Sloc (E), Condition => Condition (E), Then_Statements => Then_Statements (E), Elsif_Parts => No_List, Else_Statements => Else_Statements (N)); -- Elsif parts for new if come from remaining elsif's of parent while Present (Next (E)) loop if No (Elsif_Parts (New_If)) then Set_Elsif_Parts (New_If, New_List); end if; Append (Remove_Next (E), Elsif_Parts (New_If)); end loop; Set_Else_Statements (N, New_List (New_If)); if Present (Condition_Actions (E)) then Insert_List_Before (New_If, Condition_Actions (E)); end if; Remove (E); if Is_Empty_List (Elsif_Parts (N)) then Set_Elsif_Parts (N, No_List); end if; Analyze (New_If); -- Note this is not an implicit if statement, since it is part -- of an explicit if statement in the source (or of an implicit -- if statement that has already been tested). We set the flag -- after calling Analyze to avoid generating extra warnings -- specific to pure if statements, however (see -- Sem_Ch5.Analyze_If_Statement). Set_Comes_From_Source (New_If, Comes_From_Source (N)); return; -- No special processing for that elsif part, move to next else Next (E); end if; end loop; end if; -- Some more optimizations applicable if we still have an IF statement if Nkind (N) /= N_If_Statement then return; end if; -- Another optimization, special cases that can be simplified -- if expression then -- return true; -- else -- return false; -- end if; -- can be changed to: -- return expression; -- and -- if expression then -- return false; -- else -- return true; -- end if; -- can be changed to: -- return not (expression); -- Only do these optimizations if we are at least at -O1 level and -- do not do them if control flow optimizations are suppressed. if Optimization_Level > 0 and then not Opt.Suppress_Control_Flow_Optimizations then if Nkind (N) = N_If_Statement and then No (Elsif_Parts (N)) and then Present (Else_Statements (N)) and then List_Length (Then_Statements (N)) = 1 and then List_Length (Else_Statements (N)) = 1 then declare Then_Stm : constant Node_Id := First (Then_Statements (N)); Else_Stm : constant Node_Id := First (Else_Statements (N)); begin if Nkind (Then_Stm) = N_Simple_Return_Statement and then Nkind (Else_Stm) = N_Simple_Return_Statement then declare Then_Expr : constant Node_Id := Expression (Then_Stm); Else_Expr : constant Node_Id := Expression (Else_Stm); begin if Nkind (Then_Expr) = N_Identifier and then Nkind (Else_Expr) = N_Identifier then if Entity (Then_Expr) = Standard_True and then Entity (Else_Expr) = Standard_False then Rewrite (N, Make_Simple_Return_Statement (Loc, Expression => Relocate_Node (Condition (N)))); Analyze (N); return; elsif Entity (Then_Expr) = Standard_False and then Entity (Else_Expr) = Standard_True then Rewrite (N, Make_Simple_Return_Statement (Loc, Expression => Make_Op_Not (Loc, Right_Opnd => Relocate_Node (Condition (N))))); Analyze (N); return; end if; end if; end; end if; end; end if; end if; end Expand_N_If_Statement; -------------------------- -- Expand_Iterator_Loop -- -------------------------- procedure Expand_Iterator_Loop (N : Node_Id) is Isc : constant Node_Id := Iteration_Scheme (N); I_Spec : constant Node_Id := Iterator_Specification (Isc); Container : constant Node_Id := Name (I_Spec); Container_Typ : constant Entity_Id := Base_Type (Etype (Container)); begin -- Processing for arrays if Is_Array_Type (Container_Typ) then pragma Assert (Of_Present (I_Spec)); Expand_Iterator_Loop_Over_Array (N); elsif Has_Aspect (Container_Typ, Aspect_Iterable) then if Of_Present (I_Spec) then Expand_Formal_Container_Element_Loop (N); else Expand_Formal_Container_Loop (N); end if; -- Processing for containers else Expand_Iterator_Loop_Over_Container (N, Isc, I_Spec, Container, Container_Typ); end if; end Expand_Iterator_Loop; ------------------------------------- -- Expand_Iterator_Loop_Over_Array -- ------------------------------------- procedure Expand_Iterator_Loop_Over_Array (N : Node_Id) is Isc : constant Node_Id := Iteration_Scheme (N); I_Spec : constant Node_Id := Iterator_Specification (Isc); Array_Node : constant Node_Id := Name (I_Spec); Array_Typ : constant Entity_Id := Base_Type (Etype (Array_Node)); Array_Dim : constant Pos := Number_Dimensions (Array_Typ); Id : constant Entity_Id := Defining_Identifier (I_Spec); Loc : constant Source_Ptr := Sloc (N); Stats : constant List_Id := Statements (N); Core_Loop : Node_Id; Dim1 : Int; Ind_Comp : Node_Id; Iterator : Entity_Id; -- Start of processing for Expand_Iterator_Loop_Over_Array begin -- for Element of Array loop -- It requires an internally generated cursor to iterate over the array pragma Assert (Of_Present (I_Spec)); Iterator := Make_Temporary (Loc, 'C'); -- Generate: -- Element : Component_Type renames Array (Iterator); -- Iterator is the index value, or a list of index values -- in the case of a multidimensional array. Ind_Comp := Make_Indexed_Component (Loc, Prefix => Relocate_Node (Array_Node), Expressions => New_List (New_Occurrence_Of (Iterator, Loc))); Prepend_To (Stats, Make_Object_Renaming_Declaration (Loc, Defining_Identifier => Id, Subtype_Mark => New_Occurrence_Of (Component_Type (Array_Typ), Loc), Name => Ind_Comp)); -- Mark the loop variable as needing debug info, so that expansion -- of the renaming will result in Materialize_Entity getting set via -- Debug_Renaming_Declaration. (This setting is needed here because -- the setting in Freeze_Entity comes after the expansion, which is -- too late. ???) Set_Debug_Info_Needed (Id); -- Generate: -- for Iterator in [reverse] Array'Range (Array_Dim) loop -- Element : Component_Type renames Array (Iterator); -- <original loop statements> -- end loop; -- If this is an iteration over a multidimensional array, the -- innermost loop is over the last dimension in Ada, and over -- the first dimension in Fortran. if Convention (Array_Typ) = Convention_Fortran then Dim1 := 1; else Dim1 := Array_Dim; end if; Core_Loop := Make_Loop_Statement (Loc, Iteration_Scheme => Make_Iteration_Scheme (Loc, Loop_Parameter_Specification => Make_Loop_Parameter_Specification (Loc, Defining_Identifier => Iterator, Discrete_Subtype_Definition => Make_Attribute_Reference (Loc, Prefix => Relocate_Node (Array_Node), Attribute_Name => Name_Range, Expressions => New_List ( Make_Integer_Literal (Loc, Dim1))), Reverse_Present => Reverse_Present (I_Spec))), Statements => Stats, End_Label => Empty); -- Processing for multidimensional array. The body of each loop is -- a loop over a previous dimension, going in decreasing order in Ada -- and in increasing order in Fortran. if Array_Dim > 1 then for Dim in 1 .. Array_Dim - 1 loop if Convention (Array_Typ) = Convention_Fortran then Dim1 := Dim + 1; else Dim1 := Array_Dim - Dim; end if; Iterator := Make_Temporary (Loc, 'C'); -- Generate the dimension loops starting from the innermost one -- for Iterator in [reverse] Array'Range (Array_Dim - Dim) loop -- <core loop> -- end loop; Core_Loop := Make_Loop_Statement (Loc, Iteration_Scheme => Make_Iteration_Scheme (Loc, Loop_Parameter_Specification => Make_Loop_Parameter_Specification (Loc, Defining_Identifier => Iterator, Discrete_Subtype_Definition => Make_Attribute_Reference (Loc, Prefix => Relocate_Node (Array_Node), Attribute_Name => Name_Range, Expressions => New_List ( Make_Integer_Literal (Loc, Dim1))), Reverse_Present => Reverse_Present (I_Spec))), Statements => New_List (Core_Loop), End_Label => Empty); -- Update the previously created object renaming declaration with -- the new iterator, by adding the index of the next loop to the -- indexed component, in the order that corresponds to the -- convention. if Convention (Array_Typ) = Convention_Fortran then Append_To (Expressions (Ind_Comp), New_Occurrence_Of (Iterator, Loc)); else Prepend_To (Expressions (Ind_Comp), New_Occurrence_Of (Iterator, Loc)); end if; end loop; end if; -- Inherit the loop identifier from the original loop. This ensures that -- the scope stack is consistent after the rewriting. if Present (Identifier (N)) then Set_Identifier (Core_Loop, Relocate_Node (Identifier (N))); end if; Rewrite (N, Core_Loop); Analyze (N); end Expand_Iterator_Loop_Over_Array; ----------------------------------------- -- Expand_Iterator_Loop_Over_Container -- ----------------------------------------- -- For a 'for ... in' loop, such as: -- for Cursor in Iterator_Function (...) loop -- ... -- end loop; -- we generate: -- Iter : Iterator_Type := Iterator_Function (...); -- Cursor : Cursor_type := First (Iter); -- or Last for "reverse" -- while Has_Element (Cursor) loop -- ... -- -- Cursor := Iter.Next (Cursor); -- or Prev for "reverse" -- end loop; -- For a 'for ... of' loop, such as: -- for X of Container loop -- ... -- end loop; -- the RM implies the generation of: -- Iter : Iterator_Type := Container.Iterate; -- the Default_Iterator -- Cursor : Cursor_Type := First (Iter); -- or Last for "reverse" -- while Has_Element (Cursor) loop -- declare -- X : Element_Type renames Element (Cursor).Element.all; -- -- or Constant_Element -- begin -- ... -- end; -- Cursor := Iter.Next (Cursor); -- or Prev for "reverse" -- end loop; -- In the general case, we do what the RM says. However, the operations -- Element and Iter.Next are slow, which is bad inside a loop, because they -- involve dispatching via interfaces, secondary stack manipulation, -- Busy/Lock incr/decr, and adjust/finalization/at-end handling. So for the -- predefined containers, we use an equivalent but optimized expansion. -- In the optimized case, we make use of these: -- procedure Next (Position : in out Cursor); -- instead of Iter.Next -- function Pseudo_Reference -- (Container : aliased Vector'Class) return Reference_Control_Type; -- type Element_Access is access all Element_Type; -- function Get_Element_Access -- (Position : Cursor) return not null Element_Access; -- Next is declared in the visible part of the container packages. -- The other three are added in the private part. (We're not supposed to -- pollute the namespace for clients. The compiler has no trouble breaking -- privacy to call things in the private part of an instance.) -- Source: -- for X of My_Vector loop -- X.Count := X.Count + 1; -- ... -- end loop; -- The compiler will generate: -- Iter : Reversible_Iterator'Class := Iterate (My_Vector); -- -- Reversible_Iterator is an interface. Iterate is the -- -- Default_Iterator aspect of Vector. This increments Lock, -- -- disallowing tampering with cursors. Unfortunately, it does not -- -- increment Busy. The result of Iterate is Limited_Controlled; -- -- finalization will decrement Lock. This is a build-in-place -- -- dispatching call to Iterate. -- Cur : Cursor := First (Iter); -- or Last -- -- Dispatching call via interface. -- Control : Reference_Control_Type := Pseudo_Reference (My_Vector); -- -- Pseudo_Reference increments Busy, to detect tampering with -- -- elements, as required by RM. Also redundantly increment -- -- Lock. Finalization of Control will decrement both Busy and -- -- Lock. Pseudo_Reference returns a record containing a pointer to -- -- My_Vector, used by Finalize. -- -- -- -- Control is not used below, except to finalize it -- it's purely -- -- an RAII thing. This is needed because we are eliminating the -- -- call to Reference within the loop. -- while Has_Element (Cur) loop -- declare -- X : My_Element renames Get_Element_Access (Cur).all; -- -- Get_Element_Access returns a pointer to the element -- -- designated by Cur. No dispatching here, and no horsing -- -- around with access discriminants. This is instead of the -- -- existing -- -- -- -- X : My_Element renames Reference (Cur).Element.all; -- -- -- -- which creates a controlled object. -- begin -- -- Any attempt to tamper with My_Vector here in the loop -- -- will correctly raise Program_Error, because of the -- -- Control. -- -- X.Count := X.Count + 1; -- ... -- -- Next (Cur); -- or Prev -- -- This is instead of "Cur := Next (Iter, Cur);" -- end; -- -- No finalization here -- end loop; -- Finalize Iter and Control here, decrementing Lock twice and Busy -- once. -- This optimization makes "for ... of" loops over 30 times faster in cases -- measured. procedure Expand_Iterator_Loop_Over_Container (N : Node_Id; Isc : Node_Id; I_Spec : Node_Id; Container : Node_Id; Container_Typ : Entity_Id) is Id : constant Entity_Id := Defining_Identifier (I_Spec); Elem_Typ : constant Entity_Id := Etype (Id); Id_Kind : constant Entity_Kind := Ekind (Id); Loc : constant Source_Ptr := Sloc (N); Stats : constant List_Id := Statements (N); Cursor : Entity_Id; Decl : Node_Id; Iter_Type : Entity_Id; Iterator : Entity_Id; Name_Init : Name_Id; Name_Step : Name_Id; New_Loop : Node_Id; Fast_Element_Access_Op : Entity_Id := Empty; Fast_Step_Op : Entity_Id := Empty; -- Only for optimized version of "for ... of" Iter_Pack : Entity_Id; -- The package in which the iterator interface is instantiated. This is -- typically an instance within the container package. Pack : Entity_Id; -- The package in which the container type is declared begin -- Determine the advancement and initialization steps for the cursor. -- Analysis of the expanded loop will verify that the container has a -- reverse iterator. if Reverse_Present (I_Spec) then Name_Init := Name_Last; Name_Step := Name_Previous; else Name_Init := Name_First; Name_Step := Name_Next; end if; -- The type of the iterator is the return type of the Iterate function -- used. For the "of" form this is the default iterator for the type, -- otherwise it is the type of the explicit function used in the -- iterator specification. The most common case will be an Iterate -- function in the container package. -- The Iterator type is declared in an instance within the container -- package itself, for example: -- package Vector_Iterator_Interfaces is new -- Ada.Iterator_Interfaces (Cursor, Has_Element); -- If the container type is a derived type, the cursor type is found in -- the package of the ultimate ancestor type. if Is_Derived_Type (Container_Typ) then Pack := Scope (Root_Type (Container_Typ)); else Pack := Scope (Container_Typ); end if; if Of_Present (I_Spec) then Handle_Of : declare Container_Arg : Node_Id; function Get_Default_Iterator (T : Entity_Id) return Entity_Id; -- If the container is a derived type, the aspect holds the parent -- operation. The required one is a primitive of the derived type -- and is either inherited or overridden. Also sets Container_Arg. -------------------------- -- Get_Default_Iterator -- -------------------------- function Get_Default_Iterator (T : Entity_Id) return Entity_Id is Iter : constant Entity_Id := Entity (Find_Value_Of_Aspect (T, Aspect_Default_Iterator)); Prim : Elmt_Id; Op : Entity_Id; begin Container_Arg := New_Copy_Tree (Container); -- A previous version of GNAT allowed indexing aspects to -- be redefined on derived container types, while the -- default iterator was inherited from the parent type. -- This non-standard extension is preserved temporarily for -- use by the modelling project under debug flag d.X. if Debug_Flag_Dot_XX then if Base_Type (Etype (Container)) /= Base_Type (Etype (First_Formal (Iter))) then Container_Arg := Make_Type_Conversion (Loc, Subtype_Mark => New_Occurrence_Of (Etype (First_Formal (Iter)), Loc), Expression => Container_Arg); end if; return Iter; elsif Is_Derived_Type (T) then -- The default iterator must be a primitive operation of the -- type, at the same dispatch slot position. The DT position -- may not be established if type is not frozen yet. Prim := First_Elmt (Primitive_Operations (T)); while Present (Prim) loop Op := Node (Prim); if Alias (Op) = Iter or else (Chars (Op) = Chars (Iter) and then Present (DTC_Entity (Op)) and then DT_Position (Op) = DT_Position (Iter)) then return Op; end if; Next_Elmt (Prim); end loop; -- Default iterator must exist pragma Assert (False); -- Otherwise not a derived type else return Iter; end if; end Get_Default_Iterator; -- Local variables Default_Iter : Entity_Id; Ent : Entity_Id; Reference_Control_Type : Entity_Id := Empty; Pseudo_Reference : Entity_Id := Empty; -- Start of processing for Handle_Of begin if Is_Class_Wide_Type (Container_Typ) then Default_Iter := Get_Default_Iterator (Etype (Base_Type (Container_Typ))); else Default_Iter := Get_Default_Iterator (Etype (Container)); end if; Cursor := Make_Temporary (Loc, 'C'); -- For a container element iterator, the iterator type is obtained -- from the corresponding aspect, whose return type is descended -- from the corresponding interface type in some instance of -- Ada.Iterator_Interfaces. The actuals of that instantiation -- are Cursor and Has_Element. Iter_Type := Etype (Default_Iter); -- The iterator type, which is a class-wide type, may itself be -- derived locally, so the desired instantiation is the scope of -- the root type of the iterator type. Iter_Pack := Scope (Root_Type (Etype (Iter_Type))); -- Find declarations needed for "for ... of" optimization Ent := First_Entity (Pack); while Present (Ent) loop if Chars (Ent) = Name_Get_Element_Access then Fast_Element_Access_Op := Ent; elsif Chars (Ent) = Name_Step and then Ekind (Ent) = E_Procedure then Fast_Step_Op := Ent; elsif Chars (Ent) = Name_Reference_Control_Type then Reference_Control_Type := Ent; elsif Chars (Ent) = Name_Pseudo_Reference then Pseudo_Reference := Ent; end if; Next_Entity (Ent); end loop; if Present (Reference_Control_Type) and then Present (Pseudo_Reference) then Insert_Action (N, Make_Object_Declaration (Loc, Defining_Identifier => Make_Temporary (Loc, 'D'), Object_Definition => New_Occurrence_Of (Reference_Control_Type, Loc), Expression => Make_Function_Call (Loc, Name => New_Occurrence_Of (Pseudo_Reference, Loc), Parameter_Associations => New_List (New_Copy_Tree (Container_Arg))))); end if; -- Rewrite domain of iteration as a call to the default iterator -- for the container type. The formal may be an access parameter -- in which case we must build a reference to the container. declare Arg : Node_Id; begin if Is_Access_Type (Etype (First_Entity (Default_Iter))) then Arg := Make_Attribute_Reference (Loc, Prefix => Container_Arg, Attribute_Name => Name_Unrestricted_Access); else Arg := Container_Arg; end if; Rewrite (Name (I_Spec), Make_Function_Call (Loc, Name => New_Occurrence_Of (Default_Iter, Loc), Parameter_Associations => New_List (Arg))); end; Analyze_And_Resolve (Name (I_Spec)); -- Find cursor type in proper iterator package, which is an -- instantiation of Iterator_Interfaces. Ent := First_Entity (Iter_Pack); while Present (Ent) loop if Chars (Ent) = Name_Cursor then Set_Etype (Cursor, Etype (Ent)); exit; end if; Next_Entity (Ent); end loop; if Present (Fast_Element_Access_Op) then Decl := Make_Object_Renaming_Declaration (Loc, Defining_Identifier => Id, Subtype_Mark => New_Occurrence_Of (Elem_Typ, Loc), Name => Make_Explicit_Dereference (Loc, Prefix => Make_Function_Call (Loc, Name => New_Occurrence_Of (Fast_Element_Access_Op, Loc), Parameter_Associations => New_List (New_Occurrence_Of (Cursor, Loc))))); else Decl := Make_Object_Renaming_Declaration (Loc, Defining_Identifier => Id, Subtype_Mark => New_Occurrence_Of (Elem_Typ, Loc), Name => Make_Indexed_Component (Loc, Prefix => Relocate_Node (Container_Arg), Expressions => New_List (New_Occurrence_Of (Cursor, Loc)))); end if; -- The defining identifier in the iterator is user-visible and -- must be visible in the debugger. Set_Debug_Info_Needed (Id); -- If the container does not have a variable indexing aspect, -- the element is a constant in the loop. The container itself -- may be constant, in which case the element is a constant as -- well. The container has been rewritten as a call to Iterate, -- so examine original node. if No (Find_Value_Of_Aspect (Container_Typ, Aspect_Variable_Indexing)) or else not Is_Variable (Original_Node (Container)) then Set_Ekind (Id, E_Constant); end if; Prepend_To (Stats, Decl); end Handle_Of; -- X in Iterate (S) : type of iterator is type of explicitly given -- Iterate function, and the loop variable is the cursor. It will be -- assigned in the loop and must be a variable. else Iter_Type := Etype (Name (I_Spec)); -- The iterator type, which is a class-wide type, may itself be -- derived locally, so the desired instantiation is the scope of -- the root type of the iterator type, as in the "of" case. Iter_Pack := Scope (Root_Type (Etype (Iter_Type))); Cursor := Id; end if; Iterator := Make_Temporary (Loc, 'I'); -- For both iterator forms, add a call to the step operation to advance -- the cursor. Generate: -- Cursor := Iterator.Next (Cursor); -- or else -- Cursor := Next (Cursor); if Present (Fast_Element_Access_Op) and then Present (Fast_Step_Op) then declare Curs_Name : constant Node_Id := New_Occurrence_Of (Cursor, Loc); Step_Call : Node_Id; begin Step_Call := Make_Procedure_Call_Statement (Loc, Name => New_Occurrence_Of (Fast_Step_Op, Loc), Parameter_Associations => New_List (Curs_Name)); Append_To (Stats, Step_Call); Set_Assignment_OK (Curs_Name); end; else declare Rhs : Node_Id; begin Rhs := Make_Function_Call (Loc, Name => Make_Selected_Component (Loc, Prefix => New_Occurrence_Of (Iterator, Loc), Selector_Name => Make_Identifier (Loc, Name_Step)), Parameter_Associations => New_List ( New_Occurrence_Of (Cursor, Loc))); Append_To (Stats, Make_Assignment_Statement (Loc, Name => New_Occurrence_Of (Cursor, Loc), Expression => Rhs)); Set_Assignment_OK (Name (Last (Stats))); end; end if; -- Generate: -- while Has_Element (Cursor) loop -- <Stats> -- end loop; -- Has_Element is the second actual in the iterator package New_Loop := Make_Loop_Statement (Loc, Iteration_Scheme => Make_Iteration_Scheme (Loc, Condition => Make_Function_Call (Loc, Name => New_Occurrence_Of (Next_Entity (First_Entity (Iter_Pack)), Loc), Parameter_Associations => New_List ( New_Occurrence_Of (Cursor, Loc)))), Statements => Stats, End_Label => Empty); -- If present, preserve identifier of loop, which can be used in an exit -- statement in the body. if Present (Identifier (N)) then Set_Identifier (New_Loop, Relocate_Node (Identifier (N))); end if; -- Create the declarations for Iterator and cursor and insert them -- before the source loop. Given that the domain of iteration is already -- an entity, the iterator is just a renaming of that entity. Possible -- optimization ??? Insert_Action (N, Make_Object_Renaming_Declaration (Loc, Defining_Identifier => Iterator, Subtype_Mark => New_Occurrence_Of (Iter_Type, Loc), Name => Relocate_Node (Name (I_Spec)))); -- Create declaration for cursor declare Cursor_Decl : constant Node_Id := Make_Object_Declaration (Loc, Defining_Identifier => Cursor, Object_Definition => New_Occurrence_Of (Etype (Cursor), Loc), Expression => Make_Selected_Component (Loc, Prefix => New_Occurrence_Of (Iterator, Loc), Selector_Name => Make_Identifier (Loc, Name_Init))); begin -- The cursor is only modified in expanded code, so it appears -- as unassigned to the warning machinery. We must suppress this -- spurious warning explicitly. The cursor's kind is that of the -- original loop parameter (it is a constant if the domain of -- iteration is constant). Set_Warnings_Off (Cursor); Set_Assignment_OK (Cursor_Decl); Insert_Action (N, Cursor_Decl); Set_Ekind (Cursor, Id_Kind); end; -- If the range of iteration is given by a function call that returns -- a container, the finalization actions have been saved in the -- Condition_Actions of the iterator. Insert them now at the head of -- the loop. if Present (Condition_Actions (Isc)) then Insert_List_Before (N, Condition_Actions (Isc)); end if; Rewrite (N, New_Loop); Analyze (N); end Expand_Iterator_Loop_Over_Container; ----------------------------- -- Expand_N_Loop_Statement -- ----------------------------- -- 1. Remove null loop entirely -- 2. Deal with while condition for C/Fortran boolean -- 3. Deal with loops with a non-standard enumeration type range -- 4. Deal with while loops where Condition_Actions is set -- 5. Deal with loops over predicated subtypes -- 6. Deal with loops with iterators over arrays and containers -- 7. Insert polling call if required procedure Expand_N_Loop_Statement (N : Node_Id) is Loc : constant Source_Ptr := Sloc (N); Scheme : constant Node_Id := Iteration_Scheme (N); Stmt : Node_Id; begin -- Delete null loop if Is_Null_Loop (N) then Rewrite (N, Make_Null_Statement (Loc)); return; end if; -- Deal with condition for C/Fortran Boolean if Present (Scheme) then Adjust_Condition (Condition (Scheme)); end if; -- Generate polling call if Is_Non_Empty_List (Statements (N)) then Generate_Poll_Call (First (Statements (N))); end if; -- Nothing more to do for plain loop with no iteration scheme if No (Scheme) then null; -- Case of for loop (Loop_Parameter_Specification present) -- Note: we do not have to worry about validity checking of the for loop -- range bounds here, since they were frozen with constant declarations -- and it is during that process that the validity checking is done. elsif Present (Loop_Parameter_Specification (Scheme)) then declare LPS : constant Node_Id := Loop_Parameter_Specification (Scheme); Loop_Id : constant Entity_Id := Defining_Identifier (LPS); Ltype : constant Entity_Id := Etype (Loop_Id); Btype : constant Entity_Id := Base_Type (Ltype); Expr : Node_Id; Decls : List_Id; New_Id : Entity_Id; begin -- Deal with loop over predicates if Is_Discrete_Type (Ltype) and then Present (Predicate_Function (Ltype)) then Expand_Predicated_Loop (N); -- Handle the case where we have a for loop with the range type -- being an enumeration type with non-standard representation. -- In this case we expand: -- for x in [reverse] a .. b loop -- ... -- end loop; -- to -- for xP in [reverse] integer -- range etype'Pos (a) .. etype'Pos (b) -- loop -- declare -- x : constant etype := Pos_To_Rep (xP); -- begin -- ... -- end; -- end loop; elsif Is_Enumeration_Type (Btype) and then Present (Enum_Pos_To_Rep (Btype)) then New_Id := Make_Defining_Identifier (Loc, Chars => New_External_Name (Chars (Loop_Id), 'P')); -- If the type has a contiguous representation, successive -- values can be generated as offsets from the first literal. if Has_Contiguous_Rep (Btype) then Expr := Unchecked_Convert_To (Btype, Make_Op_Add (Loc, Left_Opnd => Make_Integer_Literal (Loc, Enumeration_Rep (First_Literal (Btype))), Right_Opnd => New_Occurrence_Of (New_Id, Loc))); else -- Use the constructed array Enum_Pos_To_Rep Expr := Make_Indexed_Component (Loc, Prefix => New_Occurrence_Of (Enum_Pos_To_Rep (Btype), Loc), Expressions => New_List (New_Occurrence_Of (New_Id, Loc))); end if; -- Build declaration for loop identifier Decls := New_List ( Make_Object_Declaration (Loc, Defining_Identifier => Loop_Id, Constant_Present => True, Object_Definition => New_Occurrence_Of (Ltype, Loc), Expression => Expr)); Rewrite (N, Make_Loop_Statement (Loc, Identifier => Identifier (N), Iteration_Scheme => Make_Iteration_Scheme (Loc, Loop_Parameter_Specification => Make_Loop_Parameter_Specification (Loc, Defining_Identifier => New_Id, Reverse_Present => Reverse_Present (LPS), Discrete_Subtype_Definition => Make_Subtype_Indication (Loc, Subtype_Mark => New_Occurrence_Of (Standard_Natural, Loc), Constraint => Make_Range_Constraint (Loc, Range_Expression => Make_Range (Loc, Low_Bound => Make_Attribute_Reference (Loc, Prefix => New_Occurrence_Of (Btype, Loc), Attribute_Name => Name_Pos, Expressions => New_List ( Relocate_Node (Type_Low_Bound (Ltype)))), High_Bound => Make_Attribute_Reference (Loc, Prefix => New_Occurrence_Of (Btype, Loc), Attribute_Name => Name_Pos, Expressions => New_List ( Relocate_Node (Type_High_Bound (Ltype))))))))), Statements => New_List ( Make_Block_Statement (Loc, Declarations => Decls, Handled_Statement_Sequence => Make_Handled_Sequence_Of_Statements (Loc, Statements => Statements (N)))), End_Label => End_Label (N))); -- The loop parameter's entity must be removed from the loop -- scope's entity list and rendered invisible, since it will -- now be located in the new block scope. Any other entities -- already associated with the loop scope, such as the loop -- parameter's subtype, will remain there. -- In an element loop, the loop will contain a declaration for -- a cursor variable; otherwise the loop id is the first entity -- in the scope constructed for the loop. if Comes_From_Source (Loop_Id) then pragma Assert (First_Entity (Scope (Loop_Id)) = Loop_Id); null; end if; Set_First_Entity (Scope (Loop_Id), Next_Entity (Loop_Id)); Remove_Homonym (Loop_Id); if Last_Entity (Scope (Loop_Id)) = Loop_Id then Set_Last_Entity (Scope (Loop_Id), Empty); end if; Analyze (N); -- Nothing to do with other cases of for loops else null; end if; end; -- Second case, if we have a while loop with Condition_Actions set, then -- we change it into a plain loop: -- while C loop -- ... -- end loop; -- changed to: -- loop -- <<condition actions>> -- exit when not C; -- ... -- end loop elsif Present (Scheme) and then Present (Condition_Actions (Scheme)) and then Present (Condition (Scheme)) then declare ES : Node_Id; begin ES := Make_Exit_Statement (Sloc (Condition (Scheme)), Condition => Make_Op_Not (Sloc (Condition (Scheme)), Right_Opnd => Condition (Scheme))); Prepend (ES, Statements (N)); Insert_List_Before (ES, Condition_Actions (Scheme)); -- This is not an implicit loop, since it is generated in response -- to the loop statement being processed. If this is itself -- implicit, the restriction has already been checked. If not, -- it is an explicit loop. Rewrite (N, Make_Loop_Statement (Sloc (N), Identifier => Identifier (N), Statements => Statements (N), End_Label => End_Label (N))); Analyze (N); end; -- Here to deal with iterator case elsif Present (Scheme) and then Present (Iterator_Specification (Scheme)) then Expand_Iterator_Loop (N); -- An iterator loop may generate renaming declarations for elements -- that require debug information. This is the case in particular -- with element iterators, where debug information must be generated -- for the temporary that holds the element value. These temporaries -- are created within a transient block whose local declarations are -- transferred to the loop, which now has nontrivial local objects. if Nkind (N) = N_Loop_Statement and then Present (Identifier (N)) then Qualify_Entity_Names (N); end if; end if; -- When the iteration scheme mentiones attribute 'Loop_Entry, the loop -- is transformed into a conditional block where the original loop is -- the sole statement. Inspect the statements of the nested loop for -- controlled objects. Stmt := N; if Subject_To_Loop_Entry_Attributes (Stmt) then Stmt := Find_Loop_In_Conditional_Block (Stmt); end if; Process_Statements_For_Controlled_Objects (Stmt); end Expand_N_Loop_Statement; ---------------------------- -- Expand_Predicated_Loop -- ---------------------------- -- Note: the expander can handle generation of loops over predicated -- subtypes for both the dynamic and static cases. Depending on what -- we decide is allowed in Ada 2012 mode and/or extensions allowed -- mode, the semantic analyzer may disallow one or both forms. procedure Expand_Predicated_Loop (N : Node_Id) is Loc : constant Source_Ptr := Sloc (N); Isc : constant Node_Id := Iteration_Scheme (N); LPS : constant Node_Id := Loop_Parameter_Specification (Isc); Loop_Id : constant Entity_Id := Defining_Identifier (LPS); Ltype : constant Entity_Id := Etype (Loop_Id); Stat : constant List_Id := Static_Discrete_Predicate (Ltype); Stmts : constant List_Id := Statements (N); begin -- Case of iteration over non-static predicate, should not be possible -- since this is not allowed by the semantics and should have been -- caught during analysis of the loop statement. if No (Stat) then raise Program_Error; -- If the predicate list is empty, that corresponds to a predicate of -- False, in which case the loop won't run at all, and we rewrite the -- entire loop as a null statement. elsif Is_Empty_List (Stat) then Rewrite (N, Make_Null_Statement (Loc)); Analyze (N); -- For expansion over a static predicate we generate the following -- declare -- J : Ltype := min-val; -- begin -- loop -- body -- case J is -- when endpoint => J := startpoint; -- when endpoint => J := startpoint; -- ... -- when max-val => exit; -- when others => J := Lval'Succ (J); -- end case; -- end loop; -- end; -- with min-val replaced by max-val and Succ replaced by Pred if the -- loop parameter specification carries a Reverse indicator. -- To make this a little clearer, let's take a specific example: -- type Int is range 1 .. 10; -- subtype StaticP is Int with -- predicate => StaticP in 3 | 10 | 5 .. 7; -- ... -- for L in StaticP loop -- Put_Line ("static:" & J'Img); -- end loop; -- In this case, the loop is transformed into -- begin -- J : L := 3; -- loop -- body -- case J is -- when 3 => J := 5; -- when 7 => J := 10; -- when 10 => exit; -- when others => J := L'Succ (J); -- end case; -- end loop; -- end; else Static_Predicate : declare S : Node_Id; D : Node_Id; P : Node_Id; Alts : List_Id; Cstm : Node_Id; function Lo_Val (N : Node_Id) return Node_Id; -- Given static expression or static range, returns an identifier -- whose value is the low bound of the expression value or range. function Hi_Val (N : Node_Id) return Node_Id; -- Given static expression or static range, returns an identifier -- whose value is the high bound of the expression value or range. ------------ -- Hi_Val -- ------------ function Hi_Val (N : Node_Id) return Node_Id is begin if Is_OK_Static_Expression (N) then return New_Copy (N); else pragma Assert (Nkind (N) = N_Range); return New_Copy (High_Bound (N)); end if; end Hi_Val; ------------ -- Lo_Val -- ------------ function Lo_Val (N : Node_Id) return Node_Id is begin if Is_OK_Static_Expression (N) then return New_Copy (N); else pragma Assert (Nkind (N) = N_Range); return New_Copy (Low_Bound (N)); end if; end Lo_Val; -- Start of processing for Static_Predicate begin -- Convert loop identifier to normal variable and reanalyze it so -- that this conversion works. We have to use the same defining -- identifier, since there may be references in the loop body. Set_Analyzed (Loop_Id, False); Set_Ekind (Loop_Id, E_Variable); -- In most loops the loop variable is assigned in various -- alternatives in the body. However, in the rare case when -- the range specifies a single element, the loop variable -- may trigger a spurious warning that is could be constant. -- This warning might as well be suppressed. Set_Warnings_Off (Loop_Id); -- Loop to create branches of case statement Alts := New_List; if Reverse_Present (LPS) then -- Initial value is largest value in predicate. D := Make_Object_Declaration (Loc, Defining_Identifier => Loop_Id, Object_Definition => New_Occurrence_Of (Ltype, Loc), Expression => Hi_Val (Last (Stat))); P := Last (Stat); while Present (P) loop if No (Prev (P)) then S := Make_Exit_Statement (Loc); else S := Make_Assignment_Statement (Loc, Name => New_Occurrence_Of (Loop_Id, Loc), Expression => Hi_Val (Prev (P))); Set_Suppress_Assignment_Checks (S); end if; Append_To (Alts, Make_Case_Statement_Alternative (Loc, Statements => New_List (S), Discrete_Choices => New_List (Lo_Val (P)))); Prev (P); end loop; else -- Initial value is smallest value in predicate. D := Make_Object_Declaration (Loc, Defining_Identifier => Loop_Id, Object_Definition => New_Occurrence_Of (Ltype, Loc), Expression => Lo_Val (First (Stat))); P := First (Stat); while Present (P) loop if No (Next (P)) then S := Make_Exit_Statement (Loc); else S := Make_Assignment_Statement (Loc, Name => New_Occurrence_Of (Loop_Id, Loc), Expression => Lo_Val (Next (P))); Set_Suppress_Assignment_Checks (S); end if; Append_To (Alts, Make_Case_Statement_Alternative (Loc, Statements => New_List (S), Discrete_Choices => New_List (Hi_Val (P)))); Next (P); end loop; end if; -- Add others choice declare Name_Next : Name_Id; begin if Reverse_Present (LPS) then Name_Next := Name_Pred; else Name_Next := Name_Succ; end if; S := Make_Assignment_Statement (Loc, Name => New_Occurrence_Of (Loop_Id, Loc), Expression => Make_Attribute_Reference (Loc, Prefix => New_Occurrence_Of (Ltype, Loc), Attribute_Name => Name_Next, Expressions => New_List ( New_Occurrence_Of (Loop_Id, Loc)))); Set_Suppress_Assignment_Checks (S); end; Append_To (Alts, Make_Case_Statement_Alternative (Loc, Discrete_Choices => New_List (Make_Others_Choice (Loc)), Statements => New_List (S))); -- Construct case statement and append to body statements Cstm := Make_Case_Statement (Loc, Expression => New_Occurrence_Of (Loop_Id, Loc), Alternatives => Alts); Append_To (Stmts, Cstm); -- Rewrite the loop Set_Suppress_Assignment_Checks (D); Rewrite (N, Make_Block_Statement (Loc, Declarations => New_List (D), Handled_Statement_Sequence => Make_Handled_Sequence_Of_Statements (Loc, Statements => New_List ( Make_Loop_Statement (Loc, Statements => Stmts, End_Label => Empty))))); Analyze (N); end Static_Predicate; end if; end Expand_Predicated_Loop; ------------------------------ -- Make_Tag_Ctrl_Assignment -- ------------------------------ function Make_Tag_Ctrl_Assignment (N : Node_Id) return List_Id is Asn : constant Node_Id := Relocate_Node (N); L : constant Node_Id := Name (N); Loc : constant Source_Ptr := Sloc (N); Res : constant List_Id := New_List; T : constant Entity_Id := Underlying_Type (Etype (L)); Comp_Asn : constant Boolean := Is_Fully_Repped_Tagged_Type (T); Ctrl_Act : constant Boolean := Needs_Finalization (T) and then not No_Ctrl_Actions (N); Save_Tag : constant Boolean := Is_Tagged_Type (T) and then not Comp_Asn and then not No_Ctrl_Actions (N) and then Tagged_Type_Expansion; Adj_Call : Node_Id; Fin_Call : Node_Id; Tag_Id : Entity_Id; begin -- Finalize the target of the assignment when controlled -- We have two exceptions here: -- 1. If we are in an init proc since it is an initialization more -- than an assignment. -- 2. If the left-hand side is a temporary that was not initialized -- (or the parent part of a temporary since it is the case in -- extension aggregates). Such a temporary does not come from -- source. We must examine the original node for the prefix, because -- it may be a component of an entry formal, in which case it has -- been rewritten and does not appear to come from source either. -- Case of init proc if not Ctrl_Act then null; -- The left-hand side is an uninitialized temporary object elsif Nkind (L) = N_Type_Conversion and then Is_Entity_Name (Expression (L)) and then Nkind (Parent (Entity (Expression (L)))) = N_Object_Declaration and then No_Initialization (Parent (Entity (Expression (L)))) then null; else Fin_Call := Make_Final_Call (Obj_Ref => Duplicate_Subexpr_No_Checks (L), Typ => Etype (L)); if Present (Fin_Call) then Append_To (Res, Fin_Call); end if; end if; -- Save the Tag in a local variable Tag_Id if Save_Tag then Tag_Id := Make_Temporary (Loc, 'A'); Append_To (Res, Make_Object_Declaration (Loc, Defining_Identifier => Tag_Id, Object_Definition => New_Occurrence_Of (RTE (RE_Tag), Loc), Expression => Make_Selected_Component (Loc, Prefix => Duplicate_Subexpr_No_Checks (L), Selector_Name => New_Occurrence_Of (First_Tag_Component (T), Loc)))); -- Otherwise Tag_Id is not used else Tag_Id := Empty; end if; -- If the tagged type has a full rep clause, expand the assignment into -- component-wise assignments. Mark the node as unanalyzed in order to -- generate the proper code and propagate this scenario by setting a -- flag to avoid infinite recursion. if Comp_Asn then Set_Analyzed (Asn, False); Set_Componentwise_Assignment (Asn, True); end if; Append_To (Res, Asn); -- Restore the tag if Save_Tag then Append_To (Res, Make_Assignment_Statement (Loc, Name => Make_Selected_Component (Loc, Prefix => Duplicate_Subexpr_No_Checks (L), Selector_Name => New_Occurrence_Of (First_Tag_Component (T), Loc)), Expression => New_Occurrence_Of (Tag_Id, Loc))); end if; -- Adjust the target after the assignment when controlled (not in the -- init proc since it is an initialization more than an assignment). if Ctrl_Act then Adj_Call := Make_Adjust_Call (Obj_Ref => Duplicate_Subexpr_Move_Checks (L), Typ => Etype (L)); if Present (Adj_Call) then Append_To (Res, Adj_Call); end if; end if; return Res; exception -- Could use comment here ??? when RE_Not_Available => return Empty_List; end Make_Tag_Ctrl_Assignment; end Exp_Ch5;
-- This file is covered by the Internet Software Consortium (ISC) License -- Reference: ../License.txt with Definitions; use Definitions; with Port_Specification; private with HelperText; private with Ada.Containers.Hashed_Maps; package Specification_Parser is package PSP renames Port_Specification; -- Parse the port specification file and extract the data into the specification record. procedure parse_specification_file (dossier : String; spec : out PSP.Portspecs; success : out Boolean; opsys_focus : supported_opsys; arch_focus : supported_arch; stop_at_targets : Boolean; extraction_dir : String := ""); private package HT renames HelperText; package CON renames Ada.Containers; type spec_array is (not_array, def, sdesc, sites, distfile, spkgs, vopts, ext_head, ext_tail, option_on, broken, var_opsys, var_arch, extra_rundep, opt_descr, opt_group, b_deps, r_deps, br_deps, c_uses); type spec_singlet is (not_singlet, namebase, version, revision, epoch, keywords, variants, contacts, dl_groups, dist_subdir, df_index, opt_avail, opt_standard, exc_opsys, inc_opsys, exc_arch, ext_only, ext_zip, ext_7z, ext_lha, ext_dirty, distname, skip_build, single_job, destdir_env, build_wrksrc, makefile, destdirname, make_args, make_env, build_target, cflags, cxxflags, cppflags, ldflags, homepage, skip_install, opt_level, patchfiles, uses, sub_list, sub_files, config_args, config_env, build_deps, buildrun_deps, run_deps, cmake_args, qmake_args, info, install_tgt, patch_wrksrc, patch_strip, patchfiles_strip, extra_patches, must_configure, configure_wrksrc, configure_script, gnu_cfg_prefix, configure_target, config_outsource, deprecated, expiration, install_wrksrc, plist_sub, prefix, licenses, users, groups, catchall, shift_install, diode, lic_scheme, lic_file, lic_name, skip_ccache, test_target, mandirs, invalid_rpath, debugging, broken_ssl, test_args, gnome_comp, rc_scripts, ug_subpackage, broken_mysql, broken_pgsql, og_radio, og_restrict, og_unlimited, ext_deb, test_env, generated, xorg_comp, sdl_comp, phpext, job_limit, so_version, lic_terms, lic_awk, lic_source, repsucks, killdog, cgo_conf, cgo_build, cgo_inst, cgo_cargs, cgo_bargs, cgo_iargs, cgo_feat); type spec_target is (not_target, target_title, target_body, bad_target); type type_category is (cat_none, cat_array, cat_singlet, cat_target, cat_option, cat_file); missing_definition : exception; bad_modifier : exception; expansion_too_long : exception; mistabbed : exception; mistabbed_40 : exception; integer_expected : exception; extra_spaces : exception; duplicate_key : exception; generic_format : exception; missing_file : exception; -- This looks for the pattern ${something}. If not found, the original value is returned. -- Otherwise it looks up "something". If that's not a definition, the missing_definition -- exception is thrown, otherwise it's expanded. If the $something contains a modifier -- (column followed by code) and that modifier is unknown or misused, the bad_modifier -- exception is thrown. Upon cycle, repeat until no more patterns found, then return -- final expanded value. If the length of the expanded value exceeds 512 bytes, the -- expansion_too_long exception is thrown. function expand_value (specification : PSP.Portspecs; value : String) return String; -- If the line represents a recognized array type, indicate which one, -- otherwise return "not_array" function determine_array (line : String) return spec_array; -- If the line represents a recognized singlet type, indicate which one, -- otherwise return "not_singlet" function determine_singlet (line : String) return spec_singlet; -- Returns "not_helper_format" if it's not in option format -- Returns "not_supported_helper" if it's not a recognized (supported) helper -- Otherwise it returns the detected spec_option function determine_option (line : String) return PSP.spec_option; -- Returns empty string if it's not a recognized option, otherwise it returns -- The option name. If 5-tabs detected, return previous name (given). function extract_option_name (spec : PSP.Portspecs; line : String; last_name : HT.Text) return String; -- If the line represents the makefile target definition or it's following body, -- return which one, otherwise return "not_target". -- Exception: if formatted as a target def. which is not recognized, return "bad_target" function determine_target (spec : PSP.Portspecs; line : String; last_seen : type_category) return spec_target; -- Returns true if the given line indicates a package containing a file follows function is_file_capsule (line : String) return Boolean; -- Given a string validated as a file capsule, return the size of the file function retrieve_file_size (capsule_label : String) return Natural; -- Given a string validated as a file capsule, return the relative path for extracted file function retrieve_file_name (capsule_label : String) return String; -- Returns everything following the tab(s) until end of line. If last tab doesn't align -- text with column 24, the mistabbed exception is thrown. function retrieve_single_value (spec : PSP.Portspecs; line : String) return String; -- Returns everything following the tab(s) until end of line. If last tab doesn't align -- text with column 40, the mistabbed exception is thrown. function retrieve_single_option_value (spec : PSP.Portspecs; line : String) return String; -- Calls retrieve_single_value and tries to convert to a natural number. function retrieve_single_integer (spec : PSP.Portspecs; line : String) return Natural; -- Returns the key for array item definition lines. function retrieve_key (line : String; previous_index : HT.Text) return HT.Text; -- Line may contain spaces, and each space is considered a single item on a list. -- This iterates through the value with space delimiters. procedure build_list (spec : in out PSP.Portspecs; field : PSP.spec_field; line : String); -- Same as build_list but for options. -- Handles all valid options (since only one isn't a list) procedure build_list (spec : in out PSP.Portspecs; field : PSP.spec_option; option : String; line : String); -- essentially a singlet, but the varname is used a key for a name-value pair -- Spaces are allowed only if quoted (single value) procedure build_nvpair (spec : in out PSP.Portspecs; line : String); -- Line may contain spaces and they are considered part of an entire string procedure build_string (spec : in out PSP.Portspecs; field : PSP.spec_field; line : String); -- For boolean variables, ensure "yes" was defined and pass to specification record. procedure set_boolean (spec : in out PSP.Portspecs; field : PSP.spec_field; line : String); -- Pass integer variables to specification record procedure set_natural (spec : in out PSP.Portspecs; field : PSP.spec_field; line : String); -- Line may contain spaces, and each space is considered a single item on a list. -- This iterates through the value with space delimiters to build a group list. procedure build_group_list (spec : in out PSP.Portspecs; field : PSP.spec_field; key : String; value : String); -- Return true if all final validity checks pass function late_validity_check_error (spec : PSP.Portspecs) return String; -- Returns new filename if it matches dynamic pkg-message filename or an extra -- patch, otherwise return blank function tranform_filename (filename : String; match_opsys : String; match_arch : String) return String; -- Returns True if conditional variable value is a valid name pair. Validity is determined -- by obtaining a singlet value that is within the accepted valued, and having no -- non-quoted spaces in the string. function valid_conditional_variable (candidate : String) return Boolean; -- Look for ${pattern} that match known definitions and replace with the payload if -- found. Don't do anything if ${pattern} matches no known definition. -- It works with modifiers too. If the skip_transform value is false, there will -- not be any transformation. The logic is that that is done only on the final buildsheet -- which already has had the transformation done on it, so avoid a lot of calculations that -- result in no change. function transform_target_line (spec : PSP.Portspecs; line : String; skip_transform : Boolean) return String; -- loads raven.versions.mk and returns result of "make -V <varname>" function extract_version (varname : String) return String; -- loads raven.information.mk and returns result of "make -V <varname>" function extract_information (varname : String) return String; -- Throws missing_file exception if the indicated patch file or sub file does not exist procedure verify_extra_file_exists (spec : PSP.Portspecs; specfile : String; line : String; is_option : Boolean; sub_file : Boolean); -- Handle GITHUB_PRIVATE special case procedure transform_download_sites (site : in out HT.Text); end Specification_Parser;
-- 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;
-------------------------------------------------------------------------------- -- Copyright (C) 2020 by Heisenbug Ltd. (gh+si_units@heisenbug.eu) -- -- This work is free. You can redistribute it and/or modify it under the -- terms of the Do What The Fuck You Want To Public License, Version 2, -- as published by Sam Hocevar. See the LICENSE file for more details. -------------------------------------------------------------------------------- pragma License (Unrestricted); -------------------------------------------------------------------------------- -- Names of all officially defined SI units (including derived units). -- -- Please note that due to current lack of proper unicode support, the symbol -- for electric resistance is defined as "Ohm" here, not the Greek letter -- Omega. The library itself is unicode agnostic, so you can just instantiate -- your Image subprograms with the proper UTF-8 string. -------------------------------------------------------------------------------- package SI_Units.Names is -- Unit names (as defined by SI). Ampere : constant Unit_Name; Becquerel : constant Unit_Name; Candela : constant Unit_Name; Coulomb : constant Unit_Name; Degree_Celsius : constant Unit_Name; Farad : constant Unit_Name; Gram : constant Unit_Name; -- official SI base unit is kilogram Gray : constant Unit_Name; Henry : constant Unit_Name; Hertz : constant Unit_Name; Joule : constant Unit_Name; Katal : constant Unit_Name; Kelvin : constant Unit_Name; Lumen : constant Unit_Name; Lux : constant Unit_Name; Metre : constant Unit_Name; Mole : constant Unit_Name; Newton : constant Unit_Name; Ohm : constant Unit_Name; Pascal : constant Unit_Name; Percent : constant Unit_Name; Radian : constant Unit_Name; Second : constant Unit_Name; Siemens : constant Unit_Name; Sievert : constant Unit_Name; Steradian : constant Unit_Name; Tesla : constant Unit_Name; Volt : constant Unit_Name; Watt : constant Unit_Name; Weber : constant Unit_Name; private Ampere : constant Unit_Name := "A"; Becquerel : constant Unit_Name := "Bq"; Candela : constant Unit_Name := "cd"; Coulomb : constant Unit_Name := "C"; Degree_Celsius : constant Unit_Name := Character'Val (16#E2#) & Character'Val (16#84#) & Character'Val (16#83#); -- U+2103 Farad : constant Unit_Name := "F"; Gram : constant Unit_Name := "g"; Gray : constant Unit_Name := "Gy"; Henry : constant Unit_Name := "H"; Hertz : constant Unit_Name := "Hz"; Joule : constant Unit_Name := "J"; Katal : constant Unit_Name := "kat"; Kelvin : constant Unit_Name := "K"; Lumen : constant Unit_Name := "lm"; Lux : constant Unit_Name := "lx"; Metre : constant Unit_Name := "m"; Mole : constant Unit_Name := "mol"; Newton : constant Unit_Name := "N"; Ohm : constant Unit_Name := Character'Val (16#E2#) & Character'Val (16#84#) & Character'Val (16#A6#); -- U+2126 Pascal : constant Unit_Name := "Pa"; Percent : constant Unit_Name := "%"; Radian : constant Unit_Name := "rad"; Second : constant Unit_Name := "s"; Siemens : constant Unit_Name := "S"; Sievert : constant Unit_Name := "Sv"; Steradian : constant Unit_Name := "sr"; Tesla : constant Unit_Name := "T"; Volt : constant Unit_Name := "V"; Watt : constant Unit_Name := "W"; Weber : constant Unit_Name := "Wb"; end SI_Units.Names;
package body afrl.cmasi.abstractZone is function getFullLmcpTypeName(this : AbstractZone'Class) return String is ("afrl.cmasi.abstractZone.AbstractZone"); function getLmcpTypeName(this : AbstractZone'Class) return String is ("AbstractZone"); function getLmcpType(this : AbstractZone'Class) return UInt32_t is (CMASIEnum'Pos(ABSTRACTZONE_ENUM)); function getZoneId(this : AbstractZone'Class) return Int64_t is (this.ZoneID); procedure setZoneId(this : out AbstractZone'Class; ZoneId : in Int64_t) is begin this.ZoneID := ZoneId; end setZoneId; function getMinAltitude (this : AbstractZone'Class) return Float_t is (this.MinAltitude); procedure setMinAltitude(this : out AbstractZone'Class; MinAltitude : in Float_t) is begin this.MinAltitude := MinAltitude; end setMinAltitude; function getMinAltitudeType(this : AbstractZone'Class) return AltitudeTypeEnum is (this.MinAltitudeType); procedure setMinAltitudeType(this : out AbstractZone'Class; MinAltitudeType : in AltitudeTypeEnum) is begin this.MinAltitudeType := MinAltitudeType; end setMinAltitudeType; function getMaxAltitude (this : AbstractZone'Class) return Float_t is (this.MaxAltitude); procedure setMaxAltitude(this : out AbstractZone'Class; MaxAltitude : in Float_t) is begin this.MaxAltitude := MaxAltitude; end setMaxAltitude; function getMaxAltitudeType(this : AbstractZone'Class) return AltitudeTypeEnum is (this.MaxAltitudeType); procedure setMaxAltitudeType(this : out AbstractZone'Class; MaxAltitudeType : in AltitudeTypeEnum) is begin this.MaxAltitudeType := MaxAltitudeType; end setMaxAltitudeType; function getAffectedAircraft(this : AbstractZone'Class) return Vect_Int64_t_Acc is (this.AffectedAircraft); function getStartTime (this : AbstractZone'Class) return Int64_t is (this.StartTime); procedure setStartTime(this : out AbstractZone'Class; StartTime : in Int64_t) is begin this.StartTime := StartTime; end setStartTime; function getEndTime (this : AbstractZone'Class) return Int64_t is (this.EndTime); procedure setEndTime(this : out AbstractZone'Class; EndTime : in Int64_t) is begin this.EndTime := EndTime; end setEndTime; function getPadding (this : AbstractZone'Class) return Float_t is (this.Padding); procedure setPadding(this : out AbstractZone'Class; Padding : in Float_t) is begin this.Padding := Padding; end setPadding; function getLabel (this : AbstractZone'Class) return Unbounded_String is (this.Label); procedure setLabel(this : out AbstractZone'Class; Label : in Unbounded_String) is begin this.Label := Label; end setLabel; function getBoundary(this : AbstractZone'Class) return AbstractGeometry_Acc is (this.Boundary); procedure setBoundary(this : out AbstractZone'Class; Boundary : in AbstractGeometry_Acc) is begin this.Boundary := Boundary; end setBoundary; end afrl.cmasi.abstractZone;
with Ada.Text_IO; use Ada.Text_IO; procedure Una_Tarea is task type A_Type; task type B_Type; A : A_Type; -- podemos declarar objetos de las tareas B : B_Type; task body A_Type is begin loop Put_Line("soy la tarea 1"); delay 3.0; end loop; end A_Type; task body B_Type is begin loop Put_Line(" la tarea 2"); delay 6.0; end loop; end B_Type; begin Put_Line("Soy el prog. prac1."); end Una_Tarea;
-- A85007D.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 'FIRST, 'LAST, 'LENGTH, 'RANGE, 'ADDRESS, 'CONSTRAINED, -- AND 'SIZE CAN BE APPLIED TO RENAMED NON-ACCESS OUT FORMAL PARAMETERS -- AND RENAMED COMPONENTS OF NON-ACCESS OUT PARAMETERS. -- SPS 02/21/84 (SEE A62006D-B.ADA) -- EG 02/22/84 -- EG 05/30/84 -- JBG 12/2/84 WITH REPORT; USE REPORT; WITH SYSTEM; PROCEDURE A85007D IS PROCEDURE Q (X : SYSTEM.ADDRESS) IS BEGIN NULL; END Q; BEGIN TEST ("A85007D", "CHECK THAT ATTRIBUTES MAY BE APPLIED TO " & "RENAMED NON-ACCESS FORMAL OUT PARAMETERS"); DECLARE TYPE ARR IS ARRAY (1 .. 2) OF BOOLEAN; TYPE REC (D : INTEGER) IS RECORD Y : BOOLEAN; X : ARR; END RECORD; PROCEDURE PROC (C2 : OUT ARR; C3 : OUT REC) IS X : SYSTEM.ADDRESS; I : INTEGER; C21 : ARR RENAMES C2; C22 : ARR RENAMES C21; C31 : REC RENAMES C3; C32 : REC RENAMES C31; C33 : ARR RENAMES C3.X; C34 : ARR RENAMES C33; C35 : ARR RENAMES C32.X; C36 : BOOLEAN RENAMES C3.Y; C37 : BOOLEAN RENAMES C36; C38 : BOOLEAN RENAMES C32.Y; BEGIN I := C21'LENGTH; Q(C21'ADDRESS); I := C21'SIZE; I := C22'LENGTH; Q(C22'ADDRESS); I := C22'SIZE; FOR I IN C21'RANGE LOOP NULL; END LOOP; FOR I IN C22'RANGE LOOP NULL; END LOOP; FOR I IN C21'FIRST..C21'LAST LOOP NULL; END LOOP; FOR I IN C22'FIRST..C22'LAST LOOP NULL; END LOOP; I := C31.X'LENGTH; C3.Y := C31'CONSTRAINED; FOR J IN C31.X'RANGE LOOP NULL; END LOOP; FOR J IN C31.X'FIRST..C31.X'LAST LOOP NULL; END LOOP; I := C32.X'LENGTH; C31.Y := C32'CONSTRAINED; FOR J IN C32.X'RANGE LOOP NULL; END LOOP; FOR J IN C32.X'FIRST..C32.X'LAST LOOP NULL; END LOOP; I := C33'LENGTH; FOR J IN C33'RANGE LOOP NULL; END LOOP; FOR J IN C33'FIRST..C33'LAST LOOP NULL; END LOOP; I := C34'LENGTH; FOR J IN C34'RANGE LOOP NULL; END LOOP; FOR J IN C34'FIRST..C34'LAST LOOP NULL; END LOOP; I := C35'LENGTH; FOR J IN C35'RANGE LOOP NULL; END LOOP; FOR J IN C35'FIRST..C35'LAST LOOP NULL; END LOOP; Q(C31.Y'ADDRESS); I := C31.Y'SIZE; Q(C32.Y'ADDRESS); I := C32.Y'SIZE; Q(C36'ADDRESS); I := C36'SIZE; Q(C37'ADDRESS); I := C37'SIZE; Q(C38'ADDRESS); I := C38'SIZE; END PROC; BEGIN NULL; END; RESULT; END A85007D;
-- This spec has been automatically generated from STM32L151.svd pragma Restrictions (No_Elaboration_Code); pragma Ada_2012; pragma Style_Checks (Off); with HAL; with System; package STM32_SVD.EXTI is pragma Preelaborate; --------------- -- Registers -- --------------- subtype IMR_MR_Field is HAL.UInt23; -- IMR type IMR_Register is record -- Interrupt mask on line x MR : IMR_MR_Field := 16#0#; -- unspecified Reserved_23_31 : HAL.UInt9 := 16#0#; end record with Volatile_Full_Access, Size => 32, Bit_Order => System.Low_Order_First; for IMR_Register use record MR at 0 range 0 .. 22; Reserved_23_31 at 0 range 23 .. 31; end record; subtype EMR_MR_Field is HAL.UInt23; -- EMR type EMR_Register is record -- Event mask on line x MR : EMR_MR_Field := 16#0#; -- unspecified Reserved_23_31 : HAL.UInt9 := 16#0#; end record with Volatile_Full_Access, Size => 32, Bit_Order => System.Low_Order_First; for EMR_Register use record MR at 0 range 0 .. 22; Reserved_23_31 at 0 range 23 .. 31; end record; subtype RTSR_TR_Field is HAL.UInt23; -- RTSR type RTSR_Register is record -- Rising edge trigger event configuration bit of line x TR : RTSR_TR_Field := 16#0#; -- unspecified Reserved_23_31 : HAL.UInt9 := 16#0#; end record with Volatile_Full_Access, Size => 32, Bit_Order => System.Low_Order_First; for RTSR_Register use record TR at 0 range 0 .. 22; Reserved_23_31 at 0 range 23 .. 31; end record; subtype FTSR_TR_Field is HAL.UInt23; -- FTSR type FTSR_Register is record -- Falling edge trigger event configuration bit of line x TR : FTSR_TR_Field := 16#0#; -- unspecified Reserved_23_31 : HAL.UInt9 := 16#0#; end record with Volatile_Full_Access, Size => 32, Bit_Order => System.Low_Order_First; for FTSR_Register use record TR at 0 range 0 .. 22; Reserved_23_31 at 0 range 23 .. 31; end record; subtype SWIER_SWIER_Field is HAL.UInt23; -- SWIER type SWIER_Register is record -- Software interrupt on line x SWIER : SWIER_SWIER_Field := 16#0#; -- unspecified Reserved_23_31 : HAL.UInt9 := 16#0#; end record with Volatile_Full_Access, Size => 32, Bit_Order => System.Low_Order_First; for SWIER_Register use record SWIER at 0 range 0 .. 22; Reserved_23_31 at 0 range 23 .. 31; end record; subtype PR_PR_Field is HAL.UInt23; -- PR type PR_Register is record -- Pending bit PR : PR_PR_Field := 16#0#; -- unspecified Reserved_23_31 : HAL.UInt9 := 16#0#; end record with Volatile_Full_Access, Size => 32, Bit_Order => System.Low_Order_First; for PR_Register use record PR at 0 range 0 .. 22; Reserved_23_31 at 0 range 23 .. 31; end record; ----------------- -- Peripherals -- ----------------- -- External interrupt/event controller type EXTI_Peripheral is record -- IMR IMR : aliased IMR_Register; -- EMR EMR : aliased EMR_Register; -- RTSR RTSR : aliased RTSR_Register; -- FTSR FTSR : aliased FTSR_Register; -- SWIER SWIER : aliased SWIER_Register; -- PR PR : aliased PR_Register; end record with Volatile; for EXTI_Peripheral use record IMR at 16#0# range 0 .. 31; EMR at 16#4# range 0 .. 31; RTSR at 16#8# range 0 .. 31; FTSR at 16#C# range 0 .. 31; SWIER at 16#10# range 0 .. 31; PR at 16#14# range 0 .. 31; end record; -- External interrupt/event controller EXTI_Periph : aliased EXTI_Peripheral with Import, Address => System'To_Address (16#40010400#); end STM32_SVD.EXTI;
-- -- Copyright 2021 (C) Jeremy Grosser <jeremy@synack.me> -- -- SPDX-License-Identifier: Apache-2.0 -- with Ada.Unchecked_Conversion; with Interfaces; with Interfaces.C.Strings; with Interfaces.C_Streams; with Interfaces.C; with Notcurses_Thin; package Notcurses is type Notcurses_Context is private; type Notcurses_Plane is private; type Notcurses_Input is record Id : Wide_Wide_Character; Y : Interfaces.C.int; X : Interfaces.C.int; Alt : Boolean; Shift : Boolean; Ctrl : Boolean; Seqnum : Interfaces.Unsigned_64; end record; type Coordinate is record Y, X : Integer; end record; function "+" (Left, Right : Coordinate) return Coordinate; function "-" (Left, Right : Coordinate) return Coordinate; Notcurses_Error : exception; function Version return String; private package Thin renames Notcurses_Thin; type Notcurses_Context is access all Thin.notcurses; type Notcurses_Plane is access all Thin.ncplane; Default_Options : aliased Thin.notcurses_options := (termtype => Interfaces.C.Strings.Null_Ptr, renderfp => Interfaces.C_Streams.NULL_Stream, loglevel => Thin.NCLOGLEVEL_ERROR, flags => 0, others => 0); Default_Context : Notcurses_Context := null; function To_Ada is new Ada.Unchecked_Conversion (Source => Thin.ncinput, Target => Notcurses_Input); function To_C is new Ada.Unchecked_Conversion (Source => Notcurses_Input, Target => Thin.ncinput); end Notcurses;
------------------------------------------------------------------------------ -- -- -- Copyright (C) 2015-2016, AdaCore -- -- -- -- Redistribution and use in source and binary forms, with or without -- -- modification, are permitted provided that the following conditions are -- -- met: -- -- 1. Redistributions of source code must retain the above copyright -- -- notice, this list of conditions and the following disclaimer. -- -- 2. Redistributions in binary form must reproduce the above copyright -- -- notice, this list of conditions and the following disclaimer in -- -- the documentation and/or other materials provided with the -- -- distribution. -- -- 3. Neither the name of the copyright holder nor the names of its -- -- contributors may be used to endorse or promote products derived -- -- from this software without specific prior written permission. -- -- -- -- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -- -- "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -- -- LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -- -- A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -- -- HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -- -- SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -- -- LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -- -- DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -- -- THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -- -- (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -- -- OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -- -- -- ------------------------------------------------------------------------------ package body WM8994 is WM8994_CHIPID_ADDR : constant := 16#00#; Output_Enabled : Boolean := False; Input_Enabled : Boolean := False; pragma Unreferenced (Input_Enabled); --------------- -- I2C_Write -- --------------- procedure I2C_Write (This : in out WM8994_Device; Reg : UInt16; Value : UInt16) is Status : I2C_Status with Unreferenced; Data : I2C_Data (1 .. 2); Check : UInt16 with Unreferenced; begin -- Device is MSB first Data (1) := UInt8 (Shift_Right (Value and 16#FF00#, 8)); Data (2) := UInt8 (Value and 16#FF#); This.Port.Mem_Write (Addr => This.I2C_Addr, Mem_Addr => Reg, Mem_Addr_Size => Memory_Size_16b, Data => Data, Status => Status); if Reg /= 0 then Check := I2C_Read (This, Reg); end if; end I2C_Write; -------------- -- I2C_Read -- -------------- function I2C_Read (This : in out WM8994_Device; Reg : UInt16) return UInt16 is Status : I2C_Status; Data : I2C_Data (1 .. 2); Ret : UInt16; begin This.Port.Mem_Read (Addr => This.I2C_Addr, Mem_Addr => Reg, Mem_Addr_Size => Memory_Size_16b, Data => Data, Status => Status); Ret := Shift_Left (UInt16 (Data (1)), 8) or UInt16 (Data (2)); return Ret; end I2C_Read; ---------- -- Init -- ---------- procedure Init (This : in out WM8994_Device; Input : Input_Device; Output : Output_Device; Volume : UInt8; Frequency : Audio_Frequency) is Power_Mgnt_Reg_1 : UInt16 := 0; begin -- WM8994 Errata work-arounds I2C_Write (This, 16#102#, 16#0003#); I2C_Write (This, 16#817#, 16#0000#); I2C_Write (This, 16#102#, 16#0000#); -- Enable VMID soft restart, Start-up Bias current enabled I2C_Write (This, 16#39#, 16#006C#); -- Enable BIAS generator, Enable VMID I2C_Write (This, 16#01#, 16#0003#); This.Time.Delay_Milliseconds (50); Output_Enabled := Output /= No_Output; Input_Enabled := Input /= No_Input; This.Set_Output_Mode (Output); case Input is when No_Input => null; when Microphone => -- Enable AIF1ADC2 (Left), Enable AIF1ADC2 (Right) -- Enable DMICDAT2 (Left), Enable DMICDAT2 (Right) -- Enable Left ADC, Enable Right ADC I2C_Write (This, 16#04#, 16#0C30#); -- Enable AIF1 DRC2 Signal Detect & DRC in AIF1ADC2 Left/Right -- Timeslot 1 I2C_Write (This, 16#450#, 16#00DB#); -- Disable IN1L, IN1R, IN2L, IN2R, Enable Thermal sensor & -- shutdown I2C_Write (This, 16#02#, 16#6000#); -- Enable the DMIC2(Left) to AIF1 Timeslot 1 (Left) mixer path I2C_Write (This, 16#608#, 16#0002#); -- Enable the DMIC2(Right) to AIF1 Timeslot 1 (Right) mixer path I2C_Write (This, 16#609#, 16#0002#); -- GPIO1 pin configuration GP1_DIR = output, GP1_FN = AIF1 DRC2 -- signal detect I2C_Write (This, 16#700#, 16#000E#); when Input_Line => -- Enable AIF1ADC1 (Left), Enable AIF1ADC1 (Right) -- Enable Left ADC, Enable Right ADC I2C_Write (This, 16#04#, 16#0303#); -- Enable AIF1 DRC1 Signal Detect & DRC in AIF1ADC1 Left/Right -- Timeslot 0 I2C_Write (This, 16#440#, 16#00DB#); -- Enable IN1L and IN1R, Disable IN2L and IN2R, Enable Thermal -- sensor & shutdown I2C_Write (This, 16#02#, 16#6350#); -- Enable the ADCL(Left) to AIF1 Timeslot 0 (Left) mixer path I2C_Write (This, 16#606#, 16#0002#); -- Enable the ADCR(Right) to AIF1 Timeslot 0 (Right) mixer path I2C_Write (This, 16#607#, 16#0002#); -- GPIO1 pin configuration GP1_DIR = output, GP1_FN = AIF1 DRC1 -- signal detect I2C_Write (This, 16#700#, 16#000D#); end case; This.Set_Frequency (Frequency); -- AIF1 Word Length = 16-bits, AIF1 Format = I2S (Default Register -- Value) I2C_Write (This, 16#300#, 16#4010#); -- slave mode I2C_Write (This, 16#302#, 16#0000#); -- Enable the DSP processing clock for AIF1, Enable the core clock I2C_Write (This, 16#208#, 16#000A#); -- Enable AIF1 Clock, AIF1 Clock Source = MCLK1 pin I2C_Write (This, 16#200#, 16#0001#); if Output /= No_Output then -- Analog Output Configuration -- Enable SPKRVOL PGA, Enable SPKMIXR, Enable SPKLVOL PGA, Enable -- SPKMIXL I2C_Write (This, 16#03#, 16#0300#); -- Left Speaker Mixer Volume = 0dB I2C_Write (This, 16#22#, 16#0000#); -- Speaker output mode = Class D, Right Speaker Mixer Volume = 0dB -- ((16#23#, 16#0100#) = class AB) I2C_Write (This, 16#23#, 16#0000#); -- Unmute DAC2 (Left) to Left Speaker Mixer (SPKMIXL) path, -- Unmute DAC2 (Right) to Right Speaker Mixer (SPKMIXR) path I2C_Write (This, 16#36#, 16#0300#); -- Enable bias generator, Enable VMID, Enable SPKOUTL, Enable SPKOUTR I2C_Write (This, 16#01#, 16#3003#); -- Headphone/Speaker Enable -- Enable Class W, Class W Envelope Tracking = AIF1 Timeslot 0 I2C_Write (This, 16#51#, 16#0001#); -- Enable bias generator, Enable VMID, Enable HPOUT1 (Left) and -- Enable HPOUT1 (Right) input stages idem for Speaker Power_Mgnt_Reg_1 := Power_Mgnt_Reg_1 or 16#0303# or 16#3003#; I2C_Write (This, 16#01#, Power_Mgnt_Reg_1); -- Enable HPOUT1 (Left) and HPOUT1 (Right) intermediate stages I2C_Write (This, 16#60#, 16#0022#); -- Enable Charge Pump I2C_Write (This, 16#4C#, 16#9F25#); -- Add Delay This.Time.Delay_Milliseconds (15); -- Select DAC1 (Left) to Left Headphone Output PGA (HPOUT1LVOL) path I2C_Write (This, 16#2D#, 16#0001#); -- Select DAC1 (Right) to Right Headphone Output PGA (HPOUT1RVOL) -- path. I2C_Write (This, 16#2E#, 16#0001#); -- Enable Left Output Mixer (MIXOUTL), Enable Right Output Mixer -- (MIXOUTR) idem for SPKOUTL and SPKOUTR. I2C_Write (This, 16#03#, 16#0030# or 16#0300#); -- Enable DC Servo and trigger start-up mode on left and right -- channels. I2C_Write (This, 16#54#, 16#0033#); -- Add Delay This.Time.Delay_Milliseconds (250); -- Enable HPOUT1 (Left) and HPOUT1 (Right) intermediate and output -- stages. Remove clamps. I2C_Write (This, 16#60#, 16#00EE#); -- Unmutes -- Unmute DAC 1 (Left) I2C_Write (This, 16#610#, 16#00C0#); -- Unmute DAC 1 (Right) I2C_Write (This, 16#611#, 16#00C0#); -- Unmute the AIF1 Timeslot 0 DAC path I2C_Write (This, 16#420#, 16#0000#); -- Unmute DAC 2 (Left) I2C_Write (This, 16#612#, 16#00C0#); -- Unmute DAC 2 (Right) I2C_Write (This, 16#613#, 16#00C0#); -- Unmute the AIF1 Timeslot 1 DAC2 path I2C_Write (This, 16#422#, 16#0000#); -- Volume Control This.Set_Volume (Volume); end if; if Input /= No_Input then if Input = Microphone then -- Enable Microphone bias 1 generator, Enable VMID Power_Mgnt_Reg_1 := Power_Mgnt_Reg_1 or 16#0013#; I2C_Write (This, 16#01#, Power_Mgnt_Reg_1); -- ADC oversample enable I2C_Write (This, 16#620#, 16#0002#); -- AIF ADC2 HPF enable, HPF cut = voice mode 1 fc=127Hz at fs=8kHz I2C_Write (This, 16#411#, 16#3800#); elsif Input = Input_Line then -- Enable normal bias generator, Enable VMID Power_Mgnt_Reg_1 := Power_Mgnt_Reg_1 or 16#0003#; I2C_Write (This, 16#01#, Power_Mgnt_Reg_1); -- Disable mute on IN1L, IN1L Volume = +0dB I2C_Write (This, 16#18#, 16#000B#); -- Disable mute on IN1R, IN1R Volume = +0dB I2C_Write (This, 16#1A#, 16#000B#); -- Disable mute on IN1L_TO_MIXINL, Gain = +0dB I2C_Write (This, 16#29#, 16#0025#); -- Disable mute on IN1R_TO_MIXINL, Gain = +0dB I2C_Write (This, 16#2A#, 16#0025#); -- IN1LN_TO_IN1L, IN1LP_TO_VMID, IN1RN_TO_IN1R, IN1RP_TO_VMID I2C_Write (This, 16#28#, 16#0011#); -- AIF ADC1 HPF enable, HPF cut = hifi mode fc=4Hz at fs=48kHz I2C_Write (This, 16#410#, 16#1800#); end if; -- Volume Control This.Set_Volume (Volume); end if; end Init; ------------- -- Read_ID -- ------------- function Read_ID (This : in out WM8994_Device) return UInt16 is begin return This.I2C_Read (WM8994_CHIPID_ADDR); end Read_ID; ---------- -- Play -- ---------- procedure Play (This : in out WM8994_Device) is begin This.Set_Mute (Mute_Off); end Play; ----------- -- Pause -- ----------- procedure Pause (This : in out WM8994_Device) is begin -- Pause the audio playing This.Set_Mute (Mute_On); -- CODEC in powersave mode I2C_Write (This, 16#02#, 16#01#); end Pause; ------------ -- Resume -- ------------ procedure Resume (This : in out WM8994_Device) is begin This.Set_Mute (Mute_Off); end Resume; ---------- -- Stop -- ---------- procedure Stop (This : in out WM8994_Device; Cmd : Stop_Mode) is begin if Output_Enabled then -- Mute the output first This.Set_Mute (Mute_On); if Cmd = Stop_Power_Down_Sw then return; end if; Output_Enabled := False; -- Mute the AIF1 Timeslot 0 DAC1 path I2C_Write (This, 16#420#, 16#0200#); -- Mute the AIF1 Timeslot 1 DAC2 path I2C_Write (This, 16#422#, 16#0200#); -- Disable DAC1L_TO_HPOUT1L I2C_Write (This, 16#2D#, 16#0000#); -- Disable DAC1R_TO_HPOUT1R I2C_Write (This, 16#2E#, 16#0000#); -- Disable DAC1 and DAC2 I2C_Write (This, 16#05#, 16#0000#); -- Reset Codec by writing in 0x0000 address register I2C_Write (This, 16#0000#, 16#0000#); end if; end Stop; ---------------- -- Set_Volume -- ---------------- procedure Set_Volume (This : in out WM8994_Device; Volume : Volume_Level) is -- Actual Volume in range 0 .. 16#3F# Converted_Volume : constant UInt16 := (if Volume = 100 then 63 else UInt16 (Volume) * 63 / 100); begin if Volume = 0 then -- Mute the codec This.Set_Mute (Mute_On); else This.Set_Mute (Mute_Off); -- Left Headphone Volume I2C_Write (This, 16#1C#, Converted_Volume or 16#140#); -- Right Headphone volume I2C_Write (This, 16#1D#, Converted_Volume or 16#140#); -- Left Speaker volume I2C_Write (This, 16#26#, Converted_Volume or 16#140#); -- Right Speaker volume I2C_Write (This, 16#27#, Converted_Volume or 16#140#); end if; end Set_Volume; -------------- -- Set_Mute -- -------------- procedure Set_Mute (This : in out WM8994_Device; Cmd : Mute) is begin if Output_Enabled then case Cmd is when Mute_On => -- Soft Mute the AIF1 Timeslot 0 DAC1 path L&R I2C_Write (This, 16#420#, 16#0200#); -- Soft Mute the AIF1 Timeslot 1 DAC2 path L&R I2C_Write (This, 16#422#, 16#0200#); when Mute_Off => -- Unmute the AIF1 Timeslot 0 DAC1 path L&R I2C_Write (This, 16#420#, 16#0000#); -- Unmute the AIF1 Timeslot 1 DAC2 path L&R I2C_Write (This, 16#422#, 16#0000#); end case; end if; end Set_Mute; --------------------- -- Set_Output_Mode -- --------------------- procedure Set_Output_Mode (This : in out WM8994_Device; Device : Output_Device) is begin case Device is when No_Output => -- Disable DAC1 (left), DAC1 (Right) I2C_Write (This, 16#05#, 16#0000#); -- Mute the AIF1 Timeslot 0 DAC1 path I2C_Write (This, 16#420#, 16#0200#); -- Mute the AIF1 Timeslot 1 DAC2 path I2C_Write (This, 16#422#, 16#0200#); when Speaker => -- Enable DAC1 (left), DAC1 (Right) I2C_Write (This, 16#05#, 16#0C0C#); -- Enable the AIF1 Timeslot 0 (Left) to DAC1 (left) mixer path I2C_Write (This, 16#601#, 16#0000#); -- Enable the AIF1 Timeslot 0 (Right) to DAC 1 (Right) mixer path I2C_Write (This, 16#602#, 16#0000#); -- Disable the AIF1 Timeslot 1 (Left) to DAC 2 (Left) mixer path I2C_Write (This, 16#604#, 16#0002#); -- Disable the AIF1 Timeslot 1 (Right) to DAC 2 (Right) mixer path I2C_Write (This, 16#605#, 16#0002#); when Headphone | Auto => -- Disable DAC1 (left), DAC1 (Right) -- Enable DAC2 (left), DAC2 (Right) I2C_Write (This, 16#05#, 16#0303#); -- Enable the AIF1 Timeslot 0 (Left) to DAC1 (left) mixer path I2C_Write (This, 16#601#, 16#0001#); -- Enable the AIF1 Timeslot 0 (Right) to DAC 1 (Right) mixer path I2C_Write (This, 16#602#, 16#0001#); -- Disable the AIF1 Timeslot 1 (Left) to DAC 2 (Left) mixer path I2C_Write (This, 16#604#, 16#0000#); -- Disable the AIF1 Timeslot 1 (Right) to DAC 2 (Right) mixer path I2C_Write (This, 16#605#, 16#0000#); when Both => -- Enable DAC1 (left), DAC1 (Right) -- Enable DAC2 (left), DAC2 (Right) I2C_Write (This, 16#05#, 16#0303# or 16#0C0C#); -- Enable the AIF1 Timeslot 0 (Left) to DAC1 (left) mixer path I2C_Write (This, 16#601#, 16#0001#); -- Enable the AIF1 Timeslot 0 (Right) to DAC 1 (Right) mixer path I2C_Write (This, 16#602#, 16#0001#); -- Enable the AIF1 Timeslot 1 (Left) to DAC 2 (Left) mixer path I2C_Write (This, 16#604#, 16#0002#); -- Enable the AIF1 Timeslot 1 (Right) to DAC 2 (Right) mixer path I2C_Write (This, 16#605#, 16#0002#); end case; end Set_Output_Mode; ------------------- -- Set_Frequency -- ------------------- procedure Set_Frequency (This : in out WM8994_Device; Freq : Audio_Frequency) is begin case Freq is when Audio_Freq_8kHz => -- AIF1 Sample Rate = 8 (kHz), ratio=256 I2C_Write (This, 16#210#, 16#0003#); when Audio_Freq_16kHz => -- AIF1 Sample Rate = 16 (kHz), ratio=256 I2C_Write (This, 16#210#, 16#0033#); when Audio_Freq_48kHz => -- AIF1 Sample Rate = 48 (kHz), ratio=256 I2C_Write (This, 16#210#, 16#0083#); when Audio_Freq_96kHz => -- AIF1 Sample Rate = 96 (kHz), ratio=256 I2C_Write (This, 16#210#, 16#00A3#); when Audio_Freq_11kHz => -- AIF1 Sample Rate = 11.025 (kHz), ratio=256 I2C_Write (This, 16#210#, 16#0013#); when Audio_Freq_22kHz => -- AIF1 Sample Rate = 22.050 (kHz), ratio=256 I2C_Write (This, 16#210#, 16#0043#); when Audio_Freq_44kHz => -- AIF1 Sample Rate = 44.1 (kHz), ratio=256 I2C_Write (This, 16#210#, 16#0073#); end case; end Set_Frequency; ----------- -- Reset -- ----------- procedure Reset (This : in out WM8994_Device) is begin I2C_Write (This, 16#0000#, 16#0000#); Output_Enabled := False; Input_Enabled := False; end Reset; end WM8994;
<AnimDB FragDef="Animations/Mannequin/ADB/PlayerFragmentIds.xml" TagDef="Animations/Mannequin/ADB/PlayerTags.xml"> <FragmentList> <Idle> <Fragment BlendOutDuration="0.2" Tags="Rotate"> <AnimLayer> <Blend ExitTime="0" StartTime="0" Duration="0.2"/> <Animation name="1DONE-BSpace_RotateRIFLE" flags="Loop"/> </AnimLayer> </Fragment> <Fragment BlendOutDuration="0.2" Tags="Walk"> <AnimLayer> <Blend ExitTime="0" StartTime="0" Duration="0.2"/> <Animation name="2DONE-BSpace_MoveStrafeRIFLE" flags="Loop"/> </AnimLayer> </Fragment> <Fragment BlendOutDuration="0.2" Tags="Walk+Rotate"> <AnimLayer> <Blend ExitTime="0" StartTime="0" Duration="0.2"/> <Animation name="2DONE-BSpace_MoveStrafeRIFLE" flags="Loop"/> </AnimLayer> </Fragment> <Fragment BlendOutDuration="0.2" Tags=""> <AnimLayer> <Blend ExitTime="0" StartTime="0" Duration="0.2"/> <Animation name="rifleAim_idle_3p" flags="Loop"/> </AnimLayer> </Fragment> </Idle> </FragmentList> </AnimDB>
with System; with Interfaces.C.Strings; with SDL.Types; use SDL.Types; with SDL.Video; with SDL.Error; package SDL_ttf is package C renames Interfaces.C; package CS renames Interfaces.C.Strings; package V renames SDL.Video; package Er renames SDL.Error; -- Reference to an internal structure containing font information. type Font_ptr is new System.Address; null_Font_ptr : constant Font_ptr := Font_ptr (System.Null_Address); -- Initialize the TTF engine - returns 0 if successful, -1 on error function Init return C.int; pragma Import (C, Init, "TTF_Init"); -- Open a font file and create a font of the specified point size function OpenFont (file : CS.chars_ptr; ptsize : C.int) return Font_ptr; pragma Import (C, OpenFont, "TTF_OpenFont"); function Open_Font (file : String; ptsize : C.int) return Font_ptr; pragma Inline (Open_Font); function OpenFontIndex (file : CS.chars_ptr; ptsize : C.int; index : C.long) return Font_ptr; pragma Import (C, OpenFontIndex, "TTF_OpenFontIndex"); function Open_Font_Index (file : String; ptsize : C.int; index : C.long) return Font_ptr; pragma Inline (Open_Font_Index); type TTF_STYLE is mod 2**8; for TTF_STYLE'Size use C.int'Size; -- Set and retrieve the font style -- This font style is implemented by modifying the -- font glyphs, and doesn't reflect any inherent -- properties of the truetype font file. TTF_STYLE_NORMAL : constant TTF_STYLE := 16#00#; TTF_STYLE_BOLD : constant TTF_STYLE := 16#01#; TTF_STYLE_ITALIC : constant TTF_STYLE := 16#02#; TTF_STYLE_UNDERLINE : constant TTF_STYLE := 16#04#; function GetFontStyle (font : Font_ptr) return TTF_STYLE; pragma Import (C, GetFontStyle, "TTF_GetFontStyle"); procedure SetFontStyle (font : Font_ptr; style : TTF_STYLE); pragma Import (C, SetFontStyle, "TTF_SetFontStyle"); procedure Set_Font_Style (font : Font_ptr; style : TTF_STYLE); pragma Inline (Set_Font_Style); -- Get the total height of the font - usually equal to -- point size. function FontHeight (font : Font_ptr) return C.int; pragma Import (C, FontHeight, "TTF_FontHeight"); -- Get the offset from the baseline to the top of the -- font. This is a positive value, relative to the -- baseline. function FontAscent (font : Font_ptr) return C.int; pragma Import (C, FontAscent, "TTF_FontAscent"); -- Get the offset from the baseline to the botton of -- the font. This is a negative value, relative to the -- baseline. function FontDescent (font : Font_ptr) return C.int; pragma Import (C, FontDescent, "TTF_FontDescent"); -- Get the recommended spacing between lines of text -- for this font. function FontLineSkip (font : Font_ptr) return C.int; pragma Import (C, FontLineSkip, "TTF_FontLineSkip"); -- Get the number of faces of the font. function FontFaces (font : Font_ptr) return C.long; pragma Import (C, FontFaces, "TTF_FontFaces"); -- Get the font face attributes, if any. function FontFaceIsFixedWidth (font : Font_ptr) return C.int; pragma Import (c, FontFaceIsFixedWidth, "TTF_FontFaceIsFixedWidth"); function FontFaceFamilyName (font : Font_ptr) return CS.chars_ptr; pragma Import (C, FontFaceFamilyName, "TTF_FontFaceFamilyName"); function Font_Face_Family_Name (font : Font_ptr) return String; pragma Inline (Font_Face_Family_Name); function FontFaceStyleName (font : Font_ptr) return CS.chars_ptr; pragma Import (C, FontFaceStyleName, "TTF_FontFaceStyleName"); function Font_Face_Style_Name (font : Font_ptr) return String; pragma Inline (Font_Face_Style_Name); -- Get the metrics (dimensions) of a glyph. function GlyphMetrics (font : Font_ptr; ch : Uint16; minx, maxx : int_ptr; miny, maxy : int_ptr; advance : int_ptr) return C.int; pragma Import (C, GlyphMetrics, "TTF_GlyphMetrics"); -- Get the dimensions of a rendered string of text. function SizeText (font : Font_ptr; text : CS.chars_ptr; w, h : C.int) return C.int; pragma Import (C, SizeText, "TTF_SizeText"); function Size_Text (font : Font_ptr; text : String; w, h : C.int) return C.int; pragma Inline (Size_Text); function SizeUTF8 (font : Font_ptr; text : CS.chars_ptr; w, h : C.int) return C.int; pragma Import (C, SizeUTF8, "TTF_SizeUTF8"); function Size_UTF8 (font : Font_ptr; text : String; w, h : C.int) return C.int; pragma Inline (Size_UTF8); function SizeUNICODE (font : Font_ptr; text : Uint16_ptr; w, h : C.int) return C.int; pragma Import (C, SizeUNICODE, "TTF_SizeUNICODE"); -- Create an 8-bit palettized surface and render the given text -- at fast quality with the given font and color. The 0 pixel is -- the colorkey, giving a transparent background, and the 1 pixel -- set to the text color. -- This function returns the new surface, or NULL if there was an -- error. function RenderText_Solid (font : Font_ptr; text : CS.chars_ptr; fg : V.Color) return V.Surface_ptr; pragma Import (C, RenderText_Solid, "TTF_RenderText_Solid"); function Render_Text_Solid (font : Font_ptr; text : String; fg : V.Color) return V.Surface_ptr; pragma Inline (Render_Text_Solid); function RenderUTF8_Solid (font : Font_ptr; text : CS.chars_ptr; fg : V.Color) return V.Surface_ptr; pragma Import (C, RenderUTF8_Solid, "TTF_RenderUTF8_Solid"); function Render_UTF8_Solid (font : Font_ptr; text : String; fg : V.Color) return V.Surface_ptr; pragma Inline (Render_UTF8_Solid); function RenderUNICODE_Solid (font : Font_ptr; text : Uint16_ptr; fg : V.Color) return V.Surface_ptr; pragma Import (C, RenderUNICODE_Solid, "TTF_RenderUNICODE_Solid"); -- Create an 8-bit palettized surface and render the given glyph at -- fast quality with the given font and color. The 0 pixel is the -- colorkey, giving a transparent background, and the 1 pixel is -- set to the text color. The glyph is rendered without any padding -- or centering in the X direction, and aligned normally in the Y -- direction. This function returns the new surface, of NULL if there -- was an error. function RenderGlyph_Solid (font : Font_ptr; ch : Uint16; fg : V.Color) return V.Surface_ptr; pragma Import (C, RenderGlyph_Solid, "TTF_RenderGlyph_Solid"); -- Create an 8-bit palettized surface and render the given text at -- high quality with the given font and colors. The 0 pixel is -- background, while other pixels have varying degrees of the -- foreground color. This function returns the new surface, or NUll if -- there was an error. function RenderText_Shaded (font : Font_ptr; text : CS.chars_ptr; fg : V.Color; bg : V.Color) return V.Surface_ptr; pragma Import (C, RenderText_Shaded, "TTF_RenderText_Shaded"); function Render_Text_Shaded (font : Font_ptr; text : String; fg : V.Color; bg : V.Color) return V.Surface_ptr; pragma Inline (Render_Text_Shaded); function RenderUTF8_Shaded (font : Font_ptr; text : CS.chars_ptr; fg : V.Color; bg : V.Color) return V.Surface_ptr; pragma Import (C, RenderUTF8_Shaded, "TTF_RenderUTF8_Shaded"); function Render_UTF8_Shaded (font : Font_ptr; text : String; fg : V.Color; bg : V.Color) return V.Surface_ptr; pragma Inline (Render_UTF8_Shaded); function RenderUNICODE_Shaded (font : Font_ptr; text : Uint16_ptr; fg : V.Color; bg : V.Color) return V.Surface_ptr; pragma Import (C, RenderUNICODE_Shaded, "TTF_RenderUNICODE_Shaded"); -- Create an 8-bit palettized surface and render the given glyph at -- high quality with the given font and colors. The 0 pixel is the -- background while other pixels have varying degrees of th foreground color. -- The glyph is rendered without any padding or centering in the X -- direction, and aligned normally in the Y direction. -- This function returns the new surface, or NULL if there was an error. function RenderGlyph_Shaded (font : Font_ptr; ch : Uint16; fg : V.Color; bg : V.Color) return V.Surface_ptr; pragma Import (C, RenderGlyph_Shaded, "TTF_RenderGlyph_Shaded"); -- Create a 32-bit ARGB surface and render the given text at high quality, -- using alpha blending to dither the font with the given clor. -- This function returns the new surface, or NULL if there was an error. function RenderText_Blended (font : Font_ptr; text : CS.chars_ptr; fg : V.Color) return V.Surface; pragma Import (C, RenderText_Blended, "TTF_RenderText_Blended"); function Render_Text_Blended (font : Font_ptr; text : String; fg : V.Color) return V.Surface; pragma Inline (Render_Text_Blended); function RenderUTF8_Blended (font : Font_ptr; text : CS.chars_ptr; fg : V.Color) return V.Surface; pragma Import (C, RenderUTF8_Blended, "TTF_RenderUTF8_Blended"); function Render_UTF8_Blended (font : Font_ptr; text : String; fg : V.Color) return V.Surface; pragma Inline (Render_UTF8_Blended); function RenderUNICODE_Blended (font : Font_ptr; text : Uint16_ptr; fg : V.Color) return V.Surface; pragma Import (C, RenderUNICODE_Blended, "TTF_RenderUNICODE_Blended"); -- Create a 32-bit ARGB surface and render the given glyph at high quality -- using alpha blending to dither the font with the given color. -- The glyph is rendered without any padding or centering in the X -- direction, and aligned normally in the Y direction. -- This function returns the new surface, or NULL if there was an error. function RenderGlyph_Blended (font : Font_ptr; ch : Uint16; fg : V.Color) return V.Surface; pragma Import (C, RenderGlyph_Blended, "TTF_RenderGlyph_Blended"); -- For compatibility with previous versions, here are the old functions. function RenderText (font : Font_ptr; text : CS.chars_ptr; fg : V.Color; bg : V.Color) return V.Surface_ptr renames RenderText_Shaded; function Render_Text (font : Font_ptr; text : String; fg : V.Color; bg : V.Color) return V.Surface_ptr renames Render_Text_Shaded; function RenderUTF8 (font : Font_ptr; text : CS.chars_ptr; fg : V.Color; bg : V.Color) return V.Surface_ptr renames RenderUTF8_Shaded; function Render_UTF8 (font : Font_ptr; text : String; fg : V.Color; bg : V.Color) return V.Surface_ptr renames Render_UTF8_Shaded; function RenderUNICODE (font : Font_ptr; text : Uint16_ptr; fg : V.Color; bg : V.Color) return V.Surface_ptr renames RenderUNICODE_Shaded; -- Close an opened font file. procedure CloseFont (font : Font_ptr); pragma Import (C, CloseFont, "TTF_CloseFont"); -- De-initialize the TTF engine. procedure TTF_Quit; pragma Import (C, TTF_Quit, "TTF_Quit"); -- We'll use SDL for reporting errors. procedure SetError (fmt : CS.chars_ptr) renames Er.SetError; procedure Set_Error (fmt : String) renames Er.Set_Error; function GetError return CS.chars_ptr renames Er.GetError; function Get_Error return String renames Er.Get_Error; end SDL_ttf;
package Md_Example4.Nested is type T is new Md_Example4.T with record Child_Attribute : Globals_Example1.Itype; end record; procedure Do_It (The_T : T); end Md_Example4.Nested;
with Libadalang.Analysis; with Libadalang.Common; with Rejuvenation.Factory; use Rejuvenation.Factory; package Generator is package LAL renames Libadalang.Analysis; package LALCO renames Libadalang.Common; Filename_LAL_Ads : constant String := "C:\GNATPRO\22.1\include\libadalang\libadalang-analysis.ads"; Filename_LALCO_Ads : constant String := "C:\GNATPRO\22.1\include\libadalang\libadalang-common.ads"; Unit_LAL_Ads : constant LAL.Analysis_Unit := Open_File (Filename_LAL_Ads); Unit_LALCO_Ads : constant LAL.Analysis_Unit := Open_File (Filename_LALCO_Ads); end Generator;
-------------------------------------------------------------------------------- -- Copyright (C) 2020 by Heisenbug Ltd. (gh+owm@heisenbug.eu) -- -- This work is free. You can redistribute it and/or modify it under the -- terms of the Do What The Fuck You Want To Public License, Version 2, -- as published by Sam Hocevar. See the LICENSE file for more details. -------------------------------------------------------------------------------- pragma License (Unrestricted); -------------------------------------------------------------------------------- --% @summary --% Open_Weather_Map.API.Service.Weather -- --% @description --% Provides the query object implementing a single id based query. -------------------------------------------------------------------------------- package Open_Weather_Map.API.Service.Weather is ----------------------------------------------------------------------------- -- API: Current weather data (by city ID) ----------------------------------------------------------------------------- type T is new Service.T with private; ----------------------------------------------------------------------------- -- Initialize ----------------------------------------------------------------------------- procedure Initialize (Self : out T; Configuration : in GNATCOLL.JSON.JSON_Value; Connection : not null Client.T_Access; Max_Cache_Interval : in Ada.Real_Time.Time_Span := Default_Cache_Interval; Id : in City_Id); --% Initializes an instance of a single query. -- --% @param Self --% Instance of the single query to initialize. -- --% @param Configuration --% Configuration data object containing connection relevant data (proxy --% server, API key, etc.). -- --% @param Connection --% The connection to be used for client server communication. -- --% @param Max_Cache_Interval --% Denotes the maximum frequency at which actual queries are being sent to --% the server. -- --% @param Id --% Location id of the place to be queried. private type T is new API. Service.T with null record; ----------------------------------------------------------------------------- -- Decode_Response ----------------------------------------------------------------------------- overriding function Decode_Response (Self : in T; Root : in GNATCOLL.JSON.JSON_Value) return Data_Set; --% Decodes a single query response from the server. -- --% @param Self --% The single query instance. -- --% @param Root --% Root of the JSON data sent back by the server. -- --% @return --% The data set decoded from the response in Root. end Open_Weather_Map.API.Service.Weather;
with Ada.Text_IO; use Ada.Text_IO; procedure main is begin -- Bonjour Put("Hello Master Falindir"); end main;
with STM32GD.I2C; with STM32_SVD; use STM32_SVD; package body Drivers.Si7006 is Measurement : STM32GD.I2C.I2C_Data (0 .. 2); function Temperature_x100 return Temperature_Type is begin if I2C.Master_Transmit (16#40#, 16#E3#, True) and then I2C.Master_Receive (16#40#, Measurement) then return Temperature_Type ( Shift_Right ((UInt32 (Measurement (0)) * 256 + UInt32 (Measurement (1))) * 17572, 16) - 4685); else return 0; end if; end Temperature_x100; function Humidity return Humidity_Type is begin if I2C.Master_Transmit (16#40#, 16#E5#, True) and then I2C.Master_Receive (16#40#, Measurement) then return Humidity_Type ( Shift_Right ((UInt32 (Measurement (0)) * 256 + UInt32 (Measurement (1))) * 125, 16) - 6); else return 0; end if; end Humidity; end Drivers.Si7006;
with Ada.UCD.East_Asian_Width; package body Ada.Strings.East_Asian_Width is use type UCD.UCS_4; pragma Compile_Time_Error ( UCD.East_Asian_Width_Type'Pos (UCD.N) /= Width_Kind'Pos (Neutral) or else UCD.East_Asian_Width_Type'Pos (UCD.Na) /= Width_Kind'Pos (Narrow) or else UCD.East_Asian_Width_Type'Pos (UCD.H) /= Width_Kind'Pos (Half_Width) or else UCD.East_Asian_Width_Type'Pos (UCD.A) /= Width_Kind'Pos (Ambiguous) or else UCD.East_Asian_Width_Type'Pos (UCD.W) /= Width_Kind'Pos (Wide) or else UCD.East_Asian_Width_Type'Pos (UCD.F) /= Width_Kind'Pos (Full_Width), "bad order"); type Long_Boolean is new Boolean; for Long_Boolean'Size use Long_Integer'Size; function expect (exp, c : Long_Boolean) return Long_Boolean with Import, Convention => Intrinsic, External_Name => "__builtin_expect"; function Search ( Table : UCD.East_Asian_Width.Table_16_Type; Code : UCD.UCS_4) return UCD.East_Asian_Width_Type; function Search ( Table : UCD.East_Asian_Width.Table_16_Type; Code : UCD.UCS_4) return UCD.East_Asian_Width_Type is L : Positive := Table'First; H : Natural := Table'Last; begin loop declare type Unsigned is mod 2 ** Integer'Size; M : constant Positive := Integer (Unsigned (L + H) / 2); M_Item : UCD.East_Asian_Width.Table_16_Item_Type renames Table (M); begin if Code < M_Item.Start then H := M - 1; elsif expect ( Long_Boolean (Code >= M_Item.Start + UCD.UCS_4 (M_Item.Length)), True) then L := M + 1; else return M_Item.Width; end if; end; exit when L > H; end loop; return UCD.N; end Search; function Search ( Table : UCD.East_Asian_Width.Table_32_Type; Code : UCD.UCS_4) return UCD.East_Asian_Width_Type; function Search ( Table : UCD.East_Asian_Width.Table_32_Type; Code : UCD.UCS_4) return UCD.East_Asian_Width_Type is L : Positive := Table'First; H : Natural := Table'Last; begin loop declare type Unsigned is mod 2 ** Integer'Size; M : constant Positive := Integer (Unsigned (L + H) / 2); M_Item : UCD.East_Asian_Width.Table_32_Item_Type renames Table (M); begin if Code < M_Item.Start then H := M - 1; elsif expect ( Long_Boolean (Code >= M_Item.Start + UCD.UCS_4 (M_Item.Length)), True) then L := M + 1; else return M_Item.Width; end if; end; exit when L > H; end loop; return UCD.N; end Search; -- implementation function Kind (C : Wide_Wide_Character) return Width_Kind is Code : constant UCD.UCS_4 := Wide_Wide_Character'Pos (C); begin case Code is when 0 .. 16#FFFF# => return Width_Kind'Val ( UCD.East_Asian_Width_Type'Pos ( Search (UCD.East_Asian_Width.Table_XXXX, Code))); when 16#10000# .. 16#1FFFF# => return Width_Kind'Val ( UCD.East_Asian_Width_Type'Pos ( Search ( UCD.East_Asian_Width.Table_1XXXX, Code - 16#10000#))); when 16#20000# .. 16#7FFFFFFF# => return Width_Kind'Val ( UCD.East_Asian_Width_Type'Pos ( Search (UCD.East_Asian_Width.Table_XXXXXXXX, Code))); end case; end Kind; function Is_Full_Width (W : Width_Kind; East_Asian : Boolean) return Boolean is begin return Width_Kind'Pos (W) > Width_Kind'Pos (Ambiguous) - Boolean'Pos (East_Asian); end Is_Full_Width; end Ada.Strings.East_Asian_Width;
pragma License (Unrestricted); -- implementation unit specialized for Darwin with C.sys.mount; package System.Native_Directories.Volumes is -- File system information. pragma Preelaborate; subtype File_Size is Ada.Streams.Stream_Element_Count; type File_System is record Statistics : aliased C.sys.mount.struct_statfs := (f_bsize => 0, others => <>); Case_Sensitive : Boolean; Case_Sensitive_Valid : Boolean; end record; pragma Suppress_Initialization (File_System); function Is_Assigned (FS : File_System) return Boolean; pragma Inline (Is_Assigned); Disable_Controlled : constant Boolean := True; procedure Get (Name : String; FS : aliased out File_System); procedure Finalize (FS : in out File_System) is null; pragma Inline (Finalize); -- [gcc-7] can not skip calling null procedure function Size (FS : File_System) return File_Size; function Free_Space (FS : File_System) return File_Size; pragma Inline (Size); pragma Inline (Free_Space); function Owner (FS : File_System) return String; function Format_Name (FS : File_System) return String; function Directory (FS : File_System) return String; function Device (FS : File_System) return String; function Case_Preserving (FS : File_System) return Boolean; function Case_Sensitive (FS : aliased in out File_System) return Boolean; function Is_HFS (FS : File_System) return Boolean; pragma Inline (Is_HFS); subtype File_System_Id is C.sys.mount.fsid_t; function Identity (FS : File_System) return File_System_Id; pragma Inline (Identity); end System.Native_Directories.Volumes;
------------------------------------------------------------------------------ -- -- -- GNAT LIBRARY COMPONENTS -- -- -- -- ADA.CONTAINERS.HASH_TABLES.GENERIC_OPERATIONS -- -- -- -- B o d y -- -- -- -- Copyright (C) 2004-2021, Free Software Foundation, Inc. -- -- -- -- GNAT is free software; you can redistribute it and/or modify it under -- -- terms of the GNU General Public License as published by the Free Soft- -- -- ware Foundation; either version 3, or (at your option) any later ver- -- -- sion. GNAT is distributed in the hope that it will be useful, but WITH- -- -- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY -- -- or FITNESS FOR A PARTICULAR PURPOSE. -- -- -- -- -- -- -- -- -- -- -- -- You should have received a copy of the GNU General Public License and -- -- a copy of the GCC Runtime Library Exception along with this program; -- -- see the files COPYING3 and COPYING.RUNTIME respectively. If not, see -- -- <http://www.gnu.org/licenses/>. -- -- -- -- This unit was originally developed by Matthew J Heaney. -- ------------------------------------------------------------------------------ with Ada.Containers.Prime_Numbers; with Ada.Unchecked_Deallocation; with System; use type System.Address; package body Ada.Containers.Hash_Tables.Generic_Operations is pragma Warnings (Off, "variable ""Busy*"" is not referenced"); pragma Warnings (Off, "variable ""Lock*"" is not referenced"); -- See comment in Ada.Containers.Helpers type Buckets_Allocation is access all Buckets_Type; -- Used for allocation and deallocation (see New_Buckets and Free_Buckets). -- This is necessary because Buckets_Access has an empty storage pool. ------------ -- Adjust -- ------------ procedure Adjust (HT : in out Hash_Table_Type) is Src_Buckets : constant Buckets_Access := HT.Buckets; N : constant Count_Type := HT.Length; Src_Node : Node_Access; Dst_Prev : Node_Access; begin -- If the counts are nonzero, execution is technically erroneous, but -- it seems friendly to allow things like concurrent "=" on shared -- constants. Zero_Counts (HT.TC); HT.Buckets := null; HT.Length := 0; if N = 0 then return; end if; -- Technically it isn't necessary to allocate the exact same length -- buckets array, because our only requirement is that following -- assignment the source and target containers compare equal (that is, -- operator "=" returns True). We can satisfy this requirement with any -- hash table length, but we decide here to match the length of the -- source table. This has the benefit that when iterating, elements of -- the target are delivered in the exact same order as for the source. HT.Buckets := New_Buckets (Length => Src_Buckets'Length); for Src_Index in Src_Buckets'Range loop Src_Node := Src_Buckets (Src_Index); if Src_Node /= null then declare Dst_Node : constant Node_Access := Copy_Node (Src_Node); -- See note above pragma Assert (Checked_Index (HT, Dst_Node) = Src_Index); begin HT.Buckets (Src_Index) := Dst_Node; HT.Length := HT.Length + 1; Dst_Prev := Dst_Node; end; Src_Node := Next (Src_Node); while Src_Node /= null loop declare Dst_Node : constant Node_Access := Copy_Node (Src_Node); -- See note above pragma Assert (Checked_Index (HT, Dst_Node) = Src_Index); begin Set_Next (Node => Dst_Prev, Next => Dst_Node); HT.Length := HT.Length + 1; Dst_Prev := Dst_Node; end; Src_Node := Next (Src_Node); end loop; end if; end loop; pragma Assert (HT.Length = N); end Adjust; -------------- -- Capacity -- -------------- function Capacity (HT : Hash_Table_Type) return Count_Type is begin if HT.Buckets = null then return 0; end if; return HT.Buckets'Length; end Capacity; ------------------- -- Checked_Index -- ------------------- function Checked_Index (Hash_Table : aliased in out Hash_Table_Type; Buckets : Buckets_Type; Node : Node_Access) return Hash_Type is Lock : With_Lock (Hash_Table.TC'Unrestricted_Access); begin return Index (Buckets, Node); end Checked_Index; function Checked_Index (Hash_Table : aliased in out Hash_Table_Type; Node : Node_Access) return Hash_Type is begin return Checked_Index (Hash_Table, Hash_Table.Buckets.all, Node); end Checked_Index; ----------- -- Clear -- ----------- procedure Clear (HT : in out Hash_Table_Type) is Index : Hash_Type := 0; Node : Node_Access; begin TC_Check (HT.TC); while HT.Length > 0 loop while HT.Buckets (Index) = null loop Index := Index + 1; end loop; declare Bucket : Node_Access renames HT.Buckets (Index); begin loop Node := Bucket; Bucket := Next (Bucket); HT.Length := HT.Length - 1; Free (Node); exit when Bucket = null; end loop; end; end loop; end Clear; -------------------------- -- Delete_Node_At_Index -- -------------------------- procedure Delete_Node_At_Index (HT : in out Hash_Table_Type; Indx : Hash_Type; X : in out Node_Access) is Prev : Node_Access; Curr : Node_Access; begin Prev := HT.Buckets (Indx); if Prev = X then HT.Buckets (Indx) := Next (Prev); HT.Length := HT.Length - 1; Free (X); return; end if; if Checks and then HT.Length = 1 then raise Program_Error with "attempt to delete node not in its proper hash bucket"; end if; loop Curr := Next (Prev); if Checks and then Curr = null then raise Program_Error with "attempt to delete node not in its proper hash bucket"; end if; if Curr = X then Set_Next (Node => Prev, Next => Next (Curr)); HT.Length := HT.Length - 1; Free (X); return; end if; Prev := Curr; end loop; end Delete_Node_At_Index; --------------------------- -- Delete_Node_Sans_Free -- --------------------------- procedure Delete_Node_Sans_Free (HT : in out Hash_Table_Type; X : Node_Access) is pragma Assert (X /= null); Indx : Hash_Type; Prev : Node_Access; Curr : Node_Access; begin if Checks and then HT.Length = 0 then raise Program_Error with "attempt to delete node from empty hashed container"; end if; Indx := Checked_Index (HT, X); Prev := HT.Buckets (Indx); if Checks and then Prev = null then raise Program_Error with "attempt to delete node from empty hash bucket"; end if; if Prev = X then HT.Buckets (Indx) := Next (Prev); HT.Length := HT.Length - 1; return; end if; if Checks and then HT.Length = 1 then raise Program_Error with "attempt to delete node not in its proper hash bucket"; end if; loop Curr := Next (Prev); if Checks and then Curr = null then raise Program_Error with "attempt to delete node not in its proper hash bucket"; end if; if Curr = X then Set_Next (Node => Prev, Next => Next (Curr)); HT.Length := HT.Length - 1; return; end if; Prev := Curr; end loop; end Delete_Node_Sans_Free; -------------- -- Finalize -- -------------- procedure Finalize (HT : in out Hash_Table_Type) is begin Clear (HT); Free_Buckets (HT.Buckets); end Finalize; ----------- -- First -- ----------- function First (HT : Hash_Table_Type) return Node_Access is Dummy : Hash_Type; begin return First (HT, Dummy); end First; function First (HT : Hash_Table_Type; Position : out Hash_Type) return Node_Access is begin if HT.Length = 0 then Position := Hash_Type'Last; return null; end if; Position := HT.Buckets'First; loop if HT.Buckets (Position) /= null then return HT.Buckets (Position); end if; Position := Position + 1; end loop; end First; ------------------ -- Free_Buckets -- ------------------ procedure Free_Buckets (Buckets : in out Buckets_Access) is procedure Free is new Ada.Unchecked_Deallocation (Buckets_Type, Buckets_Allocation); begin -- Buckets must have been created by New_Buckets. Here, we convert back -- to the Buckets_Allocation type, and do the free on that. Free (Buckets_Allocation (Buckets)); end Free_Buckets; --------------------- -- Free_Hash_Table -- --------------------- procedure Free_Hash_Table (Buckets : in out Buckets_Access) is Node : Node_Access; begin if Buckets = null then return; end if; for J in Buckets'Range loop while Buckets (J) /= null loop Node := Buckets (J); Buckets (J) := Next (Node); Free (Node); end loop; end loop; Free_Buckets (Buckets); end Free_Hash_Table; ------------------- -- Generic_Equal -- ------------------- function Generic_Equal (L, R : Hash_Table_Type) return Boolean is begin if L.Length /= R.Length then return False; end if; if L.Length = 0 then return True; end if; declare -- Per AI05-0022, the container implementation is required to detect -- element tampering by a generic actual subprogram. Lock_L : With_Lock (L.TC'Unrestricted_Access); Lock_R : With_Lock (R.TC'Unrestricted_Access); L_Index : Hash_Type; L_Node : Node_Access; N : Count_Type; begin -- Find the first node of hash table L L_Index := 0; loop L_Node := L.Buckets (L_Index); exit when L_Node /= null; L_Index := L_Index + 1; end loop; -- For each node of hash table L, search for an equivalent node in -- hash table R. N := L.Length; loop if not Find (HT => R, Key => L_Node) then return False; end if; N := N - 1; L_Node := Next (L_Node); if L_Node = null then -- We have exhausted the nodes in this bucket if N = 0 then return True; end if; -- Find the next bucket loop L_Index := L_Index + 1; L_Node := L.Buckets (L_Index); exit when L_Node /= null; end loop; end if; end loop; end; end Generic_Equal; ----------------------- -- Generic_Iteration -- ----------------------- procedure Generic_Iteration (HT : Hash_Table_Type) is procedure Wrapper (Node : Node_Access; Dummy_Pos : Hash_Type); ------------- -- Wrapper -- ------------- procedure Wrapper (Node : Node_Access; Dummy_Pos : Hash_Type) is begin Process (Node); end Wrapper; procedure Internal_With_Pos is new Generic_Iteration_With_Position (Wrapper); -- Start of processing for Generic_Iteration begin Internal_With_Pos (HT); end Generic_Iteration; ------------------------------------- -- Generic_Iteration_With_Position -- ------------------------------------- procedure Generic_Iteration_With_Position (HT : Hash_Table_Type) is Node : Node_Access; begin if HT.Length = 0 then return; end if; for Indx in HT.Buckets'Range loop Node := HT.Buckets (Indx); while Node /= null loop Process (Node, Indx); Node := Next (Node); end loop; end loop; end Generic_Iteration_With_Position; ------------------ -- Generic_Read -- ------------------ procedure Generic_Read (Stream : not null access Root_Stream_Type'Class; HT : out Hash_Table_Type) is N : Count_Type'Base; NN : Hash_Type; begin Clear (HT); Count_Type'Base'Read (Stream, N); if Checks and then N < 0 then raise Program_Error with "stream appears to be corrupt"; end if; if N = 0 then return; end if; -- The RM does not specify whether or how the capacity changes when a -- hash table is streamed in. Therefore we decide here to allocate a new -- buckets array only when it's necessary to preserve representation -- invariants. if HT.Buckets = null or else HT.Buckets'Length < N then Free_Buckets (HT.Buckets); NN := Prime_Numbers.To_Prime (N); HT.Buckets := New_Buckets (Length => NN); end if; for J in 1 .. N loop declare Node : constant Node_Access := New_Node (Stream); Indx : constant Hash_Type := Checked_Index (HT, Node); B : Node_Access renames HT.Buckets (Indx); begin Set_Next (Node => Node, Next => B); B := Node; end; HT.Length := HT.Length + 1; end loop; end Generic_Read; ------------------- -- Generic_Write -- ------------------- procedure Generic_Write (Stream : not null access Root_Stream_Type'Class; HT : Hash_Table_Type) is procedure Write (Node : Node_Access); pragma Inline (Write); procedure Write is new Generic_Iteration (Write); ----------- -- Write -- ----------- procedure Write (Node : Node_Access) is begin Write (Stream, Node); end Write; begin -- See Generic_Read for an explanation of why we do not stream out the -- buckets array length too. Count_Type'Base'Write (Stream, HT.Length); Write (HT); end Generic_Write; ----------- -- Index -- ----------- function Index (Buckets : Buckets_Type; Node : Node_Access) return Hash_Type is begin return Hash_Node (Node) mod Buckets'Length; end Index; function Index (Hash_Table : Hash_Table_Type; Node : Node_Access) return Hash_Type is begin return Index (Hash_Table.Buckets.all, Node); end Index; ---------- -- Move -- ---------- procedure Move (Target, Source : in out Hash_Table_Type) is begin if Target'Address = Source'Address then return; end if; TC_Check (Source.TC); Clear (Target); declare Buckets : constant Buckets_Access := Target.Buckets; begin Target.Buckets := Source.Buckets; Source.Buckets := Buckets; end; Target.Length := Source.Length; Source.Length := 0; end Move; ----------------- -- New_Buckets -- ----------------- function New_Buckets (Length : Hash_Type) return Buckets_Access is subtype Rng is Hash_Type range 0 .. Length - 1; begin -- Allocate in Buckets_Allocation'Storage_Pool, then convert to -- Buckets_Access. return Buckets_Access (Buckets_Allocation'(new Buckets_Type (Rng))); end New_Buckets; ---------- -- Next -- ---------- function Next (HT : aliased in out Hash_Table_Type; Node : Node_Access; Position : in out Hash_Type) return Node_Access is Result : Node_Access; First : Hash_Type; begin -- First, check if the node has other nodes chained to it Result := Next (Node); if Result /= null then return Result; end if; -- Check if we were supplied a position for Node, from which we -- can start iteration on the buckets. if Position /= Hash_Type'Last then First := Position + 1; else First := Checked_Index (HT, Node) + 1; end if; for Indx in First .. HT.Buckets'Last loop Result := HT.Buckets (Indx); if Result /= null then Position := Indx; return Result; end if; end loop; return null; end Next; function Next (HT : aliased in out Hash_Table_Type; Node : Node_Access) return Node_Access is Pos : Hash_Type := Hash_Type'Last; begin return Next (HT, Node, Pos); end Next; ---------------------- -- Reserve_Capacity -- ---------------------- procedure Reserve_Capacity (HT : in out Hash_Table_Type; N : Count_Type) is NN : Hash_Type; begin if HT.Buckets = null then if N > 0 then NN := Prime_Numbers.To_Prime (N); HT.Buckets := New_Buckets (Length => NN); end if; return; end if; if HT.Length = 0 then -- This is the easy case. There are no nodes, so no rehashing is -- necessary. All we need to do is allocate a new buckets array -- having a length implied by the specified capacity. (We say -- "implied by" because bucket arrays are always allocated with a -- length that corresponds to a prime number.) if N = 0 then Free_Buckets (HT.Buckets); return; end if; if N = HT.Buckets'Length then return; end if; NN := Prime_Numbers.To_Prime (N); if NN = HT.Buckets'Length then return; end if; declare X : Buckets_Access := HT.Buckets; pragma Warnings (Off, X); begin HT.Buckets := New_Buckets (Length => NN); Free_Buckets (X); end; return; end if; if N = HT.Buckets'Length then return; end if; if N < HT.Buckets'Length then -- This is a request to contract the buckets array. The amount of -- contraction is bounded in order to preserve the invariant that the -- buckets array length is never smaller than the number of elements -- (the load factor is 1). if HT.Length >= HT.Buckets'Length then return; end if; NN := Prime_Numbers.To_Prime (HT.Length); if NN >= HT.Buckets'Length then return; end if; else NN := Prime_Numbers.To_Prime (Count_Type'Max (N, HT.Length)); if NN = HT.Buckets'Length then -- can't expand any more return; end if; end if; TC_Check (HT.TC); Rehash : declare Dst_Buckets : Buckets_Access := New_Buckets (Length => NN); Src_Buckets : Buckets_Access := HT.Buckets; pragma Warnings (Off, Src_Buckets); L : Count_Type renames HT.Length; LL : constant Count_Type := L; Src_Index : Hash_Type := Src_Buckets'First; begin while L > 0 loop declare Src_Bucket : Node_Access renames Src_Buckets (Src_Index); begin while Src_Bucket /= null loop declare Src_Node : constant Node_Access := Src_Bucket; Dst_Index : constant Hash_Type := Checked_Index (HT, Dst_Buckets.all, Src_Node); Dst_Bucket : Node_Access renames Dst_Buckets (Dst_Index); begin Src_Bucket := Next (Src_Node); Set_Next (Src_Node, Dst_Bucket); Dst_Bucket := Src_Node; end; pragma Assert (L > 0); L := L - 1; end loop; exception when others => -- If there's an error computing a hash value during a -- rehash, then AI-302 says the nodes "become lost." The -- issue is whether to actually deallocate these lost nodes, -- since they might be designated by extant cursors. Here -- we decide to deallocate the nodes, since it's better to -- solve real problems (storage consumption) rather than -- imaginary ones (the user might, or might not, dereference -- a cursor designating a node that has been deallocated), -- and because we have a way to vet a dangling cursor -- reference anyway, and hence can actually detect the -- problem. for Dst_Index in Dst_Buckets'Range loop declare B : Node_Access renames Dst_Buckets (Dst_Index); X : Node_Access; begin while B /= null loop X := B; B := Next (X); Free (X); end loop; end; end loop; Free_Buckets (Dst_Buckets); raise Program_Error with "hash function raised exception during rehash"; end; Src_Index := Src_Index + 1; end loop; HT.Buckets := Dst_Buckets; HT.Length := LL; Free_Buckets (Src_Buckets); end Rehash; end Reserve_Capacity; end Ada.Containers.Hash_Tables.Generic_Operations;
with Ada.Real_Time; with ACO.CANopen; private with ACO.Events; private with ACO.Utils.Generic_Alarms; private with ACO.Slave_Monitors; package ACO.Protocols.Error_Control.Masters is type Master (Id : ACO.Messages.Node_Nr; Handler : not null access ACO.CANopen.Handler; Od : not null access ACO.OD.Object_Dictionary'Class) is new EC with private; procedure Periodic_Actions (This : in out Master; T_Now : in Ada.Real_Time.Time); private package Alarms is new ACO.Utils.Generic_Alarms (1); type Heartbeat_Producer_Alarm (Ref : not null access Master) is new Alarms.Alarm_Type with null record; overriding procedure Signal (This : access Heartbeat_Producer_Alarm; T_Now : in Ada.Real_Time.Time); type Entry_Update_Subscriber (Ref : not null access Master) is new ACO.Events.Event_Listener (ACO.Events.OD_Entry_Update) with null record; overriding procedure On_Event (This : in out Entry_Update_Subscriber; Data : in ACO.Events.Event_Data); type Node_State_Change_Subscriber (Ref : not null access Master) is new ACO.Events.Event_Listener (ACO.Events.State_Transition) with null record; overriding procedure On_Event (This : in out Node_State_Change_Subscriber; Data : in ACO.Events.Event_Data); type Master (Id : ACO.Messages.Node_Nr; Handler : not null access ACO.CANopen.Handler; Od : not null access ACO.OD.Object_Dictionary'Class) is new EC (Id, Od) with record Entry_Update : aliased Entry_Update_Subscriber (Master'Access); State_Change : aliased Node_State_Change_Subscriber (Master'Access); Timers : Alarms.Alarm_Manager; Producer_Alarm : aliased Heartbeat_Producer_Alarm (Master'Access); Monitor : ACO.Slave_Monitors.Slave_Monitor (Od); end record; overriding procedure Initialize (This : in out Master); overriding procedure Finalize (This : in out Master); procedure On_Heartbeat (This : in out Master; Id : in ACO.Messages.Node_Nr; Hbt_State : in EC_Commands.EC_State); function Create_Heartbeat (State : ACO.States.State; Node_Id : ACO.Messages.Node_Nr) return ACO.Messages.Message; procedure Send_Bootup (This : in out Master); procedure Heartbeat_Producer_Start (This : in out Master); procedure Heartbeat_Producer_Stop (This : in out Master); end ACO.Protocols.Error_Control.Masters;
------------------------------------------------------------------------------ -- -- -- GNAT LIBRARY COMPONENTS -- -- -- -- ADA.CONTAINERS.FUNCTIONAL_BASE -- -- -- -- S p e c -- -- -- -- Copyright (C) 2016-2020, Free Software Foundation, Inc. -- -- -- -- This specification is derived from the Ada Reference Manual for use with -- -- GNAT. The copyright notice above, and the license provisions that follow -- -- apply solely to the contents of the part following the private keyword. -- -- -- -- GNAT is free software; you can redistribute it and/or modify it under -- -- terms of the GNU General Public License as published by the Free Soft- -- -- ware Foundation; either version 3, or (at your option) any later ver- -- -- sion. GNAT is distributed in the hope that it will be useful, but WITH- -- -- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY -- -- or FITNESS FOR A PARTICULAR PURPOSE. -- -- -- -- As a special exception under Section 7 of GPL version 3, you are granted -- -- additional permissions described in the GCC Runtime Library Exception, -- -- version 3.1, as published by the Free Software Foundation. -- -- -- -- You should have received a copy of the GNU General Public License and -- -- a copy of the GCC Runtime Library Exception along with this program; -- -- see the files COPYING3 and COPYING.RUNTIME respectively. If not, see -- -- <http://www.gnu.org/licenses/>. -- ------------------------------------------------------------------------------ -- Functional containers are neither controlled nor limited. This is safe, as -- no primitives are provided to modify them. -- Memory allocated inside functional containers is never reclaimed. pragma Ada_2012; private generic type Index_Type is (<>); -- To avoid Constraint_Error being raised at run time, Index_Type'Base -- should have at least one more element at the low end than Index_Type. type Element_Type (<>) is private; with function "=" (Left, Right : Element_Type) return Boolean is <>; package Ada.Containers.Functional_Base with SPARK_Mode => Off is subtype Extended_Index is Index_Type'Base range Index_Type'Pred (Index_Type'First) .. Index_Type'Last; type Container is private; function "=" (C1 : Container; C2 : Container) return Boolean; -- Return True if C1 and C2 contain the same elements at the same position function Length (C : Container) return Count_Type; -- Number of elements stored in C function Get (C : Container; I : Index_Type) return Element_Type; -- Access to the element at index I in C function Set (C : Container; I : Index_Type; E : Element_Type) return Container; -- Return a new container which is equal to C except for the element at -- index I, which is set to E. function Add (C : Container; I : Index_Type; E : Element_Type) return Container; -- Return a new container that is C with E inserted at index I function Remove (C : Container; I : Index_Type) return Container; -- Return a new container that is C without the element at index I function Find (C : Container; E : Element_Type) return Extended_Index; -- Return the first index for which the element stored in C is I. If there -- are no such indexes, return Extended_Index'First. -------------------- -- Set Operations -- -------------------- function "<=" (C1 : Container; C2 : Container) return Boolean; -- Return True if every element of C1 is in C2 function Num_Overlaps (C1 : Container; C2 : Container) return Count_Type; -- Return the number of elements that are in both C1 and C2 function Union (C1 : Container; C2 : Container) return Container; -- Return a container which is C1 plus all the elements of C2 that are not -- in C1. function Intersection (C1 : Container; C2 : Container) return Container; -- Return a container which is C1 minus all the elements that are also in -- C2. private subtype Positive_Count_Type is Count_Type range 1 .. Count_Type'Last; type Element_Access is access all Element_Type; type Element_Array is array (Positive_Count_Type range <>) of Element_Access; type Element_Array_Access_Base is access Element_Array; subtype Element_Array_Access is not null Element_Array_Access_Base; Empty_Element_Array_Access : constant Element_Array_Access := new Element_Array'(1 .. 0 => null); type Array_Base is record Max_Length : Count_Type; Elements : Element_Array_Access; end record; type Array_Base_Access is not null access Array_Base; function Content_Init (L : Count_Type := 0) return Array_Base_Access; -- Used to initialize the content of an array base with length L type Container is record Length : Count_Type := 0; Base : Array_Base_Access := Content_Init; end record; end Ada.Containers.Functional_Base;
------------------------------------------------------------------------------ -- -- -- GNAT RUN-TIME LIBRARY (GNARL) COMPONENTS -- -- -- -- S Y S T E M . B B . B O A R D _ S U P P O R T -- -- -- -- B o d y -- -- -- -- Copyright (C) 1999-2002 Universidad Politecnica de Madrid -- -- Copyright (C) 2003-2006 The European Space Agency -- -- Copyright (C) 2003-2017, 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. -- -- -- -- 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. -- -- -- -- The port of GNARL to bare board targets was initially developed by the -- -- Real-Time Systems Group at the Technical University of Madrid. -- -- -- ------------------------------------------------------------------------------ with Ada.Unchecked_Conversion; with System.Machine_Code; with System.BB.CPU_Primitives.Multiprocessors; with Interfaces; use Interfaces; with Interfaces.Raspberry_Pi; package body System.BB.Board_Support is use BB.Interrupts; use System.Machine_Code; use System.Multiprocessors; use Interfaces.Raspberry_Pi; procedure IRQ_Handler; pragma Export (Ada, IRQ_Handler, "__gnat_irq_handler"); procedure FIQ_Handler; pragma Export (Ada, FIQ_Handler, "__gnat_fiq_handler"); -- Low-level interrupt handler procedure Initialize_CPU_Devices; pragma Export (C, Initialize_CPU_Devices, "__gnat_initialize_cpu_devices"); -- Per CPU device initialization procedure Set_CNTP_CTL (Val : Unsigned_32); procedure Set_CNTV_CTL (Val : Unsigned_32); -- Set the CNTP_CTL and CNTV_CTL register ------------------ -- Set_CNTP_CTL -- ------------------ procedure Set_CNTP_CTL (Val : Unsigned_32) is begin Asm ("mcr p15, #0, %0, c14, c2, #1", Inputs => Unsigned_32'Asm_Input ("r", Val), Volatile => True); end Set_CNTP_CTL; procedure Set_CNTV_CTL (Val : Unsigned_32) is begin Asm ("mcr p15, #0, %0, c14, c3, #1", Inputs => Unsigned_32'Asm_Input ("r", Val), Volatile => True); end Set_CNTV_CTL; ---------------------------- -- Initialize_CPU_Devices -- ---------------------------- procedure Initialize_CPU_Devices is begin -- Disable CNTP and mask. Set_CNTP_CTL (2); -- Disable CNTV and mask. Set_CNTV_CTL (2); end Initialize_CPU_Devices; ---------------------- -- Initialize_Board -- ---------------------- procedure Initialize_Board is Discard : Unsigned_32; begin -- Timer: set prescalar to 1, using crystal (19.2 Mhz) Local_Registers.Core_Timer_Prescaler := 16#8000_0000#; Local_Registers.Control := 0; -- Read MS to unlock the LS. Discard := Local_Registers.Core_Timer_MS; -- Initialize (LS then MS) Local_Registers.Core_Timer_LS := 0; Local_Registers.Core_Timer_MS := 0; -- GPU interrupt routing to core 1 Local_Registers.GPU_Int_Routing := 2#00_00#; -- Disable PMU ints Local_Registers.PMU_Int_Routing_Clr := 2#1111_1111#; -- Core timer PS to IRQ for I in Core_Unsigned_32'Range loop Local_Registers.Cores_Timer_Int_Ctr (I) := 2#0000_1111#; end loop; -- Mailbox to IRQ for I in Core_Unsigned_32'Range loop Local_Registers.Cores_Mailboxes_Int_Ctr (I) := 2#0000_1111#; end loop; Initialize_CPU_Devices; end Initialize_Board; package body Time is Alarm_Interrupt_ID : constant BB.Interrupts.Interrupt_ID := 1; -- Non-secure counter (CNTPNSIRQ) --------------- -- Set_Alarm -- --------------- procedure Set_Alarm (Ticks : BB.Time.Time) is use type BB.Time.Time; Lo : constant Unsigned_32 := Unsigned_32 (Ticks and 16#FFFF_FFFF#); Hi : constant Unsigned_32 := Unsigned_32 (Shift_Right (Unsigned_64 (Ticks), 32)); begin -- Set CNTP_CVAL Asm ("mcrr p15,#2,%0,%1,c14", Inputs => (Unsigned_32'Asm_Input ("r", Lo), Unsigned_32'Asm_Input ("r", Hi)), Volatile => True); -- Set CNTP_CTL (enable and unmask) Set_CNTP_CTL (1); end Set_Alarm; ---------------- -- Read_Clock -- ---------------- function Read_Clock return BB.Time.Time is use BB.Time; Lo : Unsigned_32; Hi : Unsigned_32; begin -- Read CNTPCT Asm ("mrrc p15,#0,%0,%1,c14", Outputs => (Unsigned_32'Asm_Output ("=r", Lo), Unsigned_32'Asm_Output ("=r", Hi)), Volatile => True); return (BB.Time.Time (Hi) * 2 ** 32) + BB.Time.Time (Lo); end Read_Clock; --------------------------- -- Install_Alarm_Handler -- --------------------------- procedure Install_Alarm_Handler (Handler : Interrupt_Handler) is begin -- Attach interrupt handler BB.Interrupts.Attach_Handler (Handler, Alarm_Interrupt_ID, Interrupts.Priority_Of_Interrupt (Alarm_Interrupt_ID)); end Install_Alarm_Handler; --------------------------- -- Clear_Alarm_Interrupt -- --------------------------- procedure Clear_Alarm_Interrupt is begin -- Disable and mask Set_CNTP_CTL (2); end Clear_Alarm_Interrupt; end Time; ----------------- -- IRQ_Handler -- ----------------- procedure IRQ_Handler is This_CPU : constant CPU := Multiprocessors.Current_CPU; Src : constant Unsigned_32 := Local_Registers.Cores_IRQ_Source (Natural (This_CPU)); Pending : Unsigned_32; IRQ : Interrupt_ID; Base : Unsigned_32; subtype Basic_IRQ is Interrupt_ID range 0 .. 11; function CTZ (X : Unsigned_32) return Unsigned_32 with Import, Convention => Intrinsic, External_Name => "__builtin_ctz"; -- Returns the number of leading zeros in X, starting at the least -- significant position. X must not be zero. begin if Src = 0 then return; end if; -- Retrieve the IRQ number Base := CTZ (Src); if Base = 8 then -- GPU interrupt: retrieve the source IRQ IRQ := Basic_IRQ'Last + 1; Pending := Arm_Interrupts.Irq_Pending_1; if Pending = 0 then Pending := Arm_Interrupts.Irq_Pending_2; IRQ := IRQ + 32; end if; if Pending = 0 then return; end if; IRQ := IRQ + Interrupt_ID (CTZ (Pending)); Interrupt_Wrapper (IRQ); else Interrupt_Wrapper (Interrupt_ID (Base)); end if; end IRQ_Handler; ----------------- -- FIQ_Handler -- ----------------- procedure FIQ_Handler is begin -- Not supported raise Program_Error; end FIQ_Handler; package body Interrupts is ------------------------------- -- Install_Interrupt_Handler -- ------------------------------- procedure Install_Interrupt_Handler (Interrupt : BB.Interrupts.Interrupt_ID; Prio : Interrupt_Priority) is pragma Unreferenced (Prio); Int_Num : Natural; Reg_Value : Unsigned_32; GPU_Int_Base_1 : constant := 12; GPU_Int_Base_2 : constant := 44; begin if Interrupt < 12 then return; elsif Interrupt < GPU_Int_Base_2 then Int_Num := Natural (Interrupt) - GPU_Int_Base_1; Reg_Value := 2 ** Int_Num; Arm_Interrupts.Enable_Irq_1 := Reg_Value; else Int_Num := Natural (Interrupt) - GPU_Int_Base_2; Reg_Value := 2 ** Int_Num; Arm_Interrupts.Enable_Irq_2 := Reg_Value; end if; end Install_Interrupt_Handler; --------------------------- -- Priority_Of_Interrupt -- --------------------------- function Priority_Of_Interrupt (Interrupt : System.BB.Interrupts.Interrupt_ID) return System.Any_Priority is pragma Unreferenced (Interrupt); begin return Interrupt_Priority'First; -- IRQ end Priority_Of_Interrupt; -------------------------- -- Set_Current_Priority -- -------------------------- procedure Set_Current_Priority (Priority : Integer) is begin null; end Set_Current_Priority; ---------------- -- Power_Down -- ---------------- procedure Power_Down is begin Asm ("wfi", Volatile => True); end Power_Down; end Interrupts; package body Multiprocessors is Poke_Interrupt : constant Interrupt_ID := 7; -- Use mailbox 3 procedure Start_Slave_Cpu with Import, External_Name => "__start_slave_cpu"; -- Entry point (in crt0) for a slave cpu procedure Poke_Handler (Interrupt : BB.Interrupts.Interrupt_ID); -- Handler for the Poke interrupt function MPIDR return Unsigned_32 with Inline_Always; -- Return current value of the MPIDR register -------------------- -- Number_Of_CPUs -- -------------------- function Number_Of_CPUs return CPU is begin return CPU'Last; end Number_Of_CPUs; ----------- -- MPIDR -- ----------- function MPIDR return Unsigned_32 is R : Unsigned_32; begin Asm ("mrc p15,0,%0,c0,c0,5", Outputs => Unsigned_32'Asm_Output ("=r", R), Volatile => True); return R; end MPIDR; ----------------- -- Current_CPU -- ----------------- function Current_CPU return CPU is -- Get CPU Id from bits 1:0 from the MPIDR register (if CPU'Last = 1 then 1 else CPU ((MPIDR and 3) + 1)); -------------- -- Poke_CPU -- -------------- procedure Poke_CPU (CPU_Id : CPU) is begin Local_Registers.Cores_Mailboxes_Write_Set (Natural (CPU_Id), 3) := 1; end Poke_CPU; -------------------- -- Start_All_CPUs -- -------------------- procedure Start_All_CPUs is function To_Unsigned_32 is new Ada.Unchecked_Conversion (Address, Unsigned_32); begin BB.Interrupts.Attach_Handler (Poke_Handler'Access, Poke_Interrupt, Interrupt_Priority'Last); -- Disable warnings for non-SMP case pragma Warnings (Off, "loop range is null*"); for CPU_Id in CPU'First + 1 .. CPU'Last loop -- Set entry point address for the slave Local_Registers.Cores_Mailboxes_Write_Set (Natural (CPU_Id), 3) := To_Unsigned_32 (Start_Slave_Cpu'Address); -- Wait until the slave starts while Local_Registers.Cores_Mailboxes_Read_Clr (Natural (CPU_Id), 3) /= 0 loop null; end loop; end loop; pragma Warnings (On, "loop range is null*"); end Start_All_CPUs; ------------------ -- Poke_Handler -- ------------------ procedure Poke_Handler (Interrupt : BB.Interrupts.Interrupt_ID) is This_CPU : constant CPU := Multiprocessors.Current_CPU; begin -- Make sure we are handling the right interrupt pragma Assert (Interrupt = Poke_Interrupt); -- Clear bit in mailbox Local_Registers.Cores_Mailboxes_Read_Clr (Natural (This_CPU), 3) := 1; System.BB.CPU_Primitives.Multiprocessors.Poke_Handler; end Poke_Handler; end Multiprocessors; end System.BB.Board_Support;
package body Integrate is function Left_Rectangular (A, B : Scalar; N : Positive) return Scalar is H : constant Scalar := (B - A) / Scalar (N); Sum : Scalar := 0.0; X : Scalar; begin for I in 0 .. N - 1 loop X := A + Scalar (I) * H; Sum := Sum + H * F (X); end loop; return Sum; end Left_Rectangular; function Right_Rectangular (A, B : Scalar; N : Positive) return Scalar is H : constant Scalar := (B - A) / Scalar (N); Sum : Scalar := 0.0; X : Scalar; begin for I in 1 .. N loop X := A + Scalar (I) * H; Sum := Sum + H * F (X); end loop; return Sum; end Right_Rectangular; function Midpoint_Rectangular (A, B : Scalar; N : Positive) return Scalar is H : constant Scalar := (B - A) / Scalar (N); Sum : Scalar := 0.0; X : Scalar; begin for I in 1 .. N loop X := A + Scalar (I) * H - 0.5 * H; Sum := Sum + H * F (X); end loop; return Sum; end Midpoint_Rectangular; function Trapezium (A, B : Scalar; N : Positive) return Scalar is H : constant Scalar := (B - A) / Scalar (N); Sum : Scalar := F(A) + F(B); X : Scalar := 1.0; begin while X <= Scalar (N) - 1.0 loop Sum := Sum + 2.0 * F (A + X * (B - A) / Scalar (N)); X := X + 1.0; end loop; return (B - A) / (2.0 * Scalar (N)) * Sum; end Trapezium; function Simpsons (A, B : Scalar; N : Positive) return Scalar is H : constant Scalar := (B - A) / Scalar (N); Sum_1 : Scalar := 0.0; Sum_2 : Scalar := 0.0; begin for I in 0 .. N - 1 loop Sum_1 := Sum_1 + F (A + H * Scalar (I) + 0.5 * H); Sum_2 := Sum_2 + F (A + H * Scalar (I)); end loop; return H / 6.0 * (F (A) + F (B) + 4.0 * Sum_1 + 2.0 * Sum_2); end Simpsons; end Integrate;
package Static_Initializer5_Pkg is type Arr is array (Positive range <>) of Character; type Buffer_Type (Length : Positive) is record Content : Arr (1 .. Length); end record; type Buffer_Access is access Buffer_Type; type Rec is tagged record Buffer : Buffer_Access; end record; Null_Rec : constant Rec := (Buffer => null); end Static_Initializer5_Pkg;
with Ada.Text_IO; use Ada.Text_IO; with Ada.Numerics.Elementary_Functions; use Ada.Numerics.Elementary_Functions; procedure main with SPARK_Mode is Y, X, angle : Float; dt : constant Float := 0.5; begin for kx in Integer range -10 .. 10 loop X := Float(kx) * dt; for ky in Integer range -10 .. 10 loop Y := Float(ky) * dt; if X /= 0.0 or Y /= 0.0 then angle := Arctan (Y => Y, X => X); Put_Line (Y'Img & "," & X'Img & "," & angle'Img); end if; end loop; end loop; end main;
pragma Ada_2005; pragma Style_Checks (Off); with Interfaces.C; use Interfaces.C; with Interfaces.C.Strings; package asm_generic_posix_types_h is -- SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note -- * This file is generally used by user-level software, so you need to -- * be a little careful about namespace pollution etc. -- * -- * First the types that are often defined in different ways across -- * architectures, so that you can override them. -- subtype uu_kernel_long_t is long; -- /usr/include/asm-generic/posix_types.h:15 subtype uu_kernel_ulong_t is unsigned_long; -- /usr/include/asm-generic/posix_types.h:16 subtype uu_kernel_ino_t is uu_kernel_ulong_t; -- /usr/include/asm-generic/posix_types.h:20 subtype uu_kernel_mode_t is unsigned; -- /usr/include/asm-generic/posix_types.h:24 subtype uu_kernel_pid_t is int; -- /usr/include/asm-generic/posix_types.h:28 subtype uu_kernel_ipc_pid_t is int; -- /usr/include/asm-generic/posix_types.h:32 subtype uu_kernel_uid_t is unsigned; -- /usr/include/asm-generic/posix_types.h:36 subtype uu_kernel_gid_t is unsigned; -- /usr/include/asm-generic/posix_types.h:37 subtype uu_kernel_suseconds_t is uu_kernel_long_t; -- /usr/include/asm-generic/posix_types.h:41 subtype uu_kernel_daddr_t is int; -- /usr/include/asm-generic/posix_types.h:45 subtype uu_kernel_uid32_t is unsigned; -- /usr/include/asm-generic/posix_types.h:49 subtype uu_kernel_gid32_t is unsigned; -- /usr/include/asm-generic/posix_types.h:50 -- * Most 32 bit architectures use "unsigned int" size_t, -- * and all 64 bit architectures use "unsigned long" size_t. -- subtype uu_kernel_size_t is uu_kernel_ulong_t; -- /usr/include/asm-generic/posix_types.h:72 subtype uu_kernel_ssize_t is uu_kernel_long_t; -- /usr/include/asm-generic/posix_types.h:73 subtype uu_kernel_ptrdiff_t is uu_kernel_long_t; -- /usr/include/asm-generic/posix_types.h:74 type uu_kernel_fsid_t_val_array is array (0 .. 1) of aliased int; type uu_kernel_fsid_t is record val : aliased uu_kernel_fsid_t_val_array; -- /usr/include/asm-generic/posix_types.h:80 end record; pragma Convention (C_Pass_By_Copy, uu_kernel_fsid_t); -- /usr/include/asm-generic/posix_types.h:81 -- skipped anonymous struct anon_1 -- * anything below here should be completely generic -- subtype uu_kernel_off_t is uu_kernel_long_t; -- /usr/include/asm-generic/posix_types.h:87 subtype uu_kernel_loff_t is Long_Long_Integer; -- /usr/include/asm-generic/posix_types.h:88 subtype uu_kernel_time_t is uu_kernel_long_t; -- /usr/include/asm-generic/posix_types.h:89 subtype uu_kernel_time64_t is Long_Long_Integer; -- /usr/include/asm-generic/posix_types.h:90 subtype uu_kernel_clock_t is uu_kernel_long_t; -- /usr/include/asm-generic/posix_types.h:91 subtype uu_kernel_timer_t is int; -- /usr/include/asm-generic/posix_types.h:92 subtype uu_kernel_clockid_t is int; -- /usr/include/asm-generic/posix_types.h:93 type uu_kernel_caddr_t is new Interfaces.C.Strings.chars_ptr; -- /usr/include/asm-generic/posix_types.h:94 subtype uu_kernel_uid16_t is unsigned_short; -- /usr/include/asm-generic/posix_types.h:95 subtype uu_kernel_gid16_t is unsigned_short; -- /usr/include/asm-generic/posix_types.h:96 end asm_generic_posix_types_h;
with Ada.Unchecked_Deallocation; with Ada.Containers.Vectors; with Ada.Containers.Indefinite_Vectors; with Protypo.Tokens; private package Protypo.Code_Trees is use Ada.Strings.Unbounded; package ID_Lists is new Ada.Containers.Indefinite_Vectors (Index_Type => Positive, Element_Type => ID); subtype Id_List is ID_Lists.Vector; type Non_Terminal is ( Statement_Sequence, Defun, Assignment, Return_Statement, Procedure_Call, Exit_Statement, If_Block, Loop_Block, For_Block, While_Block, Binary_Op, Unary_Op, Int_Constant, Real_Constant, Text_Constant, Capture_Call, Selected, Indexed, Identifier, List_Of_Names, List_Of_Expressions, Parameter_Signature ); subtype Expression is Non_Terminal range Binary_Op .. Identifier; subtype Name is Non_Terminal range Selected .. Identifier; subtype Statement_Classes is Non_Terminal range Statement_Sequence .. While_Block; type Parsed_Code is private; Empty_Tree : constant Parsed_Code; function Is_Empty (X : Parsed_Code) return Boolean; type Tree_Array is array (Positive range <>) of Parsed_Code; Empty_Tree_Array : constant Tree_Array; function Class (X : Parsed_Code) return Non_Terminal; function If_Then_Else (Conditions : Tree_Array; Then_Branches : Tree_Array; Else_Branch : Parsed_Code) return Parsed_Code with Pre => Conditions'Length = Then_Branches'Length and (for all Cond of Conditions => Class (Cond) in Expression) and (for all B of Then_Branches => Class (B) in Statement_Sequence), Post => Class (If_Then_Else'Result) = If_Block; function Assignment (LHS : Tree_Array; Value : Tree_Array) return Parsed_Code with Pre => (for all Item of Lhs => Class (Item) in Name) and (for all Item of Value => Class (Item) in Expression), Post => Class (Assignment'Result) = Assignment; function Parameter_List (Names : Id_List; Default : Tree_Array; Position : Tokens.Token_Position := Tokens.No_Position) return Parsed_Code with Pre => (for all Val of Default => Is_Empty (Val) or else (Class (Val) in Expression)), Post => Class (Parameter_List'Result) = Parameter_Signature; function Empty_Parameter_List return Parsed_Code; function Definition (Name : String; Parameter_List : Parsed_Code; Function_Body : Parsed_Code; Is_Function : Boolean; Position : Tokens.Token_Position := Tokens.No_Position) return Parsed_Code with Pre => Class (Function_Body) = Statement_Sequence and (Parameter_List = Empty_Tree or else Class (Parameter_List) = Parameter_Signature), Post => Class (Definition'Result) = Defun; function Statement_Sequence (Statements : Tree_Array; Position : Tokens.Token_Position := Tokens.No_Position) return Parsed_Code with Post => Class (Statement_Sequence'Result) = Statement_Sequence; -- function Naked_Expression (Statements : Tree_Array) -- return Parsed_Code -- with -- Post => Class (Naked_Expression'Result) = Naked; function Binary_Operation (Left : Parsed_Code; Right : Parsed_Code; Operation : Tokens.Binary_Operator; Position : Tokens.Token_Position := Tokens.No_Position) return Parsed_Code with Post => Class (Binary_Operation'Result) = Binary_Op; function Unary_Operation (X : Parsed_Code; Operation : Tokens.Unary_Operator; Position : Tokens.Token_Position := Tokens.No_Position) return Parsed_Code with Post => Class (Unary_Operation'Result) = Unary_Op; function String_Constant (Val : String; Position : Tokens.Token_Position := Tokens.No_Position) return Parsed_Code with Post => Class (String_Constant'Result) = Text_Constant; function Integer_Constant (Val : String; Position : Tokens.Token_Position := Tokens.No_Position) return Parsed_Code with Post => Class (Integer_Constant'Result) = Int_Constant; function Float_Constant (Val : String; Position : Tokens.Token_Position := Tokens.No_Position) return Parsed_Code with Post => Class (Float_Constant'Result) = Real_Constant; function Identifier (Id : String; Position : Tokens.Token_Position := Tokens.No_Position) return Parsed_Code with Post => Class (Identifier'Result) = Identifier; function Indexed_Name (Function_Ref : Parsed_Code; Parameters : Tree_Array; Position : Tokens.Token_Position := Tokens.No_Position) return Parsed_Code with Post => Class (Indexed_Name'Result) = Indexed; function Procedure_Call (Procedure_Name : String; Parameters : Tree_Array; Position : Tokens.Token_Position := Tokens.No_Position) return Parsed_Code with Post => Class (Procedure_Call'Result) = Procedure_Call; function Procedure_Call (Procedure_Name : String) return Parsed_Code with Post => Class (Procedure_Call'Result) = Procedure_Call; function Capture (Name : Unbounded_Id; Parameters : Tree_Array; Position : Tokens.Token_Position := Tokens.No_Position) return Parsed_Code with Post => Class (Capture'Result) = Capture_Call; function Selector (Ref : Parsed_Code; Field : String; Position : Tokens.Token_Position := Tokens.No_Position) return Parsed_Code with Post => Class (Selector'Result) = Selected; function Loop_Exit (Label : String; Position : Tokens.Token_Position := Tokens.No_Position) return Parsed_Code; function Basic_Loop (Loop_Body : Parsed_Code; Label : String; Position : Tokens.Token_Position := Tokens.No_Position) return Parsed_Code with Post => Class (Basic_Loop'Result) = Loop_Block; function For_Loop (Variable : String; Iterator : Parsed_Code; Loop_Body : Parsed_Code; Position : Tokens.Token_Position := Tokens.No_Position) return Parsed_Code with Post => Class (For_Loop'Result) = For_Block, Pre => Class (Loop_Body) = Loop_Block; function While_Loop (Condition : Parsed_Code; Loop_Body : Parsed_Code; Position : Tokens.Token_Position := Tokens.No_Position) return Parsed_Code with Pre => Class (Loop_Body) = Loop_Block and (Class (Condition) in Expression), Post => Class (While_Loop'Result) = While_Block; function Return_To_Caller (Values : Tree_Array; Position : Tokens.Token_Position := Tokens.No_Position) return Parsed_Code with Pre => (for all V of Values => Class (V) in Expression), Post => Class (Return_To_Caller'Result) = Return_Statement; procedure Delete (Code : in out Parsed_Code); procedure Dump (Code : Parsed_Code); private subtype Label_Type is Unbounded_String; subtype Loops is Non_Terminal range Loop_Block .. While_Block; type Node; type Node_Access is access Node; package Node_Vectors is new Ada.Containers.Vectors (Index_Type => Positive, Element_Type => Node_Access); type Parameter_Specs is record Names : Id_List; Default : Node_Vectors.Vector; end record; type Conditional_Branch is record Condition : Node_Access; Code : Node_Access; end record; package Conditional_Branch_Vectors is new Ada.Containers.Vectors (Index_Type => Positive, Element_Type => Conditional_Branch); type Node (Class : Non_Terminal) is record Source_Position : Tokens.Token_Position; case Class is when Parameter_Signature => Signature : Parameter_Specs; when Defun => Is_Function : Boolean; Definition_Name : Unbounded_String; Function_Body : Node_Vectors.Vector; Parameters : Parameter_Specs; when Statement_Sequence => Statements : Node_Vectors.Vector; -- when Naked => -- Naked_Values : Node_Vectors.Vector; when Assignment => Lhs : Node_Vectors.Vector; Rvalues : Node_Vectors.Vector; when Return_Statement => Return_Values : Node_Vectors.Vector; when Procedure_Call | Capture_Call => Name : Unbounded_Id; Params : Node_Vectors.Vector; when Exit_Statement => Loop_Label : Label_Type; when If_Block => Branches : Conditional_Branch_Vectors.Vector; Else_Branch : Node_Access; when List_Of_Names => Names : Node_Vectors.Vector; when List_Of_Expressions => Exprs : Node_Vectors.Vector; when Binary_Op => Operator : Tokens.Binary_Operator; Left : Node_Access; Right : Node_Access; when Unary_Op => Uni_Op : Tokens.Unary_Operator; Operand : Node_Access; when Int_Constant => N : Integer; when Real_Constant => X : Float; when Text_Constant => S : Unbounded_String; when Selected => Record_Var : Node_Access; Field_Name : Unbounded_ID; when Indexed => Indexed_Var : Node_Access; Indexes : Node_Vectors.Vector; when Identifier => Id_Value : Unbounded_Id; when Loop_Block | For_Block | While_Block => Loop_Body : Node_Vectors.Vector; Labl : Label_Type; case Class is when Loop_Block => null; when For_Block => Variable : Unbounded_String; Iterator : Node_Access; when While_Block => Condition : Node_Access; when others => null; end case; end case; end record; subtype Indexed_Name_Node is Node (Indexed); procedure Free is new Ada.Unchecked_Deallocation (Object => Node, Name => Node_Access); procedure Delete (Item : in out Node_Access); procedure Delete (Item : in out Node_Vectors.Vector); procedure Dump (Item : Node_Access; Level : Natural; Label : String := ""); type Parsed_Code is record Pt : Node_Access; end record; Empty_Tree : constant Parsed_Code := (Pt => null); Empty_Tree_Array : constant Tree_Array (2 .. 1) := (others => <>); function Empty_Parameter_List return Parsed_Code is (Pt => new Node '(Class => Parameter_Signature, Source_Position => Tokens.No_Position, Signature => Parameter_Specs'(Names => ID_Lists.Empty_Vector, Default => Node_Vectors.Empty_Vector))); function Is_Empty (X : Parsed_Code) return Boolean is (X.Pt = null); end Protypo.Code_Trees;