content
stringlengths
23
1.05M
-- FILE: test_oedipus.adb -- LICENSE: MIT © 2021 Mae Morella with Oedipus, Oedipus.Elementary_Functions, Oedipus.Complex_Text_IO, Ada .Text_IO, Ada.Float_Text_IO, Ada.Exceptions; use Oedipus, Oedipus.Elementary_Functions, Oedipus.Complex_Text_IO, Ada.Text_IO, Ada.Float_Text_IO, Ada.Exceptions; procedure Test_Oedipus is U : Complex; V : Complex; begin -- User-input complex numbers Put_Line ("=== Create complex number U ==="); Get (U); Put ("U = "); Put (U); Put_Line (""); Put_Line ("=== Create complex number V ==="); Get (V); Put ("V = "); Put (V); Put_Line (""); Put_Line ("=== Math operations ==="); Put ("U+V = "); Put (U + V); Put_Line (""); Put ("U-V = "); Put (U - V); Put_Line (""); Put ("U*V = "); Put (U * V); Put_Line (""); Put ("U/V = "); Put (U / V); Put_Line (""); end Test_Oedipus;
With Gnoga.Gui.Element.Form, Ada.Streams, NSO.Types, INI; Package NSO.Helpers is Generic Type Options is (<>); Procedure Add_Discrete( Form : in out Gnoga.Gui.Element.Form.Form_Type'Class; Parent : in out Gnoga.Gui.Element.Form.Selection_Type'Class ); Procedure Add_Vector( Form : in out Gnoga.Gui.Element.Form.Form_Type'Class; Parent : in out Gnoga.Gui.Element.Form.Selection_Type'Class; Input : in NSO.Types.String_Vector.Vector; Prefix : in String:= "" ); Procedure Add_Map( Form : in out Gnoga.Gui.Element.Form.Form_Type'Class; Parent : in out Gnoga.Gui.Element.Form.Selection_Type'Class; Input : in NSO.Types.String_Map.Map; Prefix : in String:= "" ); -- Adds the sections given by INPUT as groups; grouped by the section-name. Procedure Add_Sections( Form : in out Gnoga.Gui.Element.Form.Form_Type'Class; Parent : in out Gnoga.Gui.Element.Form.Selection_Type'Class; Fields : in NSO.Types.String_Vector.Vector; File : in INI.Instance; Prefix : in String:= "" ); Procedure Add_Section_Groups( Form : in out Gnoga.Gui.Element.Form.Form_Type'Class; Parent : in out Gnoga.Gui.Element.Element_Type'Class; --Gnoga.Gui.Element.Form.Selection_Type'Class; Fields : in NSO.Types.String_Vector.Vector; File : in INI.Instance; Name : in String:= "" ); Function Trim( Input : String ) return String; Function Unescape_JSON_String( Input : String ) Return String; Subtype UPPER_CASE is Character range 'A'..'Z'; Subtype LOWER_CASE is Character range 'a'..'z'; Subtype NUMERIC is Character range '0'..'9'; Subtype ALPHANUMERIC is Character with Static_Predicate => ALPHANUMERIC in UPPER_CASE|LOWER_CASE|NUMERIC; -- Given "Item" & "Data" produces "<Item>Data</Item>". Function HTML_Tag(Name, Text : String) return String with Pre => Name'Length in Positive and (for all C of Name => C in ALPHANUMERIC); Function HTML_Tag(Name, Text, Attribute, Value : String) return String with Pre => Name'Length in Positive and (for all C of Name => C in ALPHANUMERIC) and Attribute'Length in Positive and (for all C of Attribute => C in ALPHANUMERIC) and Value'Length in Positive and (for all C of Value => C /= '"'); Type Nullable_Character is access all Character; Subtype Character_Reference is not null Nullable_Character; Function Next( Stream : not null access NSO.Types.Root_Stream_Class ) return Character_Reference with Inline; End NSO.Helpers;
-- { dg-do compile } with Ada.Text_IO; use Ada.Text_IO; procedure Warn11 is type My_Integer is new Integer range 1 .. 10; for My_Integer'Size use 65; -- { dg-warning "unused" } type My_Integer2 is new Integer range 1 .. 10; for My_Integer2'Size use 129; -- { dg-warning "unused" } begin Put_Line ("MB'Size is " & Natural'Image (My_Integer'Size)); Put_Line ("MB'Size is " & Natural'Image (My_Integer2'Size)); end;
-- This spec has been automatically generated from STM32F0xx.svd pragma Restrictions (No_Elaboration_Code); pragma Ada_2012; pragma Style_Checks (Off); with System; package STM32_SVD.DAC is pragma Preelaborate; --------------- -- Registers -- --------------- subtype CR_EN1_Field is STM32_SVD.Bit; subtype CR_BOFF1_Field is STM32_SVD.Bit; subtype CR_TEN1_Field is STM32_SVD.Bit; -- CR_TSEL array element subtype CR_TSEL_Element is STM32_SVD.Bit; -- CR_TSEL array type CR_TSEL_Field_Array is array (10 .. 12) of CR_TSEL_Element with Component_Size => 1, Size => 3; -- Type definition for CR_TSEL type CR_TSEL_Field (As_Array : Boolean := False) is record case As_Array is when False => -- TSEL as a value Val : STM32_SVD.UInt3; when True => -- TSEL as an array Arr : CR_TSEL_Field_Array; end case; end record with Unchecked_Union, Size => 3; for CR_TSEL_Field use record Val at 0 range 0 .. 2; Arr at 0 range 0 .. 2; end record; subtype CR_DMAEN1_Field is STM32_SVD.Bit; subtype CR_DMAUDRIE1_Field is STM32_SVD.Bit; -- control register type CR_Register is record -- DAC channel1 enable EN1 : CR_EN1_Field := 16#0#; -- DAC channel1 output buffer disable BOFF1 : CR_BOFF1_Field := 16#0#; -- DAC channel1 trigger enable TEN1 : CR_TEN1_Field := 16#0#; -- DAC channel1 trigger selection TSEL : CR_TSEL_Field := (As_Array => False, Val => 16#0#); -- unspecified Reserved_6_11 : STM32_SVD.UInt6 := 16#0#; -- DAC channel1 DMA enable DMAEN1 : CR_DMAEN1_Field := 16#0#; -- DAC channel1 DMA Underrun Interrupt enable DMAUDRIE1 : CR_DMAUDRIE1_Field := 16#0#; -- unspecified Reserved_14_31 : STM32_SVD.UInt18 := 16#0#; end record with Volatile_Full_Access, Size => 32, Bit_Order => System.Low_Order_First; for CR_Register use record EN1 at 0 range 0 .. 0; BOFF1 at 0 range 1 .. 1; TEN1 at 0 range 2 .. 2; TSEL at 0 range 3 .. 5; Reserved_6_11 at 0 range 6 .. 11; DMAEN1 at 0 range 12 .. 12; DMAUDRIE1 at 0 range 13 .. 13; Reserved_14_31 at 0 range 14 .. 31; end record; subtype SWTRIGR_SWTRIG1_Field is STM32_SVD.Bit; -- software trigger register type SWTRIGR_Register is record -- Write-only. DAC channel1 software trigger SWTRIG1 : SWTRIGR_SWTRIG1_Field := 16#0#; -- unspecified Reserved_1_31 : STM32_SVD.UInt31 := 16#0#; end record with Volatile_Full_Access, Size => 32, Bit_Order => System.Low_Order_First; for SWTRIGR_Register use record SWTRIG1 at 0 range 0 .. 0; Reserved_1_31 at 0 range 1 .. 31; end record; subtype DHR12R1_DACC1DHR_Field is STM32_SVD.UInt12; -- channel1 12-bit right-aligned data holding register type DHR12R1_Register is record -- DAC channel1 12-bit right-aligned data DACC1DHR : DHR12R1_DACC1DHR_Field := 16#0#; -- unspecified Reserved_12_31 : STM32_SVD.UInt20 := 16#0#; end record with Volatile_Full_Access, Size => 32, Bit_Order => System.Low_Order_First; for DHR12R1_Register use record DACC1DHR at 0 range 0 .. 11; Reserved_12_31 at 0 range 12 .. 31; end record; subtype DHR12L1_DACC1DHR_Field is STM32_SVD.UInt12; -- channel1 12-bit left aligned data holding register type DHR12L1_Register is record -- unspecified Reserved_0_3 : STM32_SVD.UInt4 := 16#0#; -- DAC channel1 12-bit left-aligned data DACC1DHR : DHR12L1_DACC1DHR_Field := 16#0#; -- unspecified Reserved_16_31 : STM32_SVD.UInt16 := 16#0#; end record with Volatile_Full_Access, Size => 32, Bit_Order => System.Low_Order_First; for DHR12L1_Register use record Reserved_0_3 at 0 range 0 .. 3; DACC1DHR at 0 range 4 .. 15; Reserved_16_31 at 0 range 16 .. 31; end record; subtype DHR8R1_DACC1DHR_Field is STM32_SVD.Byte; -- channel1 8-bit right aligned data holding register type DHR8R1_Register is record -- DAC channel1 8-bit right-aligned data DACC1DHR : DHR8R1_DACC1DHR_Field := 16#0#; -- unspecified Reserved_8_31 : STM32_SVD.UInt24 := 16#0#; end record with Volatile_Full_Access, Size => 32, Bit_Order => System.Low_Order_First; for DHR8R1_Register use record DACC1DHR at 0 range 0 .. 7; Reserved_8_31 at 0 range 8 .. 31; end record; subtype DOR1_DACC1DOR_Field is STM32_SVD.UInt12; -- channel1 data output register type DOR1_Register is record -- Read-only. DAC channel1 data output DACC1DOR : DOR1_DACC1DOR_Field; -- unspecified Reserved_12_31 : STM32_SVD.UInt20; end record with Volatile_Full_Access, Size => 32, Bit_Order => System.Low_Order_First; for DOR1_Register use record DACC1DOR at 0 range 0 .. 11; Reserved_12_31 at 0 range 12 .. 31; end record; subtype SR_DMAUDR1_Field is STM32_SVD.Bit; subtype SR_DMAUDR2_Field is STM32_SVD.Bit; -- status register type SR_Register is record -- unspecified Reserved_0_12 : STM32_SVD.UInt13 := 16#0#; -- DAC channel1 DMA underrun flag DMAUDR1 : SR_DMAUDR1_Field := 16#0#; -- unspecified Reserved_14_28 : STM32_SVD.UInt15 := 16#0#; -- DAC channel2 DMA underrun flag DMAUDR2 : SR_DMAUDR2_Field := 16#0#; -- unspecified Reserved_30_31 : STM32_SVD.UInt2 := 16#0#; end record with Volatile_Full_Access, Size => 32, Bit_Order => System.Low_Order_First; for SR_Register use record Reserved_0_12 at 0 range 0 .. 12; DMAUDR1 at 0 range 13 .. 13; Reserved_14_28 at 0 range 14 .. 28; DMAUDR2 at 0 range 29 .. 29; Reserved_30_31 at 0 range 30 .. 31; end record; ----------------- -- Peripherals -- ----------------- -- Digital-to-analog converter type DAC_Peripheral is record -- control register CR : aliased CR_Register; -- software trigger register SWTRIGR : aliased SWTRIGR_Register; -- channel1 12-bit right-aligned data holding register DHR12R1 : aliased DHR12R1_Register; -- channel1 12-bit left aligned data holding register DHR12L1 : aliased DHR12L1_Register; -- channel1 8-bit right aligned data holding register DHR8R1 : aliased DHR8R1_Register; -- channel1 data output register DOR1 : aliased DOR1_Register; -- status register SR : aliased SR_Register; end record with Volatile; for DAC_Peripheral use record CR at 16#0# range 0 .. 31; SWTRIGR at 16#4# range 0 .. 31; DHR12R1 at 16#8# range 0 .. 31; DHR12L1 at 16#C# range 0 .. 31; DHR8R1 at 16#10# range 0 .. 31; DOR1 at 16#2C# range 0 .. 31; SR at 16#34# range 0 .. 31; end record; -- Digital-to-analog converter DAC_Periph : aliased DAC_Peripheral with Import, Address => System'To_Address (16#40007400#); end STM32_SVD.DAC;
with Lv.Style; package Lv.Objx.Roller is subtype Instance is Obj_T; type Style_T is (Style_Bg, Style_Sel); -- Create a roller object -- @param par pointer to an object, it will be the parent of the new roller -- @param copy pointer to a roller object, if not NULL then the new object will be copied from it -- @return pointer to the created roller function Create (Parent : Obj_T; Copy : Instance) return Instance; ---------------------- -- Setter functions -- ---------------------- -- Set the options on a roller -- @param self pointer to roller object -- @param options a string with '\n' separated options. E.g. "One\nTwo\nThree" procedure Set_Options (Self : Instance; Options : C_String_Ptr); -- Set the selected option -- @param self pointer to a roller object -- @param sel_opt id of the selected option (0 ... number of option - 1); -- @param anim_en true: set with animation; false set immediately procedure Set_Selected (Self : Instance; Set_Opt : Uint16_T; Anim_En : U_Bool); -- Set a function to call when a new option is chosen -- @param self pointer to a roller -- @param action pointer to a callback function procedure Set_Action (Self : Instance; Action : Action_Func_T); -- Set the height to show the given number of rows (options) -- @param self pointer to a roller object -- @param row_cnt number of desired visible rows procedure Set_Visible_Row_Count (Self : Instance; Arg2 : Uint8_T); -- Enable or disable the horizontal fit to the content -- @param self pointer to a roller -- @param fit en true: enable auto fit; false: disable auto fit procedure Set_Hor_Fit (Self : Instance; Fit_En : U_Bool); -- Set the open/close animation time. -- @param self pointer to a roller object -- @param anim_time: open/close animation time [ms] procedure Set_Anim_Time (Self : Instance; Anim_Time : Uint16_T); -- Set a style of a roller -- @param self pointer to a roller object -- @param type which style should be set -- @param style pointer to a style procedure Set_Style (Self : Instance; Type_P : Style_T; Style : access Lv.Style.Style); ---------------------- -- Getter functions -- ---------------------- -- Get the options of a roller -- @param self pointer to roller object -- @return the options separated by '\n'-s (E.g. "Option1\nOption2\nOption3") function Options (Self : Instance) return C_String_Ptr; -- Get the id of the selected option -- @param self pointer to a roller object -- @return id of the selected option (0 ... number of option - 1); function Selected (Self : Instance) return Uint16_T; -- Get the current selected option as a string -- @param self pointer to roller object -- @param buf pointer to an array to store the string procedure Selected_Str (Self : Instance; Buf : C_String_Ptr); -- Get the "option selected" callback function -- @param self pointer to a roller -- @return pointer to the call back function function Action (Self : Instance) return Action_Func_T; -- Get the open/close animation time. -- @param self pointer to a roller -- @return open/close animation time [ms] function Anim_Time (Self : Instance) return Uint16_T; -- Get the auto width set attribute -- @param self pointer to a roller object -- @return true: auto size enabled; false: manual width settings enabled function Hor_Fit (Self : Instance) return U_Bool; -- Get a style of a roller -- @param self pointer to a roller object -- @param type which style should be get -- @return style pointer to a style function Style (Self : Instance; Type_P : Style_T) return access Lv.Style.Style; ------------- -- Imports -- ------------- pragma Import (C, Create, "lv_roller_create"); pragma Import (C, Set_Options, "lv_roller_set_options_inline"); pragma Import (C, Set_Selected, "lv_roller_set_selected"); pragma Import (C, Set_Action, "lv_roller_set_action_inline"); pragma Import (C, Set_Visible_Row_Count, "lv_roller_set_visible_row_count"); pragma Import (C, Set_Hor_Fit, "lv_roller_set_hor_fit_inline"); pragma Import (C, Set_Anim_Time, "lv_roller_set_anim_time_inline"); pragma Import (C, Set_Style, "lv_roller_set_style"); pragma Import (C, Options, "lv_roller_get_options_inline"); pragma Import (C, Selected, "lv_roller_get_selected_inline"); pragma Import (C, Selected_Str, "lv_roller_get_selected_str_inline"); pragma Import (C, Action, "lv_roller_get_action_inline"); pragma Import (C, Anim_Time, "lv_roller_get_anim_time_inline"); pragma Import (C, Hor_Fit, "lv_roller_get_hor_fit"); pragma Import (C, Style, "lv_roller_get_style"); for Style_T'Size use 8; for Style_T use (Style_Bg => 0, Style_Sel => 1); end Lv.Objx.Roller;
with Trendy_Test.Assertions.Discrete; package Trendy_Test.Assertions.Integer_Assertions is new Trendy_Test.Assertions.Discrete (Integer);
-- 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; with Tk.Widget; package body Tk.Image.Bitmap is function Options_To_String(Options: Bitmap_Options) return String is use Ada.Strings.Unbounded; use Tk.Widget; Options_String: Unbounded_String := Null_Unbounded_String; begin Option_Image (Name => "data", Value => Options.Data, Options_String => Options_String); Option_Image (Name => "file", Value => Options.File, Options_String => Options_String); Option_Image (Name => "background", Value => Options.Background, Options_String => Options_String); Option_Image (Name => "foreground", Value => Options.Foreground, Options_String => Options_String); Option_Image (Name => "maskdata", Value => Options.Mask_Data, Options_String => Options_String); Option_Image (Name => "maskfile", Value => Options.Mask_File, Options_String => Options_String); return To_String(Source => Options_String); end Options_To_String; procedure Create (Bitmap_Image: Tk_Image; Options: Bitmap_Options; Interpreter: Tcl_Interpreter := Get_Interpreter) is begin Tcl_Eval (Tcl_Script => "image create bitmap " & Bitmap_Image & Options_To_String(Options => Options), Interpreter => Interpreter); end Create; function Create (Options: Bitmap_Options; Interpreter: Tcl_Interpreter := Get_Interpreter) return Tk_Image is begin return Tcl_Eval (Tcl_Script => "image create bitmap" & Options_To_String(Options => Options), Interpreter => Interpreter) .Result; end Create; procedure Configure (Bitmap_Image: Tk_Image; Options: Bitmap_Options; Interpreter: Tcl_Interpreter := Get_Interpreter) is begin Tcl_Eval (Tcl_Script => Bitmap_Image & " configure " & Options_To_String(Options => Options), Interpreter => Interpreter); end Configure; function Get_Option (Bitmap_Image: Tk_Image; Name: String; Interpreter: Tcl_Interpreter := Get_Interpreter) return String is Result_List: constant Array_List := Split_List (List => Tcl_Eval (Tcl_Script => Bitmap_Image & " configure -" & Name, Interpreter => Interpreter) .Result, Interpreter => Interpreter); begin return To_Ada_String(Source => Result_List(Result_List'Last)); end Get_Option; function Get_Options (Bitmap_Image: Tk_Image; Interpreter: Tcl_Interpreter := Get_Interpreter) return Bitmap_Options is begin return Options: Bitmap_Options := Default_Bitmap_Options do Options.Data := To_Tcl_String (Source => Get_Option (Bitmap_Image => Bitmap_Image, Name => "data", Interpreter => Interpreter)); Options.File := To_Tcl_String (Source => Get_Option (Bitmap_Image => Bitmap_Image, Name => "file", Interpreter => Interpreter)); Options.Background := To_Tcl_String (Source => Get_Option (Bitmap_Image => Bitmap_Image, Name => "background", Interpreter => Interpreter)); Options.Foreground := To_Tcl_String (Source => Get_Option (Bitmap_Image => Bitmap_Image, Name => "foreground", Interpreter => Interpreter)); Options.Mask_Data := To_Tcl_String (Source => Get_Option (Bitmap_Image => Bitmap_Image, Name => "maskdata", Interpreter => Interpreter)); Options.Mask_File := To_Tcl_String (Source => Get_Option (Bitmap_Image => Bitmap_Image, Name => "maskfile", Interpreter => Interpreter)); end return; end Get_Options; end Tk.Image.Bitmap;
with Ada.Directories; with Ada.Text_Io; -- TODO unecessary? with Iictl; -- TODO unecessary? with Util; package body Ch_Conn is package AD renames Ada.Directories; package ATIO renames Ada.Text_Io; procedure Rejoin_Channels (Irc_Dir : String) is Search : AD.Search_Type; Dir_Ent : AD.Directory_Entry_Type; begin AD.Start_Search (Search, Irc_Dir, ""); while AD.More_Entries (Search) loop AD.Get_Next_Entry (Search, Dir_Ent); Scan_Server (Dir_Ent); end loop; AD.End_Search (Search); end Rejoin_Channels; procedure Scan_Server (Srv_Dir : AD.Directory_Entry_Type) is -- TODO rename Scan_Server_Channels? Srv_Path : String := AD.Full_Name (Srv_Dir); Srv_Name : String := AD.Simple_Name (Srv_Dir); Search : AD.Search_Type; Ch_Dir : AD.Directory_Entry_Type; begin if Srv_Name(Srv_Name'First) = '.' then -- TODO if not Is_Srv_Dir? return; end if; Util.Verbose_Print ("Iictl: Scan_Server: Scanning " & Srv_Name); AD.Start_Search (Search, Srv_Path, ""); while AD.More_Entries (Search) loop AD.Get_Next_Entry (Search, Ch_Dir); Maintain_Channel_Connection (Srv_Dir, Ch_Dir); end loop; AD.End_Search (Search); end Scan_Server; procedure Maintain_Channel_Connection (Srv_Dir : AD.Directory_Entry_Type; Ch_Dir : AD.Directory_Entry_Type) is Ch_Path : String := AD.Full_Name (Ch_Dir); -- TODO unused? Ch_Name : String := AD.Simple_Name (Ch_Dir); begin Util.Verbose_Print ("Iictl: Maintain_Channel_Connection " & Ch_Path); if Ch_Name(Ch_Name'First) /= '#' then -- TODO if not Is_Ch_Dir? return; end if; if not Util.Is_Fifo_Up (AD.Full_Name (Ch_Dir)) then Rejoin_Channel (Srv_Dir, Ch_Dir); end if; end Maintain_Channel_Connection; procedure Rejoin_Channel (Srv_Dir : AD.Directory_Entry_Type; Ch_Dir : AD.Directory_Entry_Type) is Srv_Path : String := AD.Full_Name (Srv_Dir); Ch_Name : String := AD.Simple_Name (Ch_Dir); Srv_In : ATIO.File_Type; begin Util.Verbose_Print ("Iictl: Rejoin_Channel: Rejoining " & AD.Simple_Name (Ch_Dir)); ATIO.Open (Srv_In, ATIO.Out_File, Srv_Path & "/in"); ATIO.Put_Line (Srv_In, "/join " & Ch_Name); ATIO.Close (Srv_In); end Rejoin_Channel; end Ch_Conn;
package body Smallest_Factor with SPARK_Mode is procedure SmallestF (N : in out Positive; Factor : out Positive) is begin Factor := 2; for I in Positive range 2 .. N loop pragma Loop_Invariant (for all J in 2 .. I - 1 => N rem J /= 0); Factor := I; if N rem I = 0 then exit; end if; end loop; N := N / Factor; end SmallestF; end Smallest_Factor;
----------------------------------------------------------------------- -- bundles -- Bundle and translation example -- Copyright (C) 2010, 2021 Stephane Carrez -- Written by Stephane Carrez (Stephane.Carrez@gmail.com) -- -- Licensed under the Apache License, Version 2.0 (the "License"); -- you may not use this file except in compliance with the License. -- You may obtain a copy of the License at -- -- http://www.apache.org/licenses/LICENSE-2.0 -- -- Unless required by applicable law or agreed to in writing, software -- distributed under the License is distributed on an "AS IS" BASIS, -- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -- See the License for the specific language governing permissions and -- limitations under the License. ----------------------------------------------------------------------- with Ada.Text_IO; with Ada.Strings.Unbounded; with Ada.Exceptions; with Util.Properties.Bundles; with Util.Log.Loggers; with GNAT.Command_Line; procedure Bundles is use GNAT.Command_Line; use Ada.Strings.Unbounded; use Util.Properties.Bundles; use Util.Log.Loggers; Log : constant Logger := Create ("log"); Factory : Util.Properties.Bundles.Loader; Bundle : Util.Properties.Bundles.Manager; Locale : Unbounded_String := To_Unbounded_String ("en"); begin Util.Log.Loggers.Initialize ("samples/log4j.properties"); -- Load the bundles from the current directory Initialize (Factory, "samples/"); loop case Getopt ("h l: locale: d: directory: help") is when ASCII.NUL => exit; when 'd' => Initialize (Factory, Parameter); when 'l' => Locale := To_Unbounded_String (Parameter); when others => Log.Info ("Usage: bundles -d dir -l locale bundle"); return; end case; end loop; declare Name : constant String := Get_Argument; begin Load_Bundle (Factory, Name, To_String (Locale), Bundle); exception when NO_BUNDLE => Log.Error ("There is no bundle: {0}", Name); end; loop declare Name : constant String := Get_Argument; begin exit when Name = ""; Ada.Text_IO.Put_Line (Name & "=" & String '(Bundle.Get (Name))); end; end loop; exception when Invalid_Switch | Invalid_Parameter => Log.Error ("Usage: bundles -d dir -l locale bundle message message"); Log.Error ("Example: bundles -d samples -l fr messages welcome"); Log.Error (" bundles -d samples -l de messages welcome"); Log.Error (" bundles -d samples messages welcome"); when E : Util.Properties.NO_PROPERTY => Ada.Text_IO.Put_Line (Ada.Exceptions.Exception_Message (E)); end Bundles;
----------------------------------------------------------------------- -- awa-modules -- Application Module -- Copyright (C) 2009, 2010, 2011, 2012, 2015, 2016, 2017, 2018 Stephane Carrez -- Written by Stephane Carrez (Stephane.Carrez@gmail.com) -- -- Licensed under the Apache License, Version 2.0 (the "License"); -- you may not use this file except in compliance with the License. -- You may obtain a copy of the License at -- -- http://www.apache.org/licenses/LICENSE-2.0 -- -- Unless required by applicable law or agreed to in writing, software -- distributed under the License is distributed on an "AS IS" BASIS, -- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -- See the License for the specific language governing permissions and -- limitations under the License. ----------------------------------------------------------------------- with Ada.Finalization; with Ada.Strings.Hash; with Ada.Strings.Unbounded; with Ada.Containers.Indefinite_Hashed_Maps; with Util.Log.Loggers; with Util.Beans.Basic; with Util.Beans.Objects; with Util.Serialize.IO; with Util.Listeners; with EL.Expressions; with ASF.Beans; with ASF.Applications; with ADO.Sessions; with AWA.Events; limited with AWA.Applications; -- == AWA Modules == -- A module is a software component that can be integrated in the -- web application. The module can bring a set of service APIs, -- some Ada beans and some presentation files. The AWA framework -- allows to configure various parts of a module when it is integrated -- in an application. Some modules are designed to be re-used by -- several applications (for example a _mail_ module, a _users_ -- module, ...). Other modules could be specific to an application. -- An application will be made of several modules, some will be -- generic some others specific to the application. -- -- === Registration === -- The module should have only one instance per application and it must -- be registered when the application is initialized. The module -- instance should be added to the application record as follows: -- -- type Application is new AWA.Applications.Application with record -- Xxx : aliased Xxx_Module; -- end record; -- -- The application record must override the `Initialize_Module` procedure -- and it must register the module instance. This is done as follows: -- -- overriding -- procedure Initialize_Modules (App : in out Application) is -- begin -- Register (App => App.Self.all'Access, -- Name => Xxx.Module.NAME, -- URI => "xxx", -- Module => App.User_Module'Access); -- end Initialize_Modules; -- -- The module is registered under a unique name. That name is used -- to load the module configuration. -- -- === Configuration === -- The module is configured by using an XML or a properties file. -- The configuration file is used to define: -- -- * the Ada beans that the module defines and uses, -- * the events that the module wants to receive and the action -- that must be performed when the event is posted, -- * the permissions that the module needs and how to check them, -- * the navigation rules which are used for the module web interface, -- * the servlet and filter mappings used by the module -- -- The module configuration is located in the *config* directory -- and must be the name of the module followed by the file extension -- (example: `module-name`.xml or `module-name`.properties). -- -- package AWA.Modules is type Application_Access is access all AWA.Applications.Application'Class; -- ------------------------------ -- Module manager -- ------------------------------ -- -- The <b>Module_Manager</b> represents the root of the logic manager type Module_Manager is new Ada.Finalization.Limited_Controlled and Util.Beans.Basic.Readonly_Bean with private; function Get_Value (Manager : in Module_Manager; Name : in String) return Util.Beans.Objects.Object; -- Get the module configuration property identified by the name. -- If the configuration property does not exist, returns the default value. function Get_Config (Plugin : Module_Manager; Name : String; Default : String := "") return String; -- Get the module configuration property identified by the <tt>Config</tt> parameter. -- If the property does not exist, the default configuration value is returned. function Get_Config (Plugin : in Module_Manager; Config : in ASF.Applications.Config_Param) return String; -- ------------------------------ -- Module -- ------------------------------ type Module is abstract new Ada.Finalization.Limited_Controlled with private; type Module_Access is access all Module'Class; -- Get the module name function Get_Name (Plugin : Module) return String; -- Get the base URI for this module function Get_URI (Plugin : Module) return String; -- Get the application in which this module is registered. function Get_Application (Plugin : in Module) return Application_Access; -- Find the module with the given name function Find_Module (Plugin : Module; Name : String) return Module_Access; -- Get the module configuration property identified by the name. -- If the configuration property does not exist, returns the default value. function Get_Config (Plugin : Module; Name : String; Default : String := "") return String; -- Get the module configuration property identified by the name. -- If the configuration property does not exist, returns the default value. function Get_Config (Plugin : Module; Name : String; Default : Integer := -1) return Integer; -- Get the module configuration property identified by the name. -- If the configuration property does not exist, returns the default value. function Get_Config (Plugin : Module; Name : String; Default : Boolean := False) return Boolean; -- Get the module configuration property identified by the <tt>Config</tt> parameter. -- If the property does not exist, the default configuration value is returned. function Get_Config (Plugin : in Module; Config : in ASF.Applications.Config_Param) return String; -- Get the module configuration property identified by the <tt>Config</tt> parameter. -- If the configuration property does not exist, returns the default value. function Get_Config (Plugin : in Module; Name : in String; Default : in String := "") return EL.Expressions.Expression; procedure Initialize (Manager : in out Module_Manager; Module : in AWA.Modules.Module'Class); procedure Initialize (Plugin : in out Module; App : in Application_Access; Props : in ASF.Applications.Config); -- Initialize the configuration file parser represented by <b>Parser</b> to recognize -- the specific configuration recognized by the module. procedure Initialize_Parser (Plugin : in out Module; Parser : in out Util.Serialize.IO.Parser'Class) is null; -- Configures the module after its initialization and after having read its XML configuration. procedure Configure (Plugin : in out Module; Props : in ASF.Applications.Config) is null; -- Send the event to the module. The module identified by <b>To</b> is -- found and the event is posted on its event channel. procedure Send_Event (Plugin : in Module; Content : in AWA.Events.Module_Event'Class); -- Get the database connection for reading function Get_Session (Manager : Module) return ADO.Sessions.Session; -- Get the database connection for writing function Get_Master_Session (Manager : Module) return ADO.Sessions.Master_Session; -- Register under the given name a function to create the bean instance when -- it is accessed for a first time. The scope defines the scope of the bean. -- bean procedure Register (Plugin : in out Module; Name : in String; Bind : in ASF.Beans.Class_Binding_Access); -- Add a listener to the module listner list. The module will invoke the listner -- depending on events or actions that occur in the module. procedure Add_Listener (Into : in out Module; Item : in Util.Listeners.Listener_Access); -- Find the module with the given name in the application and add the listener to the -- module listener list. procedure Add_Listener (Plugin : in Module; Name : in String; Item : in Util.Listeners.Listener_Access); -- Remove a listener from the module listener list. procedure Remove_Listener (Into : in out Module; Item : in Util.Listeners.Listener_Access); -- Finalize the module. overriding procedure Finalize (Plugin : in out Module); type Pool_Module is abstract new Module with private; type Session_Module is abstract new Module with private; generic type Manager_Type is new Module_Manager with private; type Manager_Type_Access is access all Manager_Type'Class; Name : String; function Get_Manager return Manager_Type_Access; -- Get the database connection for reading function Get_Session (Manager : Module_Manager) return ADO.Sessions.Session; -- Get the database connection for writing function Get_Master_Session (Manager : Module_Manager) return ADO.Sessions.Master_Session; -- Send the event to the module. The module identified by <b>To</b> is -- found and the event is posted on its event channel. procedure Send_Event (Manager : in Module_Manager; Content : in AWA.Events.Module_Event'Class); -- ------------------------------ -- Module Registry -- ------------------------------ -- The module registry maintains the list of available modules with -- operations to retrieve them either from a name or from the base URI. type Module_Registry is limited private; type Module_Registry_Access is access all Module_Registry; -- Initialize the registry procedure Initialize (Registry : in out Module_Registry; Config : in ASF.Applications.Config); -- Register the module in the registry. procedure Register (Registry : in Module_Registry_Access; App : in Application_Access; Plugin : in Module_Access; Name : in String; URI : in String); -- Find the module with the given name function Find_By_Name (Registry : Module_Registry; Name : String) return Module_Access; -- Find the module mapped to a given URI function Find_By_URI (Registry : Module_Registry; URI : String) return Module_Access; -- Iterate over the modules that have been registered and execute the <b>Process</b> -- procedure on each of the module instance. procedure Iterate (Registry : in Module_Registry; Process : access procedure (Plugin : in out Module'Class)); private use Ada.Strings.Unbounded; type Module is abstract new Ada.Finalization.Limited_Controlled with record Registry : Module_Registry_Access; App : Application_Access := null; Name : Unbounded_String; URI : Unbounded_String; Config : ASF.Applications.Config; Self : Module_Access := null; Listeners : Util.Listeners.List; end record; -- Map to find a module from its name or its URI package Module_Maps is new Ada.Containers.Indefinite_Hashed_Maps (Key_Type => String, Element_Type => Module_Access, Hash => Ada.Strings.Hash, Equivalent_Keys => "="); type Module_Registry is limited record Config : ASF.Applications.Config; Name_Map : Module_Maps.Map; URI_Map : Module_Maps.Map; end record; type Module_Manager is new Ada.Finalization.Limited_Controlled and Util.Beans.Basic.Readonly_Bean with record Module : Module_Access := null; end record; type Pool_Module is new Module with record D : Natural; end record; type Session_Module is new Module with record P : Natural; end record; use Util.Log; -- The logger (used by the generic Get function). Log : constant Loggers.Logger := Loggers.Create ("AWA.Modules"); end AWA.Modules;
----------------------------------------------------------------------- -- date -- Print the date -- Copyright (C) 2011 Stephane Carrez -- Written by Stephane Carrez (Stephane.Carrez@gmail.com) -- -- Licensed under the Apache License, Version 2.0 (the "License"); -- you may not use this file except in compliance with the License. -- You may obtain a copy of the License at -- -- http://www.apache.org/licenses/LICENSE-2.0 -- -- Unless required by applicable law or agreed to in writing, software -- distributed under the License is distributed on an "AS IS" BASIS, -- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -- See the License for the specific language governing permissions and -- limitations under the License. ----------------------------------------------------------------------- with Ada.Text_IO; with Ada.Calendar; with Ada.Strings.Unbounded; with GNAT.Command_Line; with Util.Log.Loggers; with Util.Dates.Formats; with Util.Properties.Bundles; procedure Date is use type Ada.Calendar.Time; use Util.Log.Loggers; use Ada.Strings.Unbounded; use Util.Properties.Bundles; use GNAT.Command_Line; Log : constant Logger := Create ("log", "samples/log4j.properties"); Factory : Util.Properties.Bundles.Loader; Bundle : Util.Properties.Bundles.Manager; Locale : Unbounded_String := To_Unbounded_String ("en"); Date : constant Ada.Calendar.Time := Ada.Calendar.Clock; Use_Default : Boolean := True; begin -- Load the bundles from the current directory Initialize (Factory, "samples/;bundles"); loop case Getopt ("h l: locale: help") is when ASCII.NUL => exit; when 'l' => Locale := To_Unbounded_String (Parameter); when others => raise GNAT.Command_Line.Invalid_Switch; end case; end loop; begin Load_Bundle (Factory, "dates", To_String (Locale), Bundle); exception when NO_BUNDLE => Log.Error ("There is no bundle: {0}", "dates"); end; loop declare Pattern : constant String := Get_Argument; begin exit when Pattern = ""; Use_Default := False; Ada.Text_IO.Put_Line (Util.Dates.Formats.Format (Pattern => Pattern, Date => Date, Bundle => Bundle)); end; end loop; if Use_Default then Ada.Text_IO.Put_Line (Util.Dates.Formats.Format (Pattern => "%a %b %_d %T %Y", Date => Date, Bundle => Bundle)); end if; exception when GNAT.Command_Line.Invalid_Switch => Log.Error ("Usage: date -l locale format"); end Date;
-- DECLS-D_TAULA_DE_NOMS.adb -- Procediments per a la taula de noms package body Decls.D_Taula_De_Noms is -- Donam els valors per defecte de cada camp. procedure Tbuida (Tn : out Taula_De_Noms) is begin for I in Tn.Td'Range loop Tn.Td(I) := Id_Nul; end loop; Tn.Nid := 1; Tn.Ncar := 1; Tn.Tid(1).Seguent := Id_Nul; end Tbuida; procedure Posa_Id (Tn : in out Taula_De_Noms; idn : out Id_Nom; nom : in String) is -- Variable per el valor de la funcio de dispersio. P_Tid : Rang_Dispersio; -- Index per recorrer la taula d'identificadors. Idx : Id_Nom; Trobat : Boolean; P : Taula_Identificadors renames Tn.Tid; D : Taula_Dispersio renames Tn.Td; begin P_Tid := Fdisp_Tn(Nom); Idx := D(P_Tid); Trobat := False; while not Trobat and Idx/=Id_Nul loop if (Nom = Cons_Nom(Tn, Idx)) then Idn := idx; Trobat := True; else Idx := p(Idx).Seguent; end if; end loop; if not Trobat then Idn := Tn.Nid; P(Idn).Pos_Tcar := Tn.Ncar; P(Idn).Seguent := D(P_Tid); P(Idn).Long_Paraula := Nom'Length; D(P_Tid) := Tn.Nid; Posa_Tc(Tn, Nom); end if; end Posa_Id; procedure Posa_Tc (Tn : in out Taula_De_Noms; Nom : in String) is begin Tn.Nid := Tn.Nid + 1; for I in 1 .. Nom'Length loop Tn.Tc(Tn.Ncar) := Nom(I); Tn.Ncar := Tn.Ncar + 1; end loop; end Posa_Tc; procedure Posa_Str (Tn : in out Taula_De_Noms; Ids : out Rang_Tcar; S : in String) is -- Index per recorrer la taula de caracters. Jdx : Rang_Tcar; Long : Rang_Tcar renames Tn.Ncar; begin -- Excepcio per a controlar tc plena if (Long + S'Length) > Rang_Tcar'Last then raise E_Tcar_Plena; end if; -- Omplim la taula de caracters, desde la primera -- posicio lliure 'tn.ncar' renombrat a 'long'. Jdx := Long; Ids := Long; for I in 1..S'Length loop Tn.Tc(Jdx) := S(I); Jdx := Jdx + 1; end loop; Long := Jdx + 1; Tn.Tc(Jdx) := Ascii.Nul; end Posa_Str; function Cons_Nom (Tn : in Taula_De_Noms; Idn : in Id_Nom) Return String Is It1, It2 : Rang_Tcar; Begin If Idn /= Id_Nul Then It1 := Tn.Tid(Idn).Pos_Tcar; It2 := Rang_Tcar(Tn.Tid(Idn).Long_Paraula); It2 := It2 + It1 - 1; Return String(Tn.Tc(It1 .. It2)); Else Return "Id_Nul"; end If; end Cons_Nom; function Cons_Str (Tn : in Taula_De_Noms; Ids : in Rang_Tcar) return String is Idx : Rang_Tcar; begin Idx := Ids; while (Tn.Tc(Idx) /= Ascii.Nul) loop Idx := Idx+1; end loop; return String(Tn.Tc(Ids..Idx-1)); end Cons_Str; function Fdisp_Tn (Nom : in String) return Rang_Dispersio is A : array (Nom'Range) of Integer; R : array (1..2*Nom'Last) of Integer; K, C, M, N : Integer; Base : constant Integer := Character'Pos(Character'Last)+1; begin N := Nom'Last; M := Nom'Length; for I in 1..N loop A(I) := Character'Pos(Nom(I)); end Loop; for I in 1..2*N loop R(I) := 0; end loop; for I in 1..N loop C := 0; K := I - 1; for J in 1..N loop C := C + R(K+J) + A(I) + A(J); R(K+J) := C mod Base; C := C/Base; end loop; R(K+N+1) := R(K+N+1) + C; end loop; C := (R(N+1) * Base + R(N)) mod (Max_Id); return Rang_Dispersio(C); end Fdisp_Tn; end Decls.D_Taula_De_Noms;
pragma License (Unrestricted); -- public domain -- translated unit from MurmurHash3 -- -- MurmurHash3 was written by Austin Appleby, and is placed in the public -- domain. The author hereby disclaims copyright to this source code. -- -- Ada version: 2014 yt package Ada.Containers.Murmur_Hash_3 is -- 32bit version MurmurHash3 that targets low latency for hash table use. pragma Pure; type State is private; function Initialize (Initiator : Hash_Type) return State; pragma Inline (Initialize); -- Body procedure Update (S : in out State; Item : Hash_Type); -- Tail type Hash_8 is mod 2 ** 8; for Hash_8'Size use 8; type Hash_16 is mod 2 ** 16; for Hash_16'Size use 16; type Hash_24 is mod 2 ** 24; for Hash_24'Size use 24; procedure Update (S : in out State; Item : Hash_8); procedure Update (S : in out State; Item : Hash_16); procedure Update (S : in out State; Item : Hash_24); -- Finalization procedure Finalize (S : State; Digest : out Hash_Type); private pragma Compile_Time_Error (Hash_Type'Size /= 32, "size mismatch"); type State is record h1 : Hash_Type; len : Count_Type; end record; pragma Suppress_Initialization (State); end Ada.Containers.Murmur_Hash_3;
-- ---------------------------------------------------------------------------- -- Note this is an implementation package and is subject to change att any time. -- ---------------------------------------------------------------------------- package body DDS.Request_Reply.Requester.Impl is ------------------- -- Touch_Samples -- ------------------- function Touch_Samples (Self : not null access Ref; Max_Count : DDS.Integer; Read_Condition : DDS.ReadCondition.Ref_Access) return Integer is begin pragma Compile_Time_Warning (Standard.True, "Touch_Samples unimplemented"); return raise Program_Error with "Unimplemented function Touch_Samples"; end Touch_Samples; ------------------------- -- Wait_For_Any_Sample -- ------------------------- function Wait_For_Any_Sample (Self : not null access Ref; Max_Wait : DDS.Duration_T; Min_Sample_Count : DDS.Integer) return DDS.ReturnCode_T is begin pragma Compile_Time_Warning (Standard.True, "Wait_For_Any_Sample unimplemented"); return raise Program_Error with "Unimplemented function Wait_For_Any_Sample"; end Wait_For_Any_Sample; end DDS.Request_Reply.Requester.Impl;
pragma SPARK_Mode; with Interfaces.C; use Interfaces.C; with Sparkduino; use Sparkduino; package body SPARKZumo is Stop : constant := 0; Sample_Rate : constant := 500; procedure RISC_Test is Arr : Sensor_Array; begin loop Zumo_Pushbutton.WaitForButton; Zumo_QTR.Read_Sensors (Sensor_Values => Arr, ReadMode => Emitters_On); for I in Arr'Range loop Serial_Print_Short (Msg => "Sensor" & I'Img & ": ", Val => short (Arr (I))); end loop; end loop; end RISC_Test; procedure Calibration_Sequence is begin for I in 1 .. 4 loop case I is when 1 | 3 => Zumo_Motors.SetSpeed (LeftVelocity => Motor_Speed'First / 3, RightVelocity => Motor_Speed'Last / 3); when others => Zumo_Motors.SetSpeed (LeftVelocity => Motor_Speed'Last / 3, RightVelocity => Motor_Speed'First / 3); end case; for J in 1 .. 80 loop Zumo_QTR.Calibrate (ReadMode => ReadMode); SysDelay (20); end loop; end loop; Zumo_Motors.SetSpeed (LeftVelocity => Stop, RightVelocity => Stop); end Calibration_Sequence; procedure Inits is begin Zumo_LED.Init; Zumo_Pushbutton.Init; Zumo_Motors.Init; Zumo_QTR.Init; -- Zumo_Motion.Init; Initd := True; end Inits; procedure Setup is begin -- Board_Init.Initialize; Inits; Zumo_LED.Yellow_Led (On => True); Zumo_Pushbutton.WaitForButton; Zumo_LED.Yellow_Led (On => False); Calibration_Sequence; -- RISC_Test; Zumo_LED.Yellow_Led (On => True); Zumo_Pushbutton.WaitForButton; -- for I in Zumo_QTR.Cal_Vals_On'Range loop -- Serial_Print_Calibration (Index => I, -- Min => Zumo_QTR.Cal_Vals_On (I).Min, -- Max => Zumo_QTR.Cal_Vals_On (I).Max); -- end loop; -- -- SysDelay (1000); -- Zumo_Pushbutton.WaitForButton; end Setup; procedure WorkLoop is Start, Length : unsigned_long; begin Start := Millis; Line_Finder.LineFinder (ReadMode => ReadMode); Length := Millis - Start; if Length < Sample_Rate then DelayMicroseconds (Time => unsigned (Sample_Rate - Length) * 100); end if; end WorkLoop; procedure Exception_Handler is begin Zumo_Motors.SetSpeed (LeftVelocity => Stop, RightVelocity => Stop); loop Zumo_LED.Yellow_Led (On => True); SysDelay (Time => 500); Zumo_LED.Yellow_Led (On => False); SysDelay (Time => 500); end loop; end Exception_Handler; end SPARKZumo;
-- SPDX-License-Identifier: Apache-2.0 -- -- Copyright (c) 2012 Felix Krause <contact@flyx.org> -- -- Licensed under the Apache License, Version 2.0 (the "License"); -- you may not use this file except in compliance with the License. -- You may obtain a copy of the License at -- -- http://www.apache.org/licenses/LICENSE-2.0 -- -- Unless required by applicable law or agreed to in writing, software -- distributed under the License is distributed on an "AS IS" BASIS, -- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -- See the License for the specific language governing permissions and -- limitations under the License. with GL.Runtime_Loading; with GL.Blending; with GL.Buffers; with GL.Context; with GL.Debug; with GL.Debug_Types; with GL.Enums.Getter; with GL.Enums.Internalformat; with GL.Enums.Textures; with GL.Errors; with GL.Fences; with GL.Low_Level.Enums; with GL.Objects.Buffers; with GL.Objects.Framebuffers; with GL.Objects.Queries; with GL.Objects.Shaders; with GL.Objects.Textures; with GL.Pixels.Queries; with GL.Rasterization; with GL.Toggles; with GL.Types.Colors; with GL.Types.Compute; with GL.Types.Debug; with GL.Types.Pointers; with GL.Viewports; with Interfaces.C.Strings; with System; private package GL.API is pragma Preelaborate; use GL.Types; function GL_Subprogram_Reference (Function_Name : String) return System.Address; -- Implementation is platform-specific. Therefore, gl-api.adb is in the -- platform-specific source folders. package Loader is new Runtime_Loading (GL_Subprogram_Reference); -- Everything newer than OpenGL 1.1 will not be statically bound, -- but loaded with GL.Low_Level.Loader at runtime. -- -- Also, all functions that have been deprecated with OpenGL 3.0 -- will not be statically bound, as they may be omitted by implementors -- when they choose to only implement the OpenGL Core Profile. subtype Zero is Int range 0 .. 0; package Get_Error is new Loader.Function_Without_Params ("glGetError", Errors.Error_Code); package Flush is new Loader.Procedure_Without_Params ("glFlush"); package Get_Graphics_Reset_Status is new Loader.Function_Without_Params ("glGetGraphicsResetStatus", Context.Reset_Status); ----------------------------------------------------------------------------- -- Parameter getters -- ----------------------------------------------------------------------------- package Get_Boolean is new Loader.Getter_With_2_Params ("glGetBooleanv", Enums.Getter.Parameter, Low_Level.Bool); package Get_Double_Vec2_I is new Loader.Getter_With_3_Params ("glGetDoublei_v", Enums.Getter.Parameter, UInt, Doubles.Vector2); package Get_Single is new Loader.Getter_With_2_Params ("glGetFloatv", Enums.Getter.Parameter, Single); package Get_Single_Vec2 is new Loader.Getter_With_2_Params ("glGetFloatv", Enums.Getter.Parameter, Singles.Vector2); package Get_Single_Vec4_I is new Loader.Getter_With_3_Params ("glGetFloati_v", Enums.Getter.Parameter, UInt, Singles.Vector4); package Get_Color is new Loader.Getter_With_2_Params ("glGetFloatv", Enums.Getter.Parameter, Colors.Color); package Get_Enabled_Color is new Loader.Getter_With_3_Params ("glGetBooleani_v", Enums.Getter.Parameter, Buffers.Draw_Buffer_Index, Colors.Enabled_Color); package Get_Long is new Loader.Getter_With_2_Params ("glGetInteger64v", Enums.Getter.Parameter, Long); package Get_Integer is new Loader.Getter_With_2_Params ("glGetIntegerv", Enums.Getter.Parameter, Int); package Get_Unsigned_Integer is new Loader.Getter_With_2_Params ("glGetIntegerv", Enums.Getter.Parameter, UInt); package Get_Size is new Loader.Getter_With_2_Params ("glGetIntegerv", Enums.Getter.Parameter, Size); package Get_Size_I is new Loader.Getter_With_3_Params ("glGetIntegeri_v", Enums.Getter.Parameter, UInt, Size); package Get_Int_Vec4_I is new Loader.Getter_With_3_Params ("glGetIntegeri_v", Enums.Getter.Parameter, UInt, Ints.Vector4); package Get_Blend_Factor is new Loader.Getter_With_2_Params ("glGetIntegerv", Enums.Getter.Parameter, Blending.Blend_Factor); package Get_Alignment is new Loader.Getter_With_2_Params ("glGetIntegerv", Enums.Getter.Parameter, Pixels.Alignment); package Get_Blend_Equation is new Loader.Getter_With_2_Params ("glGetIntegerv", Enums.Getter.Parameter, Blending.Equation); package Get_Clip_Origin is new Loader.Getter_With_2_Params ("glGetIntegerv", Enums.Getter.Parameter, Viewports.Viewport_Origin); package Get_Clip_Depth_Mode is new Loader.Getter_With_2_Params ("glGetIntegerv", Enums.Getter.Parameter, Viewports.Depth_Mode); package Get_Compare_Function is new Loader.Getter_With_2_Params ("glGetIntegerv", Enums.Getter.Parameter, Compare_Function); package Get_Orientation is new Loader.Getter_With_2_Params ("glGetIntegerv", Enums.Getter.Parameter, Rasterization.Orientation); package Get_Face_Selector is new Loader.Getter_With_2_Params ("glGetIntegerv", Enums.Getter.Parameter, Rasterization.Face_Selector); package Get_Polygon_Mode is new Loader.Getter_With_2_Params ("glGetIntegerv", Enums.Getter.Parameter, Rasterization.Polygon_Mode_Type); package Get_Logic_Op is new Loader.Getter_With_2_Params ("glGetIntegerv", Enums.Getter.Parameter, Blending.Logic_Op); package Get_Stencil_Action is new Loader.Getter_With_2_Params ("glGetIntegerv", Enums.Getter.Parameter, Buffers.Stencil_Action); package Get_String is new Loader.Function_With_1_Param ("glGetString", Enums.Getter.String_Parameter, C.Strings.chars_ptr); package Get_String_I is new Loader.Function_With_2_Params ("glGetStringi", Enums.Getter.String_Parameter, UInt, C.Strings.chars_ptr); package Get_Context_Flags is new Loader.Getter_With_2_Params ("glGetIntegerv", Enums.Getter.Parameter, Low_Level.Bitfield); package Get_Context_Reset_Notification is new Loader.Getter_With_2_Params ("glGetIntegerv", Enums.Getter.Parameter, Context.Context_Reset_Notification); package Get_Context_Release_Behavior is new Loader.Getter_With_2_Params ("glGetIntegerv", Enums.Getter.Parameter, Context.Context_Release_Behavior); ----------------------------------------------------------------------------- -- Toggles -- ----------------------------------------------------------------------------- package Enable is new Loader.Procedure_With_1_Param ("glEnable", Toggles.Toggle); package Disable is new Loader.Procedure_With_1_Param ("glDisable", Toggles.Toggle); package Is_Enabled is new Loader.Function_With_1_Param ("glIsEnabled", Toggles.Toggle, Low_Level.Bool); package Enable_I is new Loader.Procedure_With_2_Params ("glEnablei", Toggles.Toggle_Indexed, UInt); package Disable_I is new Loader.Procedure_With_2_Params ("glDisablei", Toggles.Toggle_Indexed, UInt); package Is_Enabled_I is new Loader.Function_With_2_Params ("glIsEnabledi", Toggles.Toggle_Indexed, UInt, Low_Level.Bool); ----------------------------------------------------------------------------- -- Clipping -- ----------------------------------------------------------------------------- package Clip_Control is new Loader.Procedure_With_2_Params ("glClipControl", Viewports.Viewport_Origin, Viewports.Depth_Mode); ----------------------------------------------------------------------------- -- Culling -- ----------------------------------------------------------------------------- package Cull_Face is new Loader.Procedure_With_1_Param ("glCullFace", Rasterization.Face_Selector); package Front_Face is new Loader.Procedure_With_1_Param ("glFrontFace", Rasterization.Orientation); ----------------------------------------------------------------------------- -- Pixel stuff -- ----------------------------------------------------------------------------- package Pixel_Store_Size is new Loader.Procedure_With_2_Params ("glPixelStorei", Enums.Pixel_Store_Param, Size); package Pixel_Store_Alignment is new Loader.Procedure_With_2_Params ("glPixelStorei", Enums.Pixel_Store_Param, Pixels.Alignment); ----------------------------------------------------------------------------- -- Drawing -- ----------------------------------------------------------------------------- package Draw_Arrays_Instanced_Base_Instance is new Loader.Procedure_With_5_Params ("glDrawArraysInstancedBaseInstance", Connection_Mode, Int, Size, Size, UInt); package Multi_Draw_Arrays_Indirect is new Loader.Procedure_With_4_Params ("glMultiDrawArraysIndirect", Connection_Mode, Int, Size, Size); package Multi_Draw_Arrays_Indirect_Count is new Loader.Procedure_With_5_Params ("glMultiDrawArraysIndirectCount", Connection_Mode, Int, Low_Level.IntPtr, Size, Size); package Draw_Elements_Instanced_Base_Vertex_Base_Instance is new Loader.Procedure_With_7_Params ("glDrawElementsInstancedBaseVertexBaseInstance", Connection_Mode, Size, Index_Type, Low_Level.IntPtr, Size, Int, UInt); package Multi_Draw_Elements_Indirect is new Loader.Procedure_With_5_Params ("glMultiDrawElementsIndirect", Connection_Mode, Index_Type, Int, Size, Size); package Multi_Draw_Elements_Indirect_Count is new Loader.Procedure_With_6_Params ("glMultiDrawElementsIndirectCount", Connection_Mode, Index_Type, Int, Low_Level.IntPtr, Size, Size); ----------------------------------------------------------------------------- -- Blending -- ----------------------------------------------------------------------------- package Blend_Func_Separate is new Loader.Procedure_With_4_Params ("glBlendFuncSeparate", Blending.Blend_Factor, Blending.Blend_Factor, Blending.Blend_Factor, Blending.Blend_Factor); package Blend_Func_Separate_I is new Loader.Procedure_With_5_Params ("glBlendFuncSeparatei", Buffers.Draw_Buffer_Index, Blending.Blend_Factor, Blending.Blend_Factor, Blending.Blend_Factor, Blending.Blend_Factor); package Blend_Color is new Loader.Procedure_With_4_Params ("glBlendColor", Colors.Component, Colors.Component, Colors.Component, Colors.Component); package Blend_Equation_Separate is new Loader.Procedure_With_2_Params ("glBlendEquationSeparate", Blending.Equation, Blending.Equation); package Blend_Equation_Separate_I is new Loader.Procedure_With_3_Params ("glBlendEquationSeparatei", Buffers.Draw_Buffer_Index, Blending.Equation, Blending.Equation); ----------------------------------------------------------------------------- -- Rasterization -- ----------------------------------------------------------------------------- package Polygon_Mode is new Loader.Procedure_With_2_Params ("glPolygonMode", Rasterization.Face_Selector, Rasterization.Polygon_Mode_Type); package Polygon_Offset_Clamp is new Loader.Procedure_With_3_Params ("glPolygonOffsetClamp", Single, Single, Single); ----------------------------------------------------------------------------- -- Multisample shading -- ----------------------------------------------------------------------------- package Min_Sample_Shading is new Loader.Procedure_With_1_Param ("glMinSampleShading", Single); -- TODO glSampleMaski (replaces glSampleCoverage), glGetMultisample ----------------------------------------------------------------------------- -- Buffers -- ----------------------------------------------------------------------------- package Color_Mask is new Loader.Procedure_With_4_Params ("glColorMask", Low_Level.Bool, Low_Level.Bool, Low_Level.Bool, Low_Level.Bool); package Color_Mask_Indexed is new Loader.Procedure_With_5_Params ("glColorMaski", Buffers.Draw_Buffer_Index, Low_Level.Bool, Low_Level.Bool, Low_Level.Bool, Low_Level.Bool); ----------------------------------------------------------------------------- -- Depth and stencil buffers -- ----------------------------------------------------------------------------- package Depth_Mask is new Loader.Procedure_With_1_Param ("glDepthMask", Low_Level.Bool); package Depth_Func is new Loader.Procedure_With_1_Param ("glDepthFunc", Compare_Function); package Stencil_Func_Separate is new Loader.Procedure_With_4_Params ("glStencilFuncSeparate", Rasterization.Face_Selector, Compare_Function, Int, UInt); package Stencil_Op_Separate is new Loader.Procedure_With_4_Params ("glStencilOpSeparate", Rasterization.Face_Selector, Buffers.Stencil_Action, Buffers.Stencil_Action, Buffers.Stencil_Action); package Stencil_Mask_Separate is new Loader.Procedure_With_2_Params ("glStencilMaskSeparate", Rasterization.Face_Selector, UInt); ----------------------------------------------------------------------------- -- Textures -- ----------------------------------------------------------------------------- package Texture_Parameter_Int is new Loader.Procedure_With_3_Params ("glTextureParameteri", UInt, Enums.Textures.Parameter, Int); package Get_Texture_Parameter_Int is new Loader.Getter_With_3_Params ("glGetTextureParameteriv", UInt, Enums.Textures.Parameter, Int); package Get_Texture_Level_Parameter is new Loader.Getter_With_4_Params ("glGetTextureLevelParameteriv", UInt, Objects.Textures.Mipmap_Level, Enums.Textures.Level_Parameter, Size); package Get_Texture_Level_Parameter_Format_I is new Loader.Getter_With_4_Params ("glGetTextureLevelParameteriv", UInt, Objects.Textures.Mipmap_Level, Enums.Textures.Level_Parameter, Pixels.Internal_Format); package Get_Texture_Level_Parameter_Format_C is new Loader.Getter_With_4_Params ("glGetTextureLevelParameteriv", UInt, Objects.Textures.Mipmap_Level, Enums.Textures.Level_Parameter, Pixels.Compressed_Format); package Delete_Textures is new Loader.Procedure_With_2_Params ("glDeleteTextures", Size, Low_Level.UInt_Array); package Texture_Buffer is new Loader.Procedure_With_3_Params ("glTextureBuffer", UInt, Pixels.Internal_Format_Buffer_Texture, UInt); package Texture_Buffer_Range is new Loader.Procedure_With_5_Params ("glTextureBufferRange", UInt, Pixels.Internal_Format_Buffer_Texture, UInt, Low_Level.IntPtr, Size); package Texture_Storage_1D is new Loader.Procedure_With_4_Params ("glTextureStorage1D", UInt, Size, Pixels.Internal_Format, Size); package Texture_Storage_2D_I is new Loader.Procedure_With_5_Params ("glTextureStorage2D", UInt, Size, Pixels.Internal_Format, Size, Size); package Texture_Storage_3D_I is new Loader.Procedure_With_6_Params ("glTextureStorage3D", UInt, Size, Pixels.Internal_Format, Size, Size, Size); package Texture_Storage_2D_C is new Loader.Procedure_With_5_Params ("glTextureStorage2D", UInt, Size, Pixels.Compressed_Format, Size, Size); package Texture_Storage_3D_C is new Loader.Procedure_With_6_Params ("glTextureStorage3D", UInt, Size, Pixels.Compressed_Format, Size, Size, Size); package Texture_Storage_2D_Multisample_I is new Loader.Procedure_With_6_Params ("glTextureStorage2DMultisample", UInt, Size, Pixels.Internal_Format, Size, Size, Low_Level.Bool); package Texture_Storage_3D_Multisample_I is new Loader.Procedure_With_7_Params ("glTextureStorage3DMultisample", UInt, Size, Pixels.Internal_Format, Size, Size, Size, Low_Level.Bool); package Texture_Storage_2D_Multisample_C is new Loader.Procedure_With_6_Params ("glTextureStorage2DMultisample", UInt, Size, Pixels.Compressed_Format, Size, Size, Low_Level.Bool); package Texture_Storage_3D_Multisample_C is new Loader.Procedure_With_7_Params ("glTextureStorage3DMultisample", UInt, Size, Pixels.Compressed_Format, Size, Size, Size, Low_Level.Bool); package Texture_Sub_Image_1D is new Loader.Procedure_With_7_Params ("glTextureSubImage1D", UInt, Objects.Textures.Mipmap_Level, Int, Size, Pixels.Format, Pixels.Data_Type, System.Address); package Texture_Sub_Image_2D is new Loader.Procedure_With_9_Params ("glTextureSubImage2D", UInt, Objects.Textures.Mipmap_Level, Int, Int, Size, Size, Pixels.Format, Pixels.Data_Type, System.Address); package Texture_Sub_Image_3D is new Loader.Procedure_With_11_Params ("glTextureSubImage3D", UInt, Objects.Textures.Mipmap_Level, Int, Int, Int, Size, Size, Size, Pixels.Format, Pixels.Data_Type, System.Address); package Compressed_Texture_Sub_Image_2D is new Loader.Procedure_With_9_Params ("glCompressedTextureSubImage2D", UInt, Objects.Textures.Mipmap_Level, Int, Int, Size, Size, Pixels.Compressed_Format, Size, System.Address); package Compressed_Texture_Sub_Image_3D is new Loader.Procedure_With_11_Params ("glCompressedTextureSubImage3D", UInt, Objects.Textures.Mipmap_Level, Int, Int, Int, Size, Size, Size, Pixels.Compressed_Format, Size, System.Address); package Copy_Image_Sub_Data is new Loader.Procedure_With_15_Params ("glCopyImageSubData", UInt, Low_Level.Enums.Texture_Kind, Objects.Textures.Mipmap_Level, Int, Int, Int, UInt, Low_Level.Enums.Texture_Kind, Objects.Textures.Mipmap_Level, Int, Int, Int, Size, Size, Size); package Clear_Tex_Image is new Loader.Procedure_With_5_Params ("glClearTexImage", UInt, Objects.Textures.Mipmap_Level, Pixels.Format, Pixels.Data_Type, System.Address); package Clear_Tex_Sub_Image is new Loader.Procedure_With_11_Params ("glClearTexSubImage", UInt, Objects.Textures.Mipmap_Level, Int, Int, Int, Size, Size, Size, Pixels.Format, Pixels.Data_Type, System.Address); package Generate_Texture_Mipmap is new Loader.Procedure_With_1_Param ("glGenerateTextureMipmap", UInt); -- glGetTextureSubImage uses an access value of Interfaces.C.Pointers.Element_Array, -- therefore declared in GL.Objects.Textures package Get_Compressed_Texture_Sub_Image is new Loader.Procedure_With_10_Params ("glGetCompressedTextureSubImage", UInt, Objects.Textures.Mipmap_Level, Int, Int, Int, Size, Size, Size, Size, Types.Pointers.UByte_Array_Access); package Invalidate_Tex_Image is new Loader.Procedure_With_2_Params ("glInvalidateTexImage", UInt, Objects.Textures.Mipmap_Level); package Invalidate_Tex_Sub_Image is new Loader.Procedure_With_8_Params ("glInvalidateTexSubImage", UInt, Objects.Textures.Mipmap_Level, Int, Int, Int, Size, Size, Size); package Create_Textures is new Loader.Getter_With_3_Params ("glCreateTextures", Low_Level.Enums.Texture_Kind, Size, UInt); package Gen_Textures is new Loader.Getter_With_2_Params ("glGenTextures", Size, UInt); -- Only to be used by Texture_View package Texture_View_I is new Loader.Procedure_With_8_Params ("glTextureView", UInt, Low_Level.Enums.Texture_Kind, UInt, Pixels.Internal_Format, UInt, UInt, UInt, UInt); package Texture_View_C is new Loader.Procedure_With_8_Params ("glTextureView", UInt, Low_Level.Enums.Texture_Kind, UInt, Pixels.Compressed_Format, UInt, UInt, UInt, UInt); package Bind_Textures is new Loader.Procedure_With_3_Params ("glBindTextures", Objects.Textures.Texture_Unit, Size, Low_Level.UInt_Array); package Get_Internal_Format_A is new Loader.Getter_With_5_Params ("glGetInternalformativ", Low_Level.Enums.Texture_Kind, Pixels.Internal_Format, Enums.Internalformat.Parameter, Size, Size_Array); package Get_Internal_Format is new Loader.Getter_With_5_Params ("glGetInternalformativ", Low_Level.Enums.Texture_Kind, Pixels.Internal_Format, Enums.Internalformat.Parameter, Size, Size); package Get_Internal_Format_Long is new Loader.Getter_With_5_Params ("glGetInternalformati64v", Low_Level.Enums.Texture_Kind, Pixels.Internal_Format, Enums.Internalformat.Parameter, Size, Long_Size); package Get_Internal_Format_C is new Loader.Getter_With_5_Params ("glGetInternalformativ", Low_Level.Enums.Texture_Kind, Pixels.Compressed_Format, Enums.Internalformat.Parameter, Size, Size); package Get_Internal_Format_Support is new Loader.Getter_With_5_Params ("glGetInternalformativ", Low_Level.Enums.Texture_Kind, Pixels.Internal_Format, Enums.Internalformat.Parameter, Size, Pixels.Queries.Support); ----------------------------------------------------------------------------- -- Images -- ----------------------------------------------------------------------------- package Bind_Image_Textures is new Loader.Procedure_With_3_Params ("glBindImageTextures", Objects.Textures.Image_Unit, Size, Low_Level.UInt_Array); ----------------------------------------------------------------------------- -- Buffer objects -- ----------------------------------------------------------------------------- package Create_Buffers is new Loader.Getter_With_2_Params ("glCreateBuffers", Size, UInt); package Delete_Buffers is new Loader.Array_Proc_With_2_Params ("glDeleteBuffers", Size, UInt, Low_Level.UInt_Array); package Bind_Buffer is new Loader.Procedure_With_2_Params ("glBindBuffer", Enums.Buffer_Kind, UInt); package Bind_Buffer_Base is new Loader.Procedure_With_3_Params ("glBindBufferBase", Enums.Buffer_Kind, UInt, UInt); package Bind_Buffer_Range is new Loader.Procedure_With_5_Params ("glBindBufferRange", Enums.Buffer_Kind, UInt, UInt, Low_Level.IntPtr, Low_Level.SizeIPtr); package Named_Buffer_Sub_Data is new Loader.Procedure_With_4_Params ("glNamedBufferSubData", UInt, Low_Level.IntPtr, Low_Level.SizeIPtr, System.Address); package Named_Buffer_Storage is new Loader.Procedure_With_4_Params ("glNamedBufferStorage", UInt, Low_Level.SizeIPtr, System.Address, Low_Level.Bitfield); -- glMapNamedBufferRange returns an instance of generic Interfaces.C.Pointers.Pointer, -- therefore declared in GL.Objects.Buffers package Unmap_Named_Buffer is new Loader.Procedure_With_1_Param ("glUnmapNamedBuffer", UInt); package Invalidate_Buffer_Data is new Loader.Procedure_With_1_Param ("glInvalidateBufferData", UInt); package Invalidate_Buffer_Sub_Data is new Loader.Procedure_With_3_Params ("glInvalidateBufferSubData", UInt, Low_Level.IntPtr, Low_Level.SizeIPtr); package Flush_Mapped_Named_Buffer_Range is new Loader.Procedure_With_3_Params ("glFlushMappedNamedBufferRange", UInt, Low_Level.IntPtr, Low_Level.SizeIPtr); package Clear_Named_Buffer_Sub_Data is new Loader.Procedure_With_7_Params ("glClearNamedBufferSubData", UInt, Pixels.Internal_Format_Buffer_Texture, Low_Level.IntPtr, Low_Level.SizeIPtr, Pixels.Format, Pixels.Data_Type, System.Address); package Copy_Named_Buffer_Sub_Data is new Loader.Procedure_With_5_Params ("glCopyNamedBufferSubData", UInt, UInt, Low_Level.IntPtr, Low_Level.IntPtr, Low_Level.SizeIPtr); ----------------------------------------------------------------------------- -- Vertex Array Objects -- ----------------------------------------------------------------------------- package Create_Vertex_Arrays is new Loader.Getter_With_2_Params ("glCreateVertexArrays", Size, UInt); package Delete_Vertex_Arrays is new Loader.Array_Proc_With_2_Params ("glDeleteVertexArrays", Size, UInt, Low_Level.UInt_Array); package Bind_Vertex_Array is new Loader.Procedure_With_1_Param ("glBindVertexArray", UInt); ----------------------------------------------------------------------------- -- Framebuffer objects and handling -- ----------------------------------------------------------------------------- package Logic_Op is new Loader.Procedure_With_1_Param ("glLogicOp", Blending.Logic_Op); package Create_Framebuffers is new Loader.Getter_With_2_Params ("glCreateFramebuffers", Size, UInt); package Delete_Framebuffers is new Loader.Array_Proc_With_2_Params ("glDeleteFramebuffers", Size, UInt, Low_Level.UInt_Array); package Bind_Framebuffer is new Loader.Procedure_With_2_Params ("glBindFramebuffer", Enums.Framebuffer_Kind, UInt); package Named_Framebuffer_Draw_Buffers is new Loader.Procedure_With_3_Params ("glNamedFramebufferDrawBuffers", UInt, Size, Buffers.Color_Buffer_List); package Named_Framebuffer_Read_Buffer is new Loader.Procedure_With_2_Params ("glNamedFramebufferReadBuffer", UInt, Buffers.Color_Buffer_Selector); package Check_Named_Framebuffer_Status is new Loader.Function_With_2_Params ("glCheckNamedFramebufferStatus", UInt, Enums.Framebuffer_Kind, Objects.Framebuffers.Framebuffer_Status); package Named_Framebuffer_Texture is new Loader.Procedure_With_4_Params ("glNamedFramebufferTexture", UInt, Objects.Framebuffers.Attachment_Point, UInt, Objects.Textures.Mipmap_Level); package Named_Framebuffer_Texture_Layer is new Loader.Procedure_With_5_Params ("glNamedFramebufferTextureLayer", UInt, Objects.Framebuffers.Attachment_Point, UInt, Objects.Textures.Mipmap_Level, Int); package Blit_Named_Framebuffer is new Loader.Procedure_With_12_Params ("glBlitNamedFramebuffer", UInt, UInt, Int, Int, Int, Int, Int, Int, Int, Int, Low_Level.Bitfield, Objects.Textures.Magnifying_Function); package Invalidate_Named_Framebuffer_Data is new Loader.Array_Proc_With_3_Params ("glInvalidateNamedFramebufferData", UInt, Size, Objects.Framebuffers.Attachment_Point, Objects.Framebuffers.Attachment_List); package Invalidate_Named_Framebuffer_Data_Default is new Loader.Array_Proc_With_3_Params ("glInvalidateNamedFramebufferData", UInt, Size, Objects.Framebuffers.Default_Attachment_Point, Objects.Framebuffers.Default_Attachment_List); package Invalidate_Named_Framebuffer_Sub_Data is new Loader.Procedure_With_7_Params ("glInvalidateNamedFramebufferSubData", UInt, Size, Objects.Framebuffers.Attachment_List, Int, Int, Size, Size); package Invalidate_Named_Framebuffer_Sub_Data_Default is new Loader.Procedure_With_7_Params ("glInvalidateNamedFramebufferSubData", UInt, Size, Objects.Framebuffers.Default_Attachment_List, Int, Int, Size, Size); package Named_Framebuffer_Parameter_Size is new Loader.Procedure_With_3_Params ("glNamedFramebufferParameteri", UInt, Enums.Framebuffer_Param, Size); package Named_Framebuffer_Parameter_Bool is new Loader.Procedure_With_3_Params ("glNamedFramebufferParameteri", UInt, Enums.Framebuffer_Param, Low_Level.Bool); package Get_Named_Framebuffer_Parameter_Size is new Loader.Getter_With_3_Params ("glGetNamedFramebufferParameteriv", UInt, Enums.Framebuffer_Param, Size); package Get_Named_Framebuffer_Parameter_Bool is new Loader.Getter_With_3_Params ("glGetNamedFramebufferParameteriv", UInt, Enums.Framebuffer_Param, Low_Level.Bool); package Clear_Named_Framebuffer_Color_Real is new Loader.Procedure_With_4_Params ("glClearNamedFramebufferfv", UInt, Enums.Only_Color_Buffer, Buffers.Draw_Buffer_Index, Colors.Color); package Clear_Named_Framebuffer_Color_Signed_Int is new Loader.Procedure_With_4_Params ("glClearNamedFramebufferiv", UInt, Enums.Only_Color_Buffer, Buffers.Draw_Buffer_Index, Colors.Color); package Clear_Named_Framebuffer_Color_Unsigned_Int is new Loader.Procedure_With_4_Params ("glClearNamedFramebufferuiv", UInt, Enums.Only_Color_Buffer, Buffers.Draw_Buffer_Index, Colors.Color); package Clear_Named_Framebuffer_Depth is new Loader.Getter_With_4_Params ("glClearNamedFramebufferfv", UInt, Enums.Only_Depth_Buffer, Zero, Buffers.Depth); package Clear_Named_Framebuffer_Stencil is new Loader.Getter_With_4_Params ("glClearNamedFramebufferiv", UInt, Enums.Only_Stencil_Buffer, Zero, Buffers.Stencil_Index); package Clear_Named_Framebuffer_Depth_Stencil is new Loader.Procedure_With_5_Params ("glClearNamedFramebufferfi", UInt, Enums.Only_Depth_Stencil_Buffer, Zero, Buffers.Depth, Buffers.Stencil_Index); ----------------------------------------------------------------------------- -- Shaders -- ----------------------------------------------------------------------------- package Get_Shader_Param is new Loader.Getter_With_3_Params ("glGetShaderiv", UInt, Enums.Shader_Param, Int); package Create_Shader is new Loader.Function_With_1_Param ("glCreateShader", Objects.Shaders.Shader_Type, UInt); package Delete_Shader is new Loader.Procedure_With_1_Param ("glDeleteShader", UInt); package Shader_Source is new Loader.Procedure_With_4_Params ("glShaderSource", UInt, Size, Low_Level.CharPtr_Array, Low_Level.Int_Array); package Get_Shader_Source is new Loader.String_Getter_With_4_Params ("glGetShaderSource", Size, UInt); package Compile_Shader is new Loader.Procedure_With_1_Param ("glCompileShader", UInt); package Get_Shader_Info_Log is new Loader.String_Getter_With_4_Params ("glGetShaderInfoLog", Size, UInt); package Create_Program is new Loader.Function_Without_Params ("glCreateProgram", UInt); package Delete_Program is new Loader.Procedure_With_1_Param ("glDeleteProgram", UInt); package Get_Program_Param is new Loader.Getter_With_3_Params ("glGetProgramiv", UInt, Enums.Program_Param, Int); package Get_Program_Param_Compute is new Loader.Getter_With_3_Params ("glGetProgramiv", UInt, Enums.Program_Param, Compute.Dimension_Size_Array); package Program_Parameter_Bool is new Loader.Procedure_With_3_Params ("glProgramParameteri", UInt, Enums.Program_Set_Param, Low_Level.Bool); package Attach_Shader is new Loader.Procedure_With_2_Params ("glAttachShader", UInt, UInt); package Detach_Shader is new Loader.Procedure_With_2_Params ("glDetachShader", UInt, UInt); package Link_Program is new Loader.Procedure_With_1_Param ("glLinkProgram", UInt); package Get_Program_Info_Log is new Loader.String_Getter_With_4_Params ("glGetProgramInfoLog", Size, UInt); package Use_Program is new Loader.Procedure_With_1_Param ("glUseProgram", UInt); package Validate_Program is new Loader.Procedure_With_1_Param ("glValidateProgram", UInt); package Get_Uniform_Location is new Loader.Function_With_2_Params ("glGetUniformLocation", UInt, C.char_array, Int); ----------------------------------------------------------------------------- -- Compute -- ----------------------------------------------------------------------------- package Dispatch_Compute is new Loader.Procedure_With_3_Params ("glDispatchCompute", UInt, UInt, UInt); package Dispatch_Compute_Indirect is new Loader.Procedure_With_1_Param ("glDispatchComputeIndirect", Low_Level.IntPtr); ----------------------------------------------------------------------------- -- Program interfaces and resources -- ----------------------------------------------------------------------------- package Get_Program_Resource_Index is new Loader.Function_With_3_Params ("glGetProgramResourceIndex", UInt, Enums.Program_Interface, C.char_array, UInt); package Get_Program_Resource is new Loader.Array_Getter_With_8_Params ("glGetProgramResourceiv", UInt, Enums.Program_Interface, UInt, Size, Enums.Program_Resource_Array, Int, Int_Array); ----------------------------------------------------------------------------- -- Pipelines -- ----------------------------------------------------------------------------- package Use_Program_Stages is new Loader.Procedure_With_3_Params ("glUseProgramStages", UInt, Low_Level.Bitfield, UInt); package Create_Program_Pipelines is new Loader.Getter_With_2_Params ("glCreateProgramPipelines", Size, UInt); package Delete_Program_Pipelines is new Loader.Array_Proc_With_2_Params ("glDeleteProgramPipelines", Size, UInt, Low_Level.UInt_Array); package Bind_Program_Pipeline is new Loader.Procedure_With_1_Param ("glBindProgramPipeline", UInt); package Get_Program_Pipeline_Param is new Loader.Getter_With_3_Params ("glGetProgramPipelineiv", UInt, Enums.Program_Pipeline_Param, Int); package Get_Program_Pipeline_Info_Log is new Loader.String_Getter_With_4_Params ("glGetProgramPipelineInfoLog", Size, UInt); package Validate_Program_Pipeline is new Loader.Procedure_With_1_Param ("glValidateProgramPipeline", UInt); package Create_Shader_Program is new Loader.Function_With_3_Params ("glCreateShaderProgramv", Objects.Shaders.Shader_Type, Size, Low_Level.CharPtr_Array, UInt); ----------------------------------------------------------------------------- -- Queries -- ----------------------------------------------------------------------------- package Create_Queries is new Loader.Getter_With_3_Params ("glCreateQueries", Objects.Queries.Query_Type, Size, UInt); package Delete_Queries is new Loader.Array_Proc_With_2_Params ("glDeleteQueries", Size, UInt, Low_Level.UInt_Array); package Begin_Query_Indexed is new Loader.Procedure_With_3_Params ("glBeginQueryIndexed", Objects.Queries.Async_Query_Type, UInt, UInt); package End_Query_Indexed is new Loader.Procedure_With_2_Params ("glEndQueryIndexed", Objects.Queries.Async_Query_Type, UInt); package Query_Counter is new Loader.Procedure_With_2_Params ("glQueryCounter", UInt, Objects.Queries.Timestamp_Query_Type); package Get_Query_Object_UInt is new Loader.Getter_With_3_Params ("glGetQueryObjectuiv", UInt, Objects.Queries.Query_Param, UInt); package Get_Query_Object_UInt64 is new Loader.Getter_With_3_Params ("glGetQueryObjectui64v", UInt, Objects.Queries.Query_Param, UInt64); ----------------------------------------------------------------------------- -- Samplers -- ----------------------------------------------------------------------------- package Create_Samplers is new Loader.Getter_With_2_Params ("glCreateSamplers", Size, UInt); package Delete_Samplers is new Loader.Array_Proc_With_2_Params ("glDeleteSamplers", Size, UInt, Low_Level.UInt_Array); package Bind_Sampler is new Loader.Procedure_With_2_Params ("glBindSampler", UInt, UInt); package Bind_Samplers is new Loader.Array_Proc_With_3_Params ("glBindSamplers", UInt, Size, UInt, Low_Level.UInt_Array); package Sampler_Parameter_Bool is new Loader.Procedure_With_3_Params ("glSamplerParameteri", UInt, Enums.Textures.Parameter, Low_Level.Bool); package Sampler_Parameter_Float is new Loader.Procedure_With_3_Params ("glSamplerParameterf", UInt, Enums.Textures.Parameter, Single); package Sampler_Parameter_Floats is new Loader.Procedure_With_3_Params ("glSamplerParameterfv", UInt, Enums.Textures.Parameter, Low_Level.Single_Array); package Sampler_Parameter_Minifying_Function is new Loader.Procedure_With_3_Params ("glSamplerParameteri", UInt, Enums.Textures.Parameter, Objects.Textures.Minifying_Function); package Sampler_Parameter_Magnifying_Function is new Loader.Procedure_With_3_Params ("glSamplerParameteri", UInt, Enums.Textures.Parameter, Objects.Textures.Magnifying_Function); package Sampler_Parameter_Wrapping_Mode is new Loader.Procedure_With_3_Params ("glSamplerParameteri", UInt, Enums.Textures.Parameter, Objects.Textures.Wrapping_Mode); package Sampler_Parameter_Compare_Kind is new Loader.Procedure_With_3_Params ("glSamplerParameteri", UInt, Enums.Textures.Parameter, Enums.Textures.Compare_Kind); package Sampler_Parameter_Compare_Function is new Loader.Procedure_With_3_Params ("glSamplerParameteri", UInt, Enums.Textures.Parameter, Compare_Function); package Get_Sampler_Parameter_Bool is new Loader.Getter_With_3_Params ("glGetSamplerParameteriv", UInt, Enums.Textures.Parameter, Low_Level.Bool); package Get_Sampler_Parameter_Floats is new Loader.Getter_With_3_Params ("glGetSamplerParameterfv", UInt, Enums.Textures.Parameter, Low_Level.Single_Array); package Get_Sampler_Parameter_Minifying_Function is new Loader.Getter_With_3_Params ("glGetSamplerParameteriv", UInt, Enums.Textures.Parameter, Objects.Textures.Minifying_Function); package Get_Sampler_Parameter_Magnifying_Function is new Loader.Getter_With_3_Params ("glGetSamplerParameteriv", UInt, Enums.Textures.Parameter, Objects.Textures.Magnifying_Function); package Get_Sampler_Parameter_Wrapping_Mode is new Loader.Getter_With_3_Params ("glGetSamplerParameteriv", UInt, Enums.Textures.Parameter, Objects.Textures.Wrapping_Mode); package Get_Sampler_Parameter_Compare_Kind is new Loader.Getter_With_3_Params ("glGetSamplerParameteriv", UInt, Enums.Textures.Parameter, Enums.Textures.Compare_Kind); package Get_Sampler_Parameter_Compare_Function is new Loader.Getter_With_3_Params ("glGetSamplerParameteriv", UInt, Enums.Textures.Parameter, Compare_Function); ----------------------------------------------------------------------------- -- Barriers -- ----------------------------------------------------------------------------- package Texture_Barrier is new Loader.Procedure_Without_Params ("glTextureBarrier"); package Memory_Barrier is new Loader.Procedure_With_1_Param ("glMemoryBarrier", Low_Level.Bitfield); package Memory_Barrier_By_Region is new Loader.Procedure_With_1_Param ("glMemoryBarrierByRegion", Low_Level.Bitfield); ----------------------------------------------------------------------------- -- Debug -- ----------------------------------------------------------------------------- package Debug_Message_Control is new Loader.Procedure_With_6_Params ("glDebugMessageControl", Debug.Source, Debug.Message_Type, Debug.Severity, Size, UInt_Array, Low_Level.Bool); package Debug_Message_Control_Any_Level is new Loader.Procedure_With_6_Params ("glDebugMessageControl", Debug.Source, Debug.Message_Type, Low_Level.Enum, Size, UInt_Array, Low_Level.Bool); package Debug_Message_Control_Level is new Loader.Procedure_With_6_Params ("glDebugMessageControl", Low_Level.Enum, Low_Level.Enum, Debug.Severity, Size, UInt_Array, Low_Level.Bool); package Debug_Message_Insert is new Loader.Procedure_With_6_Params ("glDebugMessageInsert", Debug.Source, Debug.Message_Type, UInt, Debug.Severity, Size, C.char_array); package Debug_Message_Callback is new Loader.Procedure_With_2_Params ("glDebugMessageCallback", System.Address, System.Address); package Get_Debug_Message_Log is new Loader.Function_With_8_Params ("glGetDebugMessageLog", UInt, Size, Debug_Types.Source_Array_Access, Debug_Types.Type_Array_Access, Debug_Types.UInt_Array_Access, Debug_Types.Severity_Array_Access, Debug_Types.Size_Array_Access, Debug_Types.String_Access, UInt); package Push_Debug_Group is new Loader.Procedure_With_4_Params ("glPushDebugGroup", Debug.Source, UInt, Size, C.char_array); package Pop_Debug_Group is new Loader.Procedure_Without_Params ("glPopDebugGroup"); package Object_Label is new Loader.Procedure_With_4_Params ("glObjectLabel", Types.Debug.Identifier, UInt, Size, C.char_array); package Get_Object_Label is new Loader.String_Getter_With_5_Params ("glGetObjectLabel", Size, Types.Debug.Identifier, UInt); package Get_Object_Label_Length is new Loader.Procedure_With_5_Params ("glGetObjectLabel", Types.Debug.Identifier, UInt, Size, Low_Level.Size_Access, C.Strings.chars_ptr); package Object_Pointer_Label is new Loader.Procedure_With_3_Params ("glObjectPtrLabel", System.Address, Size, C.char_array); -- TODO Use for Sync objects package Get_Object_Pointer_Label is new Loader.String_Getter_With_4_Params ("glGetObjectPtrLabel", Size, System.Address); -- TODO Use for Sync objects ----------------------------------------------------------------------------- -- Syncing -- ----------------------------------------------------------------------------- package Fence_Sync is new Loader.Function_With_2_Params ("glFenceSync", Low_Level.Enum, Low_Level.Bitfield, Low_Level.Sync); package Delete_Sync is new Loader.Procedure_With_1_Param ("glDeleteSync", Low_Level.Sync); package Get_Sync is new Loader.Array_Getter_With_5_Params ("glGetSynciv", Low_Level.Sync, Low_Level.Enum, Int, Int_Array); package Client_Wait_Sync is new Loader.Function_With_3_Params ("glClientWaitSync", Low_Level.Sync, Low_Level.Bitfield, UInt64, Fences.Wait_Status); package Wait_Sync is new Loader.Procedure_With_3_Params ("glWaitSync", Low_Level.Sync, Low_Level.Bitfield, UInt64); ----------------------------------------------------------------------------- -- Transformation to window coordinates -- ----------------------------------------------------------------------------- package Depth_Range_Array is new Loader.Procedure_With_3_Params ("glDepthRangeArrayv", UInt, Size, Viewports.Depth_Range_List); package Viewport_Array is new Loader.Procedure_With_3_Params ("glViewportArrayv", UInt, Size, Viewports.Viewport_List); package Scissor_Array is new Loader.Procedure_With_3_Params ("glScissorArrayv", UInt, Size, Viewports.Scissor_Rectangle_List); end GL.API;
-- Reporter bindings for Ada 95 -- Reporter module by Chris Morison & Martin Avison -- Ada 95 bindings by Stefan Bellon with RASCAL.Utility; use RASCAL.Utility; with RASCAL.OS; use RASCAL.OS; with Kernel; use Kernel; with Interfaces.C; use Interfaces.C; with System; with System.Storage_Elements; package body Reporter is Report_Clear : constant Interfaces.C.Unsigned := 16#54C8B#; Report_Close : constant Interfaces.C.Unsigned := 16#54C8D#; Report_On : constant Interfaces.C.Unsigned := 16#54C8E#; Report_Off : constant Interfaces.C.Unsigned := 16#54C8F#; Report_Quit : constant Interfaces.C.Unsigned := 16#54C8A#; Report_Where : constant Interfaces.C.Unsigned := 16#54C84#; Report_Text0 : constant Interfaces.C.Unsigned := 16#54C80#; Report_TextS : constant Interfaces.C.Unsigned := 16#54C81#; Report_Poll : constant Interfaces.C.Unsigned := 16#54C85#; Report_Registers : constant Interfaces.C.Unsigned := 16#54C83#; Report_Dump : constant Interfaces.C.Unsigned := 16#54C86#; Error : oserror_access; Regs : aliased Kernel.SWI_Regs; -- function Address_To_C_Int (Addr : in System.Address) return Interfaces.C.Int is begin return Interfaces.C.Int (System.Storage_Elements.To_Integer (Addr)); end Address_To_C_Int; -- procedure Report (Text : in String) is begin Call_OS_CLI ("Report " & Text); end Report; -- procedure Clear (Text : in String := "") is begin Call_OS_CLI ("ReportClear " & Text); end Clear; -- procedure On (Text : in String := "") is begin Call_OS_CLI ("ReportOn " & Text); end On; -- procedure Off (Text : in String := "") is begin Call_OS_CLI ("ReportOff " & Text); end Off; -- procedure Close is begin Error := Kernel.SWI (Report_Close, Regs'Access, Regs'Access); if Error /= null then pragma Debug(Reporter.Report("Reporter.Close: " & To_Ada(Error.ErrMess))); Raise_Error(Error); end if; end Close; -- procedure Quit is begin Error := Kernel.SWI (Report_Quit, Regs'Access, Regs'Access); if Error /= null then pragma Debug(Reporter.Report("Reporter.Quit: " & To_Ada(Error.ErrMess))); Raise_Error(Error); end if; end Quit; -- procedure Where is begin Error := Kernel.SWI (Report_Where, Regs'Access, Regs'Access); if Error /= null then pragma Debug(Reporter.Report("Reporter.Where: " & To_Ada(Error.ErrMess))); Raise_Error(Error); end if; end Where; -- procedure Text (Text : in String := "") is Local_String : String := Text & ASCII.NUL; begin Regs.R(0) := Address_To_C_Int (Local_String'Address); Error := Kernel.SWI (Report_Text0, Regs'Access, Regs'Access); if Error /= null then pragma Debug(Reporter.Report("Reporter.Text: " & To_Ada(Error.ErrMess))); Raise_Error(Error); end if; end Text; -- procedure Poll (Reason : in Natural := 0) is begin Regs.R(0) := Interfaces.C.int (Reason); Error := Kernel.SWI (Report_Poll, Regs'Access, Regs'Access); if Error /= null then pragma Debug(Reporter.Report("Reporter.Poll: " & To_Ada(Error.ErrMess))); Raise_Error(Error); end if; end Poll; -- procedure Registers (Text : in String := "") is Local_String : String := Text & ASCII.NUL; begin Regs.R(0) := Address_To_C_Int (Local_String'Address); Regs.R(1) := 0; Regs.R(2) := 0; Error := Kernel.SWI (Report_Registers, Regs'Access, Regs'Access); if Error /= null then pragma Debug(Reporter.Report("Reporter.Registers: " & To_Ada(Error.ErrMess))); Raise_Error(Error); end if; end Registers; -- procedure Dump (Start : in System.Address; Length: in Natural; Width : in Positive) is begin Regs.R(0) := Address_To_C_Int (Start); Regs.R(1) := Int(Length); Regs.R(2) := Int(Width); Error := Kernel.SWI (Report_Dump, Regs'Access, Regs'Access); if Error /= null then pragma Debug(Reporter.Report("Reporter.Dump: " & To_Ada(Error.ErrMess))); Raise_Error(Error); end if; end Dump; -- procedure Save (Text : in String := "") is begin Call_OS_CLI ("ReportSave " & Text); end Save; end Reporter;
with aIDE.Editor.of_subprogram, aIDE.Editor.of_block, aIDE.Editor.of_package, aIDE.Editor.of_pragma, aIDE.Palette.of_source_Entities, aIDE.Palette.of_pragmas, aIDE.Palette.of_exceptions, aIDE.Palette.of_types, adaM.a_Pragma, Common_Gtk, Glib, Glib.Error, Gtk.Main, Gtk.Builder, Gtk.Text_View, Gtk.Tree_View, Gtk.Tree_Model, Gtk.Widget, Gtk.Window, Gtk.Alignment, Gtk.Notebook, Gtk.Tree_Store, Gtk.Tree_Selection, Gtk.Text_Iter, Gtk.Handlers, Pango.Font, ada.Characters.latin_1, ada.Text_IO; with Ada.Text_IO; with Ada.Tags; package body aIDE.GUI is use Glib, Glib.Error, gtk.Button, gtk.Builder, gtk.Text_View, gtk.Tree_View, gtk.Window, gtk.Alignment, gtk.Notebook, gtk.Tree_Store, Pango.Font; -- Editors -- the_app_Editor : aIDE.Editor.of_subprogram.view; the_package_Editor : aIDE.Editor.of_Package.view; -- Palettes -- the_source_entities_Palette : aIDE.Palette.of_source_entities.view; the_pragma_Palette : aIDE.Palette.of_pragmas.view; the_exceptions_Palette : aIDE.Palette.of_exceptions.view; the_types_Palette : aIDE.Palette.of_types.view; -- Main Widgets -- top_Window : Gtk_Window; the_top_Notebook : Gtk_Notebook; -- 'App' Notebook Page Widgets -- new_app_Button : Gtk_Button; rid_app_Button : Gtk_Button; the_app_tree_Store : gtk_tree_Store; the_app_tree_View : gtk_tree_View; the_app_tree_Selection : Gtk.Tree_Selection.gtk_Tree_Selection; the_app_Alignment : Gtk_Alignment; -- Builder Widgets -- build_project_Button : Gtk_Button; the_build_log_Textview : Gtk_Text_View; -- Package Tab Widgets -- choose_package_Button : Gtk_Button; new_package_Button : Gtk_Button; rid_package_Button : Gtk_Button; the_package_tree_Store : gtk_tree_Store; the_package_tree_View : gtk_tree_View; the_package_tree_Selection : Gtk.Tree_Selection.gtk_Tree_Selection; the_package_Alignment : Gtk_Alignment; -- Gui Callbacks -- package tree_selection_Handlers is new Gtk.Handlers.Callback (Widget_Type => Gtk.Tree_Selection.Gtk_Tree_Selection_Record); -- Gui Events -- procedure on_build_project_Button_clicked (Button : access Gtk_Button_Record'Class) is pragma Unreferenced (Button); begin aIDE.build_Project; end on_build_project_Button_clicked; procedure destroy (Widget : access gtk.Widget.Gtk_Widget_Record'Class) is pragma Unreferenced (Widget); begin Gtk.Main.Main_Quit; end Destroy; procedure on_new_app_Button_clicked (Button : access Gtk_Button_Record'Class) is pragma Unreferenced (Button); the_new_App : constant adam.Subprogram.view := adam.Subprogram.new_Subprogram (Name => anonymous_Procedure); begin all_Apps.append (the_new_App); the_app_Editor.Target_is (the_new_App); declare use AdaM, Gtk, Gtk.Tree_Model; Iter : gtk_tree_Iter; Parent : constant gtk_tree_Iter := Null_Iter; begin the_app_tree_Store.append (Iter, Parent); the_app_tree_Store.set (Iter, 0, +the_new_App.Name); the_app_tree_Selection.select_Iter (Iter); end; end on_new_app_Button_clicked; procedure on_rid_app_Button_clicked (Button : access Gtk_Button_Record'Class) is pragma Unreferenced (Button); use Gtk, Gtk.Tree_Model; use type adam.Subprogram.view; the_App : constant adam.Subprogram.view := the_app_Editor.Target; Iter : gtk_tree_Iter; the_Model : Gtk_Tree_Model; begin if the_App = the_selected_App then return; end if; the_app_tree_Selection.get_Selected (the_Model, Iter); the_app_tree_Store.remove (Iter); the_app_tree_Selection.select_Iter (the_app_tree_Store.get_Iter_first); all_Apps.delete (all_Apps.find_Index (the_App)); end on_rid_app_Button_clicked; procedure on_app_Selection_changed (Selection : access Gtk.Tree_Selection.Gtk_Tree_Selection_Record'Class) is use AdaM, gtk.Tree_Model, ada.Text_IO; Iter : Gtk_Tree_Iter; the_model : Gtk_Tree_Model; begin Selection.Get_Selected (the_model, Iter); if Iter /= null_Iter then declare app_Name : constant String := gtk.Tree_Model.Get_String (the_model, Iter, 0); begin the_app_Editor.Target_is (fetch_App (+app_Name)); end; end if; end on_app_Selection_changed; procedure on_choose_package_Button_clicked (Button : access Gtk_Button_Record'Class) is pragma Unreferenced (Button); begin Ada.Text_IO.put_Line ("YAY"); show_packages_Palette (Invoked_by => Button.all'Access, Target => the_applet_Package); end on_choose_package_Button_clicked; procedure open is use Common_Gtk, ada.Text_IO; glade_Builder : Gtk_Builder; Result : Guint; pragma Unreferenced (Result); begin -- put_Line ("************************************************"); -- put_Line ("'" & Duration'Image (Duration'Delta) & "'"); Gtk.Main.Init; Gtk_New (glade_Builder); -- Read in our Glade XML files. -- declare use ada.Text_IO; Error : aliased GError; begin Result := glade_Builder.Add_From_File ("glade/adam.glade", Error'Access); if Error /= null then put_Line ( "Error adding 'adam.glade' to Glade builder: " & Get_Message (Error)); Error_Free (Error); end if; end; -- Set our references to each important widget. -- top_Window := Gtk_Window (glade_Builder.Get_Object ("top_Window")); the_top_Notebook := Gtk_Notebook (glade_Builder.Get_Object ("top_Notebook")); the_app_Alignment := gtk_Alignment (glade_Builder.Get_Object ("app_editor_Alignment")); new_app_Button := gtk_Button (glade_Builder.Get_Object ("new_app_Button")); rid_app_Button := gtk_Button (glade_Builder.Get_Object ("rid_app_Button")); the_app_tree_Store := gtk_tree_Store (glade_Builder.Get_Object ("app_tree_Store")); the_app_tree_View := gtk_tree_View (glade_Builder.Get_Object ("app_tree_View")); the_app_tree_Selection := the_app_tree_View.Get_Selection; build_project_Button := gtk_Button (glade_Builder.Get_Object ("build_project_Button")); the_build_log_Textview := gtk_Text_view (glade_Builder.Get_Object ("builder_log_Textview")); top_Window.Modify_Font (Font_Desc => From_String ("Courier 10")); -- Hide unused pages in the top notebook. -- the_top_Notebook.get_Nth_Page (0).hide; -- the_top_Notebook.get_Nth_Page (2).hide; the_top_Notebook.get_Nth_Page (3).hide; the_top_Notebook.get_Nth_Page (4).hide; log ("Welcome... "); Widget_Handler.connect (top_Window, "destroy", Widget_Handler.To_Marshaller (Destroy'Access)); Button_Handler.connect (build_project_Button, "clicked", on_build_project_Button_clicked'Access); Button_Handler.Connect (new_app_Button, "clicked", on_new_app_Button_clicked'Access); Button_Handler.Connect (rid_app_Button, "clicked", on_rid_app_Button_clicked'Access); the_app_Editor := aIDE.Editor.of_subprogram.Forge.to_subprogram_Editor (the_selected_App); the_app_Editor.top_Widget.Reparent (New_Parent => the_app_Alignment); for Each of all_Apps loop declare use AdaM, Gtk.Tree_Model; use type AdaM.Subprogram.view; Iter : gtk_tree_Iter; Parent : constant gtk_tree_Iter := Null_Iter; begin the_app_tree_Store.append (Iter, Parent); the_app_tree_Store.set (Iter, 0, +Each.Name); if Each = all_Apps.first_Element then the_app_tree_Selection.Select_Iter (Iter); end if; end; end loop; the_app_tree_View.show_All; tree_selection_Handlers.connect (the_app_tree_Selection, "changed", on_app_Selection_changed'Access); top_Window.show; -- Display our main window and all of its children. enable_bold_Tabs_for (the_top_Notebook); -- The Package Editor -- the_package_Alignment := Gtk_Alignment (glade_Builder.Get_Object ("package_editor_Alignment")); choose_package_Button := Gtk_Button (glade_Builder.Get_Object ("choose_package_Button")); new_package_Button := Gtk_Button (glade_Builder.Get_Object ("new_package_Button")); rid_package_Button := Gtk_Button (glade_Builder.Get_Object ("rid_package_Button")); the_package_tree_Store := gtk_tree_Store (glade_Builder.Get_Object ("package_tree_Store")); the_package_tree_View := gtk_tree_View (glade_Builder.Get_Object ("package_tree_View")); the_package_tree_Selection := the_package_tree_View.Get_Selection; Button_Handler.connect (choose_package_Button, "clicked", on_choose_package_Button_clicked'Access); -- The Palettes -- the_packages_Palette := aIDE.Palette.of_packages.to_packages_Palette; the_source_entities_Palette := aIDE.Palette.of_source_entities.to_source_entities_Palette; the_pragma_Palette := aIDE.Palette.of_pragmas.to_source_entities_Palette; the_exceptions_Palette := aIDE.Palette.of_exceptions.to_exceptions_Palette; the_types_Palette := aIDE.Palette.of_types.to_Palette; the_package_Editor := aIDE.Editor.of_package.Forge.to_package_Editor (the_applet_Package); the_package_Editor.top_Widget.Reparent (New_Parent => the_package_Alignment); gtk.Main.main; -- Enter main GtkAda event loop. end open; -- Palettes -- procedure show_packages_Palette (Invoked_by : in Gtk.Button.gtk_Button; Target : in AdaM.context_Line.view) is begin the_packages_Palette.show (Invoked_by, Target); end show_packages_Palette; procedure show_packages_Palette (Invoked_by : in Gtk.Button.gtk_Button; Target : in AdaM.a_Package.view) is begin the_packages_Palette.show (Invoked_by, Target); end show_packages_Palette; procedure show_types_Palette (Invoked_by : in Gtk.Button.gtk_Button; Target : access AdaM.a_Type.view) is begin the_types_Palette.show (Invoked_by, Target); end show_types_Palette; procedure show_source_entities_Palette (Invoked_by : in aIDE.Editor.view; Target : in AdaM.Entity.Entities_view) -- Target : in AdaM.Source.Entities_view) is use Palette.of_source_entities; -- use type adam.Source.Entities_View; use type adam.Entity.Entities_view, Ada.Tags.Tag; -- the_Editor : constant AIDE.Editor.of_block.view := AIDE.Editor.of_block.view (Invoked_by); the_Editor : aIDE.Editor.of_block.view; the_Filter : Palette.of_source_entities.Filter; begin Ada.Text_IO.put_Line ("EDITOR TAG " & ada.tags.External_Tag (Invoked_by.all'Tag)); Ada.Text_IO.put_Line ("EDITOR TAG " & ada.tags.External_Tag (aide.Editor.of_block.item'Tag)); if Invoked_by.all in aide.Editor.of_block.item'Class then the_Editor := AIDE.Editor.of_block.view (Invoked_by); if the_Editor.Target.my_Declarations = Target then the_Filter := declare_Region; elsif the_Editor.Target.my_Statements = Target then the_Filter := begin_Region; else raise Program_Error; end if; elsif Invoked_by.all in aide.Editor.of_package.item'Class then -- the_Editor := AIDE.Editor.of_package.view (Invoked_by); the_Filter := declare_Region; else raise Program_Error with ada.tags.External_Tag (Invoked_by.all'Tag) & " not yet supported."; end if; the_source_entities_Palette.show (Invoked_by, Target, the_Filter); end show_source_entities_Palette; procedure show_pragma_Palette (Invoked_by : in aIDE.Editor.view; Target : in AdaM.a_Pragma.view) is begin the_pragma_Palette.show (Invoked_by, Target, aIDE.Palette.of_pragmas.declare_Region); end show_pragma_Palette; -- Logging -- procedure clear_Log is First, Last : gtk.text_Iter.gtk_text_Iter; begin the_build_log_Textview.get_Buffer.get_start_Iter (First); the_build_log_Textview.get_Buffer.get_end_Iter (Last); the_build_log_Textview.get_Buffer.delete (First, Last); end clear_Log; procedure log (the_Message : in String := ""; Count : in Positive := 1) is use Ada.Characters; Status : Boolean; pragma Unreferenced (Status); Iter : Gtk.Text_Iter.gtk_text_Iter; use type glib.Gint; begin for i in 1 .. Count loop the_build_log_Textview.get_Buffer.insert_at_Cursor (the_Message & Latin_1.LF); end loop; while gtk.Main.Events_Pending loop Status := gtk.Main.Main_Iteration; end loop; the_build_log_Textview.Get_Buffer.Get_Iter_At_Offset (Iter, -1); Status := the_build_log_Textview.Scroll_To_Iter (Iter => Iter, Within_Margin => 0.1, Use_Align => True, Xalign => 0.2, Yalign => 0.3); end log; procedure show_exceptions_Palette (Invoked_by : in gtk_Button; Target : in adam.exception_Handler.view; Slot : in Positive) is begin the_exceptions_Palette.show (Invoked_by, Target, Slot); end show_exceptions_Palette; procedure update_selected_package_Name (new_Name : in String) is begin choose_package_Button.set_Label (new_Name); end update_selected_package_Name; -- procedure update_selected_package_Name (new_Name : in String) -- is -- use gtk.Tree_Model, ada.Text_IO; -- -- the_Selection : Gtk_Tree_Iter; -- the_Model : Gtk_Tree_Model; -- begin -- the_package_tree_Selection.get_Selected (the_Model, the_Selection); -- -- if the_Selection /= null_Iter -- then -- declare -- -- use ada.Characters.handling, -- -- ada.Directories; -- -- old_Name : constant String := gtk.Tree_Model.get_String (the_Model, the_Selection, 0); -- begin -- if new_Name /= old_Name -- then -- the_package_tree_Store.set (the_Selection, 0, new_Name); -- -- build_Package; -- end if; -- end; -- else -- put_Line ("update_selected_package_Name : *** Null Iter ***"); -- end if; -- end update_selected_package_Name; procedure set_selected_Package (To : in AdaM.a_Package.view) is begin the_package_Editor.Package_is (To); end set_selected_Package; end aIDE.GUI;
-- Lua.Userdata -- Adding Ada objects of a specified tagged type to the Lua environment -- Copyright (c) 2015, James Humphry - see LICENSE for terms generic type T is abstract tagged limited private; package Lua.Userdata is type Access_Userdata is not null access all T; type Access_Userdata_Class is not null access all T'Class; -- Push an access-to-T to the stack of Lua state L as a UserData value. If a -- metatable has been registered for the type then it is associated with the -- new UserData value. procedure Push (L : in Lua_State'Class; D : not null access T); -- Push an access-to-T'Class to the stack of Lua state L as a UserData value. -- If a metatable has been registered for the type then it is associated with -- the new UserData value. procedure Push_Class (L : in Lua_State'Class; D : not null access T'Class); -- Check that the value at the index given is a valid Userdata that -- is convertible to an Ada access-to-T or access-to-T'Class. function IsAdaUserdata (L : in Lua_State'Class; index : in Integer) return Boolean; -- Retrieve an access-to-T from the stack of Lua state L at the given index. -- Checks that the value indicated is a non-class-wide userdata value, and -- that the tag is correct. function ToUserdata (L : in Lua_State'Class; index : in Integer) return Access_Userdata; -- Retrieve an access-to-T from the stack of Lua state L at the given index. -- Checks that the value indicated is a userdata value, and that the tag is -- correct. If the value is an access-to-S, where S is in T'Class, it will be -- converted to an access-to-T'Class. function ToUserdata_Class (L : in Lua_State'Class; index : in Integer) return Access_Userdata_Class; -- Create a new metatable for this type. It will be stored in the registry -- under 'Ada:ET' where ET is the result of T'External_Tag. If Set_Indexable -- is true then the key '__index' is set to the table itself, so writing -- 'a:foo()' in Lua will cause a call of metatable['foo'](a). procedure NewMetaTable (L : in Lua_State'Class; Set_Indexable : Boolean := True); -- Get the metatable for the type and push it to the stack. -- Returns true if successful, false otherwise function GetMetaTable (L : in Lua_State'Class) return Boolean; -- Get the metatable for the type and push it to the stack. If unsuccessful, -- raises Program_Error. procedure GetMetaTable (L : in Lua_State'Class); -- Registers a function Op under the given name. The top value on the stack -- should be the metatable for the type. procedure AddOperation (L : in Lua_State'Class; Name : in String; Op : AdaFunction); end Lua.Userdata;
-- part of OpenGLAda, (c) 2017 Felix Krause -- released under the terms of the MIT license, see the file "COPYING" with GL.Types; with GL.Enums.Getter; generic Min_Representation : Types.Int; Getter_Param : Enums.Getter.Parameter; package GL.Enums.Indexes is pragma Preelaborate; use GL.Types; Max : constant Int := Getter.Get_Max (Getter_Param); subtype Index is Int range 0 .. Max; function Representation (Value : Index) return Int; function Value (Representation : Int) return Index; end GL.Enums.Indexes;
with Rep_Clause5_Pkg; use Rep_Clause5_Pkg; package Rep_Clause5 is Bad_Number : exception; Too_Large : exception; type LNumber_Type is range 0..99999; procedure Merge_Numbered(LNodes : in out LNodes_Ptr); end Rep_Clause5;
--Colors package Colors is type Color_T is (Red, Yellow, Green, Blue, Black); type Color_Set_T is private; -- Add a color to the set procedure Add (Set : in out Color_Set_T; Color : Color_T); -- Remove a color from the set procedure Remove (Set : in out Color_Set_T; Color : Color_T); -- Convert the set to a string function Image (Set : Color_Set_T) return String; private -- Implement Color_Set_T type Color_Set_T is null record; end Colors;
with Ada.Tags.Generic_Dispatching_Constructor; package generic_dispatch_p is type Iface is interface; function Constructor (I : not null access Integer) return Iface is abstract; function Dispatching_Constructor is new Ada.Tags.Generic_Dispatching_Constructor (T => Iface, Parameters => Integer, Constructor => Constructor); type DT is new Iface with null record; overriding function Constructor (I : not null access Integer) return DT; end;
------------------------------------------------------------------------------ -- -- -- Matreshka Project -- -- -- -- Ada Modeling Framework -- -- -- -- Runtime Library Component -- -- -- ------------------------------------------------------------------------------ -- -- -- Copyright © 2011-2012, Vadim Godunko <vgodunko@gmail.com> -- -- All rights reserved. -- -- -- -- Redistribution and use in source and binary forms, with or without -- -- modification, are permitted provided that the following conditions -- -- are met: -- -- -- -- * Redistributions of source code must retain the above copyright -- -- notice, this list of conditions and the following disclaimer. -- -- -- -- * Redistributions in binary form must reproduce the above copyright -- -- notice, this list of conditions and the following disclaimer in the -- -- documentation and/or other materials provided with the distribution. -- -- -- -- * Neither the name of the Vadim Godunko, IE nor the names of its -- -- contributors may be used to endorse or promote products derived from -- -- this software without specific prior written permission. -- -- -- -- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -- -- "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -- -- LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -- -- A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -- -- HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -- -- SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED -- -- TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -- -- PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -- -- LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -- -- NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -- -- SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -- -- -- ------------------------------------------------------------------------------ -- $Revision$ $Date$ ------------------------------------------------------------------------------ -- This file is generated, don't edit it. ------------------------------------------------------------------------------ -- A multiplicity is a definition of an inclusive interval of non-negative -- integers beginning with a lower bound and ending with a (possibly -- infinite) upper bound. A multiplicity element embeds this information to -- specify the allowable cardinalities for an instantiation of this element. ------------------------------------------------------------------------------ with AMF.UML.Elements; limited with AMF.UML.Value_Specifications; package AMF.UML.Multiplicity_Elements is pragma Preelaborate; type UML_Multiplicity_Element is limited interface and AMF.UML.Elements.UML_Element; type UML_Multiplicity_Element_Access is access all UML_Multiplicity_Element'Class; for UML_Multiplicity_Element_Access'Storage_Size use 0; not overriding function Get_Is_Ordered (Self : not null access constant UML_Multiplicity_Element) return Boolean is abstract; -- Getter of MultiplicityElement::isOrdered. -- -- For a multivalued multiplicity, this attribute specifies whether the -- values in an instantiation of this element are sequentially ordered. not overriding procedure Set_Is_Ordered (Self : not null access UML_Multiplicity_Element; To : Boolean) is abstract; -- Setter of MultiplicityElement::isOrdered. -- -- For a multivalued multiplicity, this attribute specifies whether the -- values in an instantiation of this element are sequentially ordered. not overriding function Get_Is_Unique (Self : not null access constant UML_Multiplicity_Element) return Boolean is abstract; -- Getter of MultiplicityElement::isUnique. -- -- For a multivalued multiplicity, this attributes specifies whether the -- values in an instantiation of this element are unique. not overriding procedure Set_Is_Unique (Self : not null access UML_Multiplicity_Element; To : Boolean) is abstract; -- Setter of MultiplicityElement::isUnique. -- -- For a multivalued multiplicity, this attributes specifies whether the -- values in an instantiation of this element are unique. not overriding function Get_Lower (Self : not null access constant UML_Multiplicity_Element) return AMF.Optional_Integer is abstract; -- Getter of MultiplicityElement::lower. -- -- Specifies the lower bound of the multiplicity interval. not overriding procedure Set_Lower (Self : not null access UML_Multiplicity_Element; To : AMF.Optional_Integer) is abstract; -- Setter of MultiplicityElement::lower. -- -- Specifies the lower bound of the multiplicity interval. not overriding function Get_Lower_Value (Self : not null access constant UML_Multiplicity_Element) return AMF.UML.Value_Specifications.UML_Value_Specification_Access is abstract; -- Getter of MultiplicityElement::lowerValue. -- -- The specification of the lower bound for this multiplicity. not overriding procedure Set_Lower_Value (Self : not null access UML_Multiplicity_Element; To : AMF.UML.Value_Specifications.UML_Value_Specification_Access) is abstract; -- Setter of MultiplicityElement::lowerValue. -- -- The specification of the lower bound for this multiplicity. not overriding function Get_Upper (Self : not null access constant UML_Multiplicity_Element) return AMF.Optional_Unlimited_Natural is abstract; -- Getter of MultiplicityElement::upper. -- -- Specifies the upper bound of the multiplicity interval. not overriding procedure Set_Upper (Self : not null access UML_Multiplicity_Element; To : AMF.Optional_Unlimited_Natural) is abstract; -- Setter of MultiplicityElement::upper. -- -- Specifies the upper bound of the multiplicity interval. not overriding function Get_Upper_Value (Self : not null access constant UML_Multiplicity_Element) return AMF.UML.Value_Specifications.UML_Value_Specification_Access is abstract; -- Getter of MultiplicityElement::upperValue. -- -- The specification of the upper bound for this multiplicity. not overriding procedure Set_Upper_Value (Self : not null access UML_Multiplicity_Element; To : AMF.UML.Value_Specifications.UML_Value_Specification_Access) is abstract; -- Setter of MultiplicityElement::upperValue. -- -- The specification of the upper bound for this multiplicity. not overriding function Compatible_With (Self : not null access constant UML_Multiplicity_Element; Other : AMF.UML.Multiplicity_Elements.UML_Multiplicity_Element_Access) return Boolean is abstract; -- Operation MultiplicityElement::compatibleWith. -- -- The operation compatibleWith takes another multiplicity as input. It -- checks if one multiplicity is compatible with another. not overriding function Includes_Cardinality (Self : not null access constant UML_Multiplicity_Element; C : Integer) return Boolean is abstract; -- Operation MultiplicityElement::includesCardinality. -- -- The query includesCardinality() checks whether the specified -- cardinality is valid for this multiplicity. not overriding function Includes_Multiplicity (Self : not null access constant UML_Multiplicity_Element; M : AMF.UML.Multiplicity_Elements.UML_Multiplicity_Element_Access) return Boolean is abstract; -- Operation MultiplicityElement::includesMultiplicity. -- -- The query includesMultiplicity() checks whether this multiplicity -- includes all the cardinalities allowed by the specified multiplicity. not overriding function Iss (Self : not null access constant UML_Multiplicity_Element; Lowerbound : Integer; Upperbound : Integer) return Boolean is abstract; -- Operation MultiplicityElement::is. -- -- The operation is determines if the upper and lower bound of the ranges -- are the ones given. not overriding function Is_Multivalued (Self : not null access constant UML_Multiplicity_Element) return Boolean is abstract; -- Operation MultiplicityElement::isMultivalued. -- -- The query isMultivalued() checks whether this multiplicity has an upper -- bound greater than one. not overriding function Lower (Self : not null access constant UML_Multiplicity_Element) return AMF.Optional_Integer is abstract; -- Operation MultiplicityElement::lower. -- -- The derived lower attribute must equal the lowerBound. not overriding function Lower_Bound (Self : not null access constant UML_Multiplicity_Element) return AMF.Optional_Integer is abstract; -- Operation MultiplicityElement::lowerBound. -- -- The query lowerBound() returns the lower bound of the multiplicity as -- an integer. not overriding function Upper (Self : not null access constant UML_Multiplicity_Element) return AMF.Optional_Unlimited_Natural is abstract; -- Operation MultiplicityElement::upper. -- -- The derived upper attribute must equal the upperBound. not overriding function Upper_Bound (Self : not null access constant UML_Multiplicity_Element) return AMF.Optional_Unlimited_Natural is abstract; -- Operation MultiplicityElement::upperBound. -- -- The query upperBound() returns the upper bound of the multiplicity for -- a bounded multiplicity as an unlimited natural. end AMF.UML.Multiplicity_Elements;
-- CE3804F.ADA -- Grant of Unlimited Rights -- -- Under contracts F33600-87-D-0337, F33600-84-D-0280, MDA903-79-C-0687, -- F08630-91-C-0015, and DCA100-97-D-0025, the U.S. Government obtained -- unlimited rights in the software and documentation contained herein. -- Unlimited rights are defined in DFAR 252.227-7013(a)(19). By making -- this public release, the Government intends to confer upon all -- recipients unlimited rights equal to those held by the Government. -- These rights include rights to use, duplicate, release or disclose the -- released technical data and computer software in whole or in part, in -- any manner and for any purpose whatsoever, and to have or permit others -- to do so. -- -- DISCLAIMER -- -- ALL MATERIALS OR INFORMATION HEREIN RELEASED, MADE AVAILABLE OR -- DISCLOSED ARE AS IS. THE GOVERNMENT MAKES NO EXPRESS OR IMPLIED -- WARRANTY AS TO ANY MATTER WHATSOEVER, INCLUDING THE CONDITIONS OF THE -- SOFTWARE, DOCUMENTATION OR OTHER INFORMATION RELEASED, MADE AVAILABLE -- OR DISCLOSED, OR THE OWNERSHIP, MERCHANTABILITY, OR FITNESS FOR A -- PARTICULAR PURPOSE OF SAID MATERIAL. --* -- OBJECTIVE: -- CHECK THAT FLOAT_IO GET RAISES CONSTRAINT_ERROR WHEN THE VALUE -- SUPPLIED BY WIDTH IS NEGATIVE, WIDTH IS GREATER THAN FIELD'LAST -- WHEN FIELD'LAST IS LESS THAN INTEGER'LAST, OR THE VALUE READ IS -- OUT OF RANGE OF THE ITEM PARAMETER, BUT WITHIN THE RANGE OF THE -- SUBTYPE USED TO INSTANTIATE FLOAT_IO. -- APPLICABILITY CRITERIA: -- THIS TEST IS APPLICABLE ONLY TO IMPLEMENTATIONS WHICH -- SUPPORT TEXT FILES. -- HISTORY: -- SPS 09/07/82 -- JBG 08/30/83 -- DWC 09/11/87 SPLIT CASE FOR FIXED_IO INTO CE3804P.ADA AND -- CORRECTED EXCEPTION HANDLING. -- JRL 06/07/96 Added call to Ident_Int in expressions involving -- Field'Last, to make the expressions non-static and -- prevent compile-time rejection. WITH REPORT; USE REPORT; WITH TEXT_IO; USE TEXT_IO; PROCEDURE CE3804F IS INCOMPLETE : EXCEPTION; BEGIN TEST ("CE3804F", "CHECK THAT FLOAT_IO GET RAISES " & "CONSTRAINT_ERROR WHEN THE VALUE SUPPLIED " & "BY WIDTH IS NEGATIVE, WIDTH IS GREATER THAN " & "FIELD'LAST WHEN FIELD'LAST IS LESS THAN " & "INTEGER'LAST, OR THE VALUE READ IS OUT OF " & "RANGE OF THE ITEM PARAMETER, BUT WITHIN THE " & "RANGE OF THE SUBTYPE USED TO INSTANTIATE " & "FLOAT_IO."); DECLARE FT : FILE_TYPE; TYPE FLT IS NEW FLOAT RANGE 1.0 .. 10.0; PACKAGE FL_IO IS NEW FLOAT_IO (FLT); USE FL_IO; X : FLT RANGE 1.0 .. 5.0; BEGIN BEGIN GET (FT, X, IDENT_INT(-3)); FAILED ("CONSTRAINT_ERROR NOT RAISED FOR NEGATIVE " & "WIDTH"); EXCEPTION WHEN CONSTRAINT_ERROR => NULL; WHEN STATUS_ERROR => FAILED ("STATUS_ERROR RAISED INSTEAD OF " & "CONSTRAINT_ERROR FOR NEGATIVE WIDTH"); WHEN OTHERS => FAILED ("WRONG EXCEPTION RAISED FOR NEGATIVE " & "WIDTH"); END; IF FIELD'LAST < INTEGER'LAST THEN BEGIN GET (X, FIELD'LAST + Ident_Int(1)); FAILED ("CONSTRAINT_ERROR NOT RAISED - " & "FIELD'LAST + 1 WIDTH - DEFAULT"); EXCEPTION WHEN CONSTRAINT_ERROR => NULL; WHEN OTHERS => FAILED ("WRONG EXCEPTION RAISED - " & "FIELD'LAST + 1 WIDTH - DEFAULT"); END; END IF; BEGIN CREATE (FT, OUT_FILE, LEGAL_FILE_NAME); EXCEPTION WHEN USE_ERROR => NOT_APPLICABLE ("USE_ERROR RAISED; TEXT CREATE " & "WITH OUT_FILE MODE"); RAISE INCOMPLETE; WHEN NAME_ERROR => NOT_APPLICABLE ("NAME_ERROR RAISED; TEXT CREATE " & "WITH OUT_FILE MODE"); RAISE INCOMPLETE; END; PUT (FT, "1.0"); NEW_LINE (FT); PUT (FT, "8.0"); NEW_LINE (FT); PUT (FT, "2.0"); NEW_LINE (FT); PUT (FT, "3.0"); CLOSE (FT); BEGIN OPEN (FT, IN_FILE, LEGAL_FILE_NAME); EXCEPTION WHEN USE_ERROR => NOT_APPLICABLE ("USE_ERROR RAISED; TEXT OPEN " & "FOR IN_FILE MODE"); RAISE INCOMPLETE; END; GET (FT, X); IF X /= 1.0 THEN FAILED ("WRONG VALUE READ WITH EXTERNAL FILE"); END IF; BEGIN GET (FT, X); FAILED ("CONSTRAINT_ERROR NOT RAISED - " & "VALUE OUT OF RANGE WITH EXTERNAL FILE"); EXCEPTION WHEN CONSTRAINT_ERROR => NULL; WHEN OTHERS => FAILED ("WRONG EXCEPTION RAISED - " & "VALUE OUT OF RANGE WITH EXTERNAL FILE"); END; BEGIN GET (FT, X, IDENT_INT(-1)); FAILED ("CONSTRAINT_ERROR NOT RAISED - " & "NEGATIVE WIDTH WITH EXTERNAL FILE"); EXCEPTION WHEN CONSTRAINT_ERROR => NULL; WHEN OTHERS => FAILED ("WRONG EXCEPTION RAISED - " & "NEGATIVE WIDTH WITH EXTERNAL FILE"); END; SKIP_LINE (FT); IF FIELD'LAST < INTEGER'LAST THEN BEGIN GET (FT, X, FIELD'LAST + Ident_Int(1)); FAILED ("CONSTRAINT_ERROR NOT RAISED - " & "FIELD'LAST + 1 WIDTH WITH " & "EXTERNAL FILE"); EXCEPTION WHEN CONSTRAINT_ERROR => NULL; WHEN OTHERS => FAILED ("WRONG EXCEPTION RAISED - " & "FIELD'LAST + 1 WIDTH WITH " & "EXTERNAL FILE"); END; END IF; SKIP_LINE (FT); BEGIN GET (FT, X, 3); EXCEPTION WHEN CONSTRAINT_ERROR => FAILED ("CONSTRAINT_ERROR RAISED - " & "OUT OF RANGE WITH EXTERNAL FILE"); WHEN OTHERS => FAILED ("WRONG EXCEPTION RAISED - " & "OUT OF RANGE WITH EXTERNAL FILE"); END; BEGIN DELETE (FT); EXCEPTION WHEN USE_ERROR => NULL; END; EXCEPTION WHEN INCOMPLETE => NULL; END; RESULT; END CE3804F;
-- AOC 2020, Day 17 with Ada.Containers.Hashed_Sets; use Ada.Containers; package Day is type Location is record x : Integer := 0; y : Integer := 0; z : Integer := 0; w : Integer := 0; end record; function location_hash(key : in Location) return Hash_Type; package Grid_Set is new Ada.Containers.Hashed_Sets (Element_Type => Location, Hash => location_hash, Equivalent_Elements => "="); use Grid_Set; function load_file(filename : in String) return Grid_Set.Set; function active_count(g : in Grid_Set.Set; cycles : in Natural) return Natural; function active_count_4d(g : in Grid_Set.Set; cycles : in Natural) return Natural; end Day;
-- { dg-do run } with Modular3_Pkg; use Modular3_Pkg; procedure Modular3 is function F1 (A : Int16_T) return Int16_T is begin return A + 128; end; function F2 (B : Mod16_T) return Mod16_T is begin return B + 128; end; A : Int16_T := 16384; B : Mod16_T := 65504; begin A := F1 (A); if A /= 16512 then raise Program_Error; end if; B := F2 (B); if B /= 96 then raise Program_Error; end if; end Modular3;
generic type Real is digits <>; package pc_2_coeff_22 is subtype PC_Rule_Range is Integer range 0..31; type Integration_Rule is array(PC_Rule_Range) of Real; Starting_Id_of_First_Deriv_of_Y : constant PC_Rule_Range := 15; -- Center_Integration Rule, applied to (d/dt)**2 Y, takes a dY/dt here, and -- Integrates it one indice forward. Extrap_Factor: constant Real := 1.0 / 24.0; -- val unknown Corrector_33_22 : constant Integration_Rule := ( -8.02130559997354078604776522542254439E-4, 1.24416532870088974691741276214884268E-2, -8.64795984660665687642672166948211787E-2, 3.50230302101274679029708692614152597E-1, -8.91121460953578667337715179019697046E-1, 1.39383153917014648240732079853746142E+0, -1.07121283818712541646971756034689810E+0, -2.97295767060760759428837790575625762E-1, 1.28052482910646884772471445763110385E+0, -3.48796383077358912539756432632846449E-1, -1.18323146225282708847281583111056865E+0, 6.13830360683718379636023405051540400E-1, 1.15669753037498753526808006354467904E+0, -6.94338273293159923319315200784758205E-1, -1.25077139904584256785139807653322816E+0, 7.20794822429374825729635224538098316E-1, 1.77492750390194010614093059728166958E+0, 3.48406301508706280013183366668745917E-1, -3.24702653757985544407247498269540941E-1, 1.55113657266486316345543277158075854E+0, 2.51118592351726418774359026068146849E+0, 3.82957536377735794971423254482703827E-1, -6.54923221588828602513601179436160298E-1, 1.98098310154670126300578248795171698E+0, 2.62677613787930934327036702584321002E+0, -8.86789566789142290186373972323935862E-1, 2.85598769943888482178532669984860663E-1, 4.02778278621156389145728011748586155E+0, -2.15859907174040020406160913348832844E+0, 2.94403131132369272781778743704178050E+0, 2.00939488060088412087622634816136813E-1, 1.13310419806709432866152258587289993E+0 ); Final_Step_Corrector_33_22 : constant Real := 5.28831586172462713631478685086144395E-2; Predictor_31_22 : constant Integration_Rule := ( 0.0, 3.82206142445544963446204148715951607E-2, -6.33908224331091016776700383111987143E-1, 4.77108082172046540302262546600367877E+0, -2.13112230306056104385071748550271682E+1, 6.16394218004587635365556288368891905E+1, -1.16455265845403402132194278236324202E+2, 1.31160078589256480618203936959714671E+2, -4.73620760128097778046470502754138483E+1, -8.61155833650963992491864075194045219E+1, 1.09596202456069853887869187577271935E+2, 2.70006891539818698623550090779730573E+1, -1.23689026778934313461788121734000576E+2, 1.26308792943455875969362146348904466E+1, 1.25351440983592524456909109664479950E+2, -3.90915067214200967699893349056174838E+1, -1.25005696132419709068005825586513917E+2, 6.31400058836348955981727456733231437E+1, 1.25202212204700030730203205988430657E+2, -9.01202664128768808476121572162738365E+1, -1.13346070602251991153852098206722707E+2, 1.35832428576795315596340908178178692E+2, 7.65648954748416679820099605596069319E+1, -1.90778807698391251633999872762198544E+2, 4.29249448929317005301844046601429694E+1, 1.90302308174625292773031958813598645E+2, -2.76219723414219806259983408912758259E+2, 2.10878867270091505775711508404456506E+2, -1.02199587368891636464946651890028622E+2, 3.55597890257171711903655577067406769E+1, -6.79799476949725817083394168801447862E+0, 2.03327116014154443810644155483740520E+0 ); Center_Integration_32_22 : constant Integration_Rule := ( -5.48186298516234652810704051430422655E-6, 9.83867415088779031208187158666710319E-5, -8.07566491514156651234056438130100106E-4, 3.97340757417976466081704231342063697E-3, -1.28356892096129410337836800376618841E-2, 2.76864991077874453604989378001785406E-2, -3.73245825355348862199480292460505598E-2, 2.12653218023217359291463822190892211E-2, 2.13745306335366393296921989209611924E-2, -4.56656788294881115637614729100805322E-2, 3.89437307673685355200946981995831816E-3, 6.22684247056539251232690828593738376E-2, -3.61385003611128933128201417801336908E-2, -9.55657510587708441101932722470146491E-2, 1.33596784912141525960540060966517392E-1, 4.54185521795152227419174766084219910E-1, 4.54185521795152227419174766084219910E-1, 1.33596784912141525960540060966517392E-1, -9.55657510587708441101932722470146491E-2, -3.61385003611128933128201417801336908E-2, 6.22684247056539251232690828593738376E-2, 3.89437307673685355200946981995831816E-3, -4.56656788294881115637614729100805322E-2, 2.13745306335366393296921989209611924E-2, 2.12653218023217359291463822190892211E-2, -3.73245825355348862199480292460505598E-2, 2.76864991077874453604989378001785406E-2, -1.28356892096129410337836800376618841E-2, 3.97340757417976466081704231342063697E-3, -8.07566491514156651234056438130100106E-4, 9.83867415088779031208187158666710319E-5, -5.48186298516234652810704051430422655E-6 ); Center_to_End_Integration_32_22 : constant Integration_Rule := ( -2.46055400745919258120729405349163691E-3, 3.94937734266237896046990985820173913E-2, -2.85924604814419907317339235057302237E-1, 1.21775236041835015679281022068507655E+0, -3.31119345468907190517628700742888269E+0, 5.72250882622795112186390828443613906E+0, -5.45219585821552065525673442095904352E+0, 4.67487319274695445937703915277492695E-1, 5.04181007527642399830645261263436520E+0, -3.55919391785093453217583112024140353E+0, -3.53127580678341307884535450947182606E+0, 4.78039107137706694005293349536141932E+0, 2.58127452529930794024644881912956886E+0, -5.38383054354341648182107088309022155E+0, -2.14665605885624873975943985055075865E+0, 6.20637871667093544879506276387734096E+0, 3.05624946842682355808916099018747109E+0, -5.09128384721184624337245342432563704E+0, -9.81525574395439526528573186007045599E-1, 7.83552753870215262539576158282298399E+0, 2.35174419853373730752706320570413064E+0, -6.89285619244306859389417799474804191E+0, 1.68408438510945988767883644031839272E+0, 9.80602637995232916495184306214695197E+0, -4.76910099297560210294927249411766282E+0, -5.10257080894008187297314868283199883E+0, 1.47380098655089154766482408672545751E+1, -1.15093206885050787659302691253911179E+1, 8.20228332093864178792515819652974703E+0, -1.94051634824961325307374327575866262E+0, 1.97652535686240736364681749381366289E+0, 2.52358069475392838192001455271761107E-1 ); Center_to_End_Integration : Integration_Rule renames Center_to_End_Integration_32_22; Predictor_Rule : Integration_Rule renames Predictor_31_22; Corrector_Rule : Integration_Rule renames Corrector_33_22; Center_Integration : Integration_Rule renames Center_Integration_32_22; Final_Step_Corrector : Real renames Final_Step_Corrector_33_22; end pc_2_coeff_22;
with BB_Pico_Bsp.I2C; package body BB_Pico_Bsp.Keyboard is Device : BBQ10KBD.BBQ10KBD_Device (BB_Pico_Bsp.I2C.Port); ------------------ -- Key_FIFO_Pop -- ------------------ function Key_FIFO_Pop return BBQ10KBD.Key_State is begin return Device.Key_FIFO_Pop; end Key_FIFO_Pop; ------------ -- Status -- ------------ function Status return BBQ10KBD.KBD_Status is begin return Device.Status; end Status; ------------------- -- Set_Backlight -- ------------------- procedure Set_Backlight (Lvl : HAL.UInt8) is begin Device.Set_Backlight (Lvl); end Set_Backlight; ------------- -- Version -- ------------- function Version return HAL.UInt8 is begin return Device.Version; end Version; end BB_Pico_Bsp.Keyboard;
with Ada.Exceptions; with Ada.Unchecked_Conversion; with Interfaces.C.Strings; with System.Address_To_Access_Conversions; with System.Storage_Elements; with System.Unwind.Foreign; with C.unwind; procedure exception_cpp is pragma Linker_Options ("-lstdc++"); use type Interfaces.C.char_array; use type System.Storage_Elements.Storage_Offset; type type_info is record vtbl : System.Address; name : Interfaces.C.Strings.const_chars_ptr; end record with Convention => Cpp; char_const_ptr : aliased constant type_info with Import, Convention => Cpp, External_Name => "_ZTIPKc"; Message : aliased constant Interfaces.C.char_array := "This is a C++ exception!" & Interfaces.C.nul; package Conv is new System.Address_To_Access_Conversions ( Interfaces.C.Strings.const_chars_ptr); begin declare function cxa_allocate_exception ( size : Interfaces.C.size_t) return System.Address with Import, Convention => C, External_Name => "__cxa_allocate_exception"; procedure cxa_throw ( obj : System.Address; tinfo : access constant type_info; dest : System.Address) with Import, Convention => C, External_Name => "__cxa_throw"; pragma No_Return (cxa_throw); Cpp_Exception : System.Address; begin Cpp_Exception := cxa_allocate_exception (Interfaces.C.Strings.const_chars_ptr'Max_Size_In_Storage_Elements); Conv.To_Pointer (Cpp_Exception).all := Interfaces.C.Strings.To_Const_Chars_ptr (Message'Access); cxa_throw (Cpp_Exception, char_const_ptr'Access, System.Null_Address); end; exception when E : System.Unwind.Foreign.Foreign_Exception => declare function To_Repr is new Ada.Unchecked_Conversion ( Ada.Exceptions.Exception_Occurrence_Access, System.Unwind.Exception_Occurrence_Access); GCC_Exception : constant System.Address := To_Repr (E'Unrestricted_Access).Machine_Occurrence; Cpp_Exception : constant System.Address := GCC_Exception + C.unwind.struct_Unwind_Exception'Max_Size_In_Storage_Elements; begin Ada.Debug.Put (Interfaces.C.Strings.Value (Conv.To_Pointer (Cpp_Exception).all)); end; end exception_cpp;
with Ada.Text_IO; procedure Knapsack_Unbounded is type Bounty is record Value : Natural; Weight : Float; Volume : Float; end record; function Min (A, B : Float) return Float is begin if A < B then return A; else return B; end if; end Min; Panacea : Bounty := (3000, 0.3, 0.025); Ichor : Bounty := (1800, 0.2, 0.015); Gold : Bounty := (2500, 2.0, 0.002); Limits : Bounty := ( 0, 25.0, 0.250); Best : Bounty := ( 0, 0.0, 0.000); Current : Bounty := ( 0, 0.0, 0.000); Best_Amounts : array (1 .. 3) of Natural := (0, 0, 0); Max_Panacea : Natural := Natural (Float'Floor (Min (Limits.Weight / Panacea.Weight, Limits.Volume / Panacea.Volume))); Max_Ichor : Natural := Natural (Float'Floor (Min (Limits.Weight / Ichor.Weight, Limits.Volume / Ichor.Volume))); Max_Gold : Natural := Natural (Float'Floor (Min (Limits.Weight / Gold.Weight, Limits.Volume / Gold.Volume))); begin for Panacea_Count in 0 .. Max_Panacea loop for Ichor_Count in 0 .. Max_Ichor loop for Gold_Count in 0 .. Max_Gold loop Current.Value := Panacea_Count * Panacea.Value + Ichor_Count * Ichor.Value + Gold_Count * Gold.Value; Current.Weight := Float (Panacea_Count) * Panacea.Weight + Float (Ichor_Count) * Ichor.Weight + Float (Gold_Count) * Gold.Weight; Current.Volume := Float (Panacea_Count) * Panacea.Volume + Float (Ichor_Count) * Ichor.Volume + Float (Gold_Count) * Gold.Volume; if Current.Value > Best.Value and Current.Weight <= Limits.Weight and Current.Volume <= Limits.Volume then Best := Current; Best_Amounts := (Panacea_Count, Ichor_Count, Gold_Count); end if; end loop; end loop; end loop; Ada.Text_IO.Put_Line ("Maximum value:" & Natural'Image (Best.Value)); Ada.Text_IO.Put_Line ("Panacea:" & Natural'Image (Best_Amounts (1))); Ada.Text_IO.Put_Line ("Ichor: " & Natural'Image (Best_Amounts (2))); Ada.Text_IO.Put_Line ("Gold: " & Natural'Image (Best_Amounts (3))); end Knapsack_Unbounded;
with TEXT_IO; with INFLECTIONS_PACKAGE; use INFLECTIONS_PACKAGE; with DICTIONARY_PACKAGE; use DICTIONARY_PACKAGE; with ADDONS_PACKAGE; use ADDONS_PACKAGE; with WORD_SUPPORT_PACKAGE; use WORD_SUPPORT_PACKAGE; package WORD_PACKAGE is LINE_NUMBER, WORD_NUMBER : INTEGER := 0; type STEM_ARRAY_TYPE is array (INTEGER range <>) of STEM_TYPE; subtype STEM_ARRAY is STEM_ARRAY_TYPE(0..MAX_STEM_SIZE); NOT_A_STEM : constant STEM_TYPE := (others => 'x'); NOT_A_STEM_ARRAY : STEM_ARRAY := (others => NOT_A_STEM); SA, SSA : STEM_ARRAY := NOT_A_STEM_ARRAY; SSA_MAX : INTEGER := 0; type PRUNED_DICTIONARY_ITEM is record DS : DICTIONARY_STEM; D_K : DICTIONARY_KIND := DEFAULT_DICTIONARY_KIND; end record; NULL_PRUNED_DICTIONARY_ITEM : PRUNED_DICTIONARY_ITEM; type PRUNED_DICTIONARY_LIST is array (1..80) of PRUNED_DICTIONARY_ITEM; -- Aug 96 QU_PRON max 42, PACK max 54 -- Jan 97 QU_PRON max 42, PACK max 74 -- Might reduce PDL : PRUNED_DICTIONARY_LIST := (others => NULL_PRUNED_DICTIONARY_ITEM); PDL_INDEX : INTEGER := 0; subtype SAL is PARSE_ARRAY(1..250); type DICT_RESTRICTION is (X, REGULAR, QU_PRON_ONLY, PACK_ONLY); XXX_MEANING : MEANING_TYPE := NULL_MEANING_TYPE; -- For TRICKS YYY_MEANING : MEANING_TYPE := NULL_MEANING_TYPE; -- For SYNCOPE NNN_MEANING : MEANING_TYPE := NULL_MEANING_TYPE; -- For Names RRR_MEANING : MEANING_TYPE := NULL_MEANING_TYPE; -- For Roman Numerals PPP_MEANING : MEANING_TYPE := NULL_MEANING_TYPE; -- For COMPOUNDED SCROLL_LINE_NUMBER : INTEGER := 0; OUTPUT_SCROLL_COUNT : INTEGER := 0; procedure PAUSE(OUTPUT : TEXT_IO.FILE_TYPE); function MIN(A, B : INTEGER) return INTEGER; function LTU(C, D : CHARACTER) return BOOLEAN; function EQU(C, D : CHARACTER) return BOOLEAN; function GTU(C, D : CHARACTER) return BOOLEAN; function LTU(S, T : STRING) return BOOLEAN; function GTU(S, T : STRING) return BOOLEAN; function EQU(S, T : STRING) return BOOLEAN; procedure RUN_INFLECTIONS(S : in STRING; SL : in out SAL; RESTRICTION : DICT_RESTRICTION := REGULAR); procedure SEARCH_DICTIONARIES(SSA : in STEM_ARRAY_TYPE; PREFIX : PREFIX_ITEM; SUFFIX : SUFFIX_ITEM; RESTRICTION : DICT_RESTRICTION := REGULAR); procedure WORD(RAW_WORD : in STRING; PA : in out PARSE_ARRAY; PA_LAST : in out INTEGER); procedure CHANGE_LANGUAGE(C : CHARACTER); procedure INITIALIZE_WORD_PACKAGE; end WORD_PACKAGE;
pragma License (Unrestricted); with Ada.Numerics.Complex_Types; with Ada.Numerics.Generic_Complex_Elementary_Functions; package Ada.Numerics.Complex_Elementary_Functions is new Generic_Complex_Elementary_Functions (Complex_Types); pragma Pure (Ada.Numerics.Complex_Elementary_Functions);
-- Generated at 2017-06-29 18:53:35 +0000 by Natools.Static_Hash_Maps -- from src/natools-web-fallback_render-maps.sx package Natools.Static_Maps.Web.Fallback_Render is pragma Pure; type Command is (Unknown, Current_Time, Cookies, Comment_Cookie_Filter, Comment_Cookie_Link, Comment_Cookie_Mail, Comment_Cookie_Name, Element, Element_Or_Template, Filter, If_Comment_Cookie_Filter_Is, If_Has_Element, If_Has_Not_Element, If_Has_Parameter_Else, If_Header_Else, If_Parameter_Is, Load_Date, Optional_Tags, Parameter, Set_MIME_Type, Tags, Template, User); function To_Command (Key : String) return Command; private Map_1_Key_0 : aliased constant String := "now"; Map_1_Key_1 : aliased constant String := "today"; Map_1_Key_2 : aliased constant String := "current-time"; Map_1_Key_3 : aliased constant String := "current-date"; Map_1_Key_4 : aliased constant String := "cookies"; Map_1_Key_5 : aliased constant String := "cookie-table"; Map_1_Key_6 : aliased constant String := "comment-cookie-filter"; Map_1_Key_7 : aliased constant String := "comment-cookie-link"; Map_1_Key_8 : aliased constant String := "comment-cookie-mail"; Map_1_Key_9 : aliased constant String := "comment-cookie-name"; Map_1_Key_10 : aliased constant String := "element"; Map_1_Key_11 : aliased constant String := "render"; Map_1_Key_12 : aliased constant String := "element-or-template"; Map_1_Key_13 : aliased constant String := "filter"; Map_1_Key_14 : aliased constant String := "if-comment-cookie-filter-is"; Map_1_Key_15 : aliased constant String := "if-has-element"; Map_1_Key_16 : aliased constant String := "if-has-not-element"; Map_1_Key_17 : aliased constant String := "if-has-parameter-else"; Map_1_Key_18 : aliased constant String := "if-header-else"; Map_1_Key_19 : aliased constant String := "if-parameter-is"; Map_1_Key_20 : aliased constant String := "load-date"; Map_1_Key_21 : aliased constant String := "optional-pagelist"; Map_1_Key_22 : aliased constant String := "optional-page-list"; Map_1_Key_23 : aliased constant String := "optional-tag"; Map_1_Key_24 : aliased constant String := "optional-tags"; Map_1_Key_25 : aliased constant String := "parameter"; Map_1_Key_26 : aliased constant String := "mime-type"; Map_1_Key_27 : aliased constant String := "pagelist"; Map_1_Key_28 : aliased constant String := "page-list"; Map_1_Key_29 : aliased constant String := "tag"; Map_1_Key_30 : aliased constant String := "tags"; Map_1_Key_31 : aliased constant String := "template"; Map_1_Key_32 : aliased constant String := "user"; Map_1_Keys : constant array (0 .. 32) of access constant String := (Map_1_Key_0'Access, Map_1_Key_1'Access, Map_1_Key_2'Access, Map_1_Key_3'Access, Map_1_Key_4'Access, Map_1_Key_5'Access, Map_1_Key_6'Access, Map_1_Key_7'Access, Map_1_Key_8'Access, Map_1_Key_9'Access, Map_1_Key_10'Access, Map_1_Key_11'Access, Map_1_Key_12'Access, Map_1_Key_13'Access, Map_1_Key_14'Access, Map_1_Key_15'Access, Map_1_Key_16'Access, Map_1_Key_17'Access, Map_1_Key_18'Access, Map_1_Key_19'Access, Map_1_Key_20'Access, Map_1_Key_21'Access, Map_1_Key_22'Access, Map_1_Key_23'Access, Map_1_Key_24'Access, Map_1_Key_25'Access, Map_1_Key_26'Access, Map_1_Key_27'Access, Map_1_Key_28'Access, Map_1_Key_29'Access, Map_1_Key_30'Access, Map_1_Key_31'Access, Map_1_Key_32'Access); Map_1_Elements : constant array (0 .. 32) of Command := (Current_Time, Current_Time, Current_Time, Current_Time, Cookies, Cookies, Comment_Cookie_Filter, Comment_Cookie_Link, Comment_Cookie_Mail, Comment_Cookie_Name, Element, Element_Or_Template, Element_Or_Template, Filter, If_Comment_Cookie_Filter_Is, If_Has_Element, If_Has_Not_Element, If_Has_Parameter_Else, If_Header_Else, If_Parameter_Is, Load_Date, Optional_Tags, Optional_Tags, Optional_Tags, Optional_Tags, Parameter, Set_MIME_Type, Tags, Tags, Tags, Tags, Template, User); end Natools.Static_Maps.Web.Fallback_Render;
------------------------------------------------------------------------------ -- -- -- GNAT RUN-TIME COMPONENTS -- -- -- -- ADA.STRINGS.UTF_ENCODING.WIDE_STRINGS -- -- -- -- S p e c -- -- -- -- This specification is derived from the Ada Reference Manual for use with -- -- GNAT. In accordance with the copyright of that document, you can freely -- -- copy and modify this specification, provided that if you redistribute a -- -- modified version, any changes that you have made are clearly indicated. -- -- -- ------------------------------------------------------------------------------ -- This is an Ada 2012 package defined in AI05-0137-1. It is used for encoding -- and decoding Wide_String values using UTF encodings. Note: this package is -- consistent with Ada 95, and may be included in Ada 95 implementations. package Ada.Strings.UTF_Encoding.Wide_Strings is pragma Pure (Wide_Strings); -- The encoding routines take a Wide_String as input and encode the result -- using the specified UTF encoding method. The result includes a BOM if -- the Output_BOM argument is set to True. Encoding_Error is raised if an -- invalid character appears in the input. In particular the characters -- in the range 16#D800# .. 16#DFFF# are invalid because they conflict -- with UTF-16 surrogate encodings, and the characters 16#FFFE# and -- 16#FFFF# are also invalid because they conflict with BOM codes. function Encode (Item : Wide_String; Output_Scheme : Encoding_Scheme; Output_BOM : Boolean := False) return UTF_String; -- Encode Wide_String using UTF-8, UTF-16LE or UTF-16BE encoding as -- specified by the Output_Scheme parameter. function Encode (Item : Wide_String; Output_BOM : Boolean := False) return UTF_8_String; -- Encode Wide_String using UTF-8 encoding function Encode (Item : Wide_String; Output_BOM : Boolean := False) return UTF_16_Wide_String; -- Encode Wide_String using UTF_16 encoding -- The decoding routines take a UTF String as input, and return a decoded -- Wide_String. If the UTF String starts with a BOM that matches the -- encoding method, it is ignored. An incorrect BOM raises Encoding_Error. function Decode (Item : UTF_String; Input_Scheme : Encoding_Scheme) return Wide_String; -- The input is encoded in UTF_8, UTF_16LE or UTF_16BE as specified by the -- Input_Scheme parameter. It is decoded and returned as a Wide_String -- value. Note: a convenient form for scheme may be Encoding (UTF_String). function Decode (Item : UTF_8_String) return Wide_String; -- The input is encoded in UTF-8 and returned as a Wide_String value function Decode (Item : UTF_16_Wide_String) return Wide_String; -- The input is encoded in UTF-16 and returned as a Wide_String value end Ada.Strings.UTF_Encoding.Wide_Strings;
--------------------------------------------------------------------------------- -- package Banded_LU, LU decomposition, equation solving for banded matrices -- Copyright (C) 1995-2018 Jonathan S. Parker -- -- Permission to use, copy, modify, and/or distribute this software for any -- purpose with or without fee is hereby granted, provided that the above -- copyright notice and this permission notice appear in all copies. -- THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES -- WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF -- MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR -- ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES -- WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN -- ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF -- OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. --------------------------------------------------------------------------------- -- PACKAGE Banded_LU -- -- LU decomposition and linear equation solving for banded matrices. -- Uses Crout's method for LU decomposition of real valued matrices. -- There's no pivoting, so iterative refinement is provided. -- Iterative refinement can improve accuracy of equation solving -- in cases in which the matrices are not diagonally dominant. -- -- The decomposition can be performed on diagonal sub-blocks of -- the matrix. (The block size must be > bandwidwidth of the matrix -- or Constraint_Error is raised.) -- -- Diagonally dominant matrices are a special class that doesn't need -- pivoting in LU decomposition. A matrix is diagonally dominant if and -- only if the absolute val of each diagonal element is > or = the sum -- of the absolute vals of each off-diagonal on the same row as that diagonal -- element. -- -- In many cases non diagonally-dominant matrices are successfully -- handled by this package, but more error accumulates than would -- be present if we could do pivoting. -- Procedure Refine_Solution does Newton iterations to reduce the error -- in these solutions. Examples are provided in the test procedure. -- -- The banded matrix is constructed as an array of row vectors. -- Typically, the length of the row is very much smaller than the number -- of rows. For example, if the matrix is tri-diagonal, then each row vector -- has only three element. The middle element is the central diagonal of the -- matrix. -- -- The LU form of A can then be used to solve simultaneous linear -- equations of the form A X = B. The column vector B is input -- into procedure Solve, and the solution is returned as X. -- -- -- PROCEDURE LU_decompose -- -- matrix A: -- To correctly construct A remember that the 1st index identifies the -- row of the matrix element. The 2nd index of A is -- is the Diagonal_ID, which is 0 for the central diagonal, and -- negative for the lower diagonals. Diagonal_ID - Col - Row. -- -- Final_Index: -- The routine operates on a subset of full matrix. The subset -- matrix starts at Starting_Index, and ends at Final_Index. -- The matrix to be decomposed is logically (M X M) where -- M = Final_Index - Starting_Index + 1. It is assumed that all -- off-diagonals beyond No_Of_Off_Diagonals are 0.0. -- -- -- PROCEDURE Solve -- -- Solves for X in the equation A X = B. The matrix A_LU is -- LU of A. In other words L*U = A, L is stored in the lower triangular -- regions of A_LU, and U in the upper. (The original matrix A was written -- over with LU.) The output of LU_Decompose is in suitable form for "Solve". -- -- -- BANDED MATRIX FORMAT -- -- You translate (Row, Col) to (I, Diagonal_id) -- using the formula: I = Row, and Diagonal_id = Col - Row. -- -- The banded matrix looks like: -- -- Matrix (Row)(Diagonal_id) -- -- where Diagonal_id is in -- -- type Diag_Index is range -No_Of_Off_Diagonals..No_Of_Off_Diagonals; -- -- and the matrix element at (Row, Col) has Diagonal_id = Col - Row. -- -- Here is matrix-vector multiplication: -- -- for Row in Index loop -- Sum := 0.0; -- Start := Max(Diag_Index'First + Row, Index'First) -- Finish := Min(Diag_Index'Last + Row, Index'Last) -- for Col in Start..Finish loop -- Sum := Sum + Matrix(Row)(Col - Row) * Vector(Col); -- end loop; -- Result(Row) = Sum; -- end loop; -- -- Notice the outer index varies fastest this way, as Ada prefers. -- generic type Real is digits <>; Max_Size_Of_Matrix : Positive; No_Of_Off_Diagonals : Positive; -- If this is 1, then if the matrix is tri-diagonal. Must be less than -- Max_Size_Of_Matrix. If it equals or excedes Max_Size_Of_Matrix, then -- an assertion will detect failure. Notice 0 off_diagonals not allowed. package Banded_LU is pragma Assert (No_Of_Off_Diagonals < Max_Size_Of_Matrix); -- Number of off-diagonals must be less than size of matrix. subtype Index is Integer range 0..Max_Size_Of_Matrix-1; subtype Diag_Index is Integer range -No_Of_Off_Diagonals..No_Of_Off_Diagonals; -- There's arithmetic between these 2 indices, so we make them both type -- Integer. We also use fact that Diagonal_ID is symmetric about 0. type Row_Vector is array(Diag_Index) of Real; type Banded_Matrix is array(Index) of Row_Vector; -- The (Row, Col) element of the matrix is found at Matrix(Row)(Col - Row). type Column is array(Index) of Real; -- A column vector. procedure LU_Decompose (A : in out Banded_Matrix; Diag_Inverse : out Column; Final_Index : in Index := Index'Last; Starting_Index : in Index := Index'First); procedure Solve (X : out Column; B : in Column; A_LU : in Banded_Matrix; Diag_Inverse : in Column; Final_Index : in Index := Index'Last; Starting_Index : in Index := Index'First); -- Solves for X in A*X = B. A_LU is the LU decomp of A, as returned by -- LU_Decompose in matrix A. procedure Refine_Solution (X : out Column; B : in Column; A_LU : in Banded_Matrix; Diag_Inverse : in Column; A : in Banded_Matrix; No_Of_Iterations : in Natural := 1; Final_Index : in Index := Index'Last; Starting_Index : in Index := Index'First); -- Attempts to improve the numerical quality of solution of the linear -- equations by use of Newton iteration. -- (No pivoting is done in this version.) function Matrix_Val (A : Banded_Matrix; Row : Index; Col : Index) return Real; -- Given (Row, Column) the function returns the matrix element at -- that location. Translates (Row, Col) to (I, Diagonal_id) using -- the formula I = Row, and Diagonal_id = Col - Row. -- -- Banded Matrices are by definition 0 everywhere except on the diagonal -- bands. So 0 is returned if (Row, Col) is not in the banded region. function Product (A : in Banded_Matrix; X : in Column; Final_Index : in Index := Index'Last; Starting_Index : in Index := Index'First) return Column; -- Multiplies a banded matrix by a column vector X. -- Operates only on the diagonal block bounded by -- Starting_Row = Starting_Index, and Final_Row = Final_Index. private Zero : constant Real := +0.0; One : constant Real := +1.0; Two : constant Real := +2.0; Min_Allowed_Real : constant Real := Two ** (Real'Machine_Emin/4 + 2); end Banded_LU;
package tools is protected Output is procedure Puts(str: String; num:Natural:=0); end Output; generic type T is (<>); package Random_Generator IS --package Gen is new Ada.Numerics.Discrete_Random(T); function GetRandom return T; end Random_Generator; end tools;
pragma License (Unrestricted); -- implementation unit specialized for POSIX (Darwin, FreeBSD, or Linux) with C; package System.Zero_Terminated_Strings is pragma Preelaborate; function Value (Item : not null access constant C.char) return String; function Value (Item : not null access constant C.char; Length : C.size_t) return String; procedure To_C (Source : String; Result : not null access C.char); procedure To_C ( Source : String; Result : not null access C.char; Result_Length : out C.size_t); Expanding : constant := 1; -- UTF-8 to UTF-8 end System.Zero_Terminated_Strings;
-- { dg-do compile } package body Forward_Anon is function Get_Current return access Object is begin return Current_Object; end; end;
-- $Id: Sets.md,v 1.5 1993/08/18 15:06:51 grosch rel $ -- $Log: Sets.md,v $ -- Ich, Doktor Josef Grosch, Informatiker, Sept. 1994 with DynArray, Text_Io; use Text_Io; package Sets is package Bool_DA is new DynArray (Boolean); use Bool_DA; type tSet is record BitsetPtr : Bool_DA.FlexArray; MaxElmt : Integer; Card : Integer; FirstElmt , LastElmt : Integer; end record; procedure MakeSet (Set: in out tSet; MaxSize: Integer); procedure ResizeSet (Set: in out tSet; MaxSize: Integer); procedure ReleaseSet (Set: in out tSet); procedure Union (Set1: in out tSet; Set2: tSet); procedure Difference (Set1: in out tSet; Set2: tSet); procedure Intersection (Set1: in out tSet; Set2: tSet); procedure SymDiff (Set1: in out tSet; Set2: tSet); procedure Complement (Set: in out tSet); procedure Include (Set: in out tSet; Elmt: Integer); procedure Exclude (Set: in out tSet; Elmt: Integer); -- function Card (Set: tSet) return Integer; procedure Card (Set: in out tSet; Result: out Integer); function Size (Set: tSet) return Integer; -- function Minimum (Set: tSet) return Integer; procedure Minimum (Set: in out tSet; Result: out Integer); -- function Maximum (Set: tSet) return Integer; procedure Maximum (Set: in out tSet; Result: out Integer); -- function rSelect (Set: tSet) return Integer; procedure rSelect (Set: in out tSet; Result: out Integer); -- function Extract (Set: tSet) return Integer; procedure Extract (Set: in out tSet; Result: out Integer); function IsSubset (Set1, Set2: tSet) return Boolean; function IsStrictSubset(Set1, Set2: tSet) return Boolean; function IsEqual (Set1, Set2: tSet) return Boolean; function IsNotEqual (Set1, Set2: tSet) return Boolean; function IsElement (Elmt: Integer; Set: tSet) return Boolean; function IsEmpty (Set: tSet) return Boolean; generic with function ProcOfCardToBool (Elmt: Integer) return Boolean is <>; function Forall (Set: tSet) return Boolean; generic with function ProcOfCardToBool (Elmt: Integer) return Boolean is <>; function Exists (Set: tSet) return Boolean; generic with function ProcOfCardToBool (Elmt: Integer) return Boolean is <>; function Exists1 (Set: tSet) return Boolean; procedure Assign (Set1: out tSet; Set2: tSet); procedure AssignElmt (Set: out tSet; Elmt: Integer); procedure AssignEmpty (Set: in out tSet); generic with procedure ProcOfCard (Elmt: Integer) is <>; procedure ForallDo (Set: tSet); procedure ReadSet (f: File_Type; Set: out tSet); procedure WriteSet (f: File_Type; Set: tSet); end Sets;
with AUnit.Test_Fixtures; with AUnit.Test_Suites; package SHA1_Streams_Tests is function Suite return AUnit.Test_Suites.Access_Test_Suite; private type Fixture is new AUnit.Test_Fixtures.Test_Fixture with null record; procedure SHA1_Test (Object : in out Fixture); procedure SHA1_One_Million_Test (Object : in out Fixture); procedure SHA1_Extremely_Long_Test (Object : in out Fixture); end SHA1_Streams_Tests;
-- { dg-do run } with Ada.Direct_IO; procedure Test_Direct_IO is package BDIO is new Ada.Direct_IO (Boolean); use BDIO; FD : File_Type; begin Create (FD, Form => "shared=yes"); Reset (FD); Close (FD); end Test_Direct_IO;
-- ---------------------------------------------------------------- -- text_create.adb -- -- Oct/10/2011 -- -- ---------------------------------------------------------------- with Ada.Text_IO; use Ada.Text_IO; with Ada.Text_IO.Text_Streams; use Ada.Text_IO.Text_Streams; with Ada.Command_Line; -- ---------------------------------------------------------------- procedure text_create is procedure record_out_proc (Outfile : File_Type; key: in String; name: in String; population: in String; date_mod: in String) is begin Ada.Text_IO.Put_Line("*** record_out_proc ***"); String'Write (Stream (Outfile), key & ASCII.HT & name &ASCII.HT & population & ASCII.HT & date_mod & ASCII.LF); end record_out_proc; Outfile : File_Type; file_text : String := Ada.Command_Line.Argument (1); begin Ada.Text_IO.Put_Line("*** 開始 ***"); Create (File => Outfile, Mode => Out_File, Name => file_text); record_out_proc (Outfile,"t2381","名古屋","47325","1943-6-28"); record_out_proc (Outfile,"t2382","豊橋","82467","1943-3-15"); record_out_proc (Outfile,"t2383","岡崎","39254","1943-8-9"); record_out_proc (Outfile,"t2384","一宮","54792","1943-6-3"); record_out_proc (Outfile,"t2385","蒲郡","84327","1943-1-12"); record_out_proc (Outfile,"t2386","常滑","32198","1943-2-7"); record_out_proc (Outfile,"t2387","大府","54982","1943-10-21"); record_out_proc (Outfile,"t2388","瀬戸","97623","1943-5-12"); record_out_proc (Outfile,"t2389","犬山","47859","1943-4-24"); Close (Outfile); Ada.Text_IO.Put_Line("*** 終了 ***"); end Text_create; -- ----------------------------------------------------------------
-- { dg-do compile } -- { dg-options "-gnatws" } procedure Aggr17 is type Enum is (A, B); type Rec (D : Enum := Enum'First) is record case D is when A => X : Integer; when B => null; end case; end record; for Rec'Size use 128; pragma Volatile (Rec); type Config_T (D : Enum := Enum'First) is record N : Natural; R : Rec (D); end record; C : constant Config_T := (D => A, N => 1, R => (D => A, X => 0)); type Arr is array (Natural range 1 .. C.N) of Boolean; begin null; end;
-- { dg-do compile } procedure aggr8 is type Byte is mod 2 ** 8; subtype two is integer range 1..2; -- type Sequence is array (1 .. 2) of Byte; type Sequence is array (Two) of Byte; type Block is record Head : Sequence := (11, 22); end record; procedure Nest is Blk : Block; pragma Unreferenced (Blk); begin null; end; begin null; end;
with Ada.Strings.Bounded; package Labels is Max_Label_Length : constant := 128; package Bounded_Labels is new Ada.Strings.Bounded.Generic_Bounded_Length (Max_Label_Length); subtype Label_Type is Bounded_Labels.Bounded_String; function "+" (X : String) return Label_Type is (Bounded_Labels.To_Bounded_String (X)); function "+" (X : Label_Type) return String renames Bounded_Labels.To_String; end Labels;
------------------------------------------------------------------------------ -- -- -- GNAT COMPILER COMPONENTS -- -- -- -- A L L O C -- -- -- -- S p e c -- -- -- -- Copyright (C) 1992-2016, Free Software Foundation, Inc. -- -- -- -- GNAT is free software; you can redistribute it and/or modify it under -- -- terms of the GNU General Public License as published by the Free Soft- -- -- ware Foundation; either version 3, or (at your option) any later ver- -- -- sion. GNAT is distributed in the hope that it will be useful, but WITH- -- -- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY -- -- or FITNESS FOR A PARTICULAR PURPOSE. -- -- -- -- As a special exception under Section 7 of GPL version 3, you are granted -- -- additional permissions described in the GCC Runtime Library Exception, -- -- version 3.1, as published by the Free Software Foundation. -- -- -- -- You should have received a copy of the GNU General Public License and -- -- a copy of the GCC Runtime Library Exception along with this program; -- -- see the files COPYING3 and COPYING.RUNTIME respectively. If not, see -- -- <http://www.gnu.org/licenses/>. -- -- -- -- GNAT was originally developed by the GNAT team at New York University. -- -- Extensive contributions were provided by Ada Core Technologies Inc. -- -- -- ------------------------------------------------------------------------------ -- This package contains definitions for initial sizes and growth increments -- for the various dynamic arrays used for the main compiler data structures. -- The indicated initial size is allocated for the start of each file, and -- the increment factor is a percentage used to increase the table size when -- it needs expanding (e.g. a value of 100 = 100% increase = double) -- Note: the initial values here are multiplied by Table_Factor as set by the -- -gnatTnn switch. This variable is defined in Opt, as is the default value -- for the table factor. package Alloc is -- The comment shows the unit in which the table is defined All_Interp_Initial : constant := 1_000; -- Sem_Type All_Interp_Increment : constant := 100; Branches_Initial : constant := 1_000; -- Sem_Warn Branches_Increment : constant := 100; Conditionals_Initial : constant := 1_000; -- Sem_Warn Conditionals_Increment : constant := 100; Conditional_Stack_Initial : constant := 50; -- Sem_Warn Conditional_Stack_Increment : constant := 100; Elists_Initial : constant := 200; -- Elists Elists_Increment : constant := 100; Elmts_Initial : constant := 1_200; -- Elists Elmts_Increment : constant := 100; File_Name_Chars_Initial : constant := 10_000; -- Osint File_Name_Chars_Increment : constant := 100; In_Out_Warnings_Initial : constant := 100; -- Sem_Warn In_Out_Warnings_Increment : constant := 100; Ignored_Ghost_Units_Initial : constant := 20; -- Sem_Util Ignored_Ghost_Units_Increment : constant := 50; Inlined_Initial : constant := 100; -- Inline Inlined_Increment : constant := 100; Inlined_Bodies_Initial : constant := 50; -- Inline Inlined_Bodies_Increment : constant := 200; Interp_Map_Initial : constant := 200; -- Sem_Type Interp_Map_Increment : constant := 100; Lines_Initial : constant := 500; -- Sinput Lines_Increment : constant := 150; Linker_Option_Lines_Initial : constant := 5; -- Lib Linker_Option_Lines_Increment : constant := 200; Lists_Initial : constant := 4_000; -- Nlists Lists_Increment : constant := 200; Load_Stack_Initial : constant := 10; -- Lib Load_Stack_Increment : constant := 100; Name_Chars_Initial : constant := 50_000; -- Namet Name_Chars_Increment : constant := 100; Name_Qualify_Units_Initial : constant := 200; -- Exp_Dbug Name_Qualify_Units_Increment : constant := 300; Names_Initial : constant := 6_000; -- Namet Names_Increment : constant := 100; Nodes_Initial : constant := 50_000; -- Atree Nodes_Increment : constant := 100; Nodes_Release_Threshold : constant := 100_000; Notes_Initial : constant := 100; -- Lib Notes_Increment : constant := 200; Obsolescent_Warnings_Initial : constant := 50; -- Sem_Prag Obsolescent_Warnings_Increment : constant := 200; Orig_Nodes_Initial : constant := 50_000; -- Atree Orig_Nodes_Increment : constant := 100; Orig_Nodes_Release_Threshold : constant := 100_000; Pending_Instantiations_Initial : constant := 10; -- Inline Pending_Instantiations_Increment : constant := 100; Rep_Table_Initial : constant := 1000; -- Repinfo Rep_Table_Increment : constant := 200; Scope_Stack_Initial : constant := 10; -- Sem Scope_Stack_Increment : constant := 200; SFN_Table_Initial : constant := 10; -- Fname SFN_Table_Increment : constant := 200; Source_File_Initial : constant := 10; -- Sinput Source_File_Increment : constant := 200; String_Chars_Initial : constant := 2_500; -- Stringt String_Chars_Increment : constant := 150; Strings_Initial : constant := 5_00; -- Stringt Strings_Increment : constant := 150; Successors_Initial : constant := 2_00; -- Inline Successors_Increment : constant := 100; Udigits_Initial : constant := 10_000; -- Uintp Udigits_Increment : constant := 100; Uints_Initial : constant := 5_000; -- Uintp Uints_Increment : constant := 100; Units_Initial : constant := 30; -- Lib Units_Increment : constant := 100; Ureals_Initial : constant := 200; -- Urealp Ureals_Increment : constant := 100; Unreferenced_Entities_Initial : constant := 1_000; -- Sem_Warn Unreferenced_Entities_Increment : constant := 100; Warnings_Off_Pragmas_Initial : constant := 500; -- Sem_Warn Warnings_Off_Pragmas_Increment : constant := 100; With_List_Initial : constant := 10; -- Features With_List_Increment : constant := 300; Xrefs_Initial : constant := 5_000; -- Cross-refs Xrefs_Increment : constant := 300; Drefs_Initial : constant := 5; -- Dereferences Drefs_Increment : constant := 1_000; end Alloc;
with Ada.Text_IO.Formatting; with System.Formatting.Float; with System.Formatting.Literals.Float; package body Ada.Text_IO.Float_IO is procedure Put_To_Field ( To : out String; Fore_Last, Last : out Natural; Item : Num; Aft : Field; Exp : Field); procedure Put_To_Field ( To : out String; Fore_Last, Last : out Natural; Item : Num; Aft : Field; Exp : Field) is Triming_Sign_Marks : constant System.Formatting.Sign_Marks := ('-', System.Formatting.No_Sign, System.Formatting.No_Sign); Aft_Width : constant Field := Field'Max (1, Aft); begin if Exp /= 0 then System.Formatting.Float.Image ( Long_Long_Float (Item), To, Fore_Last, Last, Signs => Triming_Sign_Marks, Aft_Width => Aft_Width, Exponent_Digits_Width => Exp - 1); -- excluding '.' else System.Formatting.Float.Image_No_Exponent ( Long_Long_Float (Item), To, Fore_Last, Last, Signs => Triming_Sign_Marks, Aft_Width => Aft_Width); end if; end Put_To_Field; procedure Get_From_Field ( From : String; Item : out Num; Last : out Positive); procedure Get_From_Field ( From : String; Item : out Num; Last : out Positive) is Base_Item : Long_Long_Float; Error : Boolean; begin System.Formatting.Literals.Float.Get_Literal ( From, Last, Base_Item, Error => Error); if Error or else Base_Item not in Long_Long_Float (Num'First) .. Long_Long_Float (Num'Last) then raise Data_Error; end if; Item := Num (Base_Item); end Get_From_Field; -- implementation procedure Get ( File : File_Type; Item : out Num; Width : Field := 0) is begin if Width /= 0 then declare S : String (1 .. Width); Last_1 : Natural; Last_2 : Natural; begin Formatting.Get_Field (File, S, Last_1); -- checking the predicate Get_From_Field (S (1 .. Last_1), Item, Last_2); if Last_2 /= Last_1 then raise Data_Error; end if; end; else declare S : constant String := Formatting.Get_Numeric_Literal ( File, -- checking the predicate Real => True); Last : Natural; begin Get_From_Field (S, Item, Last); if Last /= S'Last then raise Data_Error; end if; end; end if; end Get; procedure Get ( Item : out Num; Width : Field := 0) is begin Get (Current_Input.all, Item, Width); end Get; procedure Get ( File : not null File_Access; Item : out Num; Width : Field := 0) is begin Get (File.all, Item, Width); end Get; procedure Put ( File : File_Type; Item : Num; Fore : Field := Default_Fore; Aft : Field := Default_Aft; Exp : Field := Default_Exp) is S : String (1 .. Long_Long_Float'Width + Fore + Aft + Exp); Fore_Last, Last : Natural; Width : Field; begin Put_To_Field (S, Fore_Last, Last, Item, Aft, Exp); if Fore_Last = Last then -- infinity or NaN, reserve a minimum width Width := Fore + 1 + Aft; if Exp /= 0 then Width := Width + 1 + Exp; end if; else Width := Last - Fore_Last + Fore; end if; Formatting.Tail ( File, -- checking the predicate S (1 .. Last), Width); end Put; procedure Put ( Item : Num; Fore : Field := Default_Fore; Aft : Field := Default_Aft; Exp : Field := Default_Exp) is begin Put (Current_Output.all, Item, Fore, Aft, Exp); end Put; procedure Put ( File : not null File_Access; Item : Num; Fore : Field := Default_Fore; Aft : Field := Default_Aft; Exp : Field := Default_Exp) is begin Put (File.all, Item, Fore, Aft, Exp); end Put; procedure Get ( From : String; Item : out Num; Last : out Positive) is begin Formatting.Get_Tail (From, First => Last); Get_From_Field (From (Last .. From'Last), Item, Last); end Get; procedure Put ( To : out String; Item : Num; Aft : Field := Default_Aft; Exp : Field := Default_Exp) is S : String (1 .. Long_Long_Float'Width + Aft + Exp); Fore_Last, Last : Natural; begin Put_To_Field (S, Fore_Last, Last, Item, Aft, Exp); Formatting.Tail (To, S (1 .. Last)); end Put; procedure Put ( To : out String; Last : out Natural; Item : Num; Aft : Field := Default_Aft; Exp : Field := Default_Exp) is Fore_Last : Natural; begin Put_To_Field (To, Fore_Last, Last, Item, Aft, Exp); end Put; end Ada.Text_IO.Float_IO;
address=/p.tanx.com/0.0.0.0 address=/googlesyndication.com/0.0.0.0 address=/linkvans.com/0.0.0.0 server=/valf.atm.youku.com/114.114.114.114
------------------------------------------------------------------------------ -- -- -- GNAT COMPILER COMPONENTS -- -- -- -- P R J . E X T -- -- -- -- B o d y -- -- -- -- Copyright (C) 2000-2005, Free Software Foundation, Inc. -- -- -- -- GNAT is free software; you can redistribute it and/or modify it under -- -- terms of the GNU General Public License as published by the Free Soft- -- -- ware Foundation; either version 2, or (at your option) any later ver- -- -- sion. GNAT is distributed in the hope that it will be useful, but WITH- -- -- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY -- -- or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -- -- for more details. You should have received a copy of the GNU General -- -- Public License distributed with GNAT; see file COPYING. If not, write -- -- to the Free Software Foundation, 51 Franklin Street, Fifth Floor, -- -- Boston, MA 02110-1301, USA. -- -- -- -- GNAT was originally developed by the GNAT team at New York University. -- -- Extensive contributions were provided by Ada Core Technologies Inc. -- -- -- ------------------------------------------------------------------------------ with Namet; use Namet; with Output; use Output; with Osint; use Osint; with Sdefault; with GNAT.HTable; package body Prj.Ext is Gpr_Project_Path : constant String := "GPR_PROJECT_PATH"; Ada_Project_Path : constant String := "ADA_PROJECT_PATH"; -- Name of the env. variables that contain path name(s) of directories -- where project files may reside. GPR_PROJECT_PATH has precedence over -- ADA_PROJECT_PATH. Gpr_Prj_Path : constant String_Access := Getenv (Gpr_Project_Path); Ada_Prj_Path : constant String_Access := Getenv (Ada_Project_Path); -- The path name(s) of directories where project files may reside. -- May be empty. No_Project_Default_Dir : constant String := "-"; Current_Project_Path : String_Access; -- The project path. Initialized during elaboration of package Contains at -- least the current working directory. package Htable is new GNAT.HTable.Simple_HTable (Header_Num => Header_Num, Element => Name_Id, No_Element => No_Name, Key => Name_Id, Hash => Hash, Equal => "="); -- External references are stored in this hash table, either by procedure -- Add (directly or through a call to function Check) or by function -- Value_Of when an environment variable is found non empty. Value_Of -- first for external reference in this table, before checking the -- environment. Htable is emptied (reset) by procedure Reset. --------- -- Add -- --------- procedure Add (External_Name : String; Value : String) is The_Key : Name_Id; The_Value : Name_Id; begin Name_Len := Value'Length; Name_Buffer (1 .. Name_Len) := Value; The_Value := Name_Find; Name_Len := External_Name'Length; Name_Buffer (1 .. Name_Len) := External_Name; Canonical_Case_File_Name (Name_Buffer (1 .. Name_Len)); The_Key := Name_Find; Htable.Set (The_Key, The_Value); end Add; ----------- -- Check -- ----------- function Check (Declaration : String) return Boolean is begin for Equal_Pos in Declaration'Range loop if Declaration (Equal_Pos) = '=' then exit when Equal_Pos = Declaration'First; exit when Equal_Pos = Declaration'Last; Add (External_Name => Declaration (Declaration'First .. Equal_Pos - 1), Value => Declaration (Equal_Pos + 1 .. Declaration'Last)); return True; end if; end loop; return False; end Check; ------------------ -- Project_Path -- ------------------ function Project_Path return String is begin return Current_Project_Path.all; end Project_Path; ----------- -- Reset -- ----------- procedure Reset is begin Htable.Reset; end Reset; ---------------------- -- Set_Project_Path -- ---------------------- procedure Set_Project_Path (New_Path : String) is begin Free (Current_Project_Path); Current_Project_Path := new String'(New_Path); end Set_Project_Path; -------------- -- Value_Of -- -------------- function Value_Of (External_Name : Name_Id; With_Default : Name_Id := No_Name) return Name_Id is The_Value : Name_Id; Name : String := Get_Name_String (External_Name); begin Canonical_Case_File_Name (Name); Name_Len := Name'Length; Name_Buffer (1 .. Name_Len) := Name; The_Value := Htable.Get (Name_Find); if The_Value /= No_Name then return The_Value; end if; -- Find if it is an environment, if it is, put value in the hash table declare Env_Value : String_Access := Getenv (Name); begin if Env_Value /= null and then Env_Value'Length > 0 then Name_Len := Env_Value'Length; Name_Buffer (1 .. Name_Len) := Env_Value.all; The_Value := Name_Find; Htable.Set (External_Name, The_Value); Free (Env_Value); return The_Value; else Free (Env_Value); return With_Default; end if; end; end Value_Of; begin -- Initialize Current_Project_Path during package elaboration declare Add_Default_Dir : Boolean := True; First : Positive; Last : Positive; New_Len : Positive; New_Last : Positive; Prj_Path : String_Access := Gpr_Prj_Path; begin if Gpr_Prj_Path.all /= "" then -- Warn if both environment variables are defined if Ada_Prj_Path.all /= "" then Write_Line ("Warning: ADA_PROJECT_PATH is not taken into account"); Write_Line (" when GPR_PROJECT_PATH is defined"); end if; else Prj_Path := Ada_Prj_Path; end if; -- The current directory is always first Name_Len := 1; Name_Buffer (Name_Len) := '.'; -- If environment variable is defined and not empty, add its content if Prj_Path.all /= "" then Name_Len := Name_Len + 1; Name_Buffer (Name_Len) := Path_Separator; Add_Str_To_Name_Buffer (Prj_Path.all); -- Scan the directory path to see if "-" is one of the directories. -- Remove each occurence of "-" and set Add_Default_Dir to False. -- Also resolve relative paths and symbolic links. First := 3; loop while First <= Name_Len and then (Name_Buffer (First) = Path_Separator) loop First := First + 1; end loop; exit when First > Name_Len; Last := First; while Last < Name_Len and then Name_Buffer (Last + 1) /= Path_Separator loop Last := Last + 1; end loop; -- If the directory is "-", set Add_Default_Dir to False and -- remove from path. if Name_Buffer (First .. Last) = No_Project_Default_Dir then Add_Default_Dir := False; for J in Last + 1 .. Name_Len loop Name_Buffer (J - No_Project_Default_Dir'Length - 1) := Name_Buffer (J); end loop; Name_Len := Name_Len - No_Project_Default_Dir'Length - 1; else declare New_Dir : constant String := Normalize_Pathname (Name_Buffer (First .. Last)); begin -- If the absolute path was resolved and is different from -- the original, replace original with the resolved path. if New_Dir /= Name_Buffer (First .. Last) and then New_Dir'Length /= 0 then New_Len := Name_Len + New_Dir'Length - (Last - First + 1); New_Last := First + New_Dir'Length - 1; Name_Buffer (New_Last + 1 .. New_Len) := Name_Buffer (Last + 1 .. Name_Len); Name_Buffer (First .. New_Last) := New_Dir; Name_Len := New_Len; Last := New_Last; end if; end; end if; First := Last + 1; end loop; end if; -- Set the initial value of Current_Project_Path if Add_Default_Dir then Current_Project_Path := new String'(Name_Buffer (1 .. Name_Len) & Path_Separator & Sdefault.Search_Dir_Prefix.all & ".." & Directory_Separator & ".." & Directory_Separator & ".." & Directory_Separator & "gnat"); else Current_Project_Path := new String'(Name_Buffer (1 .. Name_Len)); end if; end; end Prj.Ext;
with System.Storage_Elements; package body Ada.Command_Line.Argument_Parsing is use type System.Address; use type System.Storage_Elements.Storage_Offset; function memchr ( s : System.Address; c : Integer; n : System.Storage_Elements.Storage_Count) return System.Address with Import, Convention => Intrinsic, External_Name => "__builtin_memchr"; procedure unreachable with Import, Convention => Intrinsic, External_Name => "__builtin_unreachable"; pragma No_Return (unreachable); function Match ( Argument : String; Position : aliased in out Cursor; Short_Name : Character; Option : Option_Character := ' ') return Boolean; function Match ( Argument : String; Position : aliased in out Cursor; Short_Name : Character; Option : Option_Character := ' ') return Boolean is begin if Argument (Position.Index) = Short_Name then case Option is when ' ' => return True; when ':' | '?' => if Position.Index = Argument'First + 1 then Position.Option_Index := Position.Index + 1; if Option = ':' or else Position.Option_Index <= Argument'Last then Position.Has_Value := True; end if; return True; else return False; end if; end case; else return False; end if; end Match; function Match ( Argument : String; Position : aliased in out Cursor; Long_Name : String; Option : Option_Character := ' ') return Boolean; function Match ( Argument : String; Position : aliased in out Cursor; Long_Name : String; Option : Option_Character := ' ') return Boolean is begin if Argument (Position.Index .. Position.Option_Index - 2) = Long_Name then case Option is when ' ' => return Position.Option_Index - 2 = Argument'Last; when ':' | '?' => if Option = ':' or else Position.Option_Index - 1 <= Argument'Last then Position.Has_Value := True; end if; return True; end case; else return False; end if; end Match; -- implementation function Has_Element (Position : Cursor) return Boolean is begin return Position.Index > 0; end Has_Element; function Iterate (Argument : String; Initial_State : State_Type) return Argument_Iterator is First : Cursor; begin First.State := Initial_State; First.Has_Value := False; if not Initial_State.Not_Option and then Argument'First + 1 <= Argument'Last -- "-" is not option and then Argument (Argument'First) = '-' then if Argument (Argument'First + 1) = '-' then if Argument'First + 1 = Argument'Last then First.State.Not_Option := True; First.Kind := Double_Hyphen; First.Index := 0; -- No_Element First.Option_Index := 0; else First.Kind := Long_Option; First.Index := Argument'First + 2; declare S : constant System.Address := Argument (First.Index)'Address; P : constant System.Address := memchr ( S, Character'Pos ('='), System.Storage_Elements.Storage_Offset ( Argument'Last - First.Index + 1)); begin if P = System.Null_Address then First.Option_Index := Argument'Last + 2; else First.Option_Index := First.Index + Integer (P - S + 1); end if; end; end if; else First.Kind := Short_Option; First.Index := Argument'First + 1; First.Option_Index := Argument'Last + 1; end if; else if First.State.Posixly_Correct then First.State.Not_Option := True; end if; First.Kind := Not_Option; First.Index := Argument'First; First.Option_Index := Argument'Last + 1; end if; return Argument_Iterator'(First => First); end Iterate; function State (Iterator : Argument_Iterator) return State_Type is begin return Iterator.First.State; end State; function Is_Option ( Argument : String; Position : aliased in out Cursor; Short_Name : Character; Option : Option_Character := ' ') return Boolean is begin case Position.Kind is when Short_Option => return Match (Argument, Position, Short_Name, Option); when others => return False; end case; end Is_Option; function Is_Option ( Argument : String; Position : aliased in out Cursor; Long_Name : String; Option : Option_Character := ' ') return Boolean is begin case Position.Kind is when Long_Option => return Match (Argument, Position, Long_Name, Option); when others => return False; end case; end Is_Option; function Is_Option ( Argument : String; Position : aliased in out Cursor; Short_Name : Character; Long_Name : String; Option : Option_Character := ' ') return Boolean is begin case Position.Kind is when Short_Option => return Match (Argument, Position, Short_Name, Option); when Long_Option => return Match (Argument, Position, Long_Name, Option); when others => return False; end case; end Is_Option; function Is_Unknown_Option ( Argument : String; Position : aliased in out Cursor) return Boolean is begin case Position.Kind is when Short_Option => return True; when Long_Option => if Position.Option_Index - 1 <= Argument'Last then Position.Has_Value := True; end if; return True; when others => return False; end case; end Is_Unknown_Option; function Name (Argument : String; Position : Cursor) return String is begin case Position.Kind is when Short_Option => return ('-', Argument (Position.Index)); when Long_Option => return Argument (Argument'First .. Position.Option_Index - 2); when others => pragma Check (Pre, Boolean'(raise Constraint_Error)); unreachable; end case; end Name; function Short_Name (Argument : String; Position : Cursor) return Character is begin case Position.Kind is when Short_Option => return Argument (Position.Index); when Long_Option => return Character'Val (0); when others => pragma Check (Pre, Boolean'(raise Constraint_Error)); unreachable; end case; end Short_Name; function Long_Name (Argument : String; Position : Cursor) return String is begin case Position.Kind is when Short_Option => return ""; when Long_Option => return Argument (Position.Index .. Position.Option_Index - 2); when others => pragma Check (Pre, Boolean'(raise Constraint_Error)); unreachable; end case; end Long_Name; function Has_Value (Argument : String; Position : Cursor) return Value_Location is begin case Position.Kind is when Short_Option => if Position.Has_Value then if Position.Option_Index <= Argument'Last then return Same; else return Next; end if; else return None; end if; when Long_Option => if Position.Has_Value then if Position.Option_Index - 1 <= Argument'Last then return Same; else return Next; end if; else return None; end if; when others => pragma Check (Pre, Boolean'(raise Constraint_Error)); unreachable; end case; end Has_Value; function Value (Argument : String; Position : Cursor) return String is begin case Position.Kind is when Short_Option | Long_Option => return Argument (Position.Option_Index .. Argument'Last); when others => pragma Check (Pre, Boolean'(raise Constraint_Error)); unreachable; end case; end Value; function First (Object : Argument_Iterator) return Cursor is begin return Object.First; end First; function Next (Object : Argument_Iterator; Position : Cursor) return Cursor is pragma Unreferenced (Object); begin case Position.Kind is when Short_Option => if Position.Index < Position.Option_Index - 1 then return Result : Cursor := Position do Result.Index := Result.Index + 1; end return; else return No_Element; end if; when others => return No_Element; end case; end Next; end Ada.Command_Line.Argument_Parsing;
package array2 is type RIC_TYPE is (RIC1, RIC2); for RIC_TYPE'SIZE use 32; function MAX return Integer; end array2;
package body Reverser with SPARK_Mode is procedure Reverse_Array (A : in out Array_Of_Items) is begin for I in A'Range loop exit when Is_Full; Push (A (I)); end loop; for J in A'Range loop exit when Is_Empty; Pop (A (J)); end loop; end Reverse_Array; end Reverser;
with Ada.Text_IO, History_Variables; procedure Test_History is package Int_With_Hist is new History_Variables(Integer); -- define a history variable I: Int_With_Hist.Variable; Sum: Integer := 0; begin -- assign three values I.Set(3); I.Set(I.Get + 4); I.Set(9); -- non-destructively display the history for N in reverse 0 .. I.Defined-1 loop Ada.Text_IO.Put(Integer'Image(I.Peek(N))); end loop; Ada.Text_IO.New_Line; -- recall the three values while I.Defined > 0 loop Sum := Sum + I.Get; I.Undo; end loop; Ada.Text_IO.Put_Line(Integer'Image(Sum)); end Test_History;
-- { dg-do run } -- { dg-options "-gnat12" } procedure In_Out_Parameter2 is function F (I : In Out Integer) return Boolean is A : Integer := I; begin I := I + 1; return (A > 0); end; I : Integer := 0; B : Boolean; begin B := F (I); if B then raise Program_Error; end if; if I /= 1 then raise Program_Error; end if; end;
-- Auto_Counters_Suite.Refcounted_KVFlyweights_Tests -- Unit tests for Auto_Counters Refcounted KVFlyweights packages -- Copyright (c) 2016, James Humphry - see LICENSE file for details with AUnit; use AUnit; with AUnit.Test_Cases; use AUnit.Test_Cases; package Auto_Counters_Suite.Refcounted_KVFlyweights_Tests is type Refcounted_KVFlyweights_Test is new Test_Cases.Test_Case with null record; procedure Register_Tests (T: in out Refcounted_KVFlyweights_Test); function Name (T : Refcounted_KVFlyweights_Test) return Test_String; procedure Set_Up (T : in out Refcounted_KVFlyweights_Test); procedure Check_Basic_Usage (T : in out Test_Cases.Test_Case'Class); procedure Check_Basic_Refs_Usage (T : in out Test_Cases.Test_Case'Class); procedure Check_Protected_Usage (T : in out Test_Cases.Test_Case'Class); procedure Check_Protected_Refs_Usage (T : in out Test_Cases.Test_Case'Class); end Auto_Counters_Suite.Refcounted_KVFlyweights_Tests;
-- C43205K.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 THE BOUNDS OF A POSITIONAL AGGREGATE ARE DETERMINED -- CORRECTLY. IN PARTICULAR, CHECK THAT THE LOWER BOUND IS GIVEN BY -- THE LOWER BOUND OF THE APPLICABLE INDEX CONSTRAINT WHEN THE -- POSITIONAL AGGREGATE IS USED AS: -- THE EXPRESSION OF AN ENCLOSING RECORD OR ARRAY AGGREGATE, AND -- THE EXPRESSION GIVES THE VALUE OF A RECORD OR ARRAY COMPONENT -- (WHICH IS NECESSARILY CONSTRAINED). -- EG 01/27/84 -- JBG 3/30/84 WITH REPORT; PROCEDURE C43205K IS USE REPORT; BEGIN TEST("C43205K", "THE EXPRESSION OF AN ENCLOSING RECORD " & "OR ARRAY AGGREGATE, AND THE EXPRESSION GIVES " & "THE VALUE OF A RECORD OR ARRAY COMPONENT"); BEGIN CASE_K : BEGIN CASE_K1 : DECLARE SUBTYPE SK1 IS INTEGER RANGE 2 .. 6; TYPE BASE IS ARRAY(SK1 RANGE <>) OF INTEGER; SUBTYPE TE1 IS BASE(IDENT_INT(3) .. 5); TYPE TE2 IS ARRAY(1 .. 2) OF TE1; E1 : TE2; BEGIN E1 := (1 .. 2 => (3, 2, 1)); IF (E1'FIRST /= 1 OR E1'LAST /= 2) OR ELSE (E1(1)'FIRST /= 3 OR E1(1)'LAST /= 5 OR E1(2)'FIRST /= 3 OR E1(2)'LAST /= 5) THEN FAILED ("CASE K1 : INCORRECT BOUNDS"); ELSE IF E1 /= (1 .. 2 => (3, 2, 1)) THEN FAILED ("CASE K1 : ARRAY DOES NOT " & "CONTAIN THE CORRECT VALUES"); END IF; END IF; END CASE_K1; CASE_K2 : DECLARE TYPE SK2 IS RANGE 2 .. 6; TYPE BASE IS ARRAY(SK2 RANGE <>) OF INTEGER; SUBTYPE TE1 IS BASE(3 .. 5); TYPE TER IS RECORD REC : TE1; END RECORD; E2 : TER; BEGIN E2 := (REC => (3, 2, 1)); IF E2.REC'FIRST /= 3 OR E2.REC'LAST /= 5 THEN FAILED ("CASE K2 : INCORRECT BOUNDS"); ELSE IF E2.REC /= (3, 2, 1) THEN FAILED ("CASE K2 : ARRAY DOES NOT " & "CONTAIN CORRECT VALUES"); END IF; END IF; END CASE_K2; END CASE_K; END; RESULT; END C43205K;
------------------------------------------------------------------------------ -- -- -- GNAT RUN-TIME COMPONENTS -- -- -- -- A D A . S T R I N G S . M A P S -- -- -- -- B o d y -- -- -- -- Copyright (C) 1992-2021, Free Software Foundation, Inc. -- -- -- -- GNAT is free software; you can redistribute it and/or modify it under -- -- terms of the GNU General Public License as published by the Free Soft- -- -- ware Foundation; either version 3, or (at your option) any later ver- -- -- sion. GNAT is distributed in the hope that it will be useful, but WITH- -- -- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY -- -- or FITNESS FOR A PARTICULAR PURPOSE. -- -- -- -- -- -- -- -- -- -- -- -- You should have received a copy of the GNU General Public License and -- -- a copy of the GCC Runtime Library Exception along with this program; -- -- see the files COPYING3 and COPYING.RUNTIME respectively. If not, see -- -- <http://www.gnu.org/licenses/>. -- -- -- -- GNAT was originally developed by the GNAT team at New York University. -- -- Extensive contributions were provided by Ada Core Technologies Inc. -- -- -- ------------------------------------------------------------------------------ -- Note: parts of this code are derived from the ADAR.CSH public domain -- Ada 83 versions of the Appendix C string handling packages. The main -- differences are that we avoid the use of the minimize function which -- is bit-by-bit or character-by-character and therefore rather slow. -- Generally for character sets we favor the full 32-byte representation. package body Ada.Strings.Maps is --------- -- "-" -- --------- function "-" (Left, Right : Character_Set) return Character_Set is begin return Left and not Right; end "-"; --------- -- "=" -- --------- function "=" (Left, Right : Character_Set) return Boolean is begin return Character_Set_Internal (Left) = Character_Set_Internal (Right); end "="; ----------- -- "and" -- ----------- function "and" (Left, Right : Character_Set) return Character_Set is begin return Character_Set (Character_Set_Internal (Left) and Character_Set_Internal (Right)); end "and"; ----------- -- "not" -- ----------- function "not" (Right : Character_Set) return Character_Set is begin return Character_Set (not Character_Set_Internal (Right)); end "not"; ---------- -- "or" -- ---------- function "or" (Left, Right : Character_Set) return Character_Set is begin return Character_Set (Character_Set_Internal (Left) or Character_Set_Internal (Right)); end "or"; ----------- -- "xor" -- ----------- function "xor" (Left, Right : Character_Set) return Character_Set is begin return Character_Set (Character_Set_Internal (Left) xor Character_Set_Internal (Right)); end "xor"; ----------- -- Is_In -- ----------- function Is_In (Element : Character; Set : Character_Set) return Boolean is begin return Set (Element); end Is_In; --------------- -- Is_Subset -- --------------- function Is_Subset (Elements : Character_Set; Set : Character_Set) return Boolean is begin return (Elements and Set) = Elements; end Is_Subset; --------------- -- To_Domain -- --------------- function To_Domain (Map : Character_Mapping) return Character_Sequence is Result : String (1 .. Map'Length); J : Natural; begin J := 0; for C in Map'Range loop if Map (C) /= C then J := J + 1; Result (J) := C; end if; end loop; return Result (1 .. J); end To_Domain; ---------------- -- To_Mapping -- ---------------- function To_Mapping (From, To : Character_Sequence) return Character_Mapping is Result : Character_Mapping; Inserted : Character_Set := Null_Set; From_Len : constant Natural := From'Length; To_Len : constant Natural := To'Length; begin if From_Len /= To_Len then raise Strings.Translation_Error; end if; for Char in Character loop Result (Char) := Char; end loop; for J in From'Range loop if Inserted (From (J)) then raise Strings.Translation_Error; end if; Result (From (J)) := To (J - From'First + To'First); Inserted (From (J)) := True; end loop; return Result; end To_Mapping; -------------- -- To_Range -- -------------- function To_Range (Map : Character_Mapping) return Character_Sequence is Result : String (1 .. Map'Length); J : Natural; begin J := 0; for C in Map'Range loop if Map (C) /= C then J := J + 1; Result (J) := Map (C); end if; end loop; return Result (1 .. J); end To_Range; --------------- -- To_Ranges -- --------------- function To_Ranges (Set : Character_Set) return Character_Ranges is Max_Ranges : Character_Ranges (1 .. Set'Length / 2 + 1); Range_Num : Natural; C : Character; begin C := Character'First; Range_Num := 0; loop -- Skip gap between subsets while not Set (C) loop exit when C = Character'Last; C := Character'Succ (C); end loop; exit when not Set (C); Range_Num := Range_Num + 1; Max_Ranges (Range_Num).Low := C; -- Span a subset loop exit when not Set (C) or else C = Character'Last; C := Character'Succ (C); end loop; if Set (C) then Max_Ranges (Range_Num). High := C; exit; else Max_Ranges (Range_Num). High := Character'Pred (C); end if; end loop; return Max_Ranges (1 .. Range_Num); end To_Ranges; ----------------- -- To_Sequence -- ----------------- function To_Sequence (Set : Character_Set) return Character_Sequence is Result : String (1 .. Character'Pos (Character'Last) + 1); Count : Natural := 0; begin for Char in Set'Range loop if Set (Char) then Count := Count + 1; Result (Count) := Char; end if; end loop; return Result (1 .. Count); end To_Sequence; ------------ -- To_Set -- ------------ function To_Set (Ranges : Character_Ranges) return Character_Set is Result : Character_Set; begin for C in Result'Range loop Result (C) := False; end loop; for R in Ranges'Range loop for C in Ranges (R).Low .. Ranges (R).High loop Result (C) := True; end loop; end loop; return Result; end To_Set; function To_Set (Span : Character_Range) return Character_Set is Result : Character_Set; begin for C in Result'Range loop Result (C) := False; end loop; for C in Span.Low .. Span.High loop Result (C) := True; end loop; return Result; end To_Set; function To_Set (Sequence : Character_Sequence) return Character_Set is Result : Character_Set := Null_Set; begin for J in Sequence'Range loop Result (Sequence (J)) := True; end loop; return Result; end To_Set; function To_Set (Singleton : Character) return Character_Set is Result : Character_Set := Null_Set; begin Result (Singleton) := True; return Result; end To_Set; ----------- -- Value -- ----------- function Value (Map : Character_Mapping; Element : Character) return Character is begin return Map (Element); end Value; end Ada.Strings.Maps;
with Ada.Command_Line; use Ada.Command_Line; with Ada.Exceptions; use Ada.Exceptions; with Ada.Text_IO; use Ada.Text_IO; with Ada.Integer_Text_IO; use Ada.Integer_Text_IO; with TJa.Sockets; use TJa.Sockets; with TJa.Window.Text; use TJa.Window.Text; with TJa.Window.Elementary; use TJa.Window.Elementary; with TJa.Window.Graphic; use TJa.Window.Graphic; with TJa.Keyboard; use TJa.Keyboard; with Yatzy_graphics_package; use Yatzy_graphics_package; procedure Test is procedure Test_TJa is Own_Protocoll, Other_Protocoll: Protocoll_Type; Selected_Place : Integer; begin Reset_Colours; -- Standard colours is supposed to be black on white ... Clear_Window; Set_Graphical_Mode(On); background; protocoll_background(125, 4); logo_background(24, 4); message(38, 18, "Hejsan"); -- Draw a rectangle on screen ... --Set_Graphical_Mode(On); for I in 1..15 loop case I is when 1 => Own_Protocoll(I) := 1; when 2 => Own_Protocoll(I) := 2; when 3 => Own_Protocoll(I) := 3; when 4 => Own_Protocoll(I) := 4; when 5 => Own_Protocoll(I) := 5; when 6 => Own_Protocoll(I) := -1; when 7 => Own_Protocoll(I) := -1; when 8 => Own_Protocoll(I) := -1; when 9 => Own_Protocoll(I) := -1; when 10 => Own_Protocoll(I) := -1; when 11 => Own_Protocoll(I) := -1; when 12 => Own_Protocoll(I) := 15; when 13 => Own_Protocoll(I) := -1; when 14 => Own_Protocoll(I) := 15; when 15 => Own_Protocoll(I) := -1; when others => null; -- Own_Protocoll(I) := I; end case; end loop; for I in 1..15 loop Other_Protocoll(I) := I; end loop; update_protocoll(125, 4, Own_Protocoll, Other_Protocoll); for x in 1..5 loop dice(x,8 + 15 * x, 38); --dice_placement; end loop; logo(24, 4); Set_Graphical_Mode(Off); place(Own_Protocoll, Selected_Place); Reset_Colours; Reset_Text_Modes; -- Resets boold mode ... end Test_TJa; begin Test_TJa; Skip_Line; end;
------------------------------------------------------------------------------ -- -- -- GNAT EXAMPLE -- -- -- -- Copyright (C) 2014, Free Software Foundation, Inc. -- -- -- -- GNAT is free software; you can redistribute it and/or modify it under -- -- terms of the GNU General Public License as published by the Free Soft- -- -- ware Foundation; either version 3, or (at your option) any later ver- -- -- sion. GNAT is distributed in the hope that it will be useful, but WITH- -- -- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY -- -- or FITNESS FOR A PARTICULAR PURPOSE. -- -- -- -- -- -- -- -- -- -- -- -- 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 register declarations for those actually used by this -- demonstration, for the STM32F4 (ARM Cortex M4F) microcontrollers from -- ST Microelectronics. with System; with STM32F4; use STM32F4; with STM32F4.GPIO; use STM32F4.GPIO; with STM32F4.Reset_Clock_Control; use STM32F4.Reset_Clock_Control; with STM32F4.SYSCONFIG_Control; use STM32F4.SYSCONFIG_Control; package Registers is pragma Warnings (Off, "*may call Last_Chance_Handler"); pragma Warnings (Off, "*may be incompatible with alignment of object"); RCC : RCC_Register with Volatile, Address => System'To_Address (RCC_Base); GPIOA : GPIO_Register with Volatile, Address => System'To_Address (GPIOA_Base); pragma Import (Ada, GPIOA); GPIOD : GPIO_Register with Volatile, Address => System'To_Address (GPIOD_Base); pragma Import (Ada, GPIOD); EXTI : EXTI_Register with Volatile, Address => System'To_Address (EXTI_Base); pragma Import (Ada, EXTI); SYSCFG : SYSCFG_Register with Volatile, Address => System'To_Address (SYSCFG_Base); pragma Import (Ada, SYSCFG); pragma Warnings (On, "*may call Last_Chance_Handler"); pragma Warnings (On, "*may be incompatible with alignment of object"); end Registers;
----------------------------------------------------------------------- -- nodes-core -- Core nodes -- Copyright (C) 2009, 2010, 2011, 2012, 2013 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. ----------------------------------------------------------------------- -- The <b>ASF.Views.Nodes.Core</b> package defines some pre-defined -- core tag nodes which are mapped in the following namespaces: -- -- xmlns:c="http://java.sun.com/jstl/core" -- xmlns:ui="http://java.sun.com/jsf/facelets" -- xmlns:fn="http://java.sun.com/jsp/jstl/functions" -- -- The following JSTL core elements are defined: -- <c:set var="name" value="#{expr}"/> -- <c:if test="#{expr}"> ...</c:if> -- <c:choose><c:when test="#{expr}"></c:when><c:otherwise/</c:choose> -- -- with ASF.Factory; with EL.Functions; package ASF.Views.Nodes.Core is FN_URI : constant String := "http://java.sun.com/jsp/jstl/functions"; -- Tag factory for nodes defined in this package. function Definition return ASF.Factory.Factory_Bindings_Access; -- Register a set of functions in the namespace -- xmlns:fn="http://java.sun.com/jsp/jstl/functions" -- Functions: -- capitalize, toUpperCase, toLowerCase procedure Set_Functions (Mapper : in out EL.Functions.Function_Mapper'Class); -- ------------------------------ -- Set Tag -- ------------------------------ -- The <c:set var="name" value="#{expr}"/> variable creation. -- The variable is created in the faces context. type Set_Tag_Node is new Tag_Node with private; type Set_Tag_Node_Access is access all Set_Tag_Node'Class; -- Create the Set Tag function Create_Set_Tag_Node (Binding : in Binding_Access; Line : in Line_Info; Parent : in Tag_Node_Access; Attributes : in Tag_Attribute_Array_Access) return Tag_Node_Access; -- Build the component tree from the tag node and attach it as -- the last child of the given parent. Calls recursively the -- method to create children. overriding procedure Build_Components (Node : access Set_Tag_Node; Parent : in UIComponent_Access; Context : in out Facelet_Context'Class); -- ------------------------------ -- If Tag -- ------------------------------ -- The <c:if test="#{expr}"> ...</c:if> condition. -- If the condition evaluates to true when the component tree is built, -- the children of this node are evaluated. Otherwise the entire -- sub-tree is not present in the component tree. type If_Tag_Node is new Tag_Node with private; type If_Tag_Node_Access is access all If_Tag_Node'Class; -- Create the If Tag function Create_If_Tag_Node (Binding : in Binding_Access; Line : in Line_Info; Parent : in Tag_Node_Access; Attributes : in Tag_Attribute_Array_Access) return Tag_Node_Access; -- Build the component tree from the tag node and attach it as -- the last child of the given parent. Calls recursively the -- method to create children. overriding procedure Build_Components (Node : access If_Tag_Node; Parent : in UIComponent_Access; Context : in out Facelet_Context'Class); -- ------------------------------ -- Choose Tag -- ------------------------------ -- The <c:choose> ...</c:choose> choice. -- Evaluate a set of choices (<c:when>) until one of them is found. -- When no choice is found, evaluate the <c:otherwise> node. type Choose_Tag_Node is new Tag_Node with private; type Choose_Tag_Node_Access is access all Choose_Tag_Node'Class; -- Freeze the tag node tree and perform any initialization steps -- necessary to build the components efficiently. -- Prepare the evaluation of choices by identifying the <c:when> and -- <c:otherwise> conditions. overriding procedure Freeze (Node : access Choose_Tag_Node); -- Build the component tree from the tag node and attach it as -- the last child of the given parent. Calls recursively the -- method to create children. overriding procedure Build_Components (Node : access Choose_Tag_Node; Parent : in UIComponent_Access; Context : in out Facelet_Context'Class); -- Create the <c:choose> tag node function Create_Choose_Tag_Node (Binding : in Binding_Access; Line : in Line_Info; Parent : in Tag_Node_Access; Attributes : in Tag_Attribute_Array_Access) return Tag_Node_Access; -- ------------------------------ -- When Tag -- ------------------------------ -- The <c:when test="#{expr}"> ...</c:when> choice. -- If the condition evaluates to true when the component tree is built, -- the children of this node are evaluated. Otherwise the entire -- sub-tree is not present in the component tree. type When_Tag_Node is new If_Tag_Node with private; type When_Tag_Node_Access is access all When_Tag_Node'Class; -- Check whether the node condition is selected. function Is_Selected (Node : When_Tag_Node; Context : Facelet_Context'Class) return Boolean; -- Create the When Tag function Create_When_Tag_Node (Binding : in Binding_Access; Line : in Line_Info; Parent : in Tag_Node_Access; Attributes : in Tag_Attribute_Array_Access) return Tag_Node_Access; -- ------------------------------ -- Otherwise Tag -- ------------------------------ -- The <c:otherwise> ...</c:otherwise> choice. -- When all the choice conditions were false, the component tree is built, -- the children of this node are evaluated. type Otherwise_Tag_Node is new Tag_Node with null record; type Otherwise_Tag_Node_Access is access all Otherwise_Tag_Node'Class; -- Create the Otherwise Tag function Create_Otherwise_Tag_Node (Binding : in Binding_Access; Line : in Line_Info; Parent : in Tag_Node_Access; Attributes : in Tag_Attribute_Array_Access) return Tag_Node_Access; -- Java Facelet provides a <c:repeat> tag. It must not be implemented -- because it was proven this was not a good method for iterating over a list. private type Set_Tag_Node is new Tag_Node with record Var : Tag_Attribute_Access; Value : Tag_Attribute_Access; end record; type If_Tag_Node is new Tag_Node with record Condition : Tag_Attribute_Access; Var : Tag_Attribute_Access; end record; type When_Tag_Node is new If_Tag_Node with record Next_Choice : When_Tag_Node_Access; end record; type Choose_Tag_Node is new Tag_Node with record Choices : When_Tag_Node_Access; Otherwise : Tag_Node_Access; end record; end ASF.Views.Nodes.Core;
-- SPDX-FileCopyrightText: 2020 Max Reznik <reznikmm@gmail.com> -- -- SPDX-License-Identifier: MIT ---------------------------------------------------------------- with League.Application; with League.String_Vectors; with Hello_World; with Jupyter.Start_Kernel; procedure Hello_World_Run is Kernel : Hello_World.Kernel; Args : constant League.String_Vectors.Universal_String_Vector := League.Application.Arguments; begin Jupyter.Start_Kernel (Kernel, Args (1)); end Hello_World_Run;
with PolyPaver.Floats; --# inherit PolyPaver.Floats; package Peak is function Max (X,Y : Float) return Float ; --# return R => (R = X and X >= Y) or (R = Y and Y >= X); --Y_Min : constant := 0.0 ; --Y_Max : constant := 1.0 ; -- 100.0 ; --subtype Iy is Float range 0.0 .. 1.0 ; --subtype Iy is Float range Y_Min .. Y_Max ; --Pad : constant := 0.000001; --subtype Ipad is Float range -0.000001 .. 0.000001 ; --subtype Icoeff1 is Float range -1.1 .. 1.1 ; --subtype Icoeff2 is Float range -1.2 .. 1.2 ; --subtype Ipad is Float range -Pad .. Pad ; --subtype Icoeff1 is Float range 1.1*(Y_Min-Y_Max) .. 1.1*(Y_Max-Y_Min) ; --subtype Icoeff2 is Float range 1.2*(Y_Min-Y_Max) .. 1.2*(Y_Max-Y_Min) ; -- coefficients of quadratic A*X**2+B*X+C over [-1,1] -- interpolating the points (-1,Y1), (0,Y2) and (1,Y3) procedure Coeffs (Y1,Y2,Y3 : in Float; A,B,C : out Float); --# derives A from Y1,Y2,Y3 & --# B from Y1,Y3 & --# C from Y2 ; --# pre Y1 in 0.0 .. 1.0 and Y2 in 0.0 .. 1.0 and Y3 in 0.0 .. 1.0; --# post A-B+C - Y1 in -0.000001 .. 0.000001 and --# C = Y2 and --# A+B+C - Y3 in -0.000001 .. 0.000001 and --# A in -1.1 .. 1.1 and B in -1.1 .. 1.1 and C in -1.1 .. 1.1; function PeakQ (A,B,C,X : Float) return Float; --# pre X in -1.0 .. 1.0 and --# A < -0.05 and --# A in -1.2 .. 1.2 and B in -1.2 .. 1.2 and C in -1.2 .. 1.2 ; --# return R => R >= A*X**2+B*X+C-0.05 and R <= 10.0; function PeakUnit (Y1,Y2,Y3 : Float) return Float; --# pre Y1 in 0.0 .. 1.0 and Y2 in 0.0 .. 1.0 and Y3 in 0.0 .. 1.0; --# return R => R >= Y1 - 0.2 and R >= Y2 - 0.2 and R >= Y3 - 0.2; end Peak;
------------------------------------------------------------------------------ -- G P S -- -- -- -- Copyright (C) 2001-2016, AdaCore -- -- -- -- This 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. This software is distributed in the hope that it will be useful, -- -- but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHAN- -- -- TABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public -- -- License for more details. You should have received a copy of the GNU -- -- General Public License distributed with this software; see file -- -- COPYING3. If not, go to http://www.gnu.org/licenses for a complete copy -- -- of the license. -- ------------------------------------------------------------------------------ -- This package provides a multi-purpose Ada parser designed to be very -- fast and usable on non compilable sources. -- Typical use of this package includes: source highlighting, block folding, -- source reformatting, ... with Basic_Types; use Basic_Types; with Language; use Language; with Case_Handling; use Case_Handling; with GNATCOLL.Symbols; package Ada_Analyzer is ---------------------- -- Parsing Routines -- ---------------------- procedure Analyze_Ada_Source (Buffer : UTF8_String; Symbols : GNATCOLL.Symbols.Symbol_Table_Access; Indent_Params : Indent_Parameters; Format : Boolean := True; From, To : Natural := 0; Replace : Replace_Text_Callback := null; Constructs : Construct_List_Access := null; Callback : Entity_Callback := null; Indent_Offset : Natural := 0; Case_Exceptions : Casing_Exceptions := No_Casing_Exception; Is_Optional_Keyword : access function (S : String) return Boolean := null); -- Analyze a given Ada source in Buffer, and perform source reformatting -- between lines From .. To if Format is True. -- If Constructs is not null, store the list of constructs analyzed. -- If Callback is not null, call it for each Source_Entity_Kind. -- Case_Exceptions is the handler containing all the casing exceptions -- to be used while reformatting the code. Ada_Abstract_Attribute : constant Construct_Att_Key := Last_Gen_Att + 1; Ada_Access_Attribute : constant Construct_Att_Key := Access_Attribute; Ada_Aliased_Attribute : constant Construct_Att_Key := Last_Gen_Att + 2; Ada_Array_Attribute : constant Construct_Att_Key := Array_Attribute; Ada_Assign_Attribute : constant Construct_Att_Key := Last_Gen_Att + 3; Ada_Constant_Attribute : constant Construct_Att_Key := Last_Gen_Att + 4; Ada_Delta_Attribute : constant Construct_Att_Key := Last_Gen_Att + 5; Ada_Digits_Attribute : constant Construct_Att_Key := Last_Gen_Att + 6; Ada_In_Attribute : constant Construct_Att_Key := Last_Gen_Att + 7; Ada_Interface_Attribute : constant Construct_Att_Key := Last_Gen_Att + 8; Ada_Mod_Attribute : constant Construct_Att_Key := Last_Gen_Att + 9; Ada_New_Attribute : constant Construct_Att_Key := Last_Gen_Att + 10; Ada_Not_Attribute : constant Construct_Att_Key := Last_Gen_Att + 11; Ada_Null_Attribute : constant Construct_Att_Key := Last_Gen_Att + 12; Ada_Out_Attribute : constant Construct_Att_Key := Last_Gen_Att + 13; Ada_Range_Attribute : constant Construct_Att_Key := Last_Gen_Att + 14; Ada_Record_Attribute : constant Construct_Att_Key := Last_Gen_Att + 15; Ada_Tagged_Attribute : constant Construct_Att_Key := Last_Gen_Att + 16; Ada_Class_Attribute : constant Construct_Att_Key := Last_Gen_Att + 17; Ada_Renames_Attribute : constant Construct_Att_Key := Last_Gen_Att + 18; Ada_Generic_Attribute : constant Construct_Att_Key := Last_Gen_Att + 19; end Ada_Analyzer;
with Ada.Text_IO; use Ada.Text_IO; with Ada.Integer_Text_IO; use Ada.Integer_Text_IO; with Ada.Strings.Unbounded; use Ada.Strings.Unbounded; with Ada.Containers.Vectors; use Ada.Containers; procedure AccomRoomSize is type LengthCM is new Integer; type AreaCM2 is new Integer; type RoomType is (Launge, Bedroom, Kitchen, Bathroom, DiningRoom, UtilityRoom, WC); package RoomType_IO is new Enumeration_IO(Enum => RoomType); use RoomType_IO; type Room is record rType : RoomType; x : LengthCM; y : LengthCM; end record; procedure Put_Room(rm : Room) is begin Put(rm.rType); Put("("); Put(Integer(rm.x), 0); Put("cm x "); Put(Integer(rm.y), 0); Put("cm)"); end Put_Room; package RoomLists is new Ada.Containers.Vectors (Element_Type => Room, Index_Type => Natural); use RoomLists; procedure Put_Rooms(rooms : RoomLists.Vector) is i : RoomLists.Cursor; rm : Room; begin -- loop for all rooms: i := RoomLists.First(rooms); while i /= RoomLists.No_Element loop rm := RoomLists.Element(i); -- print each room: Put_Room(rm); Put_Line(""); -- advance to the next room: RoomLists.Next(i); end loop; end Put_Rooms; function TotalArea(rooms : RoomLists.Vector) return AreaCM2 is i : RoomLists.Cursor; rm : Room; result : AreaCM2; begin result := 0; -- loop for all rooms: i := RoomLists.First(rooms); while i /= RoomLists.No_Element loop rm := RoomLists.Element(i); -- calculate the area and add it to the result: result := result + AreaCM2(rm.x * rm.y); -- advance to the next room: RoomLists.Next(i); end loop; return result; end TotalArea; procedure Put_Area(rooms : RoomLists.Vector) is begin Put("total area = "); Put(Integer(TotalArea(rooms)), 0); Put_Line("cm^2"); end Put_Area; myRooms : RoomLists.Vector; begin RoomLists.Clear(myRooms); RoomLists.Append(myRooms, (Kitchen, 450, 310)); RoomLists.Append(myRooms, (Launge, 550, 450)); RoomLists.Append(myRooms, (Bathroom, 250, 170)); RoomLists.Append(myRooms, (Bedroom, 450, 390)); Put_Rooms(myRooms); Put_Area(myRooms); end AccomRoomSize;
with Ada.Interrupts; use Ada.Interrupts; with Ada.Interrupts.Names; use Ada.Interrupts.Names; package Sigint_Handler is protected Handler is entry Wait; procedure Handle; pragma Interrupt_Handler(Handle); pragma Attach_Handler(Handle, Sigint); private Call_Count : Natural := 0; end Handler; end Sigint_Handler;
----------------------------------------------------------------------- -- are-generator-tests -- Tests for generator -- Copyright (C) 2021 Stephane Carrez -- Written by Stephane Carrez (Stephane.Carrez@gmail.com) -- -- Licensed under the Apache License, Version 2.0 (the "License"); -- you may not use this file except in compliance with the License. -- You may obtain a copy of the License at -- -- http://www.apache.org/licenses/LICENSE-2.0 -- -- Unless required by applicable law or agreed to in writing, software -- distributed under the License is distributed on an "AS IS" BASIS, -- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -- See the License for the specific language governing permissions and -- limitations under the License. ----------------------------------------------------------------------- with Ada.Directories; with Util.Test_Caller; with Are.Generator.C.Tests; with Are.Generator.Ada2012.Tests; with Are.Generator.Go.Tests; package body Are.Generator.Tests is function Tool return String; package Caller is new Util.Test_Caller (Test, "Are.Generator"); function Tool return String is begin return "bin/are"; end Tool; procedure Add_Tests (Suite : in Util.Tests.Access_Test_Suite) is begin Caller.Add_Test (Suite, "Test are (usage)", Test_Wrong_Usage'Access); Caller.Add_Test (Suite, "Test are (wrong directory)", Test_Wrong_Directory'Access); Caller.Add_Test (Suite, "Test are (exec wrong command)", Test_Exec_Error_1'Access); Caller.Add_Test (Suite, "Test are (missing rule file)", Test_Missing_Rule'Access); Caller.Add_Test (Suite, "Test are (wrong include)", Test_Exec_Error_2'Access); Caller.Add_Test (Suite, "Test are (wrong exclude)", Test_Exec_Error_3'Access); Caller.Add_Test (Suite, "Test are (wrong fileset)", Test_Exec_Error_4'Access); Caller.Add_Test (Suite, "Test are (wrong install)", Test_Exec_Error_5'Access); Caller.Add_Test (Suite, "Test are (XML format error)", Test_Exec_Error_6'Access); Caller.Add_Test (Suite, "Test are (wrong resource format)", Test_Exec_Error_7'Access); Caller.Add_Test (Suite, "Test are (missing <line-separator>)", Test_Exec_Error_8'Access); Caller.Add_Test (Suite, "Test are (invalid <line-filter>)", Test_Exec_Error_9'Access); Caller.Add_Test (Suite, "Test are (verbose mode with error)", Test_Verbose'Access); Caller.Add_Test (Suite, "Test are (webmerge with errors)", Test_Merge_Error_1'Access); Are.Generator.Ada2012.Tests.Add_Tests (Suite); Are.Generator.C.Tests.Add_Tests (Suite); Are.Generator.Go.Tests.Add_Tests (Suite); end Add_Tests; procedure Test_Wrong_Usage (T : in out Test) is Result : Ada.Strings.Unbounded.Unbounded_String; begin T.Execute (Tool, Result, Status => 1); T.Execute (Tool & " --zorro", Result, Status => 1); Util.Tests.Assert_Matches (T, "are: unrecognized option '--zorro'", Result, "Invalid error message with --zorro"); T.Execute (Tool & " --lang=plop .", Result, Status => 1); Util.Tests.Assert_Matches (T, "are: error: language plop not recognized", Result, "Invalid error message with --lang=plop"); end Test_Wrong_Usage; procedure Test_Wrong_Directory (T : in out Test) is Result : Ada.Strings.Unbounded.Unbounded_String; begin T.Execute (Tool & " regtests/toto", Result, Status => 1); Util.Tests.Assert_Matches (T, "are: error: path regtests/toto does not exist", Result, "Invalid error message"); if Ada.Directories.Exists ("/dev/null") then T.Execute (Tool & " /dev/null", Result, Status => 1); Util.Tests.Assert_Matches (T, "are: error: path /dev/null is not a directory", Result, "Invalid error message"); end if; end Test_Wrong_Directory; procedure Test_Missing_Rule (T : in out Test) is Dir : constant String := Util.Tests.Get_Test_Path (""); Web : constant String := "regtests/files/test-ada-4"; Result : Ada.Strings.Unbounded.Unbounded_String; begin T.Execute (Tool & " -o " & Dir & " --rule=package-missing-rule.xml " & Web, Result, Status => 1); Util.Tests.Assert_Matches (T, "are: error: package file " & "package-missing-rule.xml does not exist", Result, "Invalid error message"); end Test_Missing_Rule; procedure Test_Exec_Error_1 (T : in out Test) is Dir : constant String := Util.Tests.Get_Test_Path (""); Web : constant String := "regtests/files/test-ada-4"; Rule : constant String := "regtests/files/package-error-1.xml"; Result : Ada.Strings.Unbounded.Unbounded_String; begin T.Execute (Tool & " -o " & Dir & " --rule=" & Rule & " " & Web, Result, Status => 1); Util.Tests.Assert_Matches (T, ".*missing-command", Result, "Invalid error message"); T.Assert (not Ada.Directories.Exists (Ada.Directories.Compose (Dir, "error1.ads")), "Unexpected file error1.ads was created"); end Test_Exec_Error_1; procedure Test_Exec_Error_2 (T : in out Test) is Dir : constant String := Util.Tests.Get_Test_Path (""); Web : constant String := "regtests/files/test-ada-4"; Rule : constant String := "regtests/files/package-error-2.xml"; Result : Ada.Strings.Unbounded.Unbounded_String; begin T.Execute (Tool & " -o " & Dir & " --rule=" & Rule & " " & Web, Result, Status => 1); Util.Tests.Assert_Matches (T, "are: error: .*package-error-2.xml: empty include", Result, "Invalid error message"); T.Assert (not Ada.Directories.Exists (Ada.Directories.Compose (Dir, "error1.ads")), "Unexpected file error1.ads was created"); end Test_Exec_Error_2; procedure Test_Exec_Error_3 (T : in out Test) is Dir : constant String := Util.Tests.Get_Test_Path (""); Web : constant String := "regtests/files/test-ada-4"; Rule : constant String := "regtests/files/package-error-3.xml"; Result : Ada.Strings.Unbounded.Unbounded_String; begin T.Execute (Tool & " -o " & Dir & " --rule=" & Rule & " " & Web, Result, Status => 1); Util.Tests.Assert_Matches (T, "are: error: .*package-error-3.xml: empty exclude", Result, "Invalid error message"); T.Assert (not Ada.Directories.Exists (Ada.Directories.Compose (Dir, "error1.ads")), "Unexpected file error1.ads was created"); end Test_Exec_Error_3; procedure Test_Exec_Error_4 (T : in out Test) is Dir : constant String := Util.Tests.Get_Test_Path (""); Web : constant String := "regtests/files/test-ada-4"; Rule : constant String := "regtests/files/package-error-4.xml"; Result : Ada.Strings.Unbounded.Unbounded_String; begin T.Execute (Tool & " -o " & Dir & " --rule=" & Rule & " " & Web, Result, Status => 1); Util.Tests.Assert_Matches (T, "are: error: .*package-error-4.xml: empty fileset", Result, "Invalid error message"); T.Assert (not Ada.Directories.Exists (Ada.Directories.Compose (Dir, "error1.ads")), "Unexpected file error1.ads was created"); end Test_Exec_Error_4; procedure Test_Exec_Error_5 (T : in out Test) is Dir : constant String := Util.Tests.Get_Test_Path (""); Web : constant String := "regtests/files/test-ada-4"; Rule : constant String := "regtests/files/package-error-5.xml"; Result : Ada.Strings.Unbounded.Unbounded_String; begin T.Execute (Tool & " -o " & Dir & " --rule=" & Rule & " " & Web, Result, Status => 1); Util.Tests.Assert_Matches (T, "are: error: .*package-error-5.xml: rule 'some-plugin'", Result, "Invalid error message"); T.Assert (not Ada.Directories.Exists (Ada.Directories.Compose (Dir, "error1.ads")), "Unexpected file error1.ads was created"); end Test_Exec_Error_5; procedure Test_Exec_Error_6 (T : in out Test) is Dir : constant String := Util.Tests.Get_Test_Path (""); Web : constant String := "regtests/files/test-ada-4"; Rule : constant String := "regtests/files/package-error-6.xml"; Result : Ada.Strings.Unbounded.Unbounded_String; begin T.Execute (Tool & " -o " & Dir & " --rule=" & Rule & " " & Web, Result, Status => 1); Util.Tests.Assert_Matches (T, "are: error: package-error-6.xml:2:0: " & "Node <package> is not closed", Result, "Invalid error message"); end Test_Exec_Error_6; procedure Test_Exec_Error_7 (T : in out Test) is Dir : constant String := Util.Tests.Get_Test_Path (""); Web : constant String := "regtests/files/test-ada-4"; Rule : constant String := "regtests/files/package-error-7.xml"; Result : Ada.Strings.Unbounded.Unbounded_String; begin T.Execute (Tool & " -o " & Dir & " --rule=" & Rule & " " & Web, Result, Status => 1); Util.Tests.Assert_Matches (T, "are: error: .*: invalid resource format 'bad-format'", Result, "Invalid error message"); end Test_Exec_Error_7; procedure Test_Exec_Error_8 (T : in out Test) is Dir : constant String := Util.Tests.Get_Test_Path (""); Web : constant String := "regtests/files/test-ada-4"; Rule : constant String := "regtests/files/package-error-8.xml"; Result : Ada.Strings.Unbounded.Unbounded_String; begin T.Execute (Tool & " -o " & Dir & " --rule=" & Rule & " " & Web, Result, Status => 1); Util.Tests.Assert_Matches (T, "are: error: .*: missing 'line-separator'" & " for resource 'Error1'", Result, "Invalid error message"); end Test_Exec_Error_8; procedure Test_Exec_Error_9 (T : in out Test) is Dir : constant String := Util.Tests.Get_Test_Path (""); Web : constant String := "regtests/files/test-ada-4"; Rule : constant String := "regtests/files/package-error-9.xml"; Result : Ada.Strings.Unbounded.Unbounded_String; begin T.Execute (Tool & " -o " & Dir & " --rule=" & Rule & " " & Web, Result, Status => 1); Util.Tests.Assert_Matches (T, "are: error: .*: invalid pattern '", Result, "Invalid error message"); end Test_Exec_Error_9; procedure Test_Merge_Error_1 (T : in out Test) is Dir : constant String := Util.Tests.Get_Test_Path (""); Web : constant String := "regtests/files/web-error-1"; Rule : constant String := "regtests/files/package-webmerge-1.xml"; Result : Ada.Strings.Unbounded.Unbounded_String; begin T.Execute (Tool & " -o " & Dir & " --rule=" & Rule & " " & Web, Result, Status => 1); Util.Tests.Assert_Matches (T, "are: error: .*: cannot read ", Result, "Invalid error message"); Util.Tests.Assert_Matches (T, "are: error: .*: expecting a 'href=' ", Result, "Invalid error message"); Util.Tests.Assert_Matches (T, "are: error: .*: may be the end marker 'RESOURCE-MERGE-END' ", Result, "Invalid error message"); end Test_Merge_Error_1; procedure Test_Verbose (T : in out Test) is Dir : constant String := Util.Tests.Get_Test_Path (""); Web : constant String := "regtests/files/test-ada-4"; Rule : constant String := "regtests/files/package-error-1.xml"; Result : Ada.Strings.Unbounded.Unbounded_String; begin T.Execute (Tool & " -v -o " & Dir & " --rule=" & Rule & " " & Web, Result, Status => 1); Util.Tests.Assert_Matches (T, ".*missing-command", Result, "Invalid error message"); T.Assert (not Ada.Directories.Exists (Ada.Directories.Compose (Dir, "error1.ads")), "Unexpected file error1.ads was created"); T.Execute (Tool & " -vv -o " & Dir & " --rule=" & Rule & " " & Web, Result, Status => 1); Util.Tests.Assert_Matches (T, ".*DEBUG.*Process rule", Result, "Invalid debug message"); Util.Tests.Assert_Matches (T, ".*INFO - Util.Processes", Result, "Missing debug message"); T.Assert (not Ada.Directories.Exists (Ada.Directories.Compose (Dir, "error1.ads")), "Unexpected file error1.ads was created"); T.Execute (Tool & " -V", Result, Status => 0); Util.Tests.Assert_Matches (T, "Advanced Resource Embedder 1.*", Result, "Invalid version"); end Test_Verbose; end Are.Generator.Tests;
with GNAT.OS_Lib; private with Littlefs; package FSmaker.Target.LittleFS is subtype Parent is Filesystem; type Instance is new Parent with private; overriding procedure Format (This : in out Instance; FD : GNAT.OS_Lib.File_Descriptor; Size : Natural); overriding procedure Mount (This : in out Instance; FD : GNAT.OS_Lib.File_Descriptor); overriding procedure Make_Dir (This : in out Instance; Path : Target_Path); overriding function Tree (This : in out Instance; Path : Target_Path) return Directory_Tree; overriding procedure Import (This : in out Instance; Path : Target_Path; Src : in out Source.Instance); overriding procedure Cat (This : in out Instance; Path : Target_Path; Dst : in out FSmaker.Sink.Class); private type LFS_Config_Access is access all Standard.Littlefs.LFS_Config; type Instance is new Parent with record FD : aliased GNAT.OS_Lib.File_Descriptor; LFS : aliased Standard.Littlefs.LFS_T; Config : LFS_Config_Access; end record; end FSmaker.Target.LittleFS;
with GNAT.Source_Info; with Ada.Strings.Unbounded; with AUnit.Assertions; use AUnit.Assertions; with GNAT.Spitbol; use GNAT.Spitbol; package body ZMQ.Tests.Testcases.Test_REQRESP is use AUnit; use Ada.Strings.Unbounded; REQUEST_STRING : constant Unbounded_String := V ("Query"); RESPONSE_STRING : constant Unbounded_String := V ("Reply"); ---------- -- Name -- ---------- function Name (T : Test_Case) return AUnit.Message_String is pragma Unreferenced (T); begin return Format (GNAT.Source_Info.File); end Name; ------------------------- -- initialize ------------------------- addr : constant String := "tcp://127.0.0.1:5555"; procedure Initialize (Test : in out AUnit.Test_Cases.Test_Case'Class) is T : Test_Case renames Test_Case (Test); begin T.RESP.Initialize (T.Ctx, Sockets.REP); T.RESP.Bind (addr); delay 0.1; T.REQ.Initialize (T.Ctx, Sockets.REQ); T.REQ.Connect (addr); delay 0.1; end Initialize; ------------------------- -- Publish ------------------------- procedure Send (Test : in out AUnit.Test_Cases.Test_Case'Class) is T : Test_Case renames Test_Case (Test); Msg : Ada.Strings.Unbounded.Unbounded_String; begin T.REQ.Send (REQUEST_STRING); T.RESP.Recv (Msg); Assert (Msg = REQUEST_STRING, "Error"); T.RESP.Send (RESPONSE_STRING); T.REQ.Recv (Msg); Assert (Msg = RESPONSE_STRING, "Error"); end Send; ------------------------- -- Subscribe ------------------------- procedure Finalize (Test : in out AUnit.Test_Cases.Test_Case'Class) is T : Test_Case renames Test_Case (Test); begin T.REQ.Finalize; T.RESP.Finalize; end Finalize; -------------------- -- Register_Tests -- -------------------- procedure Register_Tests (T : in out Test_Case) is use Test_Cases.Registration; begin Register_Routine (T, Initialize'Access, "initialize"); Register_Routine (T, Send'Access, "Send"); Register_Routine (T, Finalize'Access, "Finalize"); end Register_Tests; end ZMQ.Tests.TestCases.Test_REQRESP;
------------------------------------------------------------------------------ -- -- -- GNAT COMPILER COMPONENTS -- -- -- -- S Y S T E M . F A T _ G E N -- -- -- -- S p e c -- -- -- -- Copyright (C) 1992-2019, Free Software Foundation, Inc. -- -- -- -- GNAT is free software; you can redistribute it and/or modify it under -- -- terms of the GNU General Public License as published by the Free Soft- -- -- ware Foundation; either version 3, or (at your option) any later ver- -- -- sion. GNAT is distributed in the hope that it will be useful, but WITH- -- -- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY -- -- or FITNESS FOR A PARTICULAR PURPOSE. -- -- -- -- As a special exception under Section 7 of GPL version 3, you are granted -- -- additional permissions described in the GCC Runtime Library Exception, -- -- version 3.1, as published by the Free Software Foundation. -- -- -- -- You should have received a copy of the GNU General Public License and -- -- a copy of the GCC Runtime Library Exception along with this program; -- -- see the files COPYING3 and COPYING.RUNTIME respectively. If not, see -- -- <http://www.gnu.org/licenses/>. -- -- -- -- GNAT was originally developed by the GNAT team at New York University. -- -- Extensive contributions were provided by Ada Core Technologies Inc. -- -- -- ------------------------------------------------------------------------------ -- This generic package provides a target independent implementation of the -- floating-point attributes that denote functions. The implementations here -- are portable, but very slow. The runtime contains a set of instantiations -- of this package for all predefined floating-point types, and these should -- be replaced by efficient assembly language code where possible. generic type T is digits <>; package System.Fat_Gen is pragma Pure; subtype UI is Integer; -- The runtime representation of universal integer for the purposes of -- this package is integer. The expander generates conversions for the -- actual type used. For functions returning universal integer, there -- is no problem, since the result always is in range of integer. For -- input arguments, the expander has to do some special casing to deal -- with the (very annoying) cases of out of range values. If we used -- Long_Long_Integer to represent universal, then there would be no -- problem, but the resulting inefficiency would be annoying. function Adjacent (X, Towards : T) return T; function Ceiling (X : T) return T; function Compose (Fraction : T; Exponent : UI) return T; function Copy_Sign (Value, Sign : T) return T; function Exponent (X : T) return UI; function Floor (X : T) return T; function Fraction (X : T) return T; function Leading_Part (X : T; Radix_Digits : UI) return T; function Machine (X : T) return T; function Machine_Rounding (X : T) return T; function Model (X : T) return T; function Pred (X : T) return T; function Remainder (X, Y : T) return T; function Rounding (X : T) return T; function Scaling (X : T; Adjustment : UI) return T; function Succ (X : T) return T; function Truncation (X : T) return T; function Unbiased_Rounding (X : T) return T; function Valid (X : not null access T) return Boolean; -- This function checks if the object of type T referenced by X is valid, -- and returns True/False accordingly. The parameter is passed by reference -- (access) here, as the object of type T may be an abnormal value that -- cannot be passed in a floating-point register, and the whole point of -- 'Valid is to prevent exceptions. Note that the object of type T must -- have the natural alignment for type T. type S is new String (1 .. T'Size / Character'Size); type P is access all S with Storage_Size => 0; -- Buffer and access types used to initialize temporaries for validity -- checks, if the value to be checked has reverse scalar storage order, or -- is not known to be properly aligned (for example it appears in a packed -- record). In this case, we cannot call Valid since Valid assumes proper -- full alignment. Instead, we copy the value to a temporary location using -- type S (we cannot simply do a copy of a T value, because the value might -- be invalid, in which case it might not be possible to copy it through a -- floating point register). private pragma Inline (Machine); pragma Inline (Model); -- Note: previously the validity checking subprograms (Unaligned_Valid and -- Valid) were also inlined, but this was changed since there were some -- problems with this inlining in optimized mode, and in any case it seems -- better to avoid this inlining (space and robustness considerations). end System.Fat_Gen;
pragma Ada_95; pragma Warnings (Off); pragma Source_File_Name (ada_main, Spec_File_Name => "b__lr-main.ads"); pragma Source_File_Name (ada_main, Body_File_Name => "b__lr-main.adb"); pragma Suppress (Overflow_Check); with System.Restrictions; with Ada.Exceptions; package body ada_main is E013 : Short_Integer; pragma Import (Ada, E013, "system__soft_links_E"); E019 : Short_Integer; pragma Import (Ada, E019, "system__exception_table_E"); E021 : Short_Integer; pragma Import (Ada, E021, "system__exceptions_E"); E009 : Short_Integer; pragma Import (Ada, E009, "system__secondary_stack_E"); E336 : Short_Integer; pragma Import (Ada, E336, "ada__containers_E"); E067 : Short_Integer; pragma Import (Ada, E067, "ada__io_exceptions_E"); E304 : Short_Integer; pragma Import (Ada, E304, "ada__numerics_E"); E344 : Short_Integer; pragma Import (Ada, E344, "ada__strings_E"); E077 : Short_Integer; pragma Import (Ada, E077, "interfaces__c_E"); E087 : Short_Integer; pragma Import (Ada, E087, "interfaces__c__strings_E"); E079 : Short_Integer; pragma Import (Ada, E079, "system__os_lib_E"); E399 : Short_Integer; pragma Import (Ada, E399, "system__task_info_E"); E051 : Short_Integer; pragma Import (Ada, E051, "ada__tags_E"); E066 : Short_Integer; pragma Import (Ada, E066, "ada__streams_E"); E082 : Short_Integer; pragma Import (Ada, E082, "system__file_control_block_E"); E075 : Short_Integer; pragma Import (Ada, E075, "system__finalization_root_E"); E073 : Short_Integer; pragma Import (Ada, E073, "ada__finalization_E"); E072 : Short_Integer; pragma Import (Ada, E072, "system__file_io_E"); E364 : Short_Integer; pragma Import (Ada, E364, "ada__streams__stream_io_E"); E095 : Short_Integer; pragma Import (Ada, E095, "system__storage_pools_E"); E089 : Short_Integer; pragma Import (Ada, E089, "system__finalization_masters_E"); E109 : Short_Integer; pragma Import (Ada, E109, "system__storage_pools__subpools_E"); E372 : Short_Integer; pragma Import (Ada, E372, "ada__calendar_E"); E370 : Short_Integer; pragma Import (Ada, E370, "ada__calendar__delays_E"); E064 : Short_Integer; pragma Import (Ada, E064, "ada__text_io_E"); E128 : Short_Integer; pragma Import (Ada, E128, "system__assertions_E"); E350 : Short_Integer; pragma Import (Ada, E350, "ada__strings__maps_E"); E346 : Short_Integer; pragma Import (Ada, E346, "ada__strings__unbounded_E"); E384 : Short_Integer; pragma Import (Ada, E384, "ada__real_time_E"); E097 : Short_Integer; pragma Import (Ada, E097, "system__pool_global_E"); E443 : Short_Integer; pragma Import (Ada, E443, "system__random_seed_E"); E417 : Short_Integer; pragma Import (Ada, E417, "system__tasking__initialization_E"); E425 : Short_Integer; pragma Import (Ada, E425, "system__tasking__protected_objects_E"); E427 : Short_Integer; pragma Import (Ada, E427, "system__tasking__protected_objects__entries_E"); E431 : Short_Integer; pragma Import (Ada, E431, "system__tasking__queuing_E"); E437 : Short_Integer; pragma Import (Ada, E437, "system__tasking__stages_E"); E085 : Short_Integer; pragma Import (Ada, E085, "glib_E"); E126 : Short_Integer; pragma Import (Ada, E126, "gtkada__types_E"); E179 : Short_Integer; pragma Import (Ada, E179, "gdk__frame_timings_E"); E130 : Short_Integer; pragma Import (Ada, E130, "glib__glist_E"); E162 : Short_Integer; pragma Import (Ada, E162, "gdk__visual_E"); E132 : Short_Integer; pragma Import (Ada, E132, "glib__gslist_E"); E124 : Short_Integer; pragma Import (Ada, E124, "gtkada__c_E"); E105 : Short_Integer; pragma Import (Ada, E105, "glib__object_E"); E122 : Short_Integer; pragma Import (Ada, E122, "glib__values_E"); E120 : Short_Integer; pragma Import (Ada, E120, "glib__types_E"); E107 : Short_Integer; pragma Import (Ada, E107, "glib__type_conversion_hooks_E"); E114 : Short_Integer; pragma Import (Ada, E114, "gtkada__bindings_E"); E143 : Short_Integer; pragma Import (Ada, E143, "cairo_E"); E145 : Short_Integer; pragma Import (Ada, E145, "cairo__region_E"); E149 : Short_Integer; pragma Import (Ada, E149, "gdk__rectangle_E"); E152 : Short_Integer; pragma Import (Ada, E152, "glib__generic_properties_E"); E173 : Short_Integer; pragma Import (Ada, E173, "gdk__color_E"); E154 : Short_Integer; pragma Import (Ada, E154, "gdk__rgba_E"); E147 : Short_Integer; pragma Import (Ada, E147, "gdk__event_E"); E282 : Short_Integer; pragma Import (Ada, E282, "glib__key_file_E"); E164 : Short_Integer; pragma Import (Ada, E164, "glib__properties_E"); E244 : Short_Integer; pragma Import (Ada, E244, "glib__string_E"); E242 : Short_Integer; pragma Import (Ada, E242, "glib__variant_E"); E240 : Short_Integer; pragma Import (Ada, E240, "glib__g_icon_E"); E310 : Short_Integer; pragma Import (Ada, E310, "gtk__actionable_E"); E187 : Short_Integer; pragma Import (Ada, E187, "gtk__builder_E"); E224 : Short_Integer; pragma Import (Ada, E224, "gtk__buildable_E"); E256 : Short_Integer; pragma Import (Ada, E256, "gtk__cell_area_context_E"); E272 : Short_Integer; pragma Import (Ada, E272, "gtk__css_section_E"); E167 : Short_Integer; pragma Import (Ada, E167, "gtk__enums_E"); E230 : Short_Integer; pragma Import (Ada, E230, "gtk__orientable_E"); E284 : Short_Integer; pragma Import (Ada, E284, "gtk__paper_size_E"); E280 : Short_Integer; pragma Import (Ada, E280, "gtk__page_setup_E"); E292 : Short_Integer; pragma Import (Ada, E292, "gtk__print_settings_E"); E195 : Short_Integer; pragma Import (Ada, E195, "gtk__target_entry_E"); E193 : Short_Integer; pragma Import (Ada, E193, "gtk__target_list_E"); E380 : Short_Integer; pragma Import (Ada, E380, "lr__synchro_E"); E382 : Short_Integer; pragma Import (Ada, E382, "lr__synchro__fifo_E"); E200 : Short_Integer; pragma Import (Ada, E200, "pango__enums_E"); E218 : Short_Integer; pragma Import (Ada, E218, "pango__attributes_E"); E204 : Short_Integer; pragma Import (Ada, E204, "pango__font_metrics_E"); E206 : Short_Integer; pragma Import (Ada, E206, "pango__language_E"); E202 : Short_Integer; pragma Import (Ada, E202, "pango__font_E"); E298 : Short_Integer; pragma Import (Ada, E298, "gtk__text_attributes_E"); E300 : Short_Integer; pragma Import (Ada, E300, "gtk__text_tag_E"); E210 : Short_Integer; pragma Import (Ada, E210, "pango__font_face_E"); E208 : Short_Integer; pragma Import (Ada, E208, "pango__font_family_E"); E212 : Short_Integer; pragma Import (Ada, E212, "pango__fontset_E"); E214 : Short_Integer; pragma Import (Ada, E214, "pango__matrix_E"); E198 : Short_Integer; pragma Import (Ada, E198, "pango__context_E"); E288 : Short_Integer; pragma Import (Ada, E288, "pango__font_map_E"); E220 : Short_Integer; pragma Import (Ada, E220, "pango__tabs_E"); E216 : Short_Integer; pragma Import (Ada, E216, "pango__layout_E"); E286 : Short_Integer; pragma Import (Ada, E286, "gtk__print_context_E"); E139 : Short_Integer; pragma Import (Ada, E139, "gdk__display_E"); E290 : Short_Integer; pragma Import (Ada, E290, "gtk__print_operation_preview_E"); E262 : Short_Integer; pragma Import (Ada, E262, "gtk__tree_model_E"); E250 : Short_Integer; pragma Import (Ada, E250, "gtk__entry_buffer_E"); E248 : Short_Integer; pragma Import (Ada, E248, "gtk__editable_E"); E246 : Short_Integer; pragma Import (Ada, E246, "gtk__cell_editable_E"); E228 : Short_Integer; pragma Import (Ada, E228, "gtk__adjustment_E"); E191 : Short_Integer; pragma Import (Ada, E191, "gtk__style_E"); E185 : Short_Integer; pragma Import (Ada, E185, "gtk__accel_group_E"); E177 : Short_Integer; pragma Import (Ada, E177, "gdk__frame_clock_E"); E181 : Short_Integer; pragma Import (Ada, E181, "gdk__pixbuf_E"); E268 : Short_Integer; pragma Import (Ada, E268, "gtk__icon_source_E"); E160 : Short_Integer; pragma Import (Ada, E160, "gdk__screen_E"); E136 : Short_Integer; pragma Import (Ada, E136, "gdk__device_E"); E175 : Short_Integer; pragma Import (Ada, E175, "gdk__drag_contexts_E"); E296 : Short_Integer; pragma Import (Ada, E296, "gtk__text_iter_E"); E234 : Short_Integer; pragma Import (Ada, E234, "gdk__window_E"); E189 : Short_Integer; pragma Import (Ada, E189, "gtk__selection_data_E"); E171 : Short_Integer; pragma Import (Ada, E171, "gtk__widget_E"); E274 : Short_Integer; pragma Import (Ada, E274, "gtk__misc_E"); E169 : Short_Integer; pragma Import (Ada, E169, "gtk__style_provider_E"); E158 : Short_Integer; pragma Import (Ada, E158, "gtk__settings_E"); E270 : Short_Integer; pragma Import (Ada, E270, "gtk__style_context_E"); E266 : Short_Integer; pragma Import (Ada, E266, "gtk__icon_set_E"); E264 : Short_Integer; pragma Import (Ada, E264, "gtk__image_E"); E260 : Short_Integer; pragma Import (Ada, E260, "gtk__cell_renderer_E"); E226 : Short_Integer; pragma Import (Ada, E226, "gtk__container_E"); E236 : Short_Integer; pragma Import (Ada, E236, "gtk__bin_E"); E222 : Short_Integer; pragma Import (Ada, E222, "gtk__box_E"); E294 : Short_Integer; pragma Import (Ada, E294, "gtk__status_bar_E"); E276 : Short_Integer; pragma Import (Ada, E276, "gtk__notebook_E"); E258 : Short_Integer; pragma Import (Ada, E258, "gtk__cell_layout_E"); E254 : Short_Integer; pragma Import (Ada, E254, "gtk__cell_area_E"); E252 : Short_Integer; pragma Import (Ada, E252, "gtk__entry_completion_E"); E232 : Short_Integer; pragma Import (Ada, E232, "gtk__window_E"); E156 : Short_Integer; pragma Import (Ada, E156, "gtk__dialog_E"); E278 : Short_Integer; pragma Import (Ada, E278, "gtk__print_operation_E"); E238 : Short_Integer; pragma Import (Ada, E238, "gtk__gentry_E"); E141 : Short_Integer; pragma Import (Ada, E141, "gtk__arguments_E"); E320 : Short_Integer; pragma Import (Ada, E320, "glib__menu_model_E"); E308 : Short_Integer; pragma Import (Ada, E308, "gtk__action_E"); E312 : Short_Integer; pragma Import (Ada, E312, "gtk__activatable_E"); E306 : Short_Integer; pragma Import (Ada, E306, "gtk__button_E"); E314 : Short_Integer; pragma Import (Ada, E314, "gtk__grange_E"); E134 : Short_Integer; pragma Import (Ada, E134, "gtk__main_E"); E330 : Short_Integer; pragma Import (Ada, E330, "gtk__marshallers_E"); E322 : Short_Integer; pragma Import (Ada, E322, "gtk__menu_item_E"); E324 : Short_Integer; pragma Import (Ada, E324, "gtk__menu_shell_E"); E318 : Short_Integer; pragma Import (Ada, E318, "gtk__menu_E"); E316 : Short_Integer; pragma Import (Ada, E316, "gtk__label_E"); E332 : Short_Integer; pragma Import (Ada, E332, "gtk__tree_view_column_E"); E333 : Short_Integer; pragma Import (Ada, E333, "gtkada__handlers_E"); E326 : Short_Integer; pragma Import (Ada, E326, "gtkada__builder_E"); E378 : Short_Integer; pragma Import (Ada, E378, "lr__tasks_E"); E368 : Short_Integer; pragma Import (Ada, E368, "lr__simu_E"); E303 : Short_Integer; pragma Import (Ada, E303, "lr__affic_E"); Local_Priority_Specific_Dispatching : constant String := ""; Local_Interrupt_States : constant String := ""; Is_Elaborated : Boolean := False; procedure finalize_library is begin declare procedure F1; pragma Import (Ada, F1, "gtkada__builder__finalize_body"); begin E326 := E326 - 1; F1; end; declare procedure F2; pragma Import (Ada, F2, "gtkada__builder__finalize_spec"); begin F2; end; declare procedure F3; pragma Import (Ada, F3, "gtkada__handlers__finalize_spec"); begin E333 := E333 - 1; F3; end; E332 := E332 - 1; declare procedure F4; pragma Import (Ada, F4, "gtk__tree_view_column__finalize_spec"); begin F4; end; E316 := E316 - 1; declare procedure F5; pragma Import (Ada, F5, "gtk__label__finalize_spec"); begin F5; end; E318 := E318 - 1; declare procedure F6; pragma Import (Ada, F6, "gtk__menu__finalize_spec"); begin F6; end; E324 := E324 - 1; declare procedure F7; pragma Import (Ada, F7, "gtk__menu_shell__finalize_spec"); begin F7; end; E322 := E322 - 1; declare procedure F8; pragma Import (Ada, F8, "gtk__menu_item__finalize_spec"); begin F8; end; E314 := E314 - 1; declare procedure F9; pragma Import (Ada, F9, "gtk__grange__finalize_spec"); begin F9; end; E306 := E306 - 1; declare procedure F10; pragma Import (Ada, F10, "gtk__button__finalize_spec"); begin F10; end; E308 := E308 - 1; declare procedure F11; pragma Import (Ada, F11, "gtk__action__finalize_spec"); begin F11; end; E320 := E320 - 1; declare procedure F12; pragma Import (Ada, F12, "glib__menu_model__finalize_spec"); begin F12; end; E139 := E139 - 1; E177 := E177 - 1; E185 := E185 - 1; E171 := E171 - 1; E191 := E191 - 1; E226 := E226 - 1; E228 := E228 - 1; E156 := E156 - 1; E232 := E232 - 1; E250 := E250 - 1; E260 := E260 - 1; E252 := E252 - 1; E254 := E254 - 1; E262 := E262 - 1; E238 := E238 - 1; E270 := E270 - 1; E276 := E276 - 1; E278 := E278 - 1; E294 := E294 - 1; declare procedure F13; pragma Import (Ada, F13, "gtk__gentry__finalize_spec"); begin F13; end; declare procedure F14; pragma Import (Ada, F14, "gtk__print_operation__finalize_spec"); begin F14; end; declare procedure F15; pragma Import (Ada, F15, "gtk__dialog__finalize_spec"); begin F15; end; declare procedure F16; pragma Import (Ada, F16, "gtk__window__finalize_spec"); begin F16; end; declare procedure F17; pragma Import (Ada, F17, "gtk__entry_completion__finalize_spec"); begin F17; end; declare procedure F18; pragma Import (Ada, F18, "gtk__cell_area__finalize_spec"); begin F18; end; declare procedure F19; pragma Import (Ada, F19, "gtk__notebook__finalize_spec"); begin F19; end; declare procedure F20; pragma Import (Ada, F20, "gtk__status_bar__finalize_spec"); begin F20; end; E222 := E222 - 1; declare procedure F21; pragma Import (Ada, F21, "gtk__box__finalize_spec"); begin F21; end; E236 := E236 - 1; declare procedure F22; pragma Import (Ada, F22, "gtk__bin__finalize_spec"); begin F22; end; declare procedure F23; pragma Import (Ada, F23, "gtk__container__finalize_spec"); begin F23; end; declare procedure F24; pragma Import (Ada, F24, "gtk__cell_renderer__finalize_spec"); begin F24; end; E264 := E264 - 1; declare procedure F25; pragma Import (Ada, F25, "gtk__image__finalize_spec"); begin F25; end; E266 := E266 - 1; declare procedure F26; pragma Import (Ada, F26, "gtk__icon_set__finalize_spec"); begin F26; end; declare procedure F27; pragma Import (Ada, F27, "gtk__style_context__finalize_spec"); begin F27; end; E158 := E158 - 1; declare procedure F28; pragma Import (Ada, F28, "gtk__settings__finalize_spec"); begin F28; end; E274 := E274 - 1; declare procedure F29; pragma Import (Ada, F29, "gtk__misc__finalize_spec"); begin F29; end; declare procedure F30; pragma Import (Ada, F30, "gtk__widget__finalize_spec"); begin F30; end; E189 := E189 - 1; declare procedure F31; pragma Import (Ada, F31, "gtk__selection_data__finalize_spec"); begin F31; end; E136 := E136 - 1; E175 := E175 - 1; declare procedure F32; pragma Import (Ada, F32, "gdk__drag_contexts__finalize_spec"); begin F32; end; declare procedure F33; pragma Import (Ada, F33, "gdk__device__finalize_spec"); begin F33; end; E160 := E160 - 1; declare procedure F34; pragma Import (Ada, F34, "gdk__screen__finalize_spec"); begin F34; end; E181 := E181 - 1; E268 := E268 - 1; declare procedure F35; pragma Import (Ada, F35, "gtk__icon_source__finalize_spec"); begin F35; end; declare procedure F36; pragma Import (Ada, F36, "gdk__pixbuf__finalize_spec"); begin F36; end; declare procedure F37; pragma Import (Ada, F37, "gdk__frame_clock__finalize_spec"); begin F37; end; declare procedure F38; pragma Import (Ada, F38, "gtk__accel_group__finalize_spec"); begin F38; end; declare procedure F39; pragma Import (Ada, F39, "gtk__style__finalize_spec"); begin F39; end; declare procedure F40; pragma Import (Ada, F40, "gtk__adjustment__finalize_spec"); begin F40; end; declare procedure F41; pragma Import (Ada, F41, "gtk__entry_buffer__finalize_spec"); begin F41; end; declare procedure F42; pragma Import (Ada, F42, "gtk__tree_model__finalize_spec"); begin F42; end; declare procedure F43; pragma Import (Ada, F43, "gdk__display__finalize_spec"); begin F43; end; E286 := E286 - 1; declare procedure F44; pragma Import (Ada, F44, "gtk__print_context__finalize_spec"); begin F44; end; E216 := E216 - 1; declare procedure F45; pragma Import (Ada, F45, "pango__layout__finalize_spec"); begin F45; end; E220 := E220 - 1; declare procedure F46; pragma Import (Ada, F46, "pango__tabs__finalize_spec"); begin F46; end; E288 := E288 - 1; declare procedure F47; pragma Import (Ada, F47, "pango__font_map__finalize_spec"); begin F47; end; E198 := E198 - 1; declare procedure F48; pragma Import (Ada, F48, "pango__context__finalize_spec"); begin F48; end; E212 := E212 - 1; declare procedure F49; pragma Import (Ada, F49, "pango__fontset__finalize_spec"); begin F49; end; E208 := E208 - 1; declare procedure F50; pragma Import (Ada, F50, "pango__font_family__finalize_spec"); begin F50; end; E210 := E210 - 1; declare procedure F51; pragma Import (Ada, F51, "pango__font_face__finalize_spec"); begin F51; end; E300 := E300 - 1; declare procedure F52; pragma Import (Ada, F52, "gtk__text_tag__finalize_spec"); begin F52; end; E202 := E202 - 1; declare procedure F53; pragma Import (Ada, F53, "pango__font__finalize_spec"); begin F53; end; E206 := E206 - 1; declare procedure F54; pragma Import (Ada, F54, "pango__language__finalize_spec"); begin F54; end; E204 := E204 - 1; declare procedure F55; pragma Import (Ada, F55, "pango__font_metrics__finalize_spec"); begin F55; end; E218 := E218 - 1; declare procedure F56; pragma Import (Ada, F56, "pango__attributes__finalize_spec"); begin F56; end; E193 := E193 - 1; declare procedure F57; pragma Import (Ada, F57, "gtk__target_list__finalize_spec"); begin F57; end; E292 := E292 - 1; declare procedure F58; pragma Import (Ada, F58, "gtk__print_settings__finalize_spec"); begin F58; end; E280 := E280 - 1; declare procedure F59; pragma Import (Ada, F59, "gtk__page_setup__finalize_spec"); begin F59; end; E284 := E284 - 1; declare procedure F60; pragma Import (Ada, F60, "gtk__paper_size__finalize_spec"); begin F60; end; E272 := E272 - 1; declare procedure F61; pragma Import (Ada, F61, "gtk__css_section__finalize_spec"); begin F61; end; E256 := E256 - 1; declare procedure F62; pragma Import (Ada, F62, "gtk__cell_area_context__finalize_spec"); begin F62; end; E187 := E187 - 1; declare procedure F63; pragma Import (Ada, F63, "gtk__builder__finalize_spec"); begin F63; end; E242 := E242 - 1; declare procedure F64; pragma Import (Ada, F64, "glib__variant__finalize_spec"); begin F64; end; E105 := E105 - 1; declare procedure F65; pragma Import (Ada, F65, "glib__object__finalize_spec"); begin F65; end; E179 := E179 - 1; declare procedure F66; pragma Import (Ada, F66, "gdk__frame_timings__finalize_spec"); begin F66; end; E085 := E085 - 1; declare procedure F67; pragma Import (Ada, F67, "glib__finalize_spec"); begin F67; end; E427 := E427 - 1; declare procedure F68; pragma Import (Ada, F68, "system__tasking__protected_objects__entries__finalize_spec"); begin F68; end; E097 := E097 - 1; declare procedure F69; pragma Import (Ada, F69, "system__pool_global__finalize_spec"); begin F69; end; E346 := E346 - 1; declare procedure F70; pragma Import (Ada, F70, "ada__strings__unbounded__finalize_spec"); begin F70; end; E064 := E064 - 1; declare procedure F71; pragma Import (Ada, F71, "ada__text_io__finalize_spec"); begin F71; end; E109 := E109 - 1; declare procedure F72; pragma Import (Ada, F72, "system__storage_pools__subpools__finalize_spec"); begin F72; end; E089 := E089 - 1; declare procedure F73; pragma Import (Ada, F73, "system__finalization_masters__finalize_spec"); begin F73; end; E364 := E364 - 1; declare procedure F74; pragma Import (Ada, F74, "ada__streams__stream_io__finalize_spec"); begin F74; end; declare procedure F75; pragma Import (Ada, F75, "system__file_io__finalize_body"); begin E072 := E072 - 1; F75; end; declare procedure Reraise_Library_Exception_If_Any; pragma Import (Ada, Reraise_Library_Exception_If_Any, "__gnat_reraise_library_exception_if_any"); begin Reraise_Library_Exception_If_Any; end; end finalize_library; procedure adafinal is procedure s_stalib_adafinal; pragma Import (C, s_stalib_adafinal, "system__standard_library__adafinal"); procedure Runtime_Finalize; pragma Import (C, Runtime_Finalize, "__gnat_runtime_finalize"); begin if not Is_Elaborated then return; end if; Is_Elaborated := False; Runtime_Finalize; s_stalib_adafinal; end adafinal; type No_Param_Proc is access procedure; procedure adainit is Main_Priority : Integer; pragma Import (C, Main_Priority, "__gl_main_priority"); Time_Slice_Value : Integer; pragma Import (C, Time_Slice_Value, "__gl_time_slice_val"); WC_Encoding : Character; pragma Import (C, WC_Encoding, "__gl_wc_encoding"); Locking_Policy : Character; pragma Import (C, Locking_Policy, "__gl_locking_policy"); Queuing_Policy : Character; pragma Import (C, Queuing_Policy, "__gl_queuing_policy"); Task_Dispatching_Policy : Character; pragma Import (C, Task_Dispatching_Policy, "__gl_task_dispatching_policy"); Priority_Specific_Dispatching : System.Address; pragma Import (C, Priority_Specific_Dispatching, "__gl_priority_specific_dispatching"); Num_Specific_Dispatching : Integer; pragma Import (C, Num_Specific_Dispatching, "__gl_num_specific_dispatching"); Main_CPU : Integer; pragma Import (C, Main_CPU, "__gl_main_cpu"); Interrupt_States : System.Address; pragma Import (C, Interrupt_States, "__gl_interrupt_states"); Num_Interrupt_States : Integer; pragma Import (C, Num_Interrupt_States, "__gl_num_interrupt_states"); Unreserve_All_Interrupts : Integer; pragma Import (C, Unreserve_All_Interrupts, "__gl_unreserve_all_interrupts"); Detect_Blocking : Integer; pragma Import (C, Detect_Blocking, "__gl_detect_blocking"); Default_Stack_Size : Integer; pragma Import (C, Default_Stack_Size, "__gl_default_stack_size"); Leap_Seconds_Support : Integer; pragma Import (C, Leap_Seconds_Support, "__gl_leap_seconds_support"); Bind_Env_Addr : System.Address; pragma Import (C, Bind_Env_Addr, "__gl_bind_env_addr"); procedure Runtime_Initialize (Install_Handler : Integer); pragma Import (C, Runtime_Initialize, "__gnat_runtime_initialize"); Finalize_Library_Objects : No_Param_Proc; pragma Import (C, Finalize_Library_Objects, "__gnat_finalize_library_objects"); begin if Is_Elaborated then return; end if; Is_Elaborated := True; Main_Priority := -1; Time_Slice_Value := -1; WC_Encoding := 'b'; Locking_Policy := ' '; Queuing_Policy := ' '; Task_Dispatching_Policy := ' '; System.Restrictions.Run_Time_Restrictions := (Set => (False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, True, False, False, False, False, False, False, True, False, False, False, False, False, False, False, False, False, False, False, False, False, False), Value => (0, 0, 0, 0, 0, 0, 0, 0, 0, 0), Violated => (False, False, False, True, True, True, False, True, False, False, True, True, True, True, False, False, True, False, False, True, True, False, True, True, False, True, True, True, True, False, True, False, False, False, True, False, False, True, False, True, False, False, True, False, True, False, True, True, False, True, True, False, True, True, False, False, False, False, True, True, True, True, True, False, False, True, False, True, True, True, False, True, True, False, True, True, True, True, False, False, True, False, False, False, False, True, True, True, False, False, False), Count => (0, 0, 0, 0, 3, 4, 2, 0, 0, 0), Unknown => (False, False, False, False, False, False, True, False, False, False)); Priority_Specific_Dispatching := Local_Priority_Specific_Dispatching'Address; Num_Specific_Dispatching := 0; Main_CPU := -1; Interrupt_States := Local_Interrupt_States'Address; Num_Interrupt_States := 0; Unreserve_All_Interrupts := 0; Detect_Blocking := 0; Default_Stack_Size := -1; Leap_Seconds_Support := 0; Runtime_Initialize (1); Finalize_Library_Objects := finalize_library'access; System.Soft_Links'Elab_Spec; System.Exception_Table'Elab_Body; E019 := E019 + 1; System.Exceptions'Elab_Spec; E021 := E021 + 1; System.Soft_Links'Elab_Body; E013 := E013 + 1; System.Secondary_Stack'Elab_Body; E009 := E009 + 1; Ada.Containers'Elab_Spec; E336 := E336 + 1; Ada.Io_Exceptions'Elab_Spec; E067 := E067 + 1; Ada.Numerics'Elab_Spec; E304 := E304 + 1; Ada.Strings'Elab_Spec; E344 := E344 + 1; Interfaces.C'Elab_Spec; E077 := E077 + 1; Interfaces.C.Strings'Elab_Spec; E087 := E087 + 1; System.Os_Lib'Elab_Body; E079 := E079 + 1; System.Task_Info'Elab_Spec; E399 := E399 + 1; Ada.Tags'Elab_Spec; Ada.Tags'Elab_Body; E051 := E051 + 1; Ada.Streams'Elab_Spec; E066 := E066 + 1; System.File_Control_Block'Elab_Spec; E082 := E082 + 1; System.Finalization_Root'Elab_Spec; E075 := E075 + 1; Ada.Finalization'Elab_Spec; E073 := E073 + 1; System.File_Io'Elab_Body; E072 := E072 + 1; Ada.Streams.Stream_Io'Elab_Spec; E364 := E364 + 1; System.Storage_Pools'Elab_Spec; E095 := E095 + 1; System.Finalization_Masters'Elab_Spec; System.Finalization_Masters'Elab_Body; E089 := E089 + 1; System.Storage_Pools.Subpools'Elab_Spec; E109 := E109 + 1; Ada.Calendar'Elab_Spec; Ada.Calendar'Elab_Body; E372 := E372 + 1; Ada.Calendar.Delays'Elab_Body; E370 := E370 + 1; Ada.Text_Io'Elab_Spec; Ada.Text_Io'Elab_Body; E064 := E064 + 1; System.Assertions'Elab_Spec; E128 := E128 + 1; Ada.Strings.Maps'Elab_Spec; E350 := E350 + 1; Ada.Strings.Unbounded'Elab_Spec; E346 := E346 + 1; Ada.Real_Time'Elab_Spec; Ada.Real_Time'Elab_Body; E384 := E384 + 1; System.Pool_Global'Elab_Spec; E097 := E097 + 1; System.Random_Seed'Elab_Body; E443 := E443 + 1; System.Tasking.Initialization'Elab_Body; E417 := E417 + 1; System.Tasking.Protected_Objects'Elab_Body; E425 := E425 + 1; System.Tasking.Protected_Objects.Entries'Elab_Spec; E427 := E427 + 1; System.Tasking.Queuing'Elab_Body; E431 := E431 + 1; System.Tasking.Stages'Elab_Body; E437 := E437 + 1; Glib'Elab_Spec; E085 := E085 + 1; Gtkada.Types'Elab_Spec; E126 := E126 + 1; Gdk.Frame_Timings'Elab_Spec; E179 := E179 + 1; E130 := E130 + 1; Gdk.Visual'Elab_Body; E162 := E162 + 1; E132 := E132 + 1; E124 := E124 + 1; Glib.Object'Elab_Spec; Glib.Values'Elab_Body; E122 := E122 + 1; E107 := E107 + 1; E120 := E120 + 1; E114 := E114 + 1; E105 := E105 + 1; Cairo'Elab_Spec; E143 := E143 + 1; E145 := E145 + 1; E149 := E149 + 1; Glib.Generic_Properties'Elab_Spec; Glib.Generic_Properties'Elab_Body; E152 := E152 + 1; Gdk.Color'Elab_Spec; E173 := E173 + 1; E154 := E154 + 1; E147 := E147 + 1; E282 := E282 + 1; E164 := E164 + 1; E244 := E244 + 1; Glib.Variant'Elab_Spec; E242 := E242 + 1; E240 := E240 + 1; Gtk.Actionable'Elab_Spec; E310 := E310 + 1; Gtk.Builder'Elab_Spec; Gtk.Builder'Elab_Body; E187 := E187 + 1; E224 := E224 + 1; Gtk.Cell_Area_Context'Elab_Spec; Gtk.Cell_Area_Context'Elab_Body; E256 := E256 + 1; Gtk.Css_Section'Elab_Spec; E272 := E272 + 1; E167 := E167 + 1; Gtk.Orientable'Elab_Spec; E230 := E230 + 1; Gtk.Paper_Size'Elab_Spec; E284 := E284 + 1; Gtk.Page_Setup'Elab_Spec; Gtk.Page_Setup'Elab_Body; E280 := E280 + 1; Gtk.Print_Settings'Elab_Spec; Gtk.Print_Settings'Elab_Body; E292 := E292 + 1; E195 := E195 + 1; Gtk.Target_List'Elab_Spec; E193 := E193 + 1; E380 := E380 + 1; LR.SYNCHRO.FIFO'ELAB_BODY; E382 := E382 + 1; E200 := E200 + 1; Pango.Attributes'Elab_Spec; E218 := E218 + 1; Pango.Font_Metrics'Elab_Spec; E204 := E204 + 1; Pango.Language'Elab_Spec; E206 := E206 + 1; Pango.Font'Elab_Spec; Pango.Font'Elab_Body; E202 := E202 + 1; E298 := E298 + 1; Gtk.Text_Tag'Elab_Spec; Gtk.Text_Tag'Elab_Body; E300 := E300 + 1; Pango.Font_Face'Elab_Spec; Pango.Font_Face'Elab_Body; E210 := E210 + 1; Pango.Font_Family'Elab_Spec; Pango.Font_Family'Elab_Body; E208 := E208 + 1; Pango.Fontset'Elab_Spec; Pango.Fontset'Elab_Body; E212 := E212 + 1; E214 := E214 + 1; Pango.Context'Elab_Spec; Pango.Context'Elab_Body; E198 := E198 + 1; Pango.Font_Map'Elab_Spec; Pango.Font_Map'Elab_Body; E288 := E288 + 1; Pango.Tabs'Elab_Spec; E220 := E220 + 1; Pango.Layout'Elab_Spec; Pango.Layout'Elab_Body; E216 := E216 + 1; Gtk.Print_Context'Elab_Spec; Gtk.Print_Context'Elab_Body; E286 := E286 + 1; Gdk.Display'Elab_Spec; Gtk.Tree_Model'Elab_Spec; Gtk.Entry_Buffer'Elab_Spec; Gtk.Cell_Editable'Elab_Spec; Gtk.Adjustment'Elab_Spec; Gtk.Style'Elab_Spec; Gtk.Accel_Group'Elab_Spec; Gdk.Frame_Clock'Elab_Spec; Gdk.Pixbuf'Elab_Spec; Gtk.Icon_Source'Elab_Spec; E268 := E268 + 1; E181 := E181 + 1; Gdk.Screen'Elab_Spec; Gdk.Screen'Elab_Body; E160 := E160 + 1; Gdk.Device'Elab_Spec; Gdk.Drag_Contexts'Elab_Spec; Gdk.Drag_Contexts'Elab_Body; E175 := E175 + 1; Gdk.Device'Elab_Body; E136 := E136 + 1; E296 := E296 + 1; Gdk.Window'Elab_Spec; E234 := E234 + 1; Gtk.Selection_Data'Elab_Spec; E189 := E189 + 1; Gtk.Widget'Elab_Spec; Gtk.Misc'Elab_Spec; Gtk.Misc'Elab_Body; E274 := E274 + 1; E169 := E169 + 1; Gtk.Settings'Elab_Spec; Gtk.Settings'Elab_Body; E158 := E158 + 1; Gtk.Style_Context'Elab_Spec; Gtk.Icon_Set'Elab_Spec; E266 := E266 + 1; Gtk.Image'Elab_Spec; Gtk.Image'Elab_Body; E264 := E264 + 1; Gtk.Cell_Renderer'Elab_Spec; Gtk.Container'Elab_Spec; Gtk.Bin'Elab_Spec; Gtk.Bin'Elab_Body; E236 := E236 + 1; Gtk.Box'Elab_Spec; Gtk.Box'Elab_Body; E222 := E222 + 1; Gtk.Status_Bar'Elab_Spec; Gtk.Notebook'Elab_Spec; E258 := E258 + 1; Gtk.Cell_Area'Elab_Spec; Gtk.Entry_Completion'Elab_Spec; Gtk.Window'Elab_Spec; Gtk.Dialog'Elab_Spec; Gtk.Print_Operation'Elab_Spec; Gtk.Gentry'Elab_Spec; Gtk.Status_Bar'Elab_Body; E294 := E294 + 1; E290 := E290 + 1; Gtk.Print_Operation'Elab_Body; E278 := E278 + 1; Gtk.Notebook'Elab_Body; E276 := E276 + 1; Gtk.Style_Context'Elab_Body; E270 := E270 + 1; Gtk.Gentry'Elab_Body; E238 := E238 + 1; E262 := E262 + 1; Gtk.Cell_Area'Elab_Body; E254 := E254 + 1; Gtk.Entry_Completion'Elab_Body; E252 := E252 + 1; Gtk.Cell_Renderer'Elab_Body; E260 := E260 + 1; Gtk.Entry_Buffer'Elab_Body; E250 := E250 + 1; E248 := E248 + 1; E246 := E246 + 1; Gtk.Window'Elab_Body; E232 := E232 + 1; Gtk.Dialog'Elab_Body; E156 := E156 + 1; Gtk.Adjustment'Elab_Body; E228 := E228 + 1; Gtk.Container'Elab_Body; E226 := E226 + 1; Gtk.Style'Elab_Body; E191 := E191 + 1; Gtk.Widget'Elab_Body; E171 := E171 + 1; Gtk.Accel_Group'Elab_Body; E185 := E185 + 1; Gdk.Frame_Clock'Elab_Body; E177 := E177 + 1; E141 := E141 + 1; Gdk.Display'Elab_Body; E139 := E139 + 1; Glib.Menu_Model'Elab_Spec; Glib.Menu_Model'Elab_Body; E320 := E320 + 1; Gtk.Action'Elab_Spec; Gtk.Action'Elab_Body; E308 := E308 + 1; Gtk.Activatable'Elab_Spec; E312 := E312 + 1; Gtk.Button'Elab_Spec; Gtk.Button'Elab_Body; E306 := E306 + 1; Gtk.Grange'Elab_Spec; Gtk.Grange'Elab_Body; E314 := E314 + 1; E134 := E134 + 1; E330 := E330 + 1; Gtk.Menu_Item'Elab_Spec; Gtk.Menu_Item'Elab_Body; E322 := E322 + 1; Gtk.Menu_Shell'Elab_Spec; Gtk.Menu_Shell'Elab_Body; E324 := E324 + 1; Gtk.Menu'Elab_Spec; Gtk.Menu'Elab_Body; E318 := E318 + 1; Gtk.Label'Elab_Spec; Gtk.Label'Elab_Body; E316 := E316 + 1; Gtk.Tree_View_Column'Elab_Spec; Gtk.Tree_View_Column'Elab_Body; E332 := E332 + 1; Gtkada.Handlers'Elab_Spec; E333 := E333 + 1; Gtkada.Builder'Elab_Spec; Gtkada.Builder'Elab_Body; E326 := E326 + 1; LR.TASKS'ELAB_SPEC; LR.SIMU'ELAB_BODY; E368 := E368 + 1; LR.TASKS'ELAB_BODY; E378 := E378 + 1; LR.AFFIC'ELAB_BODY; E303 := E303 + 1; end adainit; procedure Ada_Main_Program; pragma Import (Ada, Ada_Main_Program, "_ada_lr__main"); function main (argc : Integer; argv : System.Address; envp : System.Address) return Integer is procedure Initialize (Addr : System.Address); pragma Import (C, Initialize, "__gnat_initialize"); procedure Finalize; pragma Import (C, Finalize, "__gnat_finalize"); SEH : aliased array (1 .. 2) of Integer; Ensure_Reference : aliased System.Address := Ada_Main_Program_Name'Address; pragma Volatile (Ensure_Reference); begin gnat_argc := argc; gnat_argv := argv; gnat_envp := envp; Initialize (SEH'Address); adainit; Ada_Main_Program; adafinal; Finalize; return (gnat_exit_status); end; -- BEGIN Object file/option list -- /home/hmoudden/Bureau/TP-Ada-LR/lr.o -- /home/hmoudden/Bureau/TP-Ada-LR/lr-synchro.o -- /home/hmoudden/Bureau/TP-Ada-LR/lr-synchro-fifo.o -- /home/hmoudden/Bureau/TP-Ada-LR/lr-simu.o -- /home/hmoudden/Bureau/TP-Ada-LR/lr-tasks.o -- /home/hmoudden/Bureau/TP-Ada-LR/lr-affic.o -- /home/hmoudden/Bureau/TP-Ada-LR/lr-main.o -- -L/home/hmoudden/Bureau/TP-Ada-LR/ -- -L/home/hmoudden/Bureau/TP-Ada-LR/ -- -L/usr/lib/x86_64-linux-gnu/ada/adalib/gtkada/ -- -L/usr/lib/gcc/x86_64-linux-gnu/7/adalib/ -- -shared -- -shared-libgcc -- -shared-libgcc -- -lgthread-2.0 -- -shared-libgcc -- -lgnarl-7 -- -lgnat-7 -- -lpthread -- -lrt -- END Object file/option list end ada_main;
-- SPDX-FileCopyrightText: 2022 Max Reznik <reznikmm@gmail.com> -- -- SPDX-License-Identifier: MIT ------------------------------------------------------------- private with Ada.Finalization; private with Regions.Shared_Lists; limited private with Regions.Contexts.Environments.Nodes; package Regions.Contexts.Environments is pragma Preelaborate; type Environment is tagged private; -- function Use_Visible -- function Directly_Visible function Nested_Regions (Self : Environment'Class) return Regions.Entity_Iterator_Interfaces.Forward_Iterator'Class; private type Environment_Node_Access is access all Regions.Contexts.Environments.Nodes.Environment_Node'Class; type Environment is new Ada.Finalization.Controlled with record Data : Environment_Node_Access; end record; overriding procedure Adjust (Self : in out Environment); overriding procedure Finalize (Self : in out Environment); package Selected_Entity_Name_Lists is new Regions.Shared_Lists (Selected_Entity_Name); end Regions.Contexts.Environments;
-- -- ABench2020 Benchmark Suite -- -- Parallel Factorial Program -- -- Licensed under the MIT License. See LICENSE file in the ABench root -- directory for license information. -- -- Uncomment the line below to print the result. -- with Ada.Text_IO; use Ada.Text_IO; with Ada.Command_Line; use Ada.Command_Line; procedure PFactorial is function Calculate_Factorial (Start_Value : Long_Integer; End_Value : Long_Integer) return Long_Integer is Result : Long_Integer := 1; begin for I in Long_Integer range Start_Value .. End_Value loop Result := Result * I; end loop; return Result; end; task type Factorial_Task is entry Start (Start_Value : in Long_Integer; End_Value : in Long_Integer); entry Report (Result_Value : out Long_Integer); end Factorial_Task; task body Factorial_Task is Local_Start_Value : Long_Integer; Local_End_Value : Long_Integer; Local_Result_Value : Long_Integer; begin accept Start (Start_Value : in Long_Integer; End_Value : in Long_Integer) do Local_Start_Value := Start_Value; Local_End_Value := End_Value; end Start; Local_Result_Value := Calculate_Factorial (Local_Start_Value, Local_End_Value); accept Report (Result_Value : out Long_Integer) do Result_Value := Local_Result_Value; end Report; end; Task1 : Factorial_Task; Task2 : Factorial_Task; External_Value : Long_Integer := Long_Integer'Value (Ada.Command_Line.Argument (1)); Factorial_Value : Long_Integer := 1; Thread1_Value : Long_Integer := 1; Thread2_Value : Long_Integer := 1; begin Task1.Start (1, External_Value / 2); Task2.Start (External_Value / 2 + 1 , External_Value); Task1.Report (Thread1_Value); Task2.Report (Thread2_Value); Factorial_Value := Thread1_Value * Thread2_Value; -- Uncomment the line below to print the result. -- Put_Line (Long_Integer'Image (Factorial_Value)); end;
package Units is type TramNumber is new Integer range -1 .. 100; type SteeringNumber is new Integer range -1 .. 100; procedure Dummy; end Units;
------------------------------------------------------------------------------ -- -- -- JSON Parser/Constructor -- -- -- -- ------------------------------------------------------------------------ -- -- -- -- Copyright (C) 2021, ANNEXI-STRAYLINE Trans-Human Ltd. -- -- All rights reserved. -- -- -- -- Original Contributors: -- -- * Richard Wai (ANNEXI-STRAYLINE) -- -- -- -- Redistribution and use in source and binary forms, with or without -- -- modification, are permitted provided that the following conditions are -- -- met: -- -- -- -- * Redistributions of source code must retain the above copyright -- -- notice, this list of conditions and the following disclaimer. -- -- -- -- * Redistributions in binary form must reproduce the above copyright -- -- notice, this list of conditions and the following disclaimer in -- -- the documentation and/or other materials provided with the -- -- distribution. -- -- -- -- * Neither the name of the copyright holder nor the names of its -- -- contributors may be used to endorse or promote products derived -- -- from this software without specific prior written permission. -- -- -- -- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -- -- "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -- -- LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A -- -- PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -- -- OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -- -- SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -- -- LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -- -- DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -- -- THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -- -- (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -- -- OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -- -- -- ------------------------------------------------------------------------------ separate (JSON.Unbounded_Codecs.Node_Hash_Maps) package body Indexing_Strategies is package MH renames Modular_Hashing; type Indexing_Tactic is not null access function (Bin: MH.Hash_Binary_Value) return Match_Table_Index; type Indexing_Tactics is array (Config.Hash_Algorithm, Match_Level) of Indexing_Tactic; -- Primary_Tactics -- function XXHL32_PRI_L1 (Bin: MH.Hash_Binary_Value) return Match_Table_Index; function XXHL32_PRI_L2 (Bin: MH.Hash_Binary_Value) return Match_Table_Index; function XXHL32_PRI_L3 (Bin: MH.Hash_Binary_Value) return Match_Table_Index; function XXHL32_PRI_L4 (Bin: MH.Hash_Binary_Value) return Match_Table_Index; function XXHL64_PRI_L1 (Bin: MH.Hash_Binary_Value) return Match_Table_Index; function XXHL64_PRI_L2 (Bin: MH.Hash_Binary_Value) return Match_Table_Index; function XXHL64_PRI_L3 (Bin: MH.Hash_Binary_Value) return Match_Table_Index; function XXHL64_PRI_L4 (Bin: MH.Hash_Binary_Value) return Match_Table_Index; Primary_Tactics: constant Indexing_Tactics := (xxHash32 => (1 => XXHL32_PRI_L1'Access, 2 => XXHL32_PRI_L2'Access, 3 => XXHL32_PRI_L3'Access, 4 => XXHL32_PRI_L4'Access), xxHash64 => (1 => XXHL64_PRI_L1'Access, 2 => XXHL64_PRI_L2'Access, 3 => XXHL64_PRI_L3'Access, 4 => XXHL64_PRI_L4'Access)); -- Secondary_Tactics -- function XXHL32_SEC_L1 (Bin: MH.Hash_Binary_Value) return Match_Table_Index; function XXHL32_SEC_L2 (Bin: MH.Hash_Binary_Value) return Match_Table_Index; function XXHL32_SEC_L3 (Bin: MH.Hash_Binary_Value) return Match_Table_Index; function XXHL32_SEC_L4 (Bin: MH.Hash_Binary_Value) return Match_Table_Index; function XXHL64_SEC_L1 (Bin: MH.Hash_Binary_Value) return Match_Table_Index; function XXHL64_SEC_L2 (Bin: MH.Hash_Binary_Value) return Match_Table_Index; function XXHL64_SEC_L3 (Bin: MH.Hash_Binary_Value) return Match_Table_Index; function XXHL64_SEC_L4 (Bin: MH.Hash_Binary_Value) return Match_Table_Index; Secondary_Tactics: constant Indexing_Tactics := (xxHash32 => (1 => XXHL32_SEC_L1'Access, 2 => XXHL32_SEC_L2'Access, 3 => XXHL32_SEC_L3'Access, 4 => XXHL32_SEC_L4'Access), xxHash64 => (1 => XXHL64_SEC_L1'Access, 2 => XXHL64_SEC_L2'Access, 3 => XXHL64_SEC_L3'Access, 4 => XXHL64_SEC_L4'Access)); ------------------ -- Compute_Plan -- ------------------ generic Tactics: in Indexing_Tactics; function Generic_Compute_Plan (Hash: Hash_Container) return Indexing_Plan; function Generic_Compute_Plan (Hash: Hash_Container) return Indexing_Plan is Algo: Config.Hash_Algorithm renames Config.Unbounded_Codec_Hash_Algo; Hash_Bin: MH.Hash_Binary_Value := (case Hash.Kind is when xxHash32 => Hash.XXH32.Binary, when xxHash64 => Hash.XXH64.Binary); begin pragma Assert (Hash_Bin'First = 1); pragma Assert (case Algo is when xxHash32 => Hash_Bin'Length = 4, when xxHash64 => Hash_Bin'Length = 8); return Plan: Indexing_Plan do for Level in Match_Level'Range loop Plan(Level) := Tactics(Algo, Level)(Hash_Bin); end loop; end return; end; function Compute_Primary_Plan_Instance is new Generic_Compute_Plan (Primary_Tactics); function Compute_Primary_Plan (Hash: Hash_Container) return Indexing_Plan renames Compute_Primary_Plan_Instance; function Compute_Secondary_Plan_Instance is new Generic_Compute_Plan (Secondary_Tactics); function Compute_Secondary_Plan (Hash: Hash_Container) return Indexing_Plan renames Compute_Secondary_Plan_Instance; -- -- Strategies -- -- Strategy descriptions -- -- xxHash32 -- -------- -- xxHash32 produces a 4-octet (32-bit) value, which matches exactly the -- number of Match Levels. The strategy is simple, for the primary tactics, -- we will use the octets in order of their index vis-a-vis the match level. -- -- For the secondary tactics, we will simply go in reverse order. -- xxHash64 -- -------- -- xxHash64 produces an 8-octet (64-bit) value. The XXH64 strategy -- interleves odd (primary) and even (secondary) octets per match level. -------------- -- xxHash32 -- -------------- function XXHL32_PRI_L1 (Bin: MH.Hash_Binary_Value) return Match_Table_Index is (Match_Table_Index(Bin (1))); function XXHL32_PRI_L2 (Bin: MH.Hash_Binary_Value) return Match_Table_Index is (Match_Table_Index(Bin (2))); function XXHL32_PRI_L3 (Bin: MH.Hash_Binary_Value) return Match_Table_Index is (Match_Table_Index(Bin (3))); function XXHL32_PRI_L4 (Bin: MH.Hash_Binary_Value) return Match_Table_Index is (Match_Table_Index(Bin (4))); function XXHL32_SEC_L1 (Bin: MH.Hash_Binary_Value) return Match_Table_Index is (Match_Table_Index(Bin (4))); function XXHL32_SEC_L2 (Bin: MH.Hash_Binary_Value) return Match_Table_Index is (Match_Table_Index(Bin (3))); function XXHL32_SEC_L3 (Bin: MH.Hash_Binary_Value) return Match_Table_Index is (Match_Table_Index(Bin (2))); function XXHL32_SEC_L4 (Bin: MH.Hash_Binary_Value) return Match_Table_Index is (Match_Table_Index(Bin (1))); -------------- -- xxHash64 -- -------------- function XXHL64_PRI_L1 (Bin: MH.Hash_Binary_Value) return Match_Table_Index is (Match_Table_Index(Bin (1))); function XXHL64_PRI_L2 (Bin: MH.Hash_Binary_Value) return Match_Table_Index is (Match_Table_Index(Bin (3))); function XXHL64_PRI_L3 (Bin: MH.Hash_Binary_Value) return Match_Table_Index is (Match_Table_Index(Bin (5))); function XXHL64_PRI_L4 (Bin: MH.Hash_Binary_Value) return Match_Table_Index is (Match_Table_Index(Bin (7))); function XXHL64_SEC_L1 (Bin: MH.Hash_Binary_Value) return Match_Table_Index is (Match_Table_Index(Bin (2))); function XXHL64_SEC_L2 (Bin: MH.Hash_Binary_Value) return Match_Table_Index is (Match_Table_Index(Bin (4))); function XXHL64_SEC_L3 (Bin: MH.Hash_Binary_Value) return Match_Table_Index is (Match_Table_Index(Bin (6))); function XXHL64_SEC_L4 (Bin: MH.Hash_Binary_Value) return Match_Table_Index is (Match_Table_Index(Bin (8))); end Indexing_Strategies;
----------------------------------------------------------------------- -- util-streams-tests -- Unit tests for encoding buffered streams -- Copyright (C) 2017, 2018, 2019 Stephane Carrez -- Written by Stephane Carrez (Stephane.Carrez@gmail.com) -- -- Licensed under the Apache License, Version 2.0 (the "License"); -- you may not use this file except in compliance with the License. -- You may obtain a copy of the License at -- -- http://www.apache.org/licenses/LICENSE-2.0 -- -- Unless required by applicable law or agreed to in writing, software -- distributed under the License is distributed on an "AS IS" BASIS, -- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -- See the License for the specific language governing permissions and -- limitations under the License. ----------------------------------------------------------------------- with Util.Test_Caller; with Util.Streams.Files; with Util.Streams.Texts; with Util.Streams.Base64; with Util.Streams.AES; with Ada.IO_Exceptions; with Ada.Streams.Stream_IO; package body Util.Streams.Tests is use Util.Streams.Files; use Ada.Streams.Stream_IO; package Caller is new Util.Test_Caller (Test, "Streams"); generic Mode : in Util.Encoders.AES.AES_Mode; Label : in String; procedure Test_AES_Mode (T : in out Test); procedure Test_AES (T : in out Test; Item : in String; Count : in Positive; Mode : in Util.Encoders.AES.AES_Mode; Label : in String) is Reader : aliased Util.Streams.Texts.Reader_Stream; Decipher : aliased Util.Streams.AES.Decoding_Stream; Cipher : aliased Util.Streams.AES.Encoding_Stream; Print : Util.Streams.Texts.Print_Stream; Key : Util.Encoders.Secret_Key := Util.Encoders.Create ("0123456789abcdef0123456789abcdef"); begin -- Print -> Cipher -> Decipher Decipher.Initialize (64 * 1024); Decipher.Set_Key (Key, Mode); Cipher.Initialize (Decipher'Access, 1024); Cipher.Set_Key (Key, Mode); Print.Initialize (Cipher'Access); for I in 1 .. Count loop Print.Write (Item); end loop; Print.Flush; Util.Tests.Assert_Equals (T, Item'Length * Count, Decipher.Get_Size, Label & ": decipher buffer has the wrong size mode"); -- Read content in Decipher Reader.Initialize (Decipher); for I in 1 .. Count loop declare L : String (Item'Range) := (others => ' '); begin for J in L'Range loop Reader.Read (L (J)); end loop; Util.Tests.Assert_Equals (T, Item, L, Label & ": wrong value"); exception when Ada.IO_Exceptions.Data_Error => Util.Tests.Assert_Equals (T, Item, L, Label & ": wrong value (DATA error)"); end; end loop; end Test_AES; procedure Test_AES_Mode (T : in out Test) is begin for I in 1 .. 128 loop Test_AES (T, "a", I, Mode, Label); end loop; for I in 1 .. 128 loop Test_AES (T, "ab", I, Mode, Label); end loop; for I in 1 .. 128 loop Test_AES (T, "abc", I, Mode, Label); end loop; end Test_AES_Mode; procedure Test_AES_ECB is new Test_AES_Mode (Mode => Util.Encoders.AES.ECB, Label => "AES-ECB"); procedure Test_AES_CBC is new Test_AES_Mode (Mode => Util.Encoders.AES.CBC, Label => "AES-CBC"); procedure Test_AES_PCBC is new Test_AES_Mode (Mode => Util.Encoders.AES.PCBC, Label => "AES-PCBC"); procedure Test_AES_CFB is new Test_AES_Mode (Mode => Util.Encoders.AES.PCBC, Label => "AES-CFB"); procedure Test_AES_OFB is new Test_AES_Mode (Mode => Util.Encoders.AES.PCBC, Label => "AES-OFB"); procedure Test_AES_CTR is new Test_AES_Mode (Mode => Util.Encoders.AES.PCBC, Label => "AES-CTR"); procedure Test_Base64_Stream (T : in out Test) is Stream : aliased File_Stream; Buffer : aliased Util.Streams.Base64.Encoding_Stream; Print : Util.Streams.Texts.Print_Stream; Path : constant String := Util.Tests.Get_Test_Path ("regtests/result/test-stream.b64"); Expect : constant String := Util.Tests.Get_Path ("regtests/expect/test-stream.b64"); begin Print.Initialize (Output => Buffer'Access, Size => 5); Buffer.Initialize (Output => Stream'Access, Size => 1024); Stream.Create (Mode => Out_File, Name => Path); for I in 1 .. 32 loop Print.Write ("abcd"); Print.Write (" fghij"); Print.Write (ASCII.LF); end loop; Print.Flush; Stream.Close; Util.Tests.Assert_Equal_Files (T => T, Expect => Expect, Test => Path, Message => "Base64 stream"); end Test_Base64_Stream; procedure Add_Tests (Suite : in Util.Tests.Access_Test_Suite) is begin Caller.Add_Test (Suite, "Test Util.Streams.Base64.Write, Read", Test_Base64_Stream'Access); Caller.Add_Test (Suite, "Test Util.Streams.AES (AES-ECB)", Test_AES_ECB'Access); Caller.Add_Test (Suite, "Test Util.Streams.AES (AES-CBC)", Test_AES_CBC'Access); Caller.Add_Test (Suite, "Test Util.Streams.AES (AES-PCBC)", Test_AES_PCBC'Access); Caller.Add_Test (Suite, "Test Util.Streams.AES (AES-CFB)", Test_AES_CFB'Access); Caller.Add_Test (Suite, "Test Util.Streams.AES (AES-OFB)", Test_AES_OFB'Access); Caller.Add_Test (Suite, "Test Util.Streams.AES (AES-CTR)", Test_AES_CTR'Access); end Add_Tests; end Util.Streams.Tests;
----------------------------------------------------------------------- -- gen-artifacts-query -- Query artifact for Code Generator -- Copyright (C) 2011, 2012, 2013 Stephane Carrez -- Written by Stephane Carrez (Stephane.Carrez@gmail.com) -- -- Licensed under the Apache License, Version 2.0 (the "License"); -- you may not use this file except in compliance with the License. -- You may obtain a copy of the License at -- -- http://www.apache.org/licenses/LICENSE-2.0 -- -- Unless required by applicable law or agreed to in writing, software -- distributed under the License is distributed on an "AS IS" BASIS, -- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -- See the License for the specific language governing permissions and -- limitations under the License. ----------------------------------------------------------------------- with Ada.Strings.Unbounded; with Ada.Directories; with Gen.Configs; with Gen.Utils; with Gen.Model.Tables; with Gen.Model.Queries; with Gen.Model.Mappings; with Util.Log.Loggers; with Util.Encoders.HMAC.SHA1; -- The <b>Gen.Artifacts.Query</b> package is an artifact for the generation of -- data structures returned by queries. package body Gen.Artifacts.Query is use Ada.Strings.Unbounded; use Gen.Model; use Gen.Model.Tables; use Gen.Model.Queries; use Gen.Configs; use type DOM.Core.Node; use Util.Log; Log : constant Loggers.Logger := Loggers.Create ("Gen.Artifacts.Query"); -- ------------------------------ -- After the configuration file is read, processes the node whose root -- is passed in <b>Node</b> and initializes the <b>Model</b> with the information. -- ------------------------------ procedure Initialize (Handler : in out Artifact; Path : in String; Node : in DOM.Core.Node; Model : in out Gen.Model.Packages.Model_Definition'Class; Context : in out Generator'Class) is procedure Register_Sort (Query : in out Query_Definition; Node : in DOM.Core.Node); procedure Register_Sorts (Query : in out Query_Definition; Node : in DOM.Core.Node); procedure Register_Column (Table : in out Query_Definition; Column : in DOM.Core.Node); procedure Register_Columns (Table : in out Query_Definition; Node : in DOM.Core.Node); procedure Register_Mapping (Query : in out Gen.Model.Queries.Query_File_Definition; Node : in DOM.Core.Node); procedure Register_Mapping (Model : in out Gen.Model.Packages.Model_Definition; Node : in DOM.Core.Node); procedure Register_Query (Query : in out Gen.Model.Queries.Query_File_Definition; Node : in DOM.Core.Node); Hash : Unbounded_String; -- ------------------------------ -- Register the column definition in the table -- ------------------------------ procedure Register_Column (Table : in out Query_Definition; Column : in DOM.Core.Node) is Name : constant Unbounded_String := Gen.Utils.Get_Attribute (Column, "name"); C : Column_Definition_Access; begin Table.Add_Column (Name, C); C.Initialize (Name, Column); C.Type_Name := To_Unbounded_String (Gen.Utils.Get_Normalized_Type (Column, "type")); C.Is_Inserted := False; C.Is_Updated := False; C.Not_Null := False; C.Unique := False; -- Construct the hash for this column mapping. Append (Hash, ",type="); Append (Hash, C.Type_Name); Append (Hash, ",name="); Append (Hash, Name); end Register_Column; -- ------------------------------ -- Register all the columns defined in the table -- ------------------------------ procedure Register_Columns (Table : in out Query_Definition; Node : in DOM.Core.Node) is procedure Iterate is new Gen.Utils.Iterate_Nodes (T => Query_Definition, Process => Register_Column); begin Log.Debug ("Register columns from query {0}", Table.Name); Iterate (Table, Node, "property"); end Register_Columns; -- ------------------------------ -- Register the sort definition in the query -- ------------------------------ procedure Register_Sort (Query : in out Query_Definition; Node : in DOM.Core.Node) is Name : constant Unbounded_String := Gen.Utils.Get_Attribute (Node, "name"); Sql : constant String := Gen.Utils.Get_Data_Content (Node); begin Query.Add_Sort (Name, To_Unbounded_String (Sql)); end Register_Sort; -- ------------------------------ -- Register all the sort modes defined in the query -- ------------------------------ procedure Register_Sorts (Query : in out Query_Definition; Node : in DOM.Core.Node) is procedure Iterate is new Gen.Utils.Iterate_Nodes (T => Query_Definition, Process => Register_Sort); begin Log.Debug ("Register sorts from query {0}", Query.Name); Iterate (Query, Node, "order"); end Register_Sorts; -- ------------------------------ -- Register a new class definition in the model. -- ------------------------------ procedure Register_Mapping (Query : in out Gen.Model.Queries.Query_File_Definition; Node : in DOM.Core.Node) is Name : constant Unbounded_String := Gen.Utils.Get_Attribute (Node, "name"); begin Query.Initialize (Name, Node); Query.Set_Table_Name (To_String (Name)); if Name /= "" then Query.Name := Name; else Query.Name := To_Unbounded_String (Gen.Utils.Get_Query_Name (Path)); end if; -- Construct the hash for this column mapping. Append (Hash, "class="); Append (Hash, Query.Name); Log.Debug ("Register query {0} with type {1}", Query.Name, Query.Type_Name); Register_Columns (Query_Definition (Query), Node); end Register_Mapping; -- ------------------------------ -- Register a new query. -- ------------------------------ procedure Register_Query (Query : in out Gen.Model.Queries.Query_File_Definition; Node : in DOM.Core.Node) is Name : constant Unbounded_String := Gen.Utils.Get_Attribute (Node, "name"); C : Gen.Model.Queries.Query_Definition_Access; begin Query.Add_Query (Name, C); Register_Sorts (Query_Definition (C.all), Node); end Register_Query; -- ------------------------------ -- Register a model mapping -- ------------------------------ procedure Register_Mapping (Model : in out Gen.Model.Packages.Model_Definition; Node : in DOM.Core.Node) is procedure Iterate_Mapping is new Gen.Utils.Iterate_Nodes (T => Gen.Model.Queries.Query_File_Definition, Process => Register_Mapping); procedure Iterate_Query is new Gen.Utils.Iterate_Nodes (T => Gen.Model.Queries.Query_File_Definition, Process => Register_Query); Table : constant Query_File_Definition_Access := new Query_File_Definition; Pkg : constant Unbounded_String := Gen.Utils.Get_Attribute (Node, "package"); Name : constant Unbounded_String := Gen.Utils.Get_Attribute (Node, "table"); begin Table.Initialize (Name, Node); Table.File_Name := To_Unbounded_String (Ada.Directories.Simple_Name (Path)); Table.Pkg_Name := Pkg; Iterate_Mapping (Query_File_Definition (Table.all), Node, "class"); Iterate_Query (Query_File_Definition (Table.all), Node, "query"); if Length (Table.Pkg_Name) = 0 then Context.Error ("Missing or empty package attribute"); else Model.Register_Query (Table); end if; Log.Info ("Query hash for {0} is {1}", Path, To_String (Hash)); Table.Sha1 := Util.Encoders.HMAC.SHA1.Sign (Key => "ADO.Queries", Data => To_String (Hash)); end Register_Mapping; procedure Iterate is new Gen.Utils.Iterate_Nodes (T => Gen.Model.Packages.Model_Definition, Process => Register_Mapping); begin Log.Debug ("Initializing query artifact for the configuration"); Gen.Artifacts.Artifact (Handler).Initialize (Path, Node, Model, Context); Iterate (Gen.Model.Packages.Model_Definition (Model), Node, "query-mapping"); end Initialize; -- ------------------------------ -- Prepare the generation of the package: -- o identify the column types which are used -- o build a list of package for the with clauses. -- ------------------------------ overriding procedure Prepare (Handler : in out Artifact; Model : in out Gen.Model.Packages.Model_Definition'Class; Context : in out Generator'Class) is pragma Unreferenced (Handler); begin Log.Debug ("Preparing the model for query"); if Model.Has_Packages then Context.Add_Generation (Name => GEN_PACKAGE_SPEC, Mode => ITERATION_PACKAGE, Mapping => Gen.Model.Mappings.ADA_MAPPING); Context.Add_Generation (Name => GEN_PACKAGE_BODY, Mode => ITERATION_PACKAGE, Mapping => Gen.Model.Mappings.ADA_MAPPING); end if; end Prepare; end Gen.Artifacts.Query;
pragma License (Unrestricted); -- implementation unit required by compiler package System.Wid_Enum is pragma Pure; -- required for Enum'Width by compiler (s-widenu.ads) function Width_Enumeration_8 ( Names : String; Indexes : Address; Lo, Hi : Natural) return Natural; function Width_Enumeration_16 ( Names : String; Indexes : Address; Lo, Hi : Natural) return Natural; function Width_Enumeration_32 ( Names : String; Indexes : Address; Lo, Hi : Natural) return Natural; pragma Pure_Function (Width_Enumeration_8); pragma Pure_Function (Width_Enumeration_16); pragma Pure_Function (Width_Enumeration_32); end System.Wid_Enum;
-- Copyright (C) 2019 Thierry Rascle <thierr26@free.fr> -- MIT license. Please refer to the LICENSE file. with Ada.Calendar; use Ada.Calendar; with Apsepp.Test_Node_Class; use Apsepp.Test_Node_Class; package Apsepp.Test_Reporter_Data_Struct_Class.Impl.Testing is type Node_Tag_W_Parent_Index is record Node_Tag : Tag; Parent_Index : Natural; Active : Boolean; end record; type Node_Tag_Tree_As_Array is array (Positive range <>) of Node_Tag_W_Parent_Index; function Tree_Tag (A : Node_Tag_Tree_As_Array; K : Positive) return Tag is (A(K).Node_Tag) with Pre => K in A'Range; function Tree_Parent_Tag (A : Node_Tag_Tree_As_Array; K : Positive) return Tag is (if A(K).Parent_Index = 0 then No_Tag else A(A(K).Parent_Index).Node_Tag) with Pre => K in A'Range; function Tree_Active (A : Node_Tag_Tree_As_Array; K : Positive) return Boolean is (A(K).Active) with Pre => K in A'Range; type Flattened_Event_Data is record Node_Tag : Tag; Has_E : Boolean; Date : Time; Previous_Child_Tag : Tag; R_Index : Test_Routine_Count; Assert_Num : Test_Assert_Count; end record; type Event_Data_Array is array (Positive range <>) of Flattened_Event_Data; function Current_R_Index (A : Event_Data_Array; K : Positive) return Test_Routine_Count with Pre => K in A'Range; function Current_Assert_Num (A : Event_Data_Array; K : Positive) return Test_Assert_Count with Pre => K in A'Range; function Has_Duplicate_Node_Tag (Obj : Test_Reporter_Data) return Boolean; function Node_Tag_Tree_Node_Count (Obj : Test_Reporter_Data) return Natural; function Event_Vector_Length (Obj : Test_Reporter_Data) return Natural; function Node_Event_Count (Obj : Test_Reporter_Data; Node_Tag : Tag) return Natural with Pre => not Has_Duplicate_Node_Tag (Obj); -- TODOC: Duplicated node tags not supported. <2019-11-06> procedure To_Arrays (Obj : Test_Reporter_Data; Node_Tag_Tree : out Node_Tag_Tree_As_Array; Event_Data : out Event_Data_Array) with Pre => not Has_Duplicate_Node_Tag (Obj) and then Node_Tag_Tree'Length = Node_Tag_Tree_Node_Count (Obj) and then Event_Data'Length = Event_Vector_Length (Obj); procedure To_Node_Event_Array (Obj : Test_Reporter_Data; Node_Tag : Tag; Event_Data : Event_Data_Array; Node_Event_Data : out Event_Data_Array) with Pre => not Has_Duplicate_Node_Tag (Obj) and then Event_Data'Length = Node_Event_Count (Obj, Node_Tag); function Latest_R_Index (Obj : Test_Reporter_Data; Node_Tag : Tag) return Test_Routine_Index with Pre => not Has_Duplicate_Node_Tag (Obj); end Apsepp.Test_Reporter_Data_Struct_Class.Impl.Testing;
------------------------------------------------------------------------------ -- -- -- GNU ADA RUN-TIME LIBRARY (GNARL) COMPONENTS -- -- -- -- S Y S T E M . O S _ I N T E R F A C E -- -- -- -- B o d y -- -- -- -- $Revision$ -- -- -- Copyright (C) 1997-2001 Florida State University -- -- -- -- GNARL is free software; you can redistribute it and/or modify it under -- -- terms of the GNU General Public License as published by the Free Soft- -- -- ware Foundation; either version 2, or (at your option) any later ver- -- -- sion. GNARL is distributed in the hope that it will be useful, but WITH- -- -- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY -- -- or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -- -- for more details. You should have received a copy of the GNU General -- -- Public License distributed with GNARL; see file COPYING. If not, write -- -- to the Free Software Foundation, 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. -- -- -- -- GNARL was developed by the GNARL team at Florida State University. It is -- -- now maintained by Ada Core Technologies Inc. in cooperation with Florida -- -- State University (http://www.gnat.com). -- -- -- ------------------------------------------------------------------------------ -- This is a FSU Threads version of this package pragma Polling (Off); -- Turn off polling, we do not want ATC polling to take place during -- tasking operations. It causes infinite loops and other problems. with Interfaces.C; package body System.OS_Interface is use Interfaces.C; ----------------- -- To_Duration -- ----------------- function To_Duration (TS : timespec) return Duration is begin return Duration (TS.tv_sec) + Duration (TS.tv_nsec) / 10#1#E9; end To_Duration; function To_Duration (TV : struct_timeval) return Duration is begin return Duration (TV.tv_sec) + Duration (TV.tv_usec) / 10#1#E6; end To_Duration; ----------------- -- To_Timespec -- ----------------- function To_Timespec (D : Duration) return timespec is S : time_t; F : Duration; begin S := time_t (Long_Long_Integer (D)); F := D - Duration (S); -- If F has negative value due to a round-up, adjust for positive F -- value. if F < 0.0 then S := S - 1; F := F + 1.0; end if; return timespec' (tv_sec => S, tv_nsec => long (Long_Long_Integer (F * 10#1#E9))); end To_Timespec; ---------------- -- To_Timeval -- ---------------- function To_Timeval (D : Duration) return struct_timeval is S : long; F : Duration; begin S := long (Long_Long_Integer (D)); F := D - Duration (S); -- If F has negative value due to a round-up, adjust for positive F -- value. if F < 0.0 then S := S - 1; F := F + 1.0; end if; return struct_timeval' (tv_sec => S, tv_usec => long (Long_Long_Integer (F * 10#1#E6))); end To_Timeval; ------------- -- sigwait -- ------------- -- FSU_THREADS has a nonstandard sigwait function sigwait (set : access sigset_t; sig : access Signal) return int is Result : int; function sigwait_base (set : access sigset_t) return int; pragma Import (C, sigwait_base, "sigwait"); begin Result := sigwait_base (set); if Result = -1 then sig.all := 0; return errno; end if; sig.all := Signal (Result); return 0; end sigwait; ------------------------ -- pthread_mutex_lock -- ------------------------ -- FSU_THREADS has nonstandard pthread_mutex_lock and unlock. -- It sets errno but the standard Posix requires it to be returned. function pthread_mutex_lock (mutex : access pthread_mutex_t) return int is function pthread_mutex_lock_base (mutex : access pthread_mutex_t) return int; pragma Import (C, pthread_mutex_lock_base, "pthread_mutex_lock"); Result : int; begin Result := pthread_mutex_lock_base (mutex); if Result /= 0 then return errno; end if; return 0; end pthread_mutex_lock; -------------------------- -- pthread_mutex_unlock -- -------------------------- function pthread_mutex_unlock (mutex : access pthread_mutex_t) return int is function pthread_mutex_unlock_base (mutex : access pthread_mutex_t) return int; pragma Import (C, pthread_mutex_unlock_base, "pthread_mutex_unlock"); Result : int; begin Result := pthread_mutex_unlock_base (mutex); if Result /= 0 then return errno; end if; return 0; end pthread_mutex_unlock; ----------------------- -- pthread_cond_wait -- ----------------------- -- FSU_THREADS has a nonstandard pthread_cond_wait. -- The FSU_THREADS version returns EINTR when interrupted. function pthread_cond_wait (cond : access pthread_cond_t; mutex : access pthread_mutex_t) return int is function pthread_cond_wait_base (cond : access pthread_cond_t; mutex : access pthread_mutex_t) return int; pragma Import (C, pthread_cond_wait_base, "pthread_cond_wait"); Result : int; begin Result := pthread_cond_wait_base (cond, mutex); if Result = EINTR then return 0; else return Result; end if; end pthread_cond_wait; ---------------------------- -- pthread_cond_timedwait -- ---------------------------- -- FSU_THREADS has a nonstandard pthread_cond_timedwait. The -- FSU_THREADS version returns -1 and set errno to EAGAIN for timeout. function pthread_cond_timedwait (cond : access pthread_cond_t; mutex : access pthread_mutex_t; abstime : access timespec) return int is function pthread_cond_timedwait_base (cond : access pthread_cond_t; mutex : access pthread_mutex_t; abstime : access timespec) return int; pragma Import (C, pthread_cond_timedwait_base, "pthread_cond_timedwait"); Result : int; begin Result := pthread_cond_timedwait_base (cond, mutex, abstime); if Result = -1 then if errno = EAGAIN then return ETIMEDOUT; else return EINVAL; end if; end if; return 0; end pthread_cond_timedwait; --------------------------- -- pthread_setschedparam -- --------------------------- -- FSU_THREADS does not have pthread_setschedparam -- This routine returns a non-negative value upon failure -- but the error code can not be set conforming the POSIX standard. function pthread_setschedparam (thread : pthread_t; policy : int; param : access struct_sched_param) return int is function pthread_setschedattr (thread : pthread_t; attr : pthread_attr_t) return int; pragma Import (C, pthread_setschedattr, "pthread_setschedattr"); attr : aliased pthread_attr_t; Result : int; begin Result := pthread_attr_init (attr'Access); if Result /= 0 then return Result; end if; attr.sched := policy; -- Short-cut around pthread_attr_setprio attr.prio := param.sched_priority; Result := pthread_setschedattr (thread, attr); if Result /= 0 then return Result; end if; Result := pthread_attr_destroy (attr'Access); if Result /= 0 then return Result; else return 0; end if; end pthread_setschedparam; ------------------------- -- pthread_getspecific -- ------------------------- -- FSU_THREADS has a nonstandard pthread_getspecific function pthread_getspecific (key : pthread_key_t) return System.Address is function pthread_getspecific_base (key : pthread_key_t; value : access System.Address) return int; pragma Import (C, pthread_getspecific_base, "pthread_getspecific"); Tmp : aliased System.Address; Result : int; begin Result := pthread_getspecific_base (key, Tmp'Access); if Result /= 0 then return System.Null_Address; end if; return Tmp; end pthread_getspecific; --------------------------------- -- pthread_attr_setdetachstate -- --------------------------------- function pthread_attr_setdetachstate (attr : access pthread_attr_t; detachstate : int) return int is function pthread_attr_setdetachstate_base (attr : access pthread_attr_t; detachstate : access int) return int; pragma Import (C, pthread_attr_setdetachstate_base, "pthread_attr_setdetachstate"); Tmp : aliased int := detachstate; begin return pthread_attr_setdetachstate_base (attr, Tmp'Access); end pthread_attr_setdetachstate; ----------------- -- sched_yield -- ----------------- -- FSU_THREADS does not have sched_yield; function sched_yield return int is procedure sched_yield_base (arg : System.Address); pragma Import (C, sched_yield_base, "pthread_yield"); begin sched_yield_base (System.Null_Address); return 0; end sched_yield; ---------------- -- Stack_Base -- ---------------- function Get_Stack_Base (thread : pthread_t) return Address is begin return thread.stack_base; end Get_Stack_Base; end System.OS_Interface;
----------------------------------------------------------------------- -- asf-contexts-exceptions -- Exception handlers in faces context -- Copyright (C) 2011 Stephane Carrez -- Written by Stephane Carrez (Stephane.Carrez@gmail.com) -- -- Licensed under the Apache License, Version 2.0 (the "License"); -- you may not use this file except in compliance with the License. -- You may obtain a copy of the License at -- -- http://www.apache.org/licenses/LICENSE-2.0 -- -- Unless required by applicable law or agreed to in writing, software -- distributed under the License is distributed on an "AS IS" BASIS, -- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -- See the License for the specific language governing permissions and -- limitations under the License. ----------------------------------------------------------------------- with Ada.Unchecked_Deallocation; with ASF.Contexts.Faces; with ASF.Applications.Messages.Factory; package body ASF.Contexts.Exceptions is -- ------------------------------ -- Take action to handle the <b>Exception_Event</b> instances that have been queued by -- calls to <b>Application.Publish_Event</b>. -- -- This operation is called after each ASF phase by the life cycle manager. -- ------------------------------ procedure Handle (Handler : in out Exception_Handler) is pragma Unreferenced (Handler); use ASF.Applications; use type ASF.Contexts.Faces.Faces_Context_Access; function Get_Message (Event : in Events.Exceptions.Exception_Event'Class; Context : in ASF.Contexts.Faces.Faces_Context'Class) return ASF.Applications.Messages.Message; procedure Process (Event : in Events.Exceptions.Exception_Event'Class; Remove : out Boolean; Context : in out ASF.Contexts.Faces.Faces_Context'Class); -- ------------------------------ -- Get a localized message for the exception -- ------------------------------ function Get_Message (Event : in Events.Exceptions.Exception_Event'Class; Context : in ASF.Contexts.Faces.Faces_Context'Class) return ASF.Applications.Messages.Message is Name : constant String := Event.Get_Exception_Name; Msg : constant String := Event.Get_Exception_Message; begin if Msg'Length = 0 then return Messages.Factory.Get_Message (Context => Context, Message_Id => EXCEPTION_MESSAGE_BASIC_ID, Param1 => Name); else return Messages.Factory.Get_Message (Context => Context, Message_Id => EXCEPTION_MESSAGE_EXTENDED_ID, Param1 => Name, Param2 => Msg); end if; end Get_Message; -- ------------------------------ -- Process each exception event and add a message in the faces context. -- ------------------------------ procedure Process (Event : in Events.Exceptions.Exception_Event'Class; Remove : out Boolean; Context : in out ASF.Contexts.Faces.Faces_Context'Class) is Msg : constant Messages.Message := Get_Message (Event, Context); begin Context.Add_Message (Client_Id => "", Message => Msg); Remove := True; end Process; Context : constant ASF.Contexts.Faces.Faces_Context_Access := ASF.Contexts.Faces.Current; begin if Context = null then return; end if; if Context.Get_Response_Completed then return; end if; Context.Iterate_Exception (Process'Access); end Handle; -- ------------------------------ -- Queue an exception event to the exception handler. The exception event will be -- processed at the end of the current ASF phase. -- ------------------------------ procedure Queue_Exception (Queue : in out Exception_Queue; Ex : in Ada.Exceptions.Exception_Occurrence) is begin Queue.Unhandled_Events.Append (ASF.Events.Exceptions.Create_Exception_Event (Ex)); end Queue_Exception; -- ------------------------------ -- Clear the exception queue. -- ------------------------------ overriding procedure Finalize (Queue : in out Exception_Queue) is procedure Free is new Ada.Unchecked_Deallocation (Object => ASF.Events.Exceptions.Exception_Event'Class, Name => ASF.Events.Exceptions.Exception_Event_Access); Len : Natural; begin loop Len := Natural (Queue.Unhandled_Events.Length); exit when Len = 0; declare Event : ASF.Events.Exceptions.Exception_Event_Access := Queue.Unhandled_Events.Element (Len); begin Free (Event); Queue.Unhandled_Events.Delete (Len); end; end loop; end Finalize; end ASF.Contexts.Exceptions;
-- SPDX-FileCopyrightText: 2019-2020 Max Reznik <reznikmm@gmail.com> -- -- SPDX-License-Identifier: MIT ------------------------------------------------------------- with Ada.Characters.Conversions; with Ada.Command_Line; with Ada.Wide_Wide_Text_IO; with Program.Compilation_Unit_Vectors; with Program.Compilation_Units; with Program.Plain_Contexts; with Program.Storage_Pools.Instance; pragma Unreferenced (Program.Storage_Pools.Instance); with Dump_Elements; with Errors; procedure Dump_Tree is procedure Process_Units (List : Program.Compilation_Unit_Vectors.Compilation_Unit_Vector_Access); procedure Process_Unit (Unit : Program.Compilation_Units.Compilation_Unit_Access); procedure Process_Unit (Unit : Program.Compilation_Units.Compilation_Unit_Access) is begin Ada.Wide_Wide_Text_IO.Put_Line ("Unit: " & Unit.Full_Name); Dump_Elements.Print (Unit.Unit_Declaration); end Process_Unit; procedure Process_Units (List : Program.Compilation_Unit_Vectors.Compilation_Unit_Vector_Access) is begin for Cursor in List.Each_Unit loop Process_Unit (Cursor.Unit); end loop; end Process_Units; Error : aliased Errors.Error_Listener; Ctx : aliased Program.Plain_Contexts.Context; begin Ctx.Initialize (Error'Unchecked_Access); for J in 1 .. Ada.Command_Line.Argument_Count loop declare Arg : constant Wide_Wide_String := Ada.Characters.Conversions.To_Wide_Wide_String (Ada.Command_Line.Argument (J)); begin if Arg'Length > 2 and then Arg (1 .. 2) = "-I" then Ctx.Add_Search_Directory (Arg (3 .. Arg'Last)); else Ctx.Parse_File (Arg); end if; end; end loop; Ctx.Complete_Analysis; -- Ada.Wide_Wide_Text_IO.Put_Line ("Compilation: " & C.Text_Name); -- Ada.Wide_Wide_Text_IO.Put_Line -- ("Total lines:" & Natural'Wide_Wide_Image (C.Line_Count)); -- Ada.Wide_Wide_Text_IO.Put_Line -- ("Total lexical elements:" -- & Natural'Wide_Wide_Image (C.Lexical_Element_Count)); Process_Units (Ctx.Library_Unit_Declarations); Process_Units (Ctx.Compilation_Unit_Bodies); end Dump_Tree;
pragma Ada_2012; pragma Style_Checks (Off); with Interfaces.C; use Interfaces.C; with bits_types_u_sigset_t_h; package bits_types_sigset_t_h is -- A set of signals to be blocked, unblocked, or waited for. subtype sigset_t is bits_types_u_sigset_t_h.uu_sigset_t; -- /usr/include/bits/types/sigset_t.h:7 end bits_types_sigset_t_h;
with HWIF; use HWIF; package Tasks is task ButtonPressed is entry Pressed(this : in Direction); end ButtonPressed; end Tasks;
-- Copyright 2016-2019 NXP -- All rights reserved.SPDX-License-Identifier: BSD-3-Clause -- This spec has been automatically generated from LPC55S6x.svd pragma Restrictions (No_Elaboration_Code); pragma Ada_2012; pragma Style_Checks (Off); with HAL; with System; package NXP_SVD.POWERQUAD is pragma Preelaborate; --------------- -- Registers -- --------------- subtype OUTFORMAT_out_formatint_Field is HAL.UInt2; subtype OUTFORMAT_out_formatext_Field is HAL.UInt2; subtype OUTFORMAT_out_scaler_Field is HAL.UInt8; -- Output format type OUTFORMAT_Register is record -- Output Internal format (00: q15; 01:q31; 10:float) out_formatint : OUTFORMAT_out_formatint_Field := 16#0#; -- unspecified Reserved_2_3 : HAL.UInt2 := 16#0#; -- Output External format (00: q15; 01:q31; 10:float) out_formatext : OUTFORMAT_out_formatext_Field := 16#0#; -- unspecified Reserved_6_7 : HAL.UInt2 := 16#0#; -- Output Scaler value (for scaled 'q31' formats) out_scaler : OUTFORMAT_out_scaler_Field := 16#0#; -- unspecified Reserved_16_31 : HAL.UInt16 := 16#0#; end record with Volatile_Full_Access, Size => 32, Bit_Order => System.Low_Order_First; for OUTFORMAT_Register use record out_formatint at 0 range 0 .. 1; Reserved_2_3 at 0 range 2 .. 3; out_formatext at 0 range 4 .. 5; Reserved_6_7 at 0 range 6 .. 7; out_scaler at 0 range 8 .. 15; Reserved_16_31 at 0 range 16 .. 31; end record; subtype TMPFORMAT_tmp_formatint_Field is HAL.UInt2; subtype TMPFORMAT_tmp_formatext_Field is HAL.UInt2; subtype TMPFORMAT_tmp_scaler_Field is HAL.UInt8; -- Temp format type TMPFORMAT_Register is record -- Temp Internal format (00: q15; 01:q31; 10:float) tmp_formatint : TMPFORMAT_tmp_formatint_Field := 16#0#; -- unspecified Reserved_2_3 : HAL.UInt2 := 16#0#; -- Temp External format (00: q15; 01:q31; 10:float) tmp_formatext : TMPFORMAT_tmp_formatext_Field := 16#0#; -- unspecified Reserved_6_7 : HAL.UInt2 := 16#0#; -- Temp Scaler value (for scaled 'q31' formats) tmp_scaler : TMPFORMAT_tmp_scaler_Field := 16#0#; -- unspecified Reserved_16_31 : HAL.UInt16 := 16#0#; end record with Volatile_Full_Access, Size => 32, Bit_Order => System.Low_Order_First; for TMPFORMAT_Register use record tmp_formatint at 0 range 0 .. 1; Reserved_2_3 at 0 range 2 .. 3; tmp_formatext at 0 range 4 .. 5; Reserved_6_7 at 0 range 6 .. 7; tmp_scaler at 0 range 8 .. 15; Reserved_16_31 at 0 range 16 .. 31; end record; subtype INAFORMAT_ina_formatint_Field is HAL.UInt2; subtype INAFORMAT_ina_formatext_Field is HAL.UInt2; subtype INAFORMAT_ina_scaler_Field is HAL.UInt8; -- Input A format type INAFORMAT_Register is record -- Input A Internal format (00: q15; 01:q31; 10:float) ina_formatint : INAFORMAT_ina_formatint_Field := 16#0#; -- unspecified Reserved_2_3 : HAL.UInt2 := 16#0#; -- Input A External format (00: q15; 01:q31; 10:float) ina_formatext : INAFORMAT_ina_formatext_Field := 16#0#; -- unspecified Reserved_6_7 : HAL.UInt2 := 16#0#; -- Input A Scaler value (for scaled 'q31' formats) ina_scaler : INAFORMAT_ina_scaler_Field := 16#0#; -- unspecified Reserved_16_31 : HAL.UInt16 := 16#0#; end record with Volatile_Full_Access, Size => 32, Bit_Order => System.Low_Order_First; for INAFORMAT_Register use record ina_formatint at 0 range 0 .. 1; Reserved_2_3 at 0 range 2 .. 3; ina_formatext at 0 range 4 .. 5; Reserved_6_7 at 0 range 6 .. 7; ina_scaler at 0 range 8 .. 15; Reserved_16_31 at 0 range 16 .. 31; end record; subtype INBFORMAT_inb_formatint_Field is HAL.UInt2; subtype INBFORMAT_inb_formatext_Field is HAL.UInt2; subtype INBFORMAT_inb_scaler_Field is HAL.UInt8; -- Input B format type INBFORMAT_Register is record -- Input B Internal format (00: q15; 01:q31; 10:float) inb_formatint : INBFORMAT_inb_formatint_Field := 16#0#; -- unspecified Reserved_2_3 : HAL.UInt2 := 16#0#; -- Input B External format (00: q15; 01:q31; 10:float) inb_formatext : INBFORMAT_inb_formatext_Field := 16#0#; -- unspecified Reserved_6_7 : HAL.UInt2 := 16#0#; -- Input B Scaler value (for scaled 'q31' formats) inb_scaler : INBFORMAT_inb_scaler_Field := 16#0#; -- unspecified Reserved_16_31 : HAL.UInt16 := 16#0#; end record with Volatile_Full_Access, Size => 32, Bit_Order => System.Low_Order_First; for INBFORMAT_Register use record inb_formatint at 0 range 0 .. 1; Reserved_2_3 at 0 range 2 .. 3; inb_formatext at 0 range 4 .. 5; Reserved_6_7 at 0 range 6 .. 7; inb_scaler at 0 range 8 .. 15; Reserved_16_31 at 0 range 16 .. 31; end record; subtype CONTROL_decode_opcode_Field is HAL.UInt4; subtype CONTROL_decode_machine_Field is HAL.UInt4; -- PowerQuad Control register type CONTROL_Register is record -- opcode specific to decode_machine decode_opcode : CONTROL_decode_opcode_Field := 16#0#; -- 0 : Coprocessor , 1 : matrix , 2 : fft , 3 : fir , 4 : stat , 5 : -- cordic , 6 -15 : NA decode_machine : CONTROL_decode_machine_Field := 16#0#; -- unspecified Reserved_8_30 : HAL.UInt23 := 16#0#; -- Read-only. Instruction busy signal when high indicates processing is -- on inst_busy : Boolean := False; end record with Volatile_Full_Access, Size => 32, Bit_Order => System.Low_Order_First; for CONTROL_Register use record decode_opcode at 0 range 0 .. 3; decode_machine at 0 range 4 .. 7; Reserved_8_30 at 0 range 8 .. 30; inst_busy at 0 range 31 .. 31; end record; subtype CPPRE_cppre_in_Field is HAL.UInt8; subtype CPPRE_cppre_out_Field is HAL.UInt8; -- CPPRE_cppre_sat array type CPPRE_cppre_sat_Field_Array is array (1 .. 2) of Boolean with Component_Size => 1, Size => 2; -- Type definition for CPPRE_cppre_sat type CPPRE_cppre_sat_Field (As_Array : Boolean := False) is record case As_Array is when False => -- cppre_sat as a value Val : HAL.UInt2; when True => -- cppre_sat as an array Arr : CPPRE_cppre_sat_Field_Array; end case; end record with Unchecked_Union, Size => 2; for CPPRE_cppre_sat_Field use record Val at 0 range 0 .. 1; Arr at 0 range 0 .. 1; end record; -- Pre-scale register type CPPRE_Register is record -- co-processor scaling of input cppre_in : CPPRE_cppre_in_Field := 16#0#; -- co-processor fixed point output cppre_out : CPPRE_cppre_out_Field := 16#0#; -- 1 : forces sub-32 bit saturation cppre_sat : CPPRE_cppre_sat_Field := (As_Array => False, Val => 16#0#); -- unspecified Reserved_18_31 : HAL.UInt14 := 16#0#; end record with Volatile_Full_Access, Size => 32, Bit_Order => System.Low_Order_First; for CPPRE_Register use record cppre_in at 0 range 0 .. 7; cppre_out at 0 range 8 .. 15; cppre_sat at 0 range 16 .. 17; Reserved_18_31 at 0 range 18 .. 31; end record; -- Cursory register type CURSORY_Register is record -- 1 : Enable cursory mode cursory : Boolean := False; -- unspecified Reserved_1_31 : HAL.UInt31 := 16#0#; end record with Volatile_Full_Access, Size => 32, Bit_Order => System.Low_Order_First; for CURSORY_Register use record cursory at 0 range 0 .. 0; Reserved_1_31 at 0 range 1 .. 31; end record; -- Read/Write register where error statuses are captured (sticky) type ERRSTAT_Register is record -- overflow OVERFLOW : Boolean := False; -- nan NAN : Boolean := False; -- fixed_pt_overflow FIXEDOVERFLOW : Boolean := False; -- underflow UNDERFLOW : Boolean := False; -- bus_error BUSERROR : Boolean := False; -- unspecified Reserved_5_31 : HAL.UInt27 := 16#0#; end record with Volatile_Full_Access, Size => 32, Bit_Order => System.Low_Order_First; for ERRSTAT_Register use record OVERFLOW at 0 range 0 .. 0; NAN at 0 range 1 .. 1; FIXEDOVERFLOW at 0 range 2 .. 2; UNDERFLOW at 0 range 3 .. 3; BUSERROR at 0 range 4 .. 4; Reserved_5_31 at 0 range 5 .. 31; end record; -- INTERRUPT enable register type INTREN_Register is record -- 1 : Enable interrupt on Floating point overflow intr_oflow : Boolean := False; -- 1 : Enable interrupt on Floating point NaN intr_nan : Boolean := False; -- 1: Enable interrupt on Fixed point Overflow intr_fixed : Boolean := False; -- 1 : Enable interrupt on Subnormal truncation intr_uflow : Boolean := False; -- 1: Enable interrupt on AHBM Buss Error intr_berr : Boolean := False; -- unspecified Reserved_5_6 : HAL.UInt2 := 16#0#; -- 1: Enable interrupt on instruction completion intr_comp : Boolean := False; -- unspecified Reserved_8_31 : HAL.UInt24 := 16#0#; end record with Volatile_Full_Access, Size => 32, Bit_Order => System.Low_Order_First; for INTREN_Register use record intr_oflow at 0 range 0 .. 0; intr_nan at 0 range 1 .. 1; intr_fixed at 0 range 2 .. 2; intr_uflow at 0 range 3 .. 3; intr_berr at 0 range 4 .. 4; Reserved_5_6 at 0 range 5 .. 6; intr_comp at 0 range 7 .. 7; Reserved_8_31 at 0 range 8 .. 31; end record; -- Event Enable register type EVENTEN_Register is record -- 1 : Enable event trigger on Floating point overflow event_oflow : Boolean := False; -- 1 : Enable event trigger on Floating point NaN event_nan : Boolean := False; -- 1: Enable event trigger on Fixed point Overflow event_fixed : Boolean := False; -- 1 : Enable event trigger on Subnormal truncation event_uflow : Boolean := False; -- 1: Enable event trigger on AHBM Buss Error event_berr : Boolean := False; -- unspecified Reserved_5_6 : HAL.UInt2 := 16#0#; -- 1: Enable event trigger on instruction completion event_comp : Boolean := False; -- unspecified Reserved_8_31 : HAL.UInt24 := 16#0#; end record with Volatile_Full_Access, Size => 32, Bit_Order => System.Low_Order_First; for EVENTEN_Register use record event_oflow at 0 range 0 .. 0; event_nan at 0 range 1 .. 1; event_fixed at 0 range 2 .. 2; event_uflow at 0 range 3 .. 3; event_berr at 0 range 4 .. 4; Reserved_5_6 at 0 range 5 .. 6; event_comp at 0 range 7 .. 7; Reserved_8_31 at 0 range 8 .. 31; end record; -- INTERRUPT STATUS register type INTRSTAT_Register is record -- Intr status ( 1 bit to indicate interrupt captured, 0 means no new -- interrupt), write any value will clear this bit intr_stat : Boolean := False; -- unspecified Reserved_1_31 : HAL.UInt31 := 16#0#; end record with Volatile_Full_Access, Size => 32, Bit_Order => System.Low_Order_First; for INTRSTAT_Register use record intr_stat at 0 range 0 .. 0; Reserved_1_31 at 0 range 1 .. 31; end record; -- General purpose register bank N. -- General purpose register bank N. type gpreg_Registers is array (0 .. 15) of HAL.UInt32 with Volatile; -- Compute register bank -- Compute register bank type compreg_Registers is array (0 .. 7) of HAL.UInt32 with Volatile; ----------------- -- Peripherals -- ----------------- -- Digital Signal Co-Processing companion to a Cortex-M v8M CPU core type POWERQUAD_Peripheral is record -- Base address register for output region OUTBASE : aliased HAL.UInt32; -- Output format OUTFORMAT : aliased OUTFORMAT_Register; -- Base address register for temp region TMPBASE : aliased HAL.UInt32; -- Temp format TMPFORMAT : aliased TMPFORMAT_Register; -- Base address register for input A region INABASE : aliased HAL.UInt32; -- Input A format INAFORMAT : aliased INAFORMAT_Register; -- Base address register for input B region INBBASE : aliased HAL.UInt32; -- Input B format INBFORMAT : aliased INBFORMAT_Register; -- PowerQuad Control register CONTROL : aliased CONTROL_Register; -- Length register LENGTH : aliased HAL.UInt32; -- Pre-scale register CPPRE : aliased CPPRE_Register; -- Misc register MISC : aliased HAL.UInt32; -- Cursory register CURSORY : aliased CURSORY_Register; -- Cordic input X register CORDIC_X : aliased HAL.UInt32; -- Cordic input Y register CORDIC_Y : aliased HAL.UInt32; -- Cordic input Z register CORDIC_Z : aliased HAL.UInt32; -- Read/Write register where error statuses are captured (sticky) ERRSTAT : aliased ERRSTAT_Register; -- INTERRUPT enable register INTREN : aliased INTREN_Register; -- Event Enable register EVENTEN : aliased EVENTEN_Register; -- INTERRUPT STATUS register INTRSTAT : aliased INTRSTAT_Register; -- General purpose register bank N. gpreg : aliased gpreg_Registers; -- Compute register bank compreg : aliased compreg_Registers; end record with Volatile; for POWERQUAD_Peripheral use record OUTBASE at 16#0# range 0 .. 31; OUTFORMAT at 16#4# range 0 .. 31; TMPBASE at 16#8# range 0 .. 31; TMPFORMAT at 16#C# range 0 .. 31; INABASE at 16#10# range 0 .. 31; INAFORMAT at 16#14# range 0 .. 31; INBBASE at 16#18# range 0 .. 31; INBFORMAT at 16#1C# range 0 .. 31; CONTROL at 16#100# range 0 .. 31; LENGTH at 16#104# range 0 .. 31; CPPRE at 16#108# range 0 .. 31; MISC at 16#10C# range 0 .. 31; CURSORY at 16#110# range 0 .. 31; CORDIC_X at 16#180# range 0 .. 31; CORDIC_Y at 16#184# range 0 .. 31; CORDIC_Z at 16#188# range 0 .. 31; ERRSTAT at 16#18C# range 0 .. 31; INTREN at 16#190# range 0 .. 31; EVENTEN at 16#194# range 0 .. 31; INTRSTAT at 16#198# range 0 .. 31; gpreg at 16#200# range 0 .. 511; compreg at 16#240# range 0 .. 255; end record; -- Digital Signal Co-Processing companion to a Cortex-M v8M CPU core POWERQUAD_Periph : aliased POWERQUAD_Peripheral with Import, Address => System'To_Address (16#400A6000#); end NXP_SVD.POWERQUAD;
-- Copyright 2019-2021 Simon Symeonidis (psyomn) -- -- 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.IO_Exceptions; with File_Utils; with Common_Utils; with HTTP_Status; use HTTP_Status; with Request_Helpers, Response_Helpers; use Request_Helpers, Response_Helpers; package body Transaction_Handlers is function Handle_Request (R : String; Context : String) return String is R_Type : constant Request_Method := Parse_Request_Type (R); URI : constant String := Parse_Request_URI (R); First, Last : Positive; begin case R_Type is when GET => Common_Utils.Empty_String_Range (Context, First, Last); -- TODO Sanitize URLs declare CFirst : constant Positive := Context'First; Path : constant String := Context (CFirst .. First) & URI; begin if File_Utils.Is_Dir (Path) then return Make_Response (OK, File_Utils.Read (Path & "/index.html")); else return Make_Response (OK, File_Utils.Read (Path)); end if; end; when POST | PUT | DELETE | HEAD | OPTIONS | TRACE => return Make_Response ( NOT_IMPLEMENTED, "<h1>Got Request - Haven't been implemented yet though</h1>" ); end case; exception when E : Ada.IO_Exceptions.Device_Error | Ada.IO_Exceptions.Name_Error => Common_Utils.Print_Exception (E, "request for a non existant resource"); return Make_Response ( NOT_FOUND, "Resource not found" ); when E : Request_Helpers.Request_Type_Error => Common_Utils.Print_Exception (E, "request type error"); return Make_Response ( BAD_REQUEST, "bad request" ); when E : others => Common_Utils.Print_Exception (E, "unknown error"); return Make_Response ( INTERNAL_ERROR, "something really bad happened" ); end Handle_Request; end Transaction_Handlers;
------------------------------------------------------------------------------ -- -- -- 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. -- -- -- ------------------------------------------------------------------------------ -- This program demonstrates the on-board gyro provided by the L3GD20 chip -- on the STM32F429 Discovery boards. The pitch, roll, and yaw values are -- continuously displayed on the LCD, as are the adjusted raw values. Move -- the board to see them change. The values will be positive or negative, -- depending on the direction of movement. Note that the values are not -- constant, even when the board is not moving, due to noise. -- NB: You may need to reset the board after downloading! -- This program demonstrates use of the gyro's on-board FIFO, driven by -- an interrupt signalling that the FIFO is partially full. In particular, -- the gyro generates an interrupt when the FIFO has at least the number of -- entries specified by a "watermark" configured by the main program. The -- FIFO contains at least that many sets of raw values for the three X, Y, and -- Z axes. We read all those actually in the FIFO, even if greater than the -- number specified by the watermark. We then average them into one set of -- three axis readings, and use that for further processing. In particular, -- on each iteration we subtract the stable bias offset from each axis value -- and scale by the selected sensitivity. The adjusted and scaled values are -- displayed on each iteration. The stable bias offsets are also displayed, -- initially (not iteratively since they are not recomputed). with Last_Chance_Handler; pragma Unreferenced (Last_Chance_Handler); with Gyro_Interrupts; with Output_Utils; use Output_Utils; with Ada.Synchronous_Task_Control; use Ada.Synchronous_Task_Control; with STM32.Device; use STM32.Device; with STM32.Board; use STM32.Board; with STM32.GPIO; use STM32.GPIO; with STM32.EXTI; use STM32.EXTI; with LCD_Std_Out; with L3GD20; use L3GD20; procedure Demo_L3GD20 is Axes : L3GD20.Angle_Rates; Stable : L3GD20.Angle_Rates; -- the values when the board is motionless Sensitivity : Float; Scaled_X : Float; Scaled_Y : Float; Scaled_Z : Float; FIFO_Watermark : constant L3GD20.FIFO_Level := 15; -- arbitrary, 1/2 of the FIFO content procedure Get_Gyro_Offsets (Offsets : out Angle_Rates; Sample_Count : in Long_Integer); -- Computes the averages for the gyro values returned when the board is -- motionless -- Note this uses polling so the FIFO is not yet involved procedure Configure_Gyro; -- Configures the on-board gyro chip procedure Await_Averaged_Angle_Rates (Rates : out Angle_Rates); function Averaged_Rates (Buffer : Angle_Rates_FIFO_Buffer) return Angle_Rates; procedure Configure_Gyro_Interrupt; -- Configures the gyro's FIFO interrupt (interrupt #2) on the -- required port/pin for the F429 Discovery board. Enables the interrupt. -- See the F429 Disco User Manual, Table 6, pg 19, for the port/pin. procedure Reset_and_Start_Collecting with Inline; -- go into Bypass_Mode to reset the hardware, then go into FIFO mode to -- begin collecting data into the FIFO buffer -------------------------------- -- Await_Averaged_Angle_Rates -- -------------------------------- procedure Await_Averaged_Angle_Rates (Rates : out Angle_Rates) is FIFO_Buffer : Angle_Rates_FIFO_Buffer (FIFO_Level); -- entire FIFO Actual_Depth : FIFO_Level; begin Suspend_Until_True (Gyro_Interrupts.Event); Actual_Depth := Gyro.Current_FIFO_Depth; if Actual_Depth < 1 then return; end if; Gyro.Get_Raw_Angle_Rates_FIFO (FIFO_Buffer (1 .. Actual_Depth)); Rates := Averaged_Rates (FIFO_Buffer (1 .. Actual_Depth)); end Await_Averaged_Angle_Rates; -------------------- -- Averaged_Rates -- -------------------- function Averaged_Rates (Buffer : Angle_Rates_FIFO_Buffer) return Angle_Rates is Result : Angle_Rates; Total_X : Long_Integer := 0; Total_Y : Long_Integer := 0; Total_Z : Long_Integer := 0; begin for Sample of Buffer loop Total_X := Total_X + Long_Integer (Sample.X); Total_Y := Total_Y + Long_Integer (Sample.Y); Total_Z := Total_Z + Long_Integer (Sample.Z); end loop; Result.X := Angle_Rate (Total_X / Buffer'Length); Result.Y := Angle_Rate (Total_Y / Buffer'Length); Result.Z := Angle_Rate (Total_Z / Buffer'Length); return Result; end Averaged_Rates; -------------------- -- Configure_Gyro -- -------------------- procedure Configure_Gyro is begin -- Init the on-board gyro SPI and GPIO. This is board-specific, not -- every board has a gyro. The F429 Discovery does, for example, but -- the F4 Discovery does not. STM32.Board.Initialize_Gyro_IO; Gyro.Reset; Gyro.Configure (Power_Mode => L3GD20_Mode_Active, Output_Data_Rate => L3GD20_Output_Data_Rate_95Hz, Axes_Enable => L3GD20_Axes_Enable, Bandwidth => L3GD20_Bandwidth_1, BlockData_Update => L3GD20_BlockDataUpdate_Continous, Endianness => L3GD20_Little_Endian, Full_Scale => L3GD20_Fullscale_250); Gyro.Enable_Low_Pass_Filter; end Configure_Gyro; ------------------------------ -- Configure_Gyro_Interrupt -- ------------------------------ procedure Configure_Gyro_Interrupt is Config : GPIO_Port_Configuration; -- This is the required port/pin configuration on STM32F429 Disco -- boards for interrupt 2 on the L3GD20 gyro. See the F429 Disco -- User Manual, Table 6, pg 19. begin Enable_Clock (MEMS_INT2); Config.Mode := Mode_In; Config.Resistors := Floating; Config.Speed := Speed_50MHz; Configure_IO (MEMS_INT2, Config); Configure_Trigger (MEMS_INT2, Interrupt_Rising_Edge); end Configure_Gyro_Interrupt; ---------------------- -- Get_Gyro_Offsets -- ---------------------- procedure Get_Gyro_Offsets (Offsets : out Angle_Rates; Sample_Count : in Long_Integer) is Sample : Angle_Rates; Total_X : Long_Integer := 0; Total_Y : Long_Integer := 0; Total_Z : Long_Integer := 0; begin for K in 1 .. Sample_Count loop loop exit when Gyro.Data_Status.ZYX_Available; end loop; Gyro.Get_Raw_Angle_Rates (Sample); Total_X := Total_X + Long_Integer (Sample.X); Total_Y := Total_Y + Long_Integer (Sample.Y); Total_Z := Total_Z + Long_Integer (Sample.Z); end loop; Offsets.X := Angle_Rate (Total_X / Sample_Count); Offsets.Y := Angle_Rate (Total_Y / Sample_Count); Offsets.Z := Angle_Rate (Total_Z / Sample_Count); end Get_Gyro_Offsets; -------------------------------- -- Reset_and_Start_Collecting -- -------------------------------- procedure Reset_and_Start_Collecting is begin -- Going to Bypass_Mode resets the FIFO hardware and so is essential Gyro.Set_FIFO_Mode (L3GD20_Bypass_Mode); -- Going into FIFO_Mode begins the collection into the hardware FIFO Gyro.Set_FIFO_Mode (L3GD20_FIFO_Mode); end Reset_and_Start_Collecting; begin LCD_Std_Out.Set_Font (Output_Utils.Selected_Font); Configure_Gyro; Configure_Gyro_Interrupt; Enable_FIFO_Watermark_Interrupt (Gyro); -- L3DG30 gyro interrupt 2 Gyro.Set_FIFO_Watermark (FIFO_Watermark); Sensitivity := Gyro.Full_Scale_Sensitivity; Print (0, 0, "Calibrating"); Get_Gyro_Offsets (Stable, Sample_Count => 100); -- arbitrary count -- Note this uses polling so the FIFO is not yet involved Print_Static_Content (Stable); Gyro.Enable_FIFO; Gyro.Set_FIFO_Mode (L3GD20_FIFO_Mode); -- The device starts in Bypass_Mode, in which no data are collected into -- the gyro's hardware FIFO, so going into FIFO_Mode begins the collection. loop Await_Averaged_Angle_Rates (Axes); Reset_and_Start_Collecting; -- the FIFO is filling while we display the data -- TODO: use the Reference mode to do this automatically! -- See section 4.3.2 of the 4505 App Note, pg 18 Axes.X := Axes.X - Stable.X; Axes.Y := Axes.Y - Stable.Y; Axes.Z := Axes.Z - Stable.Z; -- print the values after the stable offset is removed Print (Col_Adjusted, Line1_Adjusted, Axes.X'Img & " "); Print (Col_Adjusted, Line2_Adjusted, Axes.Y'Img & " "); Print (Col_Adjusted, Line3_Adjusted, Axes.Z'Img & " "); Scaled_X := Float (Axes.X) * Sensitivity; Scaled_Y := Float (Axes.Y) * Sensitivity; Scaled_Z := Float (Axes.Z) * Sensitivity; -- print the final values Print (Final_Column, Line1_Final, Scaled_X'Img & " "); Print (Final_Column, Line2_Final, Scaled_Y'Img & " "); Print (Final_Column, Line3_Final, Scaled_Z'Img & " "); end loop; end Demo_L3GD20;
procedure Loop_Statement is begin loop null; end loop; end Loop_Statement;
private package Testsuite.Encode.Multiframe_Tests is procedure Add_Tests (Suite : in out AUnit.Test_Suites.Test_Suite'Class); end Testsuite.Encode.Multiframe_Tests;
-- The Beer-Ware License (revision 42) -- -- Jacob Sparre Andersen <jacob@jacob-sparre.dk> wrote this. As long as you -- retain this notice you can do whatever you want with this stuff. If we meet -- some day, and you think this stuff is worth it, you can buy me a beer in -- return. -- -- Jacob Sparre Andersen with Ada.Text_IO, Ada.Text_IO.Text_Streams; with Sound.Stereo_Recording; procedure Record_Stereo_WAV is type Double_Word is mod 2 ** 32; for Double_Word'Size use 32; type Word is mod 2 ** 16; for Word'Size use 16; type Byte is mod 2 ** 8; for Byte'Size use 8; function Little_Endian return Boolean; -- Checks if we are running on a little-endian architecture. procedure Write_RIFF (Target : in Ada.Text_IO.Text_Streams.Stream_Access; Data : in Sound.Stereo_Recording.Frame_Array); procedure Write_Format (Target : in Ada.Text_IO.Text_Streams.Stream_Access; Sample_Frequency : in Sound.Sample_Frequency); procedure Write_Data (Target : in Ada.Text_IO.Text_Streams.Stream_Access; Data : in Sound.Stereo_Recording.Frame_Array); function Little_Endian return Boolean is type Word_As_Bytes is array (1 .. 2) of Byte; for Word_As_Bytes'Size use 16; As_Word : Word := 11 * 256 + 42; As_Bytes : Word_As_Bytes; for As_Bytes'Address use As_Word'Address; begin As_Word := 42 + 256 * 11; return As_Bytes = (42, 11); end Little_Endian; Bits_Per_Sample : constant := Sound.Stereo_Recording.Level'Size; Number_Of_Channels : constant Word := Sound.Stereo_Recording.Frame'Size / Bits_Per_Sample; Block_Alignment : constant Word := Number_Of_Channels * Bits_Per_Sample / 8; procedure Write_Data (Target : in Ada.Text_IO.Text_Streams.Stream_Access; Data : in Sound.Stereo_Recording.Frame_Array) is Number_Of_Samples : constant Double_Word := Data'Length; begin String'Write (Target, "data"); Double_Word'Write (Target, Number_Of_Samples * Double_Word (Number_Of_Channels) * Bits_Per_Sample / 8); Sound.Stereo_Recording.Frame_Array'Write (Target, Data); end Write_Data; procedure Write_Format (Target : in Ada.Text_IO.Text_Streams.Stream_Access; Sample_Frequency : in Sound.Sample_Frequency) is Sample_Rate : constant Double_Word := Double_Word (Sample_Frequency); Byte_Rate : constant Double_Word := Sample_Rate * Double_Word (Number_Of_Channels) * Bits_Per_Sample / 8; begin String'Write (Target, "fmt "); Double_Word'Write (Target, 16); Word'Write (Target, 1); Word'Write (Target, Number_Of_Channels); Double_Word'Write (Target, Sample_Rate); Double_Word'Write (Target, Byte_Rate); Word'Write (Target, Block_Alignment); Word'Write (Target, Bits_Per_Sample); end Write_Format; procedure Write_RIFF (Target : in Ada.Text_IO.Text_Streams.Stream_Access; Data : in Sound.Stereo_Recording.Frame_Array) is begin String'Write (Target, "RIFF"); Double_Word'Write (Target, 4 + 24 + 8 + Data'Size / 8); String'Write (Target, "WAVE"); end Write_RIFF; Microphone : Sound.Stereo_Recording.Line_Type; Resolution : Sound.Sample_Frequency := 48_000; Buffer_Size : Duration := 0.5; Period : Duration := 0.1; Recording : Sound.Stereo_Recording.Frame_Array (1 .. 48_000 * 30); Filled_To : Natural := Recording'First - 1; Target : Ada.Text_IO.Text_Streams.Stream_Access; begin if not Little_Endian then Ada.Text_IO.Put_Line (File => Ada.Text_IO.Standard_Error, Item => "Big endian is too messy."); return; end if; Sound.Stereo_Recording.Open (Line => Microphone, Resolution => Resolution, Buffer_Size => Buffer_Size, Period => Period); Ada.Text_IO.Put_Line (File => Ada.Text_IO.Standard_Error, Item => "Resolution [samples/s]:" & Sound.Sample_Frequency'Image (Resolution)); Ada.Text_IO.Put_Line (File => Ada.Text_IO.Standard_Error, Item => "Buffer size [s]:" & Duration'Image (Buffer_Size)); Ada.Text_IO.Put_Line (File => Ada.Text_IO.Standard_Error, Item => "Period [s]:" & Duration'Image (Period)); while Filled_To < Recording'Last loop Sound.Stereo_Recording.Read (Line => Microphone, Item => Recording (Filled_To + 1 .. Positive'Min (Recording'Last, Filled_To + 3000)), Last => Filled_To); end loop; Ada.Text_IO.Put_Line (File => Ada.Text_IO.Standard_Error, Item => "Recorded [s]:" & Duration'Image (Duration (Filled_To) / Duration (Resolution))); Sound.Stereo_Recording.Close (Line => Microphone); Target := Ada.Text_IO.Text_Streams.Stream (Ada.Text_IO.Standard_Output); Write_RIFF (Target => Target, Data => Recording (Recording'First .. Filled_To)); Write_Format (Target => Target, Sample_Frequency => Resolution); Write_Data (Target => Target, Data => Recording (Recording'First .. Filled_To)); end Record_Stereo_WAV;
with Ada.Text_IO; use Ada.Text_IO; package body Config is procedure Parse (File_Name : String) is function Get_Value (Input : Unbounded_String) return Unbounded_String is Result : Unbounded_String; begin for I in Index (Input, ":") + 1 .. Length (Input) loop Result := Result & Element (Input, I); end loop; return Result; end Get_Value; Config_File : File_Type; Line : Unbounded_String; Char : Character; begin Open (Config_File, In_File, File_Name); while not End_Of_File (Config_File) loop while not End_Of_Line (Config_File) loop Get (Config_File, Char); if not (Char = ' ') then Line := Line & Char; end if; end loop; declare Str : constant String := To_String (Line); begin if Str (1 .. 6) = "server" then Server := Get_Value (Line); elsif Str (1 .. 4) = "port" then Port := Integer'Value (To_String (Get_Value (Line))); elsif Str (1 .. 4) = "nick" then Nick := Get_Value (Line); elsif Str (1 .. 8) = "password" then Password := Get_Value (Line); elsif Str (1 .. 8) = "channels" then Channels := Words (GSub (Get_Value (Line), "#", " ")); elsif Str (1 .. 5) = "owner" then Owner := Get_Value (Line); elsif Str (1 .. 6) = "prefix" then Prefix := Element (Get_Value (Line), 1); end if; end; Delete (Line, 1, Length (Line)); Skip_Line (Config_File); end loop; Close (Config_File); end Parse; end Config;
------------------------------------------------------------------------------ -- -- -- GNAT COMPILER COMPONENTS -- -- -- -- I N T E R F A C E S . C O B O L -- -- -- -- S p e c -- -- -- -- $Revision: 2 $ -- -- -- -- This specification is adapted from the Ada Reference Manual for use with -- -- GNAT. In accordance with the copyright of that document, you can freely -- -- copy and modify this specification, provided that if you redistribute a -- -- modified version, any changes that you have made are clearly indicated. -- -- -- ------------------------------------------------------------------------------ package Interfaces.COBOL is ------------------------------------------------------------ -- Types And Operations For Internal Data Representations -- ------------------------------------------------------------ type Floating is new Float; type Long_Floating is new Long_Float; type Binary is new Integer; type Long_Binary is new Long_Long_Integer; Max_Digits_Binary : constant := 9; Max_Digits_Long_Binary : constant := 18; type Decimal_Element is mod 16; type Packed_Decimal is array (Positive range <>) of Decimal_Element; pragma Pack (Packed_Decimal); type COBOL_Character is new Character; Ada_To_COBOL : array (Standard.Character) of COBOL_Character := ( COBOL_Character'Val (000), COBOL_Character'Val (001), COBOL_Character'Val (002), COBOL_Character'Val (003), COBOL_Character'Val (004), COBOL_Character'Val (005), COBOL_Character'Val (006), COBOL_Character'Val (007), COBOL_Character'Val (008), COBOL_Character'Val (009), COBOL_Character'Val (010), COBOL_Character'Val (011), COBOL_Character'Val (012), COBOL_Character'Val (013), COBOL_Character'Val (014), COBOL_Character'Val (015), COBOL_Character'Val (016), COBOL_Character'Val (017), COBOL_Character'Val (018), COBOL_Character'Val (019), COBOL_Character'Val (020), COBOL_Character'Val (021), COBOL_Character'Val (022), COBOL_Character'Val (023), COBOL_Character'Val (024), COBOL_Character'Val (025), COBOL_Character'Val (026), COBOL_Character'Val (027), COBOL_Character'Val (028), COBOL_Character'Val (029), COBOL_Character'Val (030), COBOL_Character'Val (031), COBOL_Character'Val (032), COBOL_Character'Val (033), COBOL_Character'Val (034), COBOL_Character'Val (035), COBOL_Character'Val (036), COBOL_Character'Val (037), COBOL_Character'Val (038), COBOL_Character'Val (039), COBOL_Character'Val (040), COBOL_Character'Val (041), COBOL_Character'Val (042), COBOL_Character'Val (043), COBOL_Character'Val (044), COBOL_Character'Val (045), COBOL_Character'Val (046), COBOL_Character'Val (047), COBOL_Character'Val (048), COBOL_Character'Val (049), COBOL_Character'Val (050), COBOL_Character'Val (051), COBOL_Character'Val (052), COBOL_Character'Val (053), COBOL_Character'Val (054), COBOL_Character'Val (055), COBOL_Character'Val (056), COBOL_Character'Val (057), COBOL_Character'Val (058), COBOL_Character'Val (059), COBOL_Character'Val (060), COBOL_Character'Val (061), COBOL_Character'Val (062), COBOL_Character'Val (063), COBOL_Character'Val (064), COBOL_Character'Val (065), COBOL_Character'Val (066), COBOL_Character'Val (067), COBOL_Character'Val (068), COBOL_Character'Val (069), COBOL_Character'Val (070), COBOL_Character'Val (071), COBOL_Character'Val (072), COBOL_Character'Val (073), COBOL_Character'Val (074), COBOL_Character'Val (075), COBOL_Character'Val (076), COBOL_Character'Val (077), COBOL_Character'Val (078), COBOL_Character'Val (079), COBOL_Character'Val (080), COBOL_Character'Val (081), COBOL_Character'Val (082), COBOL_Character'Val (083), COBOL_Character'Val (084), COBOL_Character'Val (085), COBOL_Character'Val (086), COBOL_Character'Val (087), COBOL_Character'Val (088), COBOL_Character'Val (089), COBOL_Character'Val (090), COBOL_Character'Val (091), COBOL_Character'Val (092), COBOL_Character'Val (093), COBOL_Character'Val (094), COBOL_Character'Val (095), COBOL_Character'Val (096), COBOL_Character'Val (097), COBOL_Character'Val (098), COBOL_Character'Val (099), COBOL_Character'Val (100), COBOL_Character'Val (101), COBOL_Character'Val (102), COBOL_Character'Val (103), COBOL_Character'Val (104), COBOL_Character'Val (105), COBOL_Character'Val (106), COBOL_Character'Val (107), COBOL_Character'Val (108), COBOL_Character'Val (109), COBOL_Character'Val (110), COBOL_Character'Val (111), COBOL_Character'Val (112), COBOL_Character'Val (113), COBOL_Character'Val (114), COBOL_Character'Val (115), COBOL_Character'Val (116), COBOL_Character'Val (117), COBOL_Character'Val (118), COBOL_Character'Val (119), COBOL_Character'Val (120), COBOL_Character'Val (121), COBOL_Character'Val (122), COBOL_Character'Val (123), COBOL_Character'Val (124), COBOL_Character'Val (125), COBOL_Character'Val (126), COBOL_Character'Val (127), COBOL_Character'Val (128), COBOL_Character'Val (129), COBOL_Character'Val (130), COBOL_Character'Val (131), COBOL_Character'Val (132), COBOL_Character'Val (133), COBOL_Character'Val (134), COBOL_Character'Val (135), COBOL_Character'Val (136), COBOL_Character'Val (137), COBOL_Character'Val (138), COBOL_Character'Val (139), COBOL_Character'Val (140), COBOL_Character'Val (141), COBOL_Character'Val (142), COBOL_Character'Val (143), COBOL_Character'Val (144), COBOL_Character'Val (145), COBOL_Character'Val (146), COBOL_Character'Val (147), COBOL_Character'Val (148), COBOL_Character'Val (149), COBOL_Character'Val (150), COBOL_Character'Val (151), COBOL_Character'Val (152), COBOL_Character'Val (153), COBOL_Character'Val (154), COBOL_Character'Val (155), COBOL_Character'Val (156), COBOL_Character'Val (157), COBOL_Character'Val (158), COBOL_Character'Val (159), COBOL_Character'Val (160), COBOL_Character'Val (161), COBOL_Character'Val (162), COBOL_Character'Val (163), COBOL_Character'Val (164), COBOL_Character'Val (165), COBOL_Character'Val (166), COBOL_Character'Val (167), COBOL_Character'Val (168), COBOL_Character'Val (169), COBOL_Character'Val (170), COBOL_Character'Val (171), COBOL_Character'Val (172), COBOL_Character'Val (173), COBOL_Character'Val (174), COBOL_Character'Val (175), COBOL_Character'Val (176), COBOL_Character'Val (177), COBOL_Character'Val (178), COBOL_Character'Val (179), COBOL_Character'Val (180), COBOL_Character'Val (181), COBOL_Character'Val (182), COBOL_Character'Val (183), COBOL_Character'Val (184), COBOL_Character'Val (185), COBOL_Character'Val (186), COBOL_Character'Val (187), COBOL_Character'Val (188), COBOL_Character'Val (189), COBOL_Character'Val (190), COBOL_Character'Val (191), COBOL_Character'Val (192), COBOL_Character'Val (193), COBOL_Character'Val (194), COBOL_Character'Val (195), COBOL_Character'Val (196), COBOL_Character'Val (197), COBOL_Character'Val (198), COBOL_Character'Val (199), COBOL_Character'Val (200), COBOL_Character'Val (201), COBOL_Character'Val (202), COBOL_Character'Val (203), COBOL_Character'Val (204), COBOL_Character'Val (205), COBOL_Character'Val (206), COBOL_Character'Val (207), COBOL_Character'Val (208), COBOL_Character'Val (209), COBOL_Character'Val (210), COBOL_Character'Val (211), COBOL_Character'Val (212), COBOL_Character'Val (213), COBOL_Character'Val (214), COBOL_Character'Val (215), COBOL_Character'Val (216), COBOL_Character'Val (217), COBOL_Character'Val (218), COBOL_Character'Val (219), COBOL_Character'Val (220), COBOL_Character'Val (221), COBOL_Character'Val (222), COBOL_Character'Val (223), COBOL_Character'Val (224), COBOL_Character'Val (225), COBOL_Character'Val (226), COBOL_Character'Val (227), COBOL_Character'Val (228), COBOL_Character'Val (229), COBOL_Character'Val (230), COBOL_Character'Val (231), COBOL_Character'Val (232), COBOL_Character'Val (233), COBOL_Character'Val (234), COBOL_Character'Val (235), COBOL_Character'Val (236), COBOL_Character'Val (237), COBOL_Character'Val (238), COBOL_Character'Val (239), COBOL_Character'Val (240), COBOL_Character'Val (241), COBOL_Character'Val (242), COBOL_Character'Val (243), COBOL_Character'Val (244), COBOL_Character'Val (245), COBOL_Character'Val (246), COBOL_Character'Val (247), COBOL_Character'Val (248), COBOL_Character'Val (249), COBOL_Character'Val (250), COBOL_Character'Val (251), COBOL_Character'Val (252), COBOL_Character'Val (253), COBOL_Character'Val (254), COBOL_Character'Val (255)); COBOL_To_Ada : array (COBOL_Character) of Standard.Character := ( Standard.Character'Val (000), Standard.Character'Val (001), Standard.Character'Val (002), Standard.Character'Val (003), Standard.Character'Val (004), Standard.Character'Val (005), Standard.Character'Val (006), Standard.Character'Val (007), Standard.Character'Val (008), Standard.Character'Val (009), Standard.Character'Val (010), Standard.Character'Val (011), Standard.Character'Val (012), Standard.Character'Val (013), Standard.Character'Val (014), Standard.Character'Val (015), Standard.Character'Val (016), Standard.Character'Val (017), Standard.Character'Val (018), Standard.Character'Val (019), Standard.Character'Val (020), Standard.Character'Val (021), Standard.Character'Val (022), Standard.Character'Val (023), Standard.Character'Val (024), Standard.Character'Val (025), Standard.Character'Val (026), Standard.Character'Val (027), Standard.Character'Val (028), Standard.Character'Val (029), Standard.Character'Val (030), Standard.Character'Val (031), Standard.Character'Val (032), Standard.Character'Val (033), Standard.Character'Val (034), Standard.Character'Val (035), Standard.Character'Val (036), Standard.Character'Val (037), Standard.Character'Val (038), Standard.Character'Val (039), Standard.Character'Val (040), Standard.Character'Val (041), Standard.Character'Val (042), Standard.Character'Val (043), Standard.Character'Val (044), Standard.Character'Val (045), Standard.Character'Val (046), Standard.Character'Val (047), Standard.Character'Val (048), Standard.Character'Val (049), Standard.Character'Val (050), Standard.Character'Val (051), Standard.Character'Val (052), Standard.Character'Val (053), Standard.Character'Val (054), Standard.Character'Val (055), Standard.Character'Val (056), Standard.Character'Val (057), Standard.Character'Val (058), Standard.Character'Val (059), Standard.Character'Val (060), Standard.Character'Val (061), Standard.Character'Val (062), Standard.Character'Val (063), Standard.Character'Val (064), Standard.Character'Val (065), Standard.Character'Val (066), Standard.Character'Val (067), Standard.Character'Val (068), Standard.Character'Val (069), Standard.Character'Val (070), Standard.Character'Val (071), Standard.Character'Val (072), Standard.Character'Val (073), Standard.Character'Val (074), Standard.Character'Val (075), Standard.Character'Val (076), Standard.Character'Val (077), Standard.Character'Val (078), Standard.Character'Val (079), Standard.Character'Val (080), Standard.Character'Val (081), Standard.Character'Val (082), Standard.Character'Val (083), Standard.Character'Val (084), Standard.Character'Val (085), Standard.Character'Val (086), Standard.Character'Val (087), Standard.Character'Val (088), Standard.Character'Val (089), Standard.Character'Val (090), Standard.Character'Val (091), Standard.Character'Val (092), Standard.Character'Val (093), Standard.Character'Val (094), Standard.Character'Val (095), Standard.Character'Val (096), Standard.Character'Val (097), Standard.Character'Val (098), Standard.Character'Val (099), Standard.Character'Val (100), Standard.Character'Val (101), Standard.Character'Val (102), Standard.Character'Val (103), Standard.Character'Val (104), Standard.Character'Val (105), Standard.Character'Val (106), Standard.Character'Val (107), Standard.Character'Val (108), Standard.Character'Val (109), Standard.Character'Val (110), Standard.Character'Val (111), Standard.Character'Val (112), Standard.Character'Val (113), Standard.Character'Val (114), Standard.Character'Val (115), Standard.Character'Val (116), Standard.Character'Val (117), Standard.Character'Val (118), Standard.Character'Val (119), Standard.Character'Val (120), Standard.Character'Val (121), Standard.Character'Val (122), Standard.Character'Val (123), Standard.Character'Val (124), Standard.Character'Val (125), Standard.Character'Val (126), Standard.Character'Val (127), Standard.Character'Val (128), Standard.Character'Val (129), Standard.Character'Val (130), Standard.Character'Val (131), Standard.Character'Val (132), Standard.Character'Val (133), Standard.Character'Val (134), Standard.Character'Val (135), Standard.Character'Val (136), Standard.Character'Val (137), Standard.Character'Val (138), Standard.Character'Val (139), Standard.Character'Val (140), Standard.Character'Val (141), Standard.Character'Val (142), Standard.Character'Val (143), Standard.Character'Val (144), Standard.Character'Val (145), Standard.Character'Val (146), Standard.Character'Val (147), Standard.Character'Val (148), Standard.Character'Val (149), Standard.Character'Val (150), Standard.Character'Val (151), Standard.Character'Val (152), Standard.Character'Val (153), Standard.Character'Val (154), Standard.Character'Val (155), Standard.Character'Val (156), Standard.Character'Val (157), Standard.Character'Val (158), Standard.Character'Val (159), Standard.Character'Val (160), Standard.Character'Val (161), Standard.Character'Val (162), Standard.Character'Val (163), Standard.Character'Val (164), Standard.Character'Val (165), Standard.Character'Val (166), Standard.Character'Val (167), Standard.Character'Val (168), Standard.Character'Val (169), Standard.Character'Val (170), Standard.Character'Val (171), Standard.Character'Val (172), Standard.Character'Val (173), Standard.Character'Val (174), Standard.Character'Val (175), Standard.Character'Val (176), Standard.Character'Val (177), Standard.Character'Val (178), Standard.Character'Val (179), Standard.Character'Val (180), Standard.Character'Val (181), Standard.Character'Val (182), Standard.Character'Val (183), Standard.Character'Val (184), Standard.Character'Val (185), Standard.Character'Val (186), Standard.Character'Val (187), Standard.Character'Val (188), Standard.Character'Val (189), Standard.Character'Val (190), Standard.Character'Val (191), Standard.Character'Val (192), Standard.Character'Val (193), Standard.Character'Val (194), Standard.Character'Val (195), Standard.Character'Val (196), Standard.Character'Val (197), Standard.Character'Val (198), Standard.Character'Val (199), Standard.Character'Val (200), Standard.Character'Val (201), Standard.Character'Val (202), Standard.Character'Val (203), Standard.Character'Val (204), Standard.Character'Val (205), Standard.Character'Val (206), Standard.Character'Val (207), Standard.Character'Val (208), Standard.Character'Val (209), Standard.Character'Val (210), Standard.Character'Val (211), Standard.Character'Val (212), Standard.Character'Val (213), Standard.Character'Val (214), Standard.Character'Val (215), Standard.Character'Val (216), Standard.Character'Val (217), Standard.Character'Val (218), Standard.Character'Val (219), Standard.Character'Val (220), Standard.Character'Val (221), Standard.Character'Val (222), Standard.Character'Val (223), Standard.Character'Val (224), Standard.Character'Val (225), Standard.Character'Val (226), Standard.Character'Val (227), Standard.Character'Val (228), Standard.Character'Val (229), Standard.Character'Val (230), Standard.Character'Val (231), Standard.Character'Val (232), Standard.Character'Val (233), Standard.Character'Val (234), Standard.Character'Val (235), Standard.Character'Val (236), Standard.Character'Val (237), Standard.Character'Val (238), Standard.Character'Val (239), Standard.Character'Val (240), Standard.Character'Val (241), Standard.Character'Val (242), Standard.Character'Val (243), Standard.Character'Val (244), Standard.Character'Val (245), Standard.Character'Val (246), Standard.Character'Val (247), Standard.Character'Val (248), Standard.Character'Val (249), Standard.Character'Val (250), Standard.Character'Val (251), Standard.Character'Val (252), Standard.Character'Val (253), Standard.Character'Val (254), Standard.Character'Val (255)); type Alphanumeric is array (Positive range <>) of COBOL_Character; pragma Pack (Alphanumeric); function To_COBOL (Item : in String) return Alphanumeric; function To_Ada (Item : in Alphanumeric) return String; procedure To_COBOL (Item : in String; Target : out Alphanumeric; Last : out Natural); procedure To_Ada (Item : in Alphanumeric; Target : out String; Last : out Natural); type Numeric is array (Positive range <>) of COBOL_Character; pragma Pack (Numeric); -------------------------------------------- -- Formats For COBOL Data Representations -- -------------------------------------------- type Display_Format is private; Unsigned : constant Display_Format; Leading_Separate : constant Display_Format; Trailing_Separate : constant Display_Format; Leading_Nonseparate : constant Display_Format; Trailing_Nonseparate : constant Display_Format; type Binary_Format is private; High_Order_First : constant Binary_Format; Low_Order_First : constant Binary_Format; Native_Binary : constant Binary_Format; type Packed_Format is private; Packed_Unsigned : constant Packed_Format; Packed_Signed : constant Packed_Format; ------------------------------------------------------------ -- Types For External Representation Of COBOL Binary Data -- ------------------------------------------------------------ type Byte is mod 2 ** COBOL_Character'Size; type Byte_Array is array (Positive range <>) of Byte; pragma Pack (Byte_Array); Conversion_Error : exception; generic type Num is delta <> digits <>; package Decimal_Conversions is -- Display Formats: data values are represented as Numeric function Valid (Item : in Numeric; Format : in Display_Format) return Boolean; function Length (Format : in Display_Format) return Natural; function To_Decimal (Item : in Numeric; Format : in Display_Format) return Num; function To_Display (Item : in Num; Format : in Display_Format) return Numeric; -- Packed Formats: data values are represented as Packed_Decimal function Valid (Item : in Packed_Decimal; Format : in Packed_Format) return Boolean; function Length (Format : in Packed_Format) return Natural; function To_Decimal (Item : in Packed_Decimal; Format : in Packed_Format) return Num; function To_Packed (Item : in Num; Format : in Packed_Format) return Packed_Decimal; -- Binary Formats: external data values are represented as Byte_Array function Valid (Item : in Byte_Array; Format : in Binary_Format) return Boolean; function Length (Format : in Binary_Format) return Natural; function To_Decimal (Item : in Byte_Array; Format : in Binary_Format) return Num; function To_Binary (Item : in Num; Format : in Binary_Format) return Byte_Array; function To_Comp (Item : in Num; Format : in Binary_Format) return Byte_Array; -- Internal Binary formats: data values are of type Binary/Long_Binary function To_Decimal (Item : in Binary) return Num; function To_Decimal (Item : in Long_Binary) return Num; function To_Binary (Item : in Num) return Binary; function To_Long_Binary (Item : in Num) return Long_Binary; end Decimal_Conversions; private type Display_Format is (U, LS, TS, LN, TN); Unsigned : constant Display_Format := U; Leading_Separate : constant Display_Format := LS; Trailing_Separate : constant Display_Format := TS; Leading_Nonseparate : constant Display_Format := LN; Trailing_Nonseparate : constant Display_Format := TN; type Binary_Format is (H, L, N); High_Order_First : constant Binary_Format := H; Low_Order_First : constant Binary_Format := L; Native_Binary : constant Binary_Format := N; type Packed_Format is (U, S); Packed_Unsigned : constant Packed_Format := U; Packed_Signed : constant Packed_Format := S; end Interfaces.COBOL;
with Ada.Containers.Vectors; use Ada.Containers; with Simple_Blockchain.Block; use Simple_Blockchain; package Simple_Blockchain.Blockchain is use type Block.Object; package Block_Vectors is new Vectors (Index_Type => Positive, Element_Type => Block.Object); type Blockchain_Difficulty is range 1 .. 64; type Object is private; function Get_Blocks (This : Object) return Block_Vectors.Vector; function Get_Difficulty (This : Object) return Natural; function Image (This : Object) return String; function Is_Valid (This : Object) return Boolean; function Make (Difficulty : Blockchain_Difficulty) return Object; procedure Mine_Block (This : in out Object; Data : String); private type Object is record Blocks : Block_Vectors.Vector; Difficulty : Blockchain_Difficulty; end record; function Expected_Hash_Prefix (This : Object) return String; function Is_Empty (This : Object) return Boolean; function Last_Block (This : Object) return Block.Object; end Simple_Blockchain.Blockchain;
with GNAT.Sockets.Connection_State_Machine.HTTP_Server; with GNAT.Sockets.Server; package Yaml.Servers is package HTTP renames GNAT.Sockets.Connection_State_Machine.HTTP_Server; package Server renames GNAT.Sockets.Server; type Yaml_Factory (Request_Length : Positive; Input_Size : Server.Buffer_Length; Output_Size : Server.Buffer_Length; Max_Connections : Positive) is new Server.Connections_Factory with null record; type Yaml_Client is new HTTP.HTTP_Client with null record; pragma Warnings (Off, "formal parameter ""From"" is not referenced"); overriding function Create (Factory : access Yaml_Factory; Listener : access Server.Connections_Server'Class; From : GNAT.Sockets.Sock_Addr_Type) return Server.Connection_Ptr is (new Yaml_Client (Listener => Listener.all'Unchecked_Access, Request_Length => Factory.Request_Length, Input_Size => Factory.Input_Size, Output_Size => Factory.Output_Size)); pragma Warnings (On, "formal parameter ""From"" is not referenced"); overriding procedure Do_Get (Client : in out Yaml_Client); end Yaml.Servers;
-- -- Copyright (C) 2015-2017 secunet Security Networks AG -- -- This program is free software; you can redistribute it and/or modify -- it under the terms of the GNU General Public License as published by -- the Free Software Foundation; either version 2 of the License, or -- (at your option) any later version. -- -- This program is distributed in the hope that it will be useful, -- but WITHOUT ANY WARRANTY; without even the implied warranty of -- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -- GNU General Public License for more details. -- with HW.GFX.DP_Aux_Ch; private generic type T (<>) is limited private; with package Aux_Ch is new DP_Aux_Ch (T => T, others => <>); package HW.GFX.DP_Info is type DP_Voltage_Swing is (VS_Level_0, VS_Level_1, VS_Level_2, VS_Level_3); type DP_Pre_Emph is (Emph_Level_0, Emph_Level_1, Emph_Level_2, Emph_Level_3); type Train_Set is record Voltage_Swing : DP_Voltage_Swing; Pre_Emph : DP_Pre_Emph; end record; type Training_Pattern is (TP_1, TP_2, TP_3, TP_Idle, TP_None); ---------------------------------------------------------------------------- type Lane_Index is new Natural range 0 .. 3; type Lane_Status is record CR_Done : Boolean; Channel_EQ_Done : Boolean; Symbol_Locked : Boolean; Reserved : Boolean; end record; for Lane_Status use record CR_Done at 16#00# range 0 .. 0; Channel_EQ_Done at 16#00# range 1 .. 1; Symbol_Locked at 16#00# range 2 .. 2; Reserved at 16#00# range 3 .. 3; end record; type Lanes_Status is array (Lane_Index) of Lane_Status; pragma Pack (Lanes_Status); type Adjust_Request is record Voltage_Swing : DP_Voltage_Swing; Pre_Emph : DP_Pre_Emph; end record; for Adjust_Request use record Voltage_Swing at 16#00# range 0 .. 1; Pre_Emph at 16#00# range 2 .. 3; end record; type Adjust_Requests_Array is array (Lane_Index) of Adjust_Request; pragma Pack (Adjust_Requests_Array); type Link_Status is record Lanes : Lanes_Status; Interlane_Align_Done : Boolean; Adjust_Requests : Adjust_Requests_Array; end record; for Link_Status use record Lanes at 16#00# range 0 .. 15; Interlane_Align_Done at 16#02# range 0 .. 0; Adjust_Requests at 16#04# range 0 .. 15; end record; ---------------------------------------------------------------------------- procedure Read_Caps (Link : in out DP_Link; Port : in T; Success : out Boolean); procedure Preferred_Link_Setting (Link : in out DP_Link; Mode : in Mode_Type; Success : out Boolean); procedure Next_Link_Setting (Link : in out DP_Link; Mode : in Mode_Type; Success : out Boolean); pragma Warnings (GNATprove, Off, "subprogram ""Dump_Link_Setting"" has no effect", Reason => "It's only used for debugging"); procedure Dump_Link_Setting (Link : DP_Link); ---------------------------------------------------------------------------- M_N_Max : constant := 2 ** 24 - 1; subtype M_Type is Int64 range 0 .. M_N_Max; subtype N_Type is Int64 range 0 .. M_N_Max; procedure Calculate_M_N (Link : in DP_Link; Mode : in Mode_Type; Data_M : out M_Type; Data_N : out N_Type; Link_M : out M_Type; Link_N : out N_Type); ---------------------------------------------------------------------------- procedure Read_Link_Status (Port : in T; Status : out Link_Status; Success : out Boolean); function All_CR_Done (Status : Link_Status; Link : DP_Link) return Boolean; function All_EQ_Done (Status : Link_Status; Link : DP_Link) return Boolean; function Max_Requested_VS (Status : Link_Status; Link : DP_Link) return DP_Voltage_Swing; function Max_Requested_Emph (Status : Link_Status; Link : DP_Link) return DP_Pre_Emph; end HW.GFX.DP_Info;
-- Copyright 2016-2019 NXP -- All rights reserved.SPDX-License-Identifier: BSD-3-Clause -- This spec has been automatically generated from LPC55S6x.svd pragma Restrictions (No_Elaboration_Code); pragma Ada_2012; pragma Style_Checks (Off); with HAL; with System; package NXP_SVD.DBGMAILBOX is pragma Preelaborate; --------------- -- Registers -- --------------- -- CRC mode register type CSW_Register is record -- Debugger will set this bit to 1 to request a resynchronrisation RESYNCH_REQ : Boolean := False; -- Request is pending from debugger (i.e unread value in REQUEST) REQ_PENDING : Boolean := False; -- Debugger overrun error (previous REQUEST overwritten before being -- picked up by ROM) DBG_OR_ERR : Boolean := False; -- AHB overrun Error (Return value overwritten by ROM) AHB_OR_ERR : Boolean := False; -- Soft Reset for DM (write-only from AHB, not readable and -- selfclearing). A write to this bit will cause a soft reset for DM. SOFT_RESET : Boolean := False; -- Write-only. Write only bit. Once written will cause the chip to reset -- (note that the DM is not reset by this reset as it is only resettable -- by a SOFT reset or a POR/BOD event) CHIP_RESET_REQ : Boolean := False; -- unspecified Reserved_6_31 : HAL.UInt26 := 16#0#; end record with Volatile_Full_Access, Size => 32, Bit_Order => System.Low_Order_First; for CSW_Register use record RESYNCH_REQ at 0 range 0 .. 0; REQ_PENDING at 0 range 1 .. 1; DBG_OR_ERR at 0 range 2 .. 2; AHB_OR_ERR at 0 range 3 .. 3; SOFT_RESET at 0 range 4 .. 4; CHIP_RESET_REQ at 0 range 5 .. 5; Reserved_6_31 at 0 range 6 .. 31; end record; ----------------- -- Peripherals -- ----------------- -- MCU Debugger Mailbox type DBGMAILBOX_Peripheral is record -- CRC mode register CSW : aliased CSW_Register; -- CRC seed register REQUEST : aliased HAL.UInt32; -- Return value from ROM. RETURN_k : aliased HAL.UInt32; -- Identification register ID : aliased HAL.UInt32; end record with Volatile; for DBGMAILBOX_Peripheral use record CSW at 16#0# range 0 .. 31; REQUEST at 16#4# range 0 .. 31; RETURN_k at 16#8# range 0 .. 31; ID at 16#FC# range 0 .. 31; end record; -- MCU Debugger Mailbox DBGMAILBOX_Periph : aliased DBGMAILBOX_Peripheral with Import, Address => System'To_Address (16#4009C000#); end NXP_SVD.DBGMAILBOX;
pragma Style_Checks (Off); -- This spec has been automatically generated from STM32F3x4.svd pragma Restrictions (No_Elaboration_Code); with HAL; with System; package STM32_SVD.RCC is pragma Preelaborate; --------------- -- Registers -- --------------- subtype CR_HSITRIM_Field is HAL.UInt5; subtype CR_HSICAL_Field is HAL.UInt8; -- Clock control register type CR_Register is record -- Internal High Speed clock enable HSION : Boolean := True; -- Read-only. Internal High Speed clock ready flag HSIRDY : Boolean := True; -- unspecified Reserved_2_2 : HAL.Bit := 16#0#; -- Internal High Speed clock trimming HSITRIM : CR_HSITRIM_Field := 16#10#; -- Read-only. Internal High Speed clock Calibration HSICAL : CR_HSICAL_Field := 16#0#; -- External High Speed clock enable HSEON : Boolean := False; -- Read-only. External High Speed clock ready flag HSERDY : Boolean := False; -- External High Speed clock Bypass HSEBYP : Boolean := False; -- Clock Security System enable CSSON : Boolean := False; -- unspecified Reserved_20_23 : HAL.UInt4 := 16#0#; -- PLL enable PLLON : Boolean := False; -- Read-only. PLL clock ready flag PLLRDY : Boolean := False; -- unspecified Reserved_26_31 : HAL.UInt6 := 16#0#; end record with Volatile_Full_Access, Object_Size => 32, Bit_Order => System.Low_Order_First; for CR_Register use record HSION at 0 range 0 .. 0; HSIRDY at 0 range 1 .. 1; Reserved_2_2 at 0 range 2 .. 2; HSITRIM at 0 range 3 .. 7; HSICAL at 0 range 8 .. 15; HSEON at 0 range 16 .. 16; HSERDY at 0 range 17 .. 17; HSEBYP at 0 range 18 .. 18; CSSON at 0 range 19 .. 19; Reserved_20_23 at 0 range 20 .. 23; PLLON at 0 range 24 .. 24; PLLRDY at 0 range 25 .. 25; Reserved_26_31 at 0 range 26 .. 31; end record; subtype CFGR_SW_Field is HAL.UInt2; subtype CFGR_SWS_Field is HAL.UInt2; subtype CFGR_HPRE_Field is HAL.UInt4; -- CFGR_PPRE array element subtype CFGR_PPRE_Element is HAL.UInt3; -- CFGR_PPRE array type CFGR_PPRE_Field_Array is array (1 .. 2) of CFGR_PPRE_Element with Component_Size => 3, Size => 6; -- Type definition for CFGR_PPRE type CFGR_PPRE_Field (As_Array : Boolean := False) is record case As_Array is when False => -- PPRE as a value Val : HAL.UInt6; when True => -- PPRE as an array Arr : CFGR_PPRE_Field_Array; end case; end record with Unchecked_Union, Size => 6; for CFGR_PPRE_Field use record Val at 0 range 0 .. 5; Arr at 0 range 0 .. 5; end record; subtype CFGR_PLLMUL_Field is HAL.UInt4; subtype CFGR_MCO_Field is HAL.UInt3; subtype CFGR_MCOPRE_Field is HAL.UInt3; -- Clock configuration register (RCC_CFGR) type CFGR_Register is record -- System clock Switch SW : CFGR_SW_Field := 16#0#; -- Read-only. System Clock Switch Status SWS : CFGR_SWS_Field := 16#0#; -- AHB prescaler HPRE : CFGR_HPRE_Field := 16#0#; -- APB Low speed prescaler (APB1) PPRE : CFGR_PPRE_Field := (As_Array => False, Val => 16#0#); -- unspecified Reserved_14_15 : HAL.UInt2 := 16#0#; -- PLL entry clock source PLLSRC : Boolean := False; -- HSE divider for PLL entry PLLXTPRE : Boolean := False; -- PLL Multiplication Factor PLLMUL : CFGR_PLLMUL_Field := 16#0#; -- unspecified Reserved_22_23 : HAL.UInt2 := 16#0#; -- Microcontroller clock output MCO : CFGR_MCO_Field := 16#0#; -- unspecified Reserved_27_27 : HAL.Bit := 16#0#; -- Read-only. Microcontroller Clock Output Prescaler MCOPRE : CFGR_MCOPRE_Field := 16#0#; -- Do not divide PLL to MCO PLLNODIV : Boolean := False; end record with Volatile_Full_Access, Object_Size => 32, Bit_Order => System.Low_Order_First; for CFGR_Register use record SW at 0 range 0 .. 1; SWS at 0 range 2 .. 3; HPRE at 0 range 4 .. 7; PPRE at 0 range 8 .. 13; Reserved_14_15 at 0 range 14 .. 15; PLLSRC at 0 range 16 .. 16; PLLXTPRE at 0 range 17 .. 17; PLLMUL at 0 range 18 .. 21; Reserved_22_23 at 0 range 22 .. 23; MCO at 0 range 24 .. 26; Reserved_27_27 at 0 range 27 .. 27; MCOPRE at 0 range 28 .. 30; PLLNODIV at 0 range 31 .. 31; end record; -- Clock interrupt register (RCC_CIR) type CIR_Register is record -- Read-only. LSI Ready Interrupt flag LSIRDYF : Boolean := False; -- Read-only. LSE Ready Interrupt flag LSERDYF : Boolean := False; -- Read-only. HSI Ready Interrupt flag HSIRDYF : Boolean := False; -- Read-only. HSE Ready Interrupt flag HSERDYF : Boolean := False; -- Read-only. PLL Ready Interrupt flag PLLRDYF : Boolean := False; -- unspecified Reserved_5_6 : HAL.UInt2 := 16#0#; -- Read-only. Clock Security System Interrupt flag CSSF : Boolean := False; -- LSI Ready Interrupt Enable LSIRDYIE : Boolean := False; -- LSE Ready Interrupt Enable LSERDYIE : Boolean := False; -- HSI Ready Interrupt Enable HSIRDYIE : Boolean := False; -- HSE Ready Interrupt Enable HSERDYIE : Boolean := False; -- PLL Ready Interrupt Enable PLLRDYIE : Boolean := False; -- unspecified Reserved_13_15 : HAL.UInt3 := 16#0#; -- Write-only. LSI Ready Interrupt Clear LSIRDYC : Boolean := False; -- Write-only. LSE Ready Interrupt Clear LSERDYC : Boolean := False; -- Write-only. HSI Ready Interrupt Clear HSIRDYC : Boolean := False; -- Write-only. HSE Ready Interrupt Clear HSERDYC : Boolean := False; -- Write-only. PLL Ready Interrupt Clear PLLRDYC : Boolean := False; -- unspecified Reserved_21_22 : HAL.UInt2 := 16#0#; -- Write-only. Clock security system interrupt clear CSSC : Boolean := False; -- unspecified Reserved_24_31 : HAL.UInt8 := 16#0#; end record with Volatile_Full_Access, Object_Size => 32, Bit_Order => System.Low_Order_First; for CIR_Register use record LSIRDYF at 0 range 0 .. 0; LSERDYF at 0 range 1 .. 1; HSIRDYF at 0 range 2 .. 2; HSERDYF at 0 range 3 .. 3; PLLRDYF at 0 range 4 .. 4; Reserved_5_6 at 0 range 5 .. 6; CSSF at 0 range 7 .. 7; LSIRDYIE at 0 range 8 .. 8; LSERDYIE at 0 range 9 .. 9; HSIRDYIE at 0 range 10 .. 10; HSERDYIE at 0 range 11 .. 11; PLLRDYIE at 0 range 12 .. 12; Reserved_13_15 at 0 range 13 .. 15; LSIRDYC at 0 range 16 .. 16; LSERDYC at 0 range 17 .. 17; HSIRDYC at 0 range 18 .. 18; HSERDYC at 0 range 19 .. 19; PLLRDYC at 0 range 20 .. 20; Reserved_21_22 at 0 range 21 .. 22; CSSC at 0 range 23 .. 23; Reserved_24_31 at 0 range 24 .. 31; end record; -- APB2 peripheral reset register (RCC_APB2RSTR) type APB2RSTR_Register is record -- SYSCFG and COMP reset SYSCFGRST : Boolean := False; -- unspecified Reserved_1_10 : HAL.UInt10 := 16#0#; -- TIM1 timer reset TIM1RST : Boolean := False; -- SPI 1 reset SPI1RST : Boolean := False; -- unspecified Reserved_13_13 : HAL.Bit := 16#0#; -- USART1 reset USART1RST : Boolean := False; -- unspecified Reserved_15_15 : HAL.Bit := 16#0#; -- TIM15 timer reset TIM15RST : Boolean := False; -- TIM16 timer reset TIM16RST : Boolean := False; -- TIM17 timer reset TIM17RST : Boolean := False; -- unspecified Reserved_19_28 : HAL.UInt10 := 16#0#; -- High Resolution timer 1 reset HRTIM1RST : Boolean := False; -- unspecified Reserved_30_31 : HAL.UInt2 := 16#0#; end record with Volatile_Full_Access, Object_Size => 32, Bit_Order => System.Low_Order_First; for APB2RSTR_Register use record SYSCFGRST at 0 range 0 .. 0; Reserved_1_10 at 0 range 1 .. 10; TIM1RST at 0 range 11 .. 11; SPI1RST at 0 range 12 .. 12; Reserved_13_13 at 0 range 13 .. 13; USART1RST at 0 range 14 .. 14; Reserved_15_15 at 0 range 15 .. 15; TIM15RST at 0 range 16 .. 16; TIM16RST at 0 range 17 .. 17; TIM17RST at 0 range 18 .. 18; Reserved_19_28 at 0 range 19 .. 28; HRTIM1RST at 0 range 29 .. 29; Reserved_30_31 at 0 range 30 .. 31; end record; -- APB1 peripheral reset register (RCC_APB1RSTR) type APB1RSTR_Register is record -- Timer 2 reset TIM2RST : Boolean := False; -- Timer 3 reset TIM3RST : Boolean := False; -- unspecified Reserved_2_3 : HAL.UInt2 := 16#0#; -- Timer 6 reset TIM6RST : Boolean := False; -- Timer 7 reset TIM7RST : Boolean := False; -- unspecified Reserved_6_10 : HAL.UInt5 := 16#0#; -- Window watchdog reset WWDGRST : Boolean := False; -- unspecified Reserved_12_16 : HAL.UInt5 := 16#0#; -- USART 2 reset USART2RST : Boolean := False; -- USART3 reset USART3RST : Boolean := False; -- unspecified Reserved_19_20 : HAL.UInt2 := 16#0#; -- I2C1 reset I2C1RST : Boolean := False; -- unspecified Reserved_22_24 : HAL.UInt3 := 16#0#; -- CAN reset CANRST : Boolean := False; -- DAC interface reset DAC2RST : Boolean := False; -- unspecified Reserved_27_27 : HAL.Bit := 16#0#; -- Power interface reset PWRRST : Boolean := False; -- DAC interface reset DAC1RST : Boolean := False; -- unspecified Reserved_30_31 : HAL.UInt2 := 16#0#; end record with Volatile_Full_Access, Object_Size => 32, Bit_Order => System.Low_Order_First; for APB1RSTR_Register use record TIM2RST at 0 range 0 .. 0; TIM3RST at 0 range 1 .. 1; Reserved_2_3 at 0 range 2 .. 3; TIM6RST at 0 range 4 .. 4; TIM7RST at 0 range 5 .. 5; Reserved_6_10 at 0 range 6 .. 10; WWDGRST at 0 range 11 .. 11; Reserved_12_16 at 0 range 12 .. 16; USART2RST at 0 range 17 .. 17; USART3RST at 0 range 18 .. 18; Reserved_19_20 at 0 range 19 .. 20; I2C1RST at 0 range 21 .. 21; Reserved_22_24 at 0 range 22 .. 24; CANRST at 0 range 25 .. 25; DAC2RST at 0 range 26 .. 26; Reserved_27_27 at 0 range 27 .. 27; PWRRST at 0 range 28 .. 28; DAC1RST at 0 range 29 .. 29; Reserved_30_31 at 0 range 30 .. 31; end record; -- AHB Peripheral Clock enable register (RCC_AHBENR) type AHBENR_Register is record -- DMA1 clock enable DMA1EN : Boolean := False; -- unspecified Reserved_1_1 : HAL.Bit := 16#0#; -- SRAM interface clock enable SRAMEN : Boolean := True; -- unspecified Reserved_3_3 : HAL.Bit := 16#0#; -- FLITF clock enable FLITFEN : Boolean := True; -- unspecified Reserved_5_5 : HAL.Bit := 16#0#; -- CRC clock enable CRCEN : Boolean := False; -- unspecified Reserved_7_16 : HAL.UInt10 := 16#0#; -- I/O port A clock enable IOPAEN : Boolean := False; -- I/O port B clock enable IOPBEN : Boolean := False; -- I/O port C clock enable IOPCEN : Boolean := False; -- I/O port D clock enable IOPDEN : Boolean := False; -- unspecified Reserved_21_21 : HAL.Bit := 16#0#; -- I/O port F clock enable IOPFEN : Boolean := False; -- unspecified Reserved_23_23 : HAL.Bit := 16#0#; -- Touch sensing controller clock enable TSCEN : Boolean := False; -- unspecified Reserved_25_27 : HAL.UInt3 := 16#0#; -- ADC1 and ADC2 clock enable ADC12EN : Boolean := False; -- unspecified Reserved_29_31 : HAL.UInt3 := 16#0#; end record with Volatile_Full_Access, Object_Size => 32, Bit_Order => System.Low_Order_First; for AHBENR_Register use record DMA1EN at 0 range 0 .. 0; Reserved_1_1 at 0 range 1 .. 1; SRAMEN at 0 range 2 .. 2; Reserved_3_3 at 0 range 3 .. 3; FLITFEN at 0 range 4 .. 4; Reserved_5_5 at 0 range 5 .. 5; CRCEN at 0 range 6 .. 6; Reserved_7_16 at 0 range 7 .. 16; IOPAEN at 0 range 17 .. 17; IOPBEN at 0 range 18 .. 18; IOPCEN at 0 range 19 .. 19; IOPDEN at 0 range 20 .. 20; Reserved_21_21 at 0 range 21 .. 21; IOPFEN at 0 range 22 .. 22; Reserved_23_23 at 0 range 23 .. 23; TSCEN at 0 range 24 .. 24; Reserved_25_27 at 0 range 25 .. 27; ADC12EN at 0 range 28 .. 28; Reserved_29_31 at 0 range 29 .. 31; end record; -- APB2 peripheral clock enable register (RCC_APB2ENR) type APB2ENR_Register is record -- SYSCFG clock enable SYSCFGEN : Boolean := False; -- unspecified Reserved_1_10 : HAL.UInt10 := 16#0#; -- TIM1 Timer clock enable TIM1EN : Boolean := False; -- SPI 1 clock enable SPI1EN : Boolean := False; -- unspecified Reserved_13_13 : HAL.Bit := 16#0#; -- USART1 clock enable USART1EN : Boolean := False; -- unspecified Reserved_15_15 : HAL.Bit := 16#0#; -- TIM15 timer clock enable TIM15EN : Boolean := False; -- TIM16 timer clock enable TIM16EN : Boolean := False; -- TIM17 timer clock enable TIM17EN : Boolean := False; -- unspecified Reserved_19_28 : HAL.UInt10 := 16#0#; -- High Resolution timer 1 clock enable HRTIM1EN : Boolean := False; -- unspecified Reserved_30_31 : HAL.UInt2 := 16#0#; end record with Volatile_Full_Access, Object_Size => 32, Bit_Order => System.Low_Order_First; for APB2ENR_Register use record SYSCFGEN at 0 range 0 .. 0; Reserved_1_10 at 0 range 1 .. 10; TIM1EN at 0 range 11 .. 11; SPI1EN at 0 range 12 .. 12; Reserved_13_13 at 0 range 13 .. 13; USART1EN at 0 range 14 .. 14; Reserved_15_15 at 0 range 15 .. 15; TIM15EN at 0 range 16 .. 16; TIM16EN at 0 range 17 .. 17; TIM17EN at 0 range 18 .. 18; Reserved_19_28 at 0 range 19 .. 28; HRTIM1EN at 0 range 29 .. 29; Reserved_30_31 at 0 range 30 .. 31; end record; -- APB1 peripheral clock enable register (RCC_APB1ENR) type APB1ENR_Register is record -- Timer 2 clock enable TIM2EN : Boolean := False; -- Timer 3 clock enable TIM3EN : Boolean := False; -- unspecified Reserved_2_3 : HAL.UInt2 := 16#0#; -- Timer 6 clock enable TIM6EN : Boolean := False; -- Timer 7 clock enable TIM7EN : Boolean := False; -- unspecified Reserved_6_10 : HAL.UInt5 := 16#0#; -- Window watchdog clock enable WWDGEN : Boolean := False; -- unspecified Reserved_12_16 : HAL.UInt5 := 16#0#; -- USART 2 clock enable USART2EN : Boolean := False; -- USART 3 clock enable USART3EN : Boolean := False; -- unspecified Reserved_19_20 : HAL.UInt2 := 16#0#; -- I2C 1 clock enable I2C1EN : Boolean := False; -- unspecified Reserved_22_24 : HAL.UInt3 := 16#0#; -- CAN clock enable CANEN : Boolean := False; -- DAC interface clock enable DAC2EN : Boolean := False; -- unspecified Reserved_27_27 : HAL.Bit := 16#0#; -- Power interface clock enable PWREN : Boolean := False; -- DAC1 interface clock enable DAC1EN : Boolean := False; -- unspecified Reserved_30_31 : HAL.UInt2 := 16#0#; end record with Volatile_Full_Access, Object_Size => 32, Bit_Order => System.Low_Order_First; for APB1ENR_Register use record TIM2EN at 0 range 0 .. 0; TIM3EN at 0 range 1 .. 1; Reserved_2_3 at 0 range 2 .. 3; TIM6EN at 0 range 4 .. 4; TIM7EN at 0 range 5 .. 5; Reserved_6_10 at 0 range 6 .. 10; WWDGEN at 0 range 11 .. 11; Reserved_12_16 at 0 range 12 .. 16; USART2EN at 0 range 17 .. 17; USART3EN at 0 range 18 .. 18; Reserved_19_20 at 0 range 19 .. 20; I2C1EN at 0 range 21 .. 21; Reserved_22_24 at 0 range 22 .. 24; CANEN at 0 range 25 .. 25; DAC2EN at 0 range 26 .. 26; Reserved_27_27 at 0 range 27 .. 27; PWREN at 0 range 28 .. 28; DAC1EN at 0 range 29 .. 29; Reserved_30_31 at 0 range 30 .. 31; end record; subtype BDCR_LSEDRV_Field is HAL.UInt2; subtype BDCR_RTCSEL_Field is HAL.UInt2; -- Backup domain control register (RCC_BDCR) type BDCR_Register is record -- External Low Speed oscillator enable LSEON : Boolean := False; -- Read-only. External Low Speed oscillator ready LSERDY : Boolean := False; -- External Low Speed oscillator bypass LSEBYP : Boolean := False; -- LSE oscillator drive capability LSEDRV : BDCR_LSEDRV_Field := 16#0#; -- unspecified Reserved_5_7 : HAL.UInt3 := 16#0#; -- RTC clock source selection RTCSEL : BDCR_RTCSEL_Field := 16#0#; -- unspecified Reserved_10_14 : HAL.UInt5 := 16#0#; -- RTC clock enable RTCEN : Boolean := False; -- Backup domain software reset BDRST : Boolean := False; -- unspecified Reserved_17_31 : HAL.UInt15 := 16#0#; end record with Volatile_Full_Access, Object_Size => 32, Bit_Order => System.Low_Order_First; for BDCR_Register use record LSEON at 0 range 0 .. 0; LSERDY at 0 range 1 .. 1; LSEBYP at 0 range 2 .. 2; LSEDRV at 0 range 3 .. 4; Reserved_5_7 at 0 range 5 .. 7; RTCSEL at 0 range 8 .. 9; Reserved_10_14 at 0 range 10 .. 14; RTCEN at 0 range 15 .. 15; BDRST at 0 range 16 .. 16; Reserved_17_31 at 0 range 17 .. 31; end record; -- Control/status register (RCC_CSR) type CSR_Register is record -- Internal low speed oscillator enable LSION : Boolean := False; -- Read-only. Internal low speed oscillator ready LSIRDY : Boolean := False; -- unspecified Reserved_2_22 : HAL.UInt21 := 16#0#; -- Reset flag of the 1.8V domain V18PWRRSTF : Boolean := False; -- Remove reset flag RMVF : Boolean := False; -- Option byte loader reset flag OBLRSTF : Boolean := False; -- PIN reset flag PINRSTF : Boolean := True; -- POR/PDR reset flag PORRSTF : Boolean := True; -- Software reset flag SFTRSTF : Boolean := False; -- Independent watchdog reset flag IWDGRSTF : Boolean := False; -- Window watchdog reset flag WWDGRSTF : Boolean := False; -- Low-power reset flag LPWRRSTF : Boolean := False; end record with Volatile_Full_Access, Object_Size => 32, Bit_Order => System.Low_Order_First; for CSR_Register use record LSION at 0 range 0 .. 0; LSIRDY at 0 range 1 .. 1; Reserved_2_22 at 0 range 2 .. 22; V18PWRRSTF at 0 range 23 .. 23; RMVF at 0 range 24 .. 24; OBLRSTF at 0 range 25 .. 25; PINRSTF at 0 range 26 .. 26; PORRSTF at 0 range 27 .. 27; SFTRSTF at 0 range 28 .. 28; IWDGRSTF at 0 range 29 .. 29; WWDGRSTF at 0 range 30 .. 30; LPWRRSTF at 0 range 31 .. 31; end record; -- AHB peripheral reset register type AHBRSTR_Register is record -- unspecified Reserved_0_16 : HAL.UInt17 := 16#0#; -- I/O port A reset IOPARST : Boolean := False; -- I/O port B reset IOPBRST : Boolean := False; -- I/O port C reset IOPCRST : Boolean := False; -- I/O port D reset IOPDRST : Boolean := False; -- unspecified Reserved_21_21 : HAL.Bit := 16#0#; -- I/O port F reset IOPFRST : Boolean := False; -- unspecified Reserved_23_23 : HAL.Bit := 16#0#; -- Touch sensing controller reset TSCRST : Boolean := False; -- unspecified Reserved_25_27 : HAL.UInt3 := 16#0#; -- ADC1 and ADC2 reset ADC12RST : Boolean := False; -- unspecified Reserved_29_31 : HAL.UInt3 := 16#0#; end record with Volatile_Full_Access, Object_Size => 32, Bit_Order => System.Low_Order_First; for AHBRSTR_Register use record Reserved_0_16 at 0 range 0 .. 16; IOPARST at 0 range 17 .. 17; IOPBRST at 0 range 18 .. 18; IOPCRST at 0 range 19 .. 19; IOPDRST at 0 range 20 .. 20; Reserved_21_21 at 0 range 21 .. 21; IOPFRST at 0 range 22 .. 22; Reserved_23_23 at 0 range 23 .. 23; TSCRST at 0 range 24 .. 24; Reserved_25_27 at 0 range 25 .. 27; ADC12RST at 0 range 28 .. 28; Reserved_29_31 at 0 range 29 .. 31; end record; subtype CFGR2_PREDIV_Field is HAL.UInt4; subtype CFGR2_ADC12PRES_Field is HAL.UInt5; -- Clock configuration register 2 type CFGR2_Register is record -- PREDIV division factor PREDIV : CFGR2_PREDIV_Field := 16#0#; -- ADC1 and ADC2 prescaler ADC12PRES : CFGR2_ADC12PRES_Field := 16#0#; -- unspecified Reserved_9_31 : HAL.UInt23 := 16#0#; end record with Volatile_Full_Access, Object_Size => 32, Bit_Order => System.Low_Order_First; for CFGR2_Register use record PREDIV at 0 range 0 .. 3; ADC12PRES at 0 range 4 .. 8; Reserved_9_31 at 0 range 9 .. 31; end record; subtype CFGR3_USART1SW_Field is HAL.UInt2; -- Clock configuration register 3 type CFGR3_Register is record -- USART1 clock source selection USART1SW : CFGR3_USART1SW_Field := 16#0#; -- unspecified Reserved_2_3 : HAL.UInt2 := 16#0#; -- I2C1 clock source selection I2C1SW : Boolean := False; -- unspecified Reserved_5_7 : HAL.UInt3 := 16#0#; -- Timer1 clock source selection TIM1SW : Boolean := False; -- unspecified Reserved_9_11 : HAL.UInt3 := 16#0#; -- High Resolution Timer1 clock source selection HRTIM1SW : Boolean := False; -- unspecified Reserved_13_31 : HAL.UInt19 := 16#0#; end record with Volatile_Full_Access, Object_Size => 32, Bit_Order => System.Low_Order_First; for CFGR3_Register use record USART1SW at 0 range 0 .. 1; Reserved_2_3 at 0 range 2 .. 3; I2C1SW at 0 range 4 .. 4; Reserved_5_7 at 0 range 5 .. 7; TIM1SW at 0 range 8 .. 8; Reserved_9_11 at 0 range 9 .. 11; HRTIM1SW at 0 range 12 .. 12; Reserved_13_31 at 0 range 13 .. 31; end record; ----------------- -- Peripherals -- ----------------- -- Reset and clock control type RCC_Peripheral is record -- Clock control register CR : aliased CR_Register; -- Clock configuration register (RCC_CFGR) CFGR : aliased CFGR_Register; -- Clock interrupt register (RCC_CIR) CIR : aliased CIR_Register; -- APB2 peripheral reset register (RCC_APB2RSTR) APB2RSTR : aliased APB2RSTR_Register; -- APB1 peripheral reset register (RCC_APB1RSTR) APB1RSTR : aliased APB1RSTR_Register; -- AHB Peripheral Clock enable register (RCC_AHBENR) AHBENR : aliased AHBENR_Register; -- APB2 peripheral clock enable register (RCC_APB2ENR) APB2ENR : aliased APB2ENR_Register; -- APB1 peripheral clock enable register (RCC_APB1ENR) APB1ENR : aliased APB1ENR_Register; -- Backup domain control register (RCC_BDCR) BDCR : aliased BDCR_Register; -- Control/status register (RCC_CSR) CSR : aliased CSR_Register; -- AHB peripheral reset register AHBRSTR : aliased AHBRSTR_Register; -- Clock configuration register 2 CFGR2 : aliased CFGR2_Register; -- Clock configuration register 3 CFGR3 : aliased CFGR3_Register; end record with Volatile; for RCC_Peripheral use record CR at 16#0# range 0 .. 31; CFGR at 16#4# range 0 .. 31; CIR at 16#8# range 0 .. 31; APB2RSTR at 16#C# range 0 .. 31; APB1RSTR at 16#10# range 0 .. 31; AHBENR at 16#14# range 0 .. 31; APB2ENR at 16#18# range 0 .. 31; APB1ENR at 16#1C# range 0 .. 31; BDCR at 16#20# range 0 .. 31; CSR at 16#24# range 0 .. 31; AHBRSTR at 16#28# range 0 .. 31; CFGR2 at 16#2C# range 0 .. 31; CFGR3 at 16#30# range 0 .. 31; end record; -- Reset and clock control RCC_Periph : aliased RCC_Peripheral with Import, Address => RCC_Base; end STM32_SVD.RCC;
------------------------------------------------------------------------------ -- Copyright (c) 2020,2021 Protean Code Limited -- All rights reserved. -- -- "Simplified" (2-Clause) BSD Licence -- -- 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. -- -- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -- "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED -- TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -- PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR -- CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -- EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -- PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -- PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -- LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -- NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -- SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. ------------------------------------------------------------------------------ with Ada.Unchecked_Conversion; with Interfaces; use Interfaces; package SPARKNaCl with Pure, SPARK_Mode => On is --============================================== -- Exported types and constants -- -- These are needed by clients, or by the -- specifications of child packages --============================================== subtype Byte is Unsigned_8; subtype I32 is Integer_32; subtype N32 is I32 range 0 .. I32'Last; subtype I32_Bit is I32 range 0 .. 1; subtype I64 is Integer_64; subtype I64_Byte is I64 range 0 .. 255; subtype I64_Bit is I64 range 0 .. 1; -- Byte_Seq and constrained subtypes thereof type Byte_Seq is array (N32 range <>) of Byte; subtype Index_8 is I32 range 0 .. 7; subtype Index_16 is I32 range 0 .. 15; subtype Index_24 is I32 range 0 .. 23; subtype Index_32 is I32 range 0 .. 31; subtype Index_64 is I32 range 0 .. 63; subtype Bytes_8 is Byte_Seq (Index_8); subtype Bytes_16 is Byte_Seq (Index_16); subtype Bytes_24 is Byte_Seq (Index_24); subtype Bytes_32 is Byte_Seq (Index_32); subtype Bytes_64 is Byte_Seq (Index_64); Zero_Bytes_16 : constant Bytes_16 := (others => 0); Zero_Bytes_32 : constant Bytes_32 := (others => 0); -- A sequence of I64 values, but where each is limited to -- values 0 .. 255; type I64_Byte_Seq is array (N32 range <>) of I64_Byte; -- Sequences of I64 values and subtypes thereof type I64_Seq is array (N32 range <>) of I64; subtype I64_Seq_64 is I64_Seq (Index_64); -------------------------------------------------------- -- Constant time equality test -------------------------------------------------------- -- Primitive operation of Byte_Seq, so inheritable function Equal (X, Y : in Byte_Seq) return Boolean with Pure_Function, Global => null, Pre => X'First = Y'First and X'Last = Y'Last, Post => Equal'Result = (for all I in X'Range => X (I) = Y (I)); -------------------------------------------------------- -- Data sanitization -------------------------------------------------------- -- Primitive operation of Byte_Seq, so inheritable. -- In their "Volatiles are mis-compiled..." paper, -- Regehr et al. recommend that calls to such subprograms -- should never be in-lined as a way to prevent -- the incorrect optimization (to nothing) of such a call, -- so we apply No_Inline here. pragma Warnings (GNATProve, Off, "No_Inline"); procedure Sanitize (R : out Byte_Seq) with Global => null, No_Inline; private --============================================== -- Local types - visible below, in this package -- body and in the bodies of child packages --============================================== subtype U16 is Unsigned_16; subtype U32 is Unsigned_32; subtype U64 is Unsigned_64; subtype Index_4 is I32 range 0 .. 3; subtype Index_15 is I32 range 0 .. 14; subtype Index_20 is I32 range 0 .. 19; subtype Index_31 is I32 range 0 .. 30; subtype Index_256 is I32 range 0 .. 255; subtype Bytes_4 is Byte_Seq (Index_4); subtype Bytes_256 is Byte_Seq (Index_256); type U32_Seq is array (N32 range <>) of U32; type U64_Seq is array (N32 range <>) of U64; subtype U32_Seq_4 is U32_Seq (Index_4); subtype U32_Seq_16 is U32_Seq (Index_16); subtype I64_Byte_Seq_32 is I64_Byte_Seq (Index_32); subtype U64_Seq_16 is U64_Seq (Index_16); subtype U64_Seq_8 is U64_Seq (Index_8); -- Constant Sigma used for initialization of Core Salsa20 -- function in both Stream and Cryptobox packages Sigma : constant Bytes_16 := (0 => Character'Pos ('e'), 1 => Character'Pos ('x'), 2 => Character'Pos ('p'), 3 => Character'Pos ('a'), 4 => Character'Pos ('n'), 5 => Character'Pos ('d'), 6 => Character'Pos (' '), 7 => Character'Pos ('3'), 8 => Character'Pos ('2'), 9 => Character'Pos ('-'), 10 => Character'Pos ('b'), 11 => Character'Pos ('y'), 12 => Character'Pos ('t'), 13 => Character'Pos ('e'), 14 => Character'Pos (' '), 15 => Character'Pos ('k')); ------------------------------------------------------------------------- -- Constants common to the whole library -- -- Some "Huffman-lite coding" is applied to names here - the most -- frequently used constants having abbreviated names. ------------------------------------------------------------------------- -- GF "Limbs" are stored modulo 65536 -- -- "LM" = "Limb Modulus" -- "LMM1" = "Limb Modulus Minus 1" LM : constant := 65536; LMM1 : constant := 65535; -- The modulus of curve 25519 is (2**255 - 19). -- In the reduction of GF values, we sometime need to multiply a limb -- value by 2**256 mod (2**255 - 19), which is actually equal to 38, -- since 2**256 = (2 * (2**255 - 19)) + 38 -- -- "R2256" = "Remainder of 2**256 (modulo 2**255-19)" R2256 : constant := 38; ------------------------------------------------------------------------- -- Bounds on All GF Limbs -- -- In the most general case, we define GF_Any_Limb so it can take -- on the value of any GF limb at any point including intermediate -- values inside the "*", "-" and "+" operations. -- -- Lower bound on GF_Any_Limb -- -- During a subtraction of a GF, a limb can also reach -65535, -- but this can be rounded down to -65536 by addition of a -1 carry, -- so the lower bound is -65536 -- -- Upper bound on GF_Any_Limb -- -- During the "reduction modulo 2**255-19" phase of the "*" -- operation, each limb GF (I) is added to R2256 * GF (I + 16) -- The worst-case upper bound of this result is when I = 0, -- where GF (0) has upper bound MGFLP and GF (16) has upper bound -- 15 * MGFLP. -- -- Therefore the upper bound of Any_GF_Limb is -- (R2256 * 15 + 1) * MGFLP = 571 * MGFLP ------------------------------------------------------------------------- -- "Maximum GF Limb Coefficient" MGFLC : constant := (R2256 * 15) + 1; -- In multiplying two normalized GFs, a simple product of -- two limbs is bounded to 65535**2. This comes up in -- predicates and subtypes below, so a named number here -- is called for. The name "MGFLP" is short for -- "Maximum GF Limb Product" MGFLP : constant := LMM1 * LMM1; -- The max value of a GF32_Any_Limb is the upper bound on digit 0 -- following ONE application of Product_To_Seminormal_GF to the -- intermidiate result of a "*" operation. This value is actually -- a bit less than 2**27 which justifies that subsequence normalization -- steps can all be done in 32-bir arithmetic. -- -- See the declaration of Seminormal_GF_LSL below for detail of -- how this value is derived. GF32_Any_Limb_Max : constant := (LMM1 + R2256 * ((53 * MGFLP) / LM)); subtype GF32_Any_Limb is I32 range -LM .. GF32_Any_Limb_Max; type GF32 is array (Index_16) of GF32_Any_Limb; -- In the "*" operator for GF, intermediate results require -- 64 bit integers before being normalized, so... subtype GF64_Any_Limb is I64 range -LM .. (MGFLC * MGFLP); type GF64 is array (Index_16) of GF64_Any_Limb; -- GF64 Product Accumulator - used in "*" to accumulate the -- intermediate results of Left * Right type GF64_PA is array (Index_31) of GF64_Any_Limb; ------------------------------------------------------------------------- subtype GF64_Normal_Limb is GF64_Any_Limb range 0 .. LMM1; subtype GF32_Normal_Limb is GF32_Any_Limb range 0 .. LMM1; subtype GF16_Normal_Limb is U16; subtype Normal_GF64 is GF64 with Dynamic_Predicate => (for all I in Index_16 => Normal_GF64 (I) in GF64_Normal_Limb); subtype Normal_GF32 is GF32 with Dynamic_Predicate => (for all I in Index_16 => Normal_GF32 (I) in GF32_Normal_Limb); type Normal_GF is array (Index_16) of GF16_Normal_Limb with Alignment => 4; ------------------------------------------------------------------------- ------------------------------------------------------------------------- -- Subtypes supporting "+" operation on GF -- -- In a "+" operation, intermediate result limbs peak at +131070, so subtype GF_Sum_Limb is I32 range 0 .. (LMM1 * 2); subtype Sum_GF is GF32 with Dynamic_Predicate => (for all I in Index_16 => Sum_GF (I) in GF_Sum_Limb); ------------------------------------------------------------------------- ------------------------------------------------------------------------- -- Subtypes supporting "-" operation on GF -- -- In a "-" operation, each limb of the intermediate result is -- increased by 65536 to make sure it's not negative, and one -- is taken off the next limb up to balance the value. -- -- This means that -- Limb 0 is in range (0 - 65535) + 65536 .. (65535 - 0) + 65536 -- which is 1 .. 131071 -- Limbs 1 .. 15 are in range (0 - 65535) + 65535 .. (65535 - 0) + 65535 -- which is 0 .. 131070 -- -- Finally, to balance the -1 value carried into limb 16, limb 0 -- is reduced by R2256, so... subtype Difference_GF is GF32 with Dynamic_Predicate => ((Difference_GF (0) in (1 - R2256) .. (2 * LMM1) + 1) and (for all K in Index_16 range 1 .. 15 => Difference_GF (K) in 0 .. 2 * LMM1)); ------------------------------------------------------------------------- -- Subtypes supporting "*" operation on GF -- -- A GF which is the result of multiplying two other Normalized GFs, -- but BEFORE normalization is applied has the following bounds on -- its limbs. The upperbound on Limb 0 is MGFLC * MGFLP as in -- GF_Any_Limb, but the upper bound reduces by 37 * MGFLP -- for each limb onwards... -- -- Lower-bound here is 0 since "*" always takes Normal_GF -- parameters, so an intermediate limb can never be negative. subtype Product_GF is GF64 with Dynamic_Predicate => (for all I in Index_16 => Product_GF (I) >= 0 and Product_GF (I) <= (MGFLC - 37 * GF64_Any_Limb (I)) * MGFLP); ---------------------------------------------------------------------- -- A "Seminormal GF" is the result of applying a single -- normalization step to a Product_GF -- -- Least Significant Limb ("LSL") of a Seminormal GF. -- LSL is initially normalized to 0 .. 65535, but gets -- R2256 * Carry added to it, where Carry is (Limb 15 / 65536) -- The upper-bound on Limb 15 is given by substituting I = 14 -- into the Dynamic_Predicate above, so -- (MGFLC - 37 * 14) * MGFLP = 53 * MGFLP -- See the body of Product_To_Seminormal for the full -- proof of this upper-bound subtype Seminormal_GF_LSL is GF32_Any_Limb range 0 .. GF32_Any_Limb_Max; -- Limbs 1 though 15 are in 0 .. 65535, but the -- Least Significant Limb 0 is in GF_Seminormal_Product_LSL subtype Seminormal_GF is GF32 with Dynamic_Predicate => (Seminormal_GF (0) in Seminormal_GF_LSL and (for all I in Index_16 range 1 .. 15 => Seminormal_GF (I) in GF32_Normal_Limb)); ------------------------------------------------------------------------ -- A "Nearly-normal GF" is the result of applying either: -- 1. TWO normalization steps to a Product_GF -- OR -- 2. ONE normalization step to the SUM of 2 normalized GFs -- OR -- 3. ONE normalization step to the DIFFERENCE of 2 normalized GFs -- -- The least-significant-limb is normalized to 0 .. 65535, but then -- has +R2256 or -R2256 added to it, so its range is... subtype Nearlynormal_GF is GF32 with Dynamic_Predicate => ((Nearlynormal_GF (0) in -R2256 .. LMM1 + R2256) and (for all K in Index_16 range 1 .. 15 => (Nearlynormal_GF (K) in GF32_Normal_Limb))); ------------------------------------------------------------------------ --================================================= -- Constants, used in more than one child package --================================================= GF_0 : constant Normal_GF := (others => 0); GF32_0 : constant Normal_GF32 := (others => 0); GF_1 : constant Normal_GF := (1, others => 0); --================== -- Local functions --================== function To_U64 is new Ada.Unchecked_Conversion (I64, U64); function To_I64 is new Ada.Unchecked_Conversion (U64, I64); function To_U32 is new Ada.Unchecked_Conversion (I32, U32); function To_I32 is new Ada.Unchecked_Conversion (U32, I32); -- returns equivalent of X >> 16 in C, doing an arithmetic -- shift right when X is negative, assuming 2's complement -- representation function ASR64_16 (X : in I64) return I64 is (To_I64 (Shift_Right_Arithmetic (To_U64 (X), 16))) with Post => (if X >= 0 then ASR64_16'Result = X / LM else ASR64_16'Result = ((X + 1) / LM) - 1); pragma Annotate (GNATprove, False_Positive, "postcondition might fail", "From definition of arithmetic shift right"); -- returns equivalent of X >> 16 in C, doing an arithmetic -- shift right when X is negative, assuming 2's complement -- representation function ASR32_16 (X : in I32) return I32 is (To_I32 (Shift_Right_Arithmetic (To_U32 (X), 16))) with Post => (if X >= 0 then ASR32_16'Result = X / LM else ASR32_16'Result = ((X + 1) / LM) - 1); pragma Annotate (GNATprove, False_Positive, "postcondition might fail", "From definition of arithmetic shift right"); -- returns equivalent of X >> 8 in C, doing an arithmetic -- shift right when X is negative, assuming 2's complement -- representation function ASR_8 (X : in I64) return I64 is (To_I64 (Shift_Right_Arithmetic (To_U64 (X), 8))) with Post => (if X >= 0 then ASR_8'Result = X / 256 else ASR_8'Result = ((X + 1) / 256) - 1); pragma Annotate (GNATprove, False_Positive, "postcondition might fail", "From definition of arithmetic shift right"); -- returns equivalent of X >> 4 in C, doing an arithmetic -- shift right when X is negative, assuming 2's complement -- representation function ASR_4 (X : in I64) return I64 is (To_I64 (Shift_Right_Arithmetic (To_U64 (X), 4))) with Post => (if X >= 0 then ASR_4'Result = X / 16 else ASR_4'Result = ((X + 1) / 16) - 1); pragma Annotate (GNATprove, False_Positive, "postcondition might fail", "From definition of arithmetic shift right"); --=============================== -- Local subprogram declarations --=============================== function "+" (Left, Right : in Normal_GF) return Normal_GF with Pure_Function, Global => null; function "-" (Left, Right : in Normal_GF) return Normal_GF with Pure_Function, Global => null; function "*" (Left, Right : in Normal_GF) return Normal_GF with Pure_Function, Global => null; function Square (A : in Normal_GF) return Normal_GF is (A * A) with Pure_Function, Global => null; -- Additional sanitization procedures for local types procedure Sanitize_U32 (R : out U32) with Global => null, No_Inline; procedure Sanitize_U16 (R : out U16) with Global => null, No_Inline; procedure Sanitize_U64 (R : out U64) with Global => null, No_Inline; procedure Sanitize_GF32 (R : out GF32) with Global => null, No_Inline, Post => R in Normal_GF32; procedure Sanitize_GF16 (R : out Normal_GF) with Global => null, No_Inline, Post => R in Normal_GF; procedure Sanitize_GF64_PA (R : out GF64_PA) with Global => null, No_Inline; procedure Sanitize_I64_Seq (R : out I64_Seq) with Global => null, No_Inline; procedure Sanitize_Boolean (R : out Boolean) with Global => null, No_Inline; end SPARKNaCl;
separate(practica4)--funcion para saber que esta separado --del fichero de prueba procedure Separar(R_Total: in Unbounded_String; R_Letra: out Unbounded_String; R_numer: out Unbounded_String) is Todo:constant string:=" ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789"; --Es la ristra que se va a comparar para las subristras s,N:Natural; carac:Unbounded_string; begin s:=length(r_total);--Aqui va la longitud de la ristra r_total for i in 1..s loop carac:=to_unbounded_string(slice(r_total,i,i)); N:=index(to_unbounded_string(todo),to_string(carac)); if N > 1 and N < 53 then-- si esta en el rango entonces es un caracter de letra r_Letra:=r_Letra & carac; else if N > 52 then-- si no es el caracter letra es un caracter numero que se encuentra a -- partir de la posicion 53 y lo concateno en la ristra de numeros r_numer:=r_numer & carac; else-- si no es ninguno de los dos casos entonces el index vale 1 y es el caracter espacio --en blanco y lo concateno en las dos ristras if n=1 then r_numer:=r_numer & carac; r_Letra:=r_Letra & carac; end if; end if;--en caso de que el caracter no sea los que estan en la ristra se deshechara end if; end loop; return; end separar;