content
stringlengths
23
1.05M
----------------------------------------------------------------------- -- net-protos-dispatchers -- Network protocol dispatchers -- Copyright (C) 2016, 2017 Stephane Carrez -- Written by Stephane Carrez (Stephane.Carrez@gmail.com) -- -- Licensed under the Apache License, Version 2.0 (the "License"); -- you may not use this file except in compliance with the License. -- You may obtain a copy of the License at -- -- http://www.apache.org/licenses/LICENSE-2.0 -- -- Unless required by applicable law or agreed to in writing, software -- distributed under the License is distributed on an "AS IS" BASIS, -- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -- See the License for the specific language governing permissions and -- limitations under the License. ----------------------------------------------------------------------- with Net.Headers; with Net.Protos.IPv4; with Net.Protos.Icmp; with Net.Sockets.Udp; package body Net.Protos.Dispatchers is procedure Default_Receive (Ifnet : in out Net.Interfaces.Ifnet_Type'Class; Packet : in out Net.Buffers.Buffer_Type); Igmp_Receive : Receive_Handler := Default_Receive'Access; Icmp_Receive : Receive_Handler := Net.Protos.Icmp.Receive'Access; Udp_Receive : Receive_Handler := Net.Sockets.Udp.Input'Access; Other_Receive : Receive_Handler := Default_Receive'Access; -- ------------------------------ -- Set a protocol handler to deal with a packet of the given protocol when it is received. -- Return the previous protocol handler. -- ------------------------------ procedure Set_Handler (Proto : in Net.Uint8; Handler : in Receive_Handler; Previous : out Receive_Handler) is begin case Proto is when Net.Protos.IPv4.P_ICMP => Previous := Icmp_Receive; Icmp_Receive := Handler; when Net.Protos.IPv4.P_IGMP => Previous := Igmp_Receive; Igmp_Receive := Handler; when Net.Protos.IPv4.P_UDP => Previous := Udp_Receive; Udp_Receive := Handler; when others => Previous := Other_Receive; Other_Receive := Handler; end case; end Set_Handler; procedure Default_Receive (Ifnet : in out Net.Interfaces.Ifnet_Type'Class; Packet : in out Net.Buffers.Buffer_Type) is begin null; end Default_Receive; -- ------------------------------ -- Receive an IPv4 packet and dispatch it according to the protocol. -- ------------------------------ procedure Receive (Ifnet : in out Net.Interfaces.Ifnet_Type'Class; Packet : in out Net.Buffers.Buffer_Type) is Ip_Hdr : constant Net.Headers.IP_Header_Access := Packet.IP; begin case Ip_Hdr.Ip_P is when Net.Protos.IPv4.P_ICMP => Icmp_Receive (Ifnet, Packet); when Net.Protos.IPv4.P_IGMP => Igmp_Receive (Ifnet, Packet); when Net.Protos.IPv4.P_UDP => Udp_Receive (Ifnet, Packet); when others => Other_Receive (Ifnet, Packet); end case; end Receive; end Net.Protos.Dispatchers;
-- © Copyright 2000 by John Halleck, All rights reserved. -- Basic Definitions for NSA's Secure Hash Algorithm. -- This code implements SHA-1 defined in FIPS PUB 180-1, 17 April 1995. -- It is part of a project at http://www.cc.utah.edu/~nahaj/ with Interfaces; use Interfaces; -- The only modular types for which rotation and shift are officially -- defined are those in Interfaces. -- We use Unsigned_32 for the digest, and Unsigned_8 in some of the -- computation routines. package SHA is pragma Pure (SHA); -- At top level we define ONLY the digest, so that programs that -- store, compare, and manipulate the digest can be written, without -- them all having to drag in everything needed to compute it. -- The standard is written in terms of 32 bit words. Bits_In_Word : constant := 32; -- Bits per Digest word. Words_In_Digest : constant := 5; Bits_In_Digest : constant := Bits_In_Word * Words_In_Digest; type Digest is array (0 .. Words_In_Digest - 1) of Unsigned_32; end SHA;
with Project_Processor.Configuration; with Project_Processor.Parsers.Abstract_Parsers; with Project_Processor.Parsers.Parser_Tables; -- with Project_Processor.Parsers.XML_Parsers; with EU_Projects.Projects; with Project_Processor.Processors.Processor_Tables; use Project_Processor.Processors; use Project_Processor.Parsers; use EU_Projects.Projects; use Project_Processor.Processors; with Ada.Text_IO; use Ada.Text_IO; with EU_Projects.Times.Time_Expressions.Solving; with Ada.Exceptions; use Ada; pragma Warnings (Off); with Project_Processor.Parsers.Simple_Format; with Project_Processor.Processors.Dumping; with Project_Processor.Processors.LaTeX; pragma Warnings (On); procedure Project_Processor.Main is Project : Project_Descriptor; Current_Processor : Processors.Processor_ID; procedure Do_Call (Call : Configuration.Processing_Call) is Unknown_Processor : exception; begin if not Processor_Tables.Exists (Call.Name) then raise Unknown_Processor with Project_Processor.Processors.Image (Call.Name); end if; Current_Processor := Call.Name; declare Proc : Abstract_Processor'Class := Processor_Tables.Get (ID => Call.Name, Params => Call.Parameters, Search_If_Missing => False); begin Proc.Process (Project); end; exception when Unknown_Processor => Put_Line (File => Standard_Error, Item => "WARNING: Processor '" & To_String (Call.Name) & "' unknown. Skipped"); end Do_Call; begin Configuration.Initialize; declare Parser : Abstract_Parsers.Abstract_Parser'Class := Parsers.Parser_Tables.Get (ID => Configuration.Input_Format, Params => Configuration.Parser_Parameters, Search_If_Missing => False); begin Parser.Parse (Project => Project, Input => Configuration.Input_Data); Project.Freeze; Configuration.For_All_Calls (Callback => Do_Call'Access); end; exception when EU_Projects.Times.Time_Expressions.Solving.Unsolvable => Put_Line (Standard_Error, "Could not solve"); when E : Configuration.Bad_Command_Line => Put_Line (Standard_Error, "Bad Command Line: " & Exceptions.Exception_Message (E)); when E : EU_Projects.Bad_Input | Parsing_Error => Put_Line (Standard_Error, "Bad Project Specs : " & Exceptions.Exception_Message (E)); when E : Project_Processor.Processors.Processor_Error => Put_Line (Standard_Error, "Error in " & Processors.Image (Current_Processor) & " processor : " & Exceptions.Exception_Message (E)); end Project_Processor.Main;
-- { dg-do compile } package Static_Initializer4 is type R is tagged record b : Boolean; end record; type NR is new R with null record; C : NR := (b => True); end Static_Initializer4;
separate (SPARKNaCl) procedure Sanitize_U16 (R : out U16) is begin R := 0; pragma Inspection_Point (R); -- See RM H3.2 (9) -- Add target-dependent code here to -- 1. flush and invalidate data cache, -- 2. wait until writes have committed (e.g. a memory-fence instruction) -- 3. whatever else is required. end Sanitize_U16;
-- This package has been generated automatically by GNATtest. -- You are allowed to add your code to the bodies of test routines. -- Such changes will be kept during further regeneration of this file. -- All code placed outside of test routine bodies will be lost. The -- code intended to set up and tear down the test environment should be -- placed into Tk.Image.Photo.Test_Data. with AUnit.Assertions; use AUnit.Assertions; with System.Assertions; -- begin read only -- id:2.2/00/ -- -- This section can be used to add with clauses if necessary. -- -- end read only with Ada.Directories; with Ada.Environment_Variables; use Ada.Environment_Variables; with GNAT.Directory_Operations; use GNAT.Directory_Operations; -- begin read only -- end read only package body Tk.Image.Photo.Test_Data.Tests is -- begin read only -- id:2.2/01/ -- -- This section can be used to add global variables and other elements. -- -- end read only -- begin read only -- end read only -- begin read only procedure Wrap_Test_Blank_2c1442_30601f (Photo_Image: Tk_Image; Interpreter: Tcl_Interpreter := Get_Interpreter) is begin begin pragma Assert (Photo_Image'Length > 0 and Interpreter /= Null_Interpreter); null; exception when System.Assertions.Assert_Failure => AUnit.Assertions.Assert (False, "req_sloc(tk-image-photo.ads:0):Tests_Blank_Photo test requirement violated"); end; GNATtest_Generated.GNATtest_Standard.Tk.Image.Photo.Blank (Photo_Image, Interpreter); begin pragma Assert(True); null; exception when System.Assertions.Assert_Failure => AUnit.Assertions.Assert (False, "ens_sloc(tk-image-photo.ads:0:):Tests_Blank_Photo test commitment violated"); end; end Wrap_Test_Blank_2c1442_30601f; -- end read only -- begin read only procedure Test_Blank_tests_blank_photo(Gnattest_T: in out Test); procedure Test_Blank_2c1442_30601f(Gnattest_T: in out Test) renames Test_Blank_tests_blank_photo; -- id:2.2/2c1442a8bb75046e/Blank/1/0/tests_blank_photo/ procedure Test_Blank_tests_blank_photo(Gnattest_T: in out Test) is procedure Blank (Photo_Image: Tk_Image; Interpreter: Tcl_Interpreter := Get_Interpreter) renames Wrap_Test_Blank_2c1442_30601f; -- end read only pragma Unreferenced(Gnattest_T); begin if Value("DISPLAY", "")'Length = 0 then Assert(True, "No display, can't test"); return; end if; Blank("myphoto"); Assert(True, "This test can only crash."); -- begin read only end Test_Blank_tests_blank_photo; -- end read only -- begin read only function Wrap_Test_Get_Option_e3d52c_8f9fe9 (Photo_Image: Tk_Image; Name: String; Interpreter: Tcl_Interpreter := Get_Interpreter) return String is begin begin pragma Assert (Photo_Image'Length > 0 and Name'Length > 0 and Interpreter /= Null_Interpreter); null; exception when System.Assertions.Assert_Failure => AUnit.Assertions.Assert (False, "req_sloc(tk-image-photo.ads:0):Tests_Get_Option_Photo test requirement violated"); end; declare Test_Get_Option_e3d52c_8f9fe9_Result: constant String := GNATtest_Generated.GNATtest_Standard.Tk.Image.Photo.Get_Option (Photo_Image, Name, Interpreter); begin begin pragma Assert(True); null; exception when System.Assertions.Assert_Failure => AUnit.Assertions.Assert (False, "ens_sloc(tk-image-photo.ads:0:):Tests_Get_Option_Photo test commitment violated"); end; return Test_Get_Option_e3d52c_8f9fe9_Result; end; end Wrap_Test_Get_Option_e3d52c_8f9fe9; -- end read only -- begin read only procedure Test_Get_Option_tests_get_option_photo(Gnattest_T: in out Test); procedure Test_Get_Option_e3d52c_8f9fe9(Gnattest_T: in out Test) renames Test_Get_Option_tests_get_option_photo; -- id:2.2/e3d52c2e49e4f170/Get_Option/1/0/tests_get_option_photo/ procedure Test_Get_Option_tests_get_option_photo(Gnattest_T: in out Test) is function Get_Option (Photo_Image: Tk_Image; Name: String; Interpreter: Tcl_Interpreter := Get_Interpreter) return String renames Wrap_Test_Get_Option_e3d52c_8f9fe9; -- end read only pragma Unreferenced(Gnattest_T); begin if Value("DISPLAY", "")'Length = 0 then Assert(True, "No display, can't test"); return; end if; Assert (Get_Option("myphoto", "format") = "png", "Failed to get option of the selected image"); -- begin read only end Test_Get_Option_tests_get_option_photo; -- end read only -- begin read only procedure Wrap_Test_Copy_0a35cf_21de2d (Destination_Image, Source_Image: Tk_Image; From, To: Dimensions_Type := Empty_Dimension; Shrink: Boolean := False; Zoom, Sub_Sample: Point_Position := Empty_Point_Position; Compositing_Rule: Compositing_Types := NONE; Interpreter: Tcl_Interpreter := Get_Interpreter) is begin begin pragma Assert (Destination_Image'Length > 0 and Source_Image'Length > 0 and Interpreter /= Null_Interpreter); null; exception when System.Assertions.Assert_Failure => AUnit.Assertions.Assert (False, "req_sloc(tk-image-photo.ads:0):Tests_Copy_Photo test requirement violated"); end; GNATtest_Generated.GNATtest_Standard.Tk.Image.Photo.Copy (Destination_Image, Source_Image, From, To, Shrink, Zoom, Sub_Sample, Compositing_Rule, Interpreter); begin pragma Assert(True); null; exception when System.Assertions.Assert_Failure => AUnit.Assertions.Assert (False, "ens_sloc(tk-image-photo.ads:0:):Tests_Copy_Photo test commitment violated"); end; end Wrap_Test_Copy_0a35cf_21de2d; -- end read only -- begin read only procedure Test_Copy_tests_copy_photo(Gnattest_T: in out Test); procedure Test_Copy_0a35cf_21de2d(Gnattest_T: in out Test) renames Test_Copy_tests_copy_photo; -- id:2.2/0a35cf23b6e9723d/Copy/1/0/tests_copy_photo/ procedure Test_Copy_tests_copy_photo(Gnattest_T: in out Test) is procedure Copy (Destination_Image, Source_Image: Tk_Image; From, To: Dimensions_Type := Empty_Dimension; Shrink: Boolean := False; Zoom, Sub_Sample: Point_Position := Empty_Point_Position; Compositing_Rule: Compositing_Types := NONE; Interpreter: Tcl_Interpreter := Get_Interpreter) renames Wrap_Test_Copy_0a35cf_21de2d; -- end read only pragma Unreferenced(Gnattest_T); begin if Value("DISPLAY", "")'Length = 0 then Assert(True, "No display, can't test"); return; end if; Create("myphoto2", Default_Photo_Options); Copy("myphoto2", "myphoto"); Assert(True, "This test can only crash."); Delete("myphoto2"); -- begin read only end Test_Copy_tests_copy_photo; -- end read only -- begin read only function Wrap_Test_Get_Data_433b25_8ba84f (Photo_Image: Tk_Image; Background, Format: Tcl_String := Null_Tcl_String; From: Dimensions_Type := Empty_Dimension; Grayscale: Boolean := False; Interpreter: Tcl_Interpreter := Get_Interpreter) return Tcl_String is begin begin pragma Assert (Photo_Image'Length > 0 and Interpreter /= Null_Interpreter); null; exception when System.Assertions.Assert_Failure => AUnit.Assertions.Assert (False, "req_sloc(tk-image-photo.ads:0):Tests_Get_Data_Photo test requirement violated"); end; declare Test_Get_Data_433b25_8ba84f_Result: constant Tcl_String := GNATtest_Generated.GNATtest_Standard.Tk.Image.Photo.Get_Data (Photo_Image, Background, Format, From, Grayscale, Interpreter); begin begin pragma Assert(True); null; exception when System.Assertions.Assert_Failure => AUnit.Assertions.Assert (False, "ens_sloc(tk-image-photo.ads:0:):Tests_Get_Data_Photo test commitment violated"); end; return Test_Get_Data_433b25_8ba84f_Result; end; end Wrap_Test_Get_Data_433b25_8ba84f; -- end read only -- begin read only procedure Test_Get_Data_tests_get_data_photo(Gnattest_T: in out Test); procedure Test_Get_Data_433b25_8ba84f(Gnattest_T: in out Test) renames Test_Get_Data_tests_get_data_photo; -- id:2.2/433b2501eca6e1fa/Get_Data/1/0/tests_get_data_photo/ procedure Test_Get_Data_tests_get_data_photo(Gnattest_T: in out Test) is function Get_Data (Photo_Image: Tk_Image; Background, Format: Tcl_String := Null_Tcl_String; From: Dimensions_Type := Empty_Dimension; Grayscale: Boolean := False; Interpreter: Tcl_Interpreter := Get_Interpreter) return Tcl_String renames Wrap_Test_Get_Data_433b25_8ba84f; -- end read only pragma Unreferenced(Gnattest_T); begin if Value("DISPLAY", "")'Length = 0 then Assert(True, "No display, can't test"); return; end if; Assert (Get_Data("myphoto") /= Null_Tcl_String, "Failed to get data from photo image."); -- begin read only end Test_Get_Data_tests_get_data_photo; -- end read only -- begin read only function Wrap_Test_Get_Color_6fd571_5f6b3a (Photo_Image: Tk_Image; X, Y: Natural; Interpreter: Tcl_Interpreter := Get_Interpreter) return Color_Type is begin begin pragma Assert (Photo_Image'Length > 0 and Interpreter /= Null_Interpreter); null; exception when System.Assertions.Assert_Failure => AUnit.Assertions.Assert (False, "req_sloc(tk-image-photo.ads:0):Tests_Get_Color_Photo test requirement violated"); end; declare Test_Get_Color_6fd571_5f6b3a_Result: constant Color_Type := GNATtest_Generated.GNATtest_Standard.Tk.Image.Photo.Get_Color (Photo_Image, X, Y, Interpreter); begin begin pragma Assert(True); null; exception when System.Assertions.Assert_Failure => AUnit.Assertions.Assert (False, "ens_sloc(tk-image-photo.ads:0:):Tests_Get_Color_Photo test commitment violated"); end; return Test_Get_Color_6fd571_5f6b3a_Result; end; end Wrap_Test_Get_Color_6fd571_5f6b3a; -- end read only -- begin read only procedure Test_Get_Color_tests_get_color_photo(Gnattest_T: in out Test); procedure Test_Get_Color_6fd571_5f6b3a(Gnattest_T: in out Test) renames Test_Get_Color_tests_get_color_photo; -- id:2.2/6fd5718a9ddd1eec/Get_Color/1/0/tests_get_color_photo/ procedure Test_Get_Color_tests_get_color_photo(Gnattest_T: in out Test) is function Get_Color (Photo_Image: Tk_Image; X, Y: Natural; Interpreter: Tcl_Interpreter := Get_Interpreter) return Color_Type renames Wrap_Test_Get_Color_6fd571_5f6b3a; -- end read only pragma Unreferenced(Gnattest_T); begin if Value("DISPLAY", "")'Length = 0 then Assert(True, "No display, can't test"); return; end if; Assert (Get_Color("myphoto", 1, 1) = (0, 0, 0), "Failed to get color for photo image pixel."); -- begin read only end Test_Get_Color_tests_get_color_photo; -- end read only -- begin read only procedure Wrap_Test_Put_Data_cd9739_ee5695 (Photo_Image: Tk_Image; Data: Tcl_String; Format: Tcl_String := Null_Tcl_String; To: Dimensions_Type := Empty_Dimension; Interpreter: Tcl_Interpreter := Get_Interpreter) is begin begin pragma Assert (Photo_Image'Length > 0 and Length(Source => Data) > 0 and Interpreter /= Null_Interpreter); null; exception when System.Assertions.Assert_Failure => AUnit.Assertions.Assert (False, "req_sloc(tk-image-photo.ads:0):Tests_Put_Data_Photo test requirement violated"); end; GNATtest_Generated.GNATtest_Standard.Tk.Image.Photo.Put_Data (Photo_Image, Data, Format, To, Interpreter); begin pragma Assert(True); null; exception when System.Assertions.Assert_Failure => AUnit.Assertions.Assert (False, "ens_sloc(tk-image-photo.ads:0:):Tests_Put_Data_Photo test commitment violated"); end; end Wrap_Test_Put_Data_cd9739_ee5695; -- end read only -- begin read only procedure Test_Put_Data_tests_put_data_photo(Gnattest_T: in out Test); procedure Test_Put_Data_cd9739_ee5695(Gnattest_T: in out Test) renames Test_Put_Data_tests_put_data_photo; -- id:2.2/cd9739d25bdd8fd7/Put_Data/1/0/tests_put_data_photo/ procedure Test_Put_Data_tests_put_data_photo(Gnattest_T: in out Test) is procedure Put_Data (Photo_Image: Tk_Image; Data: Tcl_String; Format: Tcl_String := Null_Tcl_String; To: Dimensions_Type := Empty_Dimension; Interpreter: Tcl_Interpreter := Get_Interpreter) renames Wrap_Test_Put_Data_cd9739_ee5695; -- end read only pragma Unreferenced(Gnattest_T); begin if Value("DISPLAY", "")'Length = 0 then Assert(True, "No display, can't test"); return; end if; Put_Data (Photo_Image => "myphoto", Data => To_Tcl_String("red"), To => (1, 1, 2, 2)); Assert (Get_Color("myphoto", 1, 1) = (255, 0, 0), "Failed to set color for selected pixels in photo image."); -- begin read only end Test_Put_Data_tests_put_data_photo; -- end read only -- begin read only procedure Wrap_Test_Read_95a1fe_24b510 (Photo_Image: Tk_Image; File_Name: Tcl_String; Format: Tcl_String := Null_Tcl_String; From: Dimensions_Type := Empty_Dimension; Shrink: Boolean := False; To: Point_Position := Empty_Point_Position; Interpreter: Tcl_Interpreter := Get_Interpreter) is begin begin pragma Assert (Photo_Image'Length > 0 and Length(Source => File_Name) > 0 and Interpreter /= Null_Interpreter); null; exception when System.Assertions.Assert_Failure => AUnit.Assertions.Assert (False, "req_sloc(tk-image-photo.ads:0):Tests_Read_Photo test requirement violated"); end; GNATtest_Generated.GNATtest_Standard.Tk.Image.Photo.Read (Photo_Image, File_Name, Format, From, Shrink, To, Interpreter); begin pragma Assert(True); null; exception when System.Assertions.Assert_Failure => AUnit.Assertions.Assert (False, "ens_sloc(tk-image-photo.ads:0:):Tests_Read_Photo test commitment violated"); end; end Wrap_Test_Read_95a1fe_24b510; -- end read only -- begin read only procedure Test_Read_tests_read_photo(Gnattest_T: in out Test); procedure Test_Read_95a1fe_24b510(Gnattest_T: in out Test) renames Test_Read_tests_read_photo; -- id:2.2/95a1fec265c675e5/Read/1/0/tests_read_photo/ procedure Test_Read_tests_read_photo(Gnattest_T: in out Test) is procedure Read (Photo_Image: Tk_Image; File_Name: Tcl_String; Format: Tcl_String := Null_Tcl_String; From: Dimensions_Type := Empty_Dimension; Shrink: Boolean := False; To: Point_Position := Empty_Point_Position; Interpreter: Tcl_Interpreter := Get_Interpreter) renames Wrap_Test_Read_95a1fe_24b510; -- end read only pragma Unreferenced(Gnattest_T); begin if Value("DISPLAY", "")'Length = 0 then Assert(True, "No display, can't test"); return; end if; Read("myphoto", To_Tcl_String(".." & Dir_Separator & "test.png")); Assert(True, "This test can only crash"); -- begin read only end Test_Read_tests_read_photo; -- end read only -- begin read only procedure Wrap_Test_Redither_68a59f_4f3041 (Photo_Image: Tk_Image; Interpreter: Tcl_Interpreter := Get_Interpreter) is begin begin pragma Assert (Photo_Image'Length > 0 and Interpreter /= Null_Interpreter); null; exception when System.Assertions.Assert_Failure => AUnit.Assertions.Assert (False, "req_sloc(tk-image-photo.ads:0):Tests_Redither_Photo test requirement violated"); end; GNATtest_Generated.GNATtest_Standard.Tk.Image.Photo.Redither (Photo_Image, Interpreter); begin pragma Assert(True); null; exception when System.Assertions.Assert_Failure => AUnit.Assertions.Assert (False, "ens_sloc(tk-image-photo.ads:0:):Tests_Redither_Photo test commitment violated"); end; end Wrap_Test_Redither_68a59f_4f3041; -- end read only -- begin read only procedure Test_Redither_tests_redither_photo(Gnattest_T: in out Test); procedure Test_Redither_68a59f_4f3041(Gnattest_T: in out Test) renames Test_Redither_tests_redither_photo; -- id:2.2/68a59f049d29ab44/Redither/1/0/tests_redither_photo/ procedure Test_Redither_tests_redither_photo(Gnattest_T: in out Test) is procedure Redither (Photo_Image: Tk_Image; Interpreter: Tcl_Interpreter := Get_Interpreter) renames Wrap_Test_Redither_68a59f_4f3041; -- end read only pragma Unreferenced(Gnattest_T); begin if Value("DISPLAY", "")'Length = 0 then Assert(True, "No display, can't test"); return; end if; Redither("myphoto"); Assert(True, "This test can only crash"); -- begin read only end Test_Redither_tests_redither_photo; -- end read only -- begin read only function Wrap_Test_Get_Transparency_6cdf5e_ffe137 (Photo_Image: Tk_Image; X, Y: Natural; Interpreter: Tcl_Interpreter := Get_Interpreter) return Tcl_Boolean_Result is begin begin pragma Assert (Photo_Image'Length > 0 and Interpreter /= Null_Interpreter); null; exception when System.Assertions.Assert_Failure => AUnit.Assertions.Assert (False, "req_sloc(tk-image-photo.ads:0):Tests_Get_Transparency_Photo test requirement violated"); end; declare Test_Get_Transparency_6cdf5e_ffe137_Result: constant Tcl_Boolean_Result := GNATtest_Generated.GNATtest_Standard.Tk.Image.Photo.Get_Transparency (Photo_Image, X, Y, Interpreter); begin begin pragma Assert(True); null; exception when System.Assertions.Assert_Failure => AUnit.Assertions.Assert (False, "ens_sloc(tk-image-photo.ads:0:):Tests_Get_Transparency_Photo test commitment violated"); end; return Test_Get_Transparency_6cdf5e_ffe137_Result; end; end Wrap_Test_Get_Transparency_6cdf5e_ffe137; -- end read only -- begin read only procedure Test_Get_Transparency_tests_get_transparency_photo (Gnattest_T: in out Test); procedure Test_Get_Transparency_6cdf5e_ffe137 (Gnattest_T: in out Test) renames Test_Get_Transparency_tests_get_transparency_photo; -- id:2.2/6cdf5e730aae7ad4/Get_Transparency/1/0/tests_get_transparency_photo/ procedure Test_Get_Transparency_tests_get_transparency_photo (Gnattest_T: in out Test) is function Get_Transparency (Photo_Image: Tk_Image; X, Y: Natural; Interpreter: Tcl_Interpreter := Get_Interpreter) return Tcl_Boolean_Result renames Wrap_Test_Get_Transparency_6cdf5e_ffe137; -- end read only pragma Unreferenced(Gnattest_T); begin if Value("DISPLAY", "")'Length = 0 then Assert(True, "No display, can't test"); return; end if; Assert (Get_Transparency("myphoto", 0, 0).Result, "Failed to get transparency for pixel in photo image."); -- begin read only end Test_Get_Transparency_tests_get_transparency_photo; -- end read only -- begin read only procedure Wrap_Test_Set_Transparency_76d5d1_e76ade (Photo_Image: Tk_Image; X, Y: Natural; Transparent: Boolean; Interpreter: Tcl_Interpreter := Get_Interpreter) is begin begin pragma Assert (Photo_Image'Length > 0 and Interpreter /= Null_Interpreter); null; exception when System.Assertions.Assert_Failure => AUnit.Assertions.Assert (False, "req_sloc(tk-image-photo.ads:0):Tests_Set_Transparency_Photo test requirement violated"); end; GNATtest_Generated.GNATtest_Standard.Tk.Image.Photo.Set_Transparency (Photo_Image, X, Y, Transparent, Interpreter); begin pragma Assert(True); null; exception when System.Assertions.Assert_Failure => AUnit.Assertions.Assert (False, "ens_sloc(tk-image-photo.ads:0:):Tests_Set_Transparency_Photo test commitment violated"); end; end Wrap_Test_Set_Transparency_76d5d1_e76ade; -- end read only -- begin read only procedure Test_Set_Transparency_tests_set_transparency_photo (Gnattest_T: in out Test); procedure Test_Set_Transparency_76d5d1_e76ade (Gnattest_T: in out Test) renames Test_Set_Transparency_tests_set_transparency_photo; -- id:2.2/76d5d19d86527133/Set_Transparency/1/0/tests_set_transparency_photo/ procedure Test_Set_Transparency_tests_set_transparency_photo (Gnattest_T: in out Test) is procedure Set_Transparency (Photo_Image: Tk_Image; X, Y: Natural; Transparent: Boolean; Interpreter: Tcl_Interpreter := Get_Interpreter) renames Wrap_Test_Set_Transparency_76d5d1_e76ade; -- end read only pragma Unreferenced(Gnattest_T); begin if Value("DISPLAY", "")'Length = 0 then Assert(True, "No display, can't test"); return; end if; Set_Transparency("myphoto", 0, 0, False); Assert (not Get_Transparency("myphoto", 0, 0).Result, "Failed to set transparency for pixel in photo image."); -- begin read only end Test_Set_Transparency_tests_set_transparency_photo; -- end read only -- begin read only procedure Wrap_Test_Write_a9d740_96f97b (Photo_Image: Tk_Image; File_Name: Tcl_String; Background, Format: Tcl_String := Null_Tcl_String; From: Dimensions_Type := Empty_Dimension; Grayscale: Boolean := False; Interpreter: Tcl_Interpreter := Get_Interpreter) is begin begin pragma Assert (Photo_Image'Length > 0 and Length(Source => File_Name) > 0 and Interpreter /= Null_Interpreter); null; exception when System.Assertions.Assert_Failure => AUnit.Assertions.Assert (False, "req_sloc(tk-image-photo.ads:0):Tests_Write_Photo test requirement violated"); end; GNATtest_Generated.GNATtest_Standard.Tk.Image.Photo.Write (Photo_Image, File_Name, Background, Format, From, Grayscale, Interpreter); begin pragma Assert(True); null; exception when System.Assertions.Assert_Failure => AUnit.Assertions.Assert (False, "ens_sloc(tk-image-photo.ads:0:):Tests_Write_Photo test commitment violated"); end; end Wrap_Test_Write_a9d740_96f97b; -- end read only -- begin read only procedure Test_Write_tests_write_photo(Gnattest_T: in out Test); procedure Test_Write_a9d740_96f97b(Gnattest_T: in out Test) renames Test_Write_tests_write_photo; -- id:2.2/a9d74045db4a2ae3/Write/1/0/tests_write_photo/ procedure Test_Write_tests_write_photo(Gnattest_T: in out Test) is procedure Write (Photo_Image: Tk_Image; File_Name: Tcl_String; Background, Format: Tcl_String := Null_Tcl_String; From: Dimensions_Type := Empty_Dimension; Grayscale: Boolean := False; Interpreter: Tcl_Interpreter := Get_Interpreter) renames Wrap_Test_Write_a9d740_96f97b; -- end read only pragma Unreferenced(Gnattest_T); begin if Value("DISPLAY", "")'Length = 0 then Assert(True, "No display, can't test"); return; end if; Write("myphoto", To_Tcl_String(".." & Dir_Separator & "myphoto.png")); Assert (Ada.Directories.Exists(".." & Dir_Separator & "myphoto.png"), "Failed to write the selected photo image to file."); Ada.Directories.Delete_File(".." & Dir_Separator & "myphoto.png"); -- begin read only end Test_Write_tests_write_photo; -- end read only -- begin read only -- id:2.2/02/ -- -- This section can be used to add elaboration code for the global state. -- begin -- end read only null; -- begin read only -- end read only end Tk.Image.Photo.Test_Data.Tests;
with Ada.Long_Integer_Text_IO; -- Copyright 2021 Melwyn Francis Carlo procedure A015 is use Ada.Long_Integer_Text_IO; Input_Grid_Dimension : constant Integer := 20; Routes_N : Long_Float := 1.0; begin for I in 1 .. Input_Grid_Dimension loop Routes_N := Routes_N * (Long_Float (I + Input_Grid_Dimension) / Long_Float (I)); end loop; Put (Long_Integer (Long_Float'Ceiling (Routes_N)), Width => 0); end A015;
------------------------------------------------------------------------------- -- This file is part of libsparkcrypto. -- -- Copyright (C) 2012, Stefan Berghofer -- Copyright (C) 2012, secunet Security Networks AG -- 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 author nor the names of its contributors may be -- used to endorse or promote products derived from this software without -- specific prior written permission. -- -- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" -- AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -- IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE -- ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS -- BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR -- CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF -- SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS -- INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN -- CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) -- ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -- POSSIBILITY OF SUCH DAMAGE. ------------------------------------------------------------------------------- package body LSC.Internal.EC_Signature is pragma Warnings (Off, """V"" may be referenced before it has a value"); procedure Extract (X : in Bignum.Big_Int; X_First : in Natural; X_Last : in Natural; Z : in Bignum.Big_Int; Z_First : in Natural; V : out Bignum.Big_Int; V_First : in Natural; M : in Bignum.Big_Int; M_First : in Natural; M_Inv : in Types.Word32; RM : in Bignum.Big_Int; RM_First : in Natural; N : in Bignum.Big_Int; N_First : in Natural; N_Inv : in Types.Word32; RN : in Bignum.Big_Int; RN_First : in Natural) with Depends => (V =>+ (V_First, X, X_First, X_Last, Z, Z_First, M, M_First, M_Inv, RM, RM_First, N, N_First, N_Inv, RN, RN_First)), Pre => X_First in X'Range and then X_Last in X'Range and then X_First < X_Last and then X_Last - X_First < EC.Max_Coord_Length and then Z_First in Z'Range and then Z_First + (X_Last - X_First) in Z'Range and then V_First in V'Range and then V_First + (X_Last - X_First) in V'Range and then M_First in M'Range and then M_First + (X_Last - X_First) in M'Range and then RM_First in RM'Range and then RM_First + (X_Last - X_First) in RM'Range and then N_First in N'Range and then N_First + (X_Last - X_First) in N'Range and then RN_First in RN'Range and then RN_First + (X_Last - X_First) in RN'Range and then Bignum.Num_Of_Big_Int (X, X_First, X_Last - X_First + 1) < Bignum.Num_Of_Big_Int (M, M_First, X_Last - X_First + 1) and then Bignum.Num_Of_Big_Int (Z, Z_First, X_Last - X_First + 1) < Bignum.Num_Of_Big_Int (M, M_First, X_Last - X_First + 1) and then Math_Int.From_Word32 (1) < Bignum.Num_Of_Big_Int (M, M_First, X_Last - X_First + 1) and then 1 + M_Inv * M (M_First) = 0 and then Math_Int.From_Word32 (1) < Bignum.Num_Of_Big_Int (N, N_First, X_Last - X_First + 1) and then 1 + N_Inv * N (N_First) = 0 and then Bignum.Num_Of_Big_Int (RM, RM_First, X_Last - X_First + 1) = Bignum.Base ** (Math_Int.From_Integer (2) * Math_Int.From_Integer (X_Last - X_First + 1)) mod Bignum.Num_Of_Big_Int (M, M_First, X_Last - X_First + 1) and then Bignum.Num_Of_Big_Int (RN, RN_First, X_Last - X_First + 1) = Bignum.Base ** (Math_Int.From_Integer (2) * Math_Int.From_Integer (X_Last - X_First + 1)) mod Bignum.Num_Of_Big_Int (N, N_First, X_Last - X_First + 1), Post => Bignum.Num_Of_Big_Int (V, V_First, X_Last - X_First + 1) < Bignum.Num_Of_Big_Int (N, N_First, X_Last - X_First + 1); procedure Extract (X : in Bignum.Big_Int; X_First : in Natural; X_Last : in Natural; Z : in Bignum.Big_Int; Z_First : in Natural; V : out Bignum.Big_Int; V_First : in Natural; M : in Bignum.Big_Int; M_First : in Natural; M_Inv : in Types.Word32; RM : in Bignum.Big_Int; RM_First : in Natural; N : in Bignum.Big_Int; N_First : in Natural; N_Inv : in Types.Word32; RN : in Bignum.Big_Int; RN_First : in Natural) is L : Natural; H : EC.Coord; begin L := X_Last - X_First; EC.Invert (Z, Z_First, Z_First + L, H, H'First, RM, RM_First, M, M_First, M_Inv); Bignum.Mont_Mult (V, V_First, V_First + L, X, X_First, H, H'First, M, M_First, M_Inv); Bignum.Mont_Mult (H, H'First, H'First + L, V, V_First, EC.One, EC.One'First, N, N_First, N_Inv); Bignum.Mont_Mult (V, V_First, V_First + L, H, H'First, RN, RN_First, N, N_First, N_Inv); end Extract; pragma Warnings (On, """V"" may be referenced before it has a value"); ---------------------------------------------------------------------------- procedure Sign (Sign1 : out Bignum.Big_Int; Sign1_First : in Natural; Sign1_Last : in Natural; Sign2 : out Bignum.Big_Int; Sign2_First : in Natural; Hash : in Bignum.Big_Int; Hash_First : in Natural; Rand : in Bignum.Big_Int; Rand_First : in Natural; T : in Signature_Type; Priv : in Bignum.Big_Int; Priv_First : in Natural; BX : in Bignum.Big_Int; BX_First : in Natural; BY : in Bignum.Big_Int; BY_First : in Natural; A : in Bignum.Big_Int; A_First : in Natural; M : in Bignum.Big_Int; M_First : in Natural; M_Inv : in Types.Word32; RM : in Bignum.Big_Int; RM_First : in Natural; N : in Bignum.Big_Int; N_First : in Natural; N_Inv : in Types.Word32; RN : in Bignum.Big_Int; RN_First : in Natural; Success : out Boolean) is L : Natural; X, Y, Z, PrivR, H1, H2, H3 : EC.Coord; begin L := Sign1_Last - Sign1_First; Bignum.Mont_Mult (H1, H1'First, H1'First + L, Hash, Hash_First, EC.One, EC.One'First, N, N_First, N_Inv); Bignum.Mont_Mult (H3, H3'First, H3'First + L, H1, H1'First, RN, RN_First, N, N_First, N_Inv); pragma Warnings (Off, "unused assignment to ""Y"""); EC.Point_Mult (X1 => BX, X1_First => BX_First, X1_Last => BX_First + L, Y1 => BY, Y1_First => BY_First, Z1 => EC.One, Z1_First => EC.One'First, E => Rand, E_First => Rand_First, E_Last => Rand_First + L, X2 => X, X2_First => X'First, Y2 => Y, Y2_First => Y'First, Z2 => Z, Z2_First => Z'First, A => A, A_First => A_First, M => M, M_First => M_First, M_Inv => M_Inv); pragma Warnings (On, "unused assignment to ""Y"""); Extract (X, X'First, X'First + L, Z, Z'First, Sign1, Sign1_First, M, M_First, M_Inv, RM, RM_First, N, N_First, N_Inv, RN, RN_First); Bignum.Mont_Mult (PrivR, PrivR'First, PrivR'First + L, Priv, Priv_First, RN, RN_First, N, N_First, N_Inv); case T is when ECDSA => Bignum.Mont_Mult (H1, H1'First, H1'First + L, PrivR, PrivR'First, Sign1, Sign1_First, N, N_First, N_Inv); Bignum.Mod_Add_Inplace (H1, H1'First, H1'First + L, H3, H3'First, N, N_First); EC.Invert (Rand, Rand_First, Rand_First + L, H2, H2'First, RN, RN_First, N, N_First, N_Inv); Bignum.Mont_Mult (Sign2, Sign2_First, Sign2_First + L, H1, H1'First, H2, H2'First, N, N_First, N_Inv); when ECGDSA => Bignum.Mont_Mult (H1, H1'First, H1'First + L, Rand, Rand_First, RN, RN_First, N, N_First, N_Inv); Bignum.Mont_Mult (H2, H2'First, H2'First + L, H1, H1'First, Sign1, Sign1_First, N, N_First, N_Inv); Bignum.Mod_Sub_Inplace (H2, H2'First, H2'First + L, H3, H3'First, N, N_First); Bignum.Mont_Mult (Sign2, Sign2_First, Sign2_First + L, H2, H2'First, PrivR, PrivR'First, N, N_First, N_Inv); end case; Success := not Bignum.Is_Zero (Sign1, Sign1_First, Sign1_Last) and then not Bignum.Is_Zero (Sign2, Sign2_First, Sign2_First + L); end Sign; ---------------------------------------------------------------------------- function Verify (Sign1 : Bignum.Big_Int; Sign1_First : Natural; Sign1_Last : Natural; Sign2 : Bignum.Big_Int; Sign2_First : Natural; Hash : Bignum.Big_Int; Hash_First : Natural; T : Signature_Type; PubX : Bignum.Big_Int; PubX_First : Natural; PubY : Bignum.Big_Int; PubY_First : Natural; BX : Bignum.Big_Int; BX_First : Natural; BY : Bignum.Big_Int; BY_First : Natural; A : Bignum.Big_Int; A_First : Natural; M : Bignum.Big_Int; M_First : Natural; M_Inv : Types.Word32; RM : Bignum.Big_Int; RM_First : Natural; N : Bignum.Big_Int; N_First : Natural; N_Inv : Types.Word32; RN : Bignum.Big_Int; RN_First : Natural) return Boolean is L : Natural; Result : Boolean; H1, H2, H, X, Y, Z, V : EC.Coord; begin L := Sign1_Last - Sign1_First; if not Bignum.Is_Zero (Sign1, Sign1_First, Sign1_Last) and then Bignum.Less (Sign1, Sign1_First, Sign1_Last, N, N_First) and then not Bignum.Is_Zero (Sign2, Sign2_First, Sign2_First + L) and then Bignum.Less (Sign2, Sign2_First, Sign2_First + L, N, N_First) then case T is when ECDSA => EC.Invert (Sign2, Sign2_First, Sign2_First + L, H, H'First, RN, RN_First, N, N_First, N_Inv); Bignum.Mont_Mult (H2, H2'First, H2'First + L, Sign1, Sign1_First, H, H'First, N, N_First, N_Inv); when ECGDSA => EC.Invert (Sign1, Sign1_First, Sign1_Last, H, H'First, RN, RN_First, N, N_First, N_Inv); Bignum.Mont_Mult (H2, H2'First, H2'First + L, Sign2, Sign2_First, H, H'First, N, N_First, N_Inv); end case; Bignum.Mont_Mult (H1, H1'First, H1'First + L, Hash, Hash_First, H, H'First, N, N_First, N_Inv); pragma Warnings (Off, "unused assignment to ""Y"""); EC.Two_Point_Mult (X1 => BX, X1_First => BX_First, X1_Last => BX_First + L, Y1 => BY, Y1_First => BY_First, Z1 => EC.One, Z1_First => EC.One'First, E1 => H1, E1_First => H1'First, E1_Last => H1'First + L, X2 => PubX, X2_First => PubX_First, Y2 => PubY, Y2_First => PubY_First, Z2 => EC.One, Z2_First => EC.One'First, E2 => H2, E2_First => H2'First, X3 => X, X3_First => X'First, Y3 => Y, Y3_First => Y'First, Z3 => Z, Z3_First => Z'First, A => A, A_First => A_First, M => M, M_First => M_First, M_Inv => M_Inv); pragma Warnings (On, "unused assignment to ""Y"""); Extract (X, X'First, X'First + L, Z, Z'First, V, V'First, M, M_First, M_Inv, RM, RM_First, N, N_First, N_Inv, RN, RN_First); Result := Bignum.Equal (Sign1, Sign1_First, Sign1_Last, V, V'First); else Result := False; end if; return Result; end Verify; end LSC.Internal.EC_Signature;
pragma License (Unrestricted); with Ada.Formatting; with Ada.IO_Exceptions; with Ada.IO_Modes; with Ada.Unchecked_Deallocation; private with Ada.Finalization; private with Ada.Naked_Text_IO; private with Ada.Unchecked_Reallocation; private with System.Growth; package Ada.Text_IO is type File_Type is limited private; type File_Access is access constant File_Type; -- moved from below for File_Access'Storage_Size use 0; -- modified -- AI12-0054-2, Text_IO (see A.10.1) could have used predicates to describe -- some common exceptional conditions as follows: -- subtype Open_File_Type is File_Type -- with -- Dynamic_Predicate => Is_Open (Open_File_Type), -- Predicate_Failure => raise Status_Error with "File not open"; -- subtype Input_File_Type is Open_File_Type -- with -- Dynamic_Predicate => Mode (Input_File_Type) = In_File, -- Predicate_Failure => -- raise Mode_Error with -- "Cannot read file: " & Name (Input_File_Type); -- subtype Output_File_Type is Open_File_Type -- with -- Dynamic_Predicate => Mode (Output_File_Type) /= In_File, -- Predicate_Failure => -- raise Mode_Error with -- "Cannot write file: " & Name (Output_File_Type); -- type File_Mode is (In_File, Out_File, Append_File); type File_Mode is new IO_Modes.File_Mode; -- for conversion type Count is range 0 .. Natural'Last; subtype Positive_Count is Count range 1 .. Count'Last; Unbounded : constant Count := 0; subtype Field is Integer range 0 .. 255; -- implementation-defined subtype Number_Base is Integer range 2 .. 16; -- type Type_Set is (Lower_Case, Upper_Case); type Type_Set is new Formatting.Type_Set; -- extended type String_Access is access String; procedure Free is new Unchecked_Deallocation (String, String_Access); type Wide_String_Access is access Wide_String; procedure Free is new Unchecked_Deallocation (Wide_String, Wide_String_Access); type Wide_Wide_String_Access is access Wide_Wide_String; procedure Free is new Unchecked_Deallocation (Wide_Wide_String, Wide_Wide_String_Access); -- File Management -- modified procedure Create ( File : in out File_Type; Mode : File_Mode := Out_File; Name : String := ""; Form : String); -- removed default procedure Create ( File : in out File_Type; Mode : File_Mode := Out_File; Name : String := ""; Shared : IO_Modes.File_Shared_Spec := IO_Modes.By_Mode; Wait : Boolean := False; Overwrite : Boolean := True; External : IO_Modes.File_External_Spec := IO_Modes.By_Target; New_Line : IO_Modes.File_New_Line_Spec := IO_Modes.By_Target); -- extended function Create ( Mode : File_Mode := Out_File; Name : String := ""; Shared : IO_Modes.File_Shared_Spec := IO_Modes.By_Mode; Wait : Boolean := False; Overwrite : Boolean := True; External : IO_Modes.File_External_Spec := IO_Modes.By_Target; New_Line : IO_Modes.File_New_Line_Spec := IO_Modes.By_Target) return File_Type; -- modified procedure Open ( File : in out File_Type; Mode : File_Mode; Name : String; Form : String); -- removed default procedure Open ( File : in out File_Type; Mode : File_Mode; Name : String; Shared : IO_Modes.File_Shared_Spec := IO_Modes.By_Mode; Wait : Boolean := False; Overwrite : Boolean := True; External : IO_Modes.File_External_Spec := IO_Modes.By_Target; New_Line : IO_Modes.File_New_Line_Spec := IO_Modes.By_Target); -- extended function Open ( Mode : File_Mode; Name : String; Shared : IO_Modes.File_Shared_Spec := IO_Modes.By_Mode; Wait : Boolean := False; Overwrite : Boolean := True; External : IO_Modes.File_External_Spec := IO_Modes.By_Target; New_Line : IO_Modes.File_New_Line_Spec := IO_Modes.By_Target) return File_Type; procedure Close (File : in out File_Type); procedure Delete (File : in out File_Type); procedure Reset (File : in out File_Type; Mode : File_Mode); procedure Reset (File : in out File_Type); function Mode ( File : File_Type) -- Open_File_Type return File_Mode; function Name ( File : File_Type) -- Open_File_Type return String; function Name (File : not null File_Access) return String; -- alt function Form ( File : File_Type) -- Open_File_Type return String; pragma Inline (Mode); pragma Inline (Name); function Is_Open (File : File_Type) return Boolean; function Is_Open (File : not null File_Access) return Boolean; -- alt pragma Inline (Is_Open); -- Control of default input and output files procedure Set_Input (File : File_Type); procedure Set_Input (File : not null File_Access); -- alt procedure Set_Output (File : File_Type); procedure Set_Output (File : not null File_Access); -- alt procedure Set_Error (File : File_Type); procedure Set_Error (File : not null File_Access); -- alt -- Wait for Implicit_Dereference since File_Type is limited (marked "alt") -- function Standard_Input return File_Type; -- function Standard_Output return File_Type; -- function Standard_Error return File_Type; -- function Current_Input return File_Type; -- function Current_Output return File_Type; -- function Current_Error return File_Type; -- type File_Access is access constant File_Type; -- declared in above function Standard_Input return File_Access; function Standard_Output return File_Access; function Standard_Error return File_Access; pragma Pure_Function (Standard_Input); pragma Pure_Function (Standard_Output); pragma Pure_Function (Standard_Error); pragma Inline (Standard_Input); pragma Inline (Standard_Output); pragma Inline (Standard_Error); function Current_Input return File_Access; function Current_Output return File_Access; function Current_Error return File_Access; pragma Inline (Current_Input); pragma Inline (Current_Output); pragma Inline (Current_Error); -- Buffer control procedure Flush ( File : File_Type); -- Output_File_Type procedure Flush; -- Specification of line and page lengths procedure Set_Line_Length ( File : File_Type; -- Output_File_Type To : Count); procedure Set_Line_Length (To : Count); procedure Set_Line_Length (File : not null File_Access; To : Count); -- alt procedure Set_Page_Length ( File : File_Type; -- Output_File_Type To : Count); procedure Set_Page_Length (To : Count); procedure Set_Page_Length (File : not null File_Access; To : Count); -- alt function Line_Length ( File : File_Type) -- Output_File_Type return Count; function Line_Length return Count; pragma Inline (Line_Length); function Page_Length ( File : File_Type) -- Output_File_Type return Count; function Page_Length return Count; pragma Inline (Page_Length); -- Column, Line, and Page Control procedure New_Line ( File : File_Type; -- Output_File_Type Spacing : Positive_Count := 1); procedure New_Line (Spacing : Positive_Count := 1); procedure New_Line ( File : not null File_Access; Spacing : Positive_Count := 1); -- alt procedure Skip_Line ( File : File_Type; -- Input_File_Type Spacing : Positive_Count := 1); procedure Skip_Line (Spacing : Positive_Count := 1); procedure Skip_Line ( File : not null File_Access; Spacing : Positive_Count := 1); -- alt function End_Of_Line ( File : File_Type) -- Input_File_Type return Boolean; function End_Of_Line return Boolean; pragma Inline (End_Of_Line); procedure New_Page ( File : File_Type); -- Output_File_Type procedure New_Page; procedure New_Page (File : not null File_Access); -- alt procedure Skip_Page ( File : File_Type); -- Input_File_Type procedure Skip_Page; procedure Skip_Page (File : not null File_Access); -- alt function End_Of_Page ( File : File_Type) -- Input_File_Type return Boolean; function End_Of_Page return Boolean; function End_Of_Page (File : not null File_Access) return Boolean; -- alt pragma Inline (End_Of_Page); function End_Of_File ( File : File_Type) -- Input_File_Type return Boolean; function End_Of_File return Boolean; function End_Of_File (File : not null File_Access) return Boolean; -- alt pragma Inline (End_Of_File); procedure Set_Col ( File : File_Type; -- Open_File_Type To : Positive_Count); procedure Set_Col (To : Positive_Count); procedure Set_Col (File : not null File_Access; To : Positive_Count); -- alt procedure Set_Line ( File : File_Type; -- Open_File_Type To : Positive_Count); procedure Set_Line (To : Positive_Count); procedure Set_Line ( File : not null File_Access; To : Positive_Count); -- alt function Col ( File : File_Type) -- Open_File_Type return Positive_Count; function Col return Positive_Count; function Col (File : not null File_Access) return Positive_Count; -- alt pragma Inline (Col); function Line ( File : File_Type) -- Open_File_Type return Positive_Count; function Line return Positive_Count; function Line (File : not null File_Access) return Positive_Count; -- alt pragma Inline (Line); function Page ( File : File_Type) -- Open_File_Type return Positive_Count; function Page return Positive_Count; function Page (File : not null File_Access) return Positive_Count; -- alt pragma Inline (Page); -- Character Input-Output -- extended procedure Overloaded_Get ( File : File_Type; -- Input_File_Type Item : out Character); procedure Overloaded_Get ( File : File_Type; -- Input_File_Type Item : out Wide_Character); procedure Overloaded_Get ( File : File_Type; -- Input_File_Type Item : out Wide_Wide_Character); procedure Overloaded_Get (Item : out Character); procedure Overloaded_Get (Item : out Wide_Character); procedure Overloaded_Get (Item : out Wide_Wide_Character); procedure Get ( File : File_Type; -- Input_File_Type Item : out Character) renames Overloaded_Get; procedure Get (Item : out Character) renames Overloaded_Get; procedure Get (File : not null File_Access; Item : out Character); -- alt -- extended procedure Overloaded_Put ( File : File_Type; -- Output_File_Type Item : Character); procedure Overloaded_Put ( File : File_Type; -- Output_File_Type Item : Wide_Character); procedure Overloaded_Put ( File : File_Type; -- Output_File_Type Item : Wide_Wide_Character); procedure Overloaded_Put (Item : Character); procedure Overloaded_Put (Item : Wide_Character); procedure Overloaded_Put (Item : Wide_Wide_Character); procedure Put ( File : File_Type; -- Output_File_Type Item : Character) renames Overloaded_Put; procedure Put (Item : Character) renames Overloaded_Put; procedure Put (File : not null File_Access; Item : Character); -- alt -- extended procedure Overloaded_Look_Ahead ( File : File_Type; -- Input_File_Type Item : out Character; End_Of_Line : out Boolean); procedure Overloaded_Look_Ahead ( File : File_Type; -- Input_File_Type Item : out Wide_Character; End_Of_Line : out Boolean); procedure Overloaded_Look_Ahead ( File : File_Type; -- Input_File_Type Item : out Wide_Wide_Character; End_Of_Line : out Boolean); procedure Overloaded_Look_Ahead ( Item : out Character; End_Of_Line : out Boolean); procedure Overloaded_Look_Ahead ( Item : out Wide_Character; End_Of_Line : out Boolean); procedure Overloaded_Look_Ahead ( Item : out Wide_Wide_Character; End_Of_Line : out Boolean); procedure Look_Ahead ( File : File_Type; -- Input_File_Type Item : out Character; End_Of_Line : out Boolean) renames Overloaded_Look_Ahead; procedure Look_Ahead ( Item : out Character; End_Of_Line : out Boolean) renames Overloaded_Look_Ahead; -- extended -- Skip one character or mark of new-line -- looked by last calling of Look_Ahead. procedure Skip_Ahead ( File : File_Type); -- Input_File_Type -- extended procedure Overloaded_Get_Immediate ( File : File_Type; -- Input_File_Type Item : out Character); procedure Overloaded_Get_Immediate ( File : File_Type; -- Input_File_Type Item : out Wide_Character); procedure Overloaded_Get_Immediate ( File : File_Type; -- Input_File_Type Item : out Wide_Wide_Character); procedure Overloaded_Get_Immediate (Item : out Character); procedure Overloaded_Get_Immediate (Item : out Wide_Character); procedure Overloaded_Get_Immediate (Item : out Wide_Wide_Character); procedure Get_Immediate ( File : File_Type; -- Input_File_Type Item : out Character) renames Overloaded_Get_Immediate; procedure Get_Immediate (Item : out Character) renames Overloaded_Get_Immediate; -- extended procedure Overloaded_Get_Immediate ( File : File_Type; -- Input_File_Type Item : out Character; Available : out Boolean); procedure Overloaded_Get_Immediate ( File : File_Type; -- Input_File_Type Item : out Wide_Character; Available : out Boolean); procedure Overloaded_Get_Immediate ( File : File_Type; -- Input_File_Type Item : out Wide_Wide_Character; Available : out Boolean); procedure Overloaded_Get_Immediate ( Item : out Character; Available : out Boolean); procedure Overloaded_Get_Immediate ( Item : out Wide_Character; Available : out Boolean); procedure Overloaded_Get_Immediate ( Item : out Wide_Wide_Character; Available : out Boolean); procedure Get_Immediate ( File : File_Type; -- Input_File_Type Item : out Character; Available : out Boolean) renames Overloaded_Get_Immediate; procedure Get_Immediate ( Item : out Character; Available : out Boolean) renames Overloaded_Get_Immediate; -- String Input-Output -- extended procedure Overloaded_Get ( File : File_Type; -- Input_File_Type Item : out String); procedure Overloaded_Get ( File : File_Type; -- Input_File_Type Item : out Wide_String); procedure Overloaded_Get ( File : File_Type; -- Input_File_Type Item : out Wide_Wide_String); procedure Overloaded_Get (Item : out String); procedure Overloaded_Get (Item : out Wide_String); procedure Overloaded_Get (Item : out Wide_Wide_String); procedure Get ( File : File_Type; -- Input_File_Type Item : out String) renames Overloaded_Get; procedure Get (Item : out String) renames Overloaded_Get; procedure Get (File : not null File_Access; Item : out String); -- alt -- extended procedure Overloaded_Put ( File : File_Type; -- Output_File_Type Item : String); procedure Overloaded_Put ( File : File_Type; -- Output_File_Type Item : Wide_String); procedure Overloaded_Put ( File : File_Type; -- Output_File_Type Item : Wide_Wide_String); procedure Overloaded_Put (Item : String); procedure Overloaded_Put (Item : Wide_String); procedure Overloaded_Put (Item : Wide_Wide_String); procedure Put ( File : File_Type; -- Output_File_Type Item : String) renames Overloaded_Put; procedure Put (Item : String) renames Overloaded_Put; procedure Put (File : not null File_Access; Item : String); -- alt -- extended procedure Overloaded_Get_Line ( File : File_Type; -- Input_File_Type Item : out String; Last : out Natural); procedure Overloaded_Get_Line ( File : File_Type; -- Input_File_Type Item : out Wide_String; Last : out Natural); procedure Overloaded_Get_Line ( File : File_Type; -- Input_File_Type Item : out Wide_Wide_String; Last : out Natural); procedure Overloaded_Get_Line ( Item : out String; Last : out Natural); procedure Overloaded_Get_Line ( Item : out Wide_String; Last : out Natural); procedure Overloaded_Get_Line ( Item : out Wide_Wide_String; Last : out Natural); procedure Get_Line ( File : File_Type; -- Input_File_Type Item : out String; Last : out Natural) renames Overloaded_Get_Line; procedure Get_Line ( Item : out String; Last : out Natural) renames Overloaded_Get_Line; procedure Get_Line ( File : not null File_Access; Item : out String; Last : out Natural); -- alt -- extended procedure Overloaded_Get_Line ( File : File_Type; -- Input_File_Type Item : out String_Access); procedure Overloaded_Get_Line ( File : File_Type; -- Input_File_Type Item : out Wide_String_Access); procedure Overloaded_Get_Line ( File : File_Type; -- Input_File_Type Item : out Wide_Wide_String_Access); -- extended function Overloaded_Get_Line ( File : File_Type) -- Input_File_Type return String; function Overloaded_Get_Line ( File : File_Type) -- Input_File_Type return Wide_String; function Overloaded_Get_Line ( File : File_Type) -- Input_File_Type return Wide_Wide_String; function Overloaded_Get_Line return String; function Overloaded_Get_Line return Wide_String; function Overloaded_Get_Line return Wide_Wide_String; function Get_Line ( File : File_Type) -- Input_File_Type return String renames Overloaded_Get_Line; function Get_Line return String renames Overloaded_Get_Line; -- extended procedure Overloaded_Put_Line ( File : File_Type; -- Output_File_Type Item : String); procedure Overloaded_Put_Line ( File : File_Type; -- Output_File_Type Item : Wide_String); procedure Overloaded_Put_Line ( File : File_Type; -- Output_File_Type Item : Wide_Wide_String); procedure Overloaded_Put_Line (Item : String); procedure Overloaded_Put_Line (Item : Wide_String); procedure Overloaded_Put_Line (Item : Wide_Wide_String); procedure Put_Line ( File : File_Type; -- Output_File_Type Item : String) renames Overloaded_Put_Line; procedure Put_Line (Item : String) renames Overloaded_Put_Line; procedure Put_Line (File : not null File_Access; Item : String); -- alt -- Generic packages for Input-Output of Integer Types -- Generic packages for Input-Output of Real Types -- Generic package for Input-Output of Enumeration Types -- Note: Integer_IO, Modular_IO, Float_IO, Fixed_IO, Decimal_IO, and -- Enumeration_IO are separated by compiler. -- Exceptions Status_Error : exception renames IO_Exceptions.Status_Error; Mode_Error : exception renames IO_Exceptions.Mode_Error; Name_Error : exception renames IO_Exceptions.Name_Error; Use_Error : exception renames IO_Exceptions.Use_Error; Device_Error : exception renames IO_Exceptions.Device_Error; End_Error : exception renames IO_Exceptions.End_Error; Data_Error : exception renames IO_Exceptions.Data_Error; Layout_Error : exception renames IO_Exceptions.Layout_Error; private package Controlled is type File_Type is limited private; type File_Access is access constant File_Type; for File_Access'Storage_Size use 0; function Standard_Input return File_Access; function Standard_Output return File_Access; function Standard_Error return File_Access; pragma Inline (Standard_Input); pragma Inline (Standard_Output); pragma Inline (Standard_Error); function Reference_Current_Input return not null access File_Access; function Reference_Current_Output return not null access File_Access; function Reference_Current_Error return not null access File_Access; pragma Inline (Reference_Current_Input); pragma Inline (Reference_Current_Output); pragma Inline (Reference_Current_Error); function Reference (File : Text_IO.File_Type) return not null access Naked_Text_IO.Non_Controlled_File_Type; pragma Inline (Reference); private type File_Type is limited new Finalization.Limited_Controlled with record Text : aliased Naked_Text_IO.Non_Controlled_File_Type; end record; overriding procedure Finalize (Object : in out File_Type); end Controlled; type File_Type is new Controlled.File_Type; -- for Get_Line and the child packages. procedure Reallocate is new Unchecked_Reallocation ( Positive, Character, String, String_Access); function String_Grow is new System.Growth.Good_Grow ( Natural, Component_Size => String'Component_Size); function Wide_String_Grow is new System.Growth.Good_Grow ( Natural, Component_Size => Wide_String'Component_Size); function Wide_Wide_String_Grow is new System.Growth.Good_Grow ( Natural, Component_Size => Wide_Wide_String'Component_Size); end Ada.Text_IO;
-- CC1204A.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 GENERIC FORMAL TYPES MAY HAVE A DISCRIMINANT PART, -- WHICH MAY BE OF A GENERIC FORMAL TYPE. -- DAT 8/14/81 -- SPS 5/12/82 WITH REPORT; USE REPORT; PROCEDURE CC1204A IS BEGIN TEST ("CC1204A", "DISCRIMINANT PARTS FOR GENERIC FORMAL TYPES"); DECLARE GENERIC TYPE T IS ( <> ); TYPE I IS RANGE <> ; TYPE R1 (C : BOOLEAN) IS PRIVATE; TYPE R2 (C : T) IS PRIVATE; TYPE R3 (C : I) IS LIMITED PRIVATE; P1 : IN R1; P2 : IN R2; V1 : IN OUT R1; V2 : IN OUT R2; V3 : IN OUT R3; PROCEDURE PROC; TYPE DD IS NEW INTEGER RANGE 1 .. 10; TYPE ARR IS ARRAY (DD RANGE <>) OF CHARACTER; TYPE RECD (C : DD := DD (IDENT_INT (1))) IS RECORD C1 : ARR (1..C); END RECORD; X1 : RECD; X2 : RECD := (1, "Y"); TYPE RECB (C : BOOLEAN) IS RECORD V : INTEGER := 6; END RECORD; RB : RECB (IDENT_BOOL (TRUE)); RB1 : RECB (IDENT_BOOL (TRUE)); PROCEDURE PROC IS BEGIN IF P1.C /= TRUE OR P2.C /= T'FIRST OR V1.C /= TRUE OR V2.C /= T'FIRST OR V3.C /= I'FIRST THEN FAILED ("WRONG GENERIC PARAMETER VALUE"); END IF; V1 := P1; V2 := P2; IF V1 /= P1 OR V2 /= P2 THEN FAILED ("BAD ASSIGNMENT TO GENERIC PARAMETERS"); END IF; END PROC; BEGIN RB1.V := IDENT_INT (1); X1.C1 := "X"; DECLARE PROCEDURE PR IS NEW PROC (T => DD, I => DD, R1 => RECB, R2 => RECD, R3 => RECD, P1 => RB1, P2 => X1, V1 => RB, V2 => X2, V3 => X2); BEGIN PR; IF RB /= (TRUE, 1) OR X2.C1 /= "X" THEN FAILED ("PR NOT CALLED CORRECTLY"); END IF; END; END; RESULT; END CC1204A;
-- { dg-do compile } -- { dg-options "-O3" } package body Opt56 is function F (Values : Vector) return Boolean is Result : Boolean := True; begin for I in Values'Range loop Result := Result and Values (I) >= 0.0; end loop; return Result; end; end Opt56;
------------------------------------------------------------------------------ -- -- -- GNAT RUN-TIME LIBRARY (GNARL) COMPONENTS -- -- -- -- S Y S T E M . B B . C P U _ P R I M I T I V E S -- -- -- -- B o d y -- -- -- -- Copyright (C) 1999-2002 Universidad Politecnica de Madrid -- -- Copyright (C) 2003-2005 The European Space Agency -- -- Copyright (C) 2003-2020, AdaCore -- -- -- -- GNARL is free software; you can redistribute it and/or modify it under -- -- terms of the GNU General Public License as published by the Free Soft- -- -- ware Foundation; either version 3, or (at your option) any later ver- -- -- sion. GNARL is distributed in the hope that it will be useful, but WITH- -- -- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY -- -- or FITNESS FOR A PARTICULAR PURPOSE. -- -- -- -- As a special exception under Section 7 of GPL version 3, you are granted -- -- additional permissions described in the GCC Runtime Library Exception, -- -- version 3.1, as published by the Free Software Foundation. -- -- -- -- You should have received a copy of the GNU General Public License and -- -- a copy of the GCC Runtime Library Exception along with this program; -- -- see the files COPYING3 and COPYING.RUNTIME respectively. If not, see -- -- <http://www.gnu.org/licenses/>. -- -- -- ------------------------------------------------------------------------------ pragma Restrictions (No_Elaboration_Code); with System.Multiprocessors; with System.BB.CPU_Specific; with System.BB.Threads; package body System.BB.CPU_Primitives is use BB.Parameters; use System.BB.Threads; package SSE renames System.Storage_Elements; use type SSE.Integer_Address; use type SSE.Storage_Offset; ---------------- -- Local data -- ---------------- SP : constant Context_Id := 6; PC : constant Context_Id := 7; PSR : constant Context_Id := 8; WIM : constant Context_Id := 17; WIN : constant Context_Id := 18; FSR : constant Context_Id := 19; O0 : constant Context_Id := 0; INT : constant Context_Id := 52; -- these are the registers that are initialized: Program Counter, Stack -- Pointer, Window Invalid Mask, Floating-Point State Register, and -- Processor State Register. Moreover, the first input argument, the number -- of register windows to be restored, and the interrupt nesting level are -- also initialized. Base_CCR : constant Context_Id := Base_CCR_Context_Index; CCR : constant Context_Id := CCR_Context_Index; pragma Assert (Base_CCR_Context_Index = 53 and then CCR_Context_Index = 54); -- For LEON we allocate two slots for the cache control register at the -- end of the buffer. FP : constant SSE.Storage_Offset := 56; -- The frame pointer needs also to be initialized; however, it is not kept -- in the thread descriptor but in the stack, and this value represents the -- offset from the stack pointer (expressed in bytes). ---------------------- -- Trap definitions -- ---------------------- Instruction_Access_Exception : constant Vector_Id := 16#01#; Illegal_Instruction : constant Vector_Id := 16#02#; Address_Not_Aligned : constant Vector_Id := 16#07#; FP_Exception : constant Vector_Id := 16#08#; Data_Access_Exception : constant Vector_Id := 16#09#; Instruction_Access_Error : constant Vector_Id := 16#21#; Data_Access_Error : constant Vector_Id := 16#29#; Division_By_Zero_Hw : constant Vector_Id := 16#2A#; Data_Store_Error : constant Vector_Id := 16#2B#; Division_By_Zero_Sw : constant Vector_Id := 16#82#; type Trap_Entry is record First_Instr : SSE.Integer_Address; Second_Instr : SSE.Integer_Address; Third_Instr : SSE.Integer_Address; Fourth_Instr : SSE.Integer_Address; end record; -- Each entry in the trap table contains the four first instructions that -- will be executed as part of the handler. A trap is a vectored transfer -- of control to the supervisor through a special trap table that contains -- the first four instructions of each trap handler. The base address of -- the table is established by supervisor and the displacement, within the -- table, is determined by the trap type. type Trap_Entries_Table is array (Vector_Id) of Trap_Entry; Trap_Table : Trap_Entries_Table; pragma Import (Asm, Trap_Table, "trap_table"); -- This is the trap table, that is defined in the crt0 file. This table -- contains the trap entry for all the traps (synchronous and asynchronous) -- defined by the SPARC architecture. Common_Handler : Address; pragma Import (Asm, Common_Handler, "common_handler"); -- There is a common part that is executed for every trap. This common -- handler executes some prologue, then jumps to the user code, and after -- that executes an epilogue. type Vector_Table is array (Vector_Id) of System.Address; User_Vector_Table : Vector_Table; pragma Export (Asm, User_Vector_Table, "user_vector_table"); -- In addition to the trap table there is another table that contains the -- addresses for the trap handlers defined by the user. This is used by -- the common wrapper to invoke the correct user-defined handler. function Get_CCR return System.Address; pragma Import (Asm, Get_CCR, "get_ccr"); pragma Weak_External (Get_CCR); -- Get the value from the hardware Cache Control Register. procedure GNAT_Error_Handler (Trap : Vector_Id); -- Trap handler converting synchronous traps to exceptions ---------------------------- -- Floating point context -- ---------------------------- type Thread_Table is array (System.Multiprocessors.CPU) of Thread_Id; pragma Volatile_Components (Thread_Table); Float_Latest_User_Table : Thread_Table := (others => Null_Thread_Id); pragma Export (Asm, Float_Latest_User_Table, "float_latest_user_table"); -- This variable contains the last thread that used the floating point unit -- for each CPU. Hence, it points to the place where the floating point -- state must be stored. -------------------- -- Context_Switch -- -------------------- procedure Context_Switch is procedure Asm_Context_Switch; pragma Import (Asm, Asm_Context_Switch, "__gnat_context_switch"); begin Asm_Context_Switch; end Context_Switch; ------------------------ -- Disable_Interrupts -- ------------------------ procedure Disable_Interrupts is procedure Asm_Disable_Interrupts; pragma Import (Asm, Asm_Disable_Interrupts, "disable_interrupts"); begin Asm_Disable_Interrupts; -- Replace by inline Asm ??? end Disable_Interrupts; ----------------------- -- Enable_Interrupts -- ----------------------- procedure Enable_Interrupts (Level : Integer) is procedure Asm_Enable_Interrupts (Level : Natural); pragma Import (Asm, Asm_Enable_Interrupts, "enable_interrupts"); begin if Level in Interrupt_Priority then Asm_Enable_Interrupts (Level - Interrupt_Priority'First + 1); else Asm_Enable_Interrupts (0); end if; end Enable_Interrupts; ----------------- -- Get_Context -- ----------------- function Get_Context (Context : Context_Buffer; Index : Context_Id) return Word is begin return Word (Context (Index)); end Get_Context; ------------------------ -- GNAT_Error_Handler -- ------------------------ procedure GNAT_Error_Handler (Trap : Vector_Id) is begin case Trap is when Instruction_Access_Exception => raise Storage_Error with "instruction access exception"; when Illegal_Instruction => raise Constraint_Error with "illegal instruction"; when Address_Not_Aligned => raise Constraint_Error with "address not aligned"; when FP_Exception => raise Constraint_Error with "floating point exception"; when Data_Access_Exception => raise Constraint_Error with "data access exception"; when Instruction_Access_Error => raise Constraint_Error with "instruction access exception"; when Data_Access_Error => raise Constraint_Error with "data access error"; when Division_By_Zero_Hw | Division_By_Zero_Sw => raise Constraint_Error with "division by zero"; when Data_Store_Error => raise Constraint_Error with "data store error"; when others => raise Program_Error with "unhandled trap"; end case; end GNAT_Error_Handler; ------------------------ -- Initialize_Context -- ------------------------ procedure Initialize_Context (Buffer : not null access Context_Buffer; Program_Counter : System.Address; Argument : System.Address; Stack_Pointer : System.Address) is begin -- The stack must be aligned to 16. 96 bytes are needed for storing -- a whole register window (96 bytes). Buffer (SP) := SSE.To_Address ((SSE.To_Integer (Stack_Pointer) / 16) * 16 - 96); -- Initialize PSR with the state expected by the context switch routine. -- Floating point unit is disabled. Traps are enabled, although -- interrupts are disabled (after the context switch only interrupts -- with a lower priority than the task will be masked). The supervisor -- and previous supervisor are set to 1 (the system always operates in -- supervisor mode). -- CWP = 0, ET = 1, PS = 1, S = 1, and PIL = 15 Buffer (PSR) := SSE.To_Address (16#0FE0#); -- The WIM is initialized to 2 (corresponding to CWP = 1) Buffer (WIM) := SSE.To_Address (2); -- The number of windows that must be flushed is initially set to 0 -- (only the current window). Buffer (WIN) := SSE.To_Address (0); -- Initialize PC with the starting address of the task. Substract 8 -- to compensate the adjustment made in the context switch routine. Buffer (PC) := SSE.To_Address (SSE.To_Integer (Program_Counter) - 8); -- The argument to be used by the task wrapper function must be -- passed through the o0 register. Buffer (O0) := Argument; -- The frame pointer is initialized to be the top of the stack declare FP_In_Stack : System.Address; for FP_In_Stack'Address use (Buffer (SP) + FP); begin -- Mark the deepest stack frame by setting the frame pointer to zero FP_In_Stack := SSE.To_Address (0); end; -- The interrupt nesting level is initialized to 0 Buffer (INT) := SSE.To_Address (0); -- For LEON we initialize the cache control register to its value at -- initialization time. Buffer (CCR) := (if Get_CCR'Address = Null_Address then Null_Address else Get_CCR); Buffer (Base_CCR) := Buffer (CCR); -- The Floating-Point State Register is initialized to 0 Buffer (FSR) := SSE.To_Address (0); -- The rest of registers do not need to be initialized end Initialize_Context; -------------------- -- Initialize_CPU -- -------------------- procedure Initialize_CPU is begin null; end Initialize_CPU; ---------------------- -- Initialize_Stack -- ---------------------- procedure Initialize_Stack (Base : Address; Size : Storage_Elements.Storage_Offset; Stack_Pointer : out Address) is use System.Storage_Elements; begin -- Force alignment Stack_Pointer := Base + (Size - (Size mod CPU_Specific.Stack_Alignment)); end Initialize_Stack; ---------------------------- -- Install_Error_Handlers -- ---------------------------- procedure Install_Error_Handlers is -- Set up trap handler to map synchronous signals to appropriate -- exceptions. Make sure that the handler isn't interrupted by -- another signal that might cause a scheduling event. begin -- The division by zero trap may be either a hardware trap (trap type -- 16#2A#) when the integer division istruction is used (on SPARC V8 and -- later) or a software trap (trap type 16#82#) caused by the software -- division implementation in libgcc. for J in Vector_Id'Range loop if J in Instruction_Access_Exception | Illegal_Instruction | Address_Not_Aligned | FP_Exception | Data_Access_Exception | Instruction_Access_Error | Data_Access_Error | Division_By_Zero_Hw | Division_By_Zero_Sw | Data_Store_Error then Install_Trap_Handler (GNAT_Error_Handler'Address, J); end if; end loop; end Install_Error_Handlers; -------------------------- -- Install_Trap_Handler -- -------------------------- procedure Install_Trap_Handler (Service_Routine : Address; Vector : Vector_Id; Synchronous : Boolean := False) is separate; ----------------- -- Set_Context -- ----------------- procedure Set_Context (Context : in out Context_Buffer; Index : Context_Id; Value : Word) is begin Context (Index) := Address (Value); end Set_Context; end System.BB.CPU_Primitives;
-- WORDS, a Latin dictionary, by Colonel William Whitaker (USAF, Retired) -- -- Copyright William A. Whitaker (1936–2010) -- -- This is a free program, which means it is proper to copy it and pass -- it on to your friends. Consider it a developmental item for which -- there is no charge. However, just for form, it is Copyrighted -- (c). Permission is hereby freely given for any and all use of program -- and data. You can sell it as your own, but at least tell me. -- -- This version is distributed without obligation, but the developer -- would appreciate comments and suggestions. -- -- All parts of the WORDS system, source code and data files, are made freely -- available to anyone who wishes to use them, for whatever purpose. with Ada.Text_IO; with Latin_Utils.Strings_Package; use Latin_Utils.Strings_Package; with Support_Utils.Word_Parameters; use Support_Utils.Word_Parameters; with Support_Utils.Developer_Parameters; use Support_Utils.Developer_Parameters; with Latin_Utils.Inflections_Package; use Latin_Utils.Inflections_Package; with Latin_Utils.Dictionary_Package; use Latin_Utils.Dictionary_Package; with Support_Utils.Addons_Package; use Support_Utils.Addons_Package; with Support_Utils.Word_Support_Package; use Support_Utils.Word_Support_Package; with Words_Engine.Word_Package; use Words_Engine.Word_Package; with Words_Engine.Tricks; use Words_Engine.Tricks; with Words_Engine.Put_Stat; with Words_Engine.Search_English; --with Support_Utils.Char_Utils; use Support_Utils.Char_Utils; with Ada.Strings.Unbounded; use Ada.Strings.Unbounded; with Ada.Strings.Fixed; with Words_Engine.Explanation_Package; use Words_Engine.Explanation_Package; use Latin_Utils; with Words_Engine.Pearse_Code; use Words_Engine.Pearse_Code; pragma Elaborate (Support_Utils.Word_Parameters); package body Words_Engine.Parse is use Inflections_Package.Integer_IO; use Ada.Text_IO; package Word_Container is new Vectors (Natural, Unbounded_String); use Word_Container; use Result_Container; type Word_Analysis_Result is record WA : Word_Analysis; Used_Next_Word : Boolean; end record; Syncope_Max : constant := 20; Tricks_Max : constant := 40; -- the scope of these variables is over-broad Storage_Error_Count : Integer := 0; No_Syncope : Boolean := False; type Participle is record Ppl_On : Boolean; Ppl_Info : Vpar_Record; Compound_Tvm : Inflections_Package.Tense_Voice_Mood_Record; Ppp_Meaning : Meaning_Type; end record; type Verb_To_Be (Matches : Boolean) is record case Matches is when True => Verb_Rec : Verb_Record; when False => null; end case; end record; procedure Clear_Parse_Array (Any_Pa : out Parse_Array) is begin for I in Any_Pa'Range loop Any_Pa (I) := Null_Parse_Record; end loop; end Clear_Parse_Array; function Is_Esse (T : String) return Boolean is begin return Trim (T) = "esse"; end Is_Esse; function Is_Fuisse (T : String) return Boolean is begin return Trim (T) = "fuisse"; end Is_Fuisse; function Is_Iri (T : String) return Boolean is begin return Trim (T) = "iri"; end Is_Iri; function Get_Participle_Info (Vpar : Vpar_Record) return Vpar_Record is begin return ( Vpar.Con, -- In this case, there is 1 Vpar.Of_Case, -- although several different Vpar.Number, -- dictionary entries may fit Vpar.Gender, -- all have same PPL_INFO Vpar.Tense_Voice_Mood ); end Get_Participle_Info; type Participle_Gloss is record Key : Inflections_Package.Tense_Voice_Mood_Record; Gloss : String (1 .. 78); end record; -- should merge the next three arrays type Participle_Glosses_Arr is array (Integer range <>) of Participle_Gloss; Participle_Glosses : constant Participle_Glosses_Arr := ( (Key => (Perf, Passive, Ppl), Gloss => "PERF PASSIVE PPL + verb TO_BE => " & "PASSIVE perfect system "), (Key => (Fut, Active, Ppl), Gloss => "FUT ACTIVE PPL + verb TO_BE => " & "ACTIVE Periphrastic - about to, going to "), (Key => (Fut, Passive, Ppl), Gloss => "FUT PASSIVE PPL + verb TO_BE => " & "PASSIVE Periphrastic - should/ought/had to ") ); Participle_Glosses_With_Esse : constant Participle_Glosses_Arr := ( (Key => (Perf, Passive, Ppl), Gloss => "PERF PASSIVE PPL + esse => " & "PERF PASSIVE INF "), (Key => (Fut, Active, Ppl), Gloss => "FUT ACTIVE PPL + esse => " & "PRES Periphastic/FUT ACTIVE INF - be about/going to "), (Key => (Fut, Passive, Ppl), Gloss => "FUT PASSIVE PPL + esse => " & "PRES PASSIVE INF ") ); Participle_Glosses_With_Fuisse : constant Participle_Glosses_Arr := ( (Key => (Perf, Passive, Ppl), Gloss => "PERF PASSIVE PPL + esse => " & "PERF PASSIVE INF "), (Key => (Fut, Active, Ppl), Gloss => "FUT ACT PPL+fuisse => " & "PERF ACT INF Periphrastic - to have been about/going to "), (Key => (Fut, Passive, Ppl), Gloss => "FUT PASSIVE PPL + fuisse => " & "PERF PASSIVE INF Periphrastic - about to, going to") ); -- we pass in the "default" values of a bunch of variables -- this function is called in a loop, which used to overWrite -- the values of this handful of variables, at least one of -- which is a global defined elsewhere -- retaining the "defaults" allows us to (re)assign the values -- in the caller, which is effectively a no-op in the fall-through -- code path; we should pass this information in as a record of type -- "participle" rather than as four separate values, to be clearer -- about what is going on, and save wear-and-tear on the stack frame -- compare this function with the very similar one directly below it; -- they should be factored back toGether function Get_Pas_Nom_Participle (Parsed_Verb : Vpar_Record; Sum_Info : Verb_Record; Default_Ppl_On : Boolean; Default_Compound_Tvm : Tense_Voice_Mood_Record; Default_Ppp_Meaning : Meaning_Type; Default_Ppl_Info : Vpar_Record) return Participle is Compound_Tense : Tense_Type := Pres; function Get_Compound_Tense (Tense : Tense_Type) return Tense_Type is begin case Tense is when Pres | Perf => return Perf; -- Allows PERF for sum when Impf | Plup => return Plup; when Fut => return Futp; when others => return X; end case; end Get_Compound_Tense; begin for I in Participle_Glosses'Range loop if Participle_Glosses (I).Key = Parsed_Verb.Tense_Voice_Mood then if Parsed_Verb.Tense_Voice_Mood = (Perf, Passive, Ppl) then Compound_Tense := Get_Compound_Tense ( Sum_Info.Tense_Voice_Mood.Tense); else Compound_Tense := Sum_Info.Tense_Voice_Mood.Tense; end if; return ( Ppl_On => True, Ppl_Info => Get_Participle_Info (Parsed_Verb), Ppp_Meaning => Head (Participle_Glosses (I).Gloss, Max_Meaning_Size), Compound_Tvm => (Compound_Tense, Passive, Sum_Info.Tense_Voice_Mood.Mood) ); end if; end loop; return ( Ppl_On => Default_Ppl_On, Ppl_Info => Default_Ppl_Info, Ppp_Meaning => Default_Ppp_Meaning, Compound_Tvm => Default_Compound_Tvm ); end Get_Pas_Nom_Participle; -- this function should be merged with the one above function Get_Pas_Participle (Parsed_Verb : Vpar_Record; Trimmed_Next_Word : String; Default_Ppl_On : Boolean; Default_Compound_Tvm : Tense_Voice_Mood_Record; Default_Ppp_Meaning : Meaning_Type; Default_Ppl_Info : Vpar_Record) return Participle is function Get_Compound_Tense (Tense : Tense_Type; Voice : Voice_Type; Uses_Esse : Boolean) return Tense_Type is begin case Tense is when Fut => case Uses_Esse is when False => return Perf; when others => case Voice is when Active => return Fut; when Passive => return Pres; when X => return Fut; -- shouldn't happen! -- FIXME: remove 'x' member of voice enumeration end case; end case; when others => return Tense; end case; end Get_Compound_Tense; Voice : constant Voice_Type := Parsed_Verb.Tense_Voice_Mood.Voice; Uses_Esse : constant Boolean := Is_Esse (Trimmed_Next_Word); Compound_Tense : Tense_Type; begin -- voice and mood are always as specified in parsed_verb.tense_voice_mood -- if tense is future, then there's a complicated thing to do for I in Participle_Glosses_With_Esse'Range loop if Participle_Glosses_With_Esse (I).Key = Parsed_Verb.Tense_Voice_Mood then declare Ppp_Meaning_S : String (1 .. 78); begin Compound_Tense := Get_Compound_Tense ( Parsed_Verb.Tense_Voice_Mood.Tense, Parsed_Verb.Tense_Voice_Mood.Voice, Uses_Esse); if Uses_Esse then Ppp_Meaning_S := Participle_Glosses_With_Esse (I).Gloss; else Ppp_Meaning_S := Participle_Glosses_With_Fuisse (I).Gloss; end if; return ( Ppl_On => True, Ppl_Info => Get_Participle_Info (Parsed_Verb), Ppp_Meaning => Head (Ppp_Meaning_S, Max_Meaning_Size), Compound_Tvm => (Compound_Tense, Voice, Inf) ); end; end if; end loop; return ( Ppl_On => Default_Ppl_On, Ppl_Info => Default_Ppl_Info, Ppp_Meaning => Default_Ppp_Meaning, Compound_Tvm => Default_Compound_Tvm ); end Get_Pas_Participle; function Is_Sum (T : String) return Verb_To_Be is Sa : constant array (Mood_Type range Ind .. Sub, Tense_Type range Pres .. Futp, Number_Type range S .. P, Person_Type range 1 .. 3) of String (1 .. 9) := ( ( -- IND (("sum ", "es ", "est "), ("sumus ", "estis ", "sunt ")), (("eram ", "eras ", "erat "), ("eramus ", "eratis ", "erant ")), (("ero ", "eris ", "erit "), ("erimus ", "eritis ", "erunt ")), (("fui ", "fuisti ", "fuit "), ("fuimus ", "fuistis ", "fuerunt ")), (("fueram ", "fueras ", "fuerat "), ("fueramus ", "fueratis ", "fuerant ")), (("fuero ", "fueris ", "fuerit "), ("fuerimus ", "fueritis ", "fuerunt ")) ), ( -- SUB (("sim ", "sis ", "sit "), ("simus ", "sitis ", "sint ")), (("essem ", "esses ", "esset "), ("essemus ", "essetis ", "essent ")), (("zzz ", "zzz ", "zzz "), ("zzz ", "zzz ", "zzz ")), (("fuerim ", "fueris ", "fuerit "), ("fuerimus ", "fueritis ", "fuerint ")), (("fuissem ", "fuisses ", "fuisset "), ("fuissemus", "fuissetis", "fuissent ")), (("zzz ", "zzz ", "zzz "), ("zzz ", "zzz ", "zzz ")) ) ); begin if T = "" then return Verb_To_Be'(Matches => False); elsif T (T'First) /= 's' and T (T'First) /= 'e' and T (T'First) /= 'f' then return Verb_To_Be'(Matches => False); end if; for L in Mood_Type range Ind .. Sub loop for K in Tense_Type range Pres .. Futp loop for J in Number_Type range S .. P loop for I in Person_Type range 1 .. 3 loop if Trim (T) = Trim (Sa (L, K, J, I)) then return Verb_To_Be'( Matches => True, Verb_Rec => ((5, 1), (K, Active, L), I, J) ); end if; end loop; end loop; end loop; end loop; return Verb_To_Be'( Matches => False ); end Is_Sum; -- parts of these three do_clear_* functions should be factored together procedure Do_Clear_Pas_Nom_Ppl (Sum_Info : in Verb_Record; Compound_Tvm : out Tense_Voice_Mood_Record; Ppl_On : in out Boolean; Ppl_Info : out Vpar_Record; Pa : in out Parse_Array; Pa_Last : in out Integer; Xp : in out Explanations) is begin for J4 in reverse 1 .. Pa_Last loop -- Sweep backwards to kill empty suffixes if Pa (J4).IR.Qual.Pofs in Tackon .. Suffix and then Ppl_On then null; elsif Pa (J4).IR.Qual.Pofs = Vpar and then Pa (J4).IR.Qual.Vpar.Of_Case = Nom and then Pa (J4).IR.Qual.Vpar.Number = Sum_Info.Number then declare Part : constant Participle := Get_Pas_Nom_Participle (Pa (J4).IR.Qual.Vpar, Sum_Info, Ppl_On, Compound_Tvm, Xp.Ppp_Meaning, Ppl_Info); begin Ppl_On := Part.Ppl_On; Ppl_Info := Part.Ppl_Info; Xp.Ppp_Meaning := Part.Ppp_Meaning; Compound_Tvm := Part.Compound_Tvm; end; else Pa (J4 .. Pa_Last - 1) := Pa (J4 + 1 .. Pa_Last); Pa_Last := Pa_Last - 1; Ppl_On := False; end if; end loop; end Do_Clear_Pas_Nom_Ppl; -- parts of these three do_clear_* functions should be factored together procedure Do_Clear_Pas_Ppl (Next_Word : in String; Compound_Tvm : out Tense_Voice_Mood_Record; Ppl_On : in out Boolean; Ppl_Info : out Vpar_Record; Pa : in out Parse_Array; Pa_Last : in out Integer; Xp : in out Explanations) is begin for J5 in reverse 1 .. Pa_Last loop -- Sweep backwards to kill empty suffixes if Pa (J5).IR.Qual.Pofs in Tackon .. Suffix and then Ppl_On then null; elsif Pa (J5).IR.Qual.Pofs = Vpar then declare Trimmed_Next_Word : constant String := Next_Word; Part : constant Participle := Get_Pas_Participle (Pa (J5).IR.Qual.Vpar, Trimmed_Next_Word, Ppl_On, Compound_Tvm, Xp.Ppp_Meaning, Ppl_Info); begin Ppl_On := Part.Ppl_On; Ppl_Info := Part.Ppl_Info; Xp.Ppp_Meaning := Part.Ppp_Meaning; Compound_Tvm := Part.Compound_Tvm; end; else Pa (J5 .. Pa_Last - 1) := Pa (J5 + 1 .. Pa_Last); Pa_Last := Pa_Last - 1; Ppl_On := False; end if; end loop; end Do_Clear_Pas_Ppl; -- parts of these three do_clear_* functions should be factored together procedure Do_Clear_Pas_Supine (Supine_Info : out Supine_Record; Ppl_On : in out Boolean; Pa : in out Parse_Array; Pa_Last : in out Integer; Used_Next_Word : in out Boolean; Xp : in out Explanations) is begin for J6 in reverse 1 .. Pa_Last loop -- Sweep backwards to kill empty suffixes if Pa (J6).IR.Qual.Pofs in Tackon .. Suffix and then Ppl_On then null; elsif Pa (J6).IR.Qual.Pofs = Supine and then Pa (J6).IR.Qual.Supine.Of_Case = Acc then Ppl_On := True; Supine_Info := (Pa (J6).IR.Qual.Supine.Con, Pa (J6).IR.Qual.Supine.Of_Case, Pa (J6).IR.Qual.Supine.Number, Pa (J6).IR.Qual.Supine.Gender); Pa_Last := Pa_Last + 1; Pa (Pa_Last) := (Head ("SUPINE + iri", Max_Stem_Size), ((V, (Supine_Info.Con, (Fut, Passive, Inf), 0, X) ), 0, Null_Ending_Record, X, A), Ppp, Null_MNPC); Xp.Ppp_Meaning := Head ( "SUPINE + iri => " & "FUT PASSIVE INF - to be about/going/ready to be ~", Max_Meaning_Size); Used_Next_Word := True; else Pa (J6 .. Pa_Last - 1) := Pa (J6 + 1 .. Pa_Last); Pa_Last := Pa_Last - 1; Ppl_On := False; end if; end loop; end Do_Clear_Pas_Supine; procedure Perform_Syncope (Input_Word : in String; Pa : in out Parse_Array; Pa_Last : in out Integer; Xp : in out Explanations) is Sypa : Parse_Array (1 .. Syncope_Max) := (others => Null_Parse_Record); Sypa_Last : Integer := 0; begin Clear_Parse_Array (Sypa); -- FIXME: presumably redundant if Words_Mdev (Do_Syncope) and not No_Syncope then Syncope (Input_Word, Sypa, Sypa_Last, Xp); -- Make syncope another array to avoid PA-LAST = 0 problems Pa_Last := Pa_Last + Sypa_Last; -- Add SYPA to PA Pa (1 .. Pa_Last) := Pa (1 .. Pa_Last - Sypa_Last) & Sypa (1 .. Sypa_Last); -- Clean up so it does not repeat Sypa (1 .. Syncope_Max) := (1 .. Syncope_Max => Null_Parse_Record); Sypa_Last := 0; end if; No_Syncope := False; end Perform_Syncope; procedure Enclitic (Input_Word : String; Entering_Pa_Last : in out Integer; Have_Done_Enclitic : in out Boolean; Pa : in out Parse_Array; Pa_Last : in out Integer; Xp : in out Explanations) is Save_Do_Only_Fixes : constant Boolean := Words_Mdev (Do_Only_Fixes); Enclitic_Limit : Integer := 4; Try : constant String := Lower_Case (Input_Word); begin if Have_Done_Enclitic then return; end if; Entering_Pa_Last := Pa_Last; if Pa_Last > 0 then Enclitic_Limit := 1; end if; -- loop_over_enclitic_tackons: for I in 1 .. Enclitic_Limit loop -- If have parse, only do que of que, ne, ve, (est) -- remove_a_tackon: declare Less : constant String := Subtract_Tackon (Try, Tackons (I)); Save_Pa_Last : Integer := 0; begin if Less /= Try then -- LESS is less --WORDS_MODE (DO_FIXES) := FALSE; Word_Package.Word (Less, Pa, Pa_Last); if Pa_Last = 0 then Save_Pa_Last := Pa_Last; Try_Slury (Less, Pa, Pa_Last, Line_Number, Word_Number, Xp); if Save_Pa_Last /= 0 then if (Pa_Last - 1) - Save_Pa_Last = Save_Pa_Last then Pa_Last := Save_Pa_Last; end if; end if; end if; -- Do not SYNCOPE if there is a verb TO_BE or compound -- already there; I do this here and below, it might be -- combined but it workd now for I in 1 .. Pa_Last loop if Pa (I).IR.Qual.Pofs = V and then Pa (I).IR.Qual.Verb.Con = (5, 1) then No_Syncope := True; end if; end loop; Perform_Syncope (Input_Word, Pa, Pa_Last, Xp); -- Restore FIXES --WORDS_MODE (DO_FIXES) := SAVE_DO_FIXES; Words_Mdev (Do_Only_Fixes) := True; Word (Input_Word, Pa, Pa_Last); Words_Mdev (Do_Only_Fixes) := Save_Do_Only_Fixes; if Pa_Last > Entering_Pa_Last then -- have a possible word Pa_Last := Pa_Last + 1; Pa (Entering_Pa_Last + 2 .. Pa_Last) := Pa (Entering_Pa_Last + 1 .. Pa_Last - 1); Pa (Entering_Pa_Last + 1) := (Tackons (I).Tack, ((Tackon, Null_Tackon_Record), 0, Null_Ending_Record, X, X), Addons, Dict_IO.Count (Tackons (I).MNPC)); Have_Done_Enclitic := True; end if; return; end if; end; end loop; end Enclitic; procedure Tricks_Enclitic (Input_Word : String; Entering_Trpa_Last : in out Integer; Have_Done_Enclitic : Boolean; Trpa : in out Parse_Array; Trpa_Last : in out Integer; Xp : in out Explanations) is Try : constant String := Lower_Case (Input_Word); begin if Have_Done_Enclitic then return; end if; Entering_Trpa_Last := Trpa_Last; for I in 1 .. 4 loop -- que, ne, ve, (est) declare Less : constant String := Subtract_Tackon (Try, Tackons (I)); begin if Less /= Try then -- LESS is less Try_Tricks (Less, Trpa, Trpa_Last, Line_Number, Word_Number, Xp); if Trpa_Last > Entering_Trpa_Last then -- have a possible word Trpa_Last := Trpa_Last + 1; Trpa (Entering_Trpa_Last + 2 .. Trpa_Last) := Trpa (Entering_Trpa_Last + 1 .. Trpa_Last - 1); Trpa (Entering_Trpa_Last + 1) := (Tackons (I).Tack, ((Tackon, Null_Tackon_Record), 0, Null_Ending_Record, X, X), Addons, Dict_IO.Count (Tackons (I).MNPC)); end if; return; end if; end; end loop; end Tricks_Enclitic; procedure Pass (Input_Word : String; Entering_Pa_Last : in out Integer; Have_Done_Enclitic : in out Boolean; Pa : in out Parse_Array; Pa_Last : in out Integer; Xp : in out Explanations) is -- This is the core logic of the program, everything else is details Save_Do_Fixes : constant Boolean := Words_Mode (Do_Fixes); Save_Do_Only_Fixes : constant Boolean := Words_Mdev (Do_Only_Fixes); begin -- Do straight WORDS without FIXES/TRICKS, is the word in the dictionary Words_Mode (Do_Fixes) := False; Roman_Numerals (Input_Word, Pa, Pa_Last, Xp); Word (Input_Word, Pa, Pa_Last); if Pa_Last = 0 then Try_Slury (Input_Word, Pa, Pa_Last, Line_Number, Word_Number, Xp); end if; -- Do not SYNCOPE if there is a verb TO_BE or compound already there for I in 1 .. Pa_Last loop if Pa (I).IR.Qual.Pofs = V and then Pa (I).IR.Qual.Verb.Con = (5, 1) then No_Syncope := True; end if; end loop; -- Pure SYNCOPE Perform_Syncope (Input_Word, Pa, Pa_Last, Xp); -- There may be a valid simple parse, if so it is most probable -- But I have to allow for the possibility that -que is answer, -- not colloque V Enclitic (Input_Word, Entering_Pa_Last, Have_Done_Enclitic, Pa, Pa_Last, Xp); -- Restore FIXES Words_Mode (Do_Fixes) := Save_Do_Fixes; -- Now with only fixes if Pa_Last = 0 and then Words_Mode (Do_Fixes) then Words_Mdev (Do_Only_Fixes) := True; Word (Input_Word, Pa, Pa_Last); Perform_Syncope (Input_Word, Pa, Pa_Last, Xp); Enclitic (Input_Word, Entering_Pa_Last, Have_Done_Enclitic, Pa, Pa_Last, Xp); Words_Mdev (Do_Only_Fixes) := Save_Do_Only_Fixes; end if; end Pass; procedure Parse_English_Word (Input_Word : in String; Line : in String; K : in Integer; L2 : in Integer) is L : Integer := L2; Pofs : Part_Of_Speech_Type := X; begin -- Extract from the rest of the line -- Should do AUX here !!!!!!!!!!!!!!!!!!!!!!!! --extract_pofs: begin Part_Of_Speech_Type_IO.Get (Line (K + 1 .. L), Pofs, L); exception when others => Pofs := X; end; Search_English (Input_Word, Pofs); end Parse_English_Word; procedure Compounds_With_Sum (Pa : in out Parse_Array; Pa_Last : in out Integer; Next_Word : String; Used_Next_Word : in out Boolean; Xp : in out Explanations) is Compound_Tvm : Inflections_Package.Tense_Voice_Mood_Record; Ppl_On : Boolean := False; Sum_Info : Verb_Record := ((5, 1), (X, Active, X), 0, X); Ppl_Info : Vpar_Record := ((0, 0), X, X, X, (X, X, X)); Supine_Info : Supine_Record := ((0, 0), X, X, X); Is_Verb_To_Be : Boolean := False; begin declare Tmp : constant Verb_To_Be := Is_Sum (Next_Word); begin case Tmp.Matches is when True => Sum_Info := Tmp.Verb_Rec; when False => null; end case; Is_Verb_To_Be := Tmp.Matches; end; if Is_Verb_To_Be then -- On NEXT_WORD = sum, esse, iri for I in 1 .. Pa_Last loop -- Check for PPL declare Q : constant Quality_Record := Pa (I).IR.Qual; begin if Q.Pofs = Vpar and then Q.Vpar.Of_Case = Nom and then Q.Vpar.Number = Sum_Info.Number and then ((Q.Vpar.Tense_Voice_Mood = (Perf, Passive, Ppl)) or (Q.Vpar.Tense_Voice_Mood = (Fut, Active, Ppl)) or (Q.Vpar.Tense_Voice_Mood = (Fut, Passive, Ppl))) then -- There is at least one hit; -- fix PA, and advance J over the sum Used_Next_Word := True; exit; end if; end; end loop; if Used_Next_Word then -- There was a PPL hit Do_Clear_Pas_Nom_Ppl (Sum_Info, Compound_Tvm, Ppl_On, Ppl_Info, Pa, Pa_Last, Xp); Pa_Last := Pa_Last + 1; Pa (Pa_Last) := (Head ("PPL+" & Next_Word, Max_Stem_Size), ((V, (Ppl_Info.Con, Compound_Tvm, Sum_Info.Person, Sum_Info.Number) ), 0, Null_Ending_Record, X, A), Ppp, Null_MNPC); end if; elsif Is_Esse (Next_Word) or Is_Fuisse (Next_Word) then -- On NEXT_WORD for I in 1 .. Pa_Last loop -- Check for PPL declare Q : constant Quality_Record := Pa (I).IR.Qual; begin if Q.Pofs = Vpar and then (((Q.Vpar.Tense_Voice_Mood = (Perf, Passive, Ppl)) and Is_Esse (Next_Word)) or ((Q.Vpar.Tense_Voice_Mood = (Fut, Active, Ppl)) or (Q.Vpar.Tense_Voice_Mood = (Fut, Passive, Ppl)))) then -- There is at least one hit; -- fix PA, and advance J over the sum Used_Next_Word := True; exit; end if; end; end loop; if Used_Next_Word then -- There was a PPL hit Do_Clear_Pas_Ppl (Next_Word, Compound_Tvm, Ppl_On, Ppl_Info, Pa, Pa_Last, Xp); Pa_Last := Pa_Last + 1; Pa (Pa_Last) := (Head ("PPL+" & Next_Word, Max_Stem_Size), ((V, (Ppl_Info.Con, Compound_Tvm, 0, X) ), 0, Null_Ending_Record, X, A), Ppp, Null_MNPC); end if; elsif Is_Iri (Next_Word) then -- On NEXT_WORD = sum, esse, iri -- Look ahead for sum for J in 1 .. Pa_Last loop -- Check for SUPINE declare Q : constant Quality_Record := Pa (J).IR.Qual; begin if Q.Pofs = Supine and then Q.Supine.Of_Case = Acc then -- There is at least one hit; -- fix PA, and advance J over the iri Used_Next_Word := True; exit; end if; end; end loop; if Used_Next_Word then -- There was a SUPINE hit Do_Clear_Pas_Supine (Supine_Info, Ppl_On, Pa, Pa_Last, Used_Next_Word, Xp); end if; end if; -- On NEXT_WORD = sum, esse, iri end Compounds_With_Sum; -- the K variable is passed in as Input_Word'Last, but it can be modified -- by this routine, in the case where a multi-word compound is detected, -- e.g., "movendi sunt"; the value is read in the caller, and employed to -- update an iterator over the whole input line. Used_Next_Word is also -- set in these circumstances, but is currently unused -- in future, we shall pass in the next word, if any, in the input line -- to this function, obviating the need to go grovelling around further -- down the string, and saving wear and tear on variables like K function Parse_Latin_Word (Configuration : Configuration_Type; Input_Word : String; -- a trimmed single word Input_Line : String; -- what the user actually typed Next_Word : String ) return Word_Analysis_Result is Pa : Parse_Array (1 .. 100) := (others => Null_Parse_Record); Pa_Last : Integer := 0; Trpa : Parse_Array (1 .. Tricks_Max) := (others => Null_Parse_Record); Trpa_Last : Integer := 0; Entering_Pa_Last : Integer := 0; Entering_Trpa_Last : Integer := 0; Have_Done_Enclitic : Boolean := False; Used_Next_Word : Boolean := False; Xp : Explanations; -- to store the previously global state begin -- PARSE Xp.Xxx_Meaning := Null_Meaning_Type; -- This step is actually redundant; it is mentioned here simply to -- make it explicit that the contents of Pa are discarded after each -- word is handled; Pa and friends do not need to be package-global, -- but could have been local to this procedure Clear_Parse_Array (Pa); Clear_Parse_Array (Trpa); Pa_Last := 0; Word_Number := Word_Number + 1; Pass (Input_Word, Entering_Pa_Last, Have_Done_Enclitic, Pa, Pa_Last, Xp); --if (PA_LAST = 0) or DO_TRICKS_ANYWAY then -- WORD failed, try to modify the word if (Pa_Last = 0) and then not (Words_Mode (Ignore_Unknown_Names) and Capitalized) then -- WORD failed, try to modify the word if Words_Mode (Do_Tricks) then Words_Mode (Do_Tricks) := False; -- Turn it off so won't be circular Try_Tricks (Input_Word, Trpa, Trpa_Last, Line_Number, Word_Number, Xp); if Trpa_Last = 0 then Tricks_Enclitic (Input_Word, Entering_Trpa_Last, Have_Done_Enclitic, Trpa, Trpa_Last, Xp); end if; Words_Mode (Do_Tricks) := True; -- Turn it back on end if; Pa_Last := Pa_Last + Trpa_Last; -- Make TRICKS another array to avoid PA-LAST = 0 problems Pa (1 .. Pa_Last) := Pa (1 .. Pa_Last - Trpa_Last) & Trpa (1 .. Trpa_Last); -- Add SYPA to PA Trpa (1 .. Tricks_Max) := (1 .. Tricks_Max => Null_Parse_Record); -- Clean up so it does not repeat Trpa_Last := 0; end if; -- At this point we have done what we can with individual words -- Now see if there is something we can do with word combinations -- For this we have to look ahead if Pa_Last > 0 then -- But PA may be killed by ALLOW in LIST_STEMS if Words_Mode (Do_Compounds) and not (Configuration = Only_Meanings) then Compounds_With_Sum (Pa, Pa_Last, Next_Word, Used_Next_Word, Xp); end if; -- On WORDS_MODE (DO_COMPOUNDS) end if; declare WA : Word_Analysis; begin WA := Analyse_Word (Pa, Pa_Last, Input_Word, Xp); return (WA => WA, Used_Next_Word => Used_Next_Word); end; exception when others => Put_Stat ("Exception at " & Head (Integer'Image (Line_Number), 8) & Head (Integer'Image (Word_Number), 4) & " " & Head (Input_Word, 28) & " " & Input_Line); raise; end Parse_Latin_Word; function Is_Capitalized (Input_Word : String) return Boolean is begin if Input_Word'Length <= 1 then return False; end if; return Input_Word (Input_Word'First) in 'A' .. 'Z' and then Input_Word (Input_Word'First + 1) in 'a' .. 'z'; end Is_Capitalized; function Is_All_Caps (Input_Word : String) return Boolean is begin for I in Input_Word'Range loop if Input_Word (I) = Lower_Case (Input_Word (I)) then return False; end if; end loop; return True; end Is_All_Caps; procedure Do_Qvae_Kludge (W : in out String; J2, K : in Integer) is begin -- QVAE Kludge? No-one's seen QVAAKLUDES since the '70s! for I in J2 .. K - 1 loop if W (I) = 'Q' and then W (I + 1) = 'V' then W (I + 1) := 'U'; end if; end loop; end Do_Qvae_Kludge; function String_Before_Dash (S : String) return String is begin if Ada.Strings.Fixed.Index (S, "--") > S'First then return S (S'First .. Ada.Strings.Fixed.Index (S, "--")); else return S; end if; end String_Before_Dash; function Strip_Non_Alpha_Etc (S : String) return String is Twice : constant Integer := 2 * S'Length; S2 : String (1 .. Twice); J : Integer := S'First - 1; function Is_Alpha_Etc (C : Character) return Boolean is begin case C is when 'a' .. 'z' | 'A' .. 'Z' | ' ' | '.' => return True; when others => return False; end case; end Is_Alpha_Etc; begin for I in S'Range loop if Is_Alpha_Etc (S (I)) then J := J + 1; S2 (J) := S (I); if S (I) = '.' then J := J + 1; S2 (J) := ' '; end if; else J := J + 1; S2 (J) := ' '; end if; end loop; return S2 (1 .. J); end Strip_Non_Alpha_Etc; function Make_Words (Line : String) return Word_Container.Vector is Words : Word_Container.Vector; Indices : array (Line'Range) of Natural; Next_Index : Natural := Indices'First; begin if Line'Length = 0 then return Words; end if; Indices (Next_Index) := Line'First; while Indices (Next_Index) < Line'Last loop Next_Index := Next_Index + 1; Indices (Next_Index) := 1 + Ada.Strings.Fixed.Index (Line (Indices (Next_Index - 1) .. Line'Last), " "); if Indices (Next_Index) = 1 then Indices (Next_Index) := Line'Last + 2; end if; declare S : constant String := Line ( Indices (Next_Index - 1) .. Indices (Next_Index) - 2); begin if S /= "" and S /= "." then Words.Append (To_Unbounded_String (S)); end if; end; end loop; return Words; end Make_Words; -- forward declarations for exception handlers procedure Report_Storage_Error; procedure Report_Unknown_Error (Input_Line : String); -- Analyse_Line (..., Input_Line : String) -- -- This procedure massages the Input_Line, dealing with capitalisation, -- punctuation, trimming, and so on; it splits the line into separate -- words, and tries to look them up. -- -- When looking up English words, it only deals with the first word of -- input; similarly, an option can be specified to make it only look up -- the first Latin word on a line. -- Before the main loop, we convert all non-alpha characters to spaces, -- where non-alpha means the complement of [a-zA-Z.-] -- What the main loop actually does: -- -- ignore everything after a double dash -- -- set (Followed_By_Period, Capitalized, All_Caps) appropriately -- -- apply QVAE kludge -- -- if doing English, do first word then quit -- otherwise, we are doing Latin, so do a word -- quit after first word if appropriate config value set function Analyse_Line (Configuration : Configuration_Type; Input_Line : String) return Result_Container.Vector is L : constant Integer := Trim (Input_Line)'Last; Line : String (1 .. 2500) := (others => ' '); Used_Next_Word : Boolean := False; Undashed : constant String := String_Before_Dash (Input_Line); Stripped : constant String := Strip_Non_Alpha_Etc (Undashed); S : constant Word_Container.Vector := Make_Words (Stripped); Analyses : Result_Container.Vector; function Word_After (I : Count_Type) return String is begin if I + 1 >= S.Length then return ""; else return To_String (Element (Container => S, Index => Integer'Val (I + 1))); end if; end Word_After; begin Word_Number := 0; Line (1 .. L) := Trim (Input_Line); for I in 0 .. (S.Length - 1) loop if Used_Next_Word then Used_Next_Word := False; goto Continue; end if; Followed_By_Period := False; Used_Next_Word := False; declare W : String := To_String (Element (Container => S, Index => Integer'Val (I))); Last : Integer := W'Last; Next_Word : constant String := Word_After (I); begin if W (W'Last) = '.' then Followed_By_Period := True; Last := W'Last - 1; end if; Do_Qvae_Kludge (W, W'First, Last); declare Input_Word : constant String := W (W'First .. Last); Result : Word_Analysis_Result; begin Capitalized := Is_Capitalized (Input_Word); All_Caps := Is_All_Caps (Input_Word); if Language = English_To_Latin then Parse_English_Word (Input_Word, Line, Last, L); exit; end if; Result := Parse_Latin_Word (Configuration, Input_Word, Input_Line, Next_Word); Used_Next_Word := Result.Used_Next_Word; Analyses.Append (Result.WA); end; end; <<Continue>> exit when Words_Mdev (Do_Only_Initial_Word); end loop; return Analyses; end Analyse_Line; procedure Parse_Line (Configuration : Configuration_Type; Input_Line : String) is Undashed : constant String := String_Before_Dash (Input_Line); -- hack around the weird reimplementation of output redirection procedure Put_Analysis (A_Cursor : Result_Container.Cursor) is Analysis : constant Word_Analysis := Element (Position => A_Cursor); type File_Type_Access is access constant Ada.Text_IO.File_Type; O : File_Type_Access; begin if Words_Mode (Write_Output_To_File) then O := Output'Access; else O := Current_Output.all'Access; -- Current_Output is a proc end if; List_Stems (Configuration, O.all, Analysis, Undashed); end Put_Analysis; procedure Print_Analyses (Analyses : Result_Container.Vector) is begin Analyses.Iterate (Process => Put_Analysis'Access); end Print_Analyses; begin declare Analyses : Result_Container.Vector := Analyse_Line (Configuration, Input_Line); begin Print_Analyses (Analyses); Clear (Analyses); end; exception when Storage_Error => Report_Storage_Error; if Storage_Error_Count >= 4 then raise; end if; when Give_Up => raise; when others => Report_Unknown_Error (Input_Line); raise; end Parse_Line; procedure Report_Storage_Error is begin if Words_Mdev (Do_Pearse_Codes) then --Ada.Text_IO.Put ("00 "); Ada.Text_IO.Put (Pearse_Code.Format (Unknown)); end if; Ada.Text_IO.Put_Line ( -- ERROR_FILE, "STORAGE_ERROR Exception in WORDS, try again"); Storage_Error_Count := Storage_Error_Count + 1; end Report_Storage_Error; procedure Report_Unknown_Error (Input_Line : String) is begin Ada.Text_IO.Put_Line ( -- ERROR_FILE, "Exception in PARSE_LINE processing " & Input_Line); if Words_Mode (Write_Unknowns_To_File) then if Words_Mdev (Do_Pearse_Codes) then Ada.Text_IO.Put (Unknowns, Pearse_Code.Format (Unknown)); end if; Ada.Text_IO.Put (Unknowns, Input_Line); Ada.Text_IO.Set_Col (Unknowns, 30); Inflections_Package.Integer_IO.Put (Unknowns, Line_Number, 5); Inflections_Package.Integer_IO.Put (Unknowns, Word_Number, 3); Ada.Text_IO.Put_Line (Unknowns, " ======== ERROR "); end if; end Report_Unknown_Error; end Words_Engine.Parse;
with Ada.Text_IO; with Ada.Containers.Ordered_Sets; package body Problem_42 is -- The nth term of the sequence of triangle numbers is given by t_n = 1/2n(n+1); -- so the first ten triangle numbers are: -- 1, 3, 6, 10, 15, 21, 28, 36, 45, 55 -- -- By converting each letter in a word to a number corresponding to its -- alphabetical position and adding these values we form a word value. For -- example, the word value for SKY is 19 + 11 + 25 = 55 = t_10. If the word -- value is a triangle number then we shall call the word a triangle word. -- -- Using words.txt (right click and 'Save Link/Target As...'), a 16K text -- file containing nearly two-thousand common English words, how many are -- triangle words? package IO renames Ada.Text_IO; package Triangle_Set is new Ada.Containers.Ordered_Sets(Element_Type => Positive); procedure Solve is input : IO.File_Type; triangles : Triangle_Set.Set; max_triangle : Positive; max_triangle_index : Positive; sum : Natural := 0; triangle_count : Natural := 0; procedure Ensure_Triangles_To(max : Positive) is begin while max_triangle < max loop max_triangle_index := max_triangle_index + 1; max_triangle := max_triangle_index * (max_triangle_index + 1) / 2; triangles.Insert(max_triangle); end loop; end; begin triangles.Insert(1); max_triangle := 1; max_triangle_index := 1; IO.Open(input, IO.In_File, "input/Problem_42.txt"); while not IO.End_Of_File(input) loop declare c : character; begin IO.Get(input, c); sum := sum + Character'Pos(c) - Character'Pos('A') + 1; if IO.End_Of_Line(input) then Ensure_Triangles_To(sum); if triangles.Contains(sum) then triangle_count := Natural'Succ(triangle_count); end if; sum := 0; end if; end; end loop; IO.Put_Line(Natural'Image(triangle_count)); end Solve; end Problem_42;
-- { dg-do compile } -- { dg-error "not marked Inline_Always" "" { target *-*-* } 0 } -- { dg-error "cannot be inlined" "" { target *-*-* } 0 } with Inline3_Pkg; use Inline3_Pkg; procedure Inline3 is begin Test (0); end;
-- Ada_GUI implementation based on Gnoga. Adapted 2021 -- -- -- GNOGA - The GNU Omnificent GUI for Ada -- -- -- -- G N O G A . G U I . V I E W . G R I D -- -- -- -- B o d y -- -- -- -- -- -- Copyright (C) 2014 David Botton -- -- -- -- This library is free software; you can redistribute it and/or modify -- -- it under terms of the GNU General Public License as published by the -- -- Free Software Foundation; either version 3, or (at your option) any -- -- later version. This library is distributed in the hope that it will be -- -- useful, but WITHOUT ANY WARRANTY; without even the implied warranty of -- -- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. -- -- -- -- As a special exception under Section 7 of GPL version 3, you are -- -- granted additional permissions described in the GCC Runtime Library -- -- Exception, version 3.1, as published by the Free Software Foundation. -- -- -- -- You should have received a copy of the GNU General Public License and -- -- a copy of the GCC Runtime Library Exception along with this program; -- -- see the files COPYING3 and COPYING.RUNTIME respectively. If not, see -- -- <http://www.gnu.org/licenses/>. -- -- -- -- As a special exception, if other files instantiate generics from this -- -- unit, or you link this unit with other files to produce an executable, -- -- this unit does not by itself cause the resulting executable to be -- -- covered by the GNU General Public License. This exception does not -- -- however invalidate any other reasons why the executable file might be -- -- covered by the GNU Public License. -- -- -- -- For more information please go to http://www.gnoga.com -- ------------------------------------------------------------------------------ with Ada.Strings.Unbounded; with Ada_GUI.Gnoga.Server.Connection; with Ada_GUI.Gnoga.Gui.Window; package body Ada_GUI.Gnoga.Gui.View.Grid is ------------ -- Create -- ------------ procedure Create (Grid : in out Grid_View_Type; Parent : in out Gnoga.Gui.Base_Type'Class; Layout : in Grid_Rows_Type; Fill_Parent : in Boolean := True; Set_Sizes : in Boolean := True; ID : in String := "") is use Ada.Strings.Unbounded; C : Unbounded_String; CID : constant String := Gnoga.Server.Connection.New_GID; N : Natural; Span_Size : Natural; Column : Positive; P_Height : constant String := Left_Trim (Integer (100 / Layout'Length (1))'Img) & "%"; P_Width : constant String := Left_Trim (Integer (100 / Layout'Length (2))'Img) & "%"; Column_Object : View_Base_Access := null; function TD_Width return String; function TD_Width return String is begin if Set_Sizes then return " width:" & P_Width & ";"; else return ""; end if; end TD_Width; begin if Parent in Gnoga.Gui.Window.Window_Type'Class then C := To_Unbounded_String ("<div style='position:relative'>"); end if; C := C & "<table style='" & " position:relative;" & " border-spacing: 0px; border-collapse: collapse;"; if Fill_Parent then C := C & " width:100%; height:100%;'>"; else C := C & "'>"; end if; N := 0; for Row in Layout'Range (1) loop C := C & "<tr>"; Column := Layout'First (2); Span_Size := 0; loop if Layout (Row, Column) = COL then N := N + 1; C := C & "<td style='" & TD_Width & " position:relative;" & " padding:0; text-align: left; vertical-align: top;" & "' id='" & CID & "_" & Left_Trim (N'Img) & "'"; Span_Size := 1; elsif Layout (Row, Column) = SPN then Span_Size := Span_Size + 1; end if; Column := Column + 1; if Column > Layout'Last (2) or else Layout (Row, Column) = COL then if Span_Size > 0 then if Span_Size > 1 then C := C & " colspan=" & Left_Trim (Span_Size'Img); end if; C := C & " />"; end if; end if; exit when Column > Layout'Last (2); end loop; C := C & "</tr>"; end loop; C := C & "</table>"; if Parent in Gnoga.Gui.Window.Window_Type'Class then C := C & "</div>"; end if; Grid.Create_From_HTML (Parent, Escape_Quotes (To_String (C)), ID); N := 0; for Row in Layout'Range (1) loop Column := Layout'First (2); Span_Size := 0; loop if Layout (Row, Column) = COL then N := N + 1; Span_Size := 1; Column_Object := new View_Base_Type; Column_Object.Auto_Place (False); Column_Object.Dynamic (True); Column_Object.Attach_Using_Parent (Grid, CID & "_" & Left_Trim (N'Img)); Column_Object.Parent (Grid); if Column = Layout'First (2) and Row = Layout'First (1) then Column_Object.Box_Height (P_Height); end if; elsif Layout (Row, Column) = SPN then Span_Size := Span_Size + 1; end if; declare Address : constant String := Left_Trim (Row'Img) & "_" & Left_Trim (Column'Img); begin Grid.Add_Element (Address, Gnoga.Gui.Element.Pointer_To_Element_Class (Column_Object)); end; Column := Column + 1; exit when Column > Layout'Last (2); end loop; end loop; end Create; ----------- -- Panel -- ----------- function Panel (Grid : Grid_View_Type; Row, Column : Positive) return Pointer_To_View_Base_Class is Address : constant String := Left_Trim (Row'Img) & "_" & Left_Trim (Column'Img); begin return Pointer_To_View_Base_Class (Grid.Element (Address)); end Panel; end Ada_GUI.Gnoga.Gui.View.Grid;
<AnimDB FragDef="chrysalis/characters/human/male/male_fragment_ids.xml" TagDef="chrysalis/characters/human/male/male_tags.xml"> <FragmentList> <Idle> <Fragment BlendOutDuration="0.2" Tags="Alerted+ScopeLookPose"> <ProcLayer> <Blend ExitTime="0" StartTime="0" Duration="0.30000001"/> <Procedural type="Looking"> <ProceduralParams CryXmlVersion="2"/> </Procedural> </ProcLayer> </Fragment> <Fragment BlendOutDuration="0.2" Tags="Unaware"> <AnimLayer> <Blend ExitTime="0" StartTime="0" Duration="0.2"/> <Animation name="stand_relaxed_idle" flags="Loop"/> </AnimLayer> </Fragment> <Fragment BlendOutDuration="0.2" Tags="Crouching+ScopeLookPose"> <ProcLayer> <Blend ExitTime="0" StartTime="0" Duration="0.30000001"/> <Procedural type="Looking"> <ProceduralParams CryXmlVersion="2"/> </Procedural> </ProcLayer> </Fragment> <Fragment BlendOutDuration="0.2" Tags="Crouching"> <AnimLayer> <Blend ExitTime="0" StartTime="0" Duration="0.2"/> <Animation name="crouch_idle"/> </AnimLayer> </Fragment> <Fragment BlendOutDuration="0.2" Tags="Crouching"> <AnimLayer> <Blend ExitTime="0" StartTime="0" Duration="0.2"/> <Animation name="crouch_idle_v2"/> </AnimLayer> </Fragment> <Fragment BlendOutDuration="0.2" Tags="ScopeLookPose"> <ProcLayer> <Blend ExitTime="0" StartTime="0" Duration="0.30000001"/> <Procedural type="Looking"> <ProceduralParams CryXmlVersion="2"/> </Procedural> </ProcLayer> </Fragment> <Fragment BlendOutDuration="0.2" Tags=""> <AnimLayer> <Blend ExitTime="0" StartTime="0" Duration="0.2"/> <Animation name="stand_relaxed_idle" flags="Loop"/> </AnimLayer> </Fragment> </Idle> <Move> <Fragment BlendOutDuration="0.2" Tags="Crouching"> <AnimLayer> <Blend ExitTime="0" StartTime="0" Duration="0.2"/> <Animation name="bspace_2d_move_strafe_crouch" flags="Loop"/> </AnimLayer> </Fragment> <Fragment BlendOutDuration="0.2" Tags="ScopeLookPose"> <ProcLayer> <Blend ExitTime="0" StartTime="0" Duration="0.30000001"/> <Procedural type="Looking"> <ProceduralParams CryXmlVersion="2"/> </Procedural> </ProcLayer> </Fragment> <Fragment BlendOutDuration="0.2" Tags=""> <AnimLayer> <Blend ExitTime="0" StartTime="0" Duration="0.2"/> <Animation name="bspace_2d_move_strafe" flags="Loop"/> </AnimLayer> </Fragment> </Move> <Interaction> <Fragment BlendOutDuration="0.2" Tags="ScopeSlave"> <AnimLayer> <Blend ExitTime="0" StartTime="0" Duration="0.2"/> <Animation name="crouchwalk_l"/> </AnimLayer> </Fragment> <Fragment BlendOutDuration="0.2" Tags="ScopeLookPose"> <ProcLayer> <Blend ExitTime="0" StartTime="0" Duration="0.30000001"/> <Procedural type="Looking"> <ProceduralParams CryXmlVersion="2"/> </Procedural> </ProcLayer> </Fragment> <Fragment BlendOutDuration="0.2" Tags=""> <AnimLayer> <Blend ExitTime="0" StartTime="0" Duration="0.2"/> <Animation name="picking_up_object"/> </AnimLayer> </Fragment> </Interaction> <Emote> <Fragment BlendOutDuration="0.2" Tags="Awe"> <AnimLayer> <Blend ExitTime="0" StartTime="0" Duration="0.2"/> <Animation name="crouch_r_90"/> </AnimLayer> </Fragment> <Fragment BlendOutDuration="0.2" Tags="Apathy"> <AnimLayer> <Blend ExitTime="0" StartTime="0" Duration="0.2"/> <Animation name="crouch_l_135"/> </AnimLayer> </Fragment> <Fragment BlendOutDuration="0.2" Tags="ScopeLookPose"> <ProcLayer> <Blend ExitTime="0" StartTime="0" Duration="0.30000001"/> <Procedural type="Looking"> <ProceduralParams CryXmlVersion="2"/> </Procedural> </ProcLayer> </Fragment> <Fragment BlendOutDuration="0.2" Tags=""> <AnimLayer> <Blend ExitTime="0" StartTime="0" Duration="0.2"/> <Animation name="crouch_to_crouchwalk_b"/> </AnimLayer> </Fragment> </Emote> <Looking> <Fragment BlendOutDuration="0.2" Tags="ScopeLooking"> <ProcLayer> <Blend ExitTime="0" StartTime="0" Duration="0.30000001"/> <Procedural type="Looking"> <ProceduralParams CryXmlVersion="2"/> </Procedural> </ProcLayer> </Fragment> <Fragment BlendOutDuration="0.2" Tags=""/> </Looking> <LookPose> <Fragment BlendOutDuration="0.2" Tags="ScopeLookPose"> <ProcLayer> <Blend ExitTime="0" StartTime="0" Duration="0.30000001"/> <Procedural type="Looking"> <ProceduralParams CryXmlVersion="2"/> </Procedural> </ProcLayer> </Fragment> <Fragment BlendOutDuration="0.2" Tags=""/> </LookPose> </FragmentList> </AnimDB>
with Ada.Text_IO; with Ada.Strings.Unbounded; use Ada.Strings.Unbounded; with TOML; procedure Main is Table1 : constant TOML.TOML_Value := TOML.Create_Table; Table2 : constant TOML.TOML_Value := TOML.Create_Table; Table3 : constant TOML.TOML_Value := TOML.Create_Table; Arr : constant TOML.TOML_Value := TOML.Create_Array; begin -- Populate tables Table1.Set ("a", TOML.Create_Integer (1)); Arr.Append (TOML.Create_Integer (1)); Table2.Set ("b", Arr); Table3.Set ("a", TOML.Create_Integer (3)); -- With the resolver-less Merge overload, expect a constraint error on -- duplicate keys. declare Dummy : TOML.TOML_Value; begin Dummy := TOML.Merge (Table1, Table3); Ada.Text_IO.Put_Line ("No exception..."); exception when Constraint_Error => Ada.Text_IO.Put_Line ("Merging two tables with duplicate keys raises an exception"); end; Ada.Text_IO.New_Line; -- With the resolver overload, check that conflicts are resolved as -- expected Ada.Text_IO.Put_Line ("Merging with conflict resolution..."); declare function Merge_Entries (Key : TOML.Unbounded_UTF8_String; L, R : TOML.TOML_Value) return TOML.TOML_Value is (TOML.Create_String (Key & ": " & L.As_String & " | " & R.As_String)); L : constant TOML.TOML_Value := TOML.Create_Table; R : constant TOML.TOML_Value := TOML.Create_Table; Merged : TOML.TOML_Value; begin L.Set ("a", TOML.Create_String ("good")); L.Set ("b", TOML.Create_String ("hello")); R.Set ("b", TOML.Create_String ("world")); R.Set ("c", TOML.Create_String ("bye")); Merged := TOML.Merge (L, R, Merge_Entries'Access); Ada.Text_IO.Put_Line (Merged.Dump_As_String); end; declare Merged : constant TOML.TOML_Value := TOML.Merge (Table1, Table2); begin -- Change array value to see the shallow copy modified Arr.Append (TOML.Create_Integer (2)); Ada.Text_IO.Put_Line ("Merged table:"); Ada.Text_IO.Put_Line (Merged.Dump_As_String); end; end Main;
package body agar.gui.widget.fixed is package cbinds is procedure put (fixed : fixed_access_t; child : child_access_t; x : c.int; y : c.int); pragma import (c, put, "AG_FixedPut"); procedure size (fixed : fixed_access_t; child : child_access_t; width : c.int; height : c.int); pragma import (c, size, "AG_FixedSize"); procedure move (fixed : fixed_access_t; child : child_access_t; x : c.int; y : c.int); pragma import (c, move, "AG_FixedMove"); end cbinds; procedure put (fixed : fixed_access_t; child : child_access_t; x : natural; y : natural) is begin cbinds.put (fixed => fixed, child => child, x => c.int (x), y => c.int (y)); end put; procedure size (fixed : fixed_access_t; child : child_access_t; width : positive; height : positive) is begin cbinds.size (fixed => fixed, child => child, width => c.int (width), height => c.int (height)); end size; procedure move (fixed : fixed_access_t; child : child_access_t; x : natural; y : natural) is begin cbinds.move (fixed => fixed, child => child, x => c.int (x), y => c.int (y)); end move; function widget (fixed : fixed_access_t) return widget_access_t is begin return fixed.widget'unchecked_access; end widget; end agar.gui.widget.fixed;
-- SPDX-License-Identifier: Apache-2.0 -- -- Copyright (c) 2019 onox <denkpadje@gmail.com> -- -- Licensed under the Apache License, Version 2.0 (the "License"); -- you may not use this file except in compliance with the License. -- You may obtain a copy of the License at -- -- http://www.apache.org/licenses/LICENSE-2.0 -- -- Unless required by applicable law or agreed to in writing, software -- distributed under the License is distributed on an "AS IS" BASIS, -- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -- See the License for the specific language governing permissions and -- limitations under the License. with Orka.Rendering.Buffers; with Orka.Resources.Locations; with Orka.Transforms.Singles.Matrices; private with GL.Low_Level.Enums; private with Orka.Rendering.Programs.Uniforms; package Orka.Rendering.Debug.Bounding_Boxes is pragma Preelaborate; package Transforms renames Orka.Transforms.Singles.Matrices; type Bounding_Box is tagged private; function Create_Bounding_Box (Location : Resources.Locations.Location_Ptr; Color : Transforms.Vector4 := (1.0, 1.0, 1.0, 1.0)) return Bounding_Box; procedure Render (Object : in out Bounding_Box; View, Proj : Transforms.Matrix4; Transforms, Bounds : Rendering.Buffers.Bindable_Buffer'Class) with Pre => 2 * Transforms.Length = Bounds.Length; -- Render a bounding box for each transform and bounds -- -- The bounds of a bounding box consists of two vectors. private package LE renames GL.Low_Level.Enums; type Bounding_Box is tagged record Program : Rendering.Programs.Program; Uniform_Visible : Programs.Uniforms.Uniform (LE.Bool_Type); Uniform_View : Programs.Uniforms.Uniform (LE.Single_Matrix4); Uniform_Proj : Programs.Uniforms.Uniform (LE.Single_Matrix4); end record; end Orka.Rendering.Debug.Bounding_Boxes;
-- This file is generated by SWIG. Please do not modify by hand. -- with Interfaces.C; with Interfaces.C.Pointers; package xcb.Pointers is -- xcb_connection_t_Pointer -- package C_xcb_connection_t_Pointers is new interfaces.c.Pointers (Index => interfaces.c.size_t, Element => xcb.xcb_connection_t, element_Array => xcb.xcb_connection_t_Array, default_Terminator => 0); subtype xcb_connection_t_Pointer is C_xcb_connection_t_Pointers.Pointer; -- xcb_connection_t_Pointer_Array -- type xcb_connection_t_Pointer_Array is array (Interfaces.C.size_t range <>) of aliased xcb.Pointers .xcb_connection_t_Pointer; -- xcb_special_event_t_Pointer -- package C_xcb_special_event_t_Pointers is new interfaces.c.Pointers (Index => interfaces.c.size_t, Element => xcb.xcb_special_event_t, element_Array => xcb.xcb_special_event_t_Array, default_Terminator => 0); subtype xcb_special_event_t_Pointer is C_xcb_special_event_t_Pointers.Pointer; -- xcb_special_event_t_Pointer_Array -- type xcb_special_event_t_Pointer_Array is array (Interfaces.C.size_t range <>) of aliased xcb.Pointers .xcb_special_event_t_Pointer; -- xcb_window_t_Pointer -- package C_xcb_window_t_Pointers is new Interfaces.C.Pointers (Index => Interfaces.C.size_t, Element => xcb.xcb_window_t, Element_Array => xcb.xcb_window_t_array, Default_Terminator => 0); subtype xcb_window_t_Pointer is C_xcb_window_t_Pointers.Pointer; -- xcb_window_t_Pointer_Array -- type xcb_window_t_Pointer_Array is array (Interfaces.C.size_t range <>) of aliased xcb.Pointers .xcb_window_t_Pointer; -- xcb_pixmap_t_Pointer -- package C_xcb_pixmap_t_Pointers is new Interfaces.C.Pointers (Index => Interfaces.C.size_t, Element => xcb.xcb_pixmap_t, Element_Array => xcb.xcb_pixmap_t_array, Default_Terminator => 0); subtype xcb_pixmap_t_Pointer is C_xcb_pixmap_t_Pointers.Pointer; -- xcb_pixmap_t_Pointer_Array -- type xcb_pixmap_t_Pointer_Array is array (Interfaces.C.size_t range <>) of aliased xcb.Pointers .xcb_pixmap_t_Pointer; -- xcb_cursor_t_Pointer -- package C_xcb_cursor_t_Pointers is new Interfaces.C.Pointers (Index => Interfaces.C.size_t, Element => xcb.xcb_cursor_t, Element_Array => xcb.xcb_cursor_t_array, Default_Terminator => 0); subtype xcb_cursor_t_Pointer is C_xcb_cursor_t_Pointers.Pointer; -- xcb_cursor_t_Pointer_Array -- type xcb_cursor_t_Pointer_Array is array (Interfaces.C.size_t range <>) of aliased xcb.Pointers .xcb_cursor_t_Pointer; -- xcb_font_t_Pointer -- package C_xcb_font_t_Pointers is new Interfaces.C.Pointers (Index => Interfaces.C.size_t, Element => xcb.xcb_font_t, Element_Array => xcb.xcb_font_t_array, Default_Terminator => 0); subtype xcb_font_t_Pointer is C_xcb_font_t_Pointers.Pointer; -- xcb_font_t_Pointer_Array -- type xcb_font_t_Pointer_Array is array (Interfaces.C.size_t range <>) of aliased xcb.Pointers .xcb_font_t_Pointer; -- xcb_gcontext_t_Pointer -- package C_xcb_gcontext_t_Pointers is new Interfaces.C.Pointers (Index => Interfaces.C.size_t, Element => xcb.xcb_gcontext_t, Element_Array => xcb.xcb_gcontext_t_array, Default_Terminator => 0); subtype xcb_gcontext_t_Pointer is C_xcb_gcontext_t_Pointers.Pointer; -- xcb_gcontext_t_Pointer_Array -- type xcb_gcontext_t_Pointer_Array is array (Interfaces.C.size_t range <>) of aliased xcb.Pointers .xcb_gcontext_t_Pointer; -- xcb_colormap_t_Pointer -- package C_xcb_colormap_t_Pointers is new Interfaces.C.Pointers (Index => Interfaces.C.size_t, Element => xcb.xcb_colormap_t, Element_Array => xcb.xcb_colormap_t_array, Default_Terminator => 0); subtype xcb_colormap_t_Pointer is C_xcb_colormap_t_Pointers.Pointer; -- xcb_colormap_t_Pointer_Array -- type xcb_colormap_t_Pointer_Array is array (Interfaces.C.size_t range <>) of aliased xcb.Pointers .xcb_colormap_t_Pointer; -- xcb_atom_t_Pointer -- package C_xcb_atom_t_Pointers is new Interfaces.C.Pointers (Index => Interfaces.C.size_t, Element => xcb.xcb_atom_t, Element_Array => xcb.xcb_atom_t_array, Default_Terminator => 0); subtype xcb_atom_t_Pointer is C_xcb_atom_t_Pointers.Pointer; -- xcb_atom_t_Pointer_Array -- type xcb_atom_t_Pointer_Array is array (Interfaces.C.size_t range <>) of aliased xcb.Pointers .xcb_atom_t_Pointer; -- xcb_drawable_t_Pointer -- package C_xcb_drawable_t_Pointers is new Interfaces.C.Pointers (Index => Interfaces.C.size_t, Element => xcb.xcb_drawable_t, Element_Array => xcb.xcb_drawable_t_array, Default_Terminator => 0); subtype xcb_drawable_t_Pointer is C_xcb_drawable_t_Pointers.Pointer; -- xcb_drawable_t_Pointer_Array -- type xcb_drawable_t_Pointer_Array is array (Interfaces.C.size_t range <>) of aliased xcb.Pointers .xcb_drawable_t_Pointer; -- xcb_fontable_t_Pointer -- package C_xcb_fontable_t_Pointers is new Interfaces.C.Pointers (Index => Interfaces.C.size_t, Element => xcb.xcb_fontable_t, Element_Array => xcb.xcb_fontable_t_array, Default_Terminator => 0); subtype xcb_fontable_t_Pointer is C_xcb_fontable_t_Pointers.Pointer; -- xcb_fontable_t_Pointer_Array -- type xcb_fontable_t_Pointer_Array is array (Interfaces.C.size_t range <>) of aliased xcb.Pointers .xcb_fontable_t_Pointer; -- xcb_bool32_t_Pointer -- package C_xcb_bool32_t_Pointers is new Interfaces.C.Pointers (Index => Interfaces.C.size_t, Element => xcb.xcb_bool32_t, Element_Array => xcb.xcb_bool32_t_array, Default_Terminator => 0); subtype xcb_bool32_t_Pointer is C_xcb_bool32_t_Pointers.Pointer; -- xcb_bool32_t_Pointer_Array -- type xcb_bool32_t_Pointer_Array is array (Interfaces.C.size_t range <>) of aliased xcb.Pointers .xcb_bool32_t_Pointer; -- xcb_visualid_t_Pointer -- package C_xcb_visualid_t_Pointers is new Interfaces.C.Pointers (Index => Interfaces.C.size_t, Element => xcb.xcb_visualid_t, Element_Array => xcb.xcb_visualid_t_array, Default_Terminator => 0); subtype xcb_visualid_t_Pointer is C_xcb_visualid_t_Pointers.Pointer; -- xcb_visualid_t_Pointer_Array -- type xcb_visualid_t_Pointer_Array is array (Interfaces.C.size_t range <>) of aliased xcb.Pointers .xcb_visualid_t_Pointer; -- xcb_timestamp_t_Pointer -- package C_xcb_timestamp_t_Pointers is new Interfaces.C.Pointers (Index => Interfaces.C.size_t, Element => xcb.xcb_timestamp_t, Element_Array => xcb.xcb_timestamp_t_array, Default_Terminator => 0); subtype xcb_timestamp_t_Pointer is C_xcb_timestamp_t_Pointers.Pointer; -- xcb_timestamp_t_Pointer_Array -- type xcb_timestamp_t_Pointer_Array is array (Interfaces.C.size_t range <>) of aliased xcb.Pointers .xcb_timestamp_t_Pointer; -- xcb_keysym_t_Pointer -- package C_xcb_keysym_t_Pointers is new Interfaces.C.Pointers (Index => Interfaces.C.size_t, Element => xcb.xcb_keysym_t, Element_Array => xcb.xcb_keysym_t_array, Default_Terminator => 0); subtype xcb_keysym_t_Pointer is C_xcb_keysym_t_Pointers.Pointer; -- xcb_keysym_t_Pointer_Array -- type xcb_keysym_t_Pointer_Array is array (Interfaces.C.size_t range <>) of aliased xcb.Pointers .xcb_keysym_t_Pointer; -- xcb_keycode_t_Pointer -- package C_xcb_keycode_t_Pointers is new Interfaces.C.Pointers (Index => Interfaces.C.size_t, Element => xcb.xcb_keycode_t, Element_Array => xcb.xcb_keycode_t_array, Default_Terminator => 0); subtype xcb_keycode_t_Pointer is C_xcb_keycode_t_Pointers.Pointer; -- xcb_keycode_t_Pointer_Array -- type xcb_keycode_t_Pointer_Array is array (Interfaces.C.size_t range <>) of aliased xcb.Pointers .xcb_keycode_t_Pointer; -- xcb_keycode32_t_Pointer -- package C_xcb_keycode32_t_Pointers is new Interfaces.C.Pointers (Index => Interfaces.C.size_t, Element => xcb.xcb_keycode32_t, Element_Array => xcb.xcb_keycode32_t_array, Default_Terminator => 0); subtype xcb_keycode32_t_Pointer is C_xcb_keycode32_t_Pointers.Pointer; -- xcb_keycode32_t_Pointer_Array -- type xcb_keycode32_t_Pointer_Array is array (Interfaces.C.size_t range <>) of aliased xcb.Pointers .xcb_keycode32_t_Pointer; -- xcb_button_t_Pointer -- package C_xcb_button_t_Pointers is new Interfaces.C.Pointers (Index => Interfaces.C.size_t, Element => xcb.xcb_button_t, Element_Array => xcb.xcb_button_t_array, Default_Terminator => 0); subtype xcb_button_t_Pointer is C_xcb_button_t_Pointers.Pointer; -- xcb_button_t_Pointer_Array -- type xcb_button_t_Pointer_Array is array (Interfaces.C.size_t range <>) of aliased xcb.Pointers .xcb_button_t_Pointer; -- xcb_visual_class_t_Pointer -- package C_xcb_visual_class_t_Pointers is new Interfaces.C.Pointers (Index => Interfaces.C.size_t, Element => xcb.xcb_visual_class_t, Element_Array => xcb.xcb_visual_class_t_array, Default_Terminator => xcb.xcb_visual_class_t'Val (0)); subtype xcb_visual_class_t_Pointer is C_xcb_visual_class_t_Pointers.Pointer; -- xcb_visual_class_t_Pointer_Array -- type xcb_visual_class_t_Pointer_Array is array (Interfaces.C.size_t range <>) of aliased xcb.Pointers .xcb_visual_class_t_Pointer; -- xcb_event_mask_t_Pointer -- package C_xcb_event_mask_t_Pointers is new Interfaces.C.Pointers (Index => Interfaces.C.size_t, Element => xcb.xcb_event_mask_t, Element_Array => xcb.xcb_event_mask_t_array, Default_Terminator => xcb.xcb_event_mask_t'Val (0)); subtype xcb_event_mask_t_Pointer is C_xcb_event_mask_t_Pointers.Pointer; -- xcb_event_mask_t_Pointer_Array -- type xcb_event_mask_t_Pointer_Array is array (Interfaces.C.size_t range <>) of aliased xcb.Pointers .xcb_event_mask_t_Pointer; -- xcb_backing_store_t_Pointer -- package C_xcb_backing_store_t_Pointers is new Interfaces.C.Pointers (Index => Interfaces.C.size_t, Element => xcb.xcb_backing_store_t, Element_Array => xcb.xcb_backing_store_t_array, Default_Terminator => xcb.xcb_backing_store_t'Val (0)); subtype xcb_backing_store_t_Pointer is C_xcb_backing_store_t_Pointers.Pointer; -- xcb_backing_store_t_Pointer_Array -- type xcb_backing_store_t_Pointer_Array is array (Interfaces.C.size_t range <>) of aliased xcb.Pointers .xcb_backing_store_t_Pointer; -- xcb_image_order_t_Pointer -- package C_xcb_image_order_t_Pointers is new Interfaces.C.Pointers (Index => Interfaces.C.size_t, Element => xcb.xcb_image_order_t, Element_Array => xcb.xcb_image_order_t_array, Default_Terminator => xcb.xcb_image_order_t'Val (0)); subtype xcb_image_order_t_Pointer is C_xcb_image_order_t_Pointers.Pointer; -- xcb_image_order_t_Pointer_Array -- type xcb_image_order_t_Pointer_Array is array (Interfaces.C.size_t range <>) of aliased xcb.Pointers .xcb_image_order_t_Pointer; -- xcb_mod_mask_t_Pointer -- package C_xcb_mod_mask_t_Pointers is new Interfaces.C.Pointers (Index => Interfaces.C.size_t, Element => xcb.xcb_mod_mask_t, Element_Array => xcb.xcb_mod_mask_t_array, Default_Terminator => xcb.xcb_mod_mask_t'Val (0)); subtype xcb_mod_mask_t_Pointer is C_xcb_mod_mask_t_Pointers.Pointer; -- xcb_mod_mask_t_Pointer_Array -- type xcb_mod_mask_t_Pointer_Array is array (Interfaces.C.size_t range <>) of aliased xcb.Pointers .xcb_mod_mask_t_Pointer; -- xcb_key_but_mask_t_Pointer -- package C_xcb_key_but_mask_t_Pointers is new Interfaces.C.Pointers (Index => Interfaces.C.size_t, Element => xcb.xcb_key_but_mask_t, Element_Array => xcb.xcb_key_but_mask_t_array, Default_Terminator => xcb.xcb_key_but_mask_t'Val (0)); subtype xcb_key_but_mask_t_Pointer is C_xcb_key_but_mask_t_Pointers.Pointer; -- xcb_key_but_mask_t_Pointer_Array -- type xcb_key_but_mask_t_Pointer_Array is array (Interfaces.C.size_t range <>) of aliased xcb.Pointers .xcb_key_but_mask_t_Pointer; -- xcb_window_enum_t_Pointer -- package C_xcb_window_enum_t_Pointers is new Interfaces.C.Pointers (Index => Interfaces.C.size_t, Element => xcb.xcb_window_enum_t, Element_Array => xcb.xcb_window_enum_t_array, Default_Terminator => xcb.xcb_window_enum_t'Val (0)); subtype xcb_window_enum_t_Pointer is C_xcb_window_enum_t_Pointers.Pointer; -- xcb_window_enum_t_Pointer_Array -- type xcb_window_enum_t_Pointer_Array is array (Interfaces.C.size_t range <>) of aliased xcb.Pointers .xcb_window_enum_t_Pointer; -- xcb_button_mask_t_Pointer -- package C_xcb_button_mask_t_Pointers is new Interfaces.C.Pointers (Index => Interfaces.C.size_t, Element => xcb.xcb_button_mask_t, Element_Array => xcb.xcb_button_mask_t_array, Default_Terminator => xcb.xcb_button_mask_t'Val (0)); subtype xcb_button_mask_t_Pointer is C_xcb_button_mask_t_Pointers.Pointer; -- xcb_button_mask_t_Pointer_Array -- type xcb_button_mask_t_Pointer_Array is array (Interfaces.C.size_t range <>) of aliased xcb.Pointers .xcb_button_mask_t_Pointer; -- xcb_motion_t_Pointer -- package C_xcb_motion_t_Pointers is new Interfaces.C.Pointers (Index => Interfaces.C.size_t, Element => xcb.xcb_motion_t, Element_Array => xcb.xcb_motion_t_array, Default_Terminator => xcb.xcb_motion_t'Val (0)); subtype xcb_motion_t_Pointer is C_xcb_motion_t_Pointers.Pointer; -- xcb_motion_t_Pointer_Array -- type xcb_motion_t_Pointer_Array is array (Interfaces.C.size_t range <>) of aliased xcb.Pointers .xcb_motion_t_Pointer; -- xcb_notify_detail_t_Pointer -- package C_xcb_notify_detail_t_Pointers is new Interfaces.C.Pointers (Index => Interfaces.C.size_t, Element => xcb.xcb_notify_detail_t, Element_Array => xcb.xcb_notify_detail_t_array, Default_Terminator => xcb.xcb_notify_detail_t'Val (0)); subtype xcb_notify_detail_t_Pointer is C_xcb_notify_detail_t_Pointers.Pointer; -- xcb_notify_detail_t_Pointer_Array -- type xcb_notify_detail_t_Pointer_Array is array (Interfaces.C.size_t range <>) of aliased xcb.Pointers .xcb_notify_detail_t_Pointer; -- xcb_notify_mode_t_Pointer -- package C_xcb_notify_mode_t_Pointers is new Interfaces.C.Pointers (Index => Interfaces.C.size_t, Element => xcb.xcb_notify_mode_t, Element_Array => xcb.xcb_notify_mode_t_array, Default_Terminator => xcb.xcb_notify_mode_t'Val (0)); subtype xcb_notify_mode_t_Pointer is C_xcb_notify_mode_t_Pointers.Pointer; -- xcb_notify_mode_t_Pointer_Array -- type xcb_notify_mode_t_Pointer_Array is array (Interfaces.C.size_t range <>) of aliased xcb.Pointers .xcb_notify_mode_t_Pointer; -- xcb_visibility_t_Pointer -- package C_xcb_visibility_t_Pointers is new Interfaces.C.Pointers (Index => Interfaces.C.size_t, Element => xcb.xcb_visibility_t, Element_Array => xcb.xcb_visibility_t_array, Default_Terminator => xcb.xcb_visibility_t'Val (0)); subtype xcb_visibility_t_Pointer is C_xcb_visibility_t_Pointers.Pointer; -- xcb_visibility_t_Pointer_Array -- type xcb_visibility_t_Pointer_Array is array (Interfaces.C.size_t range <>) of aliased xcb.Pointers .xcb_visibility_t_Pointer; -- xcb_place_t_Pointer -- package C_xcb_place_t_Pointers is new Interfaces.C.Pointers (Index => Interfaces.C.size_t, Element => xcb.xcb_place_t, Element_Array => xcb.xcb_place_t_array, Default_Terminator => xcb.xcb_place_t'Val (0)); subtype xcb_place_t_Pointer is C_xcb_place_t_Pointers.Pointer; -- xcb_place_t_Pointer_Array -- type xcb_place_t_Pointer_Array is array (Interfaces.C.size_t range <>) of aliased xcb.Pointers .xcb_place_t_Pointer; -- xcb_property_t_Pointer -- package C_xcb_property_t_Pointers is new Interfaces.C.Pointers (Index => Interfaces.C.size_t, Element => xcb.xcb_property_t, Element_Array => xcb.xcb_property_t_array, Default_Terminator => xcb.xcb_property_t'Val (0)); subtype xcb_property_t_Pointer is C_xcb_property_t_Pointers.Pointer; -- xcb_property_t_Pointer_Array -- type xcb_property_t_Pointer_Array is array (Interfaces.C.size_t range <>) of aliased xcb.Pointers .xcb_property_t_Pointer; -- xcb_time_t_Pointer -- package C_xcb_time_t_Pointers is new Interfaces.C.Pointers (Index => Interfaces.C.size_t, Element => xcb.xcb_time_t, Element_Array => xcb.xcb_time_t_array, Default_Terminator => xcb.xcb_time_t'Val (0)); subtype xcb_time_t_Pointer is C_xcb_time_t_Pointers.Pointer; -- xcb_time_t_Pointer_Array -- type xcb_time_t_Pointer_Array is array (Interfaces.C.size_t range <>) of aliased xcb.Pointers .xcb_time_t_Pointer; -- xcb_atom_enum_t_Pointer -- package C_xcb_atom_enum_t_Pointers is new Interfaces.C.Pointers (Index => Interfaces.C.size_t, Element => xcb.xcb_atom_enum_t, Element_Array => xcb.xcb_atom_enum_t_array, Default_Terminator => xcb.xcb_atom_enum_t'Val (0)); subtype xcb_atom_enum_t_Pointer is C_xcb_atom_enum_t_Pointers.Pointer; -- xcb_atom_enum_t_Pointer_Array -- type xcb_atom_enum_t_Pointer_Array is array (Interfaces.C.size_t range <>) of aliased xcb.Pointers .xcb_atom_enum_t_Pointer; -- xcb_colormap_state_t_Pointer -- package C_xcb_colormap_state_t_Pointers is new Interfaces.C.Pointers (Index => Interfaces.C.size_t, Element => xcb.xcb_colormap_state_t, Element_Array => xcb.xcb_colormap_state_t_array, Default_Terminator => xcb.xcb_colormap_state_t'Val (0)); subtype xcb_colormap_state_t_Pointer is C_xcb_colormap_state_t_Pointers.Pointer; -- xcb_colormap_state_t_Pointer_Array -- type xcb_colormap_state_t_Pointer_Array is array (Interfaces.C.size_t range <>) of aliased xcb.Pointers .xcb_colormap_state_t_Pointer; -- xcb_colormap_enum_t_Pointer -- package C_xcb_colormap_enum_t_Pointers is new Interfaces.C.Pointers (Index => Interfaces.C.size_t, Element => xcb.xcb_colormap_enum_t, Element_Array => xcb.xcb_colormap_enum_t_array, Default_Terminator => xcb.xcb_colormap_enum_t'Val (0)); subtype xcb_colormap_enum_t_Pointer is C_xcb_colormap_enum_t_Pointers.Pointer; -- xcb_colormap_enum_t_Pointer_Array -- type xcb_colormap_enum_t_Pointer_Array is array (Interfaces.C.size_t range <>) of aliased xcb.Pointers .xcb_colormap_enum_t_Pointer; -- xcb_mapping_t_Pointer -- package C_xcb_mapping_t_Pointers is new Interfaces.C.Pointers (Index => Interfaces.C.size_t, Element => xcb.xcb_mapping_t, Element_Array => xcb.xcb_mapping_t_array, Default_Terminator => xcb.xcb_mapping_t'Val (0)); subtype xcb_mapping_t_Pointer is C_xcb_mapping_t_Pointers.Pointer; -- xcb_mapping_t_Pointer_Array -- type xcb_mapping_t_Pointer_Array is array (Interfaces.C.size_t range <>) of aliased xcb.Pointers .xcb_mapping_t_Pointer; -- xcb_window_class_t_Pointer -- package C_xcb_window_class_t_Pointers is new Interfaces.C.Pointers (Index => Interfaces.C.size_t, Element => xcb.xcb_window_class_t, Element_Array => xcb.xcb_window_class_t_array, Default_Terminator => xcb.xcb_window_class_t'Val (0)); subtype xcb_window_class_t_Pointer is C_xcb_window_class_t_Pointers.Pointer; -- xcb_window_class_t_Pointer_Array -- type xcb_window_class_t_Pointer_Array is array (Interfaces.C.size_t range <>) of aliased xcb.Pointers .xcb_window_class_t_Pointer; -- xcb_cw_t_Pointer -- package C_xcb_cw_t_Pointers is new Interfaces.C.Pointers (Index => Interfaces.C.size_t, Element => xcb.xcb_cw_t, Element_Array => xcb.xcb_cw_t_array, Default_Terminator => xcb.xcb_cw_t'Val (0)); subtype xcb_cw_t_Pointer is C_xcb_cw_t_Pointers.Pointer; -- xcb_cw_t_Pointer_Array -- type xcb_cw_t_Pointer_Array is array (Interfaces.C.size_t range <>) of aliased xcb.Pointers.xcb_cw_t_Pointer; -- xcb_back_pixmap_t_Pointer -- package C_xcb_back_pixmap_t_Pointers is new Interfaces.C.Pointers (Index => Interfaces.C.size_t, Element => xcb.xcb_back_pixmap_t, Element_Array => xcb.xcb_back_pixmap_t_array, Default_Terminator => xcb.xcb_back_pixmap_t'Val (0)); subtype xcb_back_pixmap_t_Pointer is C_xcb_back_pixmap_t_Pointers.Pointer; -- xcb_back_pixmap_t_Pointer_Array -- type xcb_back_pixmap_t_Pointer_Array is array (Interfaces.C.size_t range <>) of aliased xcb.Pointers .xcb_back_pixmap_t_Pointer; -- xcb_gravity_t_Pointer -- package C_xcb_gravity_t_Pointers is new Interfaces.C.Pointers (Index => Interfaces.C.size_t, Element => xcb.xcb_gravity_t, Element_Array => xcb.xcb_gravity_t_array, Default_Terminator => xcb.xcb_gravity_t'Val (0)); subtype xcb_gravity_t_Pointer is C_xcb_gravity_t_Pointers.Pointer; -- xcb_gravity_t_Pointer_Array -- type xcb_gravity_t_Pointer_Array is array (Interfaces.C.size_t range <>) of aliased xcb.Pointers .xcb_gravity_t_Pointer; -- xcb_map_state_t_Pointer -- package C_xcb_map_state_t_Pointers is new Interfaces.C.Pointers (Index => Interfaces.C.size_t, Element => xcb.xcb_map_state_t, Element_Array => xcb.xcb_map_state_t_array, Default_Terminator => xcb.xcb_map_state_t'Val (0)); subtype xcb_map_state_t_Pointer is C_xcb_map_state_t_Pointers.Pointer; -- xcb_map_state_t_Pointer_Array -- type xcb_map_state_t_Pointer_Array is array (Interfaces.C.size_t range <>) of aliased xcb.Pointers .xcb_map_state_t_Pointer; -- xcb_set_mode_t_Pointer -- package C_xcb_set_mode_t_Pointers is new Interfaces.C.Pointers (Index => Interfaces.C.size_t, Element => xcb.xcb_set_mode_t, Element_Array => xcb.xcb_set_mode_t_array, Default_Terminator => xcb.xcb_set_mode_t'Val (0)); subtype xcb_set_mode_t_Pointer is C_xcb_set_mode_t_Pointers.Pointer; -- xcb_set_mode_t_Pointer_Array -- type xcb_set_mode_t_Pointer_Array is array (Interfaces.C.size_t range <>) of aliased xcb.Pointers .xcb_set_mode_t_Pointer; -- xcb_config_window_t_Pointer -- package C_xcb_config_window_t_Pointers is new Interfaces.C.Pointers (Index => Interfaces.C.size_t, Element => xcb.xcb_config_window_t, Element_Array => xcb.xcb_config_window_t_array, Default_Terminator => xcb.xcb_config_window_t'Val (0)); subtype xcb_config_window_t_Pointer is C_xcb_config_window_t_Pointers.Pointer; -- xcb_config_window_t_Pointer_Array -- type xcb_config_window_t_Pointer_Array is array (Interfaces.C.size_t range <>) of aliased xcb.Pointers .xcb_config_window_t_Pointer; -- xcb_stack_mode_t_Pointer -- package C_xcb_stack_mode_t_Pointers is new Interfaces.C.Pointers (Index => Interfaces.C.size_t, Element => xcb.xcb_stack_mode_t, Element_Array => xcb.xcb_stack_mode_t_array, Default_Terminator => xcb.xcb_stack_mode_t'Val (0)); subtype xcb_stack_mode_t_Pointer is C_xcb_stack_mode_t_Pointers.Pointer; -- xcb_stack_mode_t_Pointer_Array -- type xcb_stack_mode_t_Pointer_Array is array (Interfaces.C.size_t range <>) of aliased xcb.Pointers .xcb_stack_mode_t_Pointer; -- xcb_circulate_t_Pointer -- package C_xcb_circulate_t_Pointers is new Interfaces.C.Pointers (Index => Interfaces.C.size_t, Element => xcb.xcb_circulate_t, Element_Array => xcb.xcb_circulate_t_array, Default_Terminator => xcb.xcb_circulate_t'Val (0)); subtype xcb_circulate_t_Pointer is C_xcb_circulate_t_Pointers.Pointer; -- xcb_circulate_t_Pointer_Array -- type xcb_circulate_t_Pointer_Array is array (Interfaces.C.size_t range <>) of aliased xcb.Pointers .xcb_circulate_t_Pointer; -- xcb_prop_mode_t_Pointer -- package C_xcb_prop_mode_t_Pointers is new Interfaces.C.Pointers (Index => Interfaces.C.size_t, Element => xcb.xcb_prop_mode_t, Element_Array => xcb.xcb_prop_mode_t_array, Default_Terminator => xcb.xcb_prop_mode_t'Val (0)); subtype xcb_prop_mode_t_Pointer is C_xcb_prop_mode_t_Pointers.Pointer; -- xcb_prop_mode_t_Pointer_Array -- type xcb_prop_mode_t_Pointer_Array is array (Interfaces.C.size_t range <>) of aliased xcb.Pointers .xcb_prop_mode_t_Pointer; -- xcb_get_property_type_t_Pointer -- package C_xcb_get_property_type_t_Pointers is new Interfaces.C.Pointers (Index => Interfaces.C.size_t, Element => xcb.xcb_get_property_type_t, Element_Array => xcb.xcb_get_property_type_t_array, Default_Terminator => xcb.xcb_get_property_type_t'Val (0)); subtype xcb_get_property_type_t_Pointer is C_xcb_get_property_type_t_Pointers.Pointer; -- xcb_get_property_type_t_Pointer_Array -- type xcb_get_property_type_t_Pointer_Array is array (Interfaces.C.size_t range <>) of aliased xcb.Pointers .xcb_get_property_type_t_Pointer; -- xcb_send_event_dest_t_Pointer -- package C_xcb_send_event_dest_t_Pointers is new Interfaces.C.Pointers (Index => Interfaces.C.size_t, Element => xcb.xcb_send_event_dest_t, Element_Array => xcb.xcb_send_event_dest_t_array, Default_Terminator => xcb.xcb_send_event_dest_t'Val (0)); subtype xcb_send_event_dest_t_Pointer is C_xcb_send_event_dest_t_Pointers.Pointer; -- xcb_send_event_dest_t_Pointer_Array -- type xcb_send_event_dest_t_Pointer_Array is array (Interfaces.C.size_t range <>) of aliased xcb.Pointers .xcb_send_event_dest_t_Pointer; -- xcb_grab_mode_t_Pointer -- package C_xcb_grab_mode_t_Pointers is new Interfaces.C.Pointers (Index => Interfaces.C.size_t, Element => xcb.xcb_grab_mode_t, Element_Array => xcb.xcb_grab_mode_t_array, Default_Terminator => xcb.xcb_grab_mode_t'Val (0)); subtype xcb_grab_mode_t_Pointer is C_xcb_grab_mode_t_Pointers.Pointer; -- xcb_grab_mode_t_Pointer_Array -- type xcb_grab_mode_t_Pointer_Array is array (Interfaces.C.size_t range <>) of aliased xcb.Pointers .xcb_grab_mode_t_Pointer; -- xcb_grab_status_t_Pointer -- package C_xcb_grab_status_t_Pointers is new Interfaces.C.Pointers (Index => Interfaces.C.size_t, Element => xcb.xcb_grab_status_t, Element_Array => xcb.xcb_grab_status_t_array, Default_Terminator => xcb.xcb_grab_status_t'Val (0)); subtype xcb_grab_status_t_Pointer is C_xcb_grab_status_t_Pointers.Pointer; -- xcb_grab_status_t_Pointer_Array -- type xcb_grab_status_t_Pointer_Array is array (Interfaces.C.size_t range <>) of aliased xcb.Pointers .xcb_grab_status_t_Pointer; -- xcb_cursor_enum_t_Pointer -- package C_xcb_cursor_enum_t_Pointers is new Interfaces.C.Pointers (Index => Interfaces.C.size_t, Element => xcb.xcb_cursor_enum_t, Element_Array => xcb.xcb_cursor_enum_t_array, Default_Terminator => xcb.xcb_cursor_enum_t'Val (0)); subtype xcb_cursor_enum_t_Pointer is C_xcb_cursor_enum_t_Pointers.Pointer; -- xcb_cursor_enum_t_Pointer_Array -- type xcb_cursor_enum_t_Pointer_Array is array (Interfaces.C.size_t range <>) of aliased xcb.Pointers .xcb_cursor_enum_t_Pointer; -- xcb_button_index_t_Pointer -- package C_xcb_button_index_t_Pointers is new Interfaces.C.Pointers (Index => Interfaces.C.size_t, Element => xcb.xcb_button_index_t, Element_Array => xcb.xcb_button_index_t_array, Default_Terminator => xcb.xcb_button_index_t'Val (0)); subtype xcb_button_index_t_Pointer is C_xcb_button_index_t_Pointers.Pointer; -- xcb_button_index_t_Pointer_Array -- type xcb_button_index_t_Pointer_Array is array (Interfaces.C.size_t range <>) of aliased xcb.Pointers .xcb_button_index_t_Pointer; -- xcb_grab_t_Pointer -- package C_xcb_grab_t_Pointers is new Interfaces.C.Pointers (Index => Interfaces.C.size_t, Element => xcb.xcb_grab_t, Element_Array => xcb.xcb_grab_t_array, Default_Terminator => xcb.xcb_grab_t'Val (0)); subtype xcb_grab_t_Pointer is C_xcb_grab_t_Pointers.Pointer; -- xcb_grab_t_Pointer_Array -- type xcb_grab_t_Pointer_Array is array (Interfaces.C.size_t range <>) of aliased xcb.Pointers .xcb_grab_t_Pointer; -- xcb_allow_t_Pointer -- package C_xcb_allow_t_Pointers is new Interfaces.C.Pointers (Index => Interfaces.C.size_t, Element => xcb.xcb_allow_t, Element_Array => xcb.xcb_allow_t_array, Default_Terminator => xcb.xcb_allow_t'Val (0)); subtype xcb_allow_t_Pointer is C_xcb_allow_t_Pointers.Pointer; -- xcb_allow_t_Pointer_Array -- type xcb_allow_t_Pointer_Array is array (Interfaces.C.size_t range <>) of aliased xcb.Pointers .xcb_allow_t_Pointer; -- xcb_input_focus_t_Pointer -- package C_xcb_input_focus_t_Pointers is new Interfaces.C.Pointers (Index => Interfaces.C.size_t, Element => xcb.xcb_input_focus_t, Element_Array => xcb.xcb_input_focus_t_array, Default_Terminator => xcb.xcb_input_focus_t'Val (0)); subtype xcb_input_focus_t_Pointer is C_xcb_input_focus_t_Pointers.Pointer; -- xcb_input_focus_t_Pointer_Array -- type xcb_input_focus_t_Pointer_Array is array (Interfaces.C.size_t range <>) of aliased xcb.Pointers .xcb_input_focus_t_Pointer; -- xcb_font_draw_t_Pointer -- package C_xcb_font_draw_t_Pointers is new Interfaces.C.Pointers (Index => Interfaces.C.size_t, Element => xcb.xcb_font_draw_t, Element_Array => xcb.xcb_font_draw_t_array, Default_Terminator => xcb.xcb_font_draw_t'Val (0)); subtype xcb_font_draw_t_Pointer is C_xcb_font_draw_t_Pointers.Pointer; -- xcb_font_draw_t_Pointer_Array -- type xcb_font_draw_t_Pointer_Array is array (Interfaces.C.size_t range <>) of aliased xcb.Pointers .xcb_font_draw_t_Pointer; -- xcb_gc_t_Pointer -- package C_xcb_gc_t_Pointers is new Interfaces.C.Pointers (Index => Interfaces.C.size_t, Element => xcb.xcb_gc_t, Element_Array => xcb.xcb_gc_t_array, Default_Terminator => xcb.xcb_gc_t'Val (0)); subtype xcb_gc_t_Pointer is C_xcb_gc_t_Pointers.Pointer; -- xcb_gc_t_Pointer_Array -- type xcb_gc_t_Pointer_Array is array (Interfaces.C.size_t range <>) of aliased xcb.Pointers.xcb_gc_t_Pointer; -- xcb_gx_t_Pointer -- package C_xcb_gx_t_Pointers is new Interfaces.C.Pointers (Index => Interfaces.C.size_t, Element => xcb.xcb_gx_t, Element_Array => xcb.xcb_gx_t_array, Default_Terminator => xcb.xcb_gx_t'Val (0)); subtype xcb_gx_t_Pointer is C_xcb_gx_t_Pointers.Pointer; -- xcb_gx_t_Pointer_Array -- type xcb_gx_t_Pointer_Array is array (Interfaces.C.size_t range <>) of aliased xcb.Pointers.xcb_gx_t_Pointer; -- xcb_line_style_t_Pointer -- package C_xcb_line_style_t_Pointers is new Interfaces.C.Pointers (Index => Interfaces.C.size_t, Element => xcb.xcb_line_style_t, Element_Array => xcb.xcb_line_style_t_array, Default_Terminator => xcb.xcb_line_style_t'Val (0)); subtype xcb_line_style_t_Pointer is C_xcb_line_style_t_Pointers.Pointer; -- xcb_line_style_t_Pointer_Array -- type xcb_line_style_t_Pointer_Array is array (Interfaces.C.size_t range <>) of aliased xcb.Pointers .xcb_line_style_t_Pointer; -- xcb_cap_style_t_Pointer -- package C_xcb_cap_style_t_Pointers is new Interfaces.C.Pointers (Index => Interfaces.C.size_t, Element => xcb.xcb_cap_style_t, Element_Array => xcb.xcb_cap_style_t_array, Default_Terminator => xcb.xcb_cap_style_t'Val (0)); subtype xcb_cap_style_t_Pointer is C_xcb_cap_style_t_Pointers.Pointer; -- xcb_cap_style_t_Pointer_Array -- type xcb_cap_style_t_Pointer_Array is array (Interfaces.C.size_t range <>) of aliased xcb.Pointers .xcb_cap_style_t_Pointer; -- xcb_join_style_t_Pointer -- package C_xcb_join_style_t_Pointers is new Interfaces.C.Pointers (Index => Interfaces.C.size_t, Element => xcb.xcb_join_style_t, Element_Array => xcb.xcb_join_style_t_array, Default_Terminator => xcb.xcb_join_style_t'Val (0)); subtype xcb_join_style_t_Pointer is C_xcb_join_style_t_Pointers.Pointer; -- xcb_join_style_t_Pointer_Array -- type xcb_join_style_t_Pointer_Array is array (Interfaces.C.size_t range <>) of aliased xcb.Pointers .xcb_join_style_t_Pointer; -- xcb_fill_style_t_Pointer -- package C_xcb_fill_style_t_Pointers is new Interfaces.C.Pointers (Index => Interfaces.C.size_t, Element => xcb.xcb_fill_style_t, Element_Array => xcb.xcb_fill_style_t_array, Default_Terminator => xcb.xcb_fill_style_t'Val (0)); subtype xcb_fill_style_t_Pointer is C_xcb_fill_style_t_Pointers.Pointer; -- xcb_fill_style_t_Pointer_Array -- type xcb_fill_style_t_Pointer_Array is array (Interfaces.C.size_t range <>) of aliased xcb.Pointers .xcb_fill_style_t_Pointer; -- xcb_fill_rule_t_Pointer -- package C_xcb_fill_rule_t_Pointers is new Interfaces.C.Pointers (Index => Interfaces.C.size_t, Element => xcb.xcb_fill_rule_t, Element_Array => xcb.xcb_fill_rule_t_array, Default_Terminator => xcb.xcb_fill_rule_t'Val (0)); subtype xcb_fill_rule_t_Pointer is C_xcb_fill_rule_t_Pointers.Pointer; -- xcb_fill_rule_t_Pointer_Array -- type xcb_fill_rule_t_Pointer_Array is array (Interfaces.C.size_t range <>) of aliased xcb.Pointers .xcb_fill_rule_t_Pointer; -- xcb_subwindow_mode_t_Pointer -- package C_xcb_subwindow_mode_t_Pointers is new Interfaces.C.Pointers (Index => Interfaces.C.size_t, Element => xcb.xcb_subwindow_mode_t, Element_Array => xcb.xcb_subwindow_mode_t_array, Default_Terminator => xcb.xcb_subwindow_mode_t'Val (0)); subtype xcb_subwindow_mode_t_Pointer is C_xcb_subwindow_mode_t_Pointers.Pointer; -- xcb_subwindow_mode_t_Pointer_Array -- type xcb_subwindow_mode_t_Pointer_Array is array (Interfaces.C.size_t range <>) of aliased xcb.Pointers .xcb_subwindow_mode_t_Pointer; -- xcb_arc_mode_t_Pointer -- package C_xcb_arc_mode_t_Pointers is new Interfaces.C.Pointers (Index => Interfaces.C.size_t, Element => xcb.xcb_arc_mode_t, Element_Array => xcb.xcb_arc_mode_t_array, Default_Terminator => xcb.xcb_arc_mode_t'Val (0)); subtype xcb_arc_mode_t_Pointer is C_xcb_arc_mode_t_Pointers.Pointer; -- xcb_arc_mode_t_Pointer_Array -- type xcb_arc_mode_t_Pointer_Array is array (Interfaces.C.size_t range <>) of aliased xcb.Pointers .xcb_arc_mode_t_Pointer; -- xcb_clip_ordering_t_Pointer -- package C_xcb_clip_ordering_t_Pointers is new Interfaces.C.Pointers (Index => Interfaces.C.size_t, Element => xcb.xcb_clip_ordering_t, Element_Array => xcb.xcb_clip_ordering_t_array, Default_Terminator => xcb.xcb_clip_ordering_t'Val (0)); subtype xcb_clip_ordering_t_Pointer is C_xcb_clip_ordering_t_Pointers.Pointer; -- xcb_clip_ordering_t_Pointer_Array -- type xcb_clip_ordering_t_Pointer_Array is array (Interfaces.C.size_t range <>) of aliased xcb.Pointers .xcb_clip_ordering_t_Pointer; -- xcb_coord_mode_t_Pointer -- package C_xcb_coord_mode_t_Pointers is new Interfaces.C.Pointers (Index => Interfaces.C.size_t, Element => xcb.xcb_coord_mode_t, Element_Array => xcb.xcb_coord_mode_t_array, Default_Terminator => xcb.xcb_coord_mode_t'Val (0)); subtype xcb_coord_mode_t_Pointer is C_xcb_coord_mode_t_Pointers.Pointer; -- xcb_coord_mode_t_Pointer_Array -- type xcb_coord_mode_t_Pointer_Array is array (Interfaces.C.size_t range <>) of aliased xcb.Pointers .xcb_coord_mode_t_Pointer; -- xcb_poly_shape_t_Pointer -- package C_xcb_poly_shape_t_Pointers is new Interfaces.C.Pointers (Index => Interfaces.C.size_t, Element => xcb.xcb_poly_shape_t, Element_Array => xcb.xcb_poly_shape_t_array, Default_Terminator => xcb.xcb_poly_shape_t'Val (0)); subtype xcb_poly_shape_t_Pointer is C_xcb_poly_shape_t_Pointers.Pointer; -- xcb_poly_shape_t_Pointer_Array -- type xcb_poly_shape_t_Pointer_Array is array (Interfaces.C.size_t range <>) of aliased xcb.Pointers .xcb_poly_shape_t_Pointer; -- xcb_image_format_t_Pointer -- package C_xcb_image_format_t_Pointers is new Interfaces.C.Pointers (Index => Interfaces.C.size_t, Element => xcb.xcb_image_format_t, Element_Array => xcb.xcb_image_format_t_array, Default_Terminator => xcb.xcb_image_format_t'Val (0)); subtype xcb_image_format_t_Pointer is C_xcb_image_format_t_Pointers.Pointer; -- xcb_image_format_t_Pointer_Array -- type xcb_image_format_t_Pointer_Array is array (Interfaces.C.size_t range <>) of aliased xcb.Pointers .xcb_image_format_t_Pointer; -- xcb_colormap_alloc_t_Pointer -- package C_xcb_colormap_alloc_t_Pointers is new Interfaces.C.Pointers (Index => Interfaces.C.size_t, Element => xcb.xcb_colormap_alloc_t, Element_Array => xcb.xcb_colormap_alloc_t_array, Default_Terminator => xcb.xcb_colormap_alloc_t'Val (0)); subtype xcb_colormap_alloc_t_Pointer is C_xcb_colormap_alloc_t_Pointers.Pointer; -- xcb_colormap_alloc_t_Pointer_Array -- type xcb_colormap_alloc_t_Pointer_Array is array (Interfaces.C.size_t range <>) of aliased xcb.Pointers .xcb_colormap_alloc_t_Pointer; -- xcb_color_flag_t_Pointer -- package C_xcb_color_flag_t_Pointers is new Interfaces.C.Pointers (Index => Interfaces.C.size_t, Element => xcb.xcb_color_flag_t, Element_Array => xcb.xcb_color_flag_t_array, Default_Terminator => xcb.xcb_color_flag_t'Val (0)); subtype xcb_color_flag_t_Pointer is C_xcb_color_flag_t_Pointers.Pointer; -- xcb_color_flag_t_Pointer_Array -- type xcb_color_flag_t_Pointer_Array is array (Interfaces.C.size_t range <>) of aliased xcb.Pointers .xcb_color_flag_t_Pointer; -- xcb_pixmap_enum_t_Pointer -- package C_xcb_pixmap_enum_t_Pointers is new Interfaces.C.Pointers (Index => Interfaces.C.size_t, Element => xcb.xcb_pixmap_enum_t, Element_Array => xcb.xcb_pixmap_enum_t_array, Default_Terminator => xcb.xcb_pixmap_enum_t'Val (0)); subtype xcb_pixmap_enum_t_Pointer is C_xcb_pixmap_enum_t_Pointers.Pointer; -- xcb_pixmap_enum_t_Pointer_Array -- type xcb_pixmap_enum_t_Pointer_Array is array (Interfaces.C.size_t range <>) of aliased xcb.Pointers .xcb_pixmap_enum_t_Pointer; -- xcb_font_enum_t_Pointer -- package C_xcb_font_enum_t_Pointers is new Interfaces.C.Pointers (Index => Interfaces.C.size_t, Element => xcb.xcb_font_enum_t, Element_Array => xcb.xcb_font_enum_t_array, Default_Terminator => xcb.xcb_font_enum_t'Val (0)); subtype xcb_font_enum_t_Pointer is C_xcb_font_enum_t_Pointers.Pointer; -- xcb_font_enum_t_Pointer_Array -- type xcb_font_enum_t_Pointer_Array is array (Interfaces.C.size_t range <>) of aliased xcb.Pointers .xcb_font_enum_t_Pointer; -- xcb_query_shape_of_t_Pointer -- package C_xcb_query_shape_of_t_Pointers is new Interfaces.C.Pointers (Index => Interfaces.C.size_t, Element => xcb.xcb_query_shape_of_t, Element_Array => xcb.xcb_query_shape_of_t_array, Default_Terminator => xcb.xcb_query_shape_of_t'Val (0)); subtype xcb_query_shape_of_t_Pointer is C_xcb_query_shape_of_t_Pointers.Pointer; -- xcb_query_shape_of_t_Pointer_Array -- type xcb_query_shape_of_t_Pointer_Array is array (Interfaces.C.size_t range <>) of aliased xcb.Pointers .xcb_query_shape_of_t_Pointer; -- xcb_kb_t_Pointer -- package C_xcb_kb_t_Pointers is new Interfaces.C.Pointers (Index => Interfaces.C.size_t, Element => xcb.xcb_kb_t, Element_Array => xcb.xcb_kb_t_array, Default_Terminator => xcb.xcb_kb_t'Val (0)); subtype xcb_kb_t_Pointer is C_xcb_kb_t_Pointers.Pointer; -- xcb_kb_t_Pointer_Array -- type xcb_kb_t_Pointer_Array is array (Interfaces.C.size_t range <>) of aliased xcb.Pointers.xcb_kb_t_Pointer; -- xcb_led_mode_t_Pointer -- package C_xcb_led_mode_t_Pointers is new Interfaces.C.Pointers (Index => Interfaces.C.size_t, Element => xcb.xcb_led_mode_t, Element_Array => xcb.xcb_led_mode_t_array, Default_Terminator => xcb.xcb_led_mode_t'Val (0)); subtype xcb_led_mode_t_Pointer is C_xcb_led_mode_t_Pointers.Pointer; -- xcb_led_mode_t_Pointer_Array -- type xcb_led_mode_t_Pointer_Array is array (Interfaces.C.size_t range <>) of aliased xcb.Pointers .xcb_led_mode_t_Pointer; -- xcb_auto_repeat_mode_t_Pointer -- package C_xcb_auto_repeat_mode_t_Pointers is new Interfaces.C.Pointers (Index => Interfaces.C.size_t, Element => xcb.xcb_auto_repeat_mode_t, Element_Array => xcb.xcb_auto_repeat_mode_t_array, Default_Terminator => xcb.xcb_auto_repeat_mode_t'Val (0)); subtype xcb_auto_repeat_mode_t_Pointer is C_xcb_auto_repeat_mode_t_Pointers.Pointer; -- xcb_auto_repeat_mode_t_Pointer_Array -- type xcb_auto_repeat_mode_t_Pointer_Array is array (Interfaces.C.size_t range <>) of aliased xcb.Pointers .xcb_auto_repeat_mode_t_Pointer; -- xcb_blanking_t_Pointer -- package C_xcb_blanking_t_Pointers is new Interfaces.C.Pointers (Index => Interfaces.C.size_t, Element => xcb.xcb_blanking_t, Element_Array => xcb.xcb_blanking_t_array, Default_Terminator => xcb.xcb_blanking_t'Val (0)); subtype xcb_blanking_t_Pointer is C_xcb_blanking_t_Pointers.Pointer; -- xcb_blanking_t_Pointer_Array -- type xcb_blanking_t_Pointer_Array is array (Interfaces.C.size_t range <>) of aliased xcb.Pointers .xcb_blanking_t_Pointer; -- xcb_exposures_t_Pointer -- package C_xcb_exposures_t_Pointers is new Interfaces.C.Pointers (Index => Interfaces.C.size_t, Element => xcb.xcb_exposures_t, Element_Array => xcb.xcb_exposures_t_array, Default_Terminator => xcb.xcb_exposures_t'Val (0)); subtype xcb_exposures_t_Pointer is C_xcb_exposures_t_Pointers.Pointer; -- xcb_exposures_t_Pointer_Array -- type xcb_exposures_t_Pointer_Array is array (Interfaces.C.size_t range <>) of aliased xcb.Pointers .xcb_exposures_t_Pointer; -- xcb_host_mode_t_Pointer -- package C_xcb_host_mode_t_Pointers is new Interfaces.C.Pointers (Index => Interfaces.C.size_t, Element => xcb.xcb_host_mode_t, Element_Array => xcb.xcb_host_mode_t_array, Default_Terminator => xcb.xcb_host_mode_t'Val (0)); subtype xcb_host_mode_t_Pointer is C_xcb_host_mode_t_Pointers.Pointer; -- xcb_host_mode_t_Pointer_Array -- type xcb_host_mode_t_Pointer_Array is array (Interfaces.C.size_t range <>) of aliased xcb.Pointers .xcb_host_mode_t_Pointer; -- xcb_family_t_Pointer -- package C_xcb_family_t_Pointers is new Interfaces.C.Pointers (Index => Interfaces.C.size_t, Element => xcb.xcb_family_t, Element_Array => xcb.xcb_family_t_array, Default_Terminator => xcb.xcb_family_t'Val (0)); subtype xcb_family_t_Pointer is C_xcb_family_t_Pointers.Pointer; -- xcb_family_t_Pointer_Array -- type xcb_family_t_Pointer_Array is array (Interfaces.C.size_t range <>) of aliased xcb.Pointers .xcb_family_t_Pointer; -- xcb_access_control_t_Pointer -- package C_xcb_access_control_t_Pointers is new Interfaces.C.Pointers (Index => Interfaces.C.size_t, Element => xcb.xcb_access_control_t, Element_Array => xcb.xcb_access_control_t_array, Default_Terminator => xcb.xcb_access_control_t'Val (0)); subtype xcb_access_control_t_Pointer is C_xcb_access_control_t_Pointers.Pointer; -- xcb_access_control_t_Pointer_Array -- type xcb_access_control_t_Pointer_Array is array (Interfaces.C.size_t range <>) of aliased xcb.Pointers .xcb_access_control_t_Pointer; -- xcb_close_down_t_Pointer -- package C_xcb_close_down_t_Pointers is new Interfaces.C.Pointers (Index => Interfaces.C.size_t, Element => xcb.xcb_close_down_t, Element_Array => xcb.xcb_close_down_t_array, Default_Terminator => xcb.xcb_close_down_t'Val (0)); subtype xcb_close_down_t_Pointer is C_xcb_close_down_t_Pointers.Pointer; -- xcb_close_down_t_Pointer_Array -- type xcb_close_down_t_Pointer_Array is array (Interfaces.C.size_t range <>) of aliased xcb.Pointers .xcb_close_down_t_Pointer; -- xcb_kill_t_Pointer -- package C_xcb_kill_t_Pointers is new Interfaces.C.Pointers (Index => Interfaces.C.size_t, Element => xcb.xcb_kill_t, Element_Array => xcb.xcb_kill_t_array, Default_Terminator => xcb.xcb_kill_t'Val (0)); subtype xcb_kill_t_Pointer is C_xcb_kill_t_Pointers.Pointer; -- xcb_kill_t_Pointer_Array -- type xcb_kill_t_Pointer_Array is array (Interfaces.C.size_t range <>) of aliased xcb.Pointers .xcb_kill_t_Pointer; -- xcb_screen_saver_t_Pointer -- package C_xcb_screen_saver_t_Pointers is new Interfaces.C.Pointers (Index => Interfaces.C.size_t, Element => xcb.xcb_screen_saver_t, Element_Array => xcb.xcb_screen_saver_t_array, Default_Terminator => xcb.xcb_screen_saver_t'Val (0)); subtype xcb_screen_saver_t_Pointer is C_xcb_screen_saver_t_Pointers.Pointer; -- xcb_screen_saver_t_Pointer_Array -- type xcb_screen_saver_t_Pointer_Array is array (Interfaces.C.size_t range <>) of aliased xcb.Pointers .xcb_screen_saver_t_Pointer; -- xcb_mapping_status_t_Pointer -- package C_xcb_mapping_status_t_Pointers is new Interfaces.C.Pointers (Index => Interfaces.C.size_t, Element => xcb.xcb_mapping_status_t, Element_Array => xcb.xcb_mapping_status_t_array, Default_Terminator => xcb.xcb_mapping_status_t'Val (0)); subtype xcb_mapping_status_t_Pointer is C_xcb_mapping_status_t_Pointers.Pointer; -- xcb_mapping_status_t_Pointer_Array -- type xcb_mapping_status_t_Pointer_Array is array (Interfaces.C.size_t range <>) of aliased xcb.Pointers .xcb_mapping_status_t_Pointer; -- xcb_map_index_t_Pointer -- package C_xcb_map_index_t_Pointers is new Interfaces.C.Pointers (Index => Interfaces.C.size_t, Element => xcb.xcb_map_index_t, Element_Array => xcb.xcb_map_index_t_array, Default_Terminator => xcb.xcb_map_index_t'Val (0)); subtype xcb_map_index_t_Pointer is C_xcb_map_index_t_Pointers.Pointer; -- xcb_map_index_t_Pointer_Array -- type xcb_map_index_t_Pointer_Array is array (Interfaces.C.size_t range <>) of aliased xcb.Pointers .xcb_map_index_t_Pointer; -- xcb_render_pict_type_t_Pointer -- package C_xcb_render_pict_type_t_Pointers is new Interfaces.C.Pointers (Index => Interfaces.C.size_t, Element => xcb.xcb_render_pict_type_t, Element_Array => xcb.xcb_render_pict_type_t_array, Default_Terminator => xcb.xcb_render_pict_type_t'Val (0)); subtype xcb_render_pict_type_t_Pointer is C_xcb_render_pict_type_t_Pointers.Pointer; -- xcb_render_pict_type_t_Pointer_Array -- type xcb_render_pict_type_t_Pointer_Array is array (Interfaces.C.size_t range <>) of aliased xcb.Pointers .xcb_render_pict_type_t_Pointer; -- xcb_render_picture_enum_t_Pointer -- package C_xcb_render_picture_enum_t_Pointers is new Interfaces.C.Pointers (Index => Interfaces.C.size_t, Element => xcb.xcb_render_picture_enum_t, Element_Array => xcb.xcb_render_picture_enum_t_array, Default_Terminator => xcb.xcb_render_picture_enum_t'Val (0)); subtype xcb_render_picture_enum_t_Pointer is C_xcb_render_picture_enum_t_Pointers.Pointer; -- xcb_render_picture_enum_t_Pointer_Array -- type xcb_render_picture_enum_t_Pointer_Array is array (Interfaces.C.size_t range <>) of aliased xcb.Pointers .xcb_render_picture_enum_t_Pointer; -- xcb_render_pict_op_t_Pointer -- package C_xcb_render_pict_op_t_Pointers is new Interfaces.C.Pointers (Index => Interfaces.C.size_t, Element => xcb.xcb_render_pict_op_t, Element_Array => xcb.xcb_render_pict_op_t_array, Default_Terminator => xcb.xcb_render_pict_op_t'Val (0)); subtype xcb_render_pict_op_t_Pointer is C_xcb_render_pict_op_t_Pointers.Pointer; -- xcb_render_pict_op_t_Pointer_Array -- type xcb_render_pict_op_t_Pointer_Array is array (Interfaces.C.size_t range <>) of aliased xcb.Pointers .xcb_render_pict_op_t_Pointer; -- xcb_render_poly_edge_t_Pointer -- package C_xcb_render_poly_edge_t_Pointers is new Interfaces.C.Pointers (Index => Interfaces.C.size_t, Element => xcb.xcb_render_poly_edge_t, Element_Array => xcb.xcb_render_poly_edge_t_array, Default_Terminator => xcb.xcb_render_poly_edge_t'Val (0)); subtype xcb_render_poly_edge_t_Pointer is C_xcb_render_poly_edge_t_Pointers.Pointer; -- xcb_render_poly_edge_t_Pointer_Array -- type xcb_render_poly_edge_t_Pointer_Array is array (Interfaces.C.size_t range <>) of aliased xcb.Pointers .xcb_render_poly_edge_t_Pointer; -- xcb_render_poly_mode_t_Pointer -- package C_xcb_render_poly_mode_t_Pointers is new Interfaces.C.Pointers (Index => Interfaces.C.size_t, Element => xcb.xcb_render_poly_mode_t, Element_Array => xcb.xcb_render_poly_mode_t_array, Default_Terminator => xcb.xcb_render_poly_mode_t'Val (0)); subtype xcb_render_poly_mode_t_Pointer is C_xcb_render_poly_mode_t_Pointers.Pointer; -- xcb_render_poly_mode_t_Pointer_Array -- type xcb_render_poly_mode_t_Pointer_Array is array (Interfaces.C.size_t range <>) of aliased xcb.Pointers .xcb_render_poly_mode_t_Pointer; -- xcb_render_cp_t_Pointer -- package C_xcb_render_cp_t_Pointers is new Interfaces.C.Pointers (Index => Interfaces.C.size_t, Element => xcb.xcb_render_cp_t, Element_Array => xcb.xcb_render_cp_t_array, Default_Terminator => xcb.xcb_render_cp_t'Val (0)); subtype xcb_render_cp_t_Pointer is C_xcb_render_cp_t_Pointers.Pointer; -- xcb_render_cp_t_Pointer_Array -- type xcb_render_cp_t_Pointer_Array is array (Interfaces.C.size_t range <>) of aliased xcb.Pointers .xcb_render_cp_t_Pointer; -- xcb_render_sub_pixel_t_Pointer -- package C_xcb_render_sub_pixel_t_Pointers is new Interfaces.C.Pointers (Index => Interfaces.C.size_t, Element => xcb.xcb_render_sub_pixel_t, Element_Array => xcb.xcb_render_sub_pixel_t_array, Default_Terminator => xcb.xcb_render_sub_pixel_t'Val (0)); subtype xcb_render_sub_pixel_t_Pointer is C_xcb_render_sub_pixel_t_Pointers.Pointer; -- xcb_render_sub_pixel_t_Pointer_Array -- type xcb_render_sub_pixel_t_Pointer_Array is array (Interfaces.C.size_t range <>) of aliased xcb.Pointers .xcb_render_sub_pixel_t_Pointer; -- xcb_render_repeat_t_Pointer -- package C_xcb_render_repeat_t_Pointers is new Interfaces.C.Pointers (Index => Interfaces.C.size_t, Element => xcb.xcb_render_repeat_t, Element_Array => xcb.xcb_render_repeat_t_array, Default_Terminator => xcb.xcb_render_repeat_t'Val (0)); subtype xcb_render_repeat_t_Pointer is C_xcb_render_repeat_t_Pointers.Pointer; -- xcb_render_repeat_t_Pointer_Array -- type xcb_render_repeat_t_Pointer_Array is array (Interfaces.C.size_t range <>) of aliased xcb.Pointers .xcb_render_repeat_t_Pointer; -- xcb_render_glyph_t_Pointer -- package C_xcb_render_glyph_t_Pointers is new Interfaces.C.Pointers (Index => Interfaces.C.size_t, Element => xcb.xcb_render_glyph_t, Element_Array => xcb.xcb_render_glyph_t_array, Default_Terminator => 0); subtype xcb_render_glyph_t_Pointer is C_xcb_render_glyph_t_Pointers.Pointer; -- xcb_render_glyph_t_Pointer_Array -- type xcb_render_glyph_t_Pointer_Array is array (Interfaces.C.size_t range <>) of aliased xcb.Pointers .xcb_render_glyph_t_Pointer; -- xcb_render_glyphset_t_Pointer -- package C_xcb_render_glyphset_t_Pointers is new Interfaces.C.Pointers (Index => Interfaces.C.size_t, Element => xcb.xcb_render_glyphset_t, Element_Array => xcb.xcb_render_glyphset_t_array, Default_Terminator => 0); subtype xcb_render_glyphset_t_Pointer is C_xcb_render_glyphset_t_Pointers.Pointer; -- xcb_render_glyphset_t_Pointer_Array -- type xcb_render_glyphset_t_Pointer_Array is array (Interfaces.C.size_t range <>) of aliased xcb.Pointers .xcb_render_glyphset_t_Pointer; -- xcb_render_picture_t_Pointer -- package C_xcb_render_picture_t_Pointers is new Interfaces.C.Pointers (Index => Interfaces.C.size_t, Element => xcb.xcb_render_picture_t, Element_Array => xcb.xcb_render_picture_t_array, Default_Terminator => 0); subtype xcb_render_picture_t_Pointer is C_xcb_render_picture_t_Pointers.Pointer; -- xcb_render_picture_t_Pointer_Array -- type xcb_render_picture_t_Pointer_Array is array (Interfaces.C.size_t range <>) of aliased xcb.Pointers .xcb_render_picture_t_Pointer; -- xcb_render_pictformat_t_Pointer -- package C_xcb_render_pictformat_t_Pointers is new Interfaces.C.Pointers (Index => Interfaces.C.size_t, Element => xcb.xcb_render_pictformat_t, Element_Array => xcb.xcb_render_pictformat_t_array, Default_Terminator => 0); subtype xcb_render_pictformat_t_Pointer is C_xcb_render_pictformat_t_Pointers.Pointer; -- xcb_render_pictformat_t_Pointer_Array -- type xcb_render_pictformat_t_Pointer_Array is array (Interfaces.C.size_t range <>) of aliased xcb.Pointers .xcb_render_pictformat_t_Pointer; -- xcb_render_fixed_t_Pointer -- package C_xcb_render_fixed_t_Pointers is new Interfaces.C.Pointers (Index => Interfaces.C.size_t, Element => xcb.xcb_render_fixed_t, Element_Array => xcb.xcb_render_fixed_t_array, Default_Terminator => 0); subtype xcb_render_fixed_t_Pointer is C_xcb_render_fixed_t_Pointers.Pointer; -- xcb_render_fixed_t_Pointer_Array -- type xcb_render_fixed_t_Pointer_Array is array (Interfaces.C.size_t range <>) of aliased xcb.Pointers .xcb_render_fixed_t_Pointer; -- iovec_Pointer -- package C_iovec_Pointers is new interfaces.c.Pointers (Index => interfaces.c.size_t, Element => xcb.iovec, element_Array => xcb.iovec_Array, default_Terminator => 0); subtype iovec_Pointer is C_iovec_Pointers.Pointer; -- iovec_Pointer_Array -- type iovec_Pointer_Array is array (Interfaces.C.size_t range <>) of aliased xcb.Pointers.iovec_Pointer; -- xcb_send_request_flags_t_Pointer -- package C_xcb_send_request_flags_t_Pointers is new Interfaces.C.Pointers (Index => Interfaces.C.size_t, Element => xcb.xcb_send_request_flags_t, Element_Array => xcb.xcb_send_request_flags_t_array, Default_Terminator => xcb.xcb_send_request_flags_t'Val (0)); subtype xcb_send_request_flags_t_Pointer is C_xcb_send_request_flags_t_Pointers.Pointer; -- xcb_send_request_flags_t_Pointer_Array -- type xcb_send_request_flags_t_Pointer_Array is array (Interfaces.C.size_t range <>) of aliased xcb.Pointers .xcb_send_request_flags_t_Pointer; -- xcb_pict_format_t_Pointer -- package C_xcb_pict_format_t_Pointers is new Interfaces.C.Pointers (Index => Interfaces.C.size_t, Element => xcb.xcb_pict_format_t, Element_Array => xcb.xcb_pict_format_t_array, Default_Terminator => xcb.xcb_pict_format_t'Val (0)); subtype xcb_pict_format_t_Pointer is C_xcb_pict_format_t_Pointers.Pointer; -- xcb_pict_format_t_Pointer_Array -- type xcb_pict_format_t_Pointer_Array is array (Interfaces.C.size_t range <>) of aliased xcb.Pointers .xcb_pict_format_t_Pointer; -- xcb_pict_standard_t_Pointer -- package C_xcb_pict_standard_t_Pointers is new Interfaces.C.Pointers (Index => Interfaces.C.size_t, Element => xcb.xcb_pict_standard_t, Element_Array => xcb.xcb_pict_standard_t_array, Default_Terminator => xcb.xcb_pict_standard_t'Val (0)); subtype xcb_pict_standard_t_Pointer is C_xcb_pict_standard_t_Pointers.Pointer; -- xcb_pict_standard_t_Pointer_Array -- type xcb_pict_standard_t_Pointer_Array is array (Interfaces.C.size_t range <>) of aliased xcb.Pointers .xcb_pict_standard_t_Pointer; -- xcb_render_util_composite_text_stream_t_Pointer -- package C_xcb_render_util_composite_text_stream_t_Pointers is new interfaces .c .Pointers (Index => interfaces.c.size_t, Element => xcb.xcb_render_util_composite_text_stream_t, element_Array => xcb.xcb_render_util_composite_text_stream_t_Array, default_Terminator => 0); subtype xcb_render_util_composite_text_stream_t_Pointer is C_xcb_render_util_composite_text_stream_t_Pointers.Pointer; -- xcb_render_util_composite_text_stream_t_Pointer_Array -- type xcb_render_util_composite_text_stream_t_Pointer_Array is array (Interfaces.C.size_t range <>) of aliased xcb.Pointers .xcb_render_util_composite_text_stream_t_Pointer; -- xcb_glx_pixmap_t_Pointer -- package C_xcb_glx_pixmap_t_Pointers is new Interfaces.C.Pointers (Index => Interfaces.C.size_t, Element => xcb.xcb_glx_pixmap_t, Element_Array => xcb.xcb_glx_pixmap_t_array, Default_Terminator => 0); subtype xcb_glx_pixmap_t_Pointer is C_xcb_glx_pixmap_t_Pointers.Pointer; -- xcb_glx_pixmap_t_Pointer_Array -- type xcb_glx_pixmap_t_Pointer_Array is array (Interfaces.C.size_t range <>) of aliased xcb.Pointers .xcb_glx_pixmap_t_Pointer; -- xcb_glx_context_t_Pointer -- package C_xcb_glx_context_t_Pointers is new Interfaces.C.Pointers (Index => Interfaces.C.size_t, Element => xcb.xcb_glx_context_t, Element_Array => xcb.xcb_glx_context_t_array, Default_Terminator => 0); subtype xcb_glx_context_t_Pointer is C_xcb_glx_context_t_Pointers.Pointer; -- xcb_glx_context_t_Pointer_Array -- type xcb_glx_context_t_Pointer_Array is array (Interfaces.C.size_t range <>) of aliased xcb.Pointers .xcb_glx_context_t_Pointer; -- xcb_glx_pbuffer_t_Pointer -- package C_xcb_glx_pbuffer_t_Pointers is new Interfaces.C.Pointers (Index => Interfaces.C.size_t, Element => xcb.xcb_glx_pbuffer_t, Element_Array => xcb.xcb_glx_pbuffer_t_array, Default_Terminator => 0); subtype xcb_glx_pbuffer_t_Pointer is C_xcb_glx_pbuffer_t_Pointers.Pointer; -- xcb_glx_pbuffer_t_Pointer_Array -- type xcb_glx_pbuffer_t_Pointer_Array is array (Interfaces.C.size_t range <>) of aliased xcb.Pointers .xcb_glx_pbuffer_t_Pointer; -- xcb_glx_window_t_Pointer -- package C_xcb_glx_window_t_Pointers is new Interfaces.C.Pointers (Index => Interfaces.C.size_t, Element => xcb.xcb_glx_window_t, Element_Array => xcb.xcb_glx_window_t_array, Default_Terminator => 0); subtype xcb_glx_window_t_Pointer is C_xcb_glx_window_t_Pointers.Pointer; -- xcb_glx_window_t_Pointer_Array -- type xcb_glx_window_t_Pointer_Array is array (Interfaces.C.size_t range <>) of aliased xcb.Pointers .xcb_glx_window_t_Pointer; -- xcb_glx_fbconfig_t_Pointer -- package C_xcb_glx_fbconfig_t_Pointers is new Interfaces.C.Pointers (Index => Interfaces.C.size_t, Element => xcb.xcb_glx_fbconfig_t, Element_Array => xcb.xcb_glx_fbconfig_t_array, Default_Terminator => 0); subtype xcb_glx_fbconfig_t_Pointer is C_xcb_glx_fbconfig_t_Pointers.Pointer; -- xcb_glx_fbconfig_t_Pointer_Array -- type xcb_glx_fbconfig_t_Pointer_Array is array (Interfaces.C.size_t range <>) of aliased xcb.Pointers .xcb_glx_fbconfig_t_Pointer; -- xcb_glx_drawable_t_Pointer -- package C_xcb_glx_drawable_t_Pointers is new Interfaces.C.Pointers (Index => Interfaces.C.size_t, Element => xcb.xcb_glx_drawable_t, Element_Array => xcb.xcb_glx_drawable_t_array, Default_Terminator => 0); subtype xcb_glx_drawable_t_Pointer is C_xcb_glx_drawable_t_Pointers.Pointer; -- xcb_glx_drawable_t_Pointer_Array -- type xcb_glx_drawable_t_Pointer_Array is array (Interfaces.C.size_t range <>) of aliased xcb.Pointers .xcb_glx_drawable_t_Pointer; -- xcb_glx_float32_t_Pointer -- package C_xcb_glx_float32_t_Pointers is new interfaces.c.Pointers (Index => interfaces.c.size_t, Element => xcb.xcb_glx_float32_t, element_Array => xcb.xcb_glx_float32_t_Array, default_Terminator => 0.0); subtype xcb_glx_float32_t_Pointer is C_xcb_glx_float32_t_Pointers.Pointer; -- xcb_glx_float32_t_Pointer_Array -- type xcb_glx_float32_t_Pointer_Array is array (Interfaces.C.size_t range <>) of aliased xcb.Pointers .xcb_glx_float32_t_Pointer; -- xcb_glx_float64_t_Pointer -- package C_xcb_glx_float64_t_Pointers is new interfaces.c.Pointers (Index => interfaces.c.size_t, Element => xcb.xcb_glx_float64_t, element_Array => xcb.xcb_glx_float64_t_Array, default_Terminator => 0.0); subtype xcb_glx_float64_t_Pointer is C_xcb_glx_float64_t_Pointers.Pointer; -- xcb_glx_float64_t_Pointer_Array -- type xcb_glx_float64_t_Pointer_Array is array (Interfaces.C.size_t range <>) of aliased xcb.Pointers .xcb_glx_float64_t_Pointer; -- xcb_glx_bool32_t_Pointer -- package C_xcb_glx_bool32_t_Pointers is new Interfaces.C.Pointers (Index => Interfaces.C.size_t, Element => xcb.xcb_glx_bool32_t, Element_Array => xcb.xcb_glx_bool32_t_array, Default_Terminator => 0); subtype xcb_glx_bool32_t_Pointer is C_xcb_glx_bool32_t_Pointers.Pointer; -- xcb_glx_bool32_t_Pointer_Array -- type xcb_glx_bool32_t_Pointer_Array is array (Interfaces.C.size_t range <>) of aliased xcb.Pointers .xcb_glx_bool32_t_Pointer; -- xcb_glx_context_tag_t_Pointer -- package C_xcb_glx_context_tag_t_Pointers is new Interfaces.C.Pointers (Index => Interfaces.C.size_t, Element => xcb.xcb_glx_context_tag_t, Element_Array => xcb.xcb_glx_context_tag_t_array, Default_Terminator => 0); subtype xcb_glx_context_tag_t_Pointer is C_xcb_glx_context_tag_t_Pointers.Pointer; -- xcb_glx_context_tag_t_Pointer_Array -- type xcb_glx_context_tag_t_Pointer_Array is array (Interfaces.C.size_t range <>) of aliased xcb.Pointers .xcb_glx_context_tag_t_Pointer; -- xcb_glx_pbcet_t_Pointer -- package C_xcb_glx_pbcet_t_Pointers is new Interfaces.C.Pointers (Index => Interfaces.C.size_t, Element => xcb.xcb_glx_pbcet_t, Element_Array => xcb.xcb_glx_pbcet_t_array, Default_Terminator => xcb.xcb_glx_pbcet_t'Val (0)); subtype xcb_glx_pbcet_t_Pointer is C_xcb_glx_pbcet_t_Pointers.Pointer; -- xcb_glx_pbcet_t_Pointer_Array -- type xcb_glx_pbcet_t_Pointer_Array is array (Interfaces.C.size_t range <>) of aliased xcb.Pointers .xcb_glx_pbcet_t_Pointer; -- xcb_glx_pbcdt_t_Pointer -- package C_xcb_glx_pbcdt_t_Pointers is new Interfaces.C.Pointers (Index => Interfaces.C.size_t, Element => xcb.xcb_glx_pbcdt_t, Element_Array => xcb.xcb_glx_pbcdt_t_array, Default_Terminator => xcb.xcb_glx_pbcdt_t'Val (0)); subtype xcb_glx_pbcdt_t_Pointer is C_xcb_glx_pbcdt_t_Pointers.Pointer; -- xcb_glx_pbcdt_t_Pointer_Array -- type xcb_glx_pbcdt_t_Pointer_Array is array (Interfaces.C.size_t range <>) of aliased xcb.Pointers .xcb_glx_pbcdt_t_Pointer; -- xcb_glx_gc_t_Pointer -- package C_xcb_glx_gc_t_Pointers is new Interfaces.C.Pointers (Index => Interfaces.C.size_t, Element => xcb.xcb_glx_gc_t, Element_Array => xcb.xcb_glx_gc_t_array, Default_Terminator => xcb.xcb_glx_gc_t'Val (0)); subtype xcb_glx_gc_t_Pointer is C_xcb_glx_gc_t_Pointers.Pointer; -- xcb_glx_gc_t_Pointer_Array -- type xcb_glx_gc_t_Pointer_Array is array (Interfaces.C.size_t range <>) of aliased xcb.Pointers .xcb_glx_gc_t_Pointer; -- xcb_glx_rm_t_Pointer -- package C_xcb_glx_rm_t_Pointers is new Interfaces.C.Pointers (Index => Interfaces.C.size_t, Element => xcb.xcb_glx_rm_t, Element_Array => xcb.xcb_glx_rm_t_array, Default_Terminator => xcb.xcb_glx_rm_t'Val (0)); subtype xcb_glx_rm_t_Pointer is C_xcb_glx_rm_t_Pointers.Pointer; -- xcb_glx_rm_t_Pointer_Array -- type xcb_glx_rm_t_Pointer_Array is array (Interfaces.C.size_t range <>) of aliased xcb.Pointers .xcb_glx_rm_t_Pointer; -- Display_Pointer -- package C_Display_Pointers is new interfaces.c.Pointers (Index => interfaces.c.size_t, Element => xcb.Display, element_Array => xcb.Display_Array, default_Terminator => 0); subtype Display_Pointer is C_Display_Pointers.Pointer; -- Display_Pointer_Array -- type Display_Pointer_Array is array (Interfaces.C.size_t range <>) of aliased xcb.Pointers.Display_Pointer; -- XEventQueueOwner_Pointer -- package C_XEventQueueOwner_Pointers is new Interfaces.C.Pointers (Index => Interfaces.C.size_t, Element => xcb.XEventQueueOwner, Element_Array => xcb.XEventQueueOwner_array, Default_Terminator => xcb.XEventQueueOwner'Val (0)); subtype XEventQueueOwner_Pointer is C_XEventQueueOwner_Pointers.Pointer; -- XEventQueueOwner_Pointer_Array -- type XEventQueueOwner_Pointer_Array is array (Interfaces.C.size_t range <>) of aliased xcb.Pointers .XEventQueueOwner_Pointer; end xcb.Pointers;
----------------------------------------------------------------------- -- util-http-cookies -- HTTP Cookies -- Copyright (C) 2011, 2012 Stephane Carrez -- Written by Stephane Carrez (Stephane.Carrez@gmail.com) -- -- Licensed under the Apache License, Version 2.0 (the "License"); -- you may not use this file except in compliance with the License. -- You may obtain a copy of the License at -- -- http://www.apache.org/licenses/LICENSE-2.0 -- -- Unless required by applicable law or agreed to in writing, software -- distributed under the License is distributed on an "AS IS" BASIS, -- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -- See the License for the specific language governing permissions and -- limitations under the License. ----------------------------------------------------------------------- with Ada.Strings.Unbounded; package Util.Http.Cookies is -- Exception raised if the value contains an invalid character. Invalid_Value : exception; type Cookie is private; type Cookie_Array is array (Natural range <>) of Cookie; type Cookie_Array_Access is access all Cookie_Array; -- Constructs a cookie with a specified name and value. -- -- The name must conform to RFC 2109. That means it can contain only ASCII alphanumeric -- characters and cannot contain commas, semicolons, or white space or begin with -- a $ character. The cookie's name cannot be changed after creation. -- -- The value can be anything the server chooses to send. Its value is probably -- of interest only to the server. The cookie's value can be changed after creation -- with the setValue method. -- -- By default, cookies are created according to the Netscape cookie specification. -- The version can be changed with the setVersion method. function Create (Name : in String; Value : in String) return Cookie; -- Returns the name of the cookie. The name cannot be changed after creation. function Get_Name (Object : in Cookie) return String; -- Returns the value of the cookie. function Get_Value (Object : in Cookie) return String; -- Assigns a new value to a cookie after the cookie is created. -- If you use a binary value, you may want to use BASE64 encoding. -- -- With Version 0 cookies, values should not contain white space, brackets, -- parentheses, equals signs, commas, double quotes, slashes, question marks, -- at signs, colons, and semicolons. Empty values may not behave -- the same way on all browsers. procedure Set_Value (Object : in out Cookie; Value : in String); -- Returns the comment describing the purpose of this cookie, -- or null if the cookie has no comment. function Get_Comment (Object : in Cookie) return String; -- Specifies a comment that describes a cookie's purpose. The comment is useful if -- the browser presents the cookie to the user. Comments are not supported by -- Netscape Version 0 cookies. procedure Set_Comment (Object : in out Cookie; Comment : in String); -- Returns the domain name set for this cookie. The form of the domain name -- is set by RFC 2109. function Get_Domain (Object : in Cookie) return String; -- Specifies the domain within which this cookie should be presented. -- -- The form of the domain name is specified by RFC 2109. A domain name begins with -- a dot (.foo.com) and means that the cookie is visible to servers in a specified -- Domain Name System (DNS) zone (for example, www.foo.com, but not a.b.foo.com). -- By default, cookies are only returned to the server that sent them. procedure Set_Domain (Object : in out Cookie; Domain : in String); -- Returns the maximum age of the cookie, specified in seconds. -- By default, -1 indicating the cookie will persist until browser shutdown. function Get_Max_Age (Object : in Cookie) return Integer; -- Sets the maximum age of the cookie in seconds. -- -- A positive value indicates that the cookie will expire after that many seconds -- have passed. Note that the value is the maximum age when the cookie will expire, -- not the cookie's current age. -- -- A negative value means that the cookie is not stored persistently and will be -- deleted when the Web browser exits. A zero value causes the cookie to be deleted. procedure Set_Max_Age (Object : in out Cookie; Max_Age : in Integer); -- Returns the path on the server to which the browser returns this cookie. -- The cookie is visible to all subpaths on the server. function Get_Path (Object : in Cookie) return String; -- Specifies a path for the cookie to which the client should return the cookie. -- -- The cookie is visible to all the pages in the directory you specify, -- and all the pages in that directory's subdirectories. A cookie's path -- must include the servlet that set the cookie, for example, /catalog, -- which makes the cookie visible to all directories on the server under /catalog. -- -- Consult RFC 2109 (available on the Internet) for more information on setting -- path names for cookies. procedure Set_Path (Object : in out Cookie; Path : in String); -- Returns true if the browser is sending cookies only over a secure protocol, -- or false if the browser can send cookies using any protocol. function Is_Secure (Object : in Cookie) return Boolean; -- Indicates to the browser whether the cookie should only be sent using -- a secure protocol, such as HTTPS or SSL. procedure Set_Secure (Object : in out Cookie; Secure : in Boolean); -- Returns the version of the protocol this cookie complies with. -- Version 1 complies with RFC 2109, and version 0 complies with the original -- cookie specification drafted by Netscape. Cookies provided by a browser use -- and identify the browser's cookie version. function Get_Version (Object : in Cookie) return Natural; -- Sets the version of the cookie protocol this cookie complies with. -- Version 0 complies with the original Netscape cookie specification. -- Version 1 complies with RFC 2109. procedure Set_Version (Object : in out Cookie; Version : in Natural); -- Returns True if the cookie has the http-only-flag. function Is_Http_Only (Object : in Cookie) return Boolean; -- Sets the http-only-flag associated with the cookie. When the http-only-flag is -- set, the cookie is only for http protocols and not exposed to Javascript API. procedure Set_Http_Only (Object : in out Cookie; Http_Only : in Boolean); -- Get the cookie definition function To_Http_Header (Object : in Cookie) return String; -- Parse the header and return an array of cookies. function Get_Cookies (Header : in String) return Cookie_Array_Access; private type Cookie is record Name : Ada.Strings.Unbounded.Unbounded_String; Value : Ada.Strings.Unbounded.Unbounded_String; Domain : Ada.Strings.Unbounded.Unbounded_String; Path : Ada.Strings.Unbounded.Unbounded_String; Comment : Ada.Strings.Unbounded.Unbounded_String; Max_Age : Integer := -1; Secure : Boolean := False; Http_Only : Boolean := False; Version : Natural := 0; end record; end Util.Http.Cookies;
-- SPDX-License-Identifier: Apache-2.0 -- -- Copyright (c) 2018 onox <denkpadje@gmail.com> -- -- Licensed under the Apache License, Version 2.0 (the "License"); -- you may not use this file except in compliance with the License. -- You may obtain a copy of the License at -- -- http://www.apache.org/licenses/LICENSE-2.0 -- -- Unless required by applicable law or agreed to in writing, software -- distributed under the License is distributed on an "AS IS" BASIS, -- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -- See the License for the specific language governing permissions and -- limitations under the License. with Ada.Containers.Vectors; with Ada.Exceptions; with Orka.Containers.Ring_Buffers; with Orka.OS; package body Orka.Resources.Loader is function Is_Extension (Path, Extension : String) return Boolean is (Path (Path'Last - Extension'Length .. Path'Last) = "." & Extension); use type Loaders.Loader_Access; package Loader_Vectors is new Ada.Containers.Vectors (Positive, Loaders.Loader_Access); -- Using a vector instead of a map gives looking up a loader a time -- complexity of O(n) instead of O(1), but it is assumed that there -- will only be a handful of registered loaders protected Resource_Loaders is procedure Include (Loader : Loaders.Loader_Ptr); -- Add the loader to the list of loaders if it hasn't already -- been added function Has_Loader (Path : String) return Boolean; -- Return True if a loader has been registered that can load the -- file at the given path based on its extension, False otherwise function Loader (Path : String) return Loaders.Loader_Ptr; -- Return a loader based on the extension of the given path private Loaders_Vector : Loader_Vectors.Vector; end Resource_Loaders; protected body Resource_Loaders is procedure Include (Loader : Loaders.Loader_Ptr) is begin if not (for some L of Loaders_Vector => L.Extension = Loader.Extension) then Loaders_Vector.Append (Loader); end if; end Include; function Has_Loader (Path : String) return Boolean is (for some Loader of Loaders_Vector => Is_Extension (Path, Loader.Extension)); function Loader (Path : String) return Loaders.Loader_Ptr is begin for Loader of Loaders_Vector loop if Is_Extension (Path, Loader.Extension) then return Loader; end if; end loop; raise Constraint_Error; end Loader; end Resource_Loaders; ----------------------------------------------------------------------------- type Pair is record Location : Locations.Location_Access; Loader : Loaders.Loader_Access; end record; package Pair_Vectors is new Ada.Containers.Vectors (Positive, Pair); protected Resource_Locations is procedure Add (Location : Locations.Location_Ptr; Loader : Loaders.Loader_Ptr); function Location (Loader : Loaders.Loader_Ptr; Path : String) return Locations.Location_Ptr; -- Return the first location, that match with the given loader, -- containing the file identified by the given path -- -- If none of the locations contain a file identified by the -- given path, the exception Locations.Name_Error is raised. private Pairs : Pair_Vectors.Vector; end Resource_Locations; protected body Resource_Locations is procedure Add (Location : Locations.Location_Ptr; Loader : Loaders.Loader_Ptr) is Element : constant Pair := (Location => Location, Loader => Loader); begin -- Check that the same combination of location and loader isn't -- added multiple times if (for some Pair of Pairs => Pair = Element) then raise Constraint_Error with "Location already added for the given loader"; end if; Pairs.Append (Element); end Add; function Location (Loader : Loaders.Loader_Ptr; Path : String) return Locations.Location_Ptr is File_Not_Found : Boolean := False; begin for Pair of Pairs loop if Loader = Pair.Loader then if Pair.Location.Exists (Path) then return Pair.Location; else File_Not_Found := True; end if; end if; end loop; if File_Not_Found then raise Locations.Name_Error with "Path '" & Path & "' not found"; end if; -- No locations have been added for the given loader raise Constraint_Error with "No locations added for the given loader"; end Location; end Resource_Locations; ----------------------------------------------------------------------------- type Read_Request is record Path : SU.Unbounded_String; Future : Futures.Pointers.Mutable_Pointer; Time : Orka.Time; end record; Null_Request : constant Read_Request := (others => <>); package Buffers is new Orka.Containers.Ring_Buffers (Read_Request); protected Queue is entry Enqueue (Element : Read_Request); entry Dequeue (Element : out Read_Request; Stop : out Boolean); procedure Shutdown; private Requests : Buffers.Buffer (Maximum_Requests); Should_Stop : Boolean := False; end Queue; protected body Queue is entry Enqueue (Element : Read_Request) when not Requests.Is_Full is begin Requests.Add_Last (Element); end Enqueue; entry Dequeue (Element : out Read_Request; Stop : out Boolean) when Should_Stop or else not Requests.Is_Empty is begin Stop := Should_Stop; if Should_Stop then return; end if; Element := Requests.Remove_First; end Dequeue; procedure Shutdown is begin Should_Stop := True; end Shutdown; end Queue; ----------------------------------------------------------------------------- procedure Add_Location (Location : Locations.Location_Ptr; Loader : Loaders.Loader_Ptr) is begin Resource_Locations.Add (Location, Loader); Resource_Loaders.Include (Loader); end Add_Location; function Load (Path : String) return Futures.Pointers.Mutable_Pointer is Slot : Futures.Future_Access; begin if not Resource_Loaders.Has_Loader (Path) then raise Resource_Load_Error with "No registered loader for " & Path; end if; Queues.Slots.Manager.Acquire (Slot); declare Pointer : Futures.Pointers.Mutable_Pointer; begin Pointer.Set (Slot); Queue.Enqueue ((Path => SU.To_Unbounded_String (Path), Future => Pointer, Time => Orka.OS.Monotonic_Clock)); return Pointer; -- Return Pointer instead of Pointer.Get to prevent -- adjust/finalize raising a Storage_Error end; end Load; procedure Shutdown is begin Queue.Shutdown; end Shutdown; task body Loader is Name : String renames Task_Name; Request : Read_Request; Stop : Boolean := False; begin Orka.OS.Set_Task_Name (Name); loop Queue.Dequeue (Request, Stop); exit when Stop; declare Future : Futures.Pointers.Reference renames Request.Future.Get; Promise : Futures.Promise'Class renames Futures.Promise'Class (Future.Value.all); begin Promise.Set_Status (Futures.Running); declare Path : constant String := SU.To_String (Request.Path); Loader : Loaders.Loader_Ptr renames Resource_Loaders.Loader (Path); Time_Start : constant Time := Orka.OS.Monotonic_Clock; Location : constant Locations.Location_Ptr := Resource_Locations.Location (Loader, Path); Bytes : constant Byte_Array_Pointers.Pointer := Location.Read_Data (Path); Time_End : constant Time := Orka.OS.Monotonic_Clock; Reading_Time : constant Duration := Time_End - Time_Start; procedure Enqueue (Element : Jobs.Job_Ptr) is begin Job_Queue.Enqueue (Element, Request.Future); end Enqueue; begin Loader.Load ((Bytes, Reading_Time, Request.Time, Request.Path), Enqueue'Access, Location); end; exception when Error : others => Orka.OS.Put_Line (Name & ": " & Ada.Exceptions.Exception_Information (Error)); Promise.Set_Failed (Error); end; -- Finalize the smart pointer (Request.Future) to reduce the -- number of references to the Future object Request := Null_Request; end loop; exception when Error : others => Orka.OS.Put_Line (Name & ": " & Ada.Exceptions.Exception_Information (Error)); end Loader; end Orka.Resources.Loader;
package body types.c with spark_mode => off is function len (s : c_string) return natural is len : natural := 0; begin for i in s'range loop exit when s(i) = nul; len := len + 1; end loop; return len; end len; procedure to_ada (dst : out string; src : in c_string) is begin for i in src'range loop exit when src(i) = nul; dst(i) := src(i); end loop; end to_ada; procedure to_c (dst : out c_string; src : in string) is len : natural := 0; begin for i in src'range loop dst(i) := src(i); len := len + 1; end loop; dst(len) := nul; end to_c; end types.c;
-- -- Copyright (c) 2002-2003, David Holm -- All rights reserved. -- -- Redistribution and use in source and binary forms, with or without -- modification, are permitted provided that the following conditions are -- met: -- -- * Redistributions of source code must retain the above copyright notice, -- this list of conditions and the following disclaimer. -- * Redistributions in binary form must reproduce the above copyright -- notice, -- this list of conditions and the following disclaimer in the -- documentation -- and/or other materials provided with the distribution. -- * The names of its contributors may not be used to endorse or promote -- products derived from this software without specific prior written -- permission. -- -- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -- "AS IS" -- AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -- IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE -- ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE -- LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR -- CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF -- SUBSTITUTE GOODS OR SERVICES; -- INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN -- CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) -- ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -- POSSIBILITY OF SUCH DAMAGE. -- with OpenGL.GLX; with X_Lib; package OpenGL.GLX.EXT is GLX_GLXEXT_VERSION : constant := 5; GLX_SAMPLE_BUFFERS_ARB : constant := 100000; GLX_SAMPLES_ARB : constant := 100001; GLX_SAMPLE_BUFFERS_SGIS : constant := 100000; GLX_SAMPLES_SGIS : constant := 100001; GLX_X_VISUAL_TYPE_EXT : constant := 16#0022#; GLX_TRANSPARENT_TYPE_EXT : constant := 16#0023#; GLX_TRANSPARENT_INDEX_VALUE_EXT : constant := 16#0024#; GLX_TRANSPARENT_RED_VALUE_EXT : constant := 16#0025#; GLX_TRANSPARENT_GREEN_VALUE_EXT : constant := 16#0026#; GLX_TRANSPARENT_BLUE_VALUE_EXT : constant := 16#0027#; GLX_TRANSPARENT_ALPHA_VALUE_EXT : constant := 16#0028#; GLX_NONE_EXT : constant := 16#8000#; GLX_TRUE_COLOR_EXT : constant := 16#0000_8002#; GLX_DIRECT_COLOR_EXT : constant := 16#0000_8003#; GLX_PSEUDO_COLOR_EXT : constant := 16#0000_8004#; GLX_STATIC_COLOR_EXT : constant := 16#0000_8005#; GLX_GRAY_SCALE_EXT : constant := 16#0000_8006#; GLX_STATIC_GRAY_EXT : constant := 16#0000_8007#; GLX_TRANSPARENT_RGB_EXT : constant := 16#0000_8008#; GLX_TRANSPARENT_INDEX_EXT : constant := 16#0000_8009#; GLX_VISUAL_CAVEAT_EXT : constant := 16#0020#; GLX_SLOW_VISUAL_EXT : constant := 16#0000_8001#; GLX_NON_CONFORMANT_VISUAL_EXT : constant := 16#0000_800D#; GLX_SHARE_CONTEXT_EXT : constant := 16#0000_800A#; GLX_VISUAL_ID_EXT : constant := 16#0000_800B#; GLX_SCREEN_EXT : constant := 16#0000_800C#; GLX_WINDOW_BIT_SGIX : constant := 16#0001#; GLX_PIXMAP_BIT_SGIX : constant := 16#0002#; GLX_RGBA_BIT_SGIX : constant := 16#0001#; GLX_COLOR_INDEX_BIT_SGIX : constant := 16#0002#; GLX_DRAWABLE_TYPE_SGIX : constant := 16#0000_8010#; GLX_RENDER_TYPE_SGIX : constant := 16#0000_8011#; GLX_X_RENDERABLE_SGIX : constant := 16#0000_8012#; GLX_FBCONFIG_ID_SGIX : constant := 16#0000_8013#; GLX_RGBA_TYPE_SGIX : constant := 16#0000_8014#; GLX_COLOR_INDEX_TYPE_SGIX : constant := 16#0000_8015#; GLX_PBUFFER_BIT_SGIX : constant := 16#0004#; GLX_BUFFER_CLOBBER_MASK_SGIX : constant := 16#0800_0000#; GLX_FRONT_LEFT_BUFFER_BIT_SGIX : constant := 16#0001#; GLX_FRONT_RIGHT_BUFFER_BIT_SGIX : constant := 16#0002#; GLX_BACK_LEFT_BUFFER_BIT_SGIX : constant := 16#0004#; GLX_BACK_RIGHT_BUFFER_BIT_SGIX : constant := 16#0008#; GLX_AUX_BUFFERS_BIT_SGIX : constant := 16#0010#; GLX_DEPTH_BUFFER_BIT_SGIX : constant := 16#0020#; GLX_STENCIL_BUFFER_BIT_SGIX : constant := 16#0040#; GLX_ACCUM_BUFFER_BIT_SGIX : constant := 16#0080#; GLX_SAMPLE_BUFFERS_BIT_SGIX : constant := 16#0100#; GLX_MAX_PBUFFER_WIDTH_SGIX : constant := 16#0000_8016#; GLX_MAX_PBUFFER_HEIGHT_SGIX : constant := 16#0000_8017#; GLX_MAX_PBUFFER_PIXELS_SGIX : constant := 16#0000_8018#; GLX_OPTIMAL_PBUFFER_WIDTH_SGIX : constant := 16#0000_8019#; GLX_OPTIMAL_PBUFFER_HEIGHT_SGIX : constant := 16#0000_801A#; GLX_PRESERVED_CONTENTS_SGIX : constant := 16#0000_801B#; GLX_LARGEST_PBUFFER_SGIX : constant := 16#0000_801C#; GLX_WIDTH_SGIX : constant := 16#0000_801D#; GLX_HEIGHT_SGIX : constant := 16#0000_801E#; GLX_EVENT_MASK_SGIX : constant := 16#0000_801F#; GLX_DAMAGED_SGIX : constant := 16#0000_8020#; GLX_SAVED_SGIX : constant := 16#0000_8021#; GLX_WINDOW_SGIX : constant := 16#0000_8022#; GLX_PBUFFER_SGIX : constant := 16#0000_8023#; GLX_SYNC_FRAME_SGIX : constant := 16#0000#; GLX_SYNC_SWAP_SGIX : constant := 16#0001#; GLX_DIGITAL_MEDIA_PBUFFER_SGIX : constant := 16#0000_8024#; GLX_BLENDED_RGBA_SGIS : constant := 16#0000_8025#; GLX_MULTISAMPLE_SUB_RECT_WIDTH_SGIS : constant := 16#0000_8026#; GLX_MULTISAMPLE_SUB_RECT_HEIGHT_SGIS : constant := 16#0000_8027#; GLX_SAMPLE_BUFFERS_3DFX : constant := 16#0000_8050#; GLX_SAMPLES_3DFX : constant := 16#0000_8051#; GLX_3DFX_WINDOW_MODE_MESA : constant := 16#0001#; GLX_3DFX_FULLSCREEN_MODE_MESA : constant := 16#0002#; GLX_VISUAL_SELECT_GROUP_SGIX : constant := 16#0000_8028#; GLX_SWAP_METHOD_OML : constant := 16#0000_8060#; GLX_SWAP_EXCHANGE_OML : constant := 16#0000_8061#; GLX_SWAP_COPY_OML : constant := 16#0000_8062#; GLX_SWAP_UNDEFINED_OML : constant := 16#0000_8063#; type GLXVIDEOSOURCESGIX is new X_Lib.XID; type GLXFBCONFIGIDSGIX is new X_Lib.XID; type GLXPBUFFERSGIX is new X_Lib.XID; type GLXFBCONFIGSGIX is access all OpenGL.GLX.struct_GLXFBConfigRec; type GLXEXTFUNCPTR is access procedure; end OpenGL.GLX.EXT;
-- { dg-do compile } -- { dg-options "-O2" } package body Case_Optimization1 is function F (Op_Kind : Internal_Operator_Symbol_Kinds) return Integer is begin case Op_Kind is when A_Not_Operator => return 3; when An_Exponentiate_Operator => return 2; when others => return 1; end case; end; function Len (E : Element) return Integer is Op_Kind : Internal_Element_Kinds := Int_Kind (E); begin return F (Int_Kind (E)); end; end Case_Optimization1;
pragma Warnings (Off); pragma Style_Checks (Off); -- VRML : [#VRML V1.0 ascii -- ] with GLOBE_3D; package SkotKnot is procedure Create ( object : in out GLOBE_3D.p_Object_3D; scale : GLOBE_3D.Real; centre : GLOBE_3D.Point_3D ); end;
------------------------------------------------------------------------------ -- Copyright (c) 2015, Natacha Porté -- -- -- -- Permission to use, copy, modify, and distribute this software for any -- -- purpose with or without fee is hereby granted, provided that the above -- -- copyright notice and this permission notice appear in all copies. -- -- -- -- THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES -- -- WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF -- -- MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR -- -- ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES -- -- WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN -- -- ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF -- -- OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. -- ------------------------------------------------------------------------------ package body Natools.File_Streams is overriding procedure Finalize (Object : in out Autoclose) is begin if Stream_IO.Is_Open (Object.Backend) then Stream_IO.Close (Object.Backend); end if; end Finalize; not overriding function Form (File : in File_Stream) return String is begin return Stream_IO.Form (File.Internal.Backend); end Form; not overriding function Create (Mode : in Stream_IO.File_Mode := Stream_IO.Out_File; Name : in String := ""; Form : in String := "") return File_Stream is begin return Result : File_Stream do Stream_IO.Create (Result.Internal.Backend, Mode, Name, Form); end return; end Create; not overriding function Mode (File : in File_Stream) return Stream_IO.File_Mode is begin return Stream_IO.Mode (File.Internal.Backend); end Mode; not overriding function Name (File : in File_Stream) return String is begin return Stream_IO.Name (File.Internal.Backend); end Name; not overriding function Open (Mode : in Stream_IO.File_Mode; Name : in String; Form : in String := "") return File_Stream is begin return Result : File_Stream do Stream_IO.Open (Result.Internal.Backend, Mode, Name, Form); end return; end Open; overriding procedure Read (Stream : in out File_Stream; Item : out Ada.Streams.Stream_Element_Array; Last : out Ada.Streams.Stream_Element_Offset) is pragma Unmodified (Stream); begin Stream_IO.Read (Stream.Internal.Backend, Item, Last); end Read; overriding procedure Write (Stream : in out File_Stream; Item : in Ada.Streams.Stream_Element_Array) is pragma Unmodified (Stream); begin Stream_IO.Write (Stream.Internal.Backend, Item); end Write; end Natools.File_Streams;
with Ada.Text_IO; use Ada.Text_IO; with Linked_List_Pkg; procedure demo is package List is new Linked_List_Pkg(Integer); use List; L : Linked_List; begin Put_Line(Boolean'Image(Is_Empty(L))); end demo;
package body iconv.Inside is function Version return String is begin raise Program_Error; return "glibc"; end Version; procedure Iterate (Process : not null access procedure (Name : in String)) is begin raise Program_Error; end Iterate; end iconv.Inside;
package Pck is type Data_Small is array (1 .. 2) of Integer; type Data_Large is array (1 .. 4) of Integer; function Create_Small return Data_Small; function Create_Large return Data_Large; end Pck;
package Giza.Bitmap_Fonts.FreeSerifBold8pt7b is Font : constant Giza.Font.Ref_Const; private FreeSerifBold8pt7bBitmaps : aliased constant Font_Bitmap := ( 16#FF#, 16#F4#, 16#90#, 16#FF#, 16#80#, 16#CF#, 16#3C#, 16#E3#, 16#88#, 16#12#, 16#32#, 16#36#, 16#7F#, 16#24#, 16#24#, 16#24#, 16#FE#, 16#64#, 16#6C#, 16#4C#, 16#10#, 16#3C#, 16#D6#, 16#92#, 16#D0#, 16#78#, 16#3E#, 16#1F#, 16#13#, 16#93#, 16#D7#, 16#7C#, 16#10#, 16#38#, 16#86#, 16#78#, 16#E5#, 16#0C#, 16#50#, 16#CA#, 16#07#, 16#27#, 16#04#, 16#D0#, 16#99#, 16#09#, 16#91#, 16#1A#, 16#10#, 16#C0#, 16#0E#, 16#01#, 16#B0#, 16#1B#, 16#01#, 16#A0#, 16#0C#, 16#E1#, 16#E4#, 16#66#, 16#4E#, 16#78#, 16#E7#, 16#0F#, 16#38#, 16#7D#, 16#E0#, 16#FF#, 16#80#, 16#12#, 16#44#, 16#CC#, 16#CC#, 16#CC#, 16#46#, 16#21#, 16#84#, 16#22#, 16#33#, 16#33#, 16#33#, 16#26#, 16#48#, 16#33#, 16#DE#, 16#CC#, 16#EE#, 16#D3#, 16#00#, 16#08#, 16#04#, 16#02#, 16#01#, 16#0F#, 16#F8#, 16#40#, 16#20#, 16#10#, 16#08#, 16#00#, 16#6D#, 16#95#, 16#00#, 16#F0#, 16#FF#, 16#80#, 16#18#, 16#C4#, 16#23#, 16#10#, 16#8C#, 16#42#, 16#30#, 16#3C#, 16#66#, 16#66#, 16#E7#, 16#E7#, 16#E7#, 16#E7#, 16#E7#, 16#66#, 16#66#, 16#3C#, 16#09#, 16#E3#, 16#8E#, 16#38#, 16#E3#, 16#8E#, 16#38#, 16#EF#, 16#C0#, 16#1E#, 16#37#, 16#81#, 16#C0#, 16#E0#, 16#60#, 16#70#, 16#30#, 16#30#, 16#31#, 16#3F#, 16#9F#, 16#C0#, 16#3C#, 16#CE#, 16#0E#, 16#0C#, 16#1E#, 16#0F#, 16#03#, 16#03#, 16#03#, 16#62#, 16#7C#, 16#0C#, 16#38#, 16#73#, 16#E9#, 16#D3#, 16#A7#, 16#7F#, 16#1C#, 16#38#, 16#70#, 16#3F#, 16#3E#, 16#20#, 16#40#, 16#7C#, 16#7E#, 16#06#, 16#02#, 16#02#, 16#E4#, 16#78#, 16#07#, 16#1C#, 16#30#, 16#70#, 16#FE#, 16#E7#, 16#E7#, 16#E7#, 16#E7#, 16#66#, 16#3C#, 16#7E#, 16#7E#, 16#86#, 16#04#, 16#04#, 16#0C#, 16#08#, 16#08#, 16#18#, 16#10#, 16#10#, 16#7C#, 16#C6#, 16#C6#, 16#E6#, 16#78#, 16#3E#, 16#5F#, 16#C7#, 16#C7#, 16#C6#, 16#7C#, 16#3C#, 16#66#, 16#E7#, 16#E7#, 16#E7#, 16#E7#, 16#7F#, 16#0E#, 16#0C#, 16#38#, 16#E0#, 16#FF#, 16#81#, 16#FF#, 16#FF#, 16#81#, 16#BF#, 16#2A#, 16#00#, 16#00#, 16#01#, 16#C3#, 16#C7#, 16#8E#, 16#03#, 16#80#, 16#70#, 16#0E#, 16#01#, 16#80#, 16#FF#, 16#80#, 16#00#, 16#00#, 16#0F#, 16#F8#, 16#C0#, 16#38#, 16#07#, 16#00#, 16#E0#, 16#38#, 16#F1#, 16#E1#, 16#C0#, 16#00#, 16#00#, 16#7D#, 16#1F#, 16#38#, 16#70#, 16#C2#, 16#04#, 16#00#, 16#38#, 16#70#, 16#E0#, 16#1F#, 16#06#, 16#11#, 16#99#, 16#64#, 16#DC#, 16#9B#, 16#A2#, 16#74#, 16#CE#, 16#92#, 16#7F#, 16#86#, 16#00#, 16#7C#, 16#00#, 16#04#, 16#00#, 16#C0#, 16#38#, 16#07#, 16#01#, 16#70#, 16#26#, 16#08#, 16#E1#, 16#FC#, 16#21#, 16#C8#, 16#3B#, 16#CF#, 16#80#, 16#FE#, 16#39#, 16#DC#, 16#EE#, 16#77#, 16#33#, 16#F1#, 16#CC#, 16#E7#, 16#73#, 16#B9#, 16#FF#, 16#80#, 16#1E#, 16#4C#, 16#76#, 16#0F#, 16#81#, 16#E0#, 16#38#, 16#0E#, 16#03#, 16#80#, 16#70#, 16#4C#, 16#21#, 16#F0#, 16#FE#, 16#1C#, 16#C7#, 16#19#, 16#C7#, 16#71#, 16#DC#, 16#77#, 16#1D#, 16#C7#, 16#71#, 16#9C#, 16#CF#, 16#E0#, 16#FF#, 16#9C#, 16#67#, 16#09#, 16#C0#, 16#72#, 16#1F#, 16#87#, 16#21#, 16#C8#, 16#70#, 16#5C#, 16#2F#, 16#F8#, 16#FF#, 16#B8#, 16#DC#, 16#2E#, 16#07#, 16#23#, 16#F1#, 16#D8#, 16#E4#, 16#70#, 16#38#, 16#3E#, 16#00#, 16#1E#, 16#46#, 16#39#, 16#83#, 16#70#, 16#2E#, 16#01#, 16#C0#, 16#38#, 16#FF#, 16#0E#, 16#71#, 16#C6#, 16#38#, 16#7C#, 16#00#, 16#FB#, 16#EE#, 16#39#, 16#C7#, 16#38#, 16#E7#, 16#1C#, 16#FF#, 16#9C#, 16#73#, 16#8E#, 16#71#, 16#CE#, 16#3B#, 16#EF#, 16#80#, 16#FB#, 16#9C#, 16#E7#, 16#39#, 16#CE#, 16#73#, 16#BE#, 16#1F#, 16#0E#, 16#0E#, 16#0E#, 16#0E#, 16#0E#, 16#0E#, 16#0E#, 16#0E#, 16#0E#, 16#CE#, 16#CC#, 16#78#, 16#F9#, 16#E7#, 16#0C#, 16#71#, 16#07#, 16#20#, 16#74#, 16#07#, 16#E0#, 16#77#, 16#07#, 16#38#, 16#71#, 16#C7#, 16#0E#, 16#FB#, 16#F0#, 16#F8#, 16#1C#, 16#07#, 16#01#, 16#C0#, 16#70#, 16#1C#, 16#07#, 16#01#, 16#C1#, 16#70#, 16#5C#, 16#3F#, 16#F8#, 16#F0#, 16#3D#, 16#C1#, 16#E7#, 16#87#, 16#96#, 16#2E#, 16#5C#, 16#B9#, 16#34#, 16#E4#, 16#D3#, 16#93#, 16#CE#, 16#46#, 16#39#, 16#18#, 16#EE#, 16#47#, 16#C0#, 16#E1#, 16#DC#, 16#27#, 16#89#, 16#72#, 16#5C#, 16#93#, 16#A4#, 16#79#, 16#0E#, 16#43#, 16#90#, 16#6E#, 16#08#, 16#1F#, 16#06#, 16#31#, 16#87#, 16#70#, 16#7E#, 16#0F#, 16#C1#, 16#F8#, 16#3F#, 16#07#, 16#60#, 16#C6#, 16#30#, 16#7C#, 16#00#, 16#FF#, 16#39#, 16#DC#, 16#EE#, 16#77#, 16#3B#, 16#F1#, 16#C0#, 16#E0#, 16#70#, 16#38#, 16#3E#, 16#00#, 16#1F#, 16#06#, 16#31#, 16#C7#, 16#70#, 16#7E#, 16#0F#, 16#C1#, 16#F8#, 16#3F#, 16#07#, 16#60#, 16#CE#, 16#38#, 16#44#, 16#07#, 16#00#, 16#70#, 16#07#, 16#80#, 16#FE#, 16#1C#, 16#E7#, 16#39#, 16#CE#, 16#73#, 16#1F#, 16#07#, 16#61#, 16#DC#, 16#73#, 16#9C#, 16#EF#, 16#9C#, 16#7B#, 16#8F#, 16#0F#, 16#0F#, 16#07#, 16#87#, 16#83#, 16#87#, 16#8A#, 16#E0#, 16#FF#, 16#F9#, 16#CE#, 16#38#, 16#87#, 16#00#, 16#E0#, 16#1C#, 16#03#, 16#80#, 16#70#, 16#0E#, 16#01#, 16#C0#, 16#7C#, 16#00#, 16#F9#, 16#DC#, 16#27#, 16#09#, 16#C2#, 16#70#, 16#9C#, 16#27#, 16#09#, 16#C2#, 16#70#, 16#8E#, 16#41#, 16#E0#, 16#FC#, 16#EE#, 16#08#, 16#C1#, 16#1C#, 16#41#, 16#88#, 16#3A#, 16#07#, 16#40#, 16#68#, 16#0E#, 16#00#, 16#C0#, 16#10#, 16#00#, 16#00#, 16#FB#, 16#E7#, 16#71#, 16#C2#, 16#30#, 16#C4#, 16#38#, 16#E4#, 16#39#, 16#64#, 16#19#, 16#68#, 16#1E#, 16#78#, 16#0E#, 16#38#, 16#0C#, 16#30#, 16#0C#, 16#30#, 16#04#, 16#10#, 16#FD#, 16#EF#, 16#18#, 16#E2#, 16#0E#, 16#80#, 16#E0#, 16#1C#, 16#03#, 16#C0#, 16#9C#, 16#21#, 16#C4#, 16#3B#, 16#CF#, 16#80#, 16#F8#, 16#EE#, 16#09#, 16#C2#, 16#1C#, 16#41#, 16#D0#, 16#3C#, 16#03#, 16#80#, 16#70#, 16#0E#, 16#01#, 16#C0#, 16#7C#, 16#00#, 16#7F#, 16#B0#, 16#C8#, 16#70#, 16#38#, 16#0C#, 16#07#, 16#03#, 16#80#, 16#C1#, 16#70#, 16#F8#, 16#6F#, 16#F8#, 16#FB#, 16#6D#, 16#B6#, 16#DB#, 16#6E#, 16#C6#, 16#10#, 16#C6#, 16#10#, 16#86#, 16#10#, 16#86#, 16#ED#, 16#B6#, 16#DB#, 16#6D#, 16#BE#, 16#18#, 16#70#, 16#B3#, 16#24#, 16#58#, 16#40#, 16#FF#, 16#C6#, 16#30#, 16#7E#, 16#63#, 16#B1#, 16#C0#, 16#E3#, 16#F7#, 16#3B#, 16#9D#, 16#FE#, 16#F0#, 16#38#, 16#1C#, 16#0F#, 16#C7#, 16#33#, 16#9D#, 16#CE#, 16#E7#, 16#73#, 16#B9#, 16#93#, 16#80#, 16#3E#, 16#CF#, 16#87#, 16#0E#, 16#1C#, 16#1C#, 16#1E#, 16#0F#, 16#03#, 16#81#, 16#C7#, 16#E6#, 16#77#, 16#3B#, 16#9D#, 16#CE#, 16#E7#, 16#33#, 16#8F#, 16#E0#, 16#3C#, 16#CB#, 16#9F#, 16#FE#, 16#1C#, 16#1C#, 16#9E#, 16#3D#, 16#D7#, 16#3E#, 16#71#, 16#C7#, 16#1C#, 16#71#, 16#CF#, 16#80#, 16#31#, 16#DF#, 16#BF#, 16#7E#, 16#E7#, 16#B0#, 16#7F#, 16#83#, 16#05#, 16#F0#, 16#F0#, 16#1C#, 16#07#, 16#01#, 16#DC#, 16#7B#, 16#9C#, 16#E7#, 16#39#, 16#CE#, 16#73#, 16#9C#, 16#EF#, 16#FC#, 16#73#, 16#81#, 16#E7#, 16#39#, 16#CE#, 16#73#, 16#BE#, 16#1C#, 16#70#, 16#0F#, 16#1C#, 16#71#, 16#C7#, 16#1C#, 16#71#, 16#C7#, 16#9F#, 16#E0#, 16#F0#, 16#38#, 16#1C#, 16#0E#, 16#F7#, 16#23#, 16#A1#, 16#F0#, 16#EC#, 16#77#, 16#39#, 16#FE#, 16#E0#, 16#F3#, 16#9C#, 16#E7#, 16#39#, 16#CE#, 16#73#, 16#BE#, 16#F7#, 16#71#, 16#EE#, 16#E7#, 16#3B#, 16#9C#, 16#EE#, 16#73#, 16#B9#, 16#CE#, 16#E7#, 16#3B#, 16#BF#, 16#FF#, 16#F7#, 16#1E#, 16#E7#, 16#39#, 16#CE#, 16#73#, 16#9C#, 16#E7#, 16#3B#, 16#FF#, 16#3C#, 16#66#, 16#E7#, 16#E7#, 16#E7#, 16#E7#, 16#66#, 16#3C#, 16#FE#, 16#39#, 16#9C#, 16#EE#, 16#77#, 16#3B#, 16#9D#, 16#CC#, 16#FC#, 16#70#, 16#38#, 16#3E#, 16#00#, 16#39#, 16#33#, 16#B9#, 16#DC#, 16#EE#, 16#77#, 16#39#, 16#9C#, 16#7E#, 16#07#, 16#03#, 16#83#, 16#E0#, 16#F6#, 16#FD#, 16#C3#, 16#87#, 16#0E#, 16#1C#, 16#7C#, 16#79#, 16#9E#, 16#79#, 16#9E#, 16#10#, 16#CF#, 16#9C#, 16#71#, 16#C7#, 16#1C#, 16#74#, 16#E0#, 16#F7#, 16#9C#, 16#E7#, 16#39#, 16#CE#, 16#73#, 16#9C#, 16#E7#, 16#38#, 16#FF#, 16#F7#, 16#62#, 16#74#, 16#34#, 16#3C#, 16#18#, 16#18#, 16#10#, 16#FF#, 16#6C#, 16#C9#, 16#9D#, 16#1B#, 16#A3#, 16#B8#, 16#73#, 16#04#, 16#40#, 16#88#, 16#F7#, 16#72#, 16#34#, 16#18#, 16#1C#, 16#2C#, 16#46#, 16#EF#, 16#F6#, 16#C5#, 16#D1#, 16#A3#, 16#83#, 16#06#, 16#08#, 16#11#, 16#C3#, 16#80#, 16#FF#, 16#18#, 16#71#, 16#C3#, 16#0E#, 16#38#, 16#FF#, 16#19#, 16#8C#, 16#63#, 16#18#, 16#D8#, 16#31#, 16#8C#, 16#63#, 16#18#, 16#60#, 16#FF#, 16#E0#, 16#C3#, 16#18#, 16#C6#, 16#31#, 16#83#, 16#63#, 16#18#, 16#C6#, 16#33#, 16#00#, 16#70#, 16#0E#); FreeSerifBold8pt7bGlyphs : aliased constant Glyph_Array := ( (0, 0, 0, 4, 0, 1), -- 0x20 ' ' (0, 3, 11, 5, 1, -10), -- 0x21 '!' (5, 6, 5, 9, 1, -10), -- 0x22 '"' (9, 8, 11, 8, 0, -10), -- 0x23 '#' (20, 8, 13, 8, 0, -11), -- 0x24 '$' (33, 12, 11, 16, 2, -10), -- 0x25 '%' (50, 12, 11, 13, 1, -10), -- 0x26 '&' (67, 2, 5, 4, 1, -10), -- 0x27 ''' (69, 4, 14, 5, 1, -10), -- 0x28 '(' (76, 4, 14, 5, 1, -10), -- 0x29 ')' (83, 6, 7, 8, 1, -10), -- 0x2A '*' (89, 9, 9, 11, 1, -7), -- 0x2B '+' (100, 3, 6, 4, 0, -2), -- 0x2C ',' (103, 4, 1, 5, 1, -3), -- 0x2D '-' (104, 3, 3, 4, 1, -2), -- 0x2E '.' (106, 5, 11, 4, 0, -10), -- 0x2F '/' (113, 8, 11, 8, 0, -10), -- 0x30 '0' (124, 6, 11, 8, 1, -10), -- 0x31 '1' (133, 9, 11, 8, 0, -10), -- 0x32 '2' (146, 8, 11, 8, 0, -10), -- 0x33 '3' (157, 7, 11, 8, 1, -10), -- 0x34 '4' (167, 8, 11, 8, 0, -10), -- 0x35 '5' (178, 8, 11, 8, 0, -10), -- 0x36 '6' (189, 8, 11, 8, 0, -10), -- 0x37 '7' (200, 8, 11, 8, 0, -10), -- 0x38 '8' (211, 8, 11, 8, 0, -10), -- 0x39 '9' (222, 3, 8, 5, 1, -7), -- 0x3A ':' (225, 3, 11, 5, 1, -7), -- 0x3B ';' (230, 9, 9, 11, 1, -8), -- 0x3C '<' (241, 9, 5, 11, 1, -5), -- 0x3D '=' (247, 9, 9, 11, 1, -7), -- 0x3E '>' (258, 7, 11, 8, 1, -10), -- 0x3F '?' (268, 11, 11, 15, 2, -10), -- 0x40 '@' (284, 11, 11, 12, 0, -10), -- 0x41 'A' (300, 9, 11, 11, 1, -10), -- 0x42 'B' (313, 10, 11, 11, 1, -10), -- 0x43 'C' (327, 10, 11, 12, 1, -10), -- 0x44 'D' (341, 10, 11, 11, 1, -10), -- 0x45 'E' (355, 9, 11, 10, 1, -10), -- 0x46 'F' (368, 11, 11, 12, 1, -10), -- 0x47 'G' (384, 11, 11, 12, 1, -10), -- 0x48 'H' (400, 5, 11, 6, 1, -10), -- 0x49 'I' (407, 8, 13, 8, 0, -10), -- 0x4A 'J' (420, 12, 11, 12, 1, -10), -- 0x4B 'K' (437, 10, 11, 11, 1, -10), -- 0x4C 'L' (451, 14, 11, 15, 1, -10), -- 0x4D 'M' (471, 10, 11, 12, 1, -10), -- 0x4E 'N' (485, 11, 11, 12, 1, -10), -- 0x4F 'O' (501, 9, 11, 10, 1, -10), -- 0x50 'P' (514, 11, 14, 12, 1, -10), -- 0x51 'Q' (534, 10, 11, 12, 1, -10), -- 0x52 'R' (548, 7, 11, 9, 1, -10), -- 0x53 'S' (558, 11, 11, 10, 0, -10), -- 0x54 'T' (574, 10, 11, 12, 1, -10), -- 0x55 'U' (588, 11, 12, 11, 0, -10), -- 0x56 'V' (605, 16, 11, 16, 0, -10), -- 0x57 'W' (627, 11, 11, 11, 0, -10), -- 0x58 'X' (643, 11, 11, 11, 0, -10), -- 0x59 'Y' (659, 10, 11, 10, 1, -10), -- 0x5A 'Z' (673, 3, 13, 5, 1, -10), -- 0x5B '[' (678, 5, 11, 4, 0, -10), -- 0x5C '\' (685, 3, 13, 5, 2, -10), -- 0x5D ']' (690, 7, 6, 9, 1, -10), -- 0x5E '^' (696, 8, 1, 8, 0, 2), -- 0x5F '_' (697, 4, 3, 5, 0, -10), -- 0x60 '`' (699, 9, 8, 8, 0, -7), -- 0x61 'a' (708, 9, 11, 9, 0, -10), -- 0x62 'b' (721, 7, 8, 7, 0, -7), -- 0x63 'c' (728, 9, 11, 9, 0, -10), -- 0x64 'd' (741, 7, 8, 7, 0, -7), -- 0x65 'e' (748, 6, 11, 6, 0, -10), -- 0x66 'f' (757, 7, 11, 8, 1, -7), -- 0x67 'g' (767, 10, 11, 9, 0, -10), -- 0x68 'h' (781, 5, 11, 5, 0, -10), -- 0x69 'i' (788, 6, 14, 6, 0, -10), -- 0x6A 'j' (799, 9, 11, 9, 0, -10), -- 0x6B 'k' (812, 5, 11, 4, 0, -10), -- 0x6C 'l' (819, 14, 8, 13, 0, -7), -- 0x6D 'm' (833, 10, 8, 9, 0, -7), -- 0x6E 'n' (843, 8, 8, 8, 0, -7), -- 0x6F 'o' (851, 9, 11, 9, 0, -7), -- 0x70 'p' (864, 9, 11, 9, 0, -7), -- 0x71 'q' (877, 7, 8, 7, 0, -7), -- 0x72 'r' (884, 4, 8, 6, 1, -7), -- 0x73 's' (888, 6, 10, 5, 0, -9), -- 0x74 't' (896, 10, 8, 9, 0, -7), -- 0x75 'u' (906, 8, 8, 8, 0, -7), -- 0x76 'v' (914, 11, 8, 11, 0, -7), -- 0x77 'w' (925, 8, 8, 8, 0, -7), -- 0x78 'x' (933, 7, 11, 8, 0, -7), -- 0x79 'y' (943, 7, 8, 7, 1, -7), -- 0x7A 'z' (950, 5, 15, 6, 0, -11), -- 0x7B '{' (960, 1, 11, 4, 1, -10), -- 0x7C '|' (962, 5, 15, 6, 2, -11), -- 0x7D '}' (972, 8, 2, 8, 0, -4)); -- 0x7E '~' Font_D : aliased constant Bitmap_Font := (FreeSerifBold8pt7bBitmaps'Access, FreeSerifBold8pt7bGlyphs'Access, 19); Font : constant Giza.Font.Ref_Const := Font_D'Access; end Giza.Bitmap_Fonts.FreeSerifBold8pt7b;
package UxAS.Comms.Transport is type Transport_Base is abstract tagged limited record -- these are public member data in the C++ version so they are visible -- in this base class (even if extensions are private, as they should -- be) Entity_Id : UInt32; Service_Id : UInt32; end record; end UxAS.Comms.Transport;
package body ACO.Utils.Scope_Locks is protected body Mutex is entry Seize when Is_Free is begin Is_Free := False; end Seize; procedure Release is begin Is_Free := True; end Release; end Mutex; overriding procedure Initialize (This : in out Scope_Lock) is begin This.Lock.Seize; end Initialize; overriding procedure Finalize (This : in out Scope_Lock) is begin This.Lock.Release; end Finalize; end ACO.Utils.Scope_Locks;
-- CZ1101A.ADA -- -- Grant of Unlimited Rights -- -- Under contracts F33600-87-D-0337, F33600-84-D-0280, MDA903-79-C-0687, -- F08630-91-C-0015, and DCA100-97-D-0025, the U.S. Government obtained -- unlimited rights in the software and documentation contained herein. -- Unlimited rights are defined in DFAR 252.227-7013(a)(19). By making -- this public release, the Government intends to confer upon all -- recipients unlimited rights equal to those held by the Government. -- These rights include rights to use, duplicate, release or disclose the -- released technical data and computer software in whole or in part, in -- any manner and for any purpose whatsoever, and to have or permit others -- to do so. -- -- DISCLAIMER -- -- ALL MATERIALS OR INFORMATION HEREIN RELEASED, MADE AVAILABLE OR -- DISCLOSED ARE AS IS. THE GOVERNMENT MAKES NO EXPRESS OR IMPLIED -- WARRANTY AS TO ANY MATTER WHATSOEVER, INCLUDING THE CONDITIONS OF THE -- SOFTWARE, DOCUMENTATION OR OTHER INFORMATION RELEASED, MADE AVAILABLE -- OR DISCLOSED, OR THE OWNERSHIP, MERCHANTABILITY, OR FITNESS FOR A -- PARTICULAR PURPOSE OF SAID MATERIAL. --* -- -- OBJECTIVE: -- CHECK THAT THE REPORT ROUTINES OF THE REPORT PACKAGE WORK -- CORRECTLY. -- -- PASS/FAIL CRITERIA: -- THIS TEST PASSES IF THE OUTPUT MATCHES THAT SUPPLIED IN THE -- APPLICABLE VERSION OF THE ACVC USERS' GUIDE. THE EXPECTED -- TEST RESULT IS "TENTATIVELY PASSED." -- HISTORY: -- JRK 08/07/81 CREATED ORIGINAL TEST. -- JRK 10/27/82 -- JRK 06/01/84 -- JET 01/13/88 ADDED TESTS OF SPECIAL_ACTION AND UPDATED HEADER. -- PWB 06/24/88 CORRECTED LENGTH OF ONE OUTPUT STRING AND ADDED -- PASS/FAIL CRITERIA. -- BCB 05/17/90 CORRECTED LENGTH OF 'MAX_LEN LONG' OUTPUT STRING. -- ADDED CODE TO CREATE REPFILE. -- LDC 05/17/90 REMOVED DIRECT_IO REFERENCES. -- PWN 12/03/94 REMOVED ADA 9X INCOMPATIBILITIES. WITH REPORT; USE REPORT; PROCEDURE CZ1101A IS DATE_AND_TIME : STRING(1..17); DATE, TIME : STRING(1..7); BEGIN COMMENT ("(CZ1101A) CHECK REPORT ROUTINES"); COMMENT (" INITIAL VALUES SHOULD BE 'NO_NAME' AND 'FAILED'"); RESULT; TEST ("PASS_TEST", "CHECKING 'TEST' AND 'RESULT' FOR 'PASSED'"); COMMENT ("THIS LINE IS EXACTLY 'MAX_LEN' LONG. " & "...5...60....5...70"); COMMENT ("THIS COMMENT HAS A WORD THAT SPANS THE FOLD " & "POINT. THIS COMMENT FITS EXACTLY ON TWO LINES. " & "..5...60....5...70"); COMMENT ("THIS_COMMENT_IS_ONE_VERY_LONG_WORD_AND_SO_" & "IT_SHOULD_BE_SPLIT_AT_THE_FOLD_POINT"); RESULT; COMMENT ("CHECK THAT 'RESULT' RESETS VALUES TO 'NO_NAME' " & "AND 'FAILED'"); RESULT; TEST ("FAIL_TEST", "CHECKING 'FAILED' AND 'RESULT' FOR 'FAILED'"); FAILED ("'RESULT' SHOULD NOW BE 'FAILED'"); RESULT; TEST ("NA_TEST", "CHECKING 'NOT-APPLICABLE'"); NOT_APPLICABLE ("'RESULT' SHOULD NOW BE 'NOT-APPLICABLE'"); RESULT; TEST ("FAIL_NA_TEST", "CHECKING 'NOT_APPLICABLE', 'FAILED', " & "'NOT_APPLICABLE'"); NOT_APPLICABLE ("'RESULT' BECOMES 'NOT-APPLICABLE'"); FAILED ("'RESULT' BECOMES 'FAILED'"); NOT_APPLICABLE ("CALLING 'NOT_APPLICABLE' DOESN'T CHANGE " & "'RESULT'"); RESULT; TEST ("SPEC_NA_TEST", "CHECKING 'SPEC_ACT', 'NOT_APPLICABLE', " & "'SPEC_ACT'"); SPECIAL_ACTION("'RESULT' BECOMES 'TENTATIVELY PASSED'"); NOT_APPLICABLE ("'RESULT' BECOMES 'NOT APPLICABLE'"); SPECIAL_ACTION("CALLING 'SPECIAL_ACTION' DOESN'T CHANGE 'RESULT'"); RESULT; TEST ("SPEC_FAIL_TEST", "CHECKING 'SPEC_ACT', 'FAILED', " & "'SPEC_ACT'"); SPECIAL_ACTION("'RESULT' BECOMES 'TENTATIVELY PASSED'"); FAILED ("'RESULT' BECOMES 'FAILED'"); SPECIAL_ACTION("CALLING 'SPECIAL_ACTION' DOESN'T CHANGE 'RESULT'"); RESULT; TEST ("CZ1101A", "CHECKING 'SPECIAL_ACTION' ALONE"); SPECIAL_ACTION("'RESULT' BECOMES 'TENTATIVELY PASSED'"); RESULT; END CZ1101A;
package Utilities is function Slurp (Filename : String) return String; end Utilities;
with Asis; package FP_Detect is type FP_Type_Code is (F, LF, SF); type FP_Type is record Precision : Positive; Name : Asis.Defining_Name; Is_Standard : Boolean; Code : FP_Type_Code; end record; type FP_Operator_Kind is (Field_Op, Elementary_Fn, Not_An_FP_Operator); type Maybe_FP_Operator(Kind : FP_Operator_Kind) is record case Kind is when Field_Op | Elementary_Fn => Type_Info : FP_Type; case Kind is when Field_Op => Op_Kind : Asis.Operator_Kinds; when Elementary_Fn => Fn_Name : Asis.Element; when Not_An_FP_Operator => null; end case; when Not_An_FP_Operator => null; end case; end record; No_FP_Operator : constant Maybe_FP_Operator := (Kind => Not_An_FP_Operator); function FP_Type_Of(Expr : Asis.Element) return FP_Type; function Is_FP_Operator_Expression(Element : Asis.Element) return Maybe_FP_Operator; end FP_Detect;
------------------------------------------------------------------------------ -- Copyright (c) 2014-2017, Natacha Porté -- -- -- -- Permission to use, copy, modify, and distribute this software for any -- -- purpose with or without fee is hereby granted, provided that the above -- -- copyright notice and this permission notice appear in all copies. -- -- -- -- THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES -- -- WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF -- -- MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR -- -- ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES -- -- WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN -- -- ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF -- -- OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. -- ------------------------------------------------------------------------------ ------------------------------------------------------------------------------ -- Natools.Cron.Tests provides a test suite for Natools.Cron. -- ------------------------------------------------------------------------------ with Natools.Tests; package Natools.Cron.Tests is package NT renames Natools.Tests; procedure All_Tests (Report : in out NT.Reporter'Class); procedure Basic_Usage (Report : in out NT.Reporter'Class); procedure Delete_While_Busy (Report : in out NT.Reporter'Class); procedure Delete_While_Collision (Report : in out NT.Reporter'Class); procedure Event_List_Extension (Report : in out NT.Reporter'Class); procedure Event_List_Fusion (Report : in out NT.Reporter'Class); procedure Insert_While_Busy (Report : in out NT.Reporter'Class); procedure Time_Collision (Report : in out NT.Reporter'Class); private type Bounded_String (Max_Size : Natural) is record Data : String (1 .. Max_Size); Size : Natural := 0; end record; procedure Append (S : in out Bounded_String; C : Character); function Get (S : Bounded_String) return String; procedure Reset (S : in out Bounded_String); type Test_Callback (Backend : access Bounded_String) is new Callback with record Symbol : Character; end record; overriding procedure Run (Self : in out Test_Callback); type Long_Callback (Backend : access Bounded_String) is new Callback with record Open, Close : Character; Wait : Duration; end record; overriding procedure Run (Self : in out Long_Callback); end Natools.Cron.Tests;
with AdaM.Factory, AdaM.Declaration.of_package; package body AdaM.context_Line is -- Storage Pool -- record_Version : constant := 1; max_context_Lines : constant := 5_000; package Pool is new AdaM.Factory.Pools (".adam-store", "context_lines", max_context_Lines, record_Version, context_Line.item, context_Line.view); -- Vector -- function to_Source (the_Lines : in Vector) return text_Vectors.Vector is the_Source : text_Vectors.Vector; begin for i in 1 .. the_Lines.Length loop the_Source.append (the_Lines.Element (Integer (i)).to_Source); end loop; return the_Source; end to_Source; -- Forge -- procedure define (Self : in out Item; Name : in String) is begin Self.package_Name := +Name; Self.Used := False; end define; procedure destruct (Self : in out Item) is begin null; end destruct; function new_context_Line (Name : in String := "") return View is new_View : constant context_Line.view := Pool.new_Item; begin define (context_Line.item (new_View.all), Name); return new_View; end new_context_Line; procedure free (Self : in out context_Line.view) is begin destruct (context_Line.item (Self.all)); Pool.free (Self); end free; -- Attributes -- overriding function Id (Self : access Item) return AdaM.Id is begin return Pool.to_Id (Self); end Id; function my_Package (Self : in Item) return Package_view is begin return Self.my_Package; end my_Package; procedure Package_is (Self : in out Item; Now : in Package_view) is begin Self.my_Package := Now; end Package_is; function Name (Self : access Item) return access Text is begin return Self.package_Name'Access; end Name; function Name (Self : in Item) return String is begin return +Self.package_Name; end Name; procedure Name_is (Self : in out Item; Now : in String) is begin Self.package_Name := +Now; end Name_is; function is_Used (Self : in Item) return Boolean is begin return Self.Used; end is_Used; procedure is_Used (Self : in out Item; Now : in Boolean) is begin Self.Used := Now; end is_Used; function to_Source (Self : in Item) return text_Vectors.Vector is use ada.Strings.unbounded; the_Line : Text := +"with " & String (Self.my_Package.full_Name) & ";"; the_Source : text_Vectors.Vector; begin if Self.Used then append (the_Line, " use " & String (Self.my_Package.full_Name) & ";"); end if; the_Source.append (the_Line); return the_Source; end to_Source; -- Streams -- procedure View_write (Stream : not null access Ada.Streams.Root_Stream_Type'Class; Self : in View) renames Pool.View_write; procedure View_read (Stream : not null access Ada.Streams.Root_Stream_Type'Class; Self : out View) renames Pool.View_read; procedure Package_view_write (Stream : not null access Ada.Streams.Root_Stream_Type'Class; Self : in Package_view) is begin Declaration.of_package.View_write (Stream, Declaration.of_package.view (Self)); end Package_view_write; procedure Package_view_read (Stream : not null access Ada.Streams.Root_Stream_Type'Class; Self : out Package_view) is begin Declaration.of_package.View_read (Stream, Declaration.of_package.view (Self)); end Package_view_read; end AdaM.context_Line;
------------------------------------------------------------------------------ -- -- -- GNAT COMPILER COMPONENTS -- -- -- -- B A C K _ E N D -- -- -- -- B o d y -- -- -- -- Copyright (C) 1992-2006, Free Software Foundation, Inc. -- -- -- -- GNAT is free software; you can redistribute it and/or modify it under -- -- terms of the GNU General Public License as published by the Free Soft- -- -- ware Foundation; either version 2, or (at your option) any later ver- -- -- sion. GNAT is distributed in the hope that it will be useful, but WITH- -- -- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY -- -- or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -- -- for more details. You should have received a copy of the GNU General -- -- Public License distributed with GNAT; see file COPYING. If not, write -- -- to the Free Software Foundation, 51 Franklin Street, Fifth Floor, -- -- Boston, MA 02110-1301, USA. -- -- -- -- GNAT was originally developed by the GNAT team at New York University. -- -- Extensive contributions were provided by Ada Core Technologies Inc. -- -- -- ------------------------------------------------------------------------------ with Atree; use Atree; with Debug; use Debug; with Elists; use Elists; with Lib; use Lib; with Osint; use Osint; with Opt; use Opt; with Osint.C; use Osint.C; with Namet; use Namet; with Nlists; use Nlists; with Stand; use Stand; with Sinput; use Sinput; with Stringt; use Stringt; with Switch; use Switch; with Switch.C; use Switch.C; with System; use System; with Types; use Types; package body Back_End is ------------------- -- Call_Back_End -- ------------------- procedure Call_Back_End (Mode : Back_End_Mode_Type) is -- The File_Record type has a lot of components that are meaningless -- to the back end, so a new record is created here to contain the -- needed information for each file. type Needed_File_Info_Type is record File_Name : File_Name_Type; First_Sloc : Source_Ptr; Last_Sloc : Source_Ptr; Num_Source_Lines : Nat; end record; File_Info_Array : array (Main_Unit .. Last_Unit) of Needed_File_Info_Type; procedure gigi ( gnat_root : Int; max_gnat_node : Int; number_name : Nat; nodes_ptr : Address; next_node_ptr : Address; prev_node_ptr : Address; elists_ptr : Address; elmts_ptr : Address; strings_ptr : Address; string_chars_ptr : Address; list_headers_ptr : Address; number_units : Int; file_info_ptr : Address; gigi_standard_integer : Entity_Id; gigi_standard_long_long_float : Entity_Id; gigi_standard_exception_type : Entity_Id; gigi_operating_mode : Back_End_Mode_Type); pragma Import (C, gigi); S : Source_File_Index; begin -- Skip call if in -gnatdH mode if Debug_Flag_HH then return; end if; for J in Main_Unit .. Last_Unit loop S := Source_Index (J); File_Info_Array (J).File_Name := File_Name (S); File_Info_Array (J).First_Sloc := Source_Text (S)'First; File_Info_Array (J).Last_Sloc := Source_Text (S)'Last; File_Info_Array (J).Num_Source_Lines := Num_Source_Lines (S); end loop; gigi ( gnat_root => Int (Cunit (Main_Unit)), max_gnat_node => Int (Last_Node_Id - First_Node_Id + 1), number_name => Name_Entries_Count, nodes_ptr => Nodes_Address, next_node_ptr => Next_Node_Address, prev_node_ptr => Prev_Node_Address, elists_ptr => Elists_Address, elmts_ptr => Elmts_Address, strings_ptr => Strings_Address, string_chars_ptr => String_Chars_Address, list_headers_ptr => Lists_Address, number_units => Num_Units, file_info_ptr => File_Info_Array'Address, gigi_standard_integer => Standard_Integer, gigi_standard_long_long_float => Standard_Long_Long_Float, gigi_standard_exception_type => Standard_Exception_Type, gigi_operating_mode => Mode); end Call_Back_End; ----------------------------- -- Scan_Compiler_Arguments -- ----------------------------- procedure Scan_Compiler_Arguments is Next_Arg : Pos := 1; subtype Big_String is String (Positive); type BSP is access Big_String; type Arg_Array is array (Nat) of BSP; type Arg_Array_Ptr is access Arg_Array; -- Import flag_stack_check from toplev.c flag_stack_check : Int; pragma Import (C, flag_stack_check); -- Import from toplev.c save_argc : Nat; pragma Import (C, save_argc); -- Import from toplev.c save_argv : Arg_Array_Ptr; pragma Import (C, save_argv); -- Import from toplev.c Output_File_Name_Seen : Boolean := False; -- Set to True after having scanned the file_name for -- switch "-gnatO file_name" -- Local functions function Len_Arg (Arg : Pos) return Nat; -- Determine length of argument number Arg on the original -- command line from gnat1 procedure Scan_Back_End_Switches (Switch_Chars : String); -- Procedure to scan out switches stored in Switch_Chars. The first -- character is known to be a valid switch character, and there are no -- blanks or other switch terminator characters in the string, so the -- entire string should consist of valid switch characters, except that -- an optional terminating NUL character is allowed. -- -- Back end switches have already been checked and processed by GCC -- in toplev.c, so no errors can occur and control will always return. -- The switches must still be scanned to skip the arguments of the -- "-o" or the (undocumented) "-dumpbase" switch, by incrementing -- the Next_Arg variable. The "-dumpbase" switch is used to set the -- basename for GCC dumpfiles. ------------- -- Len_Arg -- ------------- function Len_Arg (Arg : Pos) return Nat is begin for J in 1 .. Nat'Last loop if save_argv (Arg).all (Natural (J)) = ASCII.NUL then return J - 1; end if; end loop; raise Program_Error; end Len_Arg; ---------------------------- -- Scan_Back_End_Switches -- ---------------------------- procedure Scan_Back_End_Switches (Switch_Chars : String) is First : constant Positive := Switch_Chars'First + 1; Last : Natural := Switch_Chars'Last; begin if Last >= First and then Switch_Chars (Last) = ASCII.NUL then Last := Last - 1; end if; -- For these switches, skip following argument and do not -- store either the switch or the following argument if Switch_Chars (First .. Last) = "o" or else Switch_Chars (First .. Last) = "dumpbase" or else Switch_Chars (First .. Last) = "-param" then Next_Arg := Next_Arg + 1; -- Do not record -quiet switch elsif Switch_Chars (First .. Last) = "quiet" then null; else -- Store any other GCC switches Store_Compilation_Switch (Switch_Chars); end if; end Scan_Back_End_Switches; -- Start of processing for Scan_Compiler_Arguments begin -- Acquire stack checking mode directly from GCC Opt.Stack_Checking_Enabled := (flag_stack_check /= 0); -- Loop through command line arguments, storing them for later access while Next_Arg < save_argc loop Look_At_Arg : declare Argv_Ptr : constant BSP := save_argv (Next_Arg); Argv_Len : constant Nat := Len_Arg (Next_Arg); Argv : constant String := Argv_Ptr (1 .. Natural (Argv_Len)); begin -- If the previous switch has set the Output_File_Name_Present -- flag (that is we have seen a -gnatO), then the next argument -- is the name of the output object file. if Output_File_Name_Present and then not Output_File_Name_Seen then if Is_Switch (Argv) then Fail ("Object file name missing after -gnatO"); else Set_Output_Object_File_Name (Argv); Output_File_Name_Seen := True; end if; -- If the previous switch has set the Search_Directory_Present -- flag (that is if we have just seen -I), then the next -- argument is a search directory path. elsif Search_Directory_Present then if Is_Switch (Argv) then Fail ("search directory missing after -I"); else Add_Src_Search_Dir (Argv); Search_Directory_Present := False; end if; elsif not Is_Switch (Argv) then -- must be a file name Add_File (Argv); -- We must recognize -nostdinc to suppress visibility on the -- standard GNAT RTL sources. This is also a gcc switch. elsif Argv (Argv'First + 1 .. Argv'Last) = "nostdinc" then Opt.No_Stdinc := True; Scan_Back_End_Switches (Argv); -- We must recognize -nostdlib to suppress visibility on the -- standard GNAT RTL objects. elsif Argv (Argv'First + 1 .. Argv'Last) = "nostdlib" then Opt.No_Stdlib := True; elsif Is_Front_End_Switch (Argv) then Scan_Front_End_Switches (Argv); -- All non-front-end switches are back-end switches else Scan_Back_End_Switches (Argv); end if; end Look_At_Arg; Next_Arg := Next_Arg + 1; end loop; end Scan_Compiler_Arguments; end Back_End;
with Ada.Text_IO; use Ada.Text_IO; with GNAT.Sockets; use GNAT.Sockets; procedure DNSQuerying is Host : Host_Entry_Type (1, 1); Inet_Addr_V4 : Inet_Addr_Type (Family_Inet); begin Host := Get_Host_By_Name (Name => "www.kame.net"); Inet_Addr_V4 := Addresses (Host); Put ("IPv4: " & Image (Value => Inet_Addr_V4)); end DNSQuerying;
with Ada.Text_IO; use Ada.Text_IO; package body AssignmentByIfExamples is function Example1_Pattern1 (condition : Boolean) return Boolean; function Example1_Pattern1 (condition : Boolean) return Boolean is variable : Boolean; begin if condition then variable := True; else variable := False; end if; return variable; end Example1_Pattern1; function Example2_Pattern1 (condition : Boolean) return Boolean; function Example2_Pattern1 (condition : Boolean) return Boolean is AB : array (1 .. 1) of Boolean; begin if not condition then AB (1) := True; else AB (1) := False; end if; return AB (1); end Example2_Pattern1; function Example_Pattern2 (condition : Boolean) return Boolean; function Example_Pattern2 (condition : Boolean) return Boolean is variable : Boolean; begin variable := False; if condition then variable := True; end if; return variable; end Example_Pattern2; function Example_Pattern3 (condition : Boolean) return Boolean; function Example_Pattern3 (condition : Boolean) return Boolean is variable : Boolean := False; begin if condition then variable := True; end if; return variable; end Example_Pattern3; procedure Dummy is begin if Example1_Pattern1 (True) and then Example2_Pattern1 (True) and then Example_Pattern2 (True) and then Example_Pattern3 (True) then Put_Line ("True"); end if; end Dummy; end AssignmentByIfExamples;
pragma License (Unrestricted); -- implementation unit specialized for FreeBSD (or Linux) with System.Storage_Elements; package System.Unbounded_Allocators is -- Separated storage pool for local scope. pragma Preelaborate; type Unbounded_Allocator is limited private; procedure Initialize (Object : in out Unbounded_Allocator); procedure Finalize (Object : in out Unbounded_Allocator); procedure Allocate ( Allocator : Unbounded_Allocator; Storage_Address : out Address; Size_In_Storage_Elements : Storage_Elements.Storage_Count; Alignment : Storage_Elements.Storage_Count); procedure Deallocate ( Allocator : Unbounded_Allocator; Storage_Address : Address; Size_In_Storage_Elements : Storage_Elements.Storage_Count; Alignment : Storage_Elements.Storage_Count); function Allocator_Of (Storage_Address : Address) return Unbounded_Allocator; private type Header; type Header_Access is access all Header; type Header is record Previous : Header_Access; -- low 1 bit is set if sentinel Next : Header_Access; end record; pragma Suppress_Initialization (Header); type Unbounded_Allocator is new Header_Access; end System.Unbounded_Allocators;
Delete_File ("input.txt"); Delete_File ("/input.txt"); Delete_Tree ("docs"); Delete_Tree ("/docs");
-- Copyright 2019 Michael Casadevall <michael@casadevall.pro> -- -- Permission is hereby granted, free of charge, to any person obtaining a copy -- of this software and associated documentation files (the "Software"), to -- deal in the Software without restriction, including without limitation the -- rights to use, copy, modify, merge, publish, distribute, sublicense, and/or -- sell copies of the Software, and to permit persons to whom the Software is -- furnished to do so, subject to the following conditions: -- -- The above copyright notice and this permission notice shall be included in -- all copies or substantial portions of the Software. -- -- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL -- THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING -- FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER -- DEALINGS IN THE SOFTWARE. with Ada.Unchecked_Conversion; with Ada.Unchecked_Deallocation; with Ada.Exceptions; use Ada.Exceptions; with GNAT.Sockets; use GNAT.Sockets; with DNSCatcher.Config; with DNSCatcher.Utils.Logger; use DNSCatcher.Utils.Logger; with DNSCatcher.Network.UDP.Receiver; with DNSCatcher.Network.UDP.Sender; with DNSCatcher.DNS.Transaction_Manager; use DNSCatcher.DNS.Transaction_Manager; package body DNSCatcher.DNS.Server is Shutting_Down : Boolean := False; procedure Start_Server is -- Input and Output Sockets Capture_Config : DNSCatcher.Config.Configuration; DNS_Transactions : DNSCatcher.DNS.Transaction_Manager .DNS_Transaction_Manager_Task; Receiver_Interface : DNSCatcher.Network.UDP.Receiver .UDP_Receiver_Interface; Sender_Interface : DNSCatcher.Network.UDP.Sender.UDP_Sender_Interface; Logger_Task : DNSCatcher.Utils.Logger.Logger; Transaction_Manager_Ptr : DNS_Transaction_Manager_Task_Ptr; Socket : Socket_Type; Logger_Packet : DNSCatcher.Utils.Logger.Logger_Message_Packet_Ptr; procedure Free_Transaction_Manager is new Ada.Unchecked_Deallocation (Object => DNS_Transaction_Manager_Task, Name => DNS_Transaction_Manager_Task_Ptr); begin -- Load the config file from disk DNSCatcher.Config.Initialize (Capture_Config); DNSCatcher.Config.Read_Cfg_File (Capture_Config, "conf/dnscatcherd.conf"); -- Configure the logger Capture_Config.Logger_Config.Log_Level := DEBUG; Capture_Config.Logger_Config.Use_Color := True; Logger_Task.Initialize (Capture_Config.Logger_Config); Transaction_Manager_Ptr := new DNS_Transaction_Manager_Task; -- Connect the packet queue and start it all up Logger_Task.Start; Logger_Packet := new DNSCatcher.Utils.Logger.Logger_Message_Packet; Logger_Packet.Log_Message (NOTICE, "DNSCatcher starting up ..."); DNSCatcher.Utils.Logger.Logger_Queue.Add_Packet (Logger_Packet); -- Socket has to be shared between receiver and sender. This likely needs -- to move to to a higher level class begin Create_Socket (Socket => Socket, Mode => Socket_Datagram); Set_Socket_Option (Socket => Socket, Level => IP_Protocol_For_IP_Level, Option => (GNAT.Sockets.Receive_Timeout, Timeout => 1.0)); Bind_Socket (Socket => Socket, Address => (Family => Family_Inet, Addr => Any_Inet_Addr, Port => Capture_Config.Local_Listen_Port)); exception when Exp_Error : GNAT.Sockets.Socket_Error => begin Logger_Packet := new DNSCatcher.Utils.Logger.Logger_Message_Packet; Logger_Packet.Log_Message (ERROR, "Socket error: " & Exception_Information (Exp_Error)); Logger_Packet.Log_Message (ERROR, "Refusing to start!"); Logger_Queue.Add_Packet (Logger_Packet); goto Shutdown_Procedure; end; end; Receiver_Interface.Initialize (Capture_Config, Transaction_Manager_Ptr, Socket); Sender_Interface.Initialize (Socket); Transaction_Manager_Ptr.Set_Packet_Queue (Sender_Interface.Get_Packet_Queue_Ptr); Transaction_Manager_Ptr.Start; Receiver_Interface.Start; Sender_Interface.Start; loop if Shutting_Down then goto Shutdown_Procedure; else delay 1.0; end if; end loop; <<Shutdown_Procedure>> Sender_Interface.Shutdown; Receiver_Interface.Shutdown; Transaction_Manager_Ptr.Stop; Logger_Task.Stop; Free_Transaction_Manager (Transaction_Manager_Ptr); end Start_Server; -- And shutdown procedure Stop_Server is begin Shutting_Down := True; end Stop_Server; end DNSCatcher.DNS.Server;
-- Copyright 2021 Jeff Foley. All rights reserved. -- Use of this source code is governed by Apache 2 LICENSE that can be found in the LICENSE file. local url = require("url") name = "DNSDumpster" type = "scrape" function start() set_rate_limit(1) end function vertical(ctx, domain) local u = "https://dnsdumpster.com" local token = get_token(ctx, u) if token == "" then return end local headers = { ['Content-Type']="application/x-www-form-urlencoded", ['Referer']=u, ['X-CSRF-Token']=token, } local params = { ['csrfmiddlewaretoken']=token, ['targetip']=domain, ['user']="free" } local resp, err = request(ctx, { ['method']="POST", ['data']=url.build_query_string(params), ['url']=u, ['headers']=headers, }) if (err ~= nil and err ~= "") then log(ctx, "vertical request to service failed: " .. err) return end send_names(ctx, resp) end function get_token(ctx, u) local resp, err = request(ctx, {['url']=u}) if (err ~= nil and err ~= "") then log(ctx, "vertical request to service failed: " .. err) return "" end local matches = submatch(resp, '<input type="hidden" name="csrfmiddlewaretoken" value="([a-zA-Z0-9]*)">') if (matches == nil or #matches == 0) then return "" end local match = matches[1] if (match == nil or #match ~= 2) then return "" end return match[2] end
with ada.text_io, ada.Integer_text_IO, Ada.Text_IO.Text_Streams, Ada.Strings.Fixed, Interfaces.C; use ada.text_io, ada.Integer_text_IO, Ada.Strings, Ada.Strings.Fixed, Interfaces.C; procedure plus_petit is type stringptr is access all char_array; procedure PInt(i : in Integer) is begin String'Write (Text_Streams.Stream (Current_Output), Trim(Integer'Image(i), Left)); end; procedure SkipSpaces is C : Character; Eol : Boolean; begin loop Look_Ahead(C, Eol); exit when Eol or C /= ' '; Get(C); end loop; end; type c is Array (Integer range <>) of Integer; type c_PTR is access c; function go0(tab : in c_PTR; a : in Integer; b : in Integer) return Integer is m : Integer; j : Integer; i : Integer; e : Integer; begin m := (a + b) / 2; if a = m then if tab(a) = m then return b; else return a; end if; end if; i := a; j := b; while i < j loop e := tab(i); if e < m then i := i + 1; else j := j - 1; tab(i) := tab(j); tab(j) := e; end if; end loop; if i < m then return go0(tab, a, m); else return go0(tab, m, b); end if; end; function plus_petit0(tab : in c_PTR; len : in Integer) return Integer is begin return go0(tab, 0, len); end; tmp : Integer; tab : c_PTR; len : Integer; begin len := 0; Get(len); SkipSpaces; tab := new c (0..len - 1); for i in integer range 0..len - 1 loop tmp := 0; Get(tmp); SkipSpaces; tab(i) := tmp; end loop; PInt(plus_petit0(tab, len)); end;
package body Array27_Pkg is function F return Inner_Type is begin return "123"; end; end Array27_Pkg;
----------------------------------------------------------------------- -- awa-counters-components -- Counter UI component -- Copyright (C) 2015 Stephane Carrez -- Written by Stephane Carrez (Stephane.Carrez@gmail.com) -- -- Licensed under the Apache License, Version 2.0 (the "License"); -- you may not use this file except in compliance with the License. -- You may obtain a copy of the License at -- -- http://www.apache.org/licenses/LICENSE-2.0 -- -- Unless required by applicable law or agreed to in writing, software -- distributed under the License is distributed on an "AS IS" BASIS, -- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -- See the License for the specific language governing permissions and -- limitations under the License. ----------------------------------------------------------------------- with Util.Beans.Objects; with Util.Beans.Basic; with AWA.Counters.Beans; with ASF.Components.Base; with ASF.Views.Nodes; with ASF.Utils; with ASF.Contexts.Writer; package body AWA.Counters.Components is TEXT_ATTRIBUTE_NAMES : Util.Strings.String_Set.Set; function Create_Counter return ASF.Components.Base.UIComponent_Access; -- ------------------------------ -- Create a UICounter component. -- ------------------------------ function Create_Counter return ASF.Components.Base.UIComponent_Access is begin return new UICounter; end Create_Counter; URI : aliased constant String := "http://code.google.com/p/ada-awa/jsf"; COUNTER_TAG : aliased constant String := "counter"; AWA_Bindings : aliased constant ASF.Factory.Binding_Array := (1 => (Name => COUNTER_TAG'Access, Component => Create_Counter'Access, Tag => ASF.Views.Nodes.Create_Component_Node'Access) ); AWA_Factory : aliased constant ASF.Factory.Factory_Bindings := (URI => URI'Access, Bindings => AWA_Bindings'Access); -- ------------------------------ -- Get the AWA Counter component factory. -- ------------------------------ function Definition return ASF.Factory.Factory_Bindings_Access is begin return AWA_Factory'Access; end Definition; -- ------------------------------ -- Check if the counter value is hidden. -- ------------------------------ function Is_Hidden (UI : in UICounter; Context : in ASF.Contexts.Faces.Faces_Context'Class) return Boolean is Value : constant Util.Beans.Objects.Object := UI.Get_Attribute (Context, "hidden"); begin return Util.Beans.Objects.To_Boolean (Value); end Is_Hidden; -- ------------------------------ -- Render the counter component. Starts the DL/DD list and write the input -- component with the possible associated error message. -- ------------------------------ overriding procedure Encode_Begin (UI : in UICounter; Context : in out ASF.Contexts.Faces.Faces_Context'Class) is begin if not UI.Is_Rendered (Context) then return; end if; declare Value : constant Util.Beans.Objects.Object := UI.Get_Attribute (Context, "value"); Bean : constant access Util.Beans.Basic.Readonly_Bean'Class := Util.Beans.Objects.To_Bean (Value); Writer : constant ASF.Contexts.Writer.Response_Writer_Access := Context.Get_Response_Writer; Counter : AWA.Counters.Beans.Counter_Bean_Access; begin if Bean = null then ASF.Components.Base.Log_Error (UI, "There is no counter bean value"); return; elsif not (Bean.all in AWA.Counters.Beans.Counter_Bean'Class) then ASF.Components.Base.Log_Error (UI, "The bean value is not a Counter_Bean"); return; end if; Counter := AWA.Counters.Beans.Counter_Bean'Class (Bean.all)'Unchecked_Access; -- Increment the counter associated with the optional key. AWA.Counters.Increment (Counter => Counter.Counter, Key => Counter.Object); -- Render the counter within an optional <span>. if Counter.Value >= 0 and not UI.Is_Hidden (Context) then Writer.Start_Optional_Element ("span"); UI.Render_Attributes (Context, TEXT_ATTRIBUTE_NAMES, Writer); Writer.Write_Text (Integer'Image (Counter.Value)); Writer.End_Optional_Element ("span"); end if; end; end Encode_Begin; begin ASF.Utils.Set_Text_Attributes (TEXT_ATTRIBUTE_NAMES); end AWA.Counters.Components;
-- SPDX-FileCopyrightText: 2019 Max Reznik <reznikmm@gmail.com> -- -- SPDX-License-Identifier: MIT ------------------------------------------------------------- with Program.Elements.Definitions; with Program.Lexical_Elements; with Program.Elements.Expressions; with Program.Elements.Constraints; package Program.Elements.Subtype_Indications is pragma Pure (Program.Elements.Subtype_Indications); type Subtype_Indication is limited interface and Program.Elements.Definitions.Definition; type Subtype_Indication_Access is access all Subtype_Indication'Class with Storage_Size => 0; not overriding function Subtype_Mark (Self : Subtype_Indication) return not null Program.Elements.Expressions.Expression_Access is abstract; not overriding function Constraint (Self : Subtype_Indication) return Program.Elements.Constraints.Constraint_Access is abstract; not overriding function Has_Not_Null (Self : Subtype_Indication) return Boolean is abstract; type Subtype_Indication_Text is limited interface; type Subtype_Indication_Text_Access is access all Subtype_Indication_Text'Class with Storage_Size => 0; not overriding function To_Subtype_Indication_Text (Self : in out Subtype_Indication) return Subtype_Indication_Text_Access is abstract; not overriding function Not_Token (Self : Subtype_Indication_Text) return Program.Lexical_Elements.Lexical_Element_Access is abstract; not overriding function Null_Token (Self : Subtype_Indication_Text) return Program.Lexical_Elements.Lexical_Element_Access is abstract; end Program.Elements.Subtype_Indications;
with Ada.Strings.Unbounded; with Ada.Strings.Unbounded.Hash; with Ada.Containers.Vectors; with Ada.Containers.Hashed_Maps; with Ada.Text_IO; package GPR_Tools.Pkg2gpr is use Ada.Strings.Unbounded; package String_Vectors is new Ada.Containers.Vectors (Natural, Unbounded_String); package String_Maps is new Ada.Containers.Hashed_Maps (Unbounded_String, Unbounded_String, Hash, "=", "="); type Descr is tagged record Default_Include : String_Vectors.Vector; Default_Libs : String_Vectors.Vector; Variables : String_Maps.Map; Name : Unbounded_String; FName : Unbounded_String; SrcFile : Unbounded_String; Description : Unbounded_String; URL : Unbounded_String; Version : Unbounded_String; Requires : String_Vectors.Vector; Requires_Private : String_Vectors.Vector; Conflicts : String_Vectors.Vector; Cflags : String_Vectors.Vector; Libs : String_Vectors.Vector; Libs_Private : String_Vectors.Vector; end record; procedure Read_Pkg (Item : in out Descr; From : String); procedure Write_GPR (Item : Descr; To : String); procedure Write_GPR (Item : Descr; Output : Ada.Text_IO.File_Type); function Get_Source_Dirs (Item : Descr) return String_Vectors.Vector; function Get_GPR (Item : Descr) return String; function Get_GPR (Item : String) return String; function Image (Item : String_Vectors.Vector) return String; function Linker_Options (Item : Descr) return String; function Get_Include (Cpp : String := "cpp") return String_Vectors.Vector; function Get_Libs (Gcc : String := "gcc") return String_Vectors.Vector; function Compiler_Default_Switches (Item : Descr) return String_Vectors.Vector; end GPR_Tools.Pkg2gpr;
pragma Style_Checks (Off); -- This spec has been automatically generated from STM32H743x.svd pragma Restrictions (No_Elaboration_Code); with HAL; with System; package STM32_SVD.IWDG is pragma Preelaborate; --------------- -- Registers -- --------------- subtype KR_KEY_Field is HAL.UInt16; -- Key register type KR_Register is record -- Write-only. Key value (write only, read 0x0000) These bits must be -- written by software at regular intervals with the key value 0xAAAA, -- otherwise the watchdog generates a reset when the counter reaches 0. -- Writing the key value 0x5555 to enable access to the IWDG_PR, -- IWDG_RLR and IWDG_WINR registers (see Section23.3.6: Register access -- protection) Writing the key value CCCCh starts the watchdog (except -- if the hardware watchdog option is selected) KEY : KR_KEY_Field := 16#0#; -- unspecified Reserved_16_31 : HAL.UInt16 := 16#0#; end record with Volatile_Full_Access, Object_Size => 32, Bit_Order => System.Low_Order_First; for KR_Register use record KEY at 0 range 0 .. 15; Reserved_16_31 at 0 range 16 .. 31; end record; subtype PR_PR_Field is HAL.UInt3; -- Prescaler register type PR_Register is record -- Prescaler divider These bits are write access protected see -- Section23.3.6: Register access protection. They are written by -- software to select the prescaler divider feeding the counter clock. -- PVU bit of IWDG_SR must be reset in order to be able to change the -- prescaler divider. Note: Reading this register returns the prescaler -- value from the VDD voltage domain. This value may not be up to -- date/valid if a write operation to this register is ongoing. For this -- reason the value read from this register is valid only when the PVU -- bit in the IWDG_SR register is reset. PR : PR_PR_Field := 16#0#; -- unspecified Reserved_3_31 : HAL.UInt29 := 16#0#; end record with Volatile_Full_Access, Object_Size => 32, Bit_Order => System.Low_Order_First; for PR_Register use record PR at 0 range 0 .. 2; Reserved_3_31 at 0 range 3 .. 31; end record; subtype RLR_RL_Field is HAL.UInt12; -- Reload register type RLR_Register is record -- Watchdog counter reload value These bits are write access protected -- see Section23.3.6. They are written by software to define the value -- to be loaded in the watchdog counter each time the value 0xAAAA is -- written in the IWDG_KR register. The watchdog counter counts down -- from this value. The timeout period is a function of this value and -- the clock prescaler. Refer to the datasheet for the timeout -- information. The RVU bit in the IWDG_SR register must be reset in -- order to be able to change the reload value. Note: Reading this -- register returns the reload value from the VDD voltage domain. This -- value may not be up to date/valid if a write operation to this -- register is ongoing on this register. For this reason the value read -- from this register is valid only when the RVU bit in the IWDG_SR -- register is reset. RL : RLR_RL_Field := 16#FFF#; -- unspecified Reserved_12_31 : HAL.UInt20 := 16#0#; end record with Volatile_Full_Access, Object_Size => 32, Bit_Order => System.Low_Order_First; for RLR_Register use record RL at 0 range 0 .. 11; Reserved_12_31 at 0 range 12 .. 31; end record; -- Status register type SR_Register is record -- Read-only. Watchdog prescaler value update This bit is set by -- hardware to indicate that an update of the prescaler value is -- ongoing. It is reset by hardware when the prescaler update operation -- is completed in the VDD voltage domain (takes up to 5 RC 40 kHz -- cycles). Prescaler value can be updated only when PVU bit is reset. PVU : Boolean; -- Read-only. Watchdog counter reload value update This bit is set by -- hardware to indicate that an update of the reload value is ongoing. -- It is reset by hardware when the reload value update operation is -- completed in the VDD voltage domain (takes up to 5 RC 40 kHz cycles). -- Reload value can be updated only when RVU bit is reset. RVU : Boolean; -- Read-only. Watchdog counter window value update This bit is set by -- hardware to indicate that an update of the window value is ongoing. -- It is reset by hardware when the reload value update operation is -- completed in the VDD voltage domain (takes up to 5 RC 40 kHz cycles). -- Window value can be updated only when WVU bit is reset. This bit is -- generated only if generic window = 1 WVU : Boolean; -- unspecified Reserved_3_31 : HAL.UInt29; end record with Volatile_Full_Access, Object_Size => 32, Bit_Order => System.Low_Order_First; for SR_Register use record PVU at 0 range 0 .. 0; RVU at 0 range 1 .. 1; WVU at 0 range 2 .. 2; Reserved_3_31 at 0 range 3 .. 31; end record; subtype WINR_WIN_Field is HAL.UInt12; -- Window register type WINR_Register is record -- Watchdog counter window value These bits are write access protected -- see Section23.3.6. These bits contain the high limit of the window -- value to be compared to the downcounter. To prevent a reset, the -- downcounter must be reloaded when its value is lower than the window -- register value and greater than 0x0 The WVU bit in the IWDG_SR -- register must be reset in order to be able to change the reload -- value. Note: Reading this register returns the reload value from the -- VDD voltage domain. This value may not be valid if a write operation -- to this register is ongoing. For this reason the value read from this -- register is valid only when the WVU bit in the IWDG_SR register is -- reset. WIN : WINR_WIN_Field := 16#FFF#; -- unspecified Reserved_12_31 : HAL.UInt20 := 16#0#; end record with Volatile_Full_Access, Object_Size => 32, Bit_Order => System.Low_Order_First; for WINR_Register use record WIN at 0 range 0 .. 11; Reserved_12_31 at 0 range 12 .. 31; end record; ----------------- -- Peripherals -- ----------------- -- IWDG type IWDG_Peripheral is record -- Key register KR : aliased KR_Register; -- Prescaler register PR : aliased PR_Register; -- Reload register RLR : aliased RLR_Register; -- Status register SR : aliased SR_Register; -- Window register WINR : aliased WINR_Register; end record with Volatile; for IWDG_Peripheral use record KR at 16#0# range 0 .. 31; PR at 16#4# range 0 .. 31; RLR at 16#8# range 0 .. 31; SR at 16#C# range 0 .. 31; WINR at 16#10# range 0 .. 31; end record; -- IWDG IWDG_Periph : aliased IWDG_Peripheral with Import, Address => IWDG_Base; end STM32_SVD.IWDG;
-- domain types package: ${self.name} -- description: self.description with Application_Types; with Ada.Unchecked_Conversion; with Ada.Finalization; with Root_Object; package ${self.name} is type Domain_Structure is new Ada.Finalization.Controlled with null record;
-- C44003G.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 FOR CORRECT PRECEDENCE OF PRE-DEFINED AND OVERLOADED -- OPERATIONS ON BOOLEAN TYPES AND ONE-DIMENSIONAL ARRAYS WITH -- COMPONENTS OF TYPE BOOLEAN. -- HISTORY: -- RJW 10/13/88 CREATED ORIGINAL TEST. WITH REPORT; USE REPORT; PROCEDURE C44003G IS BEGIN TEST ("C44003G", "CHECK FOR CORRECT PRECEDENCE OF PRE-DEFINED " & "AND OVERLOADED OPERATIONS ON BOOLEAN TYPES " & "AND ONE-DIMENSIONAL ARRAYS WITH COMPONENTS OF " & "TYPE BOOLEAN"); ----- PREDEFINED BOOLEAN: DECLARE T : BOOLEAN := TRUE; F : BOOLEAN := FALSE; FUNCTION "AND" (LEFT, RIGHT : BOOLEAN) RETURN BOOLEAN IS BEGIN RETURN FALSE; END "AND"; FUNCTION "<" (LEFT, RIGHT : BOOLEAN) RETURN BOOLEAN IS BEGIN RETURN TRUE; END "<"; FUNCTION "-" (LEFT, RIGHT : BOOLEAN) RETURN BOOLEAN IS BEGIN RETURN TRUE; END "-"; FUNCTION "+" (RIGHT : BOOLEAN) RETURN BOOLEAN IS BEGIN RETURN NOT RIGHT; END "+"; FUNCTION "*" (LEFT, RIGHT : BOOLEAN) RETURN BOOLEAN IS BEGIN RETURN FALSE; END "*"; FUNCTION "**" (LEFT, RIGHT : BOOLEAN) RETURN BOOLEAN IS BEGIN RETURN TRUE; END "**"; BEGIN IF NOT (+T = F) OR T /= +F OR (TRUE AND FALSE ** TRUE) OR NOT (+T < F) OR NOT (T - F * T) OR (NOT T - F XOR + F - F) THEN FAILED ("INCORRECT RESULT - 1"); END IF; END; ----- ARRAYS: DECLARE TYPE ARR IS ARRAY (INTEGER RANGE <>) OF BOOLEAN; SUBTYPE SARR IS ARR (1 .. 3); T : SARR := (OTHERS => TRUE); F : SARR := (OTHERS => FALSE); FUNCTION "XOR" (LEFT, RIGHT : ARR) RETURN ARR IS BEGIN RETURN (1 .. 3 => FALSE); END "XOR"; FUNCTION "<=" (LEFT, RIGHT : ARR) RETURN ARR IS BEGIN RETURN (1 .. 3 => TRUE); END "<="; FUNCTION "+" (LEFT, RIGHT : ARR) RETURN ARR IS BEGIN RETURN (1 .. 3 => FALSE); END "+"; FUNCTION "MOD" (LEFT, RIGHT : ARR) RETURN ARR IS BEGIN RETURN (1 .. 3 => TRUE); END "MOD"; FUNCTION "**" (LEFT, RIGHT : ARR) RETURN ARR IS BEGIN RETURN (1 .. 3 => FALSE); END "**"; BEGIN IF (F ** T <= F + T MOD T XOR T) /= (1 .. 3 => FALSE) THEN FAILED ("INCORRECT RESULT - 2"); END IF; IF F ** T & T /= NOT T & T OR (T MOD F <= T) /= (1 .. 3 => TRUE) THEN FAILED ("INCORRECT RESULT - 3"); END IF; END; RESULT; END C44003G;
------------------------------------------------------------------------------ -- -- -- GNAT COMPILER COMPONENTS -- -- -- -- S Y S T E M . P R O G R A M _ I N F O -- -- -- -- S p e c -- -- -- -- Copyright (C) 1997-2005 Free Software Foundation, Inc. -- -- -- -- GNAT is free software; you can redistribute it and/or modify it under -- -- terms of the GNU General Public License as published by the Free Soft- -- -- ware Foundation; either version 2, or (at your option) any later ver- -- -- sion. GNAT is distributed in the hope that it will be useful, but WITH- -- -- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY -- -- or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -- -- for more details. You should have received a copy of the GNU General -- -- Public License distributed with GNAT; see file COPYING. If not, write -- -- to the Free Software Foundation, 51 Franklin Street, Fifth Floor, -- -- Boston, MA 02110-1301, USA. -- -- -- -- As a special exception, if other files instantiate generics from this -- -- unit, or you link this unit with other files to produce an executable, -- -- this unit does not by itself cause the resulting executable to be -- -- covered by the GNU General Public License. This exception does not -- -- however invalidate any other reasons why the executable file might be -- -- covered by the GNU Public License. -- -- -- -- GNAT was originally developed by the GNAT team at New York University. -- -- Extensive contributions were provided by Ada Core Technologies Inc. -- -- -- ------------------------------------------------------------------------------ -- This package contains the definitions and routines used as parameters -- to the run-time system at program startup for the SGI implementation. package System.Program_Info is pragma Preelaborate; function Initial_Sproc_Count return Integer; -- The number of sproc created at program startup for scheduling -- threads. function Max_Sproc_Count return Integer; -- The maximum number of sprocs that can be created by the program -- for servicing threads. This limit includes both the pre-created -- sprocs and those explicitly created under program control. function Sproc_Stack_Size return Integer; -- The size, in bytes, of the sproc's initial stack. function Default_Time_Slice return Duration; -- The default time quanta for round-robin scheduling of threads of -- equal priority. This default value can be overridden on a per-task -- basis by specifying an alternate value via the implementation-defined -- Task_Info pragma. See s-tasinf.ads for more information. function Default_Task_Stack return Integer; -- The default stack size for each created thread. This default value -- can be overriden on a per-task basis by the language-defined -- Storage_Size pragma. function Stack_Guard_Pages return Integer; -- The number of non-writable, guard pages to append to the bottom of -- each thread's stack. function Pthread_Sched_Signal return Integer; -- The signal used by the Pthreads library to affect scheduling actions -- in remote sprocs. function Pthread_Arena_Size return Integer; -- The size of the shared arena from which pthread locks are allocated. -- See the usinit(3p) man page for more information on shared arenas. function Os_Default_Priority return Integer; -- The default Irix Non-Degrading priority for each sproc created to -- service threads. end System.Program_Info;
-- -- Copyright (C) 2021 Jeremy Grosser <jeremy@synack.me> -- -- SPDX-License-Identifier: BSD-3-Clause -- with Picosystem.Screen; package Graphics is subtype Row is Integer range 1 .. Picosystem.Screen.Height; subtype Column is Integer range 1 .. Picosystem.Screen.Width; type Frame_Number is mod 2 ** 32 - 1; subtype Color is Picosystem.Screen.Color; type Color_Value is mod 4 with Size => 2; type Color_Palette is array (Color_Value) of Color; type Color_Map is array (Row, Column) of Color_Value with Pack; type Plane is record Palette : Color_Palette; Bitmap : Color_Map; end record; Grayscale : constant Color_Palette := (Color'(0, 0, 0), Color'(7, 15, 7), Color'(15, 31, 15), Color'(31, 63, 31)); Current : Plane; type HBlank_Callback is access procedure (Y : Row); type VBlank_Callback is access procedure (N : Frame_Number); HBlank : HBlank_Callback := null; VBlank : VBlank_Callback := null; procedure Initialize; procedure Update; private Frame : Frame_Number := 0; function Scanline (This : Plane; Y : Row) return Picosystem.Screen.Scanline; end Graphics;
-- Copyright (c) 2019 Maxim Reznik <reznikmm@gmail.com> -- -- SPDX-License-Identifier: MIT -- License-Filename: LICENSE ------------------------------------------------------------- with System.Storage_Pools.Subpools; with Program.Element_Vectors; with Program.Elements.Expressions; with Program.Elements.Array_Component_Associations; with Program.Elements.Aspect_Specifications; with Program.Elements.Case_Expression_Paths; with Program.Elements.Case_Paths; with Program.Elements.Component_Clauses; with Program.Elements.Defining_Identifiers; with Program.Elements.Discrete_Ranges; with Program.Elements.Discriminant_Associations; with Program.Elements.Discriminant_Specifications; with Program.Elements.Elsif_Paths; with Program.Elements.Enumeration_Literal_Specifications; with Program.Elements.Exception_Handlers; with Program.Elements.Formal_Package_Associations; with Program.Elements.Identifiers; with Program.Elements.Parameter_Associations; with Program.Elements.Parameter_Specifications; with Program.Elements.Record_Component_Associations; with Program.Elements.Select_Paths; with Program.Elements.Variants; package Program.Element_Vector_Factories is pragma Preelaborate; type Element_Vector_Factory (Subpool : not null System.Storage_Pools.Subpools.Subpool_Handle) is tagged limited private; not overriding function Create_Element_Vector (Self : Element_Vector_Factory; Each : Program.Element_Vectors.Iterators.Forward_Iterator'Class) return Program.Element_Vectors.Element_Vector_Access; not overriding function Create_Expression_Vector (Self : Element_Vector_Factory; Each : Program.Element_Vectors.Iterators.Forward_Iterator'Class) return Program.Elements.Expressions.Expression_Vector_Access; not overriding function Create_Array_Component_Association_Vector (Self : Element_Vector_Factory; Each : Program.Element_Vectors.Iterators.Forward_Iterator'Class) return Program.Elements.Array_Component_Associations .Array_Component_Association_Vector_Access; not overriding function Create_Aspect_Specification_Vector (Self : Element_Vector_Factory; Each : Program.Element_Vectors.Iterators.Forward_Iterator'Class) return Program.Elements.Aspect_Specifications .Aspect_Specification_Vector_Access; not overriding function Create_Case_Expression_Path_Vector (Self : Element_Vector_Factory; Each : Program.Element_Vectors.Iterators.Forward_Iterator'Class) return Program.Elements.Case_Expression_Paths .Case_Expression_Path_Vector_Access; not overriding function Create_Case_Path_Vector (Self : Element_Vector_Factory; Each : Program.Element_Vectors.Iterators.Forward_Iterator'Class) return Program.Elements.Case_Paths.Case_Path_Vector_Access; not overriding function Create_Component_Clause_Vector (Self : Element_Vector_Factory; Each : Program.Element_Vectors.Iterators.Forward_Iterator'Class) return Program.Elements.Component_Clauses .Component_Clause_Vector_Access; not overriding function Create_Defining_Identifier_Vector (Self : Element_Vector_Factory; Each : Program.Element_Vectors.Iterators.Forward_Iterator'Class) return Program.Elements.Defining_Identifiers .Defining_Identifier_Vector_Access; not overriding function Create_Discrete_Range_Vector (Self : Element_Vector_Factory; Each : Program.Element_Vectors.Iterators.Forward_Iterator'Class) return Program.Elements.Discrete_Ranges .Discrete_Range_Vector_Access; not overriding function Create_Discriminant_Association_Vector (Self : Element_Vector_Factory; Each : Program.Element_Vectors.Iterators.Forward_Iterator'Class) return Program.Elements.Discriminant_Associations .Discriminant_Association_Vector_Access; not overriding function Create_Discriminant_Specification_Vector (Self : Element_Vector_Factory; Each : Program.Element_Vectors.Iterators.Forward_Iterator'Class) return Program.Elements.Discriminant_Specifications .Discriminant_Specification_Vector_Access; not overriding function Create_Elsif_Path_Vector (Self : Element_Vector_Factory; Each : Program.Element_Vectors.Iterators.Forward_Iterator'Class) return Program.Elements.Elsif_Paths.Elsif_Path_Vector_Access; not overriding function Create_Enumeration_Literal_Specification_Vector (Self : Element_Vector_Factory; Each : Program.Element_Vectors.Iterators.Forward_Iterator'Class) return Program.Elements.Enumeration_Literal_Specifications .Enumeration_Literal_Specification_Vector_Access; not overriding function Create_Exception_Handler_Vector (Self : Element_Vector_Factory; Each : Program.Element_Vectors.Iterators.Forward_Iterator'Class) return Program.Elements.Exception_Handlers .Exception_Handler_Vector_Access; not overriding function Create_Formal_Package_Association_Vector (Self : Element_Vector_Factory; Each : Program.Element_Vectors.Iterators.Forward_Iterator'Class) return Program.Elements.Formal_Package_Associations .Formal_Package_Association_Vector_Access; not overriding function Create_Identifier_Vector (Self : Element_Vector_Factory; Each : Program.Element_Vectors.Iterators.Forward_Iterator'Class) return Program.Elements.Identifiers.Identifier_Vector_Access; not overriding function Create_Parameter_Association_Vector (Self : Element_Vector_Factory; Each : Program.Element_Vectors.Iterators.Forward_Iterator'Class) return Program.Elements.Parameter_Associations .Parameter_Association_Vector_Access; not overriding function Create_Parameter_Specification_Vector (Self : Element_Vector_Factory; Each : Program.Element_Vectors.Iterators.Forward_Iterator'Class) return Program.Elements.Parameter_Specifications .Parameter_Specification_Vector_Access; not overriding function Create_Record_Component_Association_Vector (Self : Element_Vector_Factory; Each : Program.Element_Vectors.Iterators.Forward_Iterator'Class) return Program.Elements.Record_Component_Associations .Record_Component_Association_Vector_Access; not overriding function Create_Select_Path_Vector (Self : Element_Vector_Factory; Each : Program.Element_Vectors.Iterators.Forward_Iterator'Class) return Program.Elements.Select_Paths .Select_Path_Vector_Access; not overriding function Create_Variant_Vector (Self : Element_Vector_Factory; Each : Program.Element_Vectors.Iterators.Forward_Iterator'Class) return Program.Elements.Variants .Variant_Vector_Access; private type Element_Vector_Factory (Subpool : not null System.Storage_Pools.Subpools.Subpool_Handle) is tagged limited null record; end Program.Element_Vector_Factories;
package Long_Multiplication is type Number (<>) is private; Zero : constant Number; One : constant Number; function Value (Item : in String) return Number; function Image (Item : in Number) return String; overriding function "=" (Left, Right : in Number) return Boolean; function "+" (Left, Right : in Number) return Number; function "*" (Left, Right : in Number) return Number; function Trim (Item : in Number) return Number; private Bits : constant := 16; Base : constant := 2 ** Bits; type Accumulated_Value is range 0 .. (Base - 1) * Base; subtype Digit is Accumulated_Value range 0 .. Base - 1; type Number is array (Natural range <>) of Digit; for Number'Component_Size use Bits; -- or pragma Pack (Number); Zero : constant Number := (1 .. 0 => 0); One : constant Number := (0 => 1); procedure Divide (Dividend : in Number; Divisor : in Digit; Result : out Number; Remainder : out Digit); end Long_Multiplication;
with Ada.Unchecked_Conversion; package body C is use Interfaces.C; function U is new Ada.Unchecked_Conversion (Int, Unsigned); function I is new Ada.Unchecked_Conversion (Unsigned, Int); function Bool_to_Int (Val: Boolean) return Int is begin if Val = False then return 0; else return 1; end if; end Bool_to_Int; function Sizeof (Bits: Integer) return Int is begin return Int(Bits/System.Storage_Unit); end Sizeof; procedure Call (Ignored_Function_Result: Int) is begin null; end Call; procedure Call (Ignored_Function_Result: Charp) is begin null; end Call; function "+" (C: char; I: Int) return char is begin return char'val(Int(char'pos(C)) + I); end "+"; function "+" (C: char; I: Int) return Int is begin return (char'pos(C) + I); end "+"; function To_C (C: Character) return Interfaces.C.Char is begin return Interfaces.C.Char'Val(Character'Pos(C)); end To_C; end C;
with Ada.Strings.Fixed, Ada.Text_IO; use Ada.Strings, Ada.Text_IO; procedure String_Replace is Original : constant String := "Mary had a @__@ lamb."; Tbr : constant String := "@__@"; New_Str : constant String := "little"; Index : Natural := Fixed.Index (Original, Tbr); begin Put_Line (Fixed.Replace_Slice ( Original, Index, Index + Tbr'Length - 1, New_Str)); end String_Replace;
with Plugins.Tables; package Project_Processor.Processors.Processor_Tables is new Plugins.Tables (Root_Plugin_Type => Abstract_Processor, Plugin_Parameters => Processor_Parameter, Plugin_ID => Processor_ID, Constructor => Create);
-- Copyright (c) 1990 Regents of the University of California. -- All rights reserved. -- -- This software was developed by John Self of the Arcadia project -- at the University of California, Irvine. -- -- Redistribution and use in source and binary forms are permitted -- provided that the above copyright notice and this paragraph are -- duplicated in all such forms and that any documentation, -- advertising materials, and other materials related to such -- distribution and use acknowledge that the software was developed -- by the University of California, Irvine. The name of the -- University may not be used to endorse or promote products derived -- from this software without specific prior written permission. -- THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR -- IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED -- WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE. -- TITLE equivalence class -- AUTHOR: John Self (UCI) -- DESCRIPTION finds equivalence classes so DFA will be smaller -- $Header: /co/ua/self/arcadia/aflex/ada/src/RCS/ecsB.a,v 1.7 90/01/12 15:19:54 self Exp Locker: self $ with Misc; with Unicode; package body ECS is use Unicode; -- ccl2ecl - convert character classes to set of equivalence classes procedure CCL2ECL is ICH, NEWLEN, CCLP, CCLMEC : INTEGER; begin for I in 1 .. LASTCCL loop -- we loop through each character class, and for each character -- in the class, add the character's equivalence class to the -- new "character" class we are creating. Thus when we are all -- done, character classes will really consist of collections -- of equivalence classes NEWLEN := 0; CCLP := CCLMAP(I); for CCLS in 0 .. CCLLEN(I) - 1 loop ICH := Unicode_Character'Pos (CCLTBL (CCLP + CCLS)); CCLMEC := ECGROUP(ICH); if (CCLMEC > 0) then CCLTBL(CCLP + NEWLEN) := Unicode_Character'Val (CCLMEC); NEWLEN := NEWLEN + 1; end if; end loop; CCLLEN(I) := NEWLEN; end loop; end CCL2ECL; -- cre8ecs - associate equivalence class numbers with class members -- fwd is the forward linked-list of equivalence class members. bck -- is the backward linked-list, and num is the number of class members. -- Returned is the number of classes. procedure CRE8ECS(FWD : C_SIZE_ARRAY; BCK : in out C_SIZE_ARRAY; NUM : INTEGER; RESULT : out INTEGER) is J, NUMCL : INTEGER; begin NUMCL := 0; -- create equivalence class numbers. From now on, abs( bck(x) ) -- is the equivalence class number for object x. If bck(x) -- is positive, then x is the representative of its equivalence -- class. for I in 1 .. NUM loop if (BCK(I) = NIL) then NUMCL := NUMCL + 1; BCK(I) := NUMCL; J := FWD(I); while (J /= NIL) loop BCK(J) := -NUMCL; J := FWD(J); end loop; end if; end loop; RESULT := NUMCL; return; end CRE8ECS; -- mkeccl - update equivalence classes based on character class xtions -- where ccls contains the elements of the character class, lenccl is the -- number of elements in the ccl, fwd is the forward link-list of equivalent -- characters, bck is the backward link-list, and llsiz size of the link-list procedure MKECCL (CCLS : Unicode_Character_Array; LENCCL : Integer; FWD, BCK : in out UNBOUNDED_INT_ARRAY; LLSIZ : Integer) is CCLP, OLDEC, NEWEC, CCLM, I, J : INTEGER; PROC_ARRAY : BOOLEAN_PTR; begin -- note that it doesn't matter whether or not the character class is -- negated. The same results will be obtained in either case. CCLP := CCLS'FIRST; -- this array tells whether or not a character class has been processed. PROC_ARRAY := new BOOLEAN_ARRAY(CCLS'FIRST .. CCLS'LAST); for CCL_INDEX in CCLS'FIRST .. CCLS'LAST loop PROC_ARRAY(CCL_INDEX) := FALSE; end loop; while (CCLP < LENCCL + CCLS'FIRST) loop CCLM := Unicode_Character'Pos (CCLS (CCLP)); OLDEC := BCK(CCLM); NEWEC := CCLM; J := CCLP + 1; I := FWD(CCLM); while ((I /= NIL) and (I <= LLSIZ)) loop -- look for the symbol in the character class while ((J < LENCCL + CCLS'FIRST) and ((CCLS(J) <= Unicode_Character'Val(I)) or PROC_ARRAY(J))) loop if (CCLS(J) = Unicode_Character'Val (I)) then -- we found an old companion of cclm in the ccl. -- link it into the new equivalence class and flag it as -- having been processed BCK(I) := NEWEC; FWD(NEWEC) := I; NEWEC := I; PROC_ARRAY(J) := TRUE; -- set flag so we don't reprocess -- get next equivalence class member -- continue 2 goto NEXT_PT; end if; J := J + 1; end loop; -- symbol isn't in character class. Put it in the old equivalence -- class BCK(I) := OLDEC; if (OLDEC /= NIL) then FWD(OLDEC) := I; end if; OLDEC := I; <<NEXT_PT>> I := FWD(I); end loop; if ((BCK(CCLM) /= NIL) or (OLDEC /= BCK(CCLM))) then BCK(CCLM) := NIL; FWD(OLDEC) := NIL; end if; FWD(NEWEC) := NIL; -- find next ccl member to process CCLP := CCLP + 1; while ((CCLP < LENCCL + CCLS'FIRST) and PROC_ARRAY(CCLP)) loop -- reset "doesn't need processing" flag PROC_ARRAY(CCLP) := FALSE; CCLP := CCLP + 1; end loop; end loop; exception when STORAGE_ERROR => Misc.Aflex_Fatal ("dynamic memory failure in mkeccl()"); end MKECCL; -- mkechar - create equivalence class for single character procedure MKECHAR(TCH : in INTEGER; FWD, BCK : in out C_SIZE_ARRAY) is begin -- if until now the character has been a proper subset of -- an equivalence class, break it away to create a new ec if (FWD(TCH) /= NIL) then BCK(FWD(TCH)) := BCK(TCH); end if; if (BCK(TCH) /= NIL) then FWD(BCK(TCH)) := FWD(TCH); end if; FWD(TCH) := NIL; BCK(TCH) := NIL; end MKECHAR; end ECS;
package Rational_Arithmetic is -- Whole numbers type Whole is new Integer; -- -- Undefine unwanted operations function "/" (Left, Right: Whole) return Whole is abstract; -- -- Rational numbers -- type Rational is private; -- -- Constructors -- function "/" (Left, Right: Whole) return Rational; -- -- Rational operations -- function "-" (Left, Right: Rational) return Rational; -- -- Mixed operations -- function "+" (Left: Whole ; Right: Rational) return Rational; function "-" (Left: Whole ; Right: Rational) return Rational; function "-" (Left: Rational; Right: Whole ) return Rational; function "/" (Left: Whole ; Right: Rational) return Rational; function "*" (Left: Whole ; Right: Rational) return Rational; function "*" (Left: Rational; Right: Whole ) return Rational; -- -- Relational -- function "=" (Left: Rational; Right: Whole) return Boolean; -- private type Rational is record Numerator, Denominator: Whole; end record; end Rational_Arithmetic;
pragma Ada_2005; pragma Style_Checks (Off); pragma Warnings (Off); with Interfaces.C; use Interfaces.C; -- limited -- with GStreamer.GST_Low_Level.glib_2_0_gobject_gclosure_h; with glib; with glib; with glib.Values; with System; package GStreamer.GST_Low_Level.gstreamer_0_10_gst_gstmarshal_h is -- unsupported macro: gst_marshal_VOID__VOID g_cclosure_marshal_VOID__VOID -- unsupported macro: gst_marshal_VOID__BOOLEAN g_cclosure_marshal_VOID__BOOLEAN -- unsupported macro: gst_marshal_VOID__INT g_cclosure_marshal_VOID__INT -- unsupported macro: gst_marshal_VOID__STRING g_cclosure_marshal_VOID__STRING -- unsupported macro: gst_marshal_VOID__BOXED g_cclosure_marshal_VOID__BOXED -- unsupported macro: gst_marshal_VOID__POINTER g_cclosure_marshal_VOID__POINTER -- unsupported macro: gst_marshal_VOID__OBJECT g_cclosure_marshal_VOID__OBJECT -- unsupported macro: gst_marshal_VOID__UINT_POINTER g_cclosure_marshal_VOID__UINT_POINTER -- This file is generated, all changes will be lost -- VOID:VOID (./gstmarshal.list:1) -- VOID:BOOLEAN (./gstmarshal.list:2) -- VOID:INT (./gstmarshal.list:3) -- VOID:STRING (./gstmarshal.list:4) -- VOID:BOXED (./gstmarshal.list:5) -- VOID:BOXED,OBJECT (./gstmarshal.list:6) procedure gst_marshal_VOID_u_BOXED_OBJECT (closure : System.Address; return_value : access Glib.Values.GValue; n_param_values : GLIB.guint; param_values : access constant Glib.Values.GValue; invocation_hint : System.Address; marshal_data : System.Address); -- gst/gstmarshal.h:26 pragma Import (C, gst_marshal_VOID_u_BOXED_OBJECT, "gst_marshal_VOID__BOXED_OBJECT"); -- VOID:POINTER (./gstmarshal.list:7) -- VOID:POINTER,OBJECT (./gstmarshal.list:8) procedure gst_marshal_VOID_u_POINTER_OBJECT (closure : System.Address; return_value : access Glib.Values.GValue; n_param_values : GLIB.guint; param_values : access constant Glib.Values.GValue; invocation_hint : System.Address; marshal_data : System.Address); -- gst/gstmarshal.h:38 pragma Import (C, gst_marshal_VOID_u_POINTER_OBJECT, "gst_marshal_VOID__POINTER_OBJECT"); -- VOID:OBJECT (./gstmarshal.list:9) -- VOID:OBJECT,OBJECT (./gstmarshal.list:10) procedure gst_marshal_VOID_u_OBJECT_OBJECT (closure : System.Address; return_value : access Glib.Values.GValue; n_param_values : GLIB.guint; param_values : access constant Glib.Values.GValue; invocation_hint : System.Address; marshal_data : System.Address); -- gst/gstmarshal.h:50 pragma Import (C, gst_marshal_VOID_u_OBJECT_OBJECT, "gst_marshal_VOID__OBJECT_OBJECT"); -- VOID:OBJECT,PARAM (./gstmarshal.list:11) procedure gst_marshal_VOID_u_OBJECT_PARAM (closure : System.Address; return_value : access Glib.Values.GValue; n_param_values : GLIB.guint; param_values : access constant Glib.Values.GValue; invocation_hint : System.Address; marshal_data : System.Address); -- gst/gstmarshal.h:59 pragma Import (C, gst_marshal_VOID_u_OBJECT_PARAM, "gst_marshal_VOID__OBJECT_PARAM"); -- VOID:OBJECT,POINTER (./gstmarshal.list:12) procedure gst_marshal_VOID_u_OBJECT_POINTER (closure : System.Address; return_value : access Glib.Values.GValue; n_param_values : GLIB.guint; param_values : access constant Glib.Values.GValue; invocation_hint : System.Address; marshal_data : System.Address); -- gst/gstmarshal.h:68 pragma Import (C, gst_marshal_VOID_u_OBJECT_POINTER, "gst_marshal_VOID__OBJECT_POINTER"); -- VOID:OBJECT,BOXED (./gstmarshal.list:13) procedure gst_marshal_VOID_u_OBJECT_BOXED (closure : System.Address; return_value : access Glib.Values.GValue; n_param_values : GLIB.guint; param_values : access constant Glib.Values.GValue; invocation_hint : System.Address; marshal_data : System.Address); -- gst/gstmarshal.h:77 pragma Import (C, gst_marshal_VOID_u_OBJECT_BOXED, "gst_marshal_VOID__OBJECT_BOXED"); -- VOID:OBJECT,BOXED,STRING (./gstmarshal.list:14) procedure gst_marshal_VOID_u_OBJECT_BOXED_STRING (closure : System.Address; return_value : access Glib.Values.GValue; n_param_values : GLIB.guint; param_values : access constant Glib.Values.GValue; invocation_hint : System.Address; marshal_data : System.Address); -- gst/gstmarshal.h:86 pragma Import (C, gst_marshal_VOID_u_OBJECT_BOXED_STRING, "gst_marshal_VOID__OBJECT_BOXED_STRING"); -- VOID:OBJECT,OBJECT,STRING (./gstmarshal.list:15) procedure gst_marshal_VOID_u_OBJECT_OBJECT_STRING (closure : System.Address; return_value : access Glib.Values.GValue; n_param_values : GLIB.guint; param_values : access constant Glib.Values.GValue; invocation_hint : System.Address; marshal_data : System.Address); -- gst/gstmarshal.h:95 pragma Import (C, gst_marshal_VOID_u_OBJECT_OBJECT_STRING, "gst_marshal_VOID__OBJECT_OBJECT_STRING"); -- VOID:OBJECT,STRING (./gstmarshal.list:16) procedure gst_marshal_VOID_u_OBJECT_STRING (closure : System.Address; return_value : access Glib.Values.GValue; n_param_values : GLIB.guint; param_values : access constant Glib.Values.GValue; invocation_hint : System.Address; marshal_data : System.Address); -- gst/gstmarshal.h:104 pragma Import (C, gst_marshal_VOID_u_OBJECT_STRING, "gst_marshal_VOID__OBJECT_STRING"); -- VOID:INT,INT (./gstmarshal.list:17) procedure gst_marshal_VOID_u_INT_INT (closure : System.Address; return_value : access Glib.Values.GValue; n_param_values : GLIB.guint; param_values : access constant Glib.Values.GValue; invocation_hint : System.Address; marshal_data : System.Address); -- gst/gstmarshal.h:113 pragma Import (C, gst_marshal_VOID_u_INT_INT, "gst_marshal_VOID__INT_INT"); -- VOID:INT64 (./gstmarshal.list:18) procedure gst_marshal_VOID_u_INT64 (closure : System.Address; return_value : access Glib.Values.GValue; n_param_values : GLIB.guint; param_values : access constant Glib.Values.GValue; invocation_hint : System.Address; marshal_data : System.Address); -- gst/gstmarshal.h:122 pragma Import (C, gst_marshal_VOID_u_INT64, "gst_marshal_VOID__INT64"); -- VOID:UINT,BOXED (./gstmarshal.list:19) procedure gst_marshal_VOID_u_UINT_BOXED (closure : System.Address; return_value : access Glib.Values.GValue; n_param_values : GLIB.guint; param_values : access constant Glib.Values.GValue; invocation_hint : System.Address; marshal_data : System.Address); -- gst/gstmarshal.h:131 pragma Import (C, gst_marshal_VOID_u_UINT_BOXED, "gst_marshal_VOID__UINT_BOXED"); -- VOID:UINT,POINTER (./gstmarshal.list:20) -- BOOLEAN:VOID (./gstmarshal.list:21) procedure gst_marshal_BOOLEAN_u_VOID (closure : System.Address; return_value : access Glib.Values.GValue; n_param_values : GLIB.guint; param_values : access constant Glib.Values.GValue; invocation_hint : System.Address; marshal_data : System.Address); -- gst/gstmarshal.h:143 pragma Import (C, gst_marshal_BOOLEAN_u_VOID, "gst_marshal_BOOLEAN__VOID"); -- BOOLEAN:POINTER (./gstmarshal.list:22) procedure gst_marshal_BOOLEAN_u_POINTER (closure : System.Address; return_value : access Glib.Values.GValue; n_param_values : GLIB.guint; param_values : access constant Glib.Values.GValue; invocation_hint : System.Address; marshal_data : System.Address); -- gst/gstmarshal.h:152 pragma Import (C, gst_marshal_BOOLEAN_u_POINTER, "gst_marshal_BOOLEAN__POINTER"); -- POINTER:POINTER (./gstmarshal.list:23) procedure gst_marshal_POINTER_u_POINTER (closure : System.Address; return_value : access Glib.Values.GValue; n_param_values : GLIB.guint; param_values : access constant Glib.Values.GValue; invocation_hint : System.Address; marshal_data : System.Address); -- gst/gstmarshal.h:161 pragma Import (C, gst_marshal_POINTER_u_POINTER, "gst_marshal_POINTER__POINTER"); -- BOXED:BOXED (./gstmarshal.list:24) procedure gst_marshal_BOXED_u_BOXED (closure : System.Address; return_value : access Glib.Values.GValue; n_param_values : GLIB.guint; param_values : access constant Glib.Values.GValue; invocation_hint : System.Address; marshal_data : System.Address); -- gst/gstmarshal.h:170 pragma Import (C, gst_marshal_BOXED_u_BOXED, "gst_marshal_BOXED__BOXED"); end GStreamer.GST_Low_Level.gstreamer_0_10_gst_gstmarshal_h;
with Interfaces; with Fmt.Generic_Mod_Int_Argument; package Fmt.Uint16_Argument is new Generic_Mod_Int_Argument(Interfaces.Unsigned_16);
package body System.Wid_Enum is function Width_Enumeration_8 ( Names : String; Indexes : Address; Lo, Hi : Natural) return Natural is pragma Unreferenced (Names); type Index_Type is mod 2 ** 8; type Index_Array_Type is array (0 .. Hi + 1) of Index_Type; Indexes_All : Index_Array_Type; for Indexes_All'Address use Indexes; Result : Natural := 0; begin for I in Lo .. Hi loop Result := Natural'Max ( Natural (Indexes_All (I + 1) - Indexes_All (I)), Result); end loop; return Result; end Width_Enumeration_8; function Width_Enumeration_16 ( Names : String; Indexes : Address; Lo, Hi : Natural) return Natural is pragma Unreferenced (Names); type Index_Type is mod 2 ** 16; type Index_Array_Type is array (0 .. Hi + 1) of Index_Type; Indexes_All : Index_Array_Type; for Indexes_All'Address use Indexes; Result : Natural := 0; begin for I in Lo .. Hi loop Result := Natural'Max ( Natural (Indexes_All (I + 1) - Indexes_All (I)), Result); end loop; return Result; end Width_Enumeration_16; function Width_Enumeration_32 ( Names : String; Indexes : Address; Lo, Hi : Natural) return Natural is pragma Unreferenced (Names); type Index_Type is mod 2 ** 32; type Index_Array_Type is array (0 .. Hi + 1) of Index_Type; Indexes_All : Index_Array_Type; for Indexes_All'Address use Indexes; Result : Natural := 0; begin for I in Lo .. Hi loop Result := Natural'Max ( Natural (Indexes_All (I + 1) - Indexes_All (I)), Result); end loop; return Result; end Width_Enumeration_32; end System.Wid_Enum;
with Ada.Execution_Time, Ada.Integer_Text_IO, Ada.Real_Time, Ada.Text_IO; with Utils; procedure Main is use Ada.Execution_Time, Ada.Real_Time, Ada.Text_IO; use Utils; subtype Adjacent_Index is Integer range -1 .. 1; type Adjacent_Location is record Line : Adjacent_Index; Column : Adjacent_Index; end record; Max_Steps : constant := 100; type Adjacent is (Top, Top_Right, Right, Bottom_Right, Bottom, Bottom_Left, Left, Top_Left); type Adjacent_Array is array (Adjacent) of Adjacent_Location; type Octopuses_Energy_Level_Array is array (1 .. 10, 1 .. 10) of Integer; Adjacents : constant Adjacent_Array := (Top => (-1, 0), Top_Right => (-1, 1), Right => (0, 1), Bottom_Right => (1, 1), Bottom => (1, 0), Bottom_Left => (1, -1), Left => (0, -1), Top_Left => (-1, -1)); File : File_Type; Start_Time, End_Time : CPU_Time; Execution_Duration : Time_Span; Octopuses_Energy_Level : Octopuses_Energy_Level_Array; File_Is_Empty : Boolean := True; Result : Natural := Natural'First; begin Get_File (File); -- Get all values declare Current_Line, Current_Column : Positive := Positive'First; begin while not End_Of_File (File) loop declare Str : constant String := Get_Line (File); Last : Positive; begin for Char of Str loop Ada.Integer_Text_IO.Get (Char & "", Octopuses_Energy_Level (Current_Line, Current_Column), Last); Current_Column := Current_Column + 1; File_Is_Empty := False; end loop; end; Current_Column := Positive'First; Current_Line := Current_Line + 1; end loop; end; -- Exit the program if there is no values if File_Is_Empty then Close_If_Open (File); Put_Line ("The input file is empty."); return; end if; -- Do the puzzle Start_Time := Ada.Execution_Time.Clock; Solve_Puzzle : declare -- Do a flash for octopuses having a light level greater than 10 procedure Do_Flash (Line, Column : Positive); -------------- -- Do_Flash -- -------------- procedure Do_Flash (Line, Column : Positive) is Current_Line, Current_Column : Positive := Positive'First; begin Result := Result + 1; Octopuses_Energy_Level (Line, Column) := -1; for Adjacent : Adjacent_Location of Adjacents loop if not (Line - Adjacent.Line in Octopuses_Energy_Level_Array'Range (1)) or not (Column - Adjacent.Column in Octopuses_Energy_Level_Array'Range (2)) then goto Continue; end if; Current_Line := Line - Adjacent.Line; Current_Column := Column - Adjacent.Column; if Octopuses_Energy_Level (Current_Line, Current_Column) > -1 then Octopuses_Energy_Level (Current_Line, Current_Column) := Octopuses_Energy_Level (Current_Line, Current_Column) + 1; if Octopuses_Energy_Level (Current_Line, Current_Column) >= 10 then Do_Flash (Current_Line, Current_Column); end if; end if; <<Continue>> end loop; end Do_Flash; Step : Natural := Natural'First; begin while Step < Max_Steps loop Step := Step + 1; -- First, increase light level of every octopuses by 1 for Line in Octopuses_Energy_Level'Range (1) loop for Column in Octopuses_Energy_Level'Range (2) loop Octopuses_Energy_Level (Line, Column) := Octopuses_Energy_Level (Line, Column) + 1; end loop; end loop; -- Now, do a flash for every octopsuses that have a light level of 10 for Line in Octopuses_Energy_Level'Range (1) loop for Column in Octopuses_Energy_Level'Range (2) loop if Octopuses_Energy_Level (Line, Column) = 10 then Do_Flash (Line, Column); end if; end loop; end loop; -- Finally, reset to 0 every octopuses who flashed. -- The special value -1 is used to not process multiple flash of one octopus in a step for Line in Octopuses_Energy_Level'Range (1) loop for Column in Octopuses_Energy_Level'Range (2) loop if Octopuses_Energy_Level (Line, Column) = -1 then Octopuses_Energy_Level (Line, Column) := 0; end if; end loop; end loop; end loop; end Solve_Puzzle; End_Time := Ada.Execution_Time.Clock; Execution_Duration := End_Time - Start_Time; Put ("Result: "); Ada.Integer_Text_IO.Put (Item => Result, Width => 0); New_Line; Put_Line ("(Took " & Duration'Image (To_Duration (Execution_Duration) * 1_000_000) & "µs)"); exception when others => Close_If_Open (File); raise; end Main;
------------------------------------------------------------------------------ -- -- -- Matreshka Project -- -- -- -- Web Framework -- -- -- -- Runtime Library Component -- -- -- ------------------------------------------------------------------------------ -- -- -- Copyright © 2016-2020, Vadim Godunko <vgodunko@gmail.com> -- -- All rights reserved. -- -- -- -- Redistribution and use in source and binary forms, with or without -- -- modification, are permitted provided that the following conditions -- -- are met: -- -- -- -- * Redistributions of source code must retain the above copyright -- -- notice, this list of conditions and the following disclaimer. -- -- -- -- * Redistributions in binary form must reproduce the above copyright -- -- notice, this list of conditions and the following disclaimer in the -- -- documentation and/or other materials provided with the distribution. -- -- -- -- * Neither the name of the Vadim Godunko, IE nor the names of its -- -- contributors may be used to endorse or promote products derived from -- -- this software without specific prior written permission. -- -- -- -- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -- -- "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -- -- LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -- -- A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -- -- HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -- -- SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED -- -- TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -- -- PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -- -- LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -- -- NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -- -- SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -- -- -- ------------------------------------------------------------------------------ -- $Revision: 5872 $ $Date: 2018-09-22 11:56:07 +0200 (Sat, 22 Sep 2018) $ ------------------------------------------------------------------------------ with Web.DOM.Event_Targets; with Web.UI_Events.Mouse_Events; --with WebAPI.UI_Events.Wheel; with Web.UI.Applications.Internals; package body Web.UI.Widgets is ------------------ -- Constructors -- ------------------ package body Constructors is ---------------- -- Initialize -- ---------------- procedure Initialize (Self : aliased in out Abstract_Widget'Class; Element : Web.HTML.Elements.HTML_Element'Class) is begin Self.Element := Web.HTML.Elements.HTML_Element (Element); -- Connect event dispatchers. Self.Element.Add_Event_Listener (+"blur", Self.Blur'Unchecked_Access, False); Self.Element.Add_Event_Listener (+"change", Self.Change'Unchecked_Access, False); Self.Element.Add_Event_Listener (+"click", Self.Click'Unchecked_Access, False); Self.Element.Add_Event_Listener (+"focus", Self.Focus'Unchecked_Access, False); Self.Element.Add_Event_Listener (+"input", Self.Input'Unchecked_Access, False); Self.Element.Add_Event_Listener (+"mousemove", Self.Mouse_Move'Unchecked_Access, False); Self.Element.Add_Event_Listener (+"mousedown", Self.Mouse_Down'Unchecked_Access, False); Self.Element.Add_Event_Listener (+"mouseup", Self.Mouse_Up'Unchecked_Access, False); Self.Element.Add_Event_Listener (+"mouseenter", Self.Mouse_Enter'Unchecked_Access, False); Self.Element.Add_Event_Listener (+"mouseleave", Self.Mouse_Leave'Unchecked_Access, False); -- WebAPI.DOM.Event_Targets.Add_Event_Listener -- (Element, +"wheel", Self.Wheel'Access, False); end Initialize; end Constructors; -------------------- -- Focus_In_Event -- -------------------- not overriding procedure Focus_In_Event (Self : in out Abstract_Widget) is begin Web.UI.Applications.Internals.Focus_In (Self'Unchecked_Access); end Focus_In_Event; --------------------- -- Focus_Out_Event -- --------------------- not overriding procedure Focus_Out_Event (Self : in out Abstract_Widget) is begin Web.UI.Applications.Internals.Focus_Out (Self'Unchecked_Access); end Focus_Out_Event; ------------------ -- Handle_Event -- ------------------ overriding procedure Handle_Event (Self : in out Blur_Dispatcher; Event : in out Web.DOM.Events.Event'Class) is begin Self.Owner.Focus_Out_Event; end Handle_Event; ------------------ -- Handle_Event -- ------------------ overriding procedure Handle_Event (Self : in out Change_Dispatcher; Event : in out Web.DOM.Events.Event'Class) is begin Self.Owner.Change_Event; end Handle_Event; ------------------ -- Handle_Event -- ------------------ overriding procedure Handle_Event (Self : in out Focus_Dispatcher; Event : in out Web.DOM.Events.Event'Class) is begin Self.Owner.Focus_In_Event; end Handle_Event; ------------------ -- Handle_Event -- ------------------ overriding procedure Handle_Event (Self : in out Input_Dispatcher; Event : in out Web.DOM.Events.Event'Class) is begin Self.Owner.Input_Event; end Handle_Event; ------------------ -- Handle_Event -- ------------------ overriding procedure Handle_Event (Self : in out Mouse_Click_Dispatcher; Event : in out Web.DOM.Events.Event'Class) is DOM_Event : Web.UI_Events.Mouse_Events.Mouse_Event := Event.As_Mouse_Event; UI_Event : Web.UI.Events.Mouse.Mouse_Event; begin Web.UI.Events.Mouse.Constructors.Initialize (UI_Event, DOM_Event); Self.Owner.Mouse_Click_Event (UI_Event); end Handle_Event; ------------------ -- Handle_Event -- ------------------ overriding procedure Handle_Event (Self : in out Mouse_Move_Dispatcher; Event : in out Web.DOM.Events.Event'Class) is DOM_Event : Web.UI_Events.Mouse_Events.Mouse_Event := Event.As_Mouse_Event; UI_Event : Web.UI.Events.Mouse.Mouse_Event; begin Web.UI.Events.Mouse.Constructors.Initialize (UI_Event, DOM_Event); Self.Owner.Mouse_Move_Event (UI_Event); end Handle_Event; ------------------ -- Handle_Event -- ------------------ overriding procedure Handle_Event (Self : in out Mouse_Down_Dispatcher; Event : in out Web.DOM.Events.Event'Class) is DOM_Event : Web.UI_Events.Mouse_Events.Mouse_Event := Event.As_Mouse_Event; UI_Event : Web.UI.Events.Mouse.Mouse_Event; begin Web.UI.Events.Mouse.Constructors.Initialize (UI_Event, DOM_Event); Self.Owner.Mouse_Press_Event (UI_Event); end Handle_Event; ------------------ -- Handle_Event -- ------------------ overriding procedure Handle_Event (Self : in out Mouse_Up_Dispatcher; Event : in out Web.DOM.Events.Event'Class) is DOM_Event : Web.UI_Events.Mouse_Events.Mouse_Event := Event.As_Mouse_Event; UI_Event : Web.UI.Events.Mouse.Mouse_Event; begin Web.UI.Events.Mouse.Constructors.Initialize (UI_Event, DOM_Event); Self.Owner.Mouse_Release_Event (UI_Event); end Handle_Event; ------------------ -- Handle_Event -- ------------------ overriding procedure Handle_Event (Self : in out Mouse_Enter_Dispatcher; Event : in out Web.DOM.Events.Event'Class) is DOM_Event : Web.UI_Events.Mouse_Events.Mouse_Event := Event.As_Mouse_Event; UI_Event : Web.UI.Events.Mouse.Mouse_Event; begin Web.UI.Events.Mouse.Constructors.Initialize (UI_Event, DOM_Event); Self.Owner.Mouse_Enter_Event (UI_Event); end Handle_Event; ------------------ -- Handle_Event -- ------------------ overriding procedure Handle_Event (Self : in out Mouse_Leave_Dispatcher; Event : in out Web.DOM.Events.Event'Class) is DOM_Event : Web.UI_Events.Mouse_Events.Mouse_Event := Event.As_Mouse_Event; UI_Event : Web.UI.Events.Mouse.Mouse_Event; begin Web.UI.Events.Mouse.Constructors.Initialize (UI_Event, DOM_Event); Self.Owner.Mouse_Leave_Event (UI_Event); end Handle_Event; -- ------------------ -- -- Handle_Event -- -- ------------------ -- -- overriding procedure Handle_Event -- (Self : not null access Wheel_Dispatcher; -- Event : access WebAPI.DOM.Events.Event'Class) -- is -- E : WUI.Events.Mouse.Wheel.Mouse_Wheel_Event; -- -- begin -- WUI.Events.Mouse.Wheel.Constructors.Initialize -- (E, -- WebAPI.UI_Events.Wheel.Wheel_Event'Class (Event.all)'Unchecked_Access); -- Self.Owner.Mouse_Wheel_Event (E); -- end Handle_Event; ----------------- -- Set_Enabled -- ----------------- not overriding procedure Set_Enabled (Self : in out Abstract_Widget; Enabled : Boolean := True) is begin Abstract_Widget'Class (Self).Set_Disabled (not Enabled); end Set_Enabled; ----------------- -- Set_Visible -- ----------------- not overriding procedure Set_Visible (Self : in out Abstract_Widget; To : Boolean) is begin Self.Element.Set_Hidden (not To); end Set_Visible; end Web.UI.Widgets;
-- Shoot'n'loot -- Copyright (c) 2020 Fabien Chouteau with Sound; with Game_Assets.Tileset; with Game_Assets.Tileset_Collisions; with Game_Assets.Misc_Objects; use Game_Assets.Misc_Objects; with GESTE_Config; use GESTE_Config; with GESTE.Tile_Bank; with GESTE.Sprite; package body Chests is Closed_Tile : constant GESTE_Config.Tile_Index := Item.Chest_Closed.Tile_Id; Open_Tile : constant GESTE_Config.Tile_Index := Item.Chest_Open.Tile_Id; Coin_Tile : constant GESTE_Config.Tile_Index := Item.Coin.Tile_Id; Empty_Tile : constant GESTE_Config.Tile_Index := Item.Empty_Tile.Tile_Id; Tile_Bank : aliased GESTE.Tile_Bank.Instance (Game_Assets.Tileset.Tiles'Access, Game_Assets.Tileset_Collisions.Tiles'Access, Game_Assets.Palette'Access); type Chest_Rec is record Sprite : aliased GESTE.Sprite.Instance (Tile_Bank'Access, Closed_Tile); Coin : aliased GESTE.Sprite.Instance (Tile_Bank'Access, Empty_Tile); Coin_TTL : Natural := 0; Pos : GESTE.Pix_Point; Open : Boolean := False; end record; Chest_Array : array (1 .. Max_Nbr_Of_Chests) of Chest_Rec; Last_Chest : Natural := 0; Nbr_Open : Natural := 0; ---------- -- Init -- ---------- procedure Init (Objects : Object_Array) is begin Last_Chest := 0; Nbr_Open := 0; for Chest of Objects loop Last_Chest := Last_Chest + 1; declare C : Chest_Rec renames Chest_Array (Last_Chest); begin C.Pos := (Integer (Chest.X), Integer (Chest.Y) - 8); C.Sprite.Move (C.Pos); C.Sprite.Set_Tile (Closed_Tile); C.Open := False; C.Sprite.Flip_Horizontal (Chest.Flip_Horizontal); C.Coin_TTL := 0; GESTE.Add (Chest_Array (Last_Chest).Sprite'Access, 2); end; end loop; end Init; ----------------------- -- Check_Chest_Found -- ----------------------- procedure Check_Chest_Found (Pt : GESTE.Pix_Point) is begin for Chest of Chest_Array (Chest_Array'First .. Last_Chest) loop if not Chest.Open and then Pt.X in Chest.Pos.X .. Chest.Pos.X + Tile_Size and then Pt.Y in Chest.Pos.Y .. Chest.Pos.Y + Tile_Size then Chest.Sprite.Set_Tile (Open_Tile); Chest.Open := True; Chest.Coin.Set_Tile (Coin_Tile); Chest.Coin.Move ((Chest.Pos.X, Chest.Pos.Y - 8)); Chest.Coin_TTL := 60; GESTE.Add (Chest.Coin'Access, 4); Sound.Play_Coin; Nbr_Open := Nbr_Open + 1; -- Don't try to open more than one chest as they shouldn't be on -- the same tile. return; end if; end loop; end Check_Chest_Found; -------------- -- All_Open -- -------------- function All_Open return Boolean is (Nbr_Open = Last_Chest); ------------ -- Update -- ------------ procedure Update is begin for Chest of Chest_Array (Chest_Array'First .. Last_Chest) loop if Chest.Coin_TTL > 0 then Chest.Coin_TTL := Chest.Coin_TTL - 1; if Chest.Coin_TTL = 1 then Chest.Coin.Set_Tile (Empty_Tile); elsif Chest.Coin_TTL = 0 then GESTE.Remove (Chest.Coin'Access); end if; end if; end loop; end Update; end Chests;
package agar.gui.rect is type rect_t is record x : c.int; y : c.int; w : c.int; h : c.int; end record; type rect_access_t is access all rect_t; pragma convention (c, rect_access_t); pragma convention (c, rect_t); type rect2_t is record x1 : c.int; y1 : c.int; w : c.int; h : c.int; x2 : c.int; y2 : c.int; end record; type rect2_access_t is access all rect2_t; pragma convention (c, rect2_access_t); pragma convention (c, rect2_t); end agar.gui.rect;
with LV.Color_Types; package Lv.Color is subtype Color_T is LV.Color_Types.Color_T; subtype Color_Int_T is LV.Color_Types.Color_Int_T; subtype Opa_T is Uint8_T; type Color_Hsv_T is record H : aliased Uint16_T; S : aliased Uint8_T; V : aliased Uint8_T; end record; pragma Convention (C_Pass_By_Copy, Color_Hsv_T); function Color_Make (R8, G8, B8 : Uint8_T) return Color_T renames LV.Color_Types.Color_Make with Inline_Always; Color_White : constant Color_T := Color_Make (16#FF#, 16#FF#, 16#FF#); Color_Silver : constant Color_T := Color_Make (16#C0#, 16#C0#, 16#C0#); Color_Gray : constant Color_T := Color_Make (16#80#, 16#80#, 16#80#); Color_Black : constant Color_T := Color_Make (16#00#, 16#00#, 16#00#); Color_Red : constant Color_T := Color_Make (16#FF#, 16#00#, 16#00#); Color_Maroon : constant Color_T := Color_Make (16#80#, 16#00#, 16#00#); Color_Yellow : constant Color_T := Color_Make (16#FF#, 16#FF#, 16#00#); Color_Olive : constant Color_T := Color_Make (16#80#, 16#80#, 16#00#); Color_Lime : constant Color_T := Color_Make (16#00#, 16#FF#, 16#00#); Color_Green : constant Color_T := Color_Make (16#00#, 16#80#, 16#00#); Color_Cyan : constant Color_T := Color_Make (16#00#, 16#FF#, 16#FF#); Color_Aqua : constant Color_T := Color_Cyan; Color_Teal : constant Color_T := Color_Make (16#00#, 16#80#, 16#80#); Color_Blue : constant Color_T := Color_Make (16#00#, 16#00#, 16#FF#); Color_Navy : constant Color_T := Color_Make (16#00#, 16#00#, 16#80#); Color_Magenta : constant Color_T := Color_Make (16#FF#, 16#00#, 16#FF#); Color_Purple : constant Color_T := Color_Make (16#80#, 16#00#, 16#80#); Color_Orange : constant Color_T := Color_Make (16#FF#, 16#A5#, 16#00#); Opa_Transp : constant := 0; Opa_0 : constant := 0; Opa_10 : constant := 25; Opa_20 : constant := 51; Opa_30 : constant := 76; Opa_40 : constant := 102; Opa_50 : constant := 127; Opa_60 : constant := 153; Opa_70 : constant := 178; Opa_80 : constant := 204; Opa_90 : constant := 229; Opa_100 : constant := 255; Opa_Cover : constant := 255; Opa_Min : constant := 16; Opa_Max : constant := 251; -- In color conversations: -- - When converting to bigger color type the LSB weight of 1 LSB is calculated -- E.g. 16 bit Red has 5 bits -- 8 bit Red has 2 bits -- ---------------------- -- 8 bit red LSB = (2^5 - 1) / (2^2 - 1) = 31 / 3 = 10 -- -- - When calculating to smaller color type simply shift out the LSBs -- E.g. 8 bit Red has 2 bits -- 16 bit Red has 5 bits -- ---------------------- -- Shift right with 5 - 3 = 2 function Color_To1 (Color : Color_T) return Uint8_T; function Color_To8 (Color : Color_T) return Uint8_T; function Color_To16 (Color : Color_T) return Uint16_T; function Color_To32 (Color : Color_T) return Uint32_T; function Color_Mix (C1 : Color_T; C2 : Color_T; Mix : Uint8_T) return Color_T; -- Get the brightness of a color -- @param color a color -- @return the brightness [0..255] function Color_Brightness (Color : Color_T) return Uint8_T; -- Convert a HSV color to RGB -- @param h hue [0..359] -- @param s saturation [0..100] -- @param v value [0..100] -- @return the given RGB color in RGB (with LV_COLOR_DEPTH depth) function Color_Hsv_To_Rgb (H : Uint16_T; S : Uint8_T; V : Uint8_T) return Color_T; -- Convert an RGB color to HSV -- @param r red -- @param g green -- @param b blue -- @return the given RGB color n HSV function Color_Rgb_To_Hsv (R : Uint8_T; G : Uint8_T; B : Uint8_T) return Color_Hsv_T; ------------- -- Imports -- ------------- pragma Import (C, Color_To1, "lv_color_to1_inline"); pragma Import (C, Color_To8, "lv_color_to8_inline"); pragma Import (C, Color_To16, "lv_color_to16_inline"); pragma Import (C, Color_To32, "lv_color_to32_inline"); pragma Import (C, Color_Mix, "lv_color_mix_inline"); pragma Import (C, Color_Brightness, "lv_color_brightness_inline"); pragma Import (C, Color_Hsv_To_Rgb, "lv_color_hsv_to_rgb"); pragma Import (C, Color_Rgb_To_Hsv, "lv_color_rgb_to_hsv"); end Lv.Color;
generic package Nested_Generic1_Pkg is type Element_Renderer is access procedure; generic procedure Image_Generic (Renderer : in not null Element_Renderer); end Nested_Generic1_Pkg;
with Ada.Text_IO; procedure pkgversion is begin Ada.Text_IO.Put_Line (Ada.Text_IO'Version); end pkgversion;
with Ada.Containers.Vectors; package body Moving is use Ada.Containers; package Number_Vectors is new Ada.Containers.Vectors (Element_Type => Number, Index_Type => Natural); Current_List : Number_Vectors.Vector := Number_Vectors.Empty_Vector; procedure Add_Number (N : Number) is begin if Natural (Current_List.Length) >= Max_Elements then Current_List.Delete_First; end if; Current_List.Append (N); end Add_Number; function Get_Average return Number is Average : Number := 0.0; procedure Sum (Position : Number_Vectors.Cursor) is begin Average := Average + Number_Vectors.Element (Position); end Sum; begin Current_List.Iterate (Sum'Access); if Current_List.Length > 1 then Average := Average / Number (Current_List.Length); end if; return Average; end Get_Average; function Moving_Average (N : Number) return Number is begin Add_Number (N); return Get_Average; end Moving_Average; end Moving;
-- Ett givet huvudprogram för laboration 2. -- Du skall inte ändra på den del som är given, endast lägga till. with Ada.Text_IO; use Ada.Text_IO; with Ada.Integer_Text_IO; use Ada.Integer_Text_IO; --with Ada.Float_Text_IO; use Ada.Float_Text_IO; with Ada.Numerics.Elementary_Functions; use Ada.Numerics.Elementary_Functions; procedure Lab2 is procedure Create_Vector_Data(Xa,Ya,Za,Xb,Yb,Zb: in Integer; L,Vy,Vz: out Integer) is procedure MakeDeg(Rad: in Float; Deg: out Float) is begin Deg := Rad *(180.0/3.1415); end MakeDeg; procedure GetL(Cx,Cy,Cz: in Integer; Lflt: out Float) is -- Tar in koordinater och returnerar längden mellan dem begin Lflt:=Float((Cx)**2+(Cy)**2+(Cz)**2); Lflt:=Sqrt(Lflt); end GetL; procedure GetVy(Lz:in Integer; L: in Float; Vy: out Integer) is --Tar in 2D komponenter och matar ut Vinkeln i grader Vrad: Float; Vdeg: Float; begin Vrad := Arccos(Float(Lz)/L); MakeDeg(Vrad, Vdeg); Vy := Integer(Vdeg); end GetVy; Cx,Cy,Cz: Integer; Lflt: Float; begin Cx:=Xa-Xb; Cy:=Ya-Yb; Cz:=Za-Zb; GetL(Cx,Cy,Cz, Lflt); GetVy(Cz,Lflt, Vy); L := Integer(Lflt)/100; end Create_Vector_Data; -- Lägg till dina underprogram... Xa, Ya, Za, Xb, Yb, Zb : Integer; L, Vy, Vz : Integer; begin Put("Mata in punkten A i cm (X, Y, Z): "); Get(Xa); Get(Ya); Get(Za); Put("Mata in punkten B i cm (X, Y, Z): "); Get(Xb); Get(Yb); Get(Zb); -- På denna rad du lägga till (exakt) ett anrop till Create_Vector_Data Create_Vector_Data(Xa, Ya, Za, Xb, Yb, Zb, L, Vy, Vz); Put_Line("Längd (i m) Vy Vz"); Put(L, Width => 11); Put(Vy, Width => 7); Put(Vz, Width => 7); New_Line; end Lab2;
------------------------------------------------------------------------------ -- -- -- GNAT COMPILER COMPONENTS -- -- -- -- B A C K _ E N D -- -- -- -- B o d y -- -- -- -- Copyright (C) 1992-2020, Free Software Foundation, Inc. -- -- -- -- GNAT is free software; you can redistribute it and/or modify it under -- -- terms of the GNU General Public License as published by the Free Soft- -- -- ware Foundation; either version 3, or (at your option) any later ver- -- -- sion. GNAT is distributed in the hope that it will be useful, but WITH- -- -- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY -- -- or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -- -- for more details. You should have received a copy of the GNU General -- -- Public License distributed with GNAT; see file COPYING3. If not, go to -- -- http://www.gnu.org/licenses for a complete copy of the license. -- -- -- -- GNAT was originally developed by the GNAT team at New York University. -- -- Extensive contributions were provided by Ada Core Technologies Inc. -- -- -- ------------------------------------------------------------------------------ -- This is the version of the Back_End package for GCC back ends with Atree; use Atree; with Debug; use Debug; with Elists; use Elists; with Errout; use Errout; with Lib; use Lib; with Osint; use Osint; with Opt; use Opt; with Osint.C; use Osint.C; with Namet; use Namet; with Nlists; use Nlists; with Stand; use Stand; with Sinput; use Sinput; with Stringt; use Stringt; with Switch; use Switch; with Switch.C; use Switch.C; with System; use System; with Types; use Types; with System.OS_Lib; use System.OS_Lib; package body Back_End is type Arg_Array is array (Nat) of Big_String_Ptr; type Arg_Array_Ptr is access Arg_Array; -- Types to access compiler arguments flag_stack_check : Int; pragma Import (C, flag_stack_check); -- Indicates if stack checking is enabled, imported from misc.c save_argc : Nat; pragma Import (C, save_argc); -- Saved value of argc (number of arguments), imported from misc.c save_argv : Arg_Array_Ptr; pragma Import (C, save_argv); -- Saved value of argv (argument pointers), imported from misc.c function Len_Arg (Arg : Pos) return Nat; -- Determine length of argument number Arg on original gnat1 command line ------------------- -- Call_Back_End -- ------------------- procedure Call_Back_End (Mode : Back_End_Mode_Type) is -- The Source_File_Record type has a lot of components that are -- meaningless to the back end, so a new record type is created -- here to contain the needed information for each file. type File_Info_Type is record File_Name : File_Name_Type; Instance : Instance_Id; Num_Source_Lines : Nat; end record; File_Info_Array : array (1 .. Last_Source_File) of File_Info_Type; procedure gigi (gnat_root : Int; max_gnat_node : Int; number_name : Nat; nodes_ptr : Address; flags_ptr : Address; next_node_ptr : Address; prev_node_ptr : Address; elists_ptr : Address; elmts_ptr : Address; strings_ptr : Address; string_chars_ptr : Address; list_headers_ptr : Address; number_file : Nat; file_info_ptr : Address; gigi_standard_boolean : Entity_Id; gigi_standard_integer : Entity_Id; gigi_standard_character : Entity_Id; gigi_standard_long_long_float : Entity_Id; gigi_standard_exception_type : Entity_Id; gigi_operating_mode : Back_End_Mode_Type); pragma Import (C, gigi); begin -- Skip call if in -gnatdH mode if Debug_Flag_HH then return; end if; -- The back end needs to know the maximum line number that can appear -- in a Sloc, in other words the maximum logical line number. for J in 1 .. Last_Source_File loop File_Info_Array (J).File_Name := Full_Debug_Name (J); File_Info_Array (J).Instance := Instance (J); File_Info_Array (J).Num_Source_Lines := Nat (Physical_To_Logical (Last_Source_Line (J), J)); end loop; -- Deal with case of generating SCIL, we should not be here unless -- debugging CodePeer mode in GNAT. if Generate_SCIL then Error_Msg_N ("'S'C'I'L generation not available", Cunit (Main_Unit)); if CodePeer_Mode or else (Mode /= Generate_Object and then not Back_Annotate_Rep_Info) then return; end if; end if; -- We should be here in GNATprove mode only when debugging GNAT. Do not -- call gigi in that case, as it is not prepared to handle the special -- form of the tree obtained in GNATprove mode. if GNATprove_Mode then return; end if; -- The actual call to the back end gigi (gnat_root => Int (Cunit (Main_Unit)), max_gnat_node => Int (Last_Node_Id - First_Node_Id + 1), number_name => Name_Entries_Count, nodes_ptr => Nodes_Address, flags_ptr => Flags_Address, next_node_ptr => Next_Node_Address, prev_node_ptr => Prev_Node_Address, elists_ptr => Elists_Address, elmts_ptr => Elmts_Address, strings_ptr => Strings_Address, string_chars_ptr => String_Chars_Address, list_headers_ptr => Lists_Address, number_file => Num_Source_Files, file_info_ptr => File_Info_Array'Address, gigi_standard_boolean => Standard_Boolean, gigi_standard_integer => Standard_Integer, gigi_standard_character => Standard_Character, gigi_standard_long_long_float => Standard_Long_Long_Float, gigi_standard_exception_type => Standard_Exception_Type, gigi_operating_mode => Mode); end Call_Back_End; ------------------------------- -- Gen_Or_Update_Object_File -- ------------------------------- procedure Gen_Or_Update_Object_File is begin null; end Gen_Or_Update_Object_File; ------------- -- Len_Arg -- ------------- function Len_Arg (Arg : Pos) return Nat is begin for J in 1 .. Nat'Last loop if save_argv (Arg).all (Natural (J)) = ASCII.NUL then return J - 1; end if; end loop; raise Program_Error; end Len_Arg; ----------------------------- -- Scan_Compiler_Arguments -- ----------------------------- procedure Scan_Compiler_Arguments is Next_Arg : Positive; -- Next argument to be scanned Arg_Count : constant Natural := Natural (save_argc - 1); Args : Argument_List (1 .. Arg_Count); Output_File_Name_Seen : Boolean := False; -- Set to True after having scanned file_name for switch "-gnatO file" procedure Scan_Back_End_Switches (Switch_Chars : String); -- Procedure to scan out switches stored in Switch_Chars. The first -- character is known to be a valid switch character, and there are no -- blanks or other switch terminator characters in the string, so the -- entire string should consist of valid switch characters, except that -- an optional terminating NUL character is allowed. -- -- Back end switches have already been checked and processed by GCC in -- toplev.c, so no errors can occur and control will always return. The -- switches must still be scanned to skip "-o" or internal GCC switches -- with their argument. ---------------------------- -- Scan_Back_End_Switches -- ---------------------------- procedure Scan_Back_End_Switches (Switch_Chars : String) is First : constant Positive := Switch_Chars'First + 1; Last : constant Natural := Switch_Last (Switch_Chars); begin -- Skip -o or internal GCC switches together with their argument if Switch_Chars (First .. Last) = "o" or else Is_Internal_GCC_Switch (Switch_Chars) then Next_Arg := Next_Arg + 1; -- Store -G xxx as -Gxxx and go directly to the next argument elsif Switch_Chars (First .. Last) = "G" then Next_Arg := Next_Arg + 1; -- Should never get there with -G not followed by an argument, -- but use defensive code nonetheless. Store as -Gxxx to avoid -- storing parameters in ALI files that might create confusion. if Next_Arg <= Args'Last then Store_Compilation_Switch (Switch_Chars & Args (Next_Arg).all); end if; -- Do not record -quiet switch elsif Switch_Chars (First .. Last) = "quiet" then null; -- Store any other GCC switches. Also do special processing for some -- specific switches that the Ada front-end knows about. else Store_Compilation_Switch (Switch_Chars); -- For gcc back ends, -fno-inline disables Inline pragmas only, -- not Inline_Always to remain consistent with the always_inline -- attribute behavior. if Switch_Chars (First .. Last) = "fno-inline" then Opt.Disable_FE_Inline := True; -- Back end switch -fpreserve-control-flow also sets the front end -- flag that inhibits improper control flow transformations. elsif Switch_Chars (First .. Last) = "fpreserve-control-flow" then Opt.Suppress_Control_Flow_Optimizations := True; -- Back end switch -fdump-scos, which exists primarily for C, is -- also accepted for Ada as a synonym of -gnateS. elsif Switch_Chars (First .. Last) = "fdump-scos" then Opt.Generate_SCO := True; Opt.Generate_SCO_Instance_Table := True; elsif Switch_Chars (First) = 'g' then Debugger_Level := 2; if First < Last then case Switch_Chars (First + 1) is when '0' => Debugger_Level := 0; when '1' => Debugger_Level := 1; when '2' => Debugger_Level := 2; when '3' => Debugger_Level := 3; when others => null; end case; end if; end if; end if; end Scan_Back_End_Switches; -- Start of processing for Scan_Compiler_Arguments begin -- Acquire stack checking mode directly from GCC. The reason we do this -- is to make sure that the indication of stack checking being enabled -- is the same in the front end and the back end. This status obtained -- from gcc is affected by more than just the switch -fstack-check. Opt.Stack_Checking_Enabled := (flag_stack_check /= 0); -- Put the arguments in Args for Arg in Pos range 1 .. save_argc - 1 loop declare Argv_Ptr : constant Big_String_Ptr := save_argv (Arg); Argv_Len : constant Nat := Len_Arg (Arg); Argv : constant String := Argv_Ptr (1 .. Natural (Argv_Len)); begin Args (Positive (Arg)) := new String'(Argv); end; end loop; -- Loop through command line arguments, storing them for later access Next_Arg := 1; while Next_Arg <= Args'Last loop Look_At_Arg : declare Argv : constant String := Args (Next_Arg).all; begin -- If the previous switch has set the Output_File_Name_Present -- flag (that is we have seen a -gnatO), then the next argument -- is the name of the output object file. if Output_File_Name_Present and then not Output_File_Name_Seen then if Is_Switch (Argv) then Fail ("Object file name missing after -gnatO"); else Set_Output_Object_File_Name (Argv); Output_File_Name_Seen := True; end if; -- If the previous switch has set the Search_Directory_Present -- flag (that is if we have just seen -I), then the next argument -- is a search directory path. elsif Search_Directory_Present then if Is_Switch (Argv) then Fail ("search directory missing after -I"); else Add_Src_Search_Dir (Argv); Search_Directory_Present := False; end if; -- If not a switch, must be a file name elsif not Is_Switch (Argv) then Add_File (Argv); -- We must recognize -nostdinc to suppress visibility on the -- standard GNAT RTL sources. This is also a gcc switch. elsif Argv (Argv'First + 1 .. Argv'Last) = "nostdinc" then Opt.No_Stdinc := True; Scan_Back_End_Switches (Argv); -- We must recognize -nostdlib to suppress visibility on the -- standard GNAT RTL objects. elsif Argv (Argv'First + 1 .. Argv'Last) = "nostdlib" then Opt.No_Stdlib := True; elsif Is_Front_End_Switch (Argv) then Scan_Front_End_Switches (Argv, Args, Next_Arg); -- All non-front-end switches are back-end switches else Scan_Back_End_Switches (Argv); end if; end Look_At_Arg; Next_Arg := Next_Arg + 1; end loop; end Scan_Compiler_Arguments; end Back_End;
------------------------------------------------------------------------------ -- -- -- Matreshka Project -- -- -- -- Web Framework -- -- -- -- Tools Component -- -- -- ------------------------------------------------------------------------------ -- -- -- Copyright © 2013, Vadim Godunko <vgodunko@gmail.com> -- -- All rights reserved. -- -- -- -- Redistribution and use in source and binary forms, with or without -- -- modification, are permitted provided that the following conditions -- -- are met: -- -- -- -- * Redistributions of source code must retain the above copyright -- -- notice, this list of conditions and the following disclaimer. -- -- -- -- * Redistributions in binary form must reproduce the above copyright -- -- notice, this list of conditions and the following disclaimer in the -- -- documentation and/or other materials provided with the distribution. -- -- -- -- * Neither the name of the Vadim Godunko, IE nor the names of its -- -- contributors may be used to endorse or promote products derived from -- -- this software without specific prior written permission. -- -- -- -- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -- -- "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -- -- LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -- -- A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -- -- HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -- -- SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED -- -- TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -- -- PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -- -- LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -- -- NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -- -- SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -- -- -- ------------------------------------------------------------------------------ -- $Revision$ $Date$ ------------------------------------------------------------------------------ package body WSDL.Assertions is WSDL_Assertion_Message : constant array (WSDL_Assertion) of League.Strings.Universal_String := (Description_1001 => League.Strings.To_Universal_String ("not supported"), Description_1002 => League.Strings.To_Universal_String ("not supported"), Description_1003 => League.Strings.To_Universal_String ("not supported"), Description_1004 => League.Strings.To_Universal_String ("not supported"), Description_1005 => League.Strings.To_Universal_String ("invalid order of children elements of wsdl:decription element"), Description_1006 => League.Strings.To_Universal_String ("not supported"), Types_1007 => League.Strings.To_Universal_String ("not supported"), Types_1008 => League.Strings.To_Universal_String ("not supported"), Interface_1009 => League.Strings.To_Universal_String ("not supported"), Interface_1010 => League.Strings.To_Universal_String ("name of the interface component must be unique"), Interface_1011 => League.Strings.To_Universal_String ("list of extended interfaces must not contain duplicates"), Interface_1012 => League.Strings.To_Universal_String ("not supported"), InterfaceFault_1013 => League.Strings.To_Universal_String ("not supported"), InterfaceFault_1014 => League.Strings.To_Universal_String ("not supported"), InterfaceFault_1015 => League.Strings.To_Universal_String ("not supported"), InterfaceFault_1016 => League.Strings.To_Universal_String ("not supported"), InterfaceFault_1017 => League.Strings.To_Universal_String ("not supported"), InterfaceOperation_1018 => League.Strings.To_Universal_String ("not supported"), InterfaceOperation_1019 => League.Strings.To_Universal_String ("not supported"), InterfaceOperation_1020 => League.Strings.To_Universal_String ("not supported"), InterfaceOperation_1021 => League.Strings.To_Universal_String ("not supported"), MEP_1022 => League.Strings.To_Universal_String ("MEP is not supported"), InterfaceOperation_1023 => League.Strings.To_Universal_String ("not supported"), MessageLabel_1024 => League.Strings.To_Universal_String ("enforced by construction"), InterfaceMessageReference_1025 => League.Strings.To_Universal_String ("enforced by construction"), InterfaceMessageReference_1026 => League.Strings.To_Universal_String ("enforced by construction"), InterfaceMessageReference_1027 => League.Strings.To_Universal_String ("enforced by construction"), InterfaceMessageReference_1028 => League.Strings.To_Universal_String ("enforced by construction"), InterfaceMessageReference_1029 => League.Strings.To_Universal_String ("effective message label must be unique"), MessageLabel_1030 => League.Strings.To_Universal_String ("no such placeholder message defined by the MEP"), MessageLabel_1031 => League.Strings.To_Universal_String ("MEP has more than one placeholder message in this direction," & " message label must be specified"), MessageLabel_1032 => League.Strings.To_Universal_String ("MEP doesn't have placeholder message with direction ""In"""), MessageLabel_1033 => League.Strings.To_Universal_String ("MEP doesn't have placeholder message with direction ""Out"""), MessageLabel_1034 => League.Strings.To_Universal_String ("MEP doesn't support fault in the ""In"" direction"), MessageLabel_1035 => League.Strings.To_Universal_String ("MEP doesn't support fault in then ""Out"" direction"), InterfaceFaultReference_1037 => League.Strings.To_Universal_String ("enforced by construction"), InterfaceFaultReference_1038 => League.Strings.To_Universal_String ("enforced by construction"), InterfaceFaultReference_1039 => League.Strings.To_Universal_String ("combination of its interface fault and message label must be" & " unique"), InterfaceFaultReference_1040 => League.Strings.To_Universal_String ("MEP has more than one fault in this direction, message label" & " must be specified"), MessageLabel_1041 => League.Strings.To_Universal_String ("MEP has more than one placeholder message in this direction," & " message label must be specified"), MessageLabel_1042 => League.Strings.To_Universal_String ("no such placeholder message defined by the MEP"), MessageLabel_1043 => League.Strings.To_Universal_String ("MEP doesn't have placeholder message with this direction"), Binding_1044 => League.Strings.To_Universal_String ("interface must be specified for binding when it specify" & " operation or fault binding details"), Binding_1045 => League.Strings.To_Universal_String ("not supported"), Binding_1046 => League.Strings.To_Universal_String ("not supported"), Binding_1047 => League.Strings.To_Universal_String ("not supported"), Binding_1048 => League.Strings.To_Universal_String ("not supported"), Binding_1049 => League.Strings.To_Universal_String ("name of binding component must be unique"), BindingFault_1050 => League.Strings.To_Universal_String ("duplicate specification of binding details for interface" & " fault"), BindingOperation_1051 => League.Strings.To_Universal_String ("duplicate specification of binding details for interface" & " operation")); ------------ -- Report -- ------------ procedure Report (File : League.Strings.Universal_String; Line : WSDL.Diagnoses.Line_Number; Column : WSDL.Diagnoses.Column_Number; Assertion : WSDL_Assertion) is begin WSDL.Diagnoses.Report (File, Line, Column, WSDL_Assertion_Message (Assertion)); end Report; end WSDL.Assertions;
-- Copyright (c) 2019 Maxim Reznik <reznikmm@gmail.com> -- -- SPDX-License-Identifier: MIT -- License-Filename: LICENSE ------------------------------------------------------------- with Ada.Calendar; with Slim.Messages.strm; with Slim.Players.Displays; package body Slim.Players.Common_Play_Visiters is function Image (Seconds : Natural) return League.Strings.Universal_String; ---------- -- BUTN -- ---------- overriding procedure BUTN (Self : in out Visiter; Message : not null access Slim.Messages.BUTN.BUTN_Message) is Player : Players.Player renames Self.Player.all; Button : constant Slim.Messages.BUTN.Button_Kind := Message.Button; begin case Button is when Slim.Messages.BUTN.Knob_Left | Slim.Messages.BUTN.Volume_Down => Player.Volume (Natural'Max (0, Player.State.Play_State.Volume - 5)); Update_Display (Player); when Slim.Messages.BUTN.Knob_Right | Slim.Messages.BUTN.Volume_Up => Player.Volume (Natural'Min (100, Player.State.Play_State.Volume + 5)); Update_Display (Player); when Slim.Messages.BUTN.Pause => declare Map : constant array (Boolean) of Slim.Messages.strm.Play_Command := (False => Slim.Messages.strm.Pause, True => Slim.Messages.strm.Unpause); Strm : Slim.Messages.strm.Strm_Message; begin Strm.Simple_Command (Map (Player.State.Play_State.Paused)); Write_Message (Player.Socket, Strm); Player.State.Play_State.Paused := not Player.State.Play_State.Paused; end; when Slim.Messages.BUTN.Back => Player.Stop; when others => null; end case; end BUTN; ----------- -- Image -- ----------- function Image (Seconds : Natural) return League.Strings.Universal_String is Min : constant Wide_Wide_String := Natural'Wide_Wide_Image (Seconds / 60); Sec : constant Wide_Wide_String := Natural'Wide_Wide_Image (Seconds mod 60); Result : League.Strings.Universal_String; begin Result.Append (Min (2 .. Min'Last)); Result.Append (":"); if Sec'Length <= 2 then Result.Append ("0"); end if; Result.Append (Sec (2 .. Sec'Last)); return Result; end Image; -------------------- -- Update_Display -- -------------------- procedure Update_Display (Self : in out Player) is use type Ada.Calendar.Time; Display : Slim.Players.Displays.Display := Self.Get_Display; State : Player_State renames Self.State; Time : constant Ada.Calendar.Time := Ada.Calendar.Clock; Text : League.Strings.Universal_String; Song : League.Strings.Universal_String; Seconds : Natural; function Volume return Wide_Wide_String is (Natural'Wide_Wide_Image (State.Play_State.Volume)); begin if State.Kind not in Play_Radio | Play_Files then return; end if; Song := State.Play_State.Current_Song; Slim.Players.Displays.Clear (Display); if Time - State.Play_State.Volume_Set_Time < 3.0 or Song.Is_Empty then Text.Append ("Volume:"); Text.Append (Volume); Text.Append ("%"); Slim.Players.Displays.Draw_Text (Self => Display, X => 1, Y => 6, Font => Self.Font, Text => Text); elsif State.Play_State.Paused then Text.Append ("Pause"); Slim.Players.Displays.Draw_Text (Self => Display, X => 1, Y => 2 - Slim.Fonts.Size (Self.Font, Song).Bottom, Font => Self.Font, Text => Text); elsif State.Kind = Play_Files then Seconds := State.Play_State.Seconds + State.Offset; Text.Append (Image (Seconds)); Slim.Players.Displays.Draw_Text (Self => Display, X => 158 - Slim.Fonts.Size (Self.Font, Text).Right, Y => 6, Font => Self.Font, Text => Text); end if; Slim.Players.Displays.Draw_Text (Self => Display, X => 1, Y => 33 - Slim.Fonts.Size (Self.Font, Song).Top, Font => Self.Font, Text => Song); Slim.Players.Displays.Send_Message (Display); end Update_Display; end Slim.Players.Common_Play_Visiters;
------------------------------------------------------------------------------ -- -- -- GNAT COMPILER COMPONENTS -- -- -- -- S C N G -- -- -- -- S p e c -- -- -- -- Copyright (C) 1992-2010, Free Software Foundation, Inc. -- -- -- -- GNAT is free software; you can redistribute it and/or modify it under -- -- terms of the GNU General Public License as published by the Free Soft- -- -- ware Foundation; either version 3, or (at your option) any later ver- -- -- sion. GNAT is distributed in the hope that it will be useful, but WITH- -- -- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY -- -- or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -- -- for more details. You should have received a copy of the GNU General -- -- Public License distributed with GNAT; see file COPYING3. If not, go to -- -- http://www.gnu.org/licenses for a complete copy of the license. -- -- -- -- GNAT was originally developed by the GNAT team at New York University. -- -- Extensive contributions were provided by Ada Core Technologies Inc. -- -- -- ------------------------------------------------------------------------------ -- This package contains a generic lexical analyzer. This is used for scanning -- Ada source files or text files with an Ada-like syntax, such as project -- files. It is instantiated in Scn and Prj.Err. with Casing; use Casing; with Styleg; with Types; use Types; generic with procedure Post_Scan; -- Procedure called by Scan for the following tokens: Tok_Char_Literal, -- Tok_Identifier, Tok_Real_Literal, Tok_Real_Literal, Tok_Integer_Literal, -- Tok_String_Literal, Tok_Operator_Symbol, and Tok_Vertical_Bar. Used to -- build Token_Node and also check for obsolescent features. with procedure Error_Msg (Msg : String; Flag_Location : Source_Ptr); -- Output a message at specified location with procedure Error_Msg_S (Msg : String); -- Output a message at current scan pointer location with procedure Error_Msg_SC (Msg : String); -- Output a message at the start of the current token with procedure Error_Msg_SP (Msg : String); -- Output a message at the start of the previous token with package Style is new Styleg (Error_Msg, Error_Msg_S, Error_Msg_SC, Error_Msg_SP); -- Instantiation of Styleg with the same error reporting routines package Scng is procedure Initialize_Scanner (Index : Source_File_Index); -- Initialize lexical scanner for scanning a new file referenced by Index. -- Initialize_Scanner does not call Scan. procedure Scan; -- Scan scans out the next token, and advances the scan state accordingly -- (see package Scan_State for details). If the scan encounters an illegal -- token, then an error message is issued pointing to the bad character, -- and Scan returns a reasonable substitute token of some kind. -- For tokens Char_Literal, Identifier, Real_Literal, Integer_Literal, -- String_Literal and Operator_Symbol, Post_Scan is called after scanning. function Determine_Token_Casing return Casing_Type; pragma Inline (Determine_Token_Casing); -- Determines the casing style of the current token, which is -- either a keyword or an identifier. See also package Casing. procedure Set_Special_Character (C : Character); -- Indicate that one of the following character '#', '$', '?', '@', '`', -- '\', '^', '_' or '~', when found is a Special token. procedure Reset_Special_Characters; -- Indicate that there is no characters that are Special tokens., which -- is the default. procedure Set_End_Of_Line_As_Token (Value : Boolean); -- Indicate if End_Of_Line is a token or not. -- By default, End_Of_Line is not a token. procedure Set_Comment_As_Token (Value : Boolean); -- Indicate if a comment is a token or not. -- By default, a comment is not a token. function Set_Start_Column return Column_Number; -- This routine is called with Scan_Ptr pointing to the first character -- of a line. On exit, Scan_Ptr is advanced to the first non-blank -- character of this line (or to the terminating format effector if the -- line contains no non-blank characters), and the returned result is the -- column number of this non-blank character (zero origin), which is the -- value to be stored in the Start_Column scan variable. end Scng;
generic type Fixed_Point_Type is delta <>; package Fmt.Generic_Ordinary_Fixed_Point_Argument is function To_Argument (X : Fixed_Point_Type) return Argument_Type'Class with Inline; function "&" (Args : Arguments; X : Fixed_Point_Type) return Arguments with Inline; private type Fixed_Point_Argument_Type is new Argument_Type with record Value : Fixed_Point_Type; Width : Natural := 0; Fill : Character := ' '; Fore : Natural := Fixed_Point_Type'Fore; Aft : Natural := Fixed_Point_Type'Aft; end record; overriding procedure Parse ( Self : in out Fixed_Point_Argument_Type; Edit : String); overriding function Get_Length ( Self : in out Fixed_Point_Argument_Type) return Natural; overriding procedure Put ( Self : in out Fixed_Point_Argument_Type; Edit : String; To : in out String); end Fmt.Generic_Ordinary_Fixed_Point_Argument;
-- This spec has been automatically generated from STM32L0x3.svd pragma Restrictions (No_Elaboration_Code); pragma Ada_2012; pragma Style_Checks (Off); with HAL; with System; package STM32_SVD.Flash is pragma Preelaborate; --------------- -- Registers -- --------------- -- Access control register type ACR_Register is record -- Latency LATENCY : Boolean := False; -- Prefetch enable PRFTEN : Boolean := False; -- unspecified Reserved_2_2 : HAL.Bit := 16#0#; -- Flash mode during Sleep SLEEP_PD : Boolean := False; -- Flash mode during Run RUN_PD : Boolean := False; -- Disable Buffer DESAB_BUF : Boolean := False; -- Pre-read data address PRE_READ : Boolean := False; -- unspecified Reserved_7_31 : HAL.UInt25 := 16#0#; end record with Volatile_Full_Access, Size => 32, Bit_Order => System.Low_Order_First; for ACR_Register use record LATENCY at 0 range 0 .. 0; PRFTEN at 0 range 1 .. 1; Reserved_2_2 at 0 range 2 .. 2; SLEEP_PD at 0 range 3 .. 3; RUN_PD at 0 range 4 .. 4; DESAB_BUF at 0 range 5 .. 5; PRE_READ at 0 range 6 .. 6; Reserved_7_31 at 0 range 7 .. 31; end record; -- Program/erase control register type PECR_Register is record -- FLASH_PECR and data EEPROM lock PELOCK : Boolean := True; -- Program memory lock PRGLOCK : Boolean := True; -- Option bytes block lock OPTLOCK : Boolean := True; -- Program memory selection PROG : Boolean := False; -- Data EEPROM selection DATA : Boolean := False; -- unspecified Reserved_5_7 : HAL.UInt3 := 16#0#; -- Fixed time data write for Byte, Half Word and Word programming FTDW : Boolean := False; -- Page or Double Word erase mode ERASE : Boolean := False; -- Half Page/Double Word programming mode FPRG : Boolean := False; -- unspecified Reserved_11_14 : HAL.UInt4 := 16#0#; -- Parallel bank mode PARALLELBANK : Boolean := False; -- End of programming interrupt enable EOPIE : Boolean := False; -- Error interrupt enable ERRIE : Boolean := False; -- Launch the option byte loading OBL_LAUNCH : Boolean := False; -- unspecified Reserved_19_31 : HAL.UInt13 := 16#0#; end record with Volatile_Full_Access, Size => 32, Bit_Order => System.Low_Order_First; for PECR_Register use record PELOCK at 0 range 0 .. 0; PRGLOCK at 0 range 1 .. 1; OPTLOCK at 0 range 2 .. 2; PROG at 0 range 3 .. 3; DATA at 0 range 4 .. 4; Reserved_5_7 at 0 range 5 .. 7; FTDW at 0 range 8 .. 8; ERASE at 0 range 9 .. 9; FPRG at 0 range 10 .. 10; Reserved_11_14 at 0 range 11 .. 14; PARALLELBANK at 0 range 15 .. 15; EOPIE at 0 range 16 .. 16; ERRIE at 0 range 17 .. 17; OBL_LAUNCH at 0 range 18 .. 18; Reserved_19_31 at 0 range 19 .. 31; end record; -- Status register type SR_Register is record -- Read-only. Write/erase operations in progress BSY : Boolean := False; -- Read-only. End of operation EOP : Boolean := False; -- Read-only. End of high voltage ENDHV : Boolean := True; -- Read-only. Flash memory module ready after low power mode READY : Boolean := False; -- unspecified Reserved_4_7 : HAL.UInt4 := 16#0#; -- Write protected error WRPERR : Boolean := False; -- Programming alignment error PGAERR : Boolean := False; -- Size error SIZERR : Boolean := False; -- Option validity error OPTVERR : Boolean := False; -- unspecified Reserved_12_13 : HAL.UInt2 := 16#0#; -- RDERR RDERR : Boolean := False; -- unspecified Reserved_15_15 : HAL.Bit := 16#0#; -- NOTZEROERR NOTZEROERR : Boolean := False; -- FWWERR FWWERR : Boolean := False; -- unspecified Reserved_18_31 : HAL.UInt14 := 16#0#; end record with Volatile_Full_Access, Size => 32, Bit_Order => System.Low_Order_First; for SR_Register use record BSY at 0 range 0 .. 0; EOP at 0 range 1 .. 1; ENDHV at 0 range 2 .. 2; READY at 0 range 3 .. 3; Reserved_4_7 at 0 range 4 .. 7; WRPERR at 0 range 8 .. 8; PGAERR at 0 range 9 .. 9; SIZERR at 0 range 10 .. 10; OPTVERR at 0 range 11 .. 11; Reserved_12_13 at 0 range 12 .. 13; RDERR at 0 range 14 .. 14; Reserved_15_15 at 0 range 15 .. 15; NOTZEROERR at 0 range 16 .. 16; FWWERR at 0 range 17 .. 17; Reserved_18_31 at 0 range 18 .. 31; end record; subtype OBR_RDPRT_Field is HAL.UInt8; subtype OBR_BOR_LEV_Field is HAL.UInt4; -- Option byte register type OBR_Register is record -- Read-only. Read protection RDPRT : OBR_RDPRT_Field; -- Read-only. Selection of protection mode of WPR bits SPRMOD : Boolean; -- unspecified Reserved_9_15 : HAL.UInt7; -- Read-only. BOR_LEV BOR_LEV : OBR_BOR_LEV_Field; -- unspecified Reserved_20_31 : HAL.UInt12; end record with Volatile_Full_Access, Size => 32, Bit_Order => System.Low_Order_First; for OBR_Register use record RDPRT at 0 range 0 .. 7; SPRMOD at 0 range 8 .. 8; Reserved_9_15 at 0 range 9 .. 15; BOR_LEV at 0 range 16 .. 19; Reserved_20_31 at 0 range 20 .. 31; end record; subtype WRPR_WRP_Field is HAL.UInt16; -- Write protection register type WRPR_Register is record -- Write protection WRP : WRPR_WRP_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 WRPR_Register use record WRP at 0 range 0 .. 15; Reserved_16_31 at 0 range 16 .. 31; end record; ----------------- -- Peripherals -- ----------------- -- Flash type Flash_Peripheral is record -- Access control register ACR : aliased ACR_Register; -- Program/erase control register PECR : aliased PECR_Register; -- Power down key register PDKEYR : aliased HAL.UInt32; -- Program/erase key register PEKEYR : aliased HAL.UInt32; -- Program memory key register PRGKEYR : aliased HAL.UInt32; -- Option byte key register OPTKEYR : aliased HAL.UInt32; -- Status register SR : aliased SR_Register; -- Option byte register OBR : aliased OBR_Register; -- Write protection register WRPR : aliased WRPR_Register; end record with Volatile; for Flash_Peripheral use record ACR at 16#0# range 0 .. 31; PECR at 16#4# range 0 .. 31; PDKEYR at 16#8# range 0 .. 31; PEKEYR at 16#C# range 0 .. 31; PRGKEYR at 16#10# range 0 .. 31; OPTKEYR at 16#14# range 0 .. 31; SR at 16#18# range 0 .. 31; OBR at 16#1C# range 0 .. 31; WRPR at 16#20# range 0 .. 31; end record; -- Flash Flash_Periph : aliased Flash_Peripheral with Import, Address => System'To_Address (16#40022000#); end STM32_SVD.Flash;
-- { dg-do run } procedure Prot_Def is protected Prot is procedure Inc; function Get return Integer; private Data : Integer := 0; end Prot; protected body Prot is procedure Inc is begin Data := Data + 1; end Inc; function Get return Integer is begin return Data; end Get; end Prot; generic with procedure Inc is Prot.Inc; with function Get return Integer is Prot.Get; package Gen is function Add2_Get return Integer; end Gen; package body Gen is function Add2_Get return Integer is begin Inc; Inc; return Get; end Add2_Get; end Gen; package Inst is new Gen; begin if Inst.Add2_Get /= 2 then raise Constraint_Error; end if; end Prot_Def;
with Ada.Integer_Text_IO; use Ada.Integer_Text_IO; type Frequency is Integer procedure One is begin ResultFrequency : Frequency := 0; CurrentFrequency : Frequency := 0; Pos : Postive_Count; InputFile : File_Type; FileName : String := "input.txt"; begin Open(File => InputFile, Mode => In_File, Name => FileName); while not End_Of_File loop Get(File => InputFile, Item => CurrentFrequency); ResultFrequency := ResultFrequency + CurrentFrequency;≤≥ Pos := Col(File => InputFile); Set_Col(File => InputFile, To: Pos + 2); end loop; end; Close(File => InputFile); Put(File => Standard_Out, Item => ResultFrequency); end;
with linear_Net; with Neural.Set; with Neural.Net; with float_Math; with lace.Environ; with ada.calendar; use ada.calendar; with ada.Strings.unbounded; use ada.Strings.unbounded; with ada.Strings.fixed; use ada.Strings.fixed; with ada.Text_IO; use ada.Text_IO; with Ada.Exceptions; use Ada.Exceptions; -- with opengl.IO; use opengl.IO; procedure launch_learn_Linear -- -- -- is package Math renames Neural.Math; use type math.Real; begin declare use Math; use type math.Real; use type neural.Signal; the_Net : aliased linear_Net.item; pattern_Count : constant := 10; the_Patterns : neural.Patterns (1 .. pattern_Count); -- the_Environ : lace.Environ.item; Training : Boolean := True; -- Training : Boolean := False; Signal : math.Real := 0.0; begin --- setup -- if Training then lace.Environ.rid_Folder ("./velocity.net"); end if; the_Net.define ("velocity"); if Training then --- collect net trainng data -- for each_Pattern in 1 .. pattern_Count loop Signal := Signal + 1.0; the_Patterns (Each_Pattern) := the_Net.Pattern_For (Signal, False, -Signal); end loop; --- train the net -- the_Net.Patterns_are (the_Patterns); the_Net.train (Max_Epochs => 150_000, Client_Actions => (1 => (Act => Neural.Net.report_training_Status'Access, Rate => 1000), 2 => (Act => Neural.Net.store_best_Epoch'Access, Rate => 1000)), -- Client_Continue => Net_is_training'Access, acceptable_error => 0.000_01); the_Net.report_training_Status; -- if the_Net.test_RMS_Error_For -- <= the_Net.min_test_RMS_Error_for -- then -- the_Net.Store; -- end if; end if; -- else --- test the net -- put_Line ("Net's output estimate: " & Real'Image (the_Net.Output_for (5.55))); exception when E : others => put_Line ("Launch *unhandled* exception ..."); put_Line (Exception_Information (E)); put_Line ("Launch has terminated !"); end; end launch_learn_Linear;
-- CA1022A6M.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 IF A SUBPROGRAM BODY IS INITIALLY COMPILED WITH A CONTEXT -- CLAUSE AND A UNIT NAMED IN THE CONTEXT CLAUSE IS RECOMPILED, THEN AN -- ATTEMPT TO COMPILE THE BODY AGAIN WILL SUCCEED IF THE CONTEXT CLAUSE -- IS PRESENT. -- CHECK THAT IF THE RECOMPILED UNIT IS NOT NEEDED IN THE SUBPROGRAM -- BODY, THE BODY CAN BE SUCCESSFULLY RECOMPILED WITHOUT MENTIONING THE -- RECOMPILED UNIT. -- SEPARATE FILES ARE: -- CA1022A0 A LIBRARY PACKAGE. -- CA1022A1 A LIBRARY PROCEDURE. -- CA1022A2 A LIBRARY FUNCTION. -- CA1022A3 A LIBRARY PACKAGE (CA1022A0). -- CA1022A4 A LIBRARY PROCEDURE (CA1022A1). -- CA1022A5 A LIBRARY FUNCTION (CA1022A2). -- CA1022A6M THE MAIN PROCEDURE. -- BHS 7/23/84 WITH CA1022A1, CA1022A2; WITH REPORT; USE REPORT; PROCEDURE CA1022A6M IS I : INTEGER := 1; BEGIN TEST ("CA1022A", "USE OF CONTEXT CLAUSES NAMING RECOMPILED " & "UNITS WITH RECOMPILED SUBPROGRAMS"); CA1022A1(I); IF I /= 5 THEN FAILED ("PROCEDURE CA1022A1 NOT INVOKED CORRECTLY"); END IF; IF CA1022A2 THEN FAILED ("FUNCTION CA1022A2 NOT INVOKED CORRECTLY"); END IF; RESULT; END CA1022A6M;
--////////////////////////////////////////////////////////// -- SFML - Simple and Fast Multimedia Library -- Copyright (C) 2007-2015 Laurent Gomila (laurent@sfml-dev.org) -- This software is provided 'as-is', without any express or implied warranty. -- In no event will the authors be held liable for any damages arising from the use of this software. -- Permission is granted to anyone to use this software for any purpose, -- including commercial applications, and to alter it and redistribute it freely, -- subject to the following restrictions: -- 1. The origin of this software must not be misrepresented; -- you must not claim that you wrote the original software. -- If you use this software in a product, an acknowledgment -- in the product documentation would be appreciated but is not required. -- 2. Altered source versions must be plainly marked as such, -- and must not be misrepresented as being the original software. -- 3. This notice may not be removed or altered from any source distribution. --////////////////////////////////////////////////////////// --////////////////////////////////////////////////////////// with Sf.System.Time; package Sf.Network.SocketSelector is --////////////////////////////////////////////////////////// --/ @brief Create a new selector --/ --/ @return A new sfSocketSelector object --/ --////////////////////////////////////////////////////////// function create return sfSocketSelector_Ptr; --////////////////////////////////////////////////////////// --/ @brief Create a new socket selector by copying an existing one --/ --/ @param selector Socket selector to copy --/ --/ @return A new sfSocketSelector object which is a copy of @a selector --/ --////////////////////////////////////////////////////////// function copy (selector : sfSocketSelector_Ptr) return sfSocketSelector_Ptr; --////////////////////////////////////////////////////////// --/ @brief Destroy a socket selector --/ --/ @param selector Socket selector to destroy --/ --////////////////////////////////////////////////////////// procedure destroy (selector : sfSocketSelector_Ptr); --////////////////////////////////////////////////////////// --/ @brief Add a new socket to a socket selector --/ --/ This function keeps a weak pointer to the socket, --/ so you have to make sure that the socket is not destroyed --/ while it is stored in the selector. --/ --/ @param selector Socket selector object --/ @param socket Pointer to the socket to add --/ --////////////////////////////////////////////////////////// procedure addTcpListener (selector : sfSocketSelector_Ptr; socket : sfTcpListener_Ptr); procedure addTcpSocket (selector : sfSocketSelector_Ptr; socket : sfTcpSocket_Ptr); procedure addUdpSocket (selector : sfSocketSelector_Ptr; socket : sfUdpSocket_Ptr); --////////////////////////////////////////////////////////// --/ @brief Remove a socket from a socket selector --/ --/ This function doesn't destroy the socket, it simply --/ removes the pointer that the selector has to it. --/ --/ @param selector Socket selector object --/ @param socket POointer to the socket to remove --/ --////////////////////////////////////////////////////////// procedure removeTcpListener (selector : sfSocketSelector_Ptr; socket : sfTcpListener_Ptr); procedure removeTcpSocket (selector : sfSocketSelector_Ptr; socket : sfTcpSocket_Ptr); procedure removeUdpSocket (selector : sfSocketSelector_Ptr; socket : sfUdpSocket_Ptr); --////////////////////////////////////////////////////////// --/ @brief Remove all the sockets stored in a selector --/ --/ This function doesn't destroy any instance, it simply --/ removes all the pointers that the selector has to --/ external sockets. --/ --/ @param selector Socket selector object --/ --////////////////////////////////////////////////////////// procedure clear (selector : sfSocketSelector_Ptr); --////////////////////////////////////////////////////////// --/ @brief Wait until one or more sockets are ready to receive --/ --/ This function returns as soon as at least one socket has --/ some data available to be received. To know which sockets are --/ ready, use the sfSocketSelector_isXxxReady functions. --/ If you use a timeout and no socket is ready before the timeout --/ is over, the function returns sfFalse. --/ --/ @param selector Socket selector object --/ @param timeout Maximum time to wait (use sfTimeZero for infinity) --/ --/ @return sfTrue if there are sockets ready, sfFalse otherwise --/ --////////////////////////////////////////////////////////// function wait (selector : sfSocketSelector_Ptr; timeout : Sf.System.Time.sfTime) return sfBool; --////////////////////////////////////////////////////////// --/ @brief Test a socket to know if it is ready to receive data --/ --/ This function must be used after a call to --/ sfSocketSelector_wait, to know which sockets are ready to --/ receive data. If a socket is ready, a call to Receive will --/ never block because we know that there is data available to read. --/ Note that if this function returns sfTrue for a sfTcpListener, --/ this means that it is ready to accept a new connection. --/ --/ @param selector Socket selector object --/ @param socket Socket to test --/ --/ @return sfTrue if the socket is ready to read, sfFalse otherwise --/ --////////////////////////////////////////////////////////// function isTcpListenerReady (selector : sfSocketSelector_Ptr; socket : sfTcpListener_Ptr) return sfBool; function isTcpSocketReady (selector : sfSocketSelector_Ptr; socket : sfTcpSocket_Ptr) return sfBool; function isUdpSocketReady (selector : sfSocketSelector_Ptr; socket : sfTcpSocket_Ptr) return sfBool; private pragma Import (C, create, "sfSocketSelector_create"); pragma Import (C, copy, "sfSocketSelector_copy"); pragma Import (C, destroy, "sfSocketSelector_destroy"); pragma Import (C, addTcpListener, "sfSocketSelector_addTcpListener"); pragma Import (C, addTcpSocket, "sfSocketSelector_addTcpSocket"); pragma Import (C, addUdpSocket, "sfSocketSelector_addUdpSocket"); pragma Import (C, removeTcpListener, "sfSocketSelector_removeTcpListener"); pragma Import (C, removeTcpSocket, "sfSocketSelector_removeTcpSocket"); pragma Import (C, removeUdpSocket, "sfSocketSelector_removeUdpSocket"); pragma Import (C, clear, "sfSocketSelector_clear"); pragma Import (C, wait, "sfSocketSelector_wait"); pragma Import (C, isTcpListenerReady, "sfSocketSelector_isTcpListenerReady"); pragma Import (C, isTcpSocketReady, "sfSocketSelector_isTcpSocketReady"); pragma Import (C, isUdpSocketReady, "sfSocketSelector_isUdpSocketReady"); end Sf.Network.SocketSelector;
----------------------------------------------------------------------- -- gen-commands -- Commands for dynamo -- Copyright (C) 2011, 2012, 2017, 2021 Stephane Carrez -- Written by Stephane Carrez (Stephane.Carrez@gmail.com) -- -- Licensed under the Apache License, Version 2.0 (the "License"); -- you may not use this file except in compliance with the License. -- You may obtain a copy of the License at -- -- http://www.apache.org/licenses/LICENSE-2.0 -- -- Unless required by applicable law or agreed to in writing, software -- distributed under the License is distributed on an "AS IS" BASIS, -- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -- See the License for the specific language governing permissions and -- limitations under the License. ----------------------------------------------------------------------- with Ada.Text_IO; with Ada.Command_Line; with Gen.Configs; with Gen.Commands.Generate; with Gen.Commands.Project; with Gen.Commands.Page; with Gen.Commands.Layout; with Gen.Commands.Model; with Gen.Commands.Propset; with Gen.Commands.Database; with Gen.Commands.Info; with Gen.Commands.Distrib; with Gen.Commands.Plugins; with Gen.Commands.Docs; package body Gen.Commands is -- ------------------------------ -- Print dynamo short usage. -- ------------------------------ procedure Short_Help_Usage is use Ada.Text_IO; begin New_Line; Put ("Type '"); Put (Ada.Command_Line.Command_Name); Put_Line (" help' for the list of commands."); end Short_Help_Usage; -- Generate command. Generate_Cmd : aliased Gen.Commands.Generate.Command; -- Create project command. Create_Project_Cmd : aliased Gen.Commands.Project.Command; -- Add page command. Add_Page_Cmd : aliased Gen.Commands.Page.Command; -- Add layout command. Add_Layout_Cmd : aliased Gen.Commands.Layout.Command; -- Add model command. Add_Model_Cmd : aliased Gen.Commands.Model.Command; -- Sets a property on the dynamo.xml project. Propset_Cmd : aliased Gen.Commands.Propset.Command; -- Create database command. Database_Cmd : aliased Gen.Commands.Database.Command; -- Project information command. Info_Cmd : aliased Gen.Commands.Info.Command; -- Distrib command. Dist_Cmd : aliased Gen.Commands.Distrib.Command; -- Create plugin command. Create_Plugin_Cmd : aliased Gen.Commands.Plugins.Command; -- Documentation command. Doc_Plugin_Cmd : aliased Gen.Commands.Docs.Command; -- Help command. Help_Cmd : aliased Drivers.Help_Command_Type; begin Driver.Set_Description (Gen.Configs.RELEASE); Driver.Set_Usage ("[-v] [-o directory] [-t templates] {command} {arguments}" & ASCII.LF & "where:" & ASCII.LF & " -v Print the version, configuration and installation paths" & ASCII.LF & " -o directory Directory where the Ada mapping files are generated" & ASCII.LF & " -t templates Directory where the Ada templates are defined" & ASCII.LF & " -c dir Directory where the Ada templates " & "and configurations are defined"); Driver.Add_Command (Name => "help", Command => Help_Cmd'Access); Driver.Add_Command (Name => "generate", Command => Generate_Cmd'Access); Driver.Add_Command (Name => "create-project", Command => Create_Project_Cmd'Access); Driver.Add_Command (Name => "add-page", Command => Add_Page_Cmd'Access); Driver.Add_Command (Name => "add-layout", Command => Add_Layout_Cmd'Access); Driver.Add_Command (Name => "add-model", Command => Add_Model_Cmd'Access); Driver.Add_Command (Name => "propset", Command => Propset_Cmd'Access); Driver.Add_Command (Name => "create-database", Command => Database_Cmd'Access); Driver.Add_Command (Name => "create-plugin", Command => Create_Plugin_Cmd'Access); Driver.Add_Command (Name => "dist", Command => Dist_Cmd'Access); Driver.Add_Command (Name => "info", Command => Info_Cmd'Access); Driver.Add_Command (Name => "build-doc", Command => Doc_Plugin_Cmd'Access); end Gen.Commands;
-- package Gauss_Quadrature_61 -- -- Package provides a 61 pt. Gauss-Kronrod quadrature rule. Tables are -- good to about 30 significant figures. -- A 30-point Gaussian rule is used for error estimate.(From Quadpack.) -- -- To estimate the idefinite integral of a function F(X) in an interval -- (X_Starting, X_Final), use the following fragment: -- -- Find_Gauss_Nodes (X_Starting, X_Final, X_gauss); -- -- for I in Gauss_Index_61 loop -- F_val(I) := F (X_gauss(I)); -- end loop; -- -- Evaluate the function at the 61 callocation points just once. -- -- Get_Integral (F_val, X_Starting, X_Final, Area, Rough_Error); -- -- The array X_gauss(I) is the set of points X that the -- function F is evaluated at. The function is multiplied by -- the Gauss_Weights associated with each of these points, and -- result is summed to give the area under the curve in the -- interval defined above. -- -- Rough_Error is usually wrong by orders of magnitude. But -- it's usually larger than the actual error. Works best when -- error is near machine epsilon. -- generic type Real is digits <>; with function Sqrt(X : Real) return Real is <>; package Gauss_Quadrature_61 is type Gauss_Index_61 is range -30 .. 30; type Gauss_Values is array (Gauss_Index_61) of Real; -- These are the 61 callocation points, the X axis points at -- which the function is evaluated. They are calculated by -- the following routine: procedure Find_Gauss_Nodes (X_Starting : in Real; X_Final : in Real; X_gauss : out Gauss_Values); type Function_Values is array(Gauss_Index_61) of Real; -- Fill array F_val of this type with values function F: -- -- for I in Gauss_Index_61 loop -- F_val(I) := F (X_gauss(I)); -- end loop; procedure Get_Integral (F_val : in Function_Values; X_Starting : in Real; X_Final : in Real; Area : out Real; Rough_Error : out Real); procedure Gauss_61_Coeff_Test; end Gauss_Quadrature_61;
------------------------------------------------------------------------------ -- -- -- GNAT COMPILER COMPONENTS -- -- -- -- S Y S T E M . S E C O N D A R Y _ S T A C K . S I N G L E _ T A S K -- -- -- -- S p e c -- -- -- -- Copyright (C) 2005-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. -- -- -- ------------------------------------------------------------------------------ -- This package provides a simple, default implementation of a function that -- returns a pointer to a secondary stack for use in single-threaded -- applications. It is not suitable for multi-threaded applications. -- -- The function defined in this package is used when the following two -- conditions are met: -- 1) No user-defined implementation has been provided. That is, the -- symbol __gnat_get_sec_stack is not exported by the user's code. -- 2) No tasking is used. When tasking is used, __gnat_get_secondary_stack -- is resolved by libgnarl.a (that contains a thread-safe implementation -- of the secondary stack), so that the single-threaded version is not -- included in the final executable. pragma Restrictions (No_Elaboration_Code); -- We want to guarantee the absence of elaboration code because the binder -- does not handle references to this package. package System.Secondary_Stack.Single_Task is function Get_Sec_Stack return SS_Stack_Ptr; pragma Export (C, Get_Sec_Stack, "__gnat_get_secondary_stack"); -- Return the pointer of the secondary stack to be used for single-threaded -- applications, as expected by System.Secondary_Stack. end System.Secondary_Stack.Single_Task;
package body SPARKNaCl.Sign.Utils with SPARK_Mode => On is procedure Construct (X : in Bytes_64; Y : out Signing_SK) is begin Y.F := X; end Construct; end SPARKNaCl.Sign.Utils;
with Ada.Integer_Text_IO; Use Ada.Integer_Text_IO; with Ada.Float_Text_IO; Use Ada.Float_Text_IO; with Ada.Text_IO; Use Ada.Text_IO; with inventory_list; Use inventory_list; with player; Use player; with save_load_game; Use save_load_game; Procedure save_test is bob : Player_Type; begin clearCharacter(bob); saveGame(bob, 1, 1); saveGame(bob, 1, 2); saveGame(bob, 1, 3); end save_test;
-- { dg-do run } procedure Nan_Max is function NaN return Long_Float is Zero : Long_Float := 0.0; begin return Zero / Zero; end; Z : Long_Float := 1.0; N : Long_Float := NaN; begin if Long_Float'Max (N, Z) /= Z then raise Program_Error; end if; if Long_Float'Max (Z, N) /= Z then raise Program_Error; end if; if Long_Float'Max (NaN, Z) /= Z then raise Program_Error; end if; if Long_Float'Max (Z, NaN) /= Z then raise Program_Error; end if; end;
------------------------------------------------------------------------------ -- -- -- GNAT RUN-TIME LIBRARY (GNARL) COMPONENTS -- -- -- -- S Y S T E M . T A S K I N G . P R O T E C T E D _ O B J E C T S -- -- -- -- B o d y -- -- -- -- Copyright (C) 1992-2021, Free Software Foundation, Inc. -- -- -- -- GNARL is free software; you can redistribute it and/or modify it under -- -- terms of the GNU General Public License as published by the Free Soft- -- -- ware Foundation; either version 3, or (at your option) any later ver- -- -- sion. GNARL is distributed in the hope that it will be useful, but WITH- -- -- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY -- -- or FITNESS FOR A PARTICULAR PURPOSE. -- -- -- -- -- -- -- -- -- -- -- -- You should have received a copy of the GNU General Public License and -- -- a copy of the GCC Runtime Library Exception along with this program; -- -- see the files COPYING3 and COPYING.RUNTIME respectively. If not, see -- -- <http://www.gnu.org/licenses/>. -- -- -- -- GNARL was developed by the GNARL team at Florida State University. -- -- Extensive contributions were provided by Ada Core Technologies, Inc. -- -- -- ------------------------------------------------------------------------------ -- This is the Ravenscar version of this package with System.Task_Primitives.Operations; -- Used for Set_Priority -- Get_Priority -- Self package body System.Tasking.Protected_Objects is use System.Task_Primitives.Operations; use System.Multiprocessors; Multiprocessor : constant Boolean := CPU'Range_Length /= 1; -- Set true if on multiprocessor (more than one CPU) --------------------------- -- Initialize_Protection -- --------------------------- procedure Initialize_Protection (Object : Protection_Access; Ceiling_Priority : Integer) is Init_Priority : Integer := Ceiling_Priority; begin if Init_Priority = Unspecified_Priority then Init_Priority := System.Priority'Last; end if; Object.Ceiling := System.Any_Priority (Init_Priority); Object.Caller_Priority := System.Any_Priority'First; Object.Owner := Null_Task; -- Only for multiprocessor if Multiprocessor then Multiprocessors.Fair_Locks.Initialize (Object.Lock); end if; end Initialize_Protection; ---------- -- Lock -- ---------- procedure Lock (Object : Protection_Access) is Self_Id : constant Task_Id := Self; Caller_Priority : constant Any_Priority := Get_Priority (Self_Id); begin -- For this run time, pragma Detect_Blocking is always active. As -- described in ARM 9.5.1, par. 15, an external call on a protected -- subprogram with the same target object as that of the protected -- action that is currently in progress (i.e., if the caller is -- already the protected object's owner) is a potentially blocking -- operation, and hence Program_Error must be raised. if Object.Owner = Self_Id then raise Program_Error; end if; -- Check ceiling locking violation. It is perfectly correct to stay at -- the same priority because a running task will never be preempted by -- another task at the same priority (no potentially blocking operation, -- no time slicing). if Caller_Priority > Object.Ceiling then raise Program_Error; end if; Set_Priority (Self_Id, Object.Ceiling); -- Locking for multiprocessor systems -- This lock ensure mutual exclusion of tasks from different processors, -- not for tasks on the same processors. But, because of the ceiling -- priority, this case never occurs. if Multiprocessor then -- Only for multiprocessor Multiprocessors.Fair_Locks.Lock (Object.Lock); end if; -- Update the protected object's owner Object.Owner := Self_Id; -- Store caller's active priority so that it can be later -- restored when finishing the protected action. Object.Caller_Priority := Caller_Priority; -- We are entering in a protected action, so that we increase the -- protected object nesting level. Self_Id.Common.Protected_Action_Nesting := Self_Id.Common.Protected_Action_Nesting + 1; end Lock; ------------ -- Unlock -- ------------ procedure Unlock (Object : Protection_Access) is Self_Id : constant Task_Id := Self; Caller_Priority : constant Any_Priority := Object.Caller_Priority; begin -- Calls to this procedure can only take place when being within a -- protected action and when the caller is the protected object's -- owner. pragma Assert (Self_Id.Common.Protected_Action_Nesting > 0 and then Object.Owner = Self_Id); -- Remove ownership of the protected object Object.Owner := Null_Task; -- We are exiting from a protected action, so that we decrease the -- protected object nesting level. Self_Id.Common.Protected_Action_Nesting := Self_Id.Common.Protected_Action_Nesting - 1; -- Locking for multiprocessor systems if Multiprocessor then -- Only for multiprocessor Multiprocessors.Fair_Locks.Unlock (Object.Lock); end if; Set_Priority (Self_Id, Caller_Priority); end Unlock; begin -- Ensure that tasking is initialized when using protected objects Tasking.Initialize; end System.Tasking.Protected_Objects;
with Ada.Integer_Text_IO; -- Copyright 2021 Melwyn Francis Carlo procedure A028 is use Ada.Integer_Text_IO; N : constant Integer := 1001; C : constant Integer := Integer (Float'Floor (Float (N) / 2.0)) + 1; Spiral_Array : array (Integer range 1 .. N, Integer range 1 .. N) of Integer; I : Integer := C; J : Integer := C; Sum : Integer := 0; Count_Val : Integer := 2; Move_Val : Integer := 1; Right_Val : Integer := 1; Down_Val : Integer := 1; Go_Right : Boolean := True; begin Spiral_Array (I, J) := 1; while I > 1 or J < (N - 1) loop if (Go_Right) then for K in 1 .. Move_Val loop J := J + Right_Val; if J > N then exit; end if; Spiral_Array (I, J) := Count_Val; Count_Val := Count_Val + 1; end loop; Right_Val := Right_Val * (-1); Go_Right := False; else for K in 1 .. Move_Val loop I := I + Down_Val; Spiral_Array (I, J) := Count_Val; Count_Val := Count_Val + 1; end loop; Move_Val := Move_Val + 1; Down_Val := Down_Val * (-1); Go_Right := True; end if; end loop; for I in 1 .. N loop Sum := Sum + Spiral_Array (I, I) + Spiral_Array (N - I + 1, I); end loop; Sum := Sum - Spiral_Array (C, C); Put (Sum, Width => 0); end A028;
with Ada.Float_Text_IO, Ada.Integer_Text_IO, Ada.Text_IO; with Integer_Exponentiation; procedure Test_Integer_Exponentiation is use Ada.Float_Text_IO, Ada.Integer_Text_IO, Ada.Text_IO; use Integer_Exponentiation; R : Float; I : Integer; begin Exponentiate (Argument => 2.5, Exponent => 3, Result => R); Put ("2.5 ^ 3 = "); Put (R, Fore => 2, Aft => 4, Exp => 0); New_Line; Exponentiate (Argument => -12, Exponent => 3, Result => I); Put ("-12 ^ 3 = "); Put (I, Width => 7); New_Line; end Test_Integer_Exponentiation;
with Ada.Real_Time; use Ada.Real_Time; package body Servo is ----------- -- Write -- ----------- procedure Write(High_Time : Integer; Pin_Id : Arduino.IOs.Pin_Id) is TimeNow : Time; begin TimeNow := Ada.Real_Time.Clock; Arduino.IOs.DigitalWrite (Pin_Id, True); delay until TimeNow + Ada.Real_Time.Microseconds(High_Time);--High_Time); TimeNow := Ada.Real_Time.Clock; Arduino.IOs.DigitalWrite (Pin_Id, False); delay until TimeNow + Ada.Real_Time.Microseconds(20000 - High_Time); end Write; end Servo;
package Animals is type Animal is abstract tagged private; function Legs (A : Animal) return Natural; function Wings (A : Animal) return Natural; procedure Add_Wings (A : in out Animal; N : Positive); procedure Add_Legs (A : in out Animal; N : Positive); private type Animal is abstract tagged record Number_Of_Legs : Natural; Number_Of_Wings : Natural; end record; end Animals;
------------------------------------------------------------------------------ -- -- -- Copyright (C) 2017-2018, AdaCore -- -- -- -- Redistribution and use in source and binary forms, with or without -- -- modification, are permitted provided that the following conditions are -- -- met: -- -- 1. Redistributions of source code must retain the above copyright -- -- notice, this list of conditions and the following disclaimer. -- -- 2. Redistributions in binary form must reproduce the above copyright -- -- notice, this list of conditions and the following disclaimer in -- -- the documentation and/or other materials provided with the -- -- distribution. -- -- 3. Neither the name of the copyright holder nor the names of its -- -- contributors may be used to endorse or promote products derived -- -- from this software without specific prior written permission. -- -- -- -- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -- -- "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -- -- LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -- -- A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -- -- HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -- -- SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -- -- LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -- -- DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -- -- THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -- -- (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -- -- OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -- -- -- ------------------------------------------------------------------------------ package body Wire_Simulation is ----------- -- Point -- ----------- function Point (This : in out Virtual_Wire; Id : Positive) return Any_GPIO_Point is begin This.Points (Id).Wire := This'Unchecked_Access; return This.Points (Id)'Unchecked_Access; end Point; -------------- -- Set_Mode -- -------------- overriding procedure Set_Mode (This : in out Wire_Point; Mode : GPIO_Config_Mode) is begin This.Current_Mode := Input; if Mode = Output and then This.Wire.At_Least_One_Output then raise Invalid_Configuration; end if; This.Current_Mode := Mode; This.Wire.Update_Wire_State; end Set_Mode; ----------------------- -- Set_Pull_Resistor -- ----------------------- overriding procedure Set_Pull_Resistor (This : in out Wire_Point; Pull : GPIO_Pull_Resistor) is begin This.Current_Pull := Floating; if Pull = Pull_Down and then (This.Wire.At_Least_One_Pull_Up or else This.Wire.Default_Pull = Pull_Up) then raise Invalid_Configuration; elsif Pull = Pull_Up and then (This.Wire.At_Least_One_Pull_Down or else This.Wire.Default_Pull = Pull_Down) then raise Invalid_Configuration; else This.Current_Pull := Pull; This.Wire.Update_Wire_State; end if; end Set_Pull_Resistor; --------- -- Set -- --------- overriding function Set (This : Wire_Point) return Boolean is begin case This.Wire.State is when Unknown => raise Unknown_State; when High => return True; when Low => return False; end case; end Set; --------- -- Set -- --------- overriding procedure Set (This : in out Wire_Point) is begin This.Current_State := True; This.Wire.Update_Wire_State; end Set; ----------- -- Clear -- ----------- overriding procedure Clear (This : in out Wire_Point) is begin This.Current_State := False; This.Wire.Update_Wire_State; end Clear; ------------ -- Toggle -- ------------ overriding procedure Toggle (This : in out Wire_Point) is begin This.Current_State := not This.Current_State; This.Wire.Update_Wire_State; end Toggle; ----------------------- -- Update_Wire_State -- ----------------------- procedure Update_Wire_State (This : in out Virtual_Wire) is Has_Pull_Up : constant Boolean := This.At_Least_One_Pull_Up or This.Default_Pull = Pull_Up; Has_Pull_Down : constant Boolean := This.At_Least_One_Pull_Down or This.Default_Pull = Pull_Down; State : Wire_State := Unknown; begin pragma Assert ((Has_Pull_Down /= Has_Pull_Up) or else not Has_Pull_Up, "Invalid config. This should've been caught before"); if Has_Pull_Down then State := Low; elsif Has_Pull_Up then State := High; end if; for Pt of This.Points loop if Pt.Current_Mode = Output then if Pt.Current_State then State := High; else State := Low; end if; exit; end if; end loop; This.State := State; end Update_Wire_State; ------------------------- -- At_Least_One_Output -- ------------------------- function At_Least_One_Output (This : Virtual_Wire) return Boolean is (for some Pt of This.Points => Pt.Current_Mode = Output); -------------------------- -- At_Least_One_Pull_Up -- -------------------------- function At_Least_One_Pull_Up (This : Virtual_Wire) return Boolean is (for some Pt of This.Points => Pt.Current_Pull = Pull_Up); ---------------------------- -- At_Least_One_Pull_Down -- ---------------------------- function At_Least_One_Pull_Down (This : Virtual_Wire) return Boolean is (for some Pt of This.Points => Pt.Current_Pull = Pull_Down); end Wire_Simulation;
------------------------------------------------------------------------------ -- -- -- Matreshka Project -- -- -- -- Web Framework -- -- -- -- Runtime Library Component -- -- -- ------------------------------------------------------------------------------ -- -- -- Copyright © 2014-2016, Vadim Godunko <vgodunko@gmail.com> -- -- All rights reserved. -- -- -- -- Redistribution and use in source and binary forms, with or without -- -- modification, are permitted provided that the following conditions -- -- are met: -- -- -- -- * Redistributions of source code must retain the above copyright -- -- notice, this list of conditions and the following disclaimer. -- -- -- -- * Redistributions in binary form must reproduce the above copyright -- -- notice, this list of conditions and the following disclaimer in the -- -- documentation and/or other materials provided with the distribution. -- -- -- -- * Neither the name of the Vadim Godunko, IE nor the names of its -- -- contributors may be used to endorse or promote products derived from -- -- this software without specific prior written permission. -- -- -- -- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -- -- "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -- -- LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -- -- A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -- -- HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -- -- SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED -- -- TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -- -- PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -- -- LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -- -- NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -- -- SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -- -- -- ------------------------------------------------------------------------------ -- $Revision$ $Date$ ------------------------------------------------------------------------------ -- Defines a set of methods that a servlet uses to communicate with its -- servlet container, for example, to get the MIME type of a file, dispatch -- requests, or write to a log file. ------------------------------------------------------------------------------ with League.Strings; with Servlet.Event_Listeners; with Servlet.Servlet_Registrations; limited with Servlet.Servlets; package Servlet.Contexts is pragma Preelaborate; type Servlet_Context is limited interface; type Servlet_Context_Access is access all Servlet_Context'Class; not overriding function Add_Servlet (Self : not null access Servlet_Context; Name : League.Strings.Universal_String; Instance : not null access Servlet.Servlets.Servlet'Class) return access Servlet.Servlet_Registrations.Servlet_Registration'Class is abstract; -- Registers the given servlet instance with this ServletContext under the -- given servletName. -- -- The registered servlet may be further configured via the returned -- ServletRegistration object. -- -- If this ServletContext already contains a preliminary -- ServletRegistration for a servlet with the given servletName, it will be -- completed (by assigning the class name of the given servlet instance to -- it) and returned. procedure Add_Servlet (Self : not null access Servlet_Context'Class; Name : League.Strings.Universal_String; Instance : not null access Servlet.Servlets.Servlet'Class); not overriding procedure Add_Listener (Self : not null access Servlet_Context; Listener : not null Servlet.Event_Listeners.Event_Listener_Access) is abstract; -- Adds a listener of the given class type to this ServletContext. -- -- The given listenerClass must implement one or more of the following -- interfaces: -- -- ServletContextAttributeListener -- ServletRequestListener -- ServletRequestAttributeListener -- HttpSessionAttributeListener -- HttpSessionIdListener -- HttpSessionListener -- -- If this ServletContext was passed to -- Servlet_Container_Initializer.On_Startup, then the given listener may -- also be an instance of ServletContextListener, in addition to the -- interfaces listed above. -- -- If the given listenerClass implements a listener interface whose -- invocation order corresponds to the declaration order (i.e., if it -- implements ServletRequestListener, ServletContextListener, or -- HttpSessionListener), then the new listener will be added to the end of -- the ordered list of listeners of that interface. not overriding function Get_MIME_Type (Self : Servlet_Context; Path : League.Strings.Universal_String) return League.Strings.Universal_String is abstract; -- Returns the MIME type of the specified file, or null if the MIME type is -- not known. The MIME type is determined by the configuration of the -- servlet container, and may be specified in a web application deployment -- descriptor. Common MIME types include text/html and image/gif. not overriding function Get_Real_Path (Self : Servlet_Context; Path : League.Strings.Universal_String) return League.Strings.Universal_String is abstract; -- Gets the real path corresponding to the given virtual path. -- -- For example, if path is equal to /index.html, this method will return -- the absolute file path on the server's filesystem to which a request of -- the form http://<host>:<port>/<contextPath>/index.html would be mapped, -- where <contextPath> corresponds to the context path of this -- ServletContext. -- -- The real path returned will be in a form appropriate to the computer and -- operating system on which the servlet container is running, including -- the proper path separators. -- -- Resources inside the /META-INF/resources directories of JAR files -- bundled in the application's /WEB-INF/lib directory must be considered -- only if the container has unpacked them from their containing JAR file, -- in which case the path to the unpacked location must be returned. -- -- This method returns null if the servlet container is unable to translate -- the given virtual path to a real path. not overriding function Get_Servlet_Registration (Self : not null access Servlet_Context; Servlet_Name : League.Strings.Universal_String) return access Servlet.Servlet_Registrations.Servlet_Registration'Class is abstract; -- Gets the Servlet_Registration corresponding to the servlet with the -- given Servlet_Name. end Servlet.Contexts;
-- { dg-do compile } with Text_IO; use Text_IO; procedure Discr43 is type Arr is array (Short_Integer range <>) of Boolean; type Rec (LB : Short_Integer; UB : Short_Integer) is record A : Arr (LB .. UB); end record; begin Put_Line ("Arr'Max_Size =" & Arr'Max_Size_In_Storage_Elements'Img); Put_Line ("Rec'Max_Size =" & Rec'Max_Size_In_Storage_Elements'Img); end;