content
stringlengths
23
1.05M
with Ada.Wide_Text_IO; use Ada.Wide_Text_IO; with Ada.Characters; with Ada.Characters.Handling; use Ada.Characters.Handling; with Ada.Exceptions; with Asis; with Asis.Implementation; with Asis.Exceptions; with Asis.Errors; with Asis.Iterator; with Asis.Expressions; with Asis.Declarations; with Asis.Text; with FP_Detect; use FP_Detect; package body FP_Translation is -- Put the program text defined by the given span within -- the compilation unit body that contains the given Element. procedure Put_Current_Span (Element : Asis.Element; State : Traversal_State) is Span : constant Asis.Text.Span := State.Span; begin if not Asis.Text.Is_Nil(Span) then declare LS : Asis.Text.Line_List := Asis.Text.Lines(Element, Span); L1 : Wide_String := Asis.Text.Line_Image(LS(LS'First)); begin Put(State.Output_File, L1(Span.First_Column .. L1'Last)); if Span.First_Line < Span.Last_Line then New_Line(State.Output_File); for I in LS'First+1 .. LS'Last-1 loop Put(State.Output_File, Asis.Text.Line_Image(LS(I))); New_Line(State.Output_File); end loop; Put(State.Output_File, Asis.Text.Line_Image(LS(LS'Last))); end if; end; end if; end Put_Current_Span; function Spans_Multiple_Lines (Expr : Asis.Element) return Boolean is Expr_Span : Asis.Text.Span := Asis.Text.Element_Span(Expr); begin return Expr_Span.First_Line < Expr_Span.Last_Line; end Spans_Multiple_Lines; procedure Put_Prefix (FP_Operator : Maybe_FP_Operator; State : Traversal_State; Is_Multi_Line : Boolean; First_Column : Positive) is Type_Info : FP_Type := FP_Operator.Type_Info; begin -- add type conversion if the type is non-standard: if not Type_Info.Is_Standard then Put(State.Output_File, Asis.Declarations.Defining_Name_Image(Type_Info.Name)); end if; Put(State.Output_File, "(PP_"); Put(State.Output_File, FP_Type_Code'Wide_Image(FP_Operator.Type_Info.Code)); Put(State.Output_File, "_Rounded."); case FP_Operator.Kind is when Field_Op => case FP_Operator.Op_Kind is when Asis.A_Plus_Operator => Put(State.Output_File, "Plus"); when Asis.A_Minus_Operator => Put(State.Output_File, "Minus"); when Asis.A_Multiply_Operator => Put(State.Output_File, "Multiply"); when Asis.A_Divide_Operator => Put(State.Output_File, "Divide"); when Asis.An_Exponentiate_Operator => Put(State.Output_File, "Exponentiate"); when others => Put(State.Output_File, "UNKNOWN_FP_OP"); end case; when Elementary_Fn => Put(State.Output_File, Asis.Expressions.Name_Image(FP_Operator.Fn_Name)); when Not_An_FP_Operator => Put(State.Output_File, "UNKNOWN_FP_OP"); end case; Put(State.Output_File, "("); Put(State.Output_File, To_Wide_String(Integer'Image(FP_Operator.Type_Info.Precision))); end Put_Prefix; procedure Recursive_Construct_Processing is new Asis.Iterator.Traverse_Element (State_Information => Traversal_State, Pre_Operation => Pre_Op, Post_Operation => Post_Op); procedure Put_Params (Params_Association : Asis.Association_List; Is_Standard_Type : Boolean; State : in out Traversal_State; Is_Multi_Line : Boolean; First_Column : Positive) is Param : Asis.Element; begin for I in Params_Association'Range loop Param := Asis.Expressions.Actual_Parameter(Params_Association(I)); declare Process_Control : Asis.Traverse_Control := Asis.Continue; begin -- print parameter separator, possibly a multi-line one: if Is_Multi_Line then New_Line(State.Output_File); for I in 2..First_Column loop Put(State.Output_File, " "); end loop; end if; Put(State.Output_File, ", "); -- optionally put type conversion if the type is non-standard: if not Is_Standard_Type then Put(State.Output_File, " Long_Float"); end if; Put(State.Output_File, "("); -- traverse the actual parameter expression, -- translating FP operators within it: State.Span := Asis.Text.Element_Span(Param); Recursive_Construct_Processing (Element => Param, Control => Process_Control, State => State); -- print the remainder of the parameter expression: Put_Current_Span(Param, State); Put(State.Output_File, ")"); end; end loop; end Put_Params; procedure Split_Span (orig, sub : in Asis.Text.Span; left, right : out Asis.Text.Span) is begin left := (First_Line => orig.First_Line, First_Column => orig.First_Column, Last_Line => sub.First_Line, Last_Column => sub.First_Column - 1); right := (First_Line => sub.Last_Line, First_Column => sub.Last_Column + 1, Last_Line => orig.Last_Line, Last_Column => orig.Last_Column); end Split_Span; procedure Put_Span_Description(Span : Asis.Text.Span) is begin Put("("); Put(To_Wide_String(Integer'Image(Span.First_Line))); Put(":"); Put(To_Wide_String(Integer'Image(Span.First_Column))); Put(")..("); Put(To_Wide_String(Integer'Image(Span.Last_Line))); Put(":"); Put(To_Wide_String(Integer'Image(Span.Last_Column))); Put(")"); end Put_Span_Description; procedure Pre_Op (Element : Asis.Element; Control : in out Asis.Traverse_Control; State : in out Traversal_State) is This_FP_Operator : Maybe_FP_Operator := Is_FP_Operator_Expression(Element); Is_Multi_Line : Boolean := Spans_Multiple_Lines(Element); begin if This_FP_Operator.Kind /= Not_An_FP_Operator then -- do not traverse the sub-expressions: Control := Asis.Abandon_Children; if State.Trace then Put("Processing FP expression at "); Put_Span_Description(Asis.Text.Element_Span(Element)); New_Line; Put("--------"); New_Line; Put(Asis.Text.Element_Image(Element)); New_Line; Put("--------"); New_Line; end if; declare e_span : Asis.Text.Span := Asis.Text.Element_Span(Element); left, right : Asis.Text.Span; begin Split_Span(State.Span, e_span, left, right); -- put everything up to this expression: State.Span := left; Put_Current_Span(Element, State); Put_Prefix(This_FP_Operator, State, Is_Multi_Line, e_span.First_Column); Put_Params(Asis.Expressions.Function_Call_Parameters(Element), This_FP_Operator.Type_Info.Is_Standard, State, Is_Multi_Line, e_span.First_Column); Put(State.Output_File, "))"); -- only the "right" span now remains to be processed and put: State.Span := right; end; end if; exception when Ex : Asis.Exceptions.ASIS_Inappropriate_Context | Asis.Exceptions.ASIS_Inappropriate_Container | Asis.Exceptions.ASIS_Inappropriate_Compilation_Unit | Asis.Exceptions.ASIS_Inappropriate_Element | Asis.Exceptions.ASIS_Inappropriate_Line | Asis.Exceptions.ASIS_Inappropriate_Line_Number | Asis.Exceptions.ASIS_Failed => Ada.Wide_Text_IO.Put ("Pre_Op : ASIS exception ("); Ada.Wide_Text_IO.Put (Ada.Characters.Handling.To_Wide_String ( Ada.Exceptions.Exception_Name (Ex))); Ada.Wide_Text_IO.Put (") is raised"); Ada.Wide_Text_IO.New_Line; Ada.Wide_Text_IO.Put ("ASIS Error Status is "); Ada.Wide_Text_IO.Put (Asis.Errors.Error_Kinds'Wide_Image (Asis.Implementation.Status)); Ada.Wide_Text_IO.New_Line; Ada.Wide_Text_IO.Put ("ASIS Diagnosis is "); Ada.Wide_Text_IO.New_Line; Ada.Wide_Text_IO.Put (Asis.Implementation.Diagnosis); Ada.Wide_Text_IO.New_Line; Asis.Implementation.Set_Status; when Ex : others => Ada.Wide_Text_IO.Put ("Pre_Op : "); Ada.Wide_Text_IO.Put (Ada.Characters.Handling.To_Wide_String ( Ada.Exceptions.Exception_Name (Ex))); Ada.Wide_Text_IO.Put (" is raised ("); Ada.Wide_Text_IO.Put (Ada.Characters.Handling.To_Wide_String ( Ada.Exceptions.Exception_Information (Ex))); Ada.Wide_Text_IO.Put (")"); Ada.Wide_Text_IO.New_Line; end Pre_Op; procedure Post_Op (Element : Asis.Element; Control : in out Asis.Traverse_Control; State : in out Traversal_State) is begin null; end Post_Op; end FP_Translation;
-- This spec has been automatically generated from STM32F103.svd pragma Restrictions (No_Elaboration_Code); pragma Ada_2012; pragma Style_Checks (Off); with System; package STM32_SVD.SPI is pragma Preelaborate; --------------- -- Registers -- --------------- subtype CR1_CPHA_Field is STM32_SVD.Bit; subtype CR1_CPOL_Field is STM32_SVD.Bit; subtype CR1_MSTR_Field is STM32_SVD.Bit; subtype CR1_BR_Field is STM32_SVD.UInt3; subtype CR1_SPE_Field is STM32_SVD.Bit; subtype CR1_LSBFIRST_Field is STM32_SVD.Bit; subtype CR1_SSI_Field is STM32_SVD.Bit; subtype CR1_SSM_Field is STM32_SVD.Bit; subtype CR1_RXONLY_Field is STM32_SVD.Bit; subtype CR1_DFF_Field is STM32_SVD.Bit; subtype CR1_CRCNEXT_Field is STM32_SVD.Bit; subtype CR1_CRCEN_Field is STM32_SVD.Bit; subtype CR1_BIDIOE_Field is STM32_SVD.Bit; subtype CR1_BIDIMODE_Field is STM32_SVD.Bit; -- control register 1 type CR1_Register is record -- Clock phase CPHA : CR1_CPHA_Field := 16#0#; -- Clock polarity CPOL : CR1_CPOL_Field := 16#0#; -- Master selection MSTR : CR1_MSTR_Field := 16#0#; -- Baud rate control BR : CR1_BR_Field := 16#0#; -- SPI enable SPE : CR1_SPE_Field := 16#0#; -- Frame format LSBFIRST : CR1_LSBFIRST_Field := 16#0#; -- Internal slave select SSI : CR1_SSI_Field := 16#0#; -- Software slave management SSM : CR1_SSM_Field := 16#0#; -- Receive only RXONLY : CR1_RXONLY_Field := 16#0#; -- Data frame format DFF : CR1_DFF_Field := 16#0#; -- CRC transfer next CRCNEXT : CR1_CRCNEXT_Field := 16#0#; -- Hardware CRC calculation enable CRCEN : CR1_CRCEN_Field := 16#0#; -- Output enable in bidirectional mode BIDIOE : CR1_BIDIOE_Field := 16#0#; -- Bidirectional data mode enable BIDIMODE : CR1_BIDIMODE_Field := 16#0#; -- unspecified Reserved_16_31 : STM32_SVD.UInt16 := 16#0#; end record with Volatile_Full_Access, Size => 32, Bit_Order => System.Low_Order_First; for CR1_Register use record CPHA at 0 range 0 .. 0; CPOL at 0 range 1 .. 1; MSTR at 0 range 2 .. 2; BR at 0 range 3 .. 5; SPE at 0 range 6 .. 6; LSBFIRST at 0 range 7 .. 7; SSI at 0 range 8 .. 8; SSM at 0 range 9 .. 9; RXONLY at 0 range 10 .. 10; DFF at 0 range 11 .. 11; CRCNEXT at 0 range 12 .. 12; CRCEN at 0 range 13 .. 13; BIDIOE at 0 range 14 .. 14; BIDIMODE at 0 range 15 .. 15; Reserved_16_31 at 0 range 16 .. 31; end record; subtype CR2_RXDMAEN_Field is STM32_SVD.Bit; subtype CR2_TXDMAEN_Field is STM32_SVD.Bit; subtype CR2_SSOE_Field is STM32_SVD.Bit; subtype CR2_ERRIE_Field is STM32_SVD.Bit; subtype CR2_RXNEIE_Field is STM32_SVD.Bit; subtype CR2_TXEIE_Field is STM32_SVD.Bit; -- control register 2 type CR2_Register is record -- Rx buffer DMA enable RXDMAEN : CR2_RXDMAEN_Field := 16#0#; -- Tx buffer DMA enable TXDMAEN : CR2_TXDMAEN_Field := 16#0#; -- SS output enable SSOE : CR2_SSOE_Field := 16#0#; -- unspecified Reserved_3_4 : STM32_SVD.UInt2 := 16#0#; -- Error interrupt enable ERRIE : CR2_ERRIE_Field := 16#0#; -- RX buffer not empty interrupt enable RXNEIE : CR2_RXNEIE_Field := 16#0#; -- Tx buffer empty interrupt enable TXEIE : CR2_TXEIE_Field := 16#0#; -- unspecified Reserved_8_31 : STM32_SVD.UInt24 := 16#0#; end record with Volatile_Full_Access, Size => 32, Bit_Order => System.Low_Order_First; for CR2_Register use record RXDMAEN at 0 range 0 .. 0; TXDMAEN at 0 range 1 .. 1; SSOE at 0 range 2 .. 2; Reserved_3_4 at 0 range 3 .. 4; ERRIE at 0 range 5 .. 5; RXNEIE at 0 range 6 .. 6; TXEIE at 0 range 7 .. 7; Reserved_8_31 at 0 range 8 .. 31; end record; subtype SR_RXNE_Field is STM32_SVD.Bit; subtype SR_TXE_Field is STM32_SVD.Bit; subtype SR_CHSIDE_Field is STM32_SVD.Bit; subtype SR_UDR_Field is STM32_SVD.Bit; subtype SR_CRCERR_Field is STM32_SVD.Bit; subtype SR_MODF_Field is STM32_SVD.Bit; subtype SR_OVR_Field is STM32_SVD.Bit; subtype SR_BSY_Field is STM32_SVD.Bit; -- status register type SR_Register is record -- Read-only. Receive buffer not empty RXNE : SR_RXNE_Field := 16#0#; -- Read-only. Transmit buffer empty TXE : SR_TXE_Field := 16#1#; -- Read-only. Channel side CHSIDE : SR_CHSIDE_Field := 16#0#; -- Read-only. Underrun flag UDR : SR_UDR_Field := 16#0#; -- CRC error flag CRCERR : SR_CRCERR_Field := 16#0#; -- Read-only. Mode fault MODF : SR_MODF_Field := 16#0#; -- Read-only. Overrun flag OVR : SR_OVR_Field := 16#0#; -- Read-only. Busy flag BSY : SR_BSY_Field := 16#0#; -- unspecified Reserved_8_31 : STM32_SVD.UInt24 := 16#0#; end record with Volatile_Full_Access, Size => 32, Bit_Order => System.Low_Order_First; for SR_Register use record RXNE at 0 range 0 .. 0; TXE at 0 range 1 .. 1; CHSIDE at 0 range 2 .. 2; UDR at 0 range 3 .. 3; CRCERR at 0 range 4 .. 4; MODF at 0 range 5 .. 5; OVR at 0 range 6 .. 6; BSY at 0 range 7 .. 7; Reserved_8_31 at 0 range 8 .. 31; end record; subtype DR_DR_Field is STM32_SVD.UInt16; -- data register type DR_Register is record -- Data register DR : DR_DR_Field := 16#0#; -- unspecified Reserved_16_31 : STM32_SVD.UInt16 := 16#0#; end record with Volatile_Full_Access, Size => 32, Bit_Order => System.Low_Order_First; for DR_Register use record DR at 0 range 0 .. 15; Reserved_16_31 at 0 range 16 .. 31; end record; subtype CRCPR_CRCPOLY_Field is STM32_SVD.UInt16; -- CRC polynomial register type CRCPR_Register is record -- CRC polynomial register CRCPOLY : CRCPR_CRCPOLY_Field := 16#7#; -- unspecified Reserved_16_31 : STM32_SVD.UInt16 := 16#0#; end record with Volatile_Full_Access, Size => 32, Bit_Order => System.Low_Order_First; for CRCPR_Register use record CRCPOLY at 0 range 0 .. 15; Reserved_16_31 at 0 range 16 .. 31; end record; subtype RXCRCR_RxCRC_Field is STM32_SVD.UInt16; -- RX CRC register type RXCRCR_Register is record -- Read-only. Rx CRC register RxCRC : RXCRCR_RxCRC_Field; -- unspecified Reserved_16_31 : STM32_SVD.UInt16; end record with Volatile_Full_Access, Size => 32, Bit_Order => System.Low_Order_First; for RXCRCR_Register use record RxCRC at 0 range 0 .. 15; Reserved_16_31 at 0 range 16 .. 31; end record; subtype TXCRCR_TxCRC_Field is STM32_SVD.UInt16; -- TX CRC register type TXCRCR_Register is record -- Read-only. Tx CRC register TxCRC : TXCRCR_TxCRC_Field; -- unspecified Reserved_16_31 : STM32_SVD.UInt16; end record with Volatile_Full_Access, Size => 32, Bit_Order => System.Low_Order_First; for TXCRCR_Register use record TxCRC at 0 range 0 .. 15; Reserved_16_31 at 0 range 16 .. 31; end record; subtype I2SCFGR_CHLEN_Field is STM32_SVD.Bit; subtype I2SCFGR_DATLEN_Field is STM32_SVD.UInt2; subtype I2SCFGR_CKPOL_Field is STM32_SVD.Bit; subtype I2SCFGR_I2SSTD_Field is STM32_SVD.UInt2; subtype I2SCFGR_PCMSYNC_Field is STM32_SVD.Bit; subtype I2SCFGR_I2SCFG_Field is STM32_SVD.UInt2; subtype I2SCFGR_I2SE_Field is STM32_SVD.Bit; subtype I2SCFGR_I2SMOD_Field is STM32_SVD.Bit; -- I2S configuration register type I2SCFGR_Register is record -- Channel length (number of bits per audio channel) CHLEN : I2SCFGR_CHLEN_Field := 16#0#; -- Data length to be transferred DATLEN : I2SCFGR_DATLEN_Field := 16#0#; -- Steady state clock polarity CKPOL : I2SCFGR_CKPOL_Field := 16#0#; -- I2S standard selection I2SSTD : I2SCFGR_I2SSTD_Field := 16#0#; -- unspecified Reserved_6_6 : STM32_SVD.Bit := 16#0#; -- PCM frame synchronization PCMSYNC : I2SCFGR_PCMSYNC_Field := 16#0#; -- I2S configuration mode I2SCFG : I2SCFGR_I2SCFG_Field := 16#0#; -- I2S Enable I2SE : I2SCFGR_I2SE_Field := 16#0#; -- I2S mode selection I2SMOD : I2SCFGR_I2SMOD_Field := 16#0#; -- unspecified Reserved_12_31 : STM32_SVD.UInt20 := 16#0#; end record with Volatile_Full_Access, Size => 32, Bit_Order => System.Low_Order_First; for I2SCFGR_Register use record CHLEN at 0 range 0 .. 0; DATLEN at 0 range 1 .. 2; CKPOL at 0 range 3 .. 3; I2SSTD at 0 range 4 .. 5; Reserved_6_6 at 0 range 6 .. 6; PCMSYNC at 0 range 7 .. 7; I2SCFG at 0 range 8 .. 9; I2SE at 0 range 10 .. 10; I2SMOD at 0 range 11 .. 11; Reserved_12_31 at 0 range 12 .. 31; end record; subtype I2SPR_I2SDIV_Field is STM32_SVD.Byte; subtype I2SPR_ODD_Field is STM32_SVD.Bit; subtype I2SPR_MCKOE_Field is STM32_SVD.Bit; -- I2S prescaler register type I2SPR_Register is record -- I2S Linear prescaler I2SDIV : I2SPR_I2SDIV_Field := 16#A#; -- Odd factor for the prescaler ODD : I2SPR_ODD_Field := 16#0#; -- Master clock output enable MCKOE : I2SPR_MCKOE_Field := 16#0#; -- unspecified Reserved_10_31 : STM32_SVD.UInt22 := 16#0#; end record with Volatile_Full_Access, Size => 32, Bit_Order => System.Low_Order_First; for I2SPR_Register use record I2SDIV at 0 range 0 .. 7; ODD at 0 range 8 .. 8; MCKOE at 0 range 9 .. 9; Reserved_10_31 at 0 range 10 .. 31; end record; ----------------- -- Peripherals -- ----------------- -- Serial peripheral interface type SPI_Peripheral is record -- control register 1 CR1 : aliased CR1_Register; -- control register 2 CR2 : aliased CR2_Register; -- status register SR : aliased SR_Register; -- data register DR : aliased DR_Register; -- CRC polynomial register CRCPR : aliased CRCPR_Register; -- RX CRC register RXCRCR : aliased RXCRCR_Register; -- TX CRC register TXCRCR : aliased TXCRCR_Register; -- I2S configuration register I2SCFGR : aliased I2SCFGR_Register; -- I2S prescaler register I2SPR : aliased I2SPR_Register; end record with Volatile; for SPI_Peripheral use record CR1 at 16#0# range 0 .. 31; CR2 at 16#4# range 0 .. 31; SR at 16#8# range 0 .. 31; DR at 16#C# range 0 .. 31; CRCPR at 16#10# range 0 .. 31; RXCRCR at 16#14# range 0 .. 31; TXCRCR at 16#18# range 0 .. 31; I2SCFGR at 16#1C# range 0 .. 31; I2SPR at 16#20# range 0 .. 31; end record; -- Serial peripheral interface SPI1_Periph : aliased SPI_Peripheral with Import, Address => System'To_Address (16#40013000#); -- Serial peripheral interface SPI2_Periph : aliased SPI_Peripheral with Import, Address => System'To_Address (16#40003800#); -- Serial peripheral interface SPI3_Periph : aliased SPI_Peripheral with Import, Address => System'To_Address (16#40003C00#); end STM32_SVD.SPI;
with HW.GFX; with HW.GFX.GMA; with HW.GFX.GMA.Display_Probing; use HW.GFX; use HW.GFX.GMA; use HW.GFX.GMA.Display_Probing; with GMA.Mainboard; package body GMA is function fill_lb_framebuffer (framebuffer : in out lb_framebuffer) return Interfaces.C.int is use type Interfaces.C.int; begin return -1; end fill_lb_framebuffer; ---------------------------------------------------------------------------- procedure gfxinit (lightup_ok : out Interfaces.C.int) is ports : Port_List; configs : Pipe_Configs; success : boolean; -- from pc80/vga driver procedure vga_io_init; pragma Import (C, vga_io_init, "vga_io_init"); procedure vga_textmode_init; pragma Import (C, vga_textmode_init, "vga_textmode_init"); begin lightup_ok := 0; HW.GFX.GMA.Initialize (Success => success); if success then ports := Mainboard.ports; HW.GFX.GMA.Display_Probing.Scan_Ports (Configs => configs, Ports => ports, Max_Pipe => Primary); if configs (Primary).Port /= Disabled then HW.GFX.GMA.Power_Up_VGA; vga_io_init; vga_textmode_init; -- override probed framebuffer config configs (Primary).Framebuffer.Width := 640; configs (Primary).Framebuffer.Height := 400; configs (Primary).Framebuffer.Offset := VGA_PLANE_FRAMEBUFFER_OFFSET; HW.GFX.GMA.Dump_Configs (configs); HW.GFX.GMA.Update_Outputs (configs); lightup_ok := 1; end if; end if; end gfxinit; end GMA;
package body Conversion with SPARK_Mode is ------------------------- -- Equal_To_Conversion -- ------------------------- -- This lemma is proved with a manual induction. procedure Equal_To_Conversion (A, B : Integer_Curve25519; L : Product_Index_Type) is begin if L = 0 then return; -- Initialization of lemma end if; Equal_To_Conversion (A, B, L - 1); -- Calling lemma for L - 1 end Equal_To_Conversion; end Conversion;
---------------------------------------------------------- -- Copyright (c), The MIT License (MIT) -- Author: Lyaaaaaaaaaaaaaaa -- -- Revision History: -- 18/09/2019 Lyaaaaaaaaaaaaaaa -- - Added file header ---------------------------------------------------------- with Log_Filter_Handlers; procedure Log_Filter_Main is begin Log_Filter_Handlers.Init; -- Start Gtkada and create objects. Log_Filter_Handlers.Connect_Interface; -- Load interface and links objects. Log_Filter_Handlers.Register_Handlers; -- Links signals and handlers. Log_Filter_Handlers.Start_Interface; -- Display the main window. null; end Log_Filter_Main;
----------------------------------------------------------------------- -- awa-users-servlets -- OpenID verification servlet for user authentication -- Copyright (C) 2011 - 2020 Stephane Carrez -- Written by Stephane Carrez (Stephane.Carrez@gmail.com) -- -- Licensed under the Apache License, Version 2.0 (the "License"); -- you may not use this file except in compliance with the License. -- You may obtain a copy of the License at -- -- http://www.apache.org/licenses/LICENSE-2.0 -- -- Unless required by applicable law or agreed to in writing, software -- distributed under the License is distributed on an "AS IS" BASIS, -- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -- See the License for the specific language governing permissions and -- limitations under the License. ----------------------------------------------------------------------- with ASF.Principals; with ASF.Security.Servlets; with ASF.Requests; with ASF.Responses; with ASF.Sessions; with Security.Auth; -- == OAuth Authentication Flow == -- The OAuth/OpenID authentication flow is implemented by using two servlets -- that participate in the authentication. A first servlet will start -- the OAuth/OpenID authentication by building the request that the user -- must use to authenticate through the OAuth/OpenID authorization server. -- This servlet is implemented by the `AWA.Users.Servlets.Request_Auth_Servlet` -- type. The servlet will respond to an HTTP `GET` request and it will -- redirect the user to the authorization server. -- -- ![OAuth Authentication Flow](images/OAuthAuthenticateFlow.png) -- -- The user will be authenticated by the OAuth/OpenID authorization server -- and when s/he grants the application to access his or her account, -- a redirection is made to the second servlet. The second servlet -- is implemented by `AWA.Users.Servlets.Verify_Auth_Servlet`. It is used -- to validate the authentication result by checking its validity with -- the OAuth/OpenID authorization endpoint. During this step, we can -- retrieve some minimal information that uniquely identifies the user -- such as a unique identifier that is specific to the OAuth/OpenID -- authorization server. It is also possible to retrieve the -- user's name and email address. -- -- These two servlets are provided by the `User_Module` and they are -- registered under the `openid-auth` name for the first step and -- under the `openid-verify` name for the second step. package AWA.Users.Servlets is -- ------------------------------ -- OpenID Request Servlet -- ------------------------------ -- The `Request_Auth_Servlet` servlet implements the first steps of an OpenID -- authentication. type Request_Auth_Servlet is new ASF.Security.Servlets.Request_Auth_Servlet with null record; -- Proceed to the OpenID authentication with an OpenID provider. -- Find the OpenID provider URL and starts the discovery, association phases -- during which a private key is obtained from the OpenID provider. -- After OpenID discovery and association, the user will be redirected to -- the OpenID provider. overriding procedure Do_Get (Server : in Request_Auth_Servlet; Request : in out ASF.Requests.Request'Class; Response : in out ASF.Responses.Response'Class); -- ------------------------------ -- OpenID Verification Servlet -- ------------------------------ -- The `Verify_Auth_Servlet` verifies the authentication result and -- extract authentication from the callback URL. We override the default -- implementation to provide our own user principal once the authentication -- succeeded. At the same time, if this is the first time we see the user, -- s/he will be registered by using the user service. type Verify_Auth_Servlet is new ASF.Security.Servlets.Verify_Auth_Servlet with private; -- Create a principal object that correspond to the authenticated user -- identified by the `Auth` information. The principal will be attached -- to the session and will be destroyed when the session is closed. overriding procedure Create_Principal (Server : in Verify_Auth_Servlet; Auth : in Security.Auth.Authentication; Result : out ASF.Principals.Principal_Access); -- Verify the authentication result that was returned by the OpenID provider. -- If the authentication succeeded and the signature was correct, sets a -- user principals on the session. overriding procedure Do_Get (Server : in Verify_Auth_Servlet; Request : in out ASF.Requests.Request'Class; Response : in out ASF.Responses.Response'Class); -- Get the redirection URL that must be used after the authentication succeeded. function Get_Redirect_URL (Server : in Verify_Auth_Servlet; Session : in ASF.Sessions.Session'Class; Request : in ASF.Requests.Request'Class) return String; private type Verify_Auth_Servlet is new ASF.Security.Servlets.Verify_Auth_Servlet with null record; end AWA.Users.Servlets;
-- -- Jan & Uwe R. Zimmer, Australia, 2013 -- package body Swarm_Structures is -- protected body Vehicle_Comms is procedure Send (Message : Inter_Vehicle_Messages) is begin Put (Sent_Messages, Message); end Send; -- procedure Push_Message (Message : Inter_Vehicle_Messages) is begin Put (Received_Messages, Message); end Push_Message; -- procedure Fetch_Message (Message : out Inter_Vehicle_Messages) is begin Get (Sent_Messages, Message); end Fetch_Message; -- function Has_Incoming_Messages return Boolean is (Element_Available (Received_Messages)); function Has_Outgoing_Messages return Boolean is (Element_Available (Sent_Messages)); -- entry Receive (Message : out Inter_Vehicle_Messages) when Element_Available (Received_Messages) is begin Get (Received_Messages, Message); end Receive; end Vehicle_Comms; -- -- -- protected body Vehicle_Controls is procedure Set_Steering (V : Vector_3D) is begin Steering_Direction := V; end Set_Steering; -- procedure Set_Throttle (T : Throttle_T) is begin Throttle := T; end Set_Throttle; -- function Read_Steering return Vector_3D is (Steering_Direction); function Read_Throttle return Throttle_T is (Throttle); -- end Vehicle_Controls; --------- -- "<" -- --------- function "<" (L, R : Distance_Entries) return Boolean is (L.Distance < R.Distance); -- protected body Simulator_Tick is entry Wait_For_Next_Tick when Trigger is begin Trigger := Wait_For_Next_Tick'Count > 0; end Wait_For_Next_Tick; procedure Tick is begin Trigger := True; end Tick; end Simulator_Tick; -- end Swarm_Structures;
with Interfaces; package kv.avm.References is pragma preelaborate; Invalid_Reference_Designator_Error : exception; -- This enumerates the four different types of register banks. -- Note that "Constant" can't be used because it is an Ada -- reserved word. Therefore "Fixed" is used instead. -- type Register_Bank_Type is (Input, Local, Attribute, Fixed); for Register_Bank_Type'SIZE use 2; -- 2 bits type Offset_Type is mod 2**10; -- 10 bits -- This has to be 12 bits so that four of them can be packed into -- an instruction. -- type Reference_Type is record Memory : Register_Bank_Type; Index : Offset_Type; end record; for Reference_Type use record Memory at 0 range 0 .. 1; Index at 0 range 2 .. 11; end record; for Reference_Type'SIZE use 12; type Reference_Array_Type is array (Interfaces.Unsigned_32 range <>) of Reference_Type; type Reference_Array_Access is access all Reference_Array_Type; function Ref_Img(Ref : Reference_Type) return String; function Make_Register_Name (Index : Natural; Bank : Register_Bank_Type) return String; function Make_Reference(Token : String) return Reference_Type; end kv.avm.References;
package Stack with SPARK_Mode => On is procedure Push (V : Character) with Pre => not Full, Post => Size = Size'Old + 1; procedure Pop (V : out Character) with Pre => not Empty, Post => Size = Size'Old - 1; procedure Clear with Post => Size = 0; function Top return Character with Post => Top'Result = Tab(Last); Max_Size : constant := 9; -- The stack size. Last : Integer range 0 .. Max_Size := 0; -- Indicates the top of the stack. When 0 the stack is empty. Tab : array (1 .. Max_Size) of Character; -- The stack. We push and pop pointers to Values. function Full return Boolean is (Last >= Max_Size); function Empty return Boolean is (Last < 1); function Size return Integer is (Last); end Stack;
-- { dg-do compile { target i?86-*-* x86_64-*-* } } -- { dg-options "-fdump-tree-optimized" } with Interfaces; with Unchecked_Conversion; with GNAT.SSE.Vector_Types; use GNAT.SSE.Vector_Types; procedure Vect14 is Msk1 : constant := 16#000FFAFFFFFFFB3F#; Msk2 : constant := 16#000FFDFFFC90FFFD#; type Unsigned_64_Array_Type is array (1 .. 2) of Interfaces.Unsigned_64; function Convert is new Unchecked_Conversion (Unsigned_64_Array_Type, M128i); Sse2_Param_Mask : constant M128i := Convert ((Msk1, Msk2)); begin null; end; -- { dg-final { scan-tree-dump-not "VIEW_CONVERT_EXPR" "optimized" } }
with Generic_AVL_Tree; with Ada.Text_IO, Ada.Integer_Text_IO; use Ada.Text_IO, Ada.Integer_Text_IO; procedure Main is procedure Integer_Put( Item: Integer ) is begin Put( Item, 2 ); end Integer_Put; package Int_AVL_Tree is new Generic_AVL_Tree( Element_Type => Integer, Less_Than => "<", Greater_Than => ">", Put => Integer_Put ); List : Int_AVL_Tree.T; Num_Elements : constant Integer := 20; Init_Values : array ( Integer range <> ) of Integer := ( 20, 10, 40, 30, 50, 35, 25, 55 ); -- ( 10, 5, 15, 3, 7, 12, 18, 2, 1, 4 ); -- ( 10, 5, 15, 3, 7, 12, 18, 20, 21, 17 ); -- ( 10, 5, 15, 3, 7, 12, 18, 2, 1, 4, 6, 8, 9, 11, 13, 14, 16, 17, 20, 19 ); begin -- for I in Init_Values'range loop -- Int_AVL_Tree.Insert( List, Init_Values(I) ); -- end loop; for I in 1 .. 2**22 loop Int_Avl_Tree.Insert( List, I ); end loop; -- for I in 1 .. Num_Elements loop -- if I mod 3 = 0 then -- Int_AVL_Tree.Remove( List, I ); -- end if; -- end loop; -- Int_AVL_Tree.Debug_Print( List ); end Main;
with Ada.Numerics.Generic_Complex_Types; with Dsp.Ring_Filters; -- -- This package provides several (OK, only filters so far...) DSP functions -- It needs to be instantiated with a floating point type and a corresponding -- complex type. -- generic type Scalar_Type is digits <>; with package Complex_Types is new Ada.Numerics.Generic_Complex_Types (Scalar_Type); package DSP.Generic_Functions is subtype Complex_Type is Complex_Types.Complex; use type Complex_Types.Complex; package Real_Filters is new Dsp.Ring_Filters (Sample_Type => Scalar_Type, Coefficient_Type => Scalar_Type, One => 1.0, Zero => 0.0, Zero_Coeff => 0.0); function Delta_Signal (K : Integer) return Scalar_Type renames Real_Filters.Delta_Signal; subtype Real_FIR is Real_Filters.Ring_FIR; subtype Real_IIR is Real_Filters.Ring_IIR; subtype Real_Filter_Interface is Real_Filters.Ring_Filter_Interface; subtype Real_IIR_Spec is Real_Filters.Ring_IIR_Spec; subtype Scalar_Array is Real_Filters.Sample_Array; package Complex_Filters is new Dsp.Ring_Filters (Sample_Type => Complex_Type, Coefficient_Type => Complex_Type, One => (1.0, 0.0), Zero => (0.0, 0.0), Zero_Coeff => (0.0, 0.0)); function Delta_Signal (K : Integer) return Complex_Type renames Complex_Filters.Delta_Signal; subtype Complex_Filter_Interface is Complex_Filters.Ring_Filter_Interface; subtype Complex_FIR is Complex_Filters.Ring_FIR; subtype Complex_IIR is Complex_Filters.Ring_IIR; subtype Complex_IIR_Spec is Complex_Filters.Ring_IIR_Spec; type Notch_Type is (Passband, Stopband); function Notch_Specs (Freq : Normalized_Frequency; Pole_Radius : Stable_Radius; Class : Notch_Type := Stopband) return Complex_IIR_Spec; -- -- Return the specs of a notch filter tuned at the frequency Freq -- (normalized to sampling frequency, that is, Freq=0.5 -- is the Nyquist frequency). Pole_Radius is the -- radius of compensating poles. Depending on the value of Class -- the filter will be a stopband (that is, it removes frequency -- Freq) or a passband (that is, it leaves unchanged the component -- at frequency Freq, while attenuating the others). -- function Notch_Specs (Freq : Normalized_Frequency; Pole_Radius : Stable_Radius; Class : Notch_Type := Stopband) return Real_IIR_Spec; -- -- Return the specs of a notch filter tuned at the frequency Freq -- (normalized to sampling frequency, that is, Freq=0.5 -- is the Nyquist frequency). Pole_Radius is the -- radius of compensating poles. Depending on the value of Class -- the filter will be a stopband (that is, it removes frequency -- Freq) or a passband (that is, it leaves unchanged the component -- at frequency Freq, while attenuating the others). -- function Complexify (X : Real_Filters.Coefficient_Array) return Complex_Filters.Coefficient_Array with Post => X'First = Complexify'Result'First and X'Last = Complexify'Result'Last; -- Create a complex vector from a real one. Quite handy in many -- cases. end DSP.Generic_Functions;
----------------------------------------------------------------------- -- AWA tests - AWA Tests Framework -- Copyright (C) 2011, 2012, 2014, 2018 Stephane Carrez -- Written by Stephane Carrez (Stephane.Carrez@gmail.com) -- -- Licensed under the Apache License, Version 2.0 (the "License"); -- you may not use this file except in compliance with the License. -- You may obtain a copy of the License at -- -- http://www.apache.org/licenses/LICENSE-2.0 -- -- Unless required by applicable law or agreed to in writing, software -- distributed under the License is distributed on an "AS IS" BASIS, -- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -- See the License for the specific language governing permissions and -- limitations under the License. ----------------------------------------------------------------------- with AWA.Applications; with AWA.Services.Filters; with Util.Properties; with Util.Tests; with Util.XUnit; with ASF.Filters.Dump; with ASF.Servlets.Faces; with Servlet.Core.Files; with ASF.Servlets.Ajax; with Servlet.Core.Measures; package AWA.Tests is type Test is abstract new Util.Tests.Test with null record; -- Setup the service context before executing the test. overriding procedure Set_Up (T : in out Test); -- Cleanup after the test execution. overriding procedure Tear_Down (T : in out Test); -- Initialize the AWA test framework mockup. procedure Initialize (App : in AWA.Applications.Application_Access; Props : in Util.Properties.Manager; Add_Modules : in Boolean); -- Called when the testsuite execution has finished. procedure Finish (Status : in Util.XUnit.Status); procedure Initialize (Props : in Util.Properties.Manager); -- Get the test application. function Get_Application return AWA.Applications.Application_Access; -- Set the application context to simulate a web request context. procedure Set_Application_Context; type Test_Application is new AWA.Applications.Application with record Self : AWA.Applications.Application_Access; -- Application servlets and filters (add new servlet and filter instances here). Faces : aliased ASF.Servlets.Faces.Faces_Servlet; Ajax : aliased ASF.Servlets.Ajax.Ajax_Servlet; Files : aliased Servlet.Core.Files.File_Servlet; Dump : aliased ASF.Filters.Dump.Dump_Filter; Service_Filter : aliased AWA.Services.Filters.Service_Filter; Measures : aliased Servlet.Core.Measures.Measure_Servlet; end record; -- Initialize the servlets provided by the application. -- This procedure is called by <b>Initialize</b>. -- It should register the application servlets. overriding procedure Initialize_Servlets (App : in out Test_Application); -- Initialize the filters provided by the application. -- This procedure is called by <b>Initialize</b>. -- It should register the application filters. overriding procedure Initialize_Filters (App : in out Test_Application); end AWA.Tests;
pragma Ada_2012; pragma Style_Checks (Off); with Interfaces.C; use Interfaces.C; with Interfaces.C.Strings; limited with bits_types_struct_statx_h; package bits_statx_generic_h is STATX_TYPE : constant := 16#0001#; -- /usr/include/bits/statx-generic.h:29 STATX_MODE : constant := 16#0002#; -- /usr/include/bits/statx-generic.h:30 STATX_NLINK : constant := 16#0004#; -- /usr/include/bits/statx-generic.h:31 STATX_UID : constant := 16#0008#; -- /usr/include/bits/statx-generic.h:32 STATX_GID : constant := 16#0010#; -- /usr/include/bits/statx-generic.h:33 STATX_ATIME : constant := 16#0020#; -- /usr/include/bits/statx-generic.h:34 STATX_MTIME : constant := 16#0040#; -- /usr/include/bits/statx-generic.h:35 STATX_CTIME : constant := 16#0080#; -- /usr/include/bits/statx-generic.h:36 STATX_INO : constant := 16#0100#; -- /usr/include/bits/statx-generic.h:37 STATX_SIZE : constant := 16#0200#; -- /usr/include/bits/statx-generic.h:38 STATX_BLOCKS : constant := 16#0400#; -- /usr/include/bits/statx-generic.h:39 STATX_BASIC_STATS : constant := 16#07ff#; -- /usr/include/bits/statx-generic.h:40 STATX_ALL : constant := 16#0fff#; -- /usr/include/bits/statx-generic.h:41 STATX_BTIME : constant := 16#0800#; -- /usr/include/bits/statx-generic.h:42 STATX_MNT_ID : constant := 16#1000#; -- /usr/include/bits/statx-generic.h:43 STATX_u_RESERVED : constant := 16#80000000#; -- /usr/include/bits/statx-generic.h:44 STATX_ATTR_COMPRESSED : constant := 16#0004#; -- /usr/include/bits/statx-generic.h:46 STATX_ATTR_IMMUTABLE : constant := 16#0010#; -- /usr/include/bits/statx-generic.h:47 STATX_ATTR_APPEND : constant := 16#0020#; -- /usr/include/bits/statx-generic.h:48 STATX_ATTR_NODUMP : constant := 16#0040#; -- /usr/include/bits/statx-generic.h:49 STATX_ATTR_ENCRYPTED : constant := 16#0800#; -- /usr/include/bits/statx-generic.h:50 STATX_ATTR_AUTOMOUNT : constant := 16#1000#; -- /usr/include/bits/statx-generic.h:51 STATX_ATTR_MOUNT_ROOT : constant := 16#2000#; -- /usr/include/bits/statx-generic.h:52 STATX_ATTR_VERITY : constant := 16#100000#; -- /usr/include/bits/statx-generic.h:53 STATX_ATTR_DAX : constant := 16#200000#; -- /usr/include/bits/statx-generic.h:54 -- Generic statx-related definitions and declarations. -- Copyright (C) 2018-2021 Free Software Foundation, Inc. -- This file is part of the GNU C Library. -- The GNU C Library is free software; you can redistribute it and/or -- modify it under the terms of the GNU Lesser General Public -- License as published by the Free Software Foundation; either -- version 2.1 of the License, or (at your option) any later version. -- The GNU C Library is distributed in the hope that it will be useful, -- but WITHOUT ANY WARRANTY; without even the implied warranty of -- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -- Lesser General Public License for more details. -- You should have received a copy of the GNU Lesser General Public -- License along with the GNU C Library; if not, see -- <https://www.gnu.org/licenses/>. -- This interface is based on <linux/stat.h> in Linux. -- Fill *BUF with information about PATH in DIRFD. function statx (uu_dirfd : int; uu_path : Interfaces.C.Strings.chars_ptr; uu_flags : int; uu_mask : unsigned; uu_buf : access bits_types_struct_statx_h.statx) return int -- /usr/include/bits/statx-generic.h:60 with Import => True, Convention => C, External_Name => "statx"; end bits_statx_generic_h;
------------------------------------------------------------------------------ -- -- -- GNAT COMPILER COMPONENTS -- -- -- -- S Y S T E M . S E C O N D A R Y _ S T A C K -- -- -- -- B o d y -- -- -- -- Copyright (C) 1992-2014, Free Software Foundation, Inc. -- -- -- -- GNAT is free software; you can redistribute it and/or modify it under -- -- terms of the GNU General Public License as published by the Free Soft- -- -- ware Foundation; either version 3, or (at your option) any later ver- -- -- sion. GNAT is distributed in the hope that it will be useful, but WITH- -- -- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY -- -- or FITNESS FOR A PARTICULAR PURPOSE. -- -- -- -- -- -- -- -- -- -- -- -- You should have received a copy of the GNU General Public License and -- -- a copy of the GCC Runtime Library Exception along with this program; -- -- see the files COPYING3 and COPYING.RUNTIME respectively. If not, see -- -- <http://www.gnu.org/licenses/>. -- -- -- -- GNAT was originally developed by the GNAT team at New York University. -- -- Extensive contributions were provided by Ada Core Technologies Inc. -- -- -- ------------------------------------------------------------------------------ -- This is the HI-E version of this package with Unchecked_Conversion; package body System.Secondary_Stack is use type SSE.Storage_Offset; type Memory is array (Mark_Id range <>) of SSE.Storage_Element; type Stack_Id is record Top : Mark_Id; Last : Mark_Id; Mem : Memory (1 .. Mark_Id'Last); end record; pragma Suppress_Initialization (Stack_Id); type Stack_Ptr is access Stack_Id; function From_Addr is new Unchecked_Conversion (Address, Stack_Ptr); function Get_Sec_Stack return Stack_Ptr; pragma Import (C, Get_Sec_Stack, "__gnat_get_secondary_stack"); -- Return the address of the secondary stack. -- In a multi-threaded environment, Sec_Stack should be a thread-local -- variable. -- -- Possible separate implementation of Get_Sec_Stack in a single-threaded -- environment: -- -- with System; -- package Secondary_Stack is -- function Get_Sec_Stack return System.Address; -- pragma Export (C, Get_Sec_Stack, "__gnat_get_secondary_stack"); -- end Secondary_Stack; -- pragma Warnings (Off); -- with System.Secondary_Stack; use System.Secondary_Stack; -- pragma Warnings (On); -- package body Secondary_Stack is -- Chunk : aliased String (1 .. Default_Secondary_Stack_Size); -- for Chunk'Alignment use Standard'Maximum_Alignment; -- Initialized : Boolean := False; -- function Get_Sec_Stack return System.Address is -- begin -- if not Initialized then -- Initialized := True; -- SS_Init (Chunk'Address); -- end if; -- return Chunk'Address; -- end Get_Sec_Stack; -- end Secondary_Stack; ----------------- -- SS_Allocate -- ----------------- procedure SS_Allocate (Address : out System.Address; Storage_Size : SSE.Storage_Count) is Max_Align : constant Mark_Id := Mark_Id (Standard'Maximum_Alignment); Max_Size : constant Mark_Id := ((Mark_Id (Storage_Size) + Max_Align - 1) / Max_Align) * Max_Align; Sec_Stack : constant Stack_Ptr := Get_Sec_Stack; begin if Sec_Stack.Top + Max_Size > Sec_Stack.Last then raise Storage_Error; end if; Address := Sec_Stack.Mem (Sec_Stack.Top)'Address; Sec_Stack.Top := Sec_Stack.Top + Max_Size; end SS_Allocate; ------------- -- SS_Init -- ------------- procedure SS_Init (Stk : System.Address; Size : Natural := Default_Secondary_Stack_Size) is Stack : constant Stack_Ptr := From_Addr (Stk); begin pragma Assert (Size >= 2 * Mark_Id'Max_Size_In_Storage_Elements); pragma Assert (Stk mod Standard'Maximum_Alignment = SSE.Storage_Offset'(0)); Stack.Top := Stack.Mem'First; Stack.Last := Mark_Id (Size) - 2 * Mark_Id'Max_Size_In_Storage_Elements; end SS_Init; ------------- -- SS_Mark -- ------------- function SS_Mark return Mark_Id is begin return Get_Sec_Stack.Top; end SS_Mark; ---------------- -- SS_Release -- ---------------- procedure SS_Release (M : Mark_Id) is begin Get_Sec_Stack.Top := M; end SS_Release; end System.Secondary_Stack;
-- part of OpenGLAda, (c) 2017 Felix Krause -- released under the terms of the MIT license, see the file "COPYING" with GL.API; with GL.Enums.Getter; package body GL.Immediate is Error_Checking_Suspended : Boolean := False; overriding procedure Finalize (Token : in out Input_Token) is begin if not Token.Finalized then API.GL_End; Error_Checking_Suspended := False; Raise_Exception_On_OpenGL_Error; Token.Finalized := True; end if; end Finalize; function Start (Mode : Connection_Mode) return Input_Token is begin API.GL_Begin (Mode); Error_Checking_Suspended := True; return Input_Token'(Ada.Finalization.Limited_Controlled with Mode => Mode, Finalized => False); end Start; procedure Add_Vertex (Token : Input_Token; Vertex : Vector2) is pragma Unreferenced (Token); begin API.Vertex2 (Vertex); end Add_Vertex; procedure Add_Vertex (Token : Input_Token; Vertex : Vector3) is pragma Unreferenced (Token); begin API.Vertex3 (Vertex); end Add_Vertex; procedure Add_Vertex (Token : Input_Token; Vertex : Vector4) is pragma Unreferenced (Token); begin API.Vertex4 (Vertex); end Add_Vertex; procedure Set_Color (Value : Colors.Color) is begin API.Color (Value); if not Error_Checking_Suspended then Raise_Exception_On_OpenGL_Error; end if; end Set_Color; function Current_Color return Colors.Color is Ret : Colors.Color; begin API.Get_Color (Enums.Getter.Current_Color, Ret); if not Error_Checking_Suspended then Raise_Exception_On_OpenGL_Error; end if; return Ret; end Current_Color; procedure Set_Secondary_Color (Value : Colors.Color) is begin API.Secondary_Color (Value); if not Error_Checking_Suspended then Raise_Exception_On_OpenGL_Error; end if; end Set_Secondary_Color; function Current_Secondary_Color return Colors.Color is Ret : Colors.Color; begin API.Get_Color (Enums.Getter.Current_Secondary_Color, Ret); if not Error_Checking_Suspended then Raise_Exception_On_OpenGL_Error; end if; return Ret; end Current_Secondary_Color; procedure Set_Fog_Distance (Value : Double) is begin API.Fog_Coord (Value); if not Error_Checking_Suspended then Raise_Exception_On_OpenGL_Error; end if; end Set_Fog_Distance; function Current_Fog_Distance return Double is Value : aliased Double; begin API.Get_Double (Enums.Getter.Current_Fog_Coord, Value'Access); if not Error_Checking_Suspended then Raise_Exception_On_OpenGL_Error; end if; return Value; end Current_Fog_Distance; procedure Set_Normal (Value : Vector3) is begin API.Normal (Value); if not Error_Checking_Suspended then Raise_Exception_On_OpenGL_Error; end if; end Set_Normal; function Current_Normal return Vector3 is Value : Vector3; begin API.Get_Double (Enums.Getter.Current_Normal, Value (X)'Access); if not Error_Checking_Suspended then Raise_Exception_On_OpenGL_Error; end if; return Value; end Current_Normal; procedure Set_Texture_Coordinates (Value : Vector4) is begin API.Tex_Coord4 (Value); if not Error_Checking_Suspended then Raise_Exception_On_OpenGL_Error; end if; end Set_Texture_Coordinates; procedure Set_Texture_Coordinates (Value : Vector3) is begin API.Tex_Coord3 (Value); if not Error_Checking_Suspended then Raise_Exception_On_OpenGL_Error; end if; end Set_Texture_Coordinates; procedure Set_Texture_Coordinates (Value : Vector2) is begin API.Tex_Coord2 (Value); if not Error_Checking_Suspended then Raise_Exception_On_OpenGL_Error; end if; end Set_Texture_Coordinates; function Current_Texture_Coordinates return Vector4 is Value : Vector4; begin API.Get_Double (Enums.Getter.Current_Texture_Coords, Value (X)'Access); if not Error_Checking_Suspended then Raise_Exception_On_OpenGL_Error; end if; return Value; end Current_Texture_Coordinates; end GL.Immediate;
-- -- Copyright (C) 2021 Jeremy Grosser <jeremy@synack.me> -- -- SPDX-License-Identifier: BSD-3-Clause -- package body Str is subtype Numbers is Character range '0' .. '9'; function Find (S : String; C : Character) return Natural is begin for I in S'Range loop if S (I) = C then return I; end if; end loop; return 0; end Find; function Contains (Haystack, Needle : String) return Boolean is I : Integer := Haystack'First; begin if Haystack'Length < Needle'Length then return False; end if; while I <= Haystack'Last - Needle'Length - 1 loop if Haystack (I .. I + Needle'Length) = Needle then return True; end if; I := I + 1; end loop; return False; end Contains; function Find_Number (S : String) return Natural is begin for I in S'Range loop if S (I) in Numbers then return I; end if; end loop; return 0; end Find_Number; function To_Natural (S : String; Base : Positive := 10) return Natural is Multiple : Natural := 1; N : Natural := 0; begin for I in reverse 0 .. S'Length - 1 loop N := N + ((Character'Pos (S (S'First + I)) - Character'Pos ('0')) * Multiple); Multiple := Multiple * Base; end loop; return N; end To_Natural; function Split (S : String; Delimiter : Character; Skip : Natural) return String is First : Natural := S'First; Last : Natural := S'Last; begin if Skip > 0 then for I in 1 .. Skip loop First := Find (S (First .. Last), Delimiter) + 1; end loop; end if; Last := Find (S (First .. Last), Delimiter); if Last = 0 then Last := S'Last; else Last := Last - 1; end if; return S (First .. Last); end Split; function Strip (S : String; C : Character) return String is begin if S'Length = 0 then return S; end if; if S'Length = 1 and then S (S'First) = C then return ""; end if; if S (S'First) = C then return Strip (S (S'First + 1 .. S'Last), C); elsif S (S'Last) = C then return Strip (S (S'First .. S'Last - 1), C); else return S; end if; end Strip; function Strip_Leading (S : String; C : Character) return String is begin if S'Length = 0 then return S; end if; if S'Length = 1 and then S (S'First) = C then return ""; end if; if S (S'First) = C then return Strip (S (S'First + 1 .. S'Last), C); else return S; end if; end Strip_Leading; function Trim (S : String; Chars : String) return String is Last : Integer := S'Last; begin while Find (Chars, S (Last)) /= 0 loop Last := Last - 1; if Last = S'First then return ""; end if; end loop; return S (S'First .. Last); end Trim; function Starts_With (S : String; Prefix : String) return Boolean is begin return (S'Length >= Prefix'Length and then S (S'First .. S'First + Prefix'Length - 1) = Prefix); end Starts_With; end Str;
with xcb; use xcb; with xcb_ewmh; use xcb_ewmh; with Compositor; with Render; package Events is type eventPtr is access all xcb_generic_event_t; procedure eventLoop (connection : access xcb_connection_t; rend : render.Renderer; mode : Compositor.CompositeMode); end Events;
----------------------------------------------------------------------- -- util-http-clients-curl -- HTTP Clients with CURL -- Copyright (C) 2012, 2017, 2018, 2020 Stephane Carrez -- Written by Stephane Carrez (Stephane.Carrez@gmail.com) -- -- Licensed under the Apache License, Version 2.0 (the "License"); -- you may not use this file except in compliance with the License. -- You may obtain a copy of the License at -- -- http://www.apache.org/licenses/LICENSE-2.0 -- -- Unless required by applicable law or agreed to in writing, software -- distributed under the License is distributed on an "AS IS" BASIS, -- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -- See the License for the specific language governing permissions and -- limitations under the License. ----------------------------------------------------------------------- with Util.Strings; with Util.Log.Loggers; with Util.Http.Clients.Curl.Constants; package body Util.Http.Clients.Curl is use System; pragma Linker_Options ("-lcurl"); Log : constant Util.Log.Loggers.Logger := Util.Log.Loggers.Create ("Util.Http.Clients.Curl"); function Get_Request (Http : in Client'Class) return Curl_Http_Request_Access; PUT_TOKEN : constant Chars_Ptr := Strings.New_String ("PUT"); PATCH_TOKEN : constant Chars_Ptr := Strings.New_String ("PATCH"); OPTIONS_TOKEN : constant Chars_Ptr := Strings.New_String ("OPTIONS"); DELETE_TOKEN : constant Chars_Ptr := Strings.New_String ("DELETE"); Manager : aliased Curl_Http_Manager; -- ------------------------------ -- Register the CURL Http manager. -- ------------------------------ procedure Register is begin Default_Http_Manager := Manager'Access; end Register; -- ------------------------------ -- Check the CURL result code and report and exception and a log message if -- the CURL code indicates an error. -- ------------------------------ procedure Check_Code (Code : in CURL_Code; Message : in String) is begin if Code /= CURLE_OK then declare Error : constant Chars_Ptr := Curl_Easy_Strerror (Code); Msg : constant String := Interfaces.C.Strings.Value (Error); begin Log.Error ("{0}: {1}", Message, Msg); raise Connection_Error with Msg; end; end if; end Check_Code; -- ------------------------------ -- Create a new HTTP request associated with the current request manager. -- ------------------------------ procedure Create (Manager : in Curl_Http_Manager; Http : in out Client'Class) is pragma Unreferenced (Manager); Request : Curl_Http_Request_Access; Data : CURL; begin Data := Curl_Easy_Init; if Data = System.Null_Address then raise Storage_Error with "curl_easy_init cannot create the CURL instance"; end if; Request := new Curl_Http_Request; Request.Data := Data; Http.Delegate := Request.all'Access; end Create; function Get_Request (Http : in Client'Class) return Curl_Http_Request_Access is begin return Curl_Http_Request'Class (Http.Delegate.all)'Access; end Get_Request; -- ------------------------------ -- This function is called by CURL when a response line was read. -- ------------------------------ function Read_Response (Data : in Chars_Ptr; Size : in Size_T; Nmemb : in Size_T; Response : in Curl_Http_Response_Access) return Size_T is Total : constant Size_T := Size * Nmemb; Last : Natural; Line : constant String := Interfaces.C.Strings.Value (Data, Total); begin Last := Line'Last; while Last > Line'First and then (Line (Last) = ASCII.CR or Line (Last) = ASCII.LF) loop Last := Last - 1; end loop; Log.Debug ("RCV: {0}", Line (Line'First .. Last)); if Response.Parsing_Body then Ada.Strings.Unbounded.Append (Response.Content, Line); elsif Total = 2 and then Line (1) = ASCII.CR and then Line (2) = ASCII.LF then Response.Parsing_Body := True; else declare Pos : constant Natural := Util.Strings.Index (Line, ':'); Start : Natural; begin if Pos > 0 then Start := Pos + 1; while Start <= Line'Last and Line (Start) = ' ' loop Start := Start + 1; end loop; Response.Add_Header (Name => Line (Line'First .. Pos - 1), Value => Line (Start .. Last)); end if; end; end if; return Total; end Read_Response; -- ------------------------------ -- Prepare to setup the headers in the request. -- ------------------------------ procedure Set_Headers (Request : in out Curl_Http_Request) is procedure Process (Name, Value : in String); procedure Process (Name, Value : in String) is S : Chars_Ptr := Strings.New_String (Name & ": " & Value); begin Request.Curl_Headers := Curl_Slist_Append (Request.Curl_Headers, S); Interfaces.C.Strings.Free (S); end Process; begin if Request.Curl_Headers /= null then Curl_Slist_Free_All (Request.Curl_Headers); Request.Curl_Headers := null; end if; Request.Iterate_Headers (Process'Access); end Set_Headers; procedure Do_Get (Manager : in Curl_Http_Manager; Http : in Client'Class; URI : in String; Reply : out Response'Class) is pragma Unreferenced (Manager); use Interfaces.C; Req : constant Curl_Http_Request_Access := Get_Request (Http); Result : CURL_Code; Response : Curl_Http_Response_Access; Status : aliased C.long; begin Log.Info ("GET {0}", URI); Result := Curl_Easy_Setopt_Write_Callback (Req.Data, Constants.CURLOPT_WRITEUNCTION, Read_Response'Access); Check_Code (Result, "set callback"); Req.Set_Headers; Interfaces.C.Strings.Free (Req.URL); Req.URL := Strings.New_String (URI); Result := Curl_Easy_Setopt_Long (Req.Data, Constants.CURLOPT_HTTPGET, 1); Check_Code (Result, "set http GET"); Result := Curl_Easy_Setopt_Long (Req.Data, Constants.CURLOPT_HEADER, 1); Check_Code (Result, "set header"); Result := Curl_Easy_Setopt_Slist (Req.Data, Constants.CURLOPT_HTTPHEADER, Req.Curl_Headers); Check_Code (Result, "set http GET headers"); Result := Curl_Easy_Setopt_String (Req.Data, Constants.CURLOPT_URL, Req.URL); Check_Code (Result, "set url"); Response := new Curl_Http_Response; Result := Curl_Easy_Setopt_Data (Req.Data, Constants.CURLOPT_WRITEDATA, Response); Check_Code (Result, "set write data"); Reply.Delegate := Response.all'Access; Result := Curl_Easy_Perform (Req.Data); Check_Code (Result, "get request"); Result := Curl_Easy_Getinfo_Long (Req.Data, Constants.CURLINFO_RESPONSE_CODE, Status'Access); Check_Code (Result, "get response code"); Response.Status := Natural (Status); end Do_Get; procedure Do_Head (Manager : in Curl_Http_Manager; Http : in Client'Class; URI : in String; Reply : out Response'Class) is pragma Unreferenced (Manager); use Interfaces.C; Req : constant Curl_Http_Request_Access := Get_Request (Http); Result : CURL_Code; Response : Curl_Http_Response_Access; Status : aliased C.long; begin Log.Info ("HEAD {0}", URI); Result := Curl_Easy_Setopt_Write_Callback (Req.Data, Constants.CURLOPT_WRITEUNCTION, Read_Response'Access); Check_Code (Result, "set callback"); Req.Set_Headers; Interfaces.C.Strings.Free (Req.URL); Req.URL := Strings.New_String (URI); Result := Curl_Easy_Setopt_Long (Req.Data, Constants.CURLOPT_NOBODY, 1); Check_Code (Result, "set http HEAD"); Result := Curl_Easy_Setopt_Long (Req.Data, Constants.CURLOPT_HEADER, 1); Check_Code (Result, "set header"); Result := Curl_Easy_Setopt_Slist (Req.Data, Constants.CURLOPT_HTTPHEADER, Req.Curl_Headers); Check_Code (Result, "set http GET headers"); Result := Curl_Easy_Setopt_String (Req.Data, Constants.CURLOPT_URL, Req.URL); Check_Code (Result, "set url"); Response := new Curl_Http_Response; Result := Curl_Easy_Setopt_Data (Req.Data, Constants.CURLOPT_WRITEDATA, Response); Check_Code (Result, "set write data"); Reply.Delegate := Response.all'Access; Result := Curl_Easy_Perform (Req.Data); Check_Code (Result, "get request"); Result := Curl_Easy_Getinfo_Long (Req.Data, Constants.CURLINFO_RESPONSE_CODE, Status'Access); Check_Code (Result, "get response code"); Response.Status := Natural (Status); end Do_Head; procedure Do_Post (Manager : in Curl_Http_Manager; Http : in Client'Class; URI : in String; Data : in String; Reply : out Response'Class) is pragma Unreferenced (Manager); use Interfaces.C; Req : constant Curl_Http_Request_Access := Get_Request (Http); Result : CURL_Code; Response : Curl_Http_Response_Access; Status : aliased C.long; begin Log.Info ("POST {0}", URI); Result := Curl_Easy_Setopt_Write_Callback (Req.Data, Constants.CURLOPT_WRITEUNCTION, Read_Response'Access); Check_Code (Result, "set callback"); Req.Set_Headers; Interfaces.C.Strings.Free (Req.URL); Req.URL := Strings.New_String (URI); Interfaces.C.Strings.Free (Req.Content); Req.Content := Strings.New_String (Data); Result := Curl_Easy_Setopt_Long (Req.Data, Constants.CURLOPT_POST, 1); Check_Code (Result, "set http POST"); Result := Curl_Easy_Setopt_Long (Req.Data, Constants.CURLOPT_HEADER, 1); Check_Code (Result, "set header"); Result := Curl_Easy_Setopt_Slist (Req.Data, Constants.CURLOPT_HTTPHEADER, Req.Curl_Headers); Check_Code (Result, "set http POST headers"); Result := Curl_Easy_Setopt_String (Req.Data, Constants.CURLOPT_URL, Req.URL); Check_Code (Result, "set url"); Result := Curl_Easy_Setopt_String (Req.Data, Constants.CURLOPT_POSTFIELDS, Req.Content); Check_Code (Result, "set post data"); Result := Curl_Easy_Setopt_Long (Req.Data, Constants.CURLOPT_POSTFIELDSIZE, Data'Length); Check_Code (Result, "set post data"); Response := new Curl_Http_Response; Result := Curl_Easy_Setopt_Data (Req.Data, Constants.CURLOPT_WRITEDATA, Response); Check_Code (Result, "set write data"); Reply.Delegate := Response.all'Access; Result := Curl_Easy_Perform (Req.Data); Check_Code (Result, "get request"); Result := Curl_Easy_Getinfo_Long (Req.Data, Constants.CURLINFO_RESPONSE_CODE, Status'Access); Check_Code (Result, "get response code"); Response.Status := Natural (Status); if Req.Curl_Headers /= null then Curl_Slist_Free_All (Req.Curl_Headers); Req.Curl_Headers := null; end if; end Do_Post; overriding procedure Do_Put (Manager : in Curl_Http_Manager; Http : in Client'Class; URI : in String; Data : in String; Reply : out Response'Class) is pragma Unreferenced (Manager); use Interfaces.C; Req : constant Curl_Http_Request_Access := Get_Request (Http); Result : CURL_Code; Response : Curl_Http_Response_Access; Status : aliased C.long; begin Log.Info ("PUT {0}", URI); Result := Curl_Easy_Setopt_Write_Callback (Req.Data, Constants.CURLOPT_WRITEUNCTION, Read_Response'Access); Check_Code (Result, "set callback"); Req.Set_Headers; Interfaces.C.Strings.Free (Req.URL); Req.URL := Strings.New_String (URI); Interfaces.C.Strings.Free (Req.Content); Req.Content := Strings.New_String (Data); Result := Curl_Easy_Setopt_Long (Req.Data, Constants.CURLOPT_POST, 1); Check_Code (Result, "set http PUT"); Result := Curl_Easy_Setopt_Long (Req.Data, Constants.CURLOPT_HEADER, 1); Check_Code (Result, "set header"); Result := Curl_Easy_Setopt_String (Req.Data, Constants.CURLOPT_CUSTOMREQUEST, PUT_TOKEN); Check_Code (Result, "set http PUT"); Result := Curl_Easy_Setopt_Slist (Req.Data, Constants.CURLOPT_HTTPHEADER, Req.Curl_Headers); Check_Code (Result, "set http PUT headers"); Result := Curl_Easy_Setopt_String (Req.Data, Constants.CURLOPT_URL, Req.URL); Check_Code (Result, "set url"); Result := Curl_Easy_Setopt_String (Req.Data, Constants.CURLOPT_POSTFIELDS, Req.Content); Check_Code (Result, "set put data"); Result := Curl_Easy_Setopt_Long (Req.Data, Constants.CURLOPT_POSTFIELDSIZE, Data'Length); Check_Code (Result, "set put data"); Response := new Curl_Http_Response; Result := Curl_Easy_Setopt_Data (Req.Data, Constants.CURLOPT_WRITEDATA, Response); Check_Code (Result, "set write data"); Reply.Delegate := Response.all'Access; Result := Curl_Easy_Perform (Req.Data); Check_Code (Result, "get request"); Result := Curl_Easy_Getinfo_Long (Req.Data, Constants.CURLINFO_RESPONSE_CODE, Status'Access); Check_Code (Result, "get response code"); Response.Status := Natural (Status); Result := Curl_Easy_Setopt_String (Req.Data, Constants.CURLOPT_CUSTOMREQUEST, Interfaces.C.Strings.Null_Ptr); Check_Code (Result, "restore set http default"); if Req.Curl_Headers /= null then Curl_Slist_Free_All (Req.Curl_Headers); Req.Curl_Headers := null; end if; end Do_Put; overriding procedure Do_Patch (Manager : in Curl_Http_Manager; Http : in Client'Class; URI : in String; Data : in String; Reply : out Response'Class) is pragma Unreferenced (Manager); use Interfaces.C; Req : constant Curl_Http_Request_Access := Get_Request (Http); Result : CURL_Code; Response : Curl_Http_Response_Access; Status : aliased C.long; begin Log.Info ("PATCH {0}", URI); Result := Curl_Easy_Setopt_Write_Callback (Req.Data, Constants.CURLOPT_WRITEUNCTION, Read_Response'Access); Check_Code (Result, "set callback"); Req.Set_Headers; Interfaces.C.Strings.Free (Req.URL); Req.URL := Strings.New_String (URI); Interfaces.C.Strings.Free (Req.Content); Req.Content := Strings.New_String (Data); Result := Curl_Easy_Setopt_Long (Req.Data, Constants.CURLOPT_POST, 1); Check_Code (Result, "set http PATCH"); Result := Curl_Easy_Setopt_Long (Req.Data, Constants.CURLOPT_HEADER, 1); Check_Code (Result, "set header"); Result := Curl_Easy_Setopt_String (Req.Data, Constants.CURLOPT_CUSTOMREQUEST, PATCH_TOKEN); Check_Code (Result, "set http PATCH"); Result := Curl_Easy_Setopt_Slist (Req.Data, Constants.CURLOPT_HTTPHEADER, Req.Curl_Headers); Check_Code (Result, "set http PATCH headers"); Result := Curl_Easy_Setopt_String (Req.Data, Constants.CURLOPT_URL, Req.URL); Check_Code (Result, "set url"); Result := Curl_Easy_Setopt_String (Req.Data, Constants.CURLOPT_POSTFIELDS, Req.Content); Check_Code (Result, "set patch data"); Result := Curl_Easy_Setopt_Long (Req.Data, Constants.CURLOPT_POSTFIELDSIZE, Data'Length); Check_Code (Result, "set patch data"); Response := new Curl_Http_Response; Result := Curl_Easy_Setopt_Data (Req.Data, Constants.CURLOPT_WRITEDATA, Response); Check_Code (Result, "set write data"); Reply.Delegate := Response.all'Access; Result := Curl_Easy_Perform (Req.Data); Check_Code (Result, "get request"); Result := Curl_Easy_Getinfo_Long (Req.Data, Constants.CURLINFO_RESPONSE_CODE, Status'Access); Check_Code (Result, "get response code"); Response.Status := Natural (Status); Result := Curl_Easy_Setopt_String (Req.Data, Constants.CURLOPT_CUSTOMREQUEST, Interfaces.C.Strings.Null_Ptr); Check_Code (Result, "restore set http default"); if Req.Curl_Headers /= null then Curl_Slist_Free_All (Req.Curl_Headers); Req.Curl_Headers := null; end if; end Do_Patch; overriding procedure Do_Delete (Manager : in Curl_Http_Manager; Http : in Client'Class; URI : in String; Reply : out Response'Class) is pragma Unreferenced (Manager); use Interfaces.C; Req : constant Curl_Http_Request_Access := Get_Request (Http); Result : CURL_Code; Response : Curl_Http_Response_Access; Status : aliased C.long; begin Log.Info ("DELETE {0}", URI); Result := Curl_Easy_Setopt_Write_Callback (Req.Data, Constants.CURLOPT_WRITEUNCTION, Read_Response'Access); Check_Code (Result, "set callback"); Req.Set_Headers; Interfaces.C.Strings.Free (Req.URL); Req.URL := Strings.New_String (URI); Result := Curl_Easy_Setopt_Long (Req.Data, Constants.CURLOPT_POST, 1); Check_Code (Result, "set http DELETE"); Result := Curl_Easy_Setopt_Long (Req.Data, Constants.CURLOPT_HEADER, 1); Check_Code (Result, "set header"); Result := Curl_Easy_Setopt_String (Req.Data, Constants.CURLOPT_CUSTOMREQUEST, DELETE_TOKEN); Check_Code (Result, "set http DELETE"); Result := Curl_Easy_Setopt_Slist (Req.Data, Constants.CURLOPT_HTTPHEADER, Req.Curl_Headers); Check_Code (Result, "set http GET headers"); Result := Curl_Easy_Setopt_String (Req.Data, Constants.CURLOPT_URL, Req.URL); Check_Code (Result, "set url"); -- Result := Curl_Easy_Setopt_String (Req.Data, Constants.CURLOPT_POSTFIELDS, Req.Content); -- Check_Code (Result, "set post data"); Result := Curl_Easy_Setopt_Long (Req.Data, Constants.CURLOPT_POSTFIELDSIZE, 0); Check_Code (Result, "set post data"); Response := new Curl_Http_Response; Result := Curl_Easy_Setopt_Data (Req.Data, Constants.CURLOPT_WRITEDATA, Response); Check_Code (Result, "set write data"); Reply.Delegate := Response.all'Access; Result := Curl_Easy_Perform (Req.Data); Check_Code (Result, "get request"); Result := Curl_Easy_Getinfo_Long (Req.Data, Constants.CURLINFO_RESPONSE_CODE, Status'Access); Check_Code (Result, "get response code"); Response.Status := Natural (Status); Result := Curl_Easy_Setopt_String (Req.Data, Constants.CURLOPT_CUSTOMREQUEST, Interfaces.C.Strings.Null_Ptr); Check_Code (Result, "restore set http default"); end Do_Delete; overriding procedure Do_Options (Manager : in Curl_Http_Manager; Http : in Client'Class; URI : in String; Reply : out Response'Class) is pragma Unreferenced (Manager); use Interfaces.C; Req : constant Curl_Http_Request_Access := Get_Request (Http); Result : CURL_Code; Response : Curl_Http_Response_Access; Status : aliased C.long; begin Log.Info ("OPTIONS {0}", URI); Result := Curl_Easy_Setopt_Write_Callback (Req.Data, Constants.CURLOPT_WRITEUNCTION, Read_Response'Access); Check_Code (Result, "set callback"); Req.Set_Headers; Interfaces.C.Strings.Free (Req.URL); Req.URL := Strings.New_String (URI); Result := Curl_Easy_Setopt_Long (Req.Data, Constants.CURLOPT_POST, 1); Check_Code (Result, "set http OPTIONS"); Result := Curl_Easy_Setopt_Long (Req.Data, Constants.CURLOPT_HEADER, 1); Check_Code (Result, "set header"); Result := Curl_Easy_Setopt_String (Req.Data, Constants.CURLOPT_CUSTOMREQUEST, OPTIONS_TOKEN); Check_Code (Result, "set http OPTIONS"); Result := Curl_Easy_Setopt_Slist (Req.Data, Constants.CURLOPT_HTTPHEADER, Req.Curl_Headers); Check_Code (Result, "set http OPTIONS headers"); Result := Curl_Easy_Setopt_String (Req.Data, Constants.CURLOPT_URL, Req.URL); Check_Code (Result, "set url"); Result := Curl_Easy_Setopt_Long (Req.Data, Constants.CURLOPT_POSTFIELDSIZE, 0); Check_Code (Result, "set options data"); Response := new Curl_Http_Response; Result := Curl_Easy_Setopt_Data (Req.Data, Constants.CURLOPT_WRITEDATA, Response); Check_Code (Result, "set write data"); Reply.Delegate := Response.all'Access; Result := Curl_Easy_Perform (Req.Data); Check_Code (Result, "get request"); Result := Curl_Easy_Getinfo_Long (Req.Data, Constants.CURLINFO_RESPONSE_CODE, Status'Access); Check_Code (Result, "get response code"); Response.Status := Natural (Status); Result := Curl_Easy_Setopt_String (Req.Data, Constants.CURLOPT_CUSTOMREQUEST, Interfaces.C.Strings.Null_Ptr); Check_Code (Result, "restore set http default"); end Do_Options; -- ------------------------------ -- Set the timeout for the connection. -- ------------------------------ overriding procedure Set_Timeout (Manager : in Curl_Http_Manager; Http : in Client'Class; Timeout : in Duration) is pragma Unreferenced (Manager); Req : constant Curl_Http_Request_Access := Get_Request (Http); Time : constant Interfaces.C.long := Interfaces.C.long (Timeout); Result : CURL_Code; begin Result := Curl_Easy_Setopt_Long (Req.Data, Constants.CURLOPT_TIMEOUT, Time); Check_Code (Result, "set timeout"); end Set_Timeout; overriding procedure Finalize (Request : in out Curl_Http_Request) is begin if Request.Data /= System.Null_Address then Curl_Easy_Cleanup (Request.Data); Request.Data := System.Null_Address; end if; if Request.Curl_Headers /= null then Curl_Slist_Free_All (Request.Curl_Headers); Request.Curl_Headers := null; end if; Interfaces.C.Strings.Free (Request.URL); Interfaces.C.Strings.Free (Request.Content); end Finalize; -- ------------------------------ -- Get the response body as a string. -- ------------------------------ overriding function Get_Body (Reply : in Curl_Http_Response) return String is begin return Ada.Strings.Unbounded.To_String (Reply.Content); end Get_Body; -- ------------------------------ -- Get the response status code. -- ------------------------------ overriding function Get_Status (Reply : in Curl_Http_Response) return Natural is begin return Reply.Status; end Get_Status; end Util.Http.Clients.Curl;
With Ada.Text_IO, Connection_Types, Connection_Combinations; procedure main is Result : Connection_Types.Partial_Board renames Connection_Combinations; begin Ada.Text_IO.Put_Line( Connection_Types.Image(Result) ); end;
-- Copyright (c) 2021 Devin Hill -- zlib License -- see LICENSE for details. package body GBA.Display is procedure Set_Display_Mode (Mode : Video_Mode; Forced_Blank : Boolean := False) is begin Display_Control := ( Display_Control with delta Mode => Mode , Forced_Blank => Forced_Blank ); end; procedure Enable_Display_Element (Element : Toggleable_Display_Element; Enable : Boolean := True) is begin Display_Control.Displayed_Elements (Element) := Enable; end; procedure Request_VBlank_Interrupt (Request : Boolean := True) is begin Display_Status.Request_VBlank_Interrupt := Request; end; procedure Request_HBlank_Interrupt (Request : Boolean := True) is begin Display_Status.Request_HBlank_Interrupt := Request; end; end GBA.Display;
package body Container is procedure Replace_All(The_Tree : in out Tree; New_Value : Element_Type) is begin The_Tree.Value := New_Value; If The_Tree.Left /= null then The_Tree.Left.all.Replace_All(New_Value); end if; if The_tree.Right /= null then The_Tree.Right.all.Replace_All(New_Value); end if; end Replace_All; end Container;
------------------------------------------------------------------------------ -- Copyright (c) 2014-2019, 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.Web.Exchanges provides a type representing a single immutable -- -- HTTP request and the associated response being bulit. -- -- It is mostly meant as an abstraction of the HTTP backend. The -- -- implementation here sits on top of AWS, though a similar interface -- -- should be easy to built for other HTTP backends. -- ------------------------------------------------------------------------------ with Ada.Streams; with AWS.Response; with AWS.Status; with Natools.S_Expressions.Atom_Refs; with Natools.Web.Containers; with Natools.Web.Filters; private with Ada.Containers.Indefinite_Ordered_Maps; private with AWS.Messages; private with Natools.S_Expressions.Atom_Buffers; package Natools.Web.Exchanges is type Request_Method is (GET, HEAD, POST, Unknown_Method); subtype Known_Method is Request_Method range GET .. POST; type Method_Array is array (Positive range <>) of Known_Method; type Method_Set is private; function To_Set (List : Method_Array) return Method_Set; function Is_In (Method : Request_Method; Set : Method_Set) return Boolean; function Image (List : Method_Array) return String; function Image (Set : Method_Set) return String; type Exchange (Request : access constant AWS.Status.Data) is limited new Ada.Streams.Root_Stream_Type with private; overriding procedure Read (Stream : in out Exchange; Item : out Ada.Streams.Stream_Element_Array; Last : out Ada.Streams.Stream_Element_Offset); function Cookie (Object : in Exchange; Name : in String) return String; -- Return a specific cookie, or the empty string if it is not set function Cookie_Table (Object : in Exchange) return Containers.Atom_Table_Refs.Immutable_Reference; -- Return all the cookies as a two-column table function Has_Parameter (Object : Exchange; Name : String) return Boolean; -- Return whether the parameter Name exists in the request function Header (Object : Exchange; Name : String) return String; -- Access a specific header by name, return "" for non-existing headers procedure Iterate_Parameters (Object : in Exchange; Process : not null access procedure (Name, Value : String)); -- Iterate over request parameters function Method (Object : Exchange) return Request_Method; -- Method requested by client function Parameter (Object : Exchange; Name : String) return String; -- Access a specific parameter function Path (Object : Exchange) return String; -- Path part of the requested URL function Has_Identity (Object : Exchange) return Boolean; -- Return whether an identity has been stored in Object function Identity (Object : Exchange) return Containers.Identity with Pre => Has_Identity (Object); -- Return the identity stored in Objet procedure Set_Identity (Object : in out Exchange; Identity : in Containers.Identity); -- Store an identity inside Object function Has_Response (Object : Exchange) return Boolean; -- Return whether a response has been built in Object function Response (Object : Exchange) return AWS.Response.Data; -- Return AWS response representation built in Object procedure Append (Object : in out Exchange; Data : in S_Expressions.Atom); -- Append Data to internal memory buffer in Object overriding procedure Write (Stream : in out Exchange; Data : in Ada.Streams.Stream_Element_Array) renames Append; procedure Insert_Filter (Object : in out Exchange; Filter : in Filters.Filter'Class; Side : in Filters.Side := Filters.Top); procedure Remove_Filter (Object : in out Exchange; Filter : in Filters.Filter'Class; Side : in Filters.Side := Filters.Top); procedure Send_File (Object : in out Exchange; File_Name : in S_Expressions.Atom); -- Send File_Name as a response in Object procedure Set_Cookie (Object : in out Exchange; Key : in String; Value : in String; Comment : in String := ""; Domain : in String := ""; Max_Age : in Duration := 10.0 * 365.0 * 86400.0; Path : in String := "/"; Secure : in Boolean := False; HTTP_Only : in Boolean := False); -- Prepare a Set_Cookie header for the response procedure Set_MIME_Type (Object : in out Exchange; MIME_Type : in S_Expressions.Atom); -- Set the MIME type for the response procedure Method_Not_Allowed (Object : in out Exchange; Allow : in Method_Set); -- Set internal state to HTTP 405 Method Not Allowed procedure Not_Found (Object : in out Exchange); -- Set internal state to HTTP 404 Not Found procedure Permanent_Redirect (Object : in out Exchange; Target : in S_Expressions.Atom); procedure Permanent_Redirect (Object : in out Exchange; Target : in S_Expressions.Atom_Refs.Immutable_Reference); -- Set internal state to HTTP 301 Moved Permanently procedure See_Other (Object : in out Exchange; Target : in S_Expressions.Atom); procedure See_Other (Object : in out Exchange; Target : in S_Expressions.Atom_Refs.Immutable_Reference); -- Set internal state to HTTP 303 See Other private type Method_Set is array (Known_Method) of Boolean with Pack; function Is_In (Method : Request_Method; Set : Method_Set) return Boolean is (Method in Set'Range and then Set (Method)); package Responses is type Kind is (Empty, Buffer, File); end Responses; type Cookie_Data (Value_Length : Natural; Comment_Length : Natural; Domain_Length : Natural; Path_Length : Natural) is record Value : String (1 .. Value_Length); Comment : String (1 .. Comment_Length); Domain : String (1 .. Domain_Length); Max_Age : Duration; Path : String (1 .. Path_Length); Secure : Boolean; HTTP_Only : Boolean; end record; package Cookie_Maps is new Ada.Containers.Indefinite_Ordered_Maps (String, Cookie_Data); type Exchange (Request : access constant AWS.Status.Data) is limited new Ada.Streams.Root_Stream_Type with record Allow : Method_Set := (others => False); Filter : Filters.Stack; Kind : Responses.Kind := Responses.Empty; Location : S_Expressions.Atom_Refs.Immutable_Reference; MIME_Type : S_Expressions.Atom_Refs.Immutable_Reference; Response_Body : S_Expressions.Atom_Buffers.Atom_Buffer; Status_Code : AWS.Messages.Status_Code := AWS.Messages.S200; Has_Identity : Boolean := False; Identity : Containers.Identity; Set_Cookies : Cookie_Maps.Map; end record; function Has_Response (Object : Exchange) return Boolean is (not Responses."=" (Object.Kind, Responses.Empty)); function Has_Identity (Object : Exchange) return Boolean is (Object.Has_Identity); end Natools.Web.Exchanges;
package Memory.Flash is type Flash_Type is new Memory_Type with private; type Flash_Pointer is access all Flash_Type'Class; function Create_Flash(word_size : Positive := 8; block_size : Positive := 256; read_latency : Time_Type := 10; write_latency : Time_Type := 1000) return Flash_Pointer; overriding function Clone(mem : Flash_Type) return Memory_Pointer; overriding procedure Reset(mem : in out Flash_Type; context : in Natural); overriding procedure Read(mem : in out Flash_Type; address : in Address_Type; size : in Positive); overriding procedure Write(mem : in out Flash_Type; address : in Address_Type; size : in Positive); overriding function To_String(mem : Flash_Type) return Unbounded_String; overriding function Get_Cost(mem : Flash_Type) return Cost_Type; overriding function Get_Writes(mem : Flash_Type) return Long_Integer; overriding function Get_Word_Size(mem : Flash_Type) return Positive; overriding function Get_Ports(mem : Flash_Type) return Port_Vector_Type; overriding procedure Generate(mem : in Flash_Type; sigs : in out Unbounded_String; code : in out Unbounded_String); private type Flash_Type is new Memory_Type with record word_size : Positive := 8; block_size : Positive := 256; read_latency : Time_Type := 10; write_latency : Time_Type := 1000; writes : Long_Integer := 0; end record; end Memory.Flash;
with Ada.Text_IO; package body Irc.Message is function Parse_Line (Line : in SU.Unbounded_String) return Message is Msg : Message; Index : Natural := 2; Start, Finish : Natural := 0; Size : Natural := SU.Length (Line); procedure Read_Word; procedure Read_Word is Next_WS : Natural := SU.Index (Line, " ", Index); begin Start := Index; if Next_WS > Size then raise Parse_Error; end if; Finish := Next_WS - 1; Index := Next_WS + 1; end Read_Word; begin if SU.To_String (Line) (1) /= ':' then if SU.Index (Line, "PING") = 1 then Msg.Sender := SU.To_Unbounded_String (""); Msg.Command := SU.To_Unbounded_String ("PING"); Msg.Args := SU.Unbounded_Slice (Line, 1 + 6, Size); return Msg; end if; raise Parse_Error; end if; Read_Word; Msg.Sender := SU.Unbounded_Slice (Line, Start, Finish); Read_Word; Msg.Command := SU.Unbounded_Slice (Line, Start, Finish); Msg.Args := SU.Unbounded_Slice (Line, Finish + 2, Size); if Msg.Command = "PRIVMSG" then Msg.Parse_Privmsg; end if; return Msg; end Parse_Line; procedure Print (This : Message) is use Ada.Text_IO; begin Ada.Text_IO.Put_Line (SU.To_String (This.Sender & "» " & This.Command & " " & This.Args)); end Print; procedure Parse_Privmsg (Msg : in out Message) is begin Msg.Privmsg.Target := SU.Unbounded_Slice (Msg.Args, 1, SU.Index (Msg.Args, " ") - 1); Msg.Privmsg.Content := SU.Unbounded_Slice (Msg.Args, SU.Index (Msg.Args, ":"), SU.Length (Msg.Args)); -- message sent to nick directly instead of in a channel if SU.To_String (Msg.Privmsg.Target) (1) /= '#' then Msg.Privmsg.Target := SU.To_Unbounded_String (SU.Slice (Msg.Sender, 1, SU.Index (Msg.Sender, "!") - 1)); end if; end Parse_Privmsg; end Irc.Message;
-- { dg-do compile } -- { dg-options "-O" } with Ada.Unchecked_Deallocation; with Opt46_Pkg; package body Opt46 is type Pattern is abstract tagged null record; type Pattern_Access is access Pattern'Class; procedure Free is new Ada.Unchecked_Deallocation (Pattern'Class, Pattern_Access); type Action is abstract tagged null record; type Action_Access is access Action'Class; procedure Free is new Ada.Unchecked_Deallocation (Action'Class, Action_Access); type Pattern_Action is record Pattern : Pattern_Access; Action : Action_Access; end record; package Pattern_Action_Table is new Opt46_Pkg (Pattern_Action, Natural, 1); type Session_Data is record Filters : Pattern_Action_Table.Instance; end record; procedure Close (Session : Session_Type) is Filters : Pattern_Action_Table.Instance renames Session.Data.Filters; begin for F in 1 .. Pattern_Action_Table.Last (Filters) loop Free (Filters.Table (F).Pattern); Free (Filters.Table (F).Action); end loop; end Close; end Opt46;
with Ada.Text_IO; with RCP.Control; package body RCP.User is task body User_T is use Ada.Text_IO, RCP.Control; -- all users will want the same type of item -- but in different quantities -- (note that the object components will take their default value -- unless overridden by the instantiation) My_Allocation : Resource_T := Resource_T'(Item => Extent, Granted => Request_T'First); begin loop Put_Line (" " & Positive'Image (Id) & " | " & Request_T'Image (Demand) & " | |"); -------------------------------------------------------- -- a user requests the allocation of "demand" resources Controller.Demand (My_Allocation, Demand); -------------------------------------------------------- Put_Line (" " & Positive'Image (Id) & " | | " & Request_T'Image (My_Allocation.Granted) & " |"); -------------------------------------------------------- -- fakes some work once the request has been satisfied delay Duration (Interval); -- then returns all of the resources in its possession Controller.Release (My_Allocation); -------------------------------------------------------- Put_Line (" " & Positive'Image (Id) & " | | | " & Request_T'Image (My_Allocation.Granted)); -- and finally happily rests a little while after a job well done delay Duration (Interval); end loop; end User_T; end RCP.User;
-- { dg-do compile } with System.Pool_Global; package Storage is x1: System.Pool_Global.Unbounded_No_Reclaim_Pool; type T1 is access integer; for T1'Storage_Pool use (x1); -- { dg-error "must be a variable" } type T2 is access Integer; for T2'Storage_Pool use x1; end Storage;
-- { dg-do run } with GNAT.Regpat; use GNAT.Regpat; procedure Quote is begin if Quote (".+") /= "\.\+" then raise Program_Error; end if; end Quote;
with Ada.Text_IO; use Ada.Text_IO; package body Tipos_Tarea is task body Tarea_Repetitiva is begin loop Put_Line("Id = " & IdTarea'Img); delay 1.0; end loop; end Tarea_Repetitiva; end Tipos_Tarea;
-- Copyright (C) 2019 Thierry Rascle <thierr26@free.fr> -- MIT license. Please refer to the LICENSE file. with Ada.Exceptions, Ada.Unchecked_Deallocation, Apsepp.Generic_Shared_Instance.Access_Setter, Apsepp.Test_Node_Class.Private_Test_Reporter; package body Apsepp.Test_Node_Class.Runner_Sequential.W_Slave_Nodes is use Ada.Exceptions; ---------------------------------------------------------------------------- task type Slave_Node_Task is entry Start_Run (Node : Test_Node_Access); entry Get_Outcome_And_E (Outcome : out Test_Outcome; E : out Exception_Occurrence_Access); end Slave_Node_Task; type Slave_Node_Task_Array is array (Test_Node_Index range <>) of Slave_Node_Task; ----------------------------------------------------- task body Slave_Node_Task is Nod : access Apsepp.Test_Node_Class.Test_Node_Interfa'Class; Outc : Test_Outcome; Ex : Exception_Occurrence_Access; begin accept Start_Run (Node : Test_Node_Access) do Nod := Node; end Start_Run; begin Nod.Run (Outc); exception when E : others => Ex := Save_Occurrence (E); end; accept Get_Outcome_And_E (Outcome : out Test_Outcome; E : out Exception_Occurrence_Access) do Outcome := Outc; E := Ex; end Get_Outcome_And_E; end Slave_Node_Task; ---------------------------------------------------------------------------- overriding procedure Finalize (Obj : in out Controlled_Slaves_Array_Access) is procedure Free is new Ada.Unchecked_Deallocation (Object => Test_Node_Array, Name => Test_Node_Array_Access); begin Free (Obj.A); end Finalize; ---------------------------------------------------------------------------- overriding procedure Run (Obj : in out Test_Runner_Sequential_W_Slave_Tasks; Outcome : out Test_Outcome; Kind : Run_Kind := Assert_Cond_And_Run_Test) is use Private_Test_Reporter; R_A : constant Shared_Instance.Instance_Type_Access := Shared_Instance.Instance_Type_Access (Obj.Reporter_Access); procedure CB is new SB_Lock_CB_procedure (SBLCB_Access => Obj.R_A_S_CB); package Test_Reporter_Access_Setter is new Shared_Instance.Access_Setter (Inst_Access => R_A, CB => CB); pragma Unreferenced (Test_Reporter_Access_Setter); ----------------------------------------------------- procedure Run_Test is Node_Task : Slave_Node_Task_Array (Obj.Slaves.A'Range); Ex : Exception_Occurrence_Access; procedure Free is new Ada.Unchecked_Deallocation (Object => Exception_Occurrence, Name => Exception_Occurrence_Access); begin for K in Node_Task'Range loop Node_Task(K).Start_Run (Obj.Slaves.A(K)); end loop; Test_Runner_Sequential (Obj).Run (Outcome); -- Inherited procedure call. for Ta of Node_Task loop declare Outc : Test_Outcome; E : Exception_Occurrence_Access; begin Ta.Get_Outcome_And_E (Outc, E); if Ex /= null and then E /= null then Free (E); elsif E /= null then Ex := E; -- Ex will be freed later. end if; case Outc is when Failed => Outcome := Failed; when Passed => null; end case; end; end loop; if Ex /= null then begin Reraise_Occurrence (Ex.all); exception when others => Free (Ex); raise; end; end if; exception when others => for Ta of Node_Task loop abort Ta; end loop; raise; end Run_Test; ----------------------------------------------------- begin case Kind is when Check_Cond => Test_Runner_Sequential (Obj).Run (Outcome, Kind); -- Inherited procedure call. when Assert_Cond_And_Run_Test => Run_Test; end case; end Run; ---------------------------------------------------------------------------- end Apsepp.Test_Node_Class.Runner_Sequential.W_Slave_Nodes;
with Ada.Text_IO; use Ada.Text_IO; with Ada.Float_Text_IO; with Units; use Units; procedure main with SPARK_Mode is a : Angle_Type; w : Angle_Type; w2 : Angle_Type; amin : constant Angle_Type := -1.3 * Radian; amax : constant Angle_Type := 1.3 * Radian; L : constant Angle_Type := 2.0 * (amax - amin); STEPS : constant := 10_000; step : constant Angle_Type := L / 10_000.0; begin a := 1.5 * amin; for k in 1 .. STEPS loop a := a + step; w := wrap_Angle (angle => a, min => amin, max => amax); w2 := wrap_Angle2 (angle => a, min => amin, max => amax); Ada.Float_Text_IO.Put (Item => Float (a), Aft => 3, Exp => 0); Put (","); Ada.Float_Text_IO.Put (Item => Float (w), Aft => 3, Exp => 0); Put (","); Ada.Float_Text_IO.Put (Item => Float (w2), Aft => 3, Exp => 0); declare err : constant Angle_Type := w2 - w; begin Put (","); Ada.Float_Text_IO.Put (Item => Float (err), Aft => 3, Exp => 0); end; New_Line; end loop; end main;
with physics.Space; package physics.Forge -- -- Provides constructors for physics classes. -- is type Real_view is access all math.Real; ---------- --- Space -- function new_Space (Kind : in space_Kind) return Space.view; end physics.Forge;
package body Generic_Ulam is subtype Index is Natural range 0 .. Size-1; subtype Number is Positive range 1 .. Size**2; function Cell(Row, Column: Index) return Number is -- outputs the number at the given position in the square -- taken from the Python solution X: Integer := Column - (Size-1)/2; Y: Integer := Row - Size/2; MX: Natural := abs(X); MY: Natural := abs(Y); L: Natural := 2 * Natural'Max(MX, MY); D: Integer; begin if Y >= X then D := 3 * L + X + Y; else D := L - X - Y; end if; return (L-1) ** 2 + D; end Cell; procedure Print_Spiral is N: Number; begin for R in Index'Range loop for C in Index'Range loop N := Cell(R, C); Put_String(Represent(N)); end loop; New_Line; end loop; end Print_Spiral; end Generic_Ulam;
with Ada.Text_IO; use Ada.Text_IO; with Ada.Integer_Text_IO; use Ada.Integer_Text_IO; with Alea; -- Procédure qui illustre l'utilisation du paquetage Alea. procedure Exemple_Alea is package Mon_Alea is new Alea (5, 15); -- générateur de nombre dans l'intervalle [5, 15] use Mon_Alea; Nombre: Integer; begin -- Afficher 10 nombres aléatoires Put_Line ("Quelques nombres aléatoires : "); for I in 1..10 loop Get_Random_Number (Nombre); Put (Nombre); New_Line; end loop; end Exemple_Alea;
------------------------------------------------------------------------------ -- -- -- GNAT COMPILER COMPONENTS -- -- -- -- S Y S T E M . F A T _ G E N -- -- -- -- B o d y -- -- -- -- Copyright (C) 1992-2015, 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. -- -- -- ------------------------------------------------------------------------------ -- The implementation here is portable to any IEEE implementation. It does -- not handle nonbinary radix, and also assumes that model numbers and -- machine numbers are basically identical, which is not true of all possible -- floating-point implementations. On a non-IEEE machine, this body must be -- specialized appropriately, or better still, its generic instantiations -- should be replaced by efficient machine-specific code. with Ada.Unchecked_Conversion; with System; package body System.Fat_Gen is Float_Radix : constant T := T (T'Machine_Radix); Radix_To_M_Minus_1 : constant T := Float_Radix ** (T'Machine_Mantissa - 1); pragma Assert (T'Machine_Radix = 2); -- This version does not handle radix 16 -- Constants for Decompose and Scaling Rad : constant T := T (T'Machine_Radix); Invrad : constant T := 1.0 / Rad; subtype Expbits is Integer range 0 .. 6; -- 2 ** (2 ** 7) might overflow. How big can radix-16 exponents get? Log_Power : constant array (Expbits) of Integer := (1, 2, 4, 8, 16, 32, 64); R_Power : constant array (Expbits) of T := (Rad ** 1, Rad ** 2, Rad ** 4, Rad ** 8, Rad ** 16, Rad ** 32, Rad ** 64); R_Neg_Power : constant array (Expbits) of T := (Invrad ** 1, Invrad ** 2, Invrad ** 4, Invrad ** 8, Invrad ** 16, Invrad ** 32, Invrad ** 64); ----------------------- -- Local Subprograms -- ----------------------- procedure Decompose (XX : T; Frac : out T; Expo : out UI); -- Decomposes a floating-point number into fraction and exponent parts. -- Both results are signed, with Frac having the sign of XX, and UI has -- the sign of the exponent. The absolute value of Frac is in the range -- 0.0 <= Frac < 1.0. If Frac = 0.0 or -0.0, then Expo is always zero. function Gradual_Scaling (Adjustment : UI) return T; -- Like Scaling with a first argument of 1.0, but returns the smallest -- denormal rather than zero when the adjustment is smaller than -- Machine_Emin. Used for Succ and Pred. -------------- -- Adjacent -- -------------- function Adjacent (X, Towards : T) return T is begin if Towards = X then return X; elsif Towards > X then return Succ (X); else return Pred (X); end if; end Adjacent; ------------- -- Ceiling -- ------------- function Ceiling (X : T) return T is XT : constant T := Truncation (X); begin if X <= 0.0 then return XT; elsif X = XT then return X; else return XT + 1.0; end if; end Ceiling; ------------- -- Compose -- ------------- function Compose (Fraction : T; Exponent : UI) return T is Arg_Frac : T; Arg_Exp : UI; pragma Unreferenced (Arg_Exp); begin Decompose (Fraction, Arg_Frac, Arg_Exp); return Scaling (Arg_Frac, Exponent); end Compose; --------------- -- Copy_Sign -- --------------- function Copy_Sign (Value, Sign : T) return T is Result : T; function Is_Negative (V : T) return Boolean; pragma Import (Intrinsic, Is_Negative); begin Result := abs Value; if Is_Negative (Sign) then return -Result; else return Result; end if; end Copy_Sign; --------------- -- Decompose -- --------------- procedure Decompose (XX : T; Frac : out T; Expo : out UI) is X : constant T := T'Machine (XX); begin if X = 0.0 then -- The normalized exponent of zero is zero, see RM A.5.2(15) Frac := X; Expo := 0; -- Check for infinities, transfinites, whatnot elsif X > T'Safe_Last then Frac := Invrad; Expo := T'Machine_Emax + 1; elsif X < T'Safe_First then Frac := -Invrad; Expo := T'Machine_Emax + 2; -- how many extra negative values? else -- Case of nonzero finite x. Essentially, we just multiply -- by Rad ** (+-2**N) to reduce the range. declare Ax : T := abs X; Ex : UI := 0; -- Ax * Rad ** Ex is invariant begin if Ax >= 1.0 then while Ax >= R_Power (Expbits'Last) loop Ax := Ax * R_Neg_Power (Expbits'Last); Ex := Ex + Log_Power (Expbits'Last); end loop; -- Ax < Rad ** 64 for N in reverse Expbits'First .. Expbits'Last - 1 loop if Ax >= R_Power (N) then Ax := Ax * R_Neg_Power (N); Ex := Ex + Log_Power (N); end if; -- Ax < R_Power (N) end loop; -- 1 <= Ax < Rad Ax := Ax * Invrad; Ex := Ex + 1; else -- 0 < ax < 1 while Ax < R_Neg_Power (Expbits'Last) loop Ax := Ax * R_Power (Expbits'Last); Ex := Ex - Log_Power (Expbits'Last); end loop; -- Rad ** -64 <= Ax < 1 for N in reverse Expbits'First .. Expbits'Last - 1 loop if Ax < R_Neg_Power (N) then Ax := Ax * R_Power (N); Ex := Ex - Log_Power (N); end if; -- R_Neg_Power (N) <= Ax < 1 end loop; end if; Frac := (if X > 0.0 then Ax else -Ax); Expo := Ex; end; end if; end Decompose; -------------- -- Exponent -- -------------- function Exponent (X : T) return UI is X_Frac : T; X_Exp : UI; pragma Unreferenced (X_Frac); begin Decompose (X, X_Frac, X_Exp); return X_Exp; end Exponent; ----------- -- Floor -- ----------- function Floor (X : T) return T is XT : constant T := Truncation (X); begin if X >= 0.0 then return XT; elsif XT = X then return X; else return XT - 1.0; end if; end Floor; -------------- -- Fraction -- -------------- function Fraction (X : T) return T is X_Frac : T; X_Exp : UI; pragma Unreferenced (X_Exp); begin Decompose (X, X_Frac, X_Exp); return X_Frac; end Fraction; --------------------- -- Gradual_Scaling -- --------------------- function Gradual_Scaling (Adjustment : UI) return T is Y : T; Y1 : T; Ex : UI := Adjustment; begin if Adjustment < T'Machine_Emin - 1 then Y := 2.0 ** T'Machine_Emin; Y1 := Y; Ex := Ex - T'Machine_Emin; while Ex < 0 loop Y := T'Machine (Y / 2.0); if Y = 0.0 then return Y1; end if; Ex := Ex + 1; Y1 := Y; end loop; return Y1; else return Scaling (1.0, Adjustment); end if; end Gradual_Scaling; ------------------ -- Leading_Part -- ------------------ function Leading_Part (X : T; Radix_Digits : UI) return T is L : UI; Y, Z : T; begin if Radix_Digits >= T'Machine_Mantissa then return X; elsif Radix_Digits <= 0 then raise Constraint_Error; else L := Exponent (X) - Radix_Digits; Y := Truncation (Scaling (X, -L)); Z := Scaling (Y, L); return Z; end if; end Leading_Part; ------------- -- Machine -- ------------- -- The trick with Machine is to force the compiler to store the result -- in memory so that we do not have extra precision used. The compiler -- is clever, so we have to outwit its possible optimizations. We do -- this by using an intermediate pragma Volatile location. function Machine (X : T) return T is Temp : T; pragma Volatile (Temp); begin Temp := X; return Temp; end Machine; ---------------------- -- Machine_Rounding -- ---------------------- -- For now, the implementation is identical to that of Rounding, which is -- a permissible behavior, but is not the most efficient possible approach. function Machine_Rounding (X : T) return T is Result : T; Tail : T; begin Result := Truncation (abs X); Tail := abs X - Result; if Tail >= 0.5 then Result := Result + 1.0; end if; if X > 0.0 then return Result; elsif X < 0.0 then return -Result; -- For zero case, make sure sign of zero is preserved else return X; end if; end Machine_Rounding; ----------- -- Model -- ----------- -- We treat Model as identical to Machine. This is true of IEEE and other -- nice floating-point systems, but not necessarily true of all systems. function Model (X : T) return T is begin return Machine (X); end Model; ---------- -- Pred -- ---------- function Pred (X : T) return T is X_Frac : T; X_Exp : UI; begin -- Zero has to be treated specially, since its exponent is zero if X = 0.0 then return -Succ (X); -- Special treatment for most negative number elsif X = T'First then -- If not generating infinities, we raise a constraint error if T'Machine_Overflows then raise Constraint_Error with "Pred of largest negative number"; -- Otherwise generate a negative infinity else return X / (X - X); end if; -- For infinities, return unchanged elsif X < T'First or else X > T'Last then return X; -- Subtract from the given number a number equivalent to the value -- of its least significant bit. Given that the most significant bit -- represents a value of 1.0 * radix ** (exp - 1), the value we want -- is obtained by shifting this by (mantissa-1) bits to the right, -- i.e. decreasing the exponent by that amount. else Decompose (X, X_Frac, X_Exp); -- A special case, if the number we had was a positive power of -- two, then we want to subtract half of what we would otherwise -- subtract, since the exponent is going to be reduced. -- Note that X_Frac has the same sign as X, so if X_Frac is 0.5, -- then we know that we have a positive number (and hence a -- positive power of 2). if X_Frac = 0.5 then return X - Gradual_Scaling (X_Exp - T'Machine_Mantissa - 1); -- Otherwise the exponent is unchanged else return X - Gradual_Scaling (X_Exp - T'Machine_Mantissa); end if; end if; end Pred; --------------- -- Remainder -- --------------- function Remainder (X, Y : T) return T is A : T; B : T; Arg : T; P : T; P_Frac : T; Sign_X : T; IEEE_Rem : T; Arg_Exp : UI; P_Exp : UI; K : UI; P_Even : Boolean; Arg_Frac : T; pragma Unreferenced (Arg_Frac); begin if Y = 0.0 then raise Constraint_Error; end if; if X > 0.0 then Sign_X := 1.0; Arg := X; else Sign_X := -1.0; Arg := -X; end if; P := abs Y; if Arg < P then P_Even := True; IEEE_Rem := Arg; P_Exp := Exponent (P); else Decompose (Arg, Arg_Frac, Arg_Exp); Decompose (P, P_Frac, P_Exp); P := Compose (P_Frac, Arg_Exp); K := Arg_Exp - P_Exp; P_Even := True; IEEE_Rem := Arg; for Cnt in reverse 0 .. K loop if IEEE_Rem >= P then P_Even := False; IEEE_Rem := IEEE_Rem - P; else P_Even := True; end if; P := P * 0.5; end loop; end if; -- That completes the calculation of modulus remainder. The final -- step is get the IEEE remainder. Here we need to compare Rem with -- (abs Y) / 2. We must be careful of unrepresentable Y/2 value -- caused by subnormal numbers if P_Exp >= 0 then A := IEEE_Rem; B := abs Y * 0.5; else A := IEEE_Rem * 2.0; B := abs Y; end if; if A > B or else (A = B and then not P_Even) then IEEE_Rem := IEEE_Rem - abs Y; end if; return Sign_X * IEEE_Rem; end Remainder; -------------- -- Rounding -- -------------- function Rounding (X : T) return T is Result : T; Tail : T; begin Result := Truncation (abs X); Tail := abs X - Result; if Tail >= 0.5 then Result := Result + 1.0; end if; if X > 0.0 then return Result; elsif X < 0.0 then return -Result; -- For zero case, make sure sign of zero is preserved else return X; end if; end Rounding; ------------- -- Scaling -- ------------- -- Return x * rad ** adjustment quickly, or quietly underflow to zero, -- or overflow naturally. function Scaling (X : T; Adjustment : UI) return T is begin if X = 0.0 or else Adjustment = 0 then return X; end if; -- Nonzero x essentially, just multiply repeatedly by Rad ** (+-2**n) declare Y : T := X; Ex : UI := Adjustment; -- Y * Rad ** Ex is invariant begin if Ex < 0 then while Ex <= -Log_Power (Expbits'Last) loop Y := Y * R_Neg_Power (Expbits'Last); Ex := Ex + Log_Power (Expbits'Last); end loop; -- -64 < Ex <= 0 for N in reverse Expbits'First .. Expbits'Last - 1 loop if Ex <= -Log_Power (N) then Y := Y * R_Neg_Power (N); Ex := Ex + Log_Power (N); end if; -- -Log_Power (N) < Ex <= 0 end loop; -- Ex = 0 else -- Ex >= 0 while Ex >= Log_Power (Expbits'Last) loop Y := Y * R_Power (Expbits'Last); Ex := Ex - Log_Power (Expbits'Last); end loop; -- 0 <= Ex < 64 for N in reverse Expbits'First .. Expbits'Last - 1 loop if Ex >= Log_Power (N) then Y := Y * R_Power (N); Ex := Ex - Log_Power (N); end if; -- 0 <= Ex < Log_Power (N) end loop; -- Ex = 0 end if; return Y; end; end Scaling; ---------- -- Succ -- ---------- function Succ (X : T) return T is X_Frac : T; X_Exp : UI; X1, X2 : T; begin -- Treat zero specially since it has a zero exponent if X = 0.0 then X1 := 2.0 ** T'Machine_Emin; -- Following loop generates smallest denormal loop X2 := T'Machine (X1 / 2.0); exit when X2 = 0.0; X1 := X2; end loop; return X1; -- Special treatment for largest positive number elsif X = T'Last then -- If not generating infinities, we raise a constraint error if T'Machine_Overflows then raise Constraint_Error with "Succ of largest negative number"; -- Otherwise generate a positive infinity else return X / (X - X); end if; -- For infinities, return unchanged elsif X < T'First or else X > T'Last then return X; -- Add to the given number a number equivalent to the value -- of its least significant bit. Given that the most significant bit -- represents a value of 1.0 * radix ** (exp - 1), the value we want -- is obtained by shifting this by (mantissa-1) bits to the right, -- i.e. decreasing the exponent by that amount. else Decompose (X, X_Frac, X_Exp); -- A special case, if the number we had was a negative power of two, -- then we want to add half of what we would otherwise add, since the -- exponent is going to be reduced. -- Note that X_Frac has the same sign as X, so if X_Frac is -0.5, -- then we know that we have a negative number (and hence a negative -- power of 2). if X_Frac = -0.5 then return X + Gradual_Scaling (X_Exp - T'Machine_Mantissa - 1); -- Otherwise the exponent is unchanged else return X + Gradual_Scaling (X_Exp - T'Machine_Mantissa); end if; end if; end Succ; ---------------- -- Truncation -- ---------------- -- The basic approach is to compute -- T'Machine (RM1 + N) - RM1 -- where N >= 0.0 and RM1 = radix ** (mantissa - 1) -- This works provided that the intermediate result (RM1 + N) does not -- have extra precision (which is why we call Machine). When we compute -- RM1 + N, the exponent of N will be normalized and the mantissa shifted -- shifted appropriately so the lower order bits, which cannot contribute -- to the integer part of N, fall off on the right. When we subtract RM1 -- again, the significant bits of N are shifted to the left, and what we -- have is an integer, because only the first e bits are different from -- zero (assuming binary radix here). function Truncation (X : T) return T is Result : T; begin Result := abs X; if Result >= Radix_To_M_Minus_1 then return Machine (X); else Result := Machine (Radix_To_M_Minus_1 + Result) - Radix_To_M_Minus_1; if Result > abs X then Result := Result - 1.0; end if; if X > 0.0 then return Result; elsif X < 0.0 then return -Result; -- For zero case, make sure sign of zero is preserved else return X; end if; end if; end Truncation; ----------------------- -- Unbiased_Rounding -- ----------------------- function Unbiased_Rounding (X : T) return T is Abs_X : constant T := abs X; Result : T; Tail : T; begin Result := Truncation (Abs_X); Tail := Abs_X - Result; if Tail > 0.5 then Result := Result + 1.0; elsif Tail = 0.5 then Result := 2.0 * Truncation ((Result / 2.0) + 0.5); end if; if X > 0.0 then return Result; elsif X < 0.0 then return -Result; -- For zero case, make sure sign of zero is preserved else return X; end if; end Unbiased_Rounding; ----------- -- Valid -- ----------- function Valid (X : not null access T) return Boolean is IEEE_Emin : constant Integer := T'Machine_Emin - 1; IEEE_Emax : constant Integer := T'Machine_Emax - 1; IEEE_Bias : constant Integer := -(IEEE_Emin - 1); subtype IEEE_Exponent_Range is Integer range IEEE_Emin - 1 .. IEEE_Emax + 1; -- The implementation of this floating point attribute uses a -- representation type Float_Rep that allows direct access to the -- exponent and mantissa parts of a floating point number. -- The Float_Rep type is an array of Float_Word elements. This -- representation is chosen to make it possible to size the type based -- on a generic parameter. Since the array size is known at compile -- time, efficient code can still be generated. The size of Float_Word -- elements should be large enough to allow accessing the exponent in -- one read, but small enough so that all floating point object sizes -- are a multiple of the Float_Word'Size. -- The following conditions must be met for all possible instantiations -- of the attributes package: -- - T'Size is an integral multiple of Float_Word'Size -- - The exponent and sign are completely contained in a single -- component of Float_Rep, named Most_Significant_Word (MSW). -- - The sign occupies the most significant bit of the MSW and the -- exponent is in the following bits. Unused bits (if any) are in -- the least significant part. type Float_Word is mod 2**Positive'Min (System.Word_Size, 32); type Rep_Index is range 0 .. 7; Rep_Words : constant Positive := (T'Size + Float_Word'Size - 1) / Float_Word'Size; Rep_Last : constant Rep_Index := Rep_Index'Min (Rep_Index (Rep_Words - 1), (T'Mantissa + 16) / Float_Word'Size); -- Determine the number of Float_Words needed for representing the -- entire floating-point value. Do not take into account excessive -- padding, as occurs on IA-64 where 80 bits floats get padded to 128 -- bits. In general, the exponent field cannot be larger than 15 bits, -- even for 128-bit floating-point types, so the final format size -- won't be larger than T'Mantissa + 16. type Float_Rep is array (Rep_Index range 0 .. Rep_Index (Rep_Words - 1)) of Float_Word; pragma Suppress_Initialization (Float_Rep); -- This pragma suppresses the generation of an initialization procedure -- for type Float_Rep when operating in Initialize/Normalize_Scalars -- mode. This is not just a matter of efficiency, but of functionality, -- since Valid has a pragma Inline_Always, which is not permitted if -- there are nested subprograms present. Most_Significant_Word : constant Rep_Index := Rep_Last * Standard'Default_Bit_Order; -- Finding the location of the Exponent_Word is a bit tricky. In general -- we assume Word_Order = Bit_Order. Exponent_Factor : constant Float_Word := 2**(Float_Word'Size - 1) / Float_Word (IEEE_Emax - IEEE_Emin + 3) * Boolean'Pos (Most_Significant_Word /= 2) + Boolean'Pos (Most_Significant_Word = 2); -- Factor that the extracted exponent needs to be divided by to be in -- range 0 .. IEEE_Emax - IEEE_Emin + 2. Special case: Exponent_Factor -- is 1 for x86/IA64 double extended (GCC adds unused bits to the type). Exponent_Mask : constant Float_Word := Float_Word (IEEE_Emax - IEEE_Emin + 2) * Exponent_Factor; -- Value needed to mask out the exponent field. This assumes that the -- range IEEE_Emin - 1 .. IEEE_Emax + contains 2**N values, for some N -- in Natural. function To_Float is new Ada.Unchecked_Conversion (Float_Rep, T); type Float_Access is access all T; function To_Address is new Ada.Unchecked_Conversion (Float_Access, System.Address); XA : constant System.Address := To_Address (Float_Access (X)); R : Float_Rep; pragma Import (Ada, R); for R'Address use XA; -- R is a view of the input floating-point parameter. Note that we -- must avoid copying the actual bits of this parameter in float -- form (since it may be a signalling NaN). E : constant IEEE_Exponent_Range := Integer ((R (Most_Significant_Word) and Exponent_Mask) / Exponent_Factor) - IEEE_Bias; -- Mask/Shift T to only get bits from the exponent. Then convert biased -- value to integer value. SR : Float_Rep; -- Float_Rep representation of significant of X.all begin if T'Denorm then -- All denormalized numbers are valid, so the only invalid numbers -- are overflows and NaNs, both with exponent = Emax + 1. return E /= IEEE_Emax + 1; end if; -- All denormalized numbers except 0.0 are invalid -- Set exponent of X to zero, so we end up with the significand, which -- definitely is a valid number and can be converted back to a float. SR := R; SR (Most_Significant_Word) := (SR (Most_Significant_Word) and not Exponent_Mask) + Float_Word (IEEE_Bias) * Exponent_Factor; return (E in IEEE_Emin .. IEEE_Emax) or else ((E = IEEE_Emin - 1) and then abs To_Float (SR) = 1.0); end Valid; end System.Fat_Gen;
with Ada.Integer_Text_IO, Ada.Containers.Doubly_Linked_Lists; use Ada.Integer_Text_IO, Ada.Containers; procedure Doubly_Linked_List is package DL_List_Pkg is new Doubly_Linked_Lists (Integer); use DL_List_Pkg; procedure Print_Node (Position : Cursor) is begin Put (Element (Position)); end Print_Node; DL_List : List; begin DL_List.Append (1); DL_List.Append (2); DL_List.Append (3); -- Iterates through every node of the list. DL_List.Iterate (Print_Node'Access); end Doubly_Linked_List;
with Ada.Numerics.Big_Numbers.Big_Integers; use Ada.Numerics.Big_Numbers.Big_Integers; with Ada.Containers.Vectors; package Primes is function Is_Prime (N : Natural) return Boolean; function Is_Prime (N : Big_Natural) return Boolean; package Prime_Vectors is new Ada.Containers.Vectors (Index_Type => Natural, Element_Type => Natural); package Big_Prime_Vectors is new Ada.Containers.Vectors (Index_Type => Natural, Element_Type => Big_Natural); function Get_Primes (Limit : Natural) return Prime_Vectors.Vector; function Get_Primes (Limit : Big_Natural) return Big_Prime_Vectors.Vector; end Primes;
package impact.d2.Contact.polygon -- -- -- is type b2PolygonContact is new b2Contact with null record; type View is access all b2PolygonContact'Class; overriding procedure Evaluate (Self : in out b2PolygonContact; manifold : access collision.b2Manifold; xfA, xfB : in b2Transform); function Create (fixtureA, fixtureB : access Fixture.b2Fixture) return access b2Contact'Class; procedure Destroy (contact : in out impact.d2.Contact.view); -- class b2PolygonContact : public b2Contact -- { -- public: -- -- b2PolygonContact(b2Fixture* fixtureA, b2Fixture* fixtureB); -- ~b2PolygonContact() {} -- -- void Evaluate(b2Manifold* manifold, const b2Transform& xfA, const b2Transform& xfB); -- }; -- -- #endif end impact.d2.Contact.polygon;
PROCEDURE Inherited_Primitive_Operation IS PACKAGE Inner IS TYPE PARENT IS ARRAY (INTEGER RANGE <>) OF float; FUNCTION CREATE ( F, L : INTEGER; TYPETAG : PARENT -- TO RESOLVE OVERLOADING. ) RETURN PARENT; END Inner; TYPE T IS NEW Inner.PARENT (5 .. 7); X : T := (OTHERS => 2.0); PACKAGE BODY Inner IS FUNCTION CREATE ( F, L : INTEGER; TYPETAG : PARENT ) RETURN PARENT IS A : PARENT (F .. L) := (others => 0.0); BEGIN RETURN A; END CREATE; END Inner; BEGIN -- CREATE MUST NOT HAVE A PREFIX X := CREATE(2, 4, X); END Inherited_Primitive_Operation;
------------------------------------------------------------------------------- -- Copyright (c) 2019, Daniel King -- 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 name of the copyright holder 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 HOLDER BE LIABLE FOR ANY -- DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES -- (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -- LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND -- ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -- (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF -- THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. ------------------------------------------------------------------------------- with Keccak.Types; -- @summary -- Implements the sponge construction. -- -- @description -- The sponge construction is defined in Section 2.2 of "Cryptographic Sponge -- Functions" (see also Section 4 of NIST FIPS 202). -- -- This package is generic and can be used with any fixed-length transformation -- permutation (such as Keccak). The following formal generics are required to -- define the state, and the operations on the state which are required by the -- sponge: -- * The type of the state is defined by the 'State' parameter. -- * The bit-length of the state is defined by the 'State_Size_Bits' parameter. -- * The 'Init_State' procedure initializes the state to zeroes. -- * The 'XOR_Bits_Into_State' procedure XORs bits into the state. -- * The 'Permute' procedure permutes the state. -- * The 'Extract_Data' procedure converts all or part of the state into a byte -- array. -- -- Additionally, the 'Pad' procedure provides the padding rule, which adds -- padding bits into a block of data (the padding may spill over into another -- block if there is not enough free bits in the first provided block). -- -- @group Sponge generic -- Size of the Sponge state in bits (e.g. 1600 for Keccak[1600]) State_Size_Bits : Positive; -- Type for the internal state. type State_Type is private; -- Procedure to initialize the state with procedure Init_State (A : out State_Type); -- Procedure to permute the state with procedure Permute (A : in out State_Type); -- Procedure to XOR bits into the internal state. with procedure XOR_Bits_Into_State (A : in out State_Type; Data : in Keccak.Types.Byte_Array; Bit_Len : in Natural); -- Extracts a block of output from the state with procedure Extract_Data (A : in State_Type; Data : out Keccak.Types.Byte_Array); -- Padding rule with procedure Pad (First_Block : in out Keccak.Types.Byte_Array; Num_Used_Bits : in Natural; Max_Bit_Length : in Natural; Next_Block : out Keccak.Types.Byte_Array; Spilled : out Boolean); package Keccak.Generic_Sponge is Block_Size_Bits : constant Positive := State_Size_Bits; type States is (Absorbing, Squeezing); type Context is private; subtype Rate_Bits_Number is Positive range 1 .. State_Size_Bits - 1 with Dynamic_Predicate => Rate_Bits_Number mod 8 = 0; -- Number representing the Rate (in bits). -- -- The Rate must be a positive integer, and less than the size of the -- state (i.e. there must be at least 1 bit of "capacity"). Furthermore, -- this implementation restricts the Rate to a multiple of 8 bits. ------------------------ -- Sponge procedures -- ------------------------ procedure Init (Ctx : out Context; Capacity : in Positive; Initial_Data : in Keccak.Types.Byte_Array := Keccak.Types.Null_Byte_Array) with Global => null, Pre => (((State_Size_Bits - Capacity) mod 8 = 0) and (Capacity < State_Size_Bits) and Initial_Data'Length <= State_Size_Bits / 8), Post => ((State_Of (Ctx) = Absorbing) and (Rate_Of (Ctx) = State_Size_Bits - Capacity) and In_Queue_Bit_Length (Ctx) = 0); -- Initialize the context with the specified capacity. -- -- The following example demonstrates initializing a sponge with a capacity -- of 512 bits: -- Init(Ctx, 512); -- -- After initialization, the sponge is in the Absorbing state. Bits are -- absorbed into the sponge using the Absorb procedure. Alternatively, it -- is possible to immediately squeeze data from the sponge using the Squeeze -- procedure, without first absorbing any data into the sponge. -- -- @param Ctx The sponge context to initialize. -- -- @param Capacity The sponge's capacity (in bits). The capacity has the -- following requirements: -- * Must be positive -- * Must be strictly smaller than the State_Size_Bits -- * Must be a multiple of 8 (this is a requirement for this implementation) function State_Of (Ctx : in Context) return States with Global => null; -- Gets the current state of the sponge. -- -- The sponge has two states: Absorbing and Squeezing. Initially the sponge -- in the Absorbing state, where bits can be absorbed into the sponge using -- the Absorb procedure. The sponge can move into the Squeezing state at -- any time by calling the Squeeze procedure. -- -- Once in the Squeezing state the sponge cannot move back into the Absorbing -- state. However, the same sponge context can be re-used for a different -- computation by re-initializing the sponge. -- -- @return The current state of the sponge. function Rate_Of (Ctx : in Context) return Rate_Bits_Number with Global => null; -- Gets the currently configured rate of the sponge. -- -- The rate is derived from the sponge's capacity and the State_Size_Bits. -- -- @return The sponge's rate, in bits. procedure Absorb (Ctx : in out Context; Data : in Keccak.Types.Byte_Array; Bit_Length : in Natural) with Global => null, Depends => (Ctx =>+ (Data, Bit_Length)), Pre => (State_Of (Ctx) = Absorbing and then Bit_Length <= Natural'Last - 7 and then (Bit_Length + 7) / 8 <= Data'Length and then In_Queue_Bit_Length (Ctx) mod 8 = 0 and then In_Queue_Bit_Length (Ctx) < Rate_Of (Ctx)), Post => (State_Of (Ctx) = Absorbing and Rate_Of (Ctx) = Rate_Of (Ctx'Old) and (In_Queue_Bit_Length (Ctx) mod 8) = (Bit_Length mod 8) and In_Queue_Bit_Length (Ctx) < Rate_Of (Ctx)); -- Absorb (input) bits into the sponge. -- -- This procedure can be called multiple times to absorb large amounts of -- data in chunks. -- -- @param Ctx The sponge context to where the data will be absorbed. -- -- @param Data Contains the data to absorb into the sponge. -- -- @param Bit_Length The number of bits from the 'Data' array to absorb -- into the sponge. The length of the 'Data' array must contain at least -- this many bits. E.g. if Bit_Length is 20 then Data'Length must be at -- least 3 bytes. procedure Absorb_With_Suffix (Ctx : in out Context; Message : in Keccak.Types.Byte_Array; Bit_Length : in Natural; Suffix : in Keccak.Types.Byte; Suffix_Len : in Natural) with Global => null, Pre => (State_Of (Ctx) = Absorbing and then Suffix_Len <= 8 and then Bit_Length <= Natural'Last - 8 and then (Bit_Length + 7) / 8 <= Message'Length and then In_Queue_Bit_Length (Ctx) mod 8 = 0 and then In_Queue_Bit_Length (Ctx) < Rate_Of (Ctx)), Post => (State_Of (Ctx) = Absorbing and Rate_Of (Ctx) = Rate_Of (Ctx'Old) and (In_Queue_Bit_Length (Ctx) mod 8) = ((Bit_Length + Suffix_Len) mod 8) and In_Queue_Bit_Length (Ctx) < Rate_Of (Ctx)); -- Concatenate up to 8 suffix bits to a message, then absorb the resulting -- concatenated data into the sponge. -- -- Typically this procedure is called before the first call to Squeeze in -- cases where there are additional bits to be appended before the padding. -- One example is SHA3, which appends the bits 11 to each message before -- the padding bits are appended. An example of using this procedure to -- absorb the final data into the sponge is shown below: -- Absorb_With_Suffix(Ctx, -- Message, -- Message'Length * 8, -- bit length of the message -- 2#11#, -- Concatenate the bits 11 onto the message -- 2); -- The suffix is two bits in length -- -- In pseudo-code, this procedure is functionally equivalent to: -- Absorb(Ctx, Message || 11); -- -- @param Ctx The sponge context into which the bits will be absorbed. -- -- @param Message Byte array containing the data to absorb. -- -- @param Bit_Length The number of bits in 'Message' to absorb into the sponge. -- -- @param Suffix A byte containing the suffix bits to append to the message. -- The least significant bit in this byte is the first bit that is appended. -- -- @param Suffix_Len The number of bits from the 'Suffix' byte to append. -- Up to 8 additional bits can be absorbed, and Suffix_Len can be set to 0 -- if no additional bits should be absorbed. procedure Squeeze (Ctx : in out Context; Digest : out Keccak.Types.Byte_Array) with Global => null, Depends => ((Ctx, Digest) => (Ctx, Digest)), Post => (State_Of (Ctx) = Squeezing and Rate_Of (Ctx) = Rate_Of (Ctx'Old)); pragma Annotate (GNATprove, False_Positive, """Digest"" might not be initialized", "Digest is fully initialized by the end of the subprogram"); -- Squeeze (output) bits from the sponge. -- -- Squeeze can be called multiple times to extract an arbitrary amount of -- output bytes. -- -- Note that after calling Squeeze it is not possible to absorb any more -- data into the sponge. -- -- @param Ctx The context from where the data will be squeezed. -- -- @param Digest This array is filled with bytes squeezed from the sponge. -- This array can be of any length. function In_Queue_Bit_Length (Ctx : in Context) return Natural with Global => null, Post => In_Queue_Bit_Length'Result < State_Size_Bits; -- Get the number of bits which are waiting in the input queue, and have -- not yet been absorbed into the sponge. -- -- The purpose of this function is to aid in the definition of the -- preconditions and postconditions private -- The rate number here represents bytes, not bits. -- This makes it easier to handle in proof, since bytes are -- always a multiple of 8 bits. subtype Rate_Bytes_Number is Positive range 1 .. ((State_Size_Bits + 7) / 8) - 1; subtype Byte_Absorption_Number is Natural range 0 .. ((State_Size_Bits + 7) / 8) - 1; subtype Bit_Absorption_Number is Natural range 0 .. State_Size_Bits - 1; subtype Block_Type is Keccak.Types.Byte_Array (Byte_Absorption_Number); subtype Suffix_Bits_Number is Natural range 0 .. 8; type Context is record -- The sponge state. State : State_Type; -- Input/output queue. -- -- When absorbing, this buffer holds data which is waiting to be absorbed. -- When squeezing, this buffer holds squeezed bytes which are waiting to -- be read by calling Squeeze. Block : Block_Type; -- While absorbing, this keeps track of the number of bits in the input -- queue that are waiting to be absorbed. Bits_Absorbed : Bit_Absorption_Number; -- While squeezing, this keeps track of the number of bytes -- that have been extracted from output queue. Once this value reaches -- the rate, then the next block of output is generated and Bytes_Squeezed -- is reset to 0. Bytes_Squeezed : Byte_Absorption_Number; -- True if the data in the 'Block' buffer contain valid output data. Out_Bytes_Ready : Boolean; -- The rate parameter. This value is represented in bytes, not bits -- so that it is easier to manage in proof. Rate : Rate_Bytes_Number; -- The current state of the sponge (Absorbing or Squeezing). Curr_State : States; end record; ---------------------------------- -- Sponge Expression functions -- ---------------------------------- function State_Of (Ctx : in Context) return States is (Ctx.Curr_State); function Rate_Of (Ctx : in Context) return Rate_Bits_Number is (Positive (Ctx.Rate) * 8); function In_Queue_Bit_Length (Ctx : in Context) return Natural is (Ctx.Bits_Absorbed); end Keccak.Generic_Sponge;
package body Tagged_Type_Pkg is function Pass_TT_Access (Obj : access TT'Class) return access TT'Class is begin if Obj = null then return null; else -- The implicit conversion in the assignment to the return object -- must fail if Obj's actual is not a library-level object. return TT_Acc : access TT'Class := Obj do TT_Acc := TT_Acc.Self; end return; end if; end Pass_TT_Access; end Tagged_Type_Pkg;
-- { dg-do compile } -- { dg-options "-O2" } with Opt10_Pkg; use Opt10_Pkg; procedure Opt10 is procedure Compare_Rep_Data (MA, MB : Rep_Message) is begin if MA.Data /= MB.Data then raise Program_Error; end if; end; procedure Check_Rep_For (Bit : Boolean) is MA, MB : Rep_Message; begin Safe_Assign (MA, Bit); Safe_Assign (MB, Bit); Compare_Rep_Data (MA, MB); end; begin Check_Rep_For (Bit => False); end;
------------------------------------------------------------------------------ -- -- -- Matreshka Project -- -- -- -- Localization, Internationalization, Globalization for Ada -- -- -- -- Tools Component -- -- -- ------------------------------------------------------------------------------ -- -- -- Copyright © 2010, Vadim Godunko <vgodunko@gmail.com> -- -- All rights reserved. -- -- -- -- Redistribution and use in source and binary forms, with or without -- -- modification, are permitted provided that the following conditions -- -- are met: -- -- -- -- * Redistributions of source code must retain the above copyright -- -- notice, this list of conditions and the following disclaimer. -- -- -- -- * Redistributions in binary form must reproduce the above copyright -- -- notice, this list of conditions and the following disclaimer in the -- -- documentation and/or other materials provided with the distribution. -- -- -- -- * Neither the name of the Vadim Godunko, IE nor the names of its -- -- contributors may be used to endorse or promote products derived from -- -- this software without specific prior written permission. -- -- -- -- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -- -- "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -- -- LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -- -- A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -- -- HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -- -- SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED -- -- TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -- -- PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -- -- LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -- -- NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -- -- SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -- -- -- ------------------------------------------------------------------------------ -- $Revision$ $Date$ ------------------------------------------------------------------------------ with Ada.Command_Line; with Ada.Directories; with Ada.Integer_Wide_Text_IO; with Ada.Strings.Wide_Unbounded.Wide_Text_IO; with Ada.Wide_Text_IO; with Token_Extractor; package body Token_Generator is use Ada.Integer_Wide_Text_IO; use Ada.Strings.Wide_Unbounded.Wide_Text_IO; use Ada.Wide_Text_IO; use Token_Extractor; function Tokens_File_Name return String; -- Returns file name of the output file. function Tokens_Template_File_Name return String; -- Returns file name of the input template file. ---------------------------- -- Generate_Parser_Tokens -- ---------------------------- procedure Generate_Parser_Tokens is Input : File_Type; Output : File_Type; Buffer : Wide_String (1 .. 1024); Last : Natural; begin Open (Input, In_File, Tokens_Template_File_Name, "wcem=8"); Create (Output, Out_File, Tokens_File_Name, "wcem=8"); while not End_Of_File (Input) loop Get_Line (Input, Buffer, Last); if Buffer (1 .. Last) = "%%" then Put_Line (Output, " type Token is"); for J in 1 .. Natural (Tokens.Length) loop if J = 1 then Put (Output, " ("); else Put_Line (Output, ","); Put (Output, " "); end if; Put (Output, Tokens.Element (J)); end loop; Put_Line (Output, ");"); else Put_Line (Output, Buffer (1 .. Last)); end if; end loop; Close (Output); Close (Input); end Generate_Parser_Tokens; ---------------------- -- Tokens_File_Name -- ---------------------- function Tokens_File_Name return String is Template : constant String := Ada.Directories.Simple_Name (Tokens_Template_File_Name); begin return Template (Template'First .. Template'Last - 3); end Tokens_File_Name; ------------------------------- -- Tokens_Template_File_Name -- ------------------------------- function Tokens_Template_File_Name return String is begin return Ada.Command_Line.Argument (3); end Tokens_Template_File_Name; end Token_Generator;
-- NORX_Load_Store -- A collection of functions to load and store words of different sizes from -- Storage_Array in Little Endian format. Currently these are not optimised -- for the case where the machine itself is LE or has dedicated assembly -- instructions that can perform the conversion. -- Copyright (c) 2016-2017, James Humphry - see LICENSE file for details -- Note that all the Unsigned_xx types count as Implementation_Identifiers pragma Restrictions(No_Implementation_Attributes, No_Implementation_Units, No_Obsolescent_Features); with System.Storage_Elements; use System.Storage_Elements; with Interfaces; use Interfaces; package NORX_Load_Store with Pure, SPARK_Mode => On is subtype E is Storage_Element; subtype Storage_Array_Single is Storage_Array(1..1); function Check_Storage_Array_Length (X : in Storage_Array; L : in Positive) return Boolean is ( if X'Last < X'First then False elsif X'First < 0 then ( (Long_Long_Integer (X'Last) < Long_Long_Integer'Last + Long_Long_Integer (X'First)) and then X'Last - X'First = Storage_Offset(L) - 1) else X'Last - X'First = Storage_Offset(L) - 1 ) with Ghost; function Storage_Array_To_Unsigned_8 (S : in Storage_Array) return Unsigned_8 is (Unsigned_8(S(S'First))) with Inline, Pre => (Check_Storage_Array_Length(S, 1)); function Unsigned_8_To_Storage_Array (W : in Unsigned_8) return Storage_Array is (Storage_Array_Single'(Storage_Array_Single'First => E(W))) with Inline, Post => (Unsigned_8_To_Storage_Array'Result'Length = 1); function Storage_Array_To_Unsigned_16 (S : in Storage_Array) return Unsigned_16 is (Unsigned_16(S(S'First)) or Shift_Left(Unsigned_16(S(S'First + 1)), 8)) with Inline, Pre => (Check_Storage_Array_Length(S, 2)); function Unsigned_16_To_Storage_Array (W : in Unsigned_16) return Storage_Array is (Storage_Array'(E(W mod 16#100#), E(Shift_Right(W, 8) mod 16#100#))) with Inline, Post => (Unsigned_16_To_Storage_Array'Result'Length = 2); function Storage_Array_To_Unsigned_32 (S : in Storage_Array) return Unsigned_32 is (Unsigned_32(S(S'First)) or Shift_Left(Unsigned_32(S(S'First + 1)), 8) or Shift_Left(Unsigned_32(S(S'First + 2)), 16) or Shift_Left(Unsigned_32(S(S'First + 3)), 24)) with Inline, Pre => (Check_Storage_Array_Length(S, 4)); function Unsigned_32_To_Storage_Array (W : in Unsigned_32) return Storage_Array is (Storage_Array'(E(W mod 16#100#), E(Shift_Right(W, 8) mod 16#100#), E(Shift_Right(W, 16) mod 16#100#), E(Shift_Right(W, 24) mod 16#100#))) with Inline, Post => (Unsigned_32_To_Storage_Array'Result'Length = 4); function Storage_Array_To_Unsigned_64 (S : in Storage_Array) return Unsigned_64 is (Unsigned_64(S(S'First)) or Shift_Left(Unsigned_64(S(S'First + 1)), 8) or Shift_Left(Unsigned_64(S(S'First + 2)), 16) or Shift_Left(Unsigned_64(S(S'First + 3)), 24) or Shift_Left(Unsigned_64(S(S'First + 4)), 32) or Shift_Left(Unsigned_64(S(S'First + 5)), 40) or Shift_Left(Unsigned_64(S(S'First + 6)), 48) or Shift_Left(Unsigned_64(S(S'First + 7)), 56)) with Inline, Pre => (Check_Storage_Array_Length(S, 8)); function Unsigned_64_To_Storage_Array (W : in Unsigned_64) return Storage_Array is (Storage_Array'(E(W mod 16#100#), E(Shift_Right(W, 8) mod 16#100#), E(Shift_Right(W, 16) mod 16#100#), E(Shift_Right(W, 24) mod 16#100#), E(Shift_Right(W, 32) mod 16#100#), E(Shift_Right(W, 40) mod 16#100#), E(Shift_Right(W, 48) mod 16#100#), E(Shift_Right(W, 56) mod 16#100#))) with Inline, Post => (Unsigned_64_To_Storage_Array'Result'Length = 8); end NORX_Load_Store;
-- This file is covered by the Internet Software Consortium (ISC) License -- Reference: ../License.txt -- To enable ncurses support, use sed to change Options_Dialog_Console => Options_Dialog with Ada.Characters.Latin_1; with Ada.Strings.Fixed; with Ada.Command_Line; with Ada.Directories; with Ada.Calendar; with Ada.Text_IO; with Ada.Exceptions; with Specification_Parser; with File_Operations.Heap; with Information; with Parameters; with Replicant; with Configure; with Utilities; with Signals; with Unix; with Port_Specification.Buildsheet; with Port_Specification.Makefile; with Port_Specification.Transform; with Port_Specification.Web; with PortScan.Operations; with PortScan.Buildcycle; with PortScan.Scan; with PortScan.Log; with Package_Manifests; with Options_Dialog_Console; with Ravenports; with Repository; package body Pilot is package UTL renames Utilities; package REP renames Replicant; package PM renames Parameters; package NFO renames Information; package FOP renames File_Operations; package PAR renames Specification_Parser; package PSB renames Port_Specification.Buildsheet; package PSM renames Port_Specification.Makefile; package PST renames Port_Specification.Transform; package WEB renames Port_Specification.Web; package OPS renames PortScan.Operations; package CYC renames PortScan.Buildcycle; package SCN renames PortScan.Scan; package LOG renames PortScan.Log; package MAN renames Package_Manifests; package OPT renames Options_Dialog_Console; package LAT renames Ada.Characters.Latin_1; package CLI renames Ada.Command_Line; package DIR renames Ada.Directories; package CAL renames Ada.Calendar; package TIO renames Ada.Text_IO; package AS renames Ada.Strings; package EX renames Ada.Exceptions; -------------------------------------------------------------------------------------------- -- display_usage -------------------------------------------------------------------------------------------- procedure display_usage is begin NFO.display_usage; end display_usage; -------------------------------------------------------------------------------------------- -- react_to_unknown_first_level_command -------------------------------------------------------------------------------------------- procedure react_to_unknown_first_level_command (argument : String) is begin NFO.display_unknown_command (argument); end react_to_unknown_first_level_command; -------------------------------------------------------------------------------------------- -- react_to_unknown_second_level_command -------------------------------------------------------------------------------------------- procedure react_to_unknown_second_level_command (level1, level2 : String) is begin NFO.display_unknown_command (level1, level2); end react_to_unknown_second_level_command; -------------------------------------------------------------------------------------------- -- show_short_help -------------------------------------------------------------------------------------------- procedure show_short_help is begin NFO.short_help_screen; end show_short_help; -------------------------------------------------------------------------------------------- -- launch_man_page -------------------------------------------------------------------------------------------- procedure launch_man_page (level2 : String) is function man_command return String; result : Boolean; level2ok : Boolean := False; man_page : constant String := host_localbase & "/share/man/man8/ravenadm-" & level2 & ".8.gz"; function man_command return String is begin case platform_type is when sunos => return host_localbase & "/bin/man 8 ravenadm-" & level2; when others => return "/usr/bin/man " & man_page; end case; end man_command; begin if level2 = "dev" or else level2 = "build" or else level2 = "build-everything" or else level2 = "force" or else level2 = "test" or else level2 = "test-everything" or else level2 = "status" or else level2 = "status-everything" or else level2 = "configure" or else level2 = "locate" or else level2 = "purge-distfiles" or else level2 = "purge-logs" or else level2 = "set-options" or else level2 = "check-ports" or else level2 = "update-ports" or else level2 = "generate-repository" or else level2 = "generate-website" or else level2 = "subpackages" then if DIR.Exists (man_page) then result := Unix.external_command (man_command); else TIO.Put_Line (errprefix & "the " & level2 & " man page is missing"); end if; else TIO.Put_Line ("'" & level2 & "' is not a valid command (so no help is available)"); end if; end launch_man_page; -------------------------------------------------------------------------------------------- -- dump_ravensource -------------------------------------------------------------------------------------------- procedure dump_ravensource (optional_directory : String) is directory_specified : constant Boolean := (optional_directory /= ""); successful : Boolean; specification : Port_Specification.Portspecs; begin if directory_specified then declare filename : String := optional_directory & "/" & specfile; begin if DIR.Exists (filename) then PAR.parse_specification_file (dossier => filename, spec => specification, opsys_focus => platform_type, arch_focus => sysrootver.arch, success => successful, stop_at_targets => False); else DNE (filename); return; end if; end; else if DIR.Exists (specfile) then PAR.parse_specification_file (dossier => specfile, spec => specification, opsys_focus => platform_type, arch_focus => sysrootver.arch, success => successful, stop_at_targets => False); else DNE (specfile); return; end if; end if; if successful then specification.dump_specification; else TIO.Put_Line ("dump_ravensource < " & errprefix & "Failed to parse " & specfile); TIO.Put_Line (specification.get_parse_error); end if; end dump_ravensource; -------------------------------------------------------------------------------------------- -- list_subpackages -------------------------------------------------------------------------------------------- procedure list_subpackages is successful : Boolean := SCN.scan_provided_list_of_ports (False, sysrootver); begin if successful then OPS.list_subpackages_of_queued_ports; end if; end list_subpackages; -------------------------------------------------------------------------------------------- -- generate_makefile -------------------------------------------------------------------------------------------- procedure generate_makefile (optional_directory : String; optional_variant : String) is function get_variant return String; directory_specified : constant Boolean := (optional_directory /= ""); successful : Boolean; specification : Port_Specification.Portspecs; dossier_text : HT.Text; function get_variant return String is begin if optional_variant = "" then return variant_standard; else return optional_variant; end if; end get_variant; selected_variant : constant String := get_variant; begin if directory_specified then dossier_text := HT.SUS (optional_directory & "/" & specfile); else dossier_text := HT.SUS (specfile); end if; if DIR.Exists (HT.USS (dossier_text)) then OPS.parse_and_transform_buildsheet (specification => specification, successful => successful, buildsheet => HT.USS (dossier_text), variant => selected_variant, portloc => "", excl_targets => False, avoid_dialog => True, for_webpage => False, sysrootver => sysrootver); else DNE (HT.USS (dossier_text)); return; end if; if successful then if not specification.post_transform_option_group_defaults_passes then return; end if; PSM.generator (specs => specification, variant => selected_variant, opsys => platform_type, arch => sysrootver.arch, output_file => ""); else TIO.Put_Line ("generate_makefile < " & errprefix & "Failed to parse " & specfile); TIO.Put_Line (specification.get_parse_error); end if; end generate_makefile; -------------------------------------------------------------------------------------------- -- generate_webpage -------------------------------------------------------------------------------------------- procedure generate_webpage (required_namebase : String; optional_variant : String) is function get_variant return String; successful : Boolean; specification : Port_Specification.Portspecs; bogustime : constant CAL.Time := CAL.Clock; dossier : constant String := HT.USS (PM.configuration.dir_conspiracy) & "/bucket_" & UTL.bucket (required_namebase) & "/" & required_namebase; function get_variant return String is begin if optional_variant = "" then return variant_standard; else return optional_variant; end if; end get_variant; begin if DIR.Exists (dossier) then REP.launch_workzone; OPS.parse_and_transform_buildsheet (specification => specification, successful => successful, buildsheet => dossier, variant => get_variant, portloc => REP.get_workzone_path, excl_targets => False, avoid_dialog => True, for_webpage => True, sysrootver => sysrootver); else DNE (dossier); return; end if; if successful then WEB.produce_page (specs => specification, variant => get_variant, dossier => TIO.Standard_Output, portdir => REP.get_workzone_path, blocked => "", created => bogustime, changed => bogustime, devscan => True); else TIO.Put_Line ("generate_webpage < " & errprefix & "Failed to parse " & dossier); TIO.Put_Line (specification.get_parse_error); end if; REP.destroy_workzone; end generate_webpage; -------------------------------------------------------------------------------------------- -- generate_buildsheet -------------------------------------------------------------------------------------------- procedure generate_buildsheet (sourcedir : String; save_command : String) is save_it : Boolean := False; successful : Boolean; ravensrcdir : constant String := Unix.true_path (sourcedir); filename : constant String := ravensrcdir & "/" & specfile; specification : Port_Specification.Portspecs; begin if save_command = "save" then -- We don't want custom ports to be saved into the conspiracy directory. -- These source ports are parsed every time (not through a build sheet). -- However, we want to preserve the ability to construct and display a build sheet, -- but just not save it. If it's a custom port, tell user that saving is a no-no if not HT.equivalent (PM.configuration.dir_unkindness, PM.no_unkindness) then if HT.leads (ravensrcdir, HT.USS (PM.configuration.dir_unkindness)) then TIO.Put_Line ("Custom port buildsheets must not be saved."); TIO.Put_Line ("Don't worry, ravenadm will compile them automatically as needed."); return; end if; end if; save_it := True; elsif save_command /= "" then TIO.Put_Line (errprefix & "fourth argument can only be 'save'"); return; end if; if ravensrcdir = "" then TIO.Put_Line (errprefix & "not a valid directory: " & sourcedir); return; end if; if DIR.Exists (filename) then PAR.parse_specification_file (dossier => filename, spec => specification, opsys_focus => platform_type, -- unused arch_focus => sysrootver.arch, success => successful, stop_at_targets => False); else DNE (filename); return; end if; if not successful then TIO.Put_Line (errprefix & "Failed to parse " & specfile & " (generate_buildsheet)"); TIO.Put_Line (specification.get_parse_error); return; end if; PST.set_option_defaults (specs => specification, variant => specification.get_list_item (Port_Specification.sp_variants, 1), opsys => platform_type, arch_standard => sysrootver.arch, osrelease => HT.USS (sysrootver.release)); if not specification.post_transform_option_group_defaults_passes then successful := False; return; end if; declare namebase : String := specification.get_namebase; output_file : String := HT.USS (PM.configuration.dir_conspiracy) & "/bucket_" & UTL.bucket (palabra => namebase) & "/" & namebase; begin if save_it then FOP.mkdirp_from_filename (output_file); PSB.generator (specs => specification, ravensrcdir => ravensrcdir, output_file => output_file); TIO.Put_Line (namebase & " buildsheet created at:"); TIO.Put_Line (output_file); else PSB.generator (specs => specification, ravensrcdir => ravensrcdir, output_file => ""); end if; end; end generate_buildsheet; -------------------------------------------------------------------------------------------- -- DNE -------------------------------------------------------------------------------------------- procedure DNE (filename : String) is begin TIO.Put_Line (errprefix & "File " & LAT.Quotation & filename & LAT.Quotation & " does not exist."); end DNE; -------------------------------------------------------------------------------------------- -- TERM_defined_in_environment -------------------------------------------------------------------------------------------- function TERM_defined_in_environment return Boolean is defined : constant Boolean := Unix.env_variable_defined ("TERM"); begin if not defined then TIO.Put_Line ("Please define TERM in environment first and retry."); end if; return defined; end TERM_defined_in_environment; -------------------------------------------------------------------------------------------- -- launch_clash_detected -------------------------------------------------------------------------------------------- function launch_clash_detected return Boolean is violation : Boolean; cwd : constant String := DIR.Current_Directory; sysroot : constant String := HT.USS (PM.configuration.dir_sysroot); portsdir : constant String := HT.USS (PM.configuration.dir_conspiracy); distfiles : constant String := HT.USS (PM.configuration.dir_distfiles); packages : constant String := HT.USS (PM.configuration.dir_packages); ccache : constant String := HT.USS (PM.configuration.dir_ccache); buildbase : constant String := HT.USS (PM.configuration.dir_buildbase) & "/"; begin case platform_type is when macos | openbsd => violation := HT.leads (cwd, sysroot & "/System") or else HT.leads (cwd, distfiles) or else HT.leads (cwd, packages) or else HT.leads (cwd, ccache) or else HT.leads (cwd, buildbase); when others => violation := HT.leads (cwd, sysroot) or else HT.leads (cwd, portsdir) or else HT.leads (cwd, distfiles) or else HT.leads (cwd, packages) or else HT.leads (cwd, ccache) or else HT.leads (cwd, buildbase); end case; if violation then TIO.Put_Line ("Please change the current directory; " & "ravenadm is unable to launch from here."); end if; return violation; end launch_clash_detected; -------------------------------------------------------------------------------------------- -- insufficient_privileges -------------------------------------------------------------------------------------------- function insufficient_privileges return Boolean is function id_command return String; function id_command return String is begin case platform_type is when sunos => return "/usr/xpg4/bin/id -u"; when others => return "/usr/bin/id -u"; end case; end id_command; status : Integer; command : constant String := id_command; result : String := HT.USS (Unix.piped_command (command, status)); begin if status /= 0 then TIO.Put_Line ("command '" & command & "' failed. Output=" & result); return True; end if; declare resint : constant Integer := Integer'Value (HT.first_line (result)); begin if resint = 0 then return False; else -- Regular user called this return True; end if; end; end insufficient_privileges; -------------------------------------------------------------------------------------------- -- already_running -------------------------------------------------------------------------------------------- function already_running return Boolean is procedure remove_stale_pidfile; procedure remove_stale_pidfile is begin DIR.Delete_File (pidfile); exception when others => -- silently ignore failure. Likely ravenadm was launched by regular -- user after event that left root-created stale pid file. We can -- clean it up the next time root executes this command null; end remove_stale_pidfile; begin if DIR.Exists (pidfile) then declare textpid : constant String := FOP.head_n1 (pidfile); command : constant String := "/bin/ps -p " & textpid; pid : Integer; comres : HT.Text; status : Integer; begin -- test if valid by converting it (exception if fails) pid := Integer'Value (textpid); -- exception raised by line below if pid not found. comres := Unix.piped_command (command, status); if status = 0 and then HT.contains (comres, "ravenadm") then TIO.Put_Line ("ravenadm is already running on this system."); return True; else -- pidfile is obsolete, remove it. remove_stale_pidfile; return False; end if; exception when others => -- pidfile contains garbage, remove it remove_stale_pidfile; return False; end; end if; return False; end already_running; -------------------------------------------------------------------------------------------- -- create_pidfile -------------------------------------------------------------------------------------------- procedure create_pidfile is begin FOP.create_pidfile (pidfile); end create_pidfile; -------------------------------------------------------------------------------------------- -- destroy_pidfile -------------------------------------------------------------------------------------------- procedure destroy_pidfile is begin FOP.destroy_pidfile (pidfile); end destroy_pidfile; -------------------------------------------------------------------------------------------- -- previous_run_mounts_detected -------------------------------------------------------------------------------------------- function previous_run_mounts_detected return Boolean is begin if REP.ravenadm_mounts_exist then TIO.Put_Line ("Builder mounts detected; attempting to remove them automatically ..."); return True; else return False; end if; end previous_run_mounts_detected; -------------------------------------------------------------------------------------------- -- previous_realfs_work_detected -------------------------------------------------------------------------------------------- function previous_realfs_work_detected return Boolean is begin if REP.disk_workareas_exist then TIO.Put_Line ("Old work directories detected; " & "attempting to remove them automatically ..."); return True; else return False; end if; end previous_realfs_work_detected; -------------------------------------------------------------------------------------------- -- old_mounts_successfully_removed -------------------------------------------------------------------------------------------- function old_mounts_successfully_removed return Boolean is begin if REP.clear_existing_mounts then TIO.Put_Line ("Dismounting successful!"); return True; end if; TIO.Put_Line ("The attempt failed. Check for stuck or ongoing processes and kill them."); TIO.Put_Line ("After that try running ravenadm again or just manually unmount everything"); TIO.Put_Line ("that is still attached to " & HT.USS (PM.configuration.dir_buildbase)); return False; end old_mounts_successfully_removed; -------------------------------------------------------------------------------------------- -- old_realfs_work_successfully_removed -------------------------------------------------------------------------------------------- function old_realfs_work_successfully_removed return Boolean is begin if REP.clear_existing_workareas then TIO.Put_Line ("Directory removal successful!"); return True; end if; TIO.Put_Line ("The attempt to remove the work directories located at "); TIO.Put_Line (HT.USS (PM.configuration.dir_buildbase) & " failed."); TIO.Put_Line ("Please remove them manually before continuing."); return False; end old_realfs_work_successfully_removed; -------------------------------------------------------------------------------------------- -- ravenexec_missing -------------------------------------------------------------------------------------------- function ravenexec_missing return Boolean is begin if DIR.Exists (ravenexec) then return False; end if; TIO.Put_Line (ravenexec & " missing!" & bailing); return True; end ravenexec_missing; -------------------------------------------------------------------------------------------- -- launch_configure_menu -------------------------------------------------------------------------------------------- procedure launch_configure_menu is begin Configure.launch_configure_menu; end launch_configure_menu; -------------------------------------------------------------------------------------------- -- locate -------------------------------------------------------------------------------------------- procedure locate (candidate : String) is -- These are *buildsheet* locations suffix : String := "/bucket_" & UTL.bucket (candidate) & LAT.Solidus & candidate; should_be : String := HT.USS (PM.configuration.dir_conspiracy) & suffix; customloc : String := HT.USS (PM.configuration.dir_profile) & "/unkindness" & suffix; begin if candidate = "" then TIO.Put_Line ("The locate command requires the port's name base as an argument"); return; end if; if not HT.equivalent (PM.configuration.dir_unkindness, PM.no_unkindness) and then DIR.Exists (customloc) then TIO.Put_Line ("Custom port found at " & customloc); elsif DIR.Exists (should_be) then TIO.Put_Line ("Found at " & should_be); else TIO.Put_Line ("Does not exist at " & should_be); end if; end locate; -------------------------------------------------------------------------------------------- -- jump -------------------------------------------------------------------------------------------- procedure jump (candidate : String) is function cd (rport : String) return String; function negative (rport : String) return String; function cd (rport : String) return String is begin return "cd '" & HT.replace_char (rport, LAT.Space, "\ ") & "' && pwd"; end cd; function negative (rport : String) return String is begin return "echo Sorry, the " & rport & " port was not found."; end negative; begin if candidate = "" then TIO.Put_Line ("echo You must provide a namebase for this command."); end if; declare -- These are *source port* locations canbucket : String := "/bucket_" & UTL.bucket (candidate); suffix : String := canbucket & LAT.Solidus & candidate; customloc : String := HT.USS (PM.configuration.dir_unkindness) & suffix; begin if not HT.equivalent (PM.configuration.dir_unkindness, PM.no_unkindness) and then DIR.Exists (customloc) then TIO.Put_Line (cd (customloc)); else -- We can find ravensource if we are located: -- A) within top directory of ravensource tree -- B) within a bucket directory -- C) within a bucket directory's subdirectory (some port) -- D) within a ports subdirectory (e.g. manifests) -- E) within the ravensource's Scripts directory declare cwd : constant String := DIR.Current_Directory; parent : constant String := HT.head (cwd, "/"); gramps : constant String := HT.head (parent, "/"); super : constant String := HT.head (gramps, "/"); top : HT.Text; begin if DIR.Exists (cwd & canbucket) then -- Found (A) scenario top := HT.SUS (cwd); elsif parent /= cwd and then DIR.Exists (parent & canbucket) then -- Found (B) scenario or (E) Scripts top := HT.SUS (parent); elsif gramps /= parent and then DIR.Exists (gramps & canbucket) then -- Found (C) scenario or (E) Scripts/subdir top := HT.SUS (gramps); elsif super /= gramps and then DIR.Exists (super & canbucket) then -- Found (D) scenario or (E) e.g. Scripts/Ravenports_Mk/Uses/ top := HT.SUS (super); end if; if not HT.IsBlank (top) and then DIR.Exists (HT.USS (top) & suffix) then TIO.Put_Line (cd (HT.USS (top) & suffix)); else TIO.Put_Line (negative (candidate)); end if; end; end if; end; end jump; -------------------------------------------------------------------------------------------- -- slave_platform_determined -------------------------------------------------------------------------------------------- function slave_platform_determined return Boolean is base : String := HT.USS (PM.configuration.dir_sysroot) & "/usr/share/"; F1 : String := base & "OSRELEASE"; F2 : String := base & "OSMAJOR"; F3 : String := base & "OSVERSION"; F4 : String := base & "STDARCH"; begin if not DIR.Exists (F1) or else not DIR.Exists (F2) or else not DIR.Exists (F3) or else not DIR.Exists (F4) then TIO.Put_Line ("Platform type could not be determined (sysroot F1-F4 missing)"); return False; end if; sysrootver.release := HT.SUS (FOP.head_n1 (F1)); sysrootver.major := HT.SUS (FOP.head_n1 (F2)); sysrootver.version := HT.SUS (FOP.head_n1 (F3)); declare candidate : String := FOP.head_n1 (F4); begin if UTL.valid_cpu_arch (candidate) then sysrootver.arch := UTL.convert_cpu_arch (candidate); else TIO.Put_Line ("Platform type could not be determined (STDARCH conversion failed)"); return False; end if; end; return True; end slave_platform_determined; -------------------------------------------------------------------------------------------- -- fully_scan_ports_tree -------------------------------------------------------------------------------------------- function fully_scan_ports_tree return Boolean is successful : Boolean; begin if not unkindness_index_current then return False; end if; successful := SCN.scan_entire_ports_tree (sysrootver); if successful then SCN.set_build_priority; if PortScan.queue_is_empty then successful := False; TIO.Put_Line ("There are no valid ports to build." & bailing); end if; else if Signals.graceful_shutdown_requested then TIO.Put_Line (shutreq); else TIO.Put_Line ("Failed to scan ports tree " & bailing); end if; end if; return successful; end fully_scan_ports_tree; -------------------------------------------------------------------------------------------- -- scan_stack_of_single_ports -------------------------------------------------------------------------------------------- function scan_stack_of_single_ports (always_build : Boolean) return Boolean is successful : Boolean; begin -- unkindness index generated at store_origins routine (can't get this far if failed) successful := SCN.scan_provided_list_of_ports (always_build, sysrootver); if successful then SCN.set_build_priority; if PortScan.queue_is_empty then successful := False; TIO.Put_Line ("There are no valid ports to build." & bailing); end if; else if Signals.graceful_shutdown_requested then TIO.Put_Line (shutreq); end if; end if; return successful; end scan_stack_of_single_ports; -------------------------------------------------------------------------------------------- -- sanity_check_then_prefail -------------------------------------------------------------------------------------------- function sanity_check_then_prefail (delete_first : Boolean := False; dry_run : Boolean := False) return Boolean is ptid : PortScan.port_id; num_skipped : Natural; block_remote : Boolean := True; force_compiler_build : Boolean := False; force_binutils_build : Boolean := False; update_external_repo : constant String := host_pkg8 & " update --quiet --repository "; no_packages : constant String := "No prebuilt packages will be used as a result."; begin LOG.set_overall_start_time (CAL.Clock); if delete_first and then not dry_run then OPS.delete_existing_packages_of_ports_list; end if; if PM.configuration.defer_prebuilt then -- Before any remote operations, find the external repo if OPS.located_external_repository then block_remote := False; -- We're going to use prebuilt packages if available, so let's -- prepare for that case by updating the external repository TIO.Put ("Stand by, updating external repository catalogs ... "); if Unix.external_command (update_external_repo & OPS.top_external_repository) then TIO.Put_Line ("done."); else TIO.Put_Line ("Failed!"); TIO.Put_Line ("The external repository could not be updated."); TIO.Put_Line (no_packages); block_remote := True; end if; else TIO.Put_Line ("The external repository does not seem to be configured."); TIO.Put_Line (no_packages); end if; end if; if delete_first then force_compiler_build := PortScan.jail_port_compiler_specified; force_binutils_build := PortScan.jail_port_binutils_specified; end if; OPS.limited_sanity_check (repository => HT.USS (PM.configuration.dir_repository), dry_run => dry_run, rebuild_compiler => force_compiler_build, rebuild_binutils => force_binutils_build, suppress_remote => block_remote, major_release => HT.USS (sysrootver.major), architecture => sysrootver.arch); LOG.set_build_counters (PortScan.queue_length, 0, 0, 0, 0); if dry_run then return True; end if; if Signals.graceful_shutdown_requested then TIO.Put_Line (shutreq); return False; end if; OPS.delete_existing_web_history_files; LOG.start_logging (PortScan.total); LOG.start_logging (PortScan.ignored); LOG.start_logging (PortScan.skipped); LOG.start_logging (PortScan.success); LOG.start_logging (PortScan.failure); -- Need to initialize hooks next because ignore hook is embedded in OPS.next_ignored_port; OPS.initialize_hooks; loop ptid := OPS.next_ignored_port; exit when not PortScan.valid_port_id (ptid); exit when Signals.graceful_shutdown_requested; LOG.increment_build_counter (PortScan.ignored); LOG.scribe (PortScan.total, LOG.elapsed_now & " " & PortScan.get_port_variant (ptid) & " has been ignored: " & PortScan.ignore_reason (ptid), False); LOG.scribe (PortScan.ignored, LOG.elapsed_now & " " & PortScan.get_port_variant (ptid) & " ## reason: " & PortScan.ignore_reason (ptid), False); OPS.cascade_failed_build (id => ptid, numskipped => num_skipped); OPS.record_history_ignored (elapsed => LOG.elapsed_now, bucket => PortScan.get_bucket (ptid), origin => PortScan.get_port_variant (ptid), reason => PortScan.ignore_reason (ptid), skips => num_skipped); LOG.increment_build_counter (PortScan.skipped, num_skipped); end loop; LOG.stop_logging (PortScan.ignored); LOG.scribe (PortScan.total, LOG.elapsed_now & " Sanity check complete. " & "Ports remaining to build:" & PortScan.queue_length'Img, True); if Signals.graceful_shutdown_requested then TIO.Put_Line (shutreq); else if OPS.integrity_intact then return True; end if; end if; -- If here, we either got control-C or failed integrity check if not Signals.graceful_shutdown_requested then TIO.Put_Line ("Queue integrity lost! " & bailing); end if; LOG.stop_logging (PortScan.total); LOG.stop_logging (PortScan.skipped); LOG.stop_logging (PortScan.success); LOG.stop_logging (PortScan.failure); return False; end sanity_check_then_prefail; -------------------------------------------------------------------------------------------- -- perform_bulk_run -------------------------------------------------------------------------------------------- procedure perform_bulk_run (testmode : Boolean) is num_builders : constant builders := PM.configuration.num_builders; show_tally : Boolean := True; begin if PortScan.queue_is_empty then TIO.Put_Line ("After inspection, it has been determined that there are no packages that"); TIO.Put_Line ("require rebuilding; the task is therefore complete."); show_tally := False; else OPS.run_start_hook; REP.initialize (testmode); CYC.initialize (testmode); OPS.initialize_web_report (num_builders); OPS.initialize_display (num_builders); OPS.parallel_bulk_run (num_builders, sysrootver); -- The parallel_bulk_run contains the end_hook activation REP.finalize; end if; LOG.set_overall_complete (CAL.Clock); LOG.stop_logging (PortScan.total); LOG.stop_logging (PortScan.success); LOG.stop_logging (PortScan.failure); LOG.stop_logging (PortScan.skipped); if show_tally then TIO.Put_Line (LAT.LF & LAT.LF); TIO.Put_Line ("The task is complete. Final tally:"); TIO.Put_Line ("Initial queue size:" & LOG.port_counter_value (PortScan.total)'Img); TIO.Put_Line (" packages built:" & LOG.port_counter_value (PortScan.success)'Img); TIO.Put_Line (" ignored:" & LOG.port_counter_value (PortScan.ignored)'Img); TIO.Put_Line (" skipped:" & LOG.port_counter_value (PortScan.skipped)'Img); TIO.Put_Line (" failed:" & LOG.port_counter_value (PortScan.failure)'Img); TIO.Put_Line (""); TIO.Put_Line (LOG.bulk_run_duration); TIO.Put_Line ("The build logs can be found at: " & HT.USS (PM.configuration.dir_logs) & "/logs"); end if; end perform_bulk_run; -------------------------------------------------------------------------------------------- -- store_origins -------------------------------------------------------------------------------------------- function store_origins (start_from : Positive) return Boolean is -- format is <namebase>:<variant> begin if CLI.Argument_Count < 2 then TIO.Put_Line ("This command requires a list of one or more port origins."); return False; end if; if not unkindness_index_current then TIO.Put_Line ("Failed to generate unkindness index."); return False; end if; all_stdvar := True; if CLI.Argument_Count = 2 then -- Check if this is a file declare potential_file : String renames CLI.Argument (2); use type DIR.File_Kind; begin if DIR.Exists (potential_file) and then DIR.Kind (potential_file) = DIR.Ordinary_File then return valid_origin_file (potential_file); end if; end; end if; for k in start_from .. CLI.Argument_Count loop declare Argk : constant String := CLI.Argument (k); bad_namebase : Boolean; bad_format : Boolean; add_standard : Boolean; is_stdvar : Boolean; begin if valid_origin (Argk, bad_namebase, bad_format, add_standard, is_stdvar) then if add_standard then PortScan.insert_into_portlist (Argk & LAT.Colon & variant_standard); else PortScan.insert_into_portlist (Argk); end if; if not is_stdvar then all_stdvar := False; end if; else if bad_format then TIO.Put_Line (badformat & "'" & Argk & "'"); elsif bad_namebase then TIO.Put_Line (badname & "'" & Argk & "'"); else if HT.contains (Argk, ":") then TIO.Put_Line (badvariant & "'" & Argk & "'"); else TIO.Put_Line (badvariant & "(:standard)'" & Argk & "'"); end if; end if; return False; end if; end; end loop; return True; end store_origins; -------------------------------------------------------------------------------------------- -- valid_origin -------------------------------------------------------------------------------------------- function valid_origin (port_variant : String; bad_namebase : out Boolean; bad_format : out Boolean; assume_std : out Boolean; known_std : out Boolean) return Boolean is function variant_valid (fileloc : String; variant : String) return Boolean; numcolons : constant Natural := HT.count_char (port_variant, LAT.Colon); num_spaces : constant Natural := HT.count_char (port_variant, LAT.Space); function variant_valid (fileloc : String; variant : String) return Boolean is package FOPH is new FOP.Heap (Natural (DIR.Size (fileloc))); variantsvar : Natural; variants : constant String := "VARIANTS=" & LAT.HT & LAT.HT; begin FOPH.slurp_file (fileloc); variantsvar := AS.Fixed.Index (FOPH.file_contents.all, variants); if variantsvar = 0 then return False; end if; declare single_LF : constant String (1 .. 1) := (1 => LAT.LF); nextlf : Natural := AS.Fixed.Index (Source => FOPH.file_contents.all, Pattern => single_LF, From => variantsvar); special : String := HT.strip_excessive_spaces (FOPH.file_contents.all (variantsvar + variants'Length .. nextlf - 1)); begin if nextlf = 0 then return False; end if; return special = variant or else (special'First + variant'Length <= special'Last and then special (special'First .. special'First + variant'Length) = variant & " ") or else (special'Last > variant'Length and then special (special'Last - variant'Length .. special'Last) = " " & variant) or else AS.Fixed.Index (special, " " & variant & " ") /= 0; end; end variant_valid; begin bad_namebase := True; assume_std := False; if num_spaces > 0 or else numcolons > 1 then bad_format := True; return False; end if; bad_format := False; if numcolons = 1 then declare namebase : String := HT.part_1 (port_variant, ":"); variant : String := HT.part_2 (port_variant, ":"); bsheetname : String := "/bucket_" & UTL.bucket (namebase) & "/" & namebase; bsheetc : String := HT.USS (PM.configuration.dir_conspiracy) & bsheetname; bsheetu : String := HT.USS (PM.configuration.dir_profile) & "/unkindness" & bsheetname; begin known_std := (variant = variant_standard); if DIR.Exists (bsheetu) then bad_namebase := False; return variant_valid (bsheetu, variant); elsif DIR.Exists (bsheetc) then bad_namebase := False; return variant_valid (bsheetc, variant); else return False; end if; end; else declare bsheetname : String := "/bucket_" & UTL.bucket (port_variant) & "/" & port_variant; bsheetc : String := HT.USS (PM.configuration.dir_conspiracy) & bsheetname; bsheetu : String := HT.USS (PM.configuration.dir_profile) & "/unkindness" & bsheetname; begin assume_std := True; known_std := True; if DIR.Exists (bsheetu) then bad_namebase := False; return variant_valid (bsheetu, variant_standard); elsif DIR.Exists (bsheetc) then bad_namebase := False; return variant_valid (bsheetc, variant_standard); else return False; end if; end; end if; end valid_origin; -------------------------------------------------------------------------------------------- -- valid_origin_file -------------------------------------------------------------------------------------------- function valid_origin_file (regular_file : String) return Boolean is origin_list : constant String := FOP.get_file_contents (regular_file); markers : HT.Line_Markers; good : Boolean := True; total : Natural := 0; begin HT.initialize_markers (origin_list, markers); loop exit when not HT.next_line_present (origin_list, markers); declare line : constant String := HT.extract_line (origin_list, markers); bad_namebase : Boolean; bad_format : Boolean; add_standard : Boolean; is_stdvar : Boolean; begin if not HT.IsBlank (line) then if valid_origin (line, bad_namebase, bad_format, add_standard, is_stdvar) then if add_standard then PortScan.insert_into_portlist (line & LAT.Colon & variant_standard); else PortScan.insert_into_portlist (line); end if; if not is_stdvar then all_stdvar := False; end if; total := total + 1; else if bad_format then TIO.Put_Line (badformat & "'" & line & "'"); elsif bad_namebase then TIO.Put_Line (badname & "'" & line & "'"); else TIO.Put_Line (badvariant & "'" & line & "'"); end if; good := False; exit; end if; end if; end; end loop; return (total > 0) and then good; end valid_origin_file; -------------------------------------------------------------------------------------------- -- print_spec_template -------------------------------------------------------------------------------------------- procedure print_spec_template (save_command : String) is save_here : constant Boolean := (save_command = "save"); begin PSB.print_specification_template (save_here); end print_spec_template; -------------------------------------------------------------------------------------------- -- generate_distinfo -------------------------------------------------------------------------------------------- procedure generate_distinfo is portloc : String := HT.USS (PM.configuration.dir_buildbase) & ss_base & "/port"; makefile : String := portloc & "/Makefile"; sslv : String := PM.ssl_selection (PM.configuration); successful : Boolean; specification : Port_Specification.Portspecs; begin if not DIR.Exists (specfile) then TIO.Put_Line ("No specification file found in current directory."); return; end if; REP.initialize (testmode => False); REP.launch_slave (scan_slave); PAR.parse_specification_file (dossier => specfile, spec => specification, opsys_focus => platform_type, arch_focus => x86_64, success => successful, stop_at_targets => True, extraction_dir => portloc); if not successful then TIO.Put_Line ("generate_distinfo < " & errprefix & "Failed to parse " & specfile); TIO.Put_Line (specification.get_parse_error); goto endzone; end if; declare variant : String := specification.get_list_item (Port_Specification.sp_variants, 1); begin PSM.generator (specs => specification, variant => variant, opsys => platform_type, arch => x86_64, output_file => makefile); end; CYC.run_makesum (scan_slave, sslv); <<endzone>> REP.destroy_slave (scan_slave); REP.finalize; end generate_distinfo; -------------------------------------------------------------------------------------------- -- bulk_run_then_interact_with_final_port -------------------------------------------------------------------------------------------- procedure bulk_run_then_interact_with_final_port is brkphase : constant String := Unix.env_variable_value (brkname); buildres : Boolean; ptid : PortScan.port_id := OPS.unlist_first_port; pvname : constant String := PortScan.get_port_variant (ptid); use_proc : constant Boolean := PortScan.requires_procfs (ptid); begin if not PortScan.valid_port_id (ptid) then TIO.Put_Line ("Failed to remove first port from list." & bailing); return; end if; perform_bulk_run (testmode => True); if Signals.graceful_shutdown_requested then return; end if; if LOG.port_counter_value (PortScan.ignored) > 0 or else LOG.port_counter_value (PortScan.skipped) > 0 or else LOG.port_counter_value (PortScan.failure) > 0 then TIO.Put_Line ("It appears a prerequisite failed, so the interactive build of"); TIO.Put_Line (pvname & " has been cancelled."); return; end if; TIO.Put_Line ("Starting interactive build of " & pvname); TIO.Put_Line ("Stand by, building up to the point requested ..."); REP.initialize (testmode => True); CYC.initialize (test_mode => True); REP.launch_slave (scan_slave, use_proc); Unix.cone_of_silence (deploy => False); buildres := OPS.build_subpackages (builder => scan_slave, sequence_id => ptid, sysrootver => sysrootver, interactive => True, enterafter => brkphase); REP.destroy_slave (scan_slave, use_proc); REP.finalize; end bulk_run_then_interact_with_final_port; -------------------------------------------------------------------------------------------- -- interact_with_single_builder -------------------------------------------------------------------------------------------- function interact_with_single_builder return Boolean is EA_defined : constant Boolean := Unix.env_variable_defined (brkname); begin if PortScan.build_request_length /= 1 then return False; end if; if not EA_defined then return False; end if; return CYC.valid_test_phase (Unix.env_variable_value (brkname)); end interact_with_single_builder; -------------------------------------------------------------------------------------------- -- install_compiler_packages -------------------------------------------------------------------------------------------- function install_compiler_packages return Boolean is function get_package_name (subpackage : String; use_prev : Boolean) return String; function package_copy (subpackage : String) return Boolean; function dupe_archive (origin, destino : String) return Boolean; binutils : constant String := "binutils"; function get_package_name (subpackage : String; use_prev : Boolean) return String is function pkg_name (cname, vsn_binutils, vsn_compiler : String) return String; function pkg_name (cname, vsn_binutils, vsn_compiler : String) return String is begin if subpackage = binutils then return "binutils-single-ravensys-" & vsn_binutils & arc_ext; else return cname & LAT.Hyphen & subpackage & LAT.Hyphen & variant_standard & LAT.Hyphen & vsn_compiler & arc_ext; end if; end pkg_name; begin if use_prev then return pkg_name (previous_default, previous_binutils, previous_compiler); else return pkg_name (default_compiler, binutils_version, compiler_version); end if; end get_package_name; function dupe_archive (origin, destino : String) return Boolean is begin DIR.Copy_File (Source_Name => origin, Target_Name => destino); return True; exception when others => TIO.Put_Line ("Failed to copy " & origin & " to " & destino); return False; end dupe_archive; function package_copy (subpackage : String) return Boolean is pkgname : constant String := get_package_name (subpackage, False); tool_path : constant String := HT.USS (PM.configuration.dir_toolchain) & "/share/"; src_path : constant String := tool_path & pkgname; dest_dir : constant String := HT.USS (PM.configuration.dir_repository); dest_path : constant String := dest_dir & LAT.Solidus & pkgname; begin begin if not DIR.Exists (dest_dir) then DIR.Create_Directory (dest_dir); end if; exception when DIR.Use_Error => TIO.Put_Line ("Failed to create " & dest_dir & " (repository directory)"); return False; when issue : others => TIO.Put_Line ("install_compiler_packages error: " & EX.Exception_Information (issue)); return False; end; if DIR.Exists (dest_path) then return True; else if DIR.Exists (src_path) then return dupe_archive (origin => src_path, destino => dest_path); else -- We didn't find the ports binutils or compiler in the system root storage. -- It's likely that we're in a transition with a new version of binutils or -- gcc available, and a new system root needs to be generated. Assuming this, -- try to copy the previously known compiler/binutils under the new name so -- that package building doesn't break. declare old_pkg : constant String := get_package_name (subpackage, True); old_path : constant String := tool_path & old_pkg; begin if DIR.Exists (old_path) then return dupe_archive (origin => old_path, destino => dest_path); else TIO.Put_Line ("Neither of the following compiler packages were found:"); TIO.Put_Line (src_path); TIO.Put_Line (old_path); return False; end if; end; end if; end if; exception when issue : others => TIO.Put_Line ("install_compiler_packages error: " & EX.Exception_Information (issue)); return False; end package_copy; begin return package_copy (binutils) and then package_copy ("ada_run") and then package_copy ("compilers") and then package_copy ("complete") and then package_copy ("cxx_run") and then package_copy ("fortran_run") and then package_copy ("infopages") and then package_copy ("libs"); end install_compiler_packages; -------------------------------------------------------------------------------------------- -- generate_ports_index -------------------------------------------------------------------------------------------- procedure generate_ports_index is begin PortScan.Scan.generate_conspiracy_index (sysrootver); end generate_ports_index; -------------------------------------------------------------------------------------------- -- display_results_of_dry_run -------------------------------------------------------------------------------------------- procedure display_results_of_dry_run is begin PortScan.Scan.display_results_of_dry_run; end display_results_of_dry_run; -------------------------------------------------------------------------------------------- -- purge_distfiles -------------------------------------------------------------------------------------------- procedure purge_distfiles is begin if unkindness_index_current and then PortScan.Scan.gather_distfile_set (sysrootver) then PortScan.Scan.purge_obsolete_distfiles; end if; end purge_distfiles; -------------------------------------------------------------------------------------------- -- purge_logs -------------------------------------------------------------------------------------------- procedure purge_logs is begin PortScan.Scan.gather_list_of_build_logs; PortScan.Scan.eliminate_current_logs (main_tree => True); PortScan.Scan.eliminate_current_logs (main_tree => False); PortScan.Scan.remove_obsolete_logs; end purge_logs; -------------------------------------------------------------------------------------------- -- change_options -------------------------------------------------------------------------------------------- procedure change_options is number_ports : constant Natural := PortScan.build_request_length; issues : HT.Text; begin -- First confirm all given origins are the standard variants if not all_stdvar then TIO.Put_Line ("User error: Only standard variants of ports have configurable options"); return; end if; for x in 1 .. number_ports loop declare specification : Port_Specification.Portspecs; successful : Boolean; buildsheet : constant String := PortScan.get_buildsheet_from_origin_list (x); begin OPS.parse_and_transform_buildsheet (specification => specification, successful => successful, buildsheet => buildsheet, variant => variant_standard, portloc => "", excl_targets => True, avoid_dialog => True, for_webpage => False, sysrootver => sysrootver); if not specification.standard_options_present then HT.SU.Append (issues, "User error: The " & specification.get_namebase & " port has no options to configure." & LAT.LF); else exit when not OPT.launch_dialog (specification); end if; end; end loop; if not HT.IsBlank (issues) then TIO.Put (HT.USS (issues)); end if; end change_options; -------------------------------------------------------------------------------------------- -- check_ravenports_version -------------------------------------------------------------------------------------------- procedure check_ravenports_version is begin Ravenports.check_version_available; end check_ravenports_version; -------------------------------------------------------------------------------------------- -- update_to_latest_ravenports -------------------------------------------------------------------------------------------- procedure update_to_latest_ravenports is begin Ravenports.retrieve_latest_ravenports; end update_to_latest_ravenports; -------------------------------------------------------------------------------------------- -- generate_repository -------------------------------------------------------------------------------------------- procedure generate_repository is begin if fully_scan_ports_tree then Repository.rebuild_local_respository (remove_invalid_packages => True); end if; end generate_repository; -------------------------------------------------------------------------------------------- -- generate_repository -------------------------------------------------------------------------------------------- procedure check_that_ravenadm_is_modern_enough is raverreq : constant String := HT.USS (PM.configuration.dir_conspiracy) & "/Mk/Misc/raverreq"; begin if not DIR.Exists (raverreq) then return; end if; declare filecon : constant String := FOP.get_file_contents (raverreq); ravenadm_ver : constant Integer := Integer'Value (raven_version_major) * 100 + Integer'Value (raven_version_minor); required_ver : constant Integer := Integer'Value (HT.first_line (filecon)); stars : constant String (1 .. 51) := (others => '*'); Ch : Character; begin if ravenadm_ver < required_ver then TIO.Put_Line (LAT.LF & stars & LAT.LF & "*** Please upgrade ravenadm as soon as possible ***" & LAT.LF & stars & LAT.LF & LAT.LF & "Either build and install ravenadm, or upgrade the ravenports package" & LAT.LF & "This version of ravenadm will not recognize all directives in some ports."); if Unix.env_variable_defined ("TERM") then TIO.Put ("Press any key to acknowledge:"); Ada.Text_IO.Get_Immediate (Ch); TIO.Put_Line (""); end if; end if; end; exception when others => TIO.Put_Line ("check_that_ravenadm_is_modern_enough: exception"); end check_that_ravenadm_is_modern_enough; -------------------------------------------------------------------------------------------- -- generate_website -------------------------------------------------------------------------------------------- procedure generate_website is www_site : constant String := HT.USS (PM.configuration.dir_profile) & "/www"; begin -- make sure ccache isn't added to deps PM.configuration.dir_ccache := HT.SUS (PM.no_ccache); if not DIR.Exists (www_site) then DIR.Create_Path (www_site); end if; if SCN.generate_entire_website (www_site, sysrootver) then TIO.Put_Line ("The web site generation is complete."); else TIO.Put_Line ("The web site generation was not entirely successful."); end if; end generate_website; -------------------------------------------------------------------------------------------- -- regenerate_patches -------------------------------------------------------------------------------------------- procedure regenerate_patches (optional_directory : String; optional_variant : String) is function get_variant return String; function get_buildsheet return String; directory_specified : constant Boolean := (optional_directory /= ""); successful : Boolean; portloc : String := HT.USS (PM.configuration.dir_buildbase) & ss_base & "/port"; sslv : String := PM.ssl_selection (PM.configuration); specification : Port_Specification.Portspecs; spec_found : Boolean := False; function get_variant return String is begin if optional_variant = "" then return variant_standard; else return optional_variant; end if; end get_variant; function get_buildsheet return String is dossier_text : HT.Text; presuccess : Boolean; prespec : Port_Specification.Portspecs; begin if directory_specified then dossier_text := HT.SUS (optional_directory & "/" & specfile); else dossier_text := HT.SUS (specfile); end if; if DIR.Exists (HT.USS (dossier_text)) then PAR.parse_specification_file (dossier => HT.USS (dossier_text), spec => prespec, opsys_focus => platform_type, arch_focus => x86_64, success => presuccess, stop_at_targets => True); if presuccess then declare namebase : String := prespec.get_namebase; buckname : String := "/bucket_" & UTL.bucket (namebase) & "/" & namebase; savedspec : String := HT.USS (PM.configuration.dir_conspiracy) & buckname; custspec : String := HT.USS (PM.configuration.dir_profile) & "/unkindness" & buckname; begin if DIR.Exists (custspec) then spec_found := True; return custspec; else if DIR.Exists (savedspec) then spec_found := True; return savedspec; else DNE (savedspec); end if; end if; end; end if; end if; return "unused"; end get_buildsheet; selected_variant : constant String := get_variant; dossier : constant String := get_buildsheet; begin if spec_found then REP.initialize (testmode => False); REP.launch_slave (scan_slave); OPS.parse_and_transform_buildsheet (specification => specification, successful => successful, buildsheet => dossier, variant => selected_variant, portloc => portloc, excl_targets => False, avoid_dialog => True, for_webpage => False, sysrootver => sysrootver); CYC.run_patch_regen (id => scan_slave, sourceloc => optional_directory, ssl_variant => sslv); REP.destroy_slave (scan_slave); REP.finalize; end if; end regenerate_patches; -------------------------------------------------------------------------------------------- -- resort_manifests -------------------------------------------------------------------------------------------- procedure resort_manifests (sourcedir : String) is function assume_dot (source : String) return String; function assume_dot (source : String) return String is begin if source = "" then return "."; else return source; end if; end assume_dot; portsrc : constant String := Unix.true_path (assume_dot (sourcedir)); manifestdir : constant String := portsrc & "/manifests"; begin if not DIR.Exists (manifestdir) then TIO.Put_Line ("Sort ignored: No manifests directory detected"); return; end if; declare use type DIR.File_Kind; begin if not (DIR.Kind (manifestdir) = DIR.Directory) then TIO.Put_Line ("Manifest sort failed because " & manifestdir & " is not a directory"); return; end if; end; declare search : DIR.Search_Type; dirent : DIR.Directory_Entry_Type; filter : constant DIR.Filter_Type := (DIR.Ordinary_File => True, others => False); begin DIR.Start_Search (Search => search, Directory => manifestdir, Pattern => "plist.*", Filter => filter); while DIR.More_Entries (search) loop DIR.Get_Next_Entry (search, dirent); declare sname : constant String := DIR.Simple_Name (dirent); plist : constant String := manifestdir & "/" & sname; begin MAN.sort_manifest (MAN.Filename (plist)); TIO.Put_Line ("Sort complete: " & sname); exception when others => TIO.Put_Line ("Failed to sort " & plist & " manifest"); end; end loop; DIR.End_Search (search); end; end resort_manifests; -------------------------------------------------------------------------------------------- -- unkindness_index_current -------------------------------------------------------------------------------------------- function unkindness_index_current return Boolean is require_new_index : Boolean; begin require_new_index := SCN.unkindness_index_required; if require_new_index then return SCN.generate_unkindness_index (sysrootver); else return True; end if; end unkindness_index_current; -------------------------------------------------------------------------------------------- -- show_config_value -------------------------------------------------------------------------------------------- procedure show_config_value (AQvalue : String) is errmsg : constant String := "Configuration info command requires 'A' .. 'Q' argument"; option : Character; begin if HT.IsBlank (AQvalue) then TIO.Put_Line (errmsg); else option := AQvalue (AQvalue'First); case option is when 'A' .. 'Z' => Configure.print_configuration_value (option); when others => TIO.Put_Line (errmsg); end case; end if; end show_config_value; -------------------------------------------------------------------------------------------- -- generate_conspiracy -------------------------------------------------------------------------------------------- procedure generate_conspiracy (sourcedir : String) is ravensrcdir : constant String := Unix.true_path (sourcedir); begin if ravensrcdir = "" then TIO.Put_Line (errprefix & "not a valid directory: " & sourcedir); return; end if; SCN.generate_all_buildsheets (ravensrcdir); end generate_conspiracy; end Pilot;
package Integer_Exponentiation is -- int^int procedure Exponentiate (Argument : in Integer; Exponent : in Natural; Result : out Integer); function "**" (Left : Integer; Right : Natural) return Integer; -- real^int procedure Exponentiate (Argument : in Float; Exponent : in Integer; Result : out Float); function "**" (Left : Float; Right : Integer) return Float; end Integer_Exponentiation;
package body Iterate_Subsets is function First return Subset is S: Subset; begin for I in S'Range loop S(I) := I; end loop; return S; end First; procedure Next(S: in out Subset) is I: Natural := S'Last; begin if S(I) < Index'Last then S(I) := S(I) + 1; else while S(I-1)+1 = S(I) loop I := I - 1; end loop; S(I-1) := S(I-1) + 1; for J in I .. S'Last loop S(J) := S(J-1) + 1; end loop; end if; return; end Next; function Last(S: Subset) return Boolean is begin return S(S'First) = Index'Last-S'Length+1; end Last; end Iterate_Subsets;
------------------------------------------------------------------------------ -- G E L A A S I S -- -- ASIS implementation for Gela project, a portable Ada compiler -- -- http://gela.ada-ru.org -- -- - - - - - - - - - - - - - - - -- -- Read copyright and license at the end of this file -- ------------------------------------------------------------------------------ -- $Revision: 209 $ $Date: 2013-11-30 21:03:24 +0200 (Сб., 30 нояб. 2013) $ -- Purpose: -- Procedural wrapper over Object-Oriented ASIS implementation with Asis.Errors; with Asis.Exceptions; with Asis.Implementation; with Asis.Gela.Contexts; with Ada.Exceptions; with Ada.Characters.Handling; with Ada.Unchecked_Deallocation; package body Asis.Ada_Environments is type Context_Ptr is access all Context_Node'Class; --------------- -- Associate -- --------------- procedure Associate (The_Context : in out Asis.Context; Name : in Wide_String; Parameters : in Wide_String := Default_Parameters) is begin if not Implementation.Is_Initialized or Implementation.Is_Finalized then Implementation.Set_Status ( Status => Asis.Errors.Initialization_Error, Diagnosis => "ASIS is not initialized"); raise Exceptions.ASIS_Failed; end if; if Is_Open (The_Context) then Implementation.Set_Status ( Status => Asis.Errors.Value_Error, Diagnosis => "Context has alredy been opened"); raise Exceptions.ASIS_Inappropriate_Context; end if; begin if not Assigned (The_Context) then The_Context := new Asis.Gela.Contexts.Concrete_Context_Node; end if; Asis.Associate (The_Context => The_Context, Name => Name, Parameters => Parameters); end; end Associate; ----------- -- Close -- ----------- procedure Close (The_Context : in out Asis.Context) is begin if not Is_Open (The_Context) then Implementation.Set_Status ( Status => Asis.Errors.Value_Error, Diagnosis => "Context is not opened"); raise Exceptions.ASIS_Inappropriate_Context; end if; Close (The_Context.all); end Close; ----------------- -- Debug_Image -- ----------------- function Debug_Image (The_Context : in Asis.Context) return Wide_String is begin if not Assigned (The_Context) then return "[null]"; else return Debug_Image (The_Context.all); end if; end Debug_Image; ------------------ -- Default_Name -- ------------------ function Default_Name return Wide_String is begin return ""; end Default_Name; ------------------------ -- Default_Parameters -- ------------------------ function Default_Parameters return Wide_String is begin return ""; end Default_Parameters; ---------------- -- Dissociate -- ---------------- procedure Dissociate (The_Context : in out Asis.Context) is procedure Free is new Ada.Unchecked_Deallocation (Asis.Context_Node'Class, Asis.Context); begin if Assigned (The_Context) then Dissociate (The_Context.all); Free (The_Context); The_Context := null; end if; end Dissociate; ------------ -- Exists -- ------------ function Exists (The_Context : in Asis.Context) return Boolean is begin return Has_Associations (The_Context); end Exists; ---------------------- -- Has_Associations -- ---------------------- function Has_Associations (The_Context : in Asis.Context) return Boolean is begin if Assigned (The_Context) then return Has_Associations (The_Context.all); else return False; end if; end Has_Associations; -------------- -- Is_Equal -- -------------- function Is_Equal (Left : in Asis.Context; Right : in Asis.Context) return Boolean is begin if not Assigned (Left) and not Assigned (Right) then return True; elsif Assigned (Left) and then Assigned (Right) and then Is_Equal (Left.all, Right.all) then return True; else return False; end if; end Is_Equal; ------------------ -- Is_Identical -- ------------------ function Is_Identical (Left : in Asis.Context; Right : in Asis.Context) return Boolean is begin return Is_Open (Left) and Is_Open (Right) and Context_Ptr (Left) = Context_Ptr (Right); end Is_Identical; ------------- -- Is_Open -- ------------- function Is_Open (The_Context : in Asis.Context) return Boolean is begin return Assigned (The_Context) and then Is_Open (The_Context.all); end Is_Open; ---------- -- Name -- ---------- function Name (The_Context : in Asis.Context) return Wide_String is begin if Assigned (The_Context) then return Context_Name (The_Context.all); else return ""; end if; end Name; ---------- -- Open -- ---------- procedure Open (The_Context : in out Asis.Context) is use Ada.Exceptions; use Asis.Exceptions; use Ada.Characters.Handling; begin if Is_Open (The_Context) then Implementation.Set_Status ( Status => Asis.Errors.Value_Error, Diagnosis => "Context has alredy been opened"); raise ASIS_Inappropriate_Context; end if; if not Has_Associations (The_Context) then Implementation.Set_Status ( Status => Asis.Errors.Value_Error, Diagnosis => "Context has no association"); raise ASIS_Inappropriate_Context; end if; Open (The_Context.all); exception when E : ASIS_Inappropriate_Context | ASIS_Failed => Reraise_Occurrence (E); when E : others => Implementation.Set_Status (Status => Asis.Errors.Internal_Error, Diagnosis => "Asis.Ada_Environments.Open: " & To_Wide_String (Exception_Information (E))); raise ASIS_Failed; end Open; ---------------- -- Parameters -- ---------------- function Parameters (The_Context : in Asis.Context) return Wide_String is begin if Assigned (The_Context) then return Parameters (The_Context.all); else return ""; end if; end Parameters; end Asis.Ada_Environments; ------------------------------------------------------------------------------ -- Copyright (c) 2006-2013, Maxim Reznik -- All rights reserved. -- -- Redistribution and use in source and binary forms, with or without -- modification, are permitted provided that the following conditions are met: -- -- * Redistributions of source code must retain the above copyright notice, -- this list of conditions and the following disclaimer. -- * Redistributions in binary form must reproduce the above copyright -- notice, this list of conditions and the following disclaimer in the -- documentation and/or other materials provided with the distribution. -- * Neither the name of the Maxim Reznik, IE nor the names of its -- contributors may be used to endorse or promote products derived from -- this software without specific prior written permission. -- -- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" -- AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -- IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE -- ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE -- LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR -- CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF -- SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS -- INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN -- CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) -- ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -- POSSIBILITY OF SUCH DAMAGE. ------------------------------------------------------------------------------
pragma License (Unrestricted); with System.WCh_Con; with GNAT.Decode_String; package GNAT.Decode_UTF8_String is new GNAT.Decode_String (System.WCh_Con.WCEM_UTF8); pragma Pure (GNAT.Decode_UTF8_String);
-- C43004C.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 CONSTRAINT_ERROR IS RAISED IF THE VALUE OF A -- DISCRIMINANT OF A CONSTRAINED COMPONENT OF AN AGGREGATE DOES -- NOT EQUAL THE CORRESPONDING DISCRIMINANT VALUE FOR THE -- COMPONENT'S SUBTYPE. -- HISTORY: -- BCB 07/19/88 CREATED ORIGINAL TEST. WITH REPORT; USE REPORT; PROCEDURE C43004C IS ZERO : INTEGER := 0; TYPE REC (D : INTEGER := 0) IS RECORD COMP1 : INTEGER; END RECORD; TYPE DREC (DD : INTEGER := ZERO) IS RECORD DCOMP1 : INTEGER; END RECORD; TYPE REC1 IS RECORD A : REC(0); END RECORD; TYPE REC2 IS RECORD B : DREC(ZERO); END RECORD; TYPE REC3 (D3 : INTEGER := 0) IS RECORD C : REC(D3); END RECORD; V : REC1; W : REC2; X : REC3; PACKAGE P IS TYPE PRIV1 (D : INTEGER := 0) IS PRIVATE; TYPE PRIV2 (DD : INTEGER := ZERO) IS PRIVATE; FUNCTION INIT (I : INTEGER) RETURN PRIV1; PRIVATE TYPE PRIV1 (D : INTEGER := 0) IS RECORD NULL; END RECORD; TYPE PRIV2 (DD : INTEGER := ZERO) IS RECORD NULL; END RECORD; END P; TYPE REC7 IS RECORD H : P.PRIV1 (0); END RECORD; Y : REC7; GENERIC TYPE GP IS PRIVATE; FUNCTION GEN_EQUAL (X, Y : GP) RETURN BOOLEAN; FUNCTION GEN_EQUAL (X, Y : GP) RETURN BOOLEAN IS BEGIN RETURN X = Y; END GEN_EQUAL; PACKAGE BODY P IS TYPE REC4 IS RECORD E : PRIV1(0); END RECORD; TYPE REC5 IS RECORD F : PRIV2(ZERO); END RECORD; TYPE REC6 (D6 : INTEGER := 0) IS RECORD G : PRIV1(D6); END RECORD; VV : REC4; WW : REC5; XX : REC6; FUNCTION REC4_EQUAL IS NEW GEN_EQUAL (REC4); FUNCTION REC5_EQUAL IS NEW GEN_EQUAL (REC5); FUNCTION REC6_EQUAL IS NEW GEN_EQUAL (REC6); FUNCTION INIT (I : INTEGER) RETURN PRIV1 IS VAR : PRIV1; BEGIN VAR := (D => I); RETURN VAR; END INIT; BEGIN TEST ("C43004C", "CHECK THAT CONSTRAINT_ERROR IS RAISED " & "IF THE VALUE OF A DISCRIMINANT OF A " & "CONSTRAINED COMPONENT OF AN AGGREGATE " & "DOES NOT EQUAL THE CORRESPONDING " & "DISCRIMINANT VALUE FOR THECOMPONENT'S " & "SUBTYPE"); BEGIN VV := (E => (D => 1)); FAILED ("CONSTRAINT_ERROR NOT RAISED - 1"); IF REC4_EQUAL (VV,VV) THEN COMMENT ("DON'T OPTIMIZE VV"); END IF; EXCEPTION WHEN CONSTRAINT_ERROR => NULL; WHEN OTHERS => FAILED ("OTHER EXCEPTION RAISED - 1"); END; BEGIN WW := (F => (DD => 1)); FAILED ("CONSTRAINT_ERROR NOT RAISED - 2"); IF REC5_EQUAL (WW,WW) THEN COMMENT ("DON'T OPTIMIZE WW"); END IF; EXCEPTION WHEN CONSTRAINT_ERROR => NULL; WHEN OTHERS => FAILED ("OTHER EXCEPTION RAISED - 2"); END; BEGIN XX := (D6 => 1, G => (D => 5)); FAILED ("CONSTRAINT_ERROR NOT RAISED - 3"); IF REC6_EQUAL (XX,XX) THEN COMMENT ("DON'T OPTIMIZE XX"); END IF; EXCEPTION WHEN CONSTRAINT_ERROR => NULL; WHEN OTHERS => FAILED ("OTHER EXCEPTION RAISED - 3"); END; END P; USE P; FUNCTION REC1_EQUAL IS NEW GEN_EQUAL (REC1); FUNCTION REC2_EQUAL IS NEW GEN_EQUAL (REC2); FUNCTION REC3_EQUAL IS NEW GEN_EQUAL (REC3); FUNCTION REC7_EQUAL IS NEW GEN_EQUAL (REC7); BEGIN BEGIN V := (A => (D => 1, COMP1 => 2)); FAILED ("CONSTRAINT_ERROR NOT RAISED - 4"); IF REC1_EQUAL (V,V) THEN COMMENT ("DON'T OPTIMIZE V"); END IF; EXCEPTION WHEN CONSTRAINT_ERROR => NULL; WHEN OTHERS => FAILED ("OTHER EXCEPTION RAISED - 4"); END; BEGIN W := (B => (DD => 1, DCOMP1 => 2)); FAILED ("CONSTRAINT_ERROR NOT RAISED - 5"); IF REC2_EQUAL (W,W) THEN COMMENT ("DON'T OPTIMIZE W"); END IF; EXCEPTION WHEN CONSTRAINT_ERROR => NULL; WHEN OTHERS => FAILED ("OTHER EXCEPTION RAISED - 5"); END; BEGIN X := (D3 => 1, C => (D => 5, COMP1 => 2)); FAILED ("CONSTRAINT_ERROR NOT RAISED - 6"); IF REC3_EQUAL (X,X) THEN COMMENT ("DON'T OPTIMIZE X"); END IF; EXCEPTION WHEN CONSTRAINT_ERROR => NULL; WHEN OTHERS => FAILED ("OTHER EXCEPTION RAISED - 6"); END; BEGIN Y := (H => INIT (1)); FAILED ("CONSTRAINT_ERROR NOT RAISED - 7"); IF REC7_EQUAL (Y,Y) THEN COMMENT ("DON'T OPTIMIZE Y"); END IF; EXCEPTION WHEN CONSTRAINT_ERROR => NULL; WHEN OTHERS => FAILED ("OTHER EXCEPTION RAISED - 7"); END; RESULT; END C43004C;
with ada.unchecked_Deallocation; package body lace.Subject_and_deferred_Observer is package body Forge is function to_Subject_and_Observer (Name : in String) return Item is begin return Self : Item do Self.Name := to_unbounded_String (Name); end return; end to_Subject_and_Observer; function new_Subject_and_Observer (Name : in String) return View is begin return new Item' (to_Subject_and_Observer (Name)); end new_Subject_and_Observer; end Forge; overriding procedure destroy (Self : in out Item) is begin Deferred.destroy (Deferred.item (Self)); -- Destroy base classes. Subject .destroy (Subject .item (Self)); end destroy; procedure free (Self : in out View) is procedure deallocate is new ada.unchecked_Deallocation (Item'Class, View); begin Self.destroy; deallocate (Self); end free; overriding function Name (Self : in Item) return String is begin return to_String (Self.Name); end Name; end lace.Subject_and_deferred_Observer;
------------------------------------------------------------------------------ -- -- -- GNAT RUN-TIME COMPONENTS -- -- -- -- A D A . C A L E N D A R -- -- -- -- B o d y -- -- -- -- Copyright (C) 2004-2021, AdaCore -- -- -- -- GNAT is free software; you can redistribute it and/or modify it under -- -- terms of the GNU General Public License as published by the Free Soft- -- -- ware Foundation; either version 3, or (at your option) any later ver- -- -- sion. GNAT is distributed in the hope that it will be useful, but WITH- -- -- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY -- -- or FITNESS FOR A PARTICULAR PURPOSE. -- -- -- -- -- -- -- -- -- -- -- -- You should have received a copy of the GNU General Public License and -- -- a copy of the GCC Runtime Library Exception along with this program; -- -- see the files COPYING3 and COPYING.RUNTIME respectively. If not, see -- -- <http://www.gnu.org/licenses/>. -- -- -- -- GNAT was originally developed by the GNAT team at New York University. -- -- Extensive contributions were provided by Ada Core Technologies Inc. -- -- -- ------------------------------------------------------------------------------ -- This is the cert and bare metal Ravenscar runtime version of this package package body Ada.Calendar with SPARK_Mode => Off is ------------------------ -- Local Declarations -- ------------------------ Secs_Per_Day : constant := 86_400.0; -- Number of seconds in a day -- Julian day range covers Ada.Time range requirement with smallest -- possible delta within 64 bits. This type is used for calculations that -- do not need to preserve the precision of type Duration and that need a -- larger Julian Day range than the Modified Julian Day provides, because -- of the algorithms used type Julian_Day is delta Duration'Small / (86_400.0 / 2.0 ** 5) range 2415_385.5 .. 2488_069.5; for Julian_Day'Small use Duration'Small / (86_400.0 / 2.0 ** 5); function Trunc (Arg : Time) return Integer; -- Truncate Time function Trunc (Arg : Duration) return Integer; -- Truncate Duration function Trunc (Arg : Julian_Day'Base) return Integer; -- Truncate Julian Day function Valid_Date (D : Day_Number; M : Month_Number; Y : Year_Number) return Boolean; -- Check for valid Gregorian calendar date --------- -- "+" -- --------- function "+" (Left : Time; Right : Duration) return Time is pragma Unsuppress (Overflow_Check, Time); Result : Time; begin Result := Left + Time (Right / Secs_Per_Day); return Result; exception when Constraint_Error => raise Time_Error; end "+"; function "+" (Left : Duration; Right : Time) return Time is pragma Unsuppress (Overflow_Check, Time); Result : Time; begin Result := Time (Left / Secs_Per_Day) + Right; return Result; exception when Constraint_Error => raise Time_Error; end "+"; --------- -- "-" -- --------- function "-" (Left : Time; Right : Duration) return Time is pragma Unsuppress (Overflow_Check, Time); Result : Time; begin Result := Left - Time (Right / Secs_Per_Day); return Result; exception when Constraint_Error => raise Time_Error; end "-"; function "-" (Left : Time; Right : Time) return Duration is pragma Unsuppress (Overflow_Check, Time); Temp : Time; Result : Duration; begin Temp := Left - Right; Result := Duration (Secs_Per_Day * Temp); return Result; exception when Constraint_Error => raise Time_Error; end "-"; --------- -- "<" -- --------- function "<" (Left, Right : Time) return Boolean is begin return Modified_Julian_Day (Left) < Modified_Julian_Day (Right); end "<"; ---------- -- "<=" -- ---------- function "<=" (Left, Right : Time) return Boolean is begin return Modified_Julian_Day (Left) <= Modified_Julian_Day (Right); end "<="; --------- -- ">" -- --------- function ">" (Left, Right : Time) return Boolean is begin return Modified_Julian_Day (Left) > Modified_Julian_Day (Right); end ">"; ---------- -- ">=" -- ---------- function ">=" (Left, Right : Time) return Boolean is begin return Modified_Julian_Day (Left) >= Modified_Julian_Day (Right); end ">="; ----------- -- Clock -- ----------- function Clock return Time is separate; --------- -- Day -- --------- function Day (Date : Time) return Day_Number is DY : Year_Number; DM : Month_Number; DD : Day_Number; DS : Day_Duration; begin Split (Date, DY, DM, DD, DS); return DD; end Day; ----------- -- Month -- ----------- function Month (Date : Time) return Month_Number is DY : Year_Number; DM : Month_Number; DD : Day_Number; DS : Day_Duration; begin Split (Date, DY, DM, DD, DS); return DM; end Month; ------------- -- Seconds -- ------------- function Seconds (Date : Time) return Day_Duration is DY : Year_Number; DM : Month_Number; DD : Day_Number; DS : Day_Duration; begin Split (Date, DY, DM, DD, DS); return DS; end Seconds; ----------- -- Split -- ----------- procedure Split (Date : Time; Year : out Year_Number; Month : out Month_Number; Day : out Day_Number; Seconds : out Day_Duration) is -- Algorithm is the standard astronomical one for conversion -- from a Julian Day number to the Gregorian calendar date. -- Adapted from J. Meeus' "Astronomical Algorithms" pp 63 - 4. -- No need to check for Trunc (Date) < 2299_161 (Ada "Time" is -- always a Gregorian date). -- Split off fractional part before losing precision: F : constant Time'Base := Date - Time (Trunc (Date)); -- Do remainder of calcs on full Julian day number with less precision -- in fractional part (not necessary for these calcs) JD_Date : constant Julian_Day := Julian_Day'Base (Date) + Julian_Day'Base'(240_0000.5); Z : constant Integer := Trunc (JD_Date + Julian_Day'Base (0.5)); A, B, C, D, E : Integer; Alpha : constant Integer := Trunc (Julian_Day'Base ((Julian_Day'Base (Z) - Julian_Day'Base'(1867_216.25)) / Julian_Day'Base'(36524.25))); begin -- Generate intermediate values A := Z + 1 + Alpha - Alpha / 4; B := A + 1524; C := Trunc (Julian_Day'Base ((Julian_Day'Base (B) - Julian_Day'Base'(122.1)) / Julian_Day'Base'(365.25))); D := Trunc (Julian_Day'Base (Julian_Day'Base'(365.25) * Julian_Day'Base (C))); E := Trunc (Duration (Duration (B - D) / 30.6001)); -- Generate results from intermediate values Month := E - (if E < 14 then 1 else 13); Year := C - (if Month > 2 then 4716 else 4715); Day := B - D - Trunc (Duration (30.6001 * Duration (E))); -- Restore seconds from precise fractional part Seconds := Day_Duration (86_400.0 * F); end Split; ------------- -- Time_Of -- ------------- function Time_Of (Year : Year_Number; Month : Month_Number; Day : Day_Number; Seconds : Day_Duration := 0.0) return Time is -- This is an adaptation of the standard astronomical algorithm for -- conversion from a Gregorian calendar date to a Julian day number. -- Taken from J. Meeus' "Astronomical Algorithms" pp 60 - 1. Month_Num : Natural := Month; Year_Num : Integer := Year; A, B : Integer; type Day_Type is delta Modified_Julian_Day'Delta range 0.0 .. 32.0; for Day_Type'Small use Modified_Julian_Day'Small; Day_Val : constant Day_Type := Day_Type (Day) + Day_Type (Seconds / Secs_Per_Day); subtype Month_Fixed is Duration range 4.0 .. 15.0; begin -- Check for valid date if not Valid_Date (Day, Month, Year) then raise Time_Error; end if; if Month_Num <= 2 then Year_Num := Year_Num - 1; Month_Num := Month_Num + 12; end if; A := Year_Num / 100; B := 2 - A + A / 4; return Time'Base (Day_Val) + Time (Julian_Day'Base ( (B + Trunc (Duration (30.6001 * Month_Fixed (Month_Num + 1))) + Trunc (Julian_Day'Base (Julian_Day'Base'(365.25) * Julian_Day'Base (Year_Num + 4716))))) - Julian_Day'Base'(1524.5) - Julian_Day'Base'(240_0000.5)); end Time_Of; ----------- -- Trunc -- ----------- function Trunc (Arg : Time) return Integer is Rounded : constant Integer := Integer (Arg); Sign : constant Integer := Rounded / abs (Rounded); begin if abs (Time (Rounded)) > abs (Arg) then return Rounded - Sign; else return Rounded; end if; end Trunc; function Trunc (Arg : Duration) return Integer is Rounded : constant Integer := Integer (Arg); begin if Rounded = 0 or else abs (Duration (Rounded)) <= abs (Arg) then return Rounded; else return Rounded - Rounded / abs (Rounded); end if; end Trunc; function Trunc (Arg : Julian_Day'Base) return Integer is Rounded : constant Integer := Integer (Arg); begin if Rounded = 0 or else abs (Julian_Day'Base (Rounded)) <= abs (Arg) then return Rounded; else return Rounded - Rounded / abs (Rounded); end if; end Trunc; ---------------- -- Valid_Date -- ---------------- function Valid_Date (D : Day_Number; M : Month_Number; Y : Year_Number) return Boolean is begin -- Check that input values have valid representations. This check is not -- strictly required, since the only way we could fail this test is if -- the Time_Of caller suppressed checks, in which case we have erroneous -- execution. However, raising Time_Error in this case seems a friendly -- way to handle the erroneous action. if not (Y'Valid and then M'Valid and then D'Valid) then return False; end if; -- Deal with checking day according to month case M is -- Apr | Jun | Sep | Nov when 4 | 6 | 9 | 11 => return D <= 30; -- Note: lower bound OK due to 'Valid. Lower bound check would be -- optimized away anyway, and resulted in a compilation warning. -- Feb when 2 => -- Do leap year check. Note that we do not need to check centuries -- due to the limited range of Year_Number. if Y mod 4 = 0 then return D <= 29; -- Note: lower bound OK due to 'Valid else return D <= 28; -- Note: lower bound OK due to 'Valid end if; -- Jan | Mar | May | Jul | Aug | Oct | Dec when 1 | 3 | 5 | 7 | 8 | 10 | 12 => return True; end case; end Valid_Date; ---------- -- Year -- ---------- function Year (Date : Time) return Year_Number is DY : Year_Number; DM : Month_Number; DD : Day_Number; DS : Day_Duration; begin Split (Date, DY, DM, DD, DS); return DY; end Year; -- Start of elaboration code for Ada.Calendar begin Radix_Time := Time_Of (1970, 1, 1, 0.0); end Ada.Calendar;
with Ada.Sequential_IO; with Ada.Directories; pragma Warnings (Off, "no entities of ""Ada.Text_IO"" are referenced"); pragma Warnings (Off, "use clause for package ""Text_IO"" has no effect"); with Ada.Text_IO; use Ada.Text_IO; package body Utilities is ----------- -- Slurp -- ----------- function Slurp (Filename : String) return String is subtype Content is String (1 .. Integer (Ada.Directories.Size (Filename))); Result : Content; package Content_IO is new Ada.Sequential_IO (Content); Input : Content_IO.File_Type; begin -- Put_Line (Filename'Length'Image); -- Put_Line (Filename); Content_IO.Open (File => Input, Mode => Content_IO.In_File, Name => Filename); Content_IO.Read (File => Input, Item => Result); Content_IO.Close (Input); return Result; end Slurp; end Utilities;
-- -- package Spherical_Harmonics -- -- Actually makes just the part that varies in Theta..leaves out -- the Exp(i*m*Phi) / Sqrt(2*Pi), which is all that's required to complete -- the spherical harmonic. Uses package Clenshaw to make the polynomials. -- -- The results may be thought of as normalized versions of Associated -- Legendre Functions, Q(k, m, X) (which in standard form are not -- normalized, and are not actually polynomials if m is odd). -- -- Designed to be most efficient when k and X change a lot, and m -- changes rarely. A table of Normalization factors for fixed -- m and varying k is made. if k is fixed and m varies a lot, then -- this method is grossly inefficient. -- -- Package should be thought of as an example of how to use package -- Clenshaw and package A_Legendre to make spherical harmonics. There -- will always be more efficient methods. Best method is problem dependent. -- -- (un-normalized) Spherical_Harmonic (m, k): ( l = k + m ) -- -- Q_0 (m, X) = (-1)**m * Sqrt(1-X*X)**m -- Q_1 (m, X) = X * (2*(m+1) - 1) * Q_0 (m, X) = Alpha*Q_0 -- Q_k (m, X) = X * ((2*(m+k) - 1) / k) * Q_k-1 (m, X) -- -((k + 2*m - 1) / k) * Q_k-2 (m, X) -- Alpha (k, m, X) = X * (2*(m+k) - 1) / k -- Beta (k, m, X) = -(k + 2*m - 1) / k -- -- Functions are orthogonal on the interval [-1,1] with -- weight function W(X) = 1. Orthogonality is respect integration, not -- summation of discrete data points. Normalizing integral: -- -- Int (Q_k(m, X) * Q_k(m, X) * W(X)) -- = 2*(k+2*m)! / ((2*k + 2*m + 1) * (k!*(2m-1)!!**2)) -- -- The actual Associated Legendre Polys are usually defined with (2m-1)!! times -- the Q_0 given above, but this leads to overflow, so it's put in the Norm. -- -- The m values for the Associated Legendre Polys are always non-negative. When -- you use Associated Legendre Polys to make spherical, (where m is in -l..l) -- then use Abs(m) to make the Assoc. Legendre Polys. -- Azimuthal quantum number l is equal to k + m. -- Notice that l_min = m, (since m_max = l). k is in 0..inf, -- so l = k + m is in m..inf. So in the standard l and m notation, (m > -1): -- -- Int (Q_k(m, X) * Q_k(m, X) * W(X)) -- = 2*(l+m)! / ((2*l + 1) * (l-m)! * (2m-1)!!)) -- -- To make spherical harmonics, which -- are normalized respect integration in Phi also, you multiply the results -- of Clenshaw (the Associated Legendre Functions) by -- Sqrt [(2*l + 1) * (l-m)! * (2m-1)!! / 2*(l+m)!] and by -- [1.0 / Sqrt (2*Pi)] * Exp(i*m*Psi). -- generic type Real is digits <>; with function Sqrt (X : Real) return Real; with function Exp (X : Real) return Real; with function Log (X : Real) return Real; type Base_Poly_Index is range <>; Poly_Limit : Base_Poly_Index; package Spherical_Harmonics is pragma Assert (Poly_Limit > 1 and Base_Poly_Index'First <= 0); -- Index l is of type Base_Poly_Index, and l must be >= 0. function X_Lower_Bound return Real; -- -1.0 function X_Upper_Bound return Real; -- +1.0 -- The Spherical_Harms use a table to speed up calculation: designed -- to be efficient when X and k change a lot, and m changes rarely. function Spherical_Harm (l : Base_Poly_Index; m : Real; X : Real; Iterations : Positive := 1) return Real; -- Uses Evaluate_Qs() to get array of Spherical_Harm(X) in k=[0, l]. -- -- For efficiency, ought to add another version of Spherical_Harm that -- returns the whole array of Vals, from l = 0 to l_max. -- -- Seems to work ok to l,m >> 3000. -- -- Seems to work to machine precision to very high l,m, so haven't -- found a limit where Iterations > 1 is needed. function Spherical_Harm_2 (l : Base_Poly_Index; m : Real; X : Real; Iterations : Positive := 1) return Real; -- Uses Clenshaw's summation to get Spherical_Harmonics. Used for -- testing, mainly. function Poly_Weight (X : Real) return Real; end Spherical_Harmonics;
-- Copyright (c) 2020-2021 Bartek thindil Jasicki <thindil@laeran.pl> -- -- This program is free software: you can redistribute it and/or modify -- it under the terms of the GNU General Public License as published by -- the Free Software Foundation, either version 3 of the License, or -- (at your option) any later version. -- -- This program is distributed in the hope that it will be useful, -- but WITHOUT ANY WARRANTY; without even the implied warranty of -- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -- GNU General Public License for more details. -- -- You should have received a copy of the GNU General Public License -- along with this program. If not, see <http://www.gnu.org/licenses/>. with Ada.Characters.Handling; use Ada.Characters.Handling; with Ada.Characters.Latin_1; use Ada.Characters.Latin_1; with Ada.Containers.Generic_Array_Sort; with Ada.Strings; use Ada.Strings; with Ada.Strings.Fixed; use Ada.Strings.Fixed; with Interfaces.C; use Interfaces.C; with Interfaces.C.Strings; use Interfaces.C.Strings; with CArgv; use CArgv; with Tcl; use Tcl; with Tcl.Ada; use Tcl.Ada; with Tcl.Tk.Ada; use Tcl.Tk.Ada; with Tcl.Tk.Ada.Grid; with Tcl.Tk.Ada.Widgets; use Tcl.Tk.Ada.Widgets; with Tcl.Tk.Ada.Widgets.Canvas; use Tcl.Tk.Ada.Widgets.Canvas; with Tcl.Tk.Ada.Widgets.Menu; use Tcl.Tk.Ada.Widgets.Menu; with Tcl.Tk.Ada.Widgets.Toplevel.MainWindow; use Tcl.Tk.Ada.Widgets.Toplevel.MainWindow; with Tcl.Tk.Ada.Widgets.TtkButton; use Tcl.Tk.Ada.Widgets.TtkButton; with Tcl.Tk.Ada.Widgets.TtkButton.TtkRadioButton; use Tcl.Tk.Ada.Widgets.TtkButton.TtkRadioButton; with Tcl.Tk.Ada.Widgets.TtkEntry.TtkComboBox; use Tcl.Tk.Ada.Widgets.TtkEntry.TtkComboBox; with Tcl.Tk.Ada.Widgets.TtkFrame; use Tcl.Tk.Ada.Widgets.TtkFrame; with Tcl.Tk.Ada.Widgets.TtkLabel; use Tcl.Tk.Ada.Widgets.TtkLabel; with Tcl.Tk.Ada.Widgets.TtkProgressBar; use Tcl.Tk.Ada.Widgets.TtkProgressBar; with Tcl.Tk.Ada.Widgets.TtkScale; use Tcl.Tk.Ada.Widgets.TtkScale; with Tcl.Tk.Ada.Widgets.TtkScrollbar; use Tcl.Tk.Ada.Widgets.TtkScrollbar; with Tcl.Tk.Ada.Winfo; use Tcl.Tk.Ada.Winfo; with Tcl.Tklib.Ada.Autoscroll; use Tcl.Tklib.Ada.Autoscroll; with Tcl.Tklib.Ada.Tooltip; use Tcl.Tklib.Ada.Tooltip; with Bases.Trade; use Bases.Trade; with Config; use Config; with CoreUI; use CoreUI; with Dialogs; use Dialogs; with Maps; use Maps; with Maps.UI; use Maps.UI; with Ships.Crew; use Ships.Crew; with Table; use Table; with Utils.UI; use Utils.UI; package body Bases.RecruitUI is -- ****iv* RecruitUI/RecruitUI.RecruitTable -- FUNCTION -- Table with info about the available recruits -- SOURCE RecruitTable: Table_Widget (6); -- **** -- ****iv* RecruitUI/RecruitUI.Modules_Indexes -- FUNCTION -- Indexes of the available recruits in base -- SOURCE Recruits_Indexes: Positive_Container.Vector; -- **** -- ****if* RecruitUI/RecruitUI.Get_Highest_Attribute -- FUNCTION -- Get the highest attribute's name of the selected recruit -- PARAMETERS -- BaseIndex - The index of the base in which the recruit's attributes -- will be check -- MemberIndex - The index of the recruit which attributes will be check -- RESULT -- The name of the attribute with the highest level of the selected recruit -- HISTORY -- 6.5 - Added -- SOURCE function Get_Highest_Attribute (BaseIndex, MemberIndex: Positive) return Unbounded_String is -- **** use Tiny_String; HighestLevel, HighestIndex: Positive := 1; begin Get_Highest_Attribute_Level_Loop : for I in Sky_Bases(BaseIndex).Recruits(MemberIndex).Attributes'Range loop if Sky_Bases(BaseIndex).Recruits(MemberIndex).Attributes(I).Level > HighestLevel then HighestLevel := Sky_Bases(BaseIndex).Recruits(MemberIndex).Attributes(I).Level; HighestIndex := I; end if; end loop Get_Highest_Attribute_Level_Loop; return To_Unbounded_String (To_String (AttributesData_Container.Element(Attributes_List, HighestIndex) .Name)); end Get_Highest_Attribute; -- ****if* RecruitUI/RecruitUI.Get_Highest_Skill -- FUNCTION -- Get the highest skill's name of the selected recruit -- PARAMETERS -- BaseIndex - The index of the base in which the recruit's skills will -- be check -- MemberIndex - The index of the recruit which skills will be check -- RESULT -- The name of the skill with the highest level of the selected recruit -- HISTORY -- 6.5 - Added -- SOURCE function Get_Highest_Skill (BaseIndex, MemberIndex: Positive) return Unbounded_String is -- **** use Tiny_String; HighestLevel, HighestIndex: Positive := 1; begin Get_Highest_Skill_Level_Loop : for Skill of Sky_Bases(BaseIndex).Recruits(MemberIndex).Skills loop if Skill.Level > HighestLevel then HighestLevel := Skill.Level; HighestIndex := Skill.Index; end if; end loop Get_Highest_Skill_Level_Loop; return To_Unbounded_String (To_String (SkillsData_Container.Element(Skills_List, HighestIndex).Name)); end Get_Highest_Skill; -- ****o* RecruitUI/RecruitUI.Show_Recruit_Command -- FUNCTION -- Show the selected base available recruits -- PARAMETERS -- ClientData - Custom data send to the command. Unused -- Interp - Tcl interpreter in which command was executed. -- Argc - Number of arguments passed to the command. -- Argv - Values of arguments passed to the command. -- RESULT -- This function always return TCL_OK -- COMMANDS -- ShowRecruit -- SOURCE function Show_Recruit_Command (ClientData: Integer; Interp: Tcl.Tcl_Interp; Argc: Interfaces.C.int; Argv: CArgv.Chars_Ptr_Ptr) return Interfaces.C.int with Convention => C; -- **** function Show_Recruit_Command (ClientData: Integer; Interp: Tcl.Tcl_Interp; Argc: Interfaces.C.int; Argv: CArgv.Chars_Ptr_Ptr) return Interfaces.C.int is pragma Unreferenced(ClientData); RecruitFrame: Ttk_Frame := Get_Widget(Main_Paned & ".recruitframe", Interp); BaseIndex: constant Positive := SkyMap(Player_Ship.Sky_X, Player_Ship.Sky_Y).BaseIndex; Page: constant Positive := (if Argc = 2 then Positive'Value(CArgv.Arg(Argv, 1)) else 1); Start_Row: constant Positive := ((Page - 1) * Game_Settings.Lists_Limit) + 1; Current_Row: Positive := 1; begin if Winfo_Get(RecruitFrame, "exists") = "0" then RecruitFrame := Create(Widget_Image(RecruitFrame)); RecruitTable := CreateTable (Parent => Widget_Image(RecruitFrame), Headers => (To_Unbounded_String("Name"), To_Unbounded_String("Gender"), To_Unbounded_String("Faction"), To_Unbounded_String("Base cost"), To_Unbounded_String("Highest stat"), To_Unbounded_String("Highest skill")), Command => "SortRecruits", Tooltip => "Press mouse button to sort the recruits."); Bind (RecruitFrame, "<Configure>", "{ResizeCanvas " & RecruitTable.Canvas & " %w %h}"); elsif Winfo_Get(RecruitFrame, "ismapped") = "1" and (Argc = 1 or Sky_Bases(BaseIndex).Recruits.Length = 0) then Tcl.Tk.Ada.Grid.Grid_Remove(Close_Button); Entry_Configure(GameMenu, "Help", "-command {ShowHelp general}"); ShowSkyMap(True); return TCL_OK; end if; Entry_Configure(GameMenu, "Help", "-command {ShowHelp crew}"); Tcl.Tk.Ada.Grid.Grid(Close_Button, "-row 0 -column 1"); if Recruits_Indexes.Length /= Sky_Bases(BaseIndex).Recruits.Length then Recruits_Indexes.Clear; for I in Sky_Bases(BaseIndex).Recruits.Iterate loop Recruits_Indexes.Append(Recruit_Container.To_Index(I)); end loop; end if; ClearTable(RecruitTable); Load_Recruits_Loop : for I of Recruits_Indexes loop if Current_Row < Start_Row then Current_Row := Current_Row + 1; goto End_Of_Loop; end if; AddButton (RecruitTable, To_String(Sky_Bases(BaseIndex).Recruits(I).Name), "Show available options for recruit", "ShowRecruitMenu" & Positive'Image(I), 1); AddButton (RecruitTable, (if Sky_Bases(BaseIndex).Recruits(I).Gender = 'F' then "Female" else "Male"), "Show available options for recruit", "ShowRecruitMenu" & Positive'Image(I), 2); AddButton (RecruitTable, To_String (Factions_List(Sky_Bases(BaseIndex).Recruits(I).Faction).Name), "Show available options for recruit", "ShowRecruitMenu" & Positive'Image(I), 3); AddButton (RecruitTable, Positive'Image(Sky_Bases(BaseIndex).Recruits(I).Price), "Show available options for recruit", "ShowRecruitMenu" & Positive'Image(I), 4); AddButton (RecruitTable, To_String(Get_Highest_Attribute(BaseIndex, I)), "Show available options for recruit", "ShowRecruitMenu" & Positive'Image(I), 5); AddButton (RecruitTable, To_String(Get_Highest_Skill(BaseIndex, I)), "Show available options for recruit", "ShowRecruitMenu" & Positive'Image(I), 6, True); exit Load_Recruits_Loop when RecruitTable.Row = Game_Settings.Lists_Limit + 1; <<End_Of_Loop>> end loop Load_Recruits_Loop; if Page > 1 then if RecruitTable.Row < Game_Settings.Lists_Limit + 1 then AddPagination (RecruitTable, "ShowRecruit" & Positive'Image(Page - 1), ""); else AddPagination (RecruitTable, "ShowRecruit" & Positive'Image(Page - 1), "ShowRecruit" & Positive'Image(Page + 1)); end if; elsif RecruitTable.Row = Game_Settings.Lists_Limit + 1 then AddPagination (RecruitTable, "", "ShowRecruit" & Positive'Image(Page + 1)); end if; UpdateTable(RecruitTable); configure (RecruitTable.Canvas, "-scrollregion [list " & BBox(RecruitTable.Canvas, "all") & "]"); Show_Screen("recruitframe"); return TCL_OK; end Show_Recruit_Command; -- ****iv* RecruitUI/RecruitUI.RecruitIndex -- FUNCTION -- The index of currently selected recruit -- SOURCE RecruitIndex: Positive; -- **** -- ****o* RecruitUI/RecruitUI.Show_Recruit_Menu_Command -- FUNCTION -- Show menu with actions for the selected recruit -- PARAMETERS -- ClientData - Custom data send to the command. Unused -- Interp - Tcl interpreter in which command was executed. -- Argc - Number of arguments passed to the command. Unused -- Argv - Values of arguments passed to the command. -- RESULT -- This function always return TCL_OK -- COMMANDS -- ShowRecruitMenu recruitindex -- RecruitIndex is a index of the recruit which menu will be shown -- SOURCE function Show_Recruit_Menu_Command (ClientData: Integer; Interp: Tcl.Tcl_Interp; Argc: Interfaces.C.int; Argv: CArgv.Chars_Ptr_Ptr) return Interfaces.C.int with Convention => C; -- **** function Show_Recruit_Menu_Command (ClientData: Integer; Interp: Tcl.Tcl_Interp; Argc: Interfaces.C.int; Argv: CArgv.Chars_Ptr_Ptr) return Interfaces.C.int is pragma Unreferenced(ClientData, Argc); RecruitMenu: Tk_Menu := Get_Widget(".recruitmenu", Interp); begin RecruitIndex := Positive'Value(CArgv.Arg(Argv, 1)); if Winfo_Get(RecruitMenu, "exists") = "0" then RecruitMenu := Create(".recruitmenu", "-tearoff false"); end if; Delete(RecruitMenu, "0", "end"); Menu.Add (RecruitMenu, "command", "-label {Show recruit details} -command {ShowRecruitInfo}"); Menu.Add (RecruitMenu, "command", "-label {Start negotiations} -command {Negotiate}"); Tk_Popup (RecruitMenu, Winfo_Get(Get_Main_Window(Interp), "pointerx"), Winfo_Get(Get_Main_Window(Interp), "pointery")); return TCL_OK; end Show_Recruit_Menu_Command; -- ****o* RecruitUI/RecruitUI.Show_Recruit_Info_Command -- FUNCTION -- Show information about the selected recruit -- PARAMETERS -- ClientData - Custom data send to the command. Unused -- Interp - Tcl interpreter in which command was executed. -- Argc - Number of arguments passed to the command. Unused -- Argv - Values of arguments passed to the command. Unused -- RESULT -- This function always return TCL_OK -- COMMANDS -- ShowRecruitInfoCommand -- SOURCE function Show_Recruit_Info_Command (ClientData: Integer; Interp: Tcl.Tcl_Interp; Argc: Interfaces.C.int; Argv: CArgv.Chars_Ptr_Ptr) return Interfaces.C.int with Convention => C; -- **** function Show_Recruit_Info_Command (ClientData: Integer; Interp: Tcl.Tcl_Interp; Argc: Interfaces.C.int; Argv: CArgv.Chars_Ptr_Ptr) return Interfaces.C.int is pragma Unreferenced(ClientData, Argc, Argv); use Tiny_String; RecruitInfo: Unbounded_String; BaseIndex: constant Positive := SkyMap(Player_Ship.Sky_X, Player_Ship.Sky_Y).BaseIndex; Recruit: constant Recruit_Data := Sky_Bases(BaseIndex).Recruits(RecruitIndex); RecruitDialog: constant Ttk_Frame := Create_Dialog(".recruitdialog", To_String(Recruit.Name)); YScroll: constant Ttk_Scrollbar := Create (RecruitDialog & ".yscroll", "-orient vertical -command [list " & RecruitDialog & ".canvas yview]"); RecruitCanvas: constant Tk_Canvas := Create (RecruitDialog & ".canvas", "-yscrollcommand [list " & YScroll & " set]"); CloseButton, InfoButton, Button: Ttk_Button; Height, NewHeight: Positive := 1; Width, NewWidth: Positive := 1; ProgressBar: Ttk_ProgressBar; TabButton: Ttk_RadioButton; Frame: Ttk_Frame := Create(RecruitDialog & ".buttonbox"); RecruitLabel: Ttk_Label; ProgressFrame: Ttk_Frame; TabNames: constant array(1 .. 4) of Unbounded_String := (To_Unbounded_String("General"), To_Unbounded_String("Attributes"), To_Unbounded_String("Skills"), To_Unbounded_String("Inventory")); begin Tcl_SetVar(Interp, "newtab", To_Lower(To_String(TabNames(1)))); for I in TabNames'Range loop TabButton := Create (Frame & "." & To_Lower(To_String(TabNames(I))), " -text " & To_String(TabNames(I)) & " -style Radio.Toolbutton -value " & To_Lower(To_String(TabNames(I))) & " -variable newtab -command ShowRecruitTab"); Tcl.Tk.Ada.Grid.Grid (TabButton, "-column" & Natural'Image(I - 1) & " -row 0"); Bind (TabButton, "<Escape>", "{" & RecruitDialog & ".buttonbox2.button invoke;break}"); end loop; Height := Positive'Value(Winfo_Get(TabButton, "reqheight")); Bind (TabButton, "<Tab>", "{focus " & RecruitDialog & ".buttonbox2.hirebutton;break}"); Tcl.Tk.Ada.Grid.Grid(Frame, "-pady {5 0} -columnspan 2"); Tcl.Tk.Ada.Grid.Grid(RecruitCanvas, "-sticky nwes -pady 5 -padx 5"); Tcl.Tk.Ada.Grid.Grid (YScroll, " -sticky ns -pady 5 -padx {0 5} -row 1 -column 1"); Frame := Create(RecruitDialog & ".buttonbox2"); Button := Create (RecruitDialog & ".buttonbox2.hirebutton", "-text Negotiate -command {CloseDialog " & RecruitDialog & ";Negotiate}"); Tcl.Tk.Ada.Grid.Grid(Button); CloseButton := Create (RecruitDialog & ".buttonbox2.button", "-text Close -command {CloseDialog " & RecruitDialog & "}"); Tcl.Tk.Ada.Grid.Grid(CloseButton, "-row 0 -column 1"); Tcl.Tk.Ada.Grid.Grid(Frame, "-pady {0 5}"); Focus(CloseButton); Autoscroll(YScroll); -- General info about the selected recruit Frame := Create(RecruitCanvas & ".general"); if not Factions_List(Recruit.Faction).Flags.Contains (To_Unbounded_String("nogender")) then RecruitInfo := (if Recruit.Gender = 'M' then To_Unbounded_String("Gender: Male") else To_Unbounded_String("Gender: Female")); end if; Append (RecruitInfo, LF & "Faction: " & Factions_List(Recruit.Faction).Name & LF & "Home base: " & Sky_Bases(Recruit.Home_Base).Name); RecruitLabel := Create (Frame & ".label", "-text {" & To_String(RecruitInfo) & "} -wraplength 400"); Tcl.Tk.Ada.Grid.Grid(RecruitLabel, "-sticky w"); Height := Height + Positive'Value(Winfo_Get(RecruitLabel, "reqheight")); Width := Positive'Value(Winfo_Get(RecruitLabel, "reqwidth")); Tcl.Tk.Ada.Grid.Grid(Frame); -- Statistics of the selected recruit Frame := Create(RecruitCanvas & ".attributes"); Show_Recruit_Stats_Loop : for I in Recruit.Attributes'Range loop ProgressFrame := Create(Frame & ".statinfo" & Trim(Positive'Image(I), Left)); RecruitLabel := Create (ProgressFrame & ".label", "-text {" & To_String (AttributesData_Container.Element(Attributes_List, I).Name) & ": " & GetAttributeLevelName(Recruit.Attributes(I).Level) & "}"); Tcl.Tk.Ada.Grid.Grid(RecruitLabel); InfoButton := Create (ProgressFrame & ".button", "-text ""[format %c 0xf05a]"" -style Header.Toolbutton -command {ShowCrewStatsInfo" & Positive'Image(I) & " .recruitdialog}"); Tcl.Tklib.Ada.Tooltip.Add (InfoButton, "Show detailed information about the selected attribute."); Tcl.Tk.Ada.Grid.Grid(InfoButton, "-column 1 -row 0"); NewHeight := NewHeight + Positive'Value(Winfo_Get(InfoButton, "reqheight")); Tcl.Tk.Ada.Grid.Grid(ProgressFrame); ProgressBar := Create (Frame & ".level" & Trim(Positive'Image(I), Left), "-value" & Positive'Image(Recruit.Attributes(I).Level * 2) & " -length 200"); Tcl.Tklib.Ada.Tooltip.Add (ProgressBar, "The current level of the attribute."); Tcl.Tk.Ada.Grid.Grid(ProgressBar); NewHeight := NewHeight + Positive'Value(Winfo_Get(ProgressBar, "reqheight")); end loop Show_Recruit_Stats_Loop; if NewHeight > Height then Height := NewHeight; end if; -- Skills of the selected recruit Frame := Create(RecruitCanvas & ".skills"); NewHeight := 1; Show_Recruit_Skills_Loop : for I in Recruit.Skills.Iterate loop ProgressFrame := Create (Frame & ".skillinfo" & Trim(Positive'Image(Skills_Container.To_Index(I)), Left)); RecruitLabel := Create (ProgressFrame & ".label" & Trim(Positive'Image(Skills_Container.To_Index(I)), Left), "-text {" & To_String (SkillsData_Container.Element (Skills_List, Recruit.Skills(I).Index) .Name) & ": " & GetSkillLevelName(Recruit.Skills(I).Level) & "}"); Tcl.Tk.Ada.Grid.Grid(RecruitLabel); declare ToolQuality: Positive := 100; begin Tool_Quality_Loop : for Quality of SkillsData_Container.Element (Skills_List, Skills_Container.To_Index(I)) .Tools_Quality loop if Recruit.Skills(I).Level <= Quality.Level then ToolQuality := Quality.Quality; exit Tool_Quality_Loop; end if; end loop Tool_Quality_Loop; InfoButton := Create (ProgressFrame & ".button", "-text ""[format %c 0xf05a]"" -style Header.Toolbutton -command {ShowCrewSkillInfo" & Positive'Image(Recruit.Skills(I).Index) & Positive'Image(ToolQuality) & " .recruitdialog}"); end; Tcl.Tklib.Ada.Tooltip.Add (InfoButton, "Show detailed information about the selected skill."); Tcl.Tk.Ada.Grid.Grid(InfoButton, "-column 1 -row 0"); NewHeight := NewHeight + Positive'Value(Winfo_Get(InfoButton, "reqheight")); Tcl.Tk.Ada.Grid.Grid(ProgressFrame); ProgressBar := Create (Frame & ".level" & Trim(Positive'Image(Skills_Container.To_Index(I)), Left), "-value" & Positive'Image(Recruit.Skills(I).Level) & " -length 200"); Tcl.Tklib.Ada.Tooltip.Add (ProgressBar, "The current level of the skill."); Tcl.Tk.Ada.Grid.Grid(ProgressBar); NewHeight := NewHeight + Positive'Value(Winfo_Get(ProgressBar, "reqheight")); end loop Show_Recruit_Skills_Loop; if NewHeight > Height then Height := NewHeight; end if; -- Equipment of the selected recruit Frame := Create(RecruitCanvas & ".inventory"); NewHeight := 1; RecruitInfo := Null_Unbounded_String; Show_Recruit_Equipment_Loop : for Item of Recruit.Inventory loop Append(RecruitInfo, Items_List(Item).Name & LF); end loop Show_Recruit_Equipment_Loop; RecruitLabel := Create (Frame & ".label", "-text {" & To_String(RecruitInfo) & "} -wraplength 400"); Tcl.Tk.Ada.Grid.Grid(RecruitLabel, "-sticky w"); NewHeight := Positive'Value(Winfo_Get(RecruitLabel, "reqheight")); if NewHeight > Height then Height := NewHeight; end if; NewWidth := Positive'Value(Winfo_Get(RecruitLabel, "reqwidth")); if NewWidth > Width then Width := NewWidth; end if; if Height > 500 then Height := 500; end if; if Width < 350 then Width := 350; end if; Frame := Get_Widget(RecruitCanvas & ".general"); declare XPos: constant Natural := (Positive'Value(Winfo_Get(RecruitCanvas, "reqwidth")) - Positive'Value(Winfo_Get(Frame, "reqwidth"))) / 4; begin Canvas_Create (RecruitCanvas, "window", Trim(Natural'Image(XPos), Left) & " 0 -anchor nw -window " & Frame & " -tag info"); end; Tcl_Eval(Interp, "update"); configure (RecruitCanvas, "-scrollregion [list " & BBox(RecruitCanvas, "all") & "] -width" & Positive'Image(Width) & " -height" & Positive'Image(Height)); Bind (CloseButton, "<Tab>", "{focus " & RecruitDialog & ".buttonbox.general;break}"); Bind(RecruitDialog, "<Escape>", "{" & CloseButton & " invoke;break}"); Bind(CloseButton, "<Escape>", "{" & CloseButton & " invoke;break}"); Show_Dialog(Dialog => RecruitDialog, Relative_Y => 0.2); return TCL_OK; end Show_Recruit_Info_Command; -- ****o* RecruitUI/RecruitUI.Negotiate_Hire_Command -- FUNCTION -- Show information about the selected recruit -- PARAMETERS -- ClientData - Custom data send to the command. Unused -- Interp - Tcl interpreter in which command was executed. -- Argc - Number of arguments passed to the command. Unused -- Argv - Values of arguments passed to the command. Unused -- RESULT -- This function always return TCL_OK -- COMMANDS -- NegotiateHire -- SOURCE function Negotiate_Hire_Command (ClientData: Integer; Interp: Tcl.Tcl_Interp; Argc: Interfaces.C.int; Argv: CArgv.Chars_Ptr_Ptr) return Interfaces.C.int with Convention => C; -- **** function Negotiate_Hire_Command (ClientData: Integer; Interp: Tcl.Tcl_Interp; Argc: Interfaces.C.int; Argv: CArgv.Chars_Ptr_Ptr) return Interfaces.C.int is pragma Unreferenced(ClientData, Argc, Argv); DialogName: constant String := ".negotiatedialog"; MoneyIndex2: constant Natural := FindItem(Player_Ship.Cargo, Money_Index); BaseIndex: constant Positive := SkyMap(Player_Ship.Sky_X, Player_Ship.Sky_Y).BaseIndex; Recruit: constant Recruit_Data := Sky_Bases(BaseIndex).Recruits(RecruitIndex); Cost: Integer; Scale: Ttk_Scale := Get_Widget(DialogName & ".daily", Interp); DailyPayment: constant Natural := Natural(Float'Value(cget(Scale, "-value"))); ContractBox: constant Ttk_ComboBox := Get_Widget(DialogName & ".contract", Interp); ContractLength: constant Natural := Natural'Value(Current(ContractBox)); TradePayment: Natural; Label: Ttk_Label := Get_Widget(DialogName & ".cost", Interp); HireButton: constant Ttk_Button := Get_Widget(DialogName & ".buttonbox.hirebutton", Interp); begin Scale.Name := New_String(DialogName & ".percent"); TradePayment := Natural(Float'Value(cget(Scale, "-value"))); Cost := Recruit.Price - ((DailyPayment - Recruit.Payment) * 50) - (TradePayment * 5_000); Cost := (case ContractLength is when 1 => Cost - Integer(Float(Recruit.Price) * 0.1), when 2 => Cost - Integer(Float(Recruit.Price) * 0.5), when 3 => Cost - Integer(Float(Recruit.Price) * 0.75), when 4 => Cost - Integer(Float(Recruit.Price) * 0.9), when others => Cost); if Cost < 1 then Cost := 1; end if; Count_Price(Cost, FindMember(Talk)); configure (Label, "-text {Hire for" & Natural'Image(Cost) & " " & To_String(Money_Name) & "}"); Label.Name := New_String(DialogName & ".dailylbl"); configure (Label, "-text {Daily payment:" & Natural'Image(DailyPayment) & "}"); Label.Name := New_String(DialogName & ".percentlbl"); configure (Label, "-text {Percent of profit from trades: " & Natural'Image(TradePayment) & "}"); if MoneyIndex2 > 0 and then Player_Ship.Cargo(MoneyIndex2).Amount < Cost then configure(HireButton, "-state disabled"); else configure(HireButton, "-state !disabled"); end if; return TCL_OK; end Negotiate_Hire_Command; -- ****o* RecruitUI/RecruitUI.Hire_Command -- FUNCTION -- Hire the selected recruit -- PARAMETERS -- ClientData - Custom data send to the command. -- Interp - Tcl interpreter in which command was executed. -- Argc - Number of arguments passed to the command. Unused -- Argv - Values of arguments passed to the command. Unused -- RESULT -- This function always return TCL_OK -- COMMANDS -- Hire -- SOURCE function Hire_Command (ClientData: Integer; Interp: Tcl.Tcl_Interp; Argc: Interfaces.C.int; Argv: CArgv.Chars_Ptr_Ptr) return Interfaces.C.int with Convention => C; -- **** function Hire_Command (ClientData: Integer; Interp: Tcl.Tcl_Interp; Argc: Interfaces.C.int; Argv: CArgv.Chars_Ptr_Ptr) return Interfaces.C.int is pragma Unreferenced(Argc, Argv); DialogName: constant String := ".negotiatedialog"; Cost, ContractLength2: Integer; BaseIndex: constant Positive := SkyMap(Player_Ship.Sky_X, Player_Ship.Sky_Y).BaseIndex; Recruit: constant Recruit_Data := Sky_Bases(BaseIndex).Recruits(RecruitIndex); Scale: Ttk_Scale := Get_Widget(DialogName & ".daily", Interp); DailyPayment: constant Natural := Natural(Float'Value(cget(Scale, "-value"))); ContractBox: constant Ttk_ComboBox := Get_Widget(DialogName & ".contract", Interp); ContractLength: constant Natural := Natural'Value(Current(ContractBox)); TradePayment: Natural; begin Scale.Name := New_String(DialogName & ".percent"); TradePayment := Natural(Float'Value(cget(Scale, "-value"))); Cost := Recruit.Price - ((DailyPayment - Recruit.Payment) * 50) - (TradePayment * 5_000); case ContractLength is when 1 => Cost := Cost - Integer(Float(Recruit.Price) * 0.1); ContractLength2 := 100; when 2 => Cost := Cost - Integer(Float(Recruit.Price) * 0.5); ContractLength2 := 30; when 3 => Cost := Cost - Integer(Float(Recruit.Price) * 0.75); ContractLength2 := 20; when 4 => Cost := Cost - Integer(Float(Recruit.Price) * 0.9); ContractLength2 := 10; when others => ContractLength2 := -1; end case; if Cost < 1 then Cost := 1; end if; HireRecruit (RecruitIndex, Cost, DailyPayment, TradePayment, ContractLength2); Update_Messages; Tcl_Eval(Interp, "CloseDialog " & DialogName); return Show_Recruit_Command (ClientData, Interp, 2, CArgv.Empty & "ShowRecruit" & "1"); end Hire_Command; -- ****o* RecruitUI/RecruitUI.Show_Recruit_Tab_Command -- FUNCTION -- Show the selected information about the selected recruit -- PARAMETERS -- ClientData - Custom data send to the command. Unused -- Interp - Tcl interpreter in which command was executed. -- Argc - Number of arguments passed to the command. Unused -- Argv - Values of arguments passed to the command. Unused -- RESULT -- This function always return TCL_OK -- COMMANDS -- ShowMemberTab -- SOURCE function Show_Recruit_Tab_Command (ClientData: Integer; Interp: Tcl.Tcl_Interp; Argc: Interfaces.C.int; Argv: CArgv.Chars_Ptr_Ptr) return Interfaces.C.int with Convention => C; -- **** function Show_Recruit_Tab_Command (ClientData: Integer; Interp: Tcl.Tcl_Interp; Argc: Interfaces.C.int; Argv: CArgv.Chars_Ptr_Ptr) return Interfaces.C.int is pragma Unreferenced(ClientData, Argc, Argv); RecruitCanvas: constant Tk_Canvas := Get_Widget(".recruitdialog.canvas", Interp); Frame: constant Ttk_Frame := Get_Widget(RecruitCanvas & "." & Tcl_GetVar(Interp, "newtab")); XPos: constant Natural := (Positive'Value(Winfo_Get(RecruitCanvas, "reqwidth")) - Positive'Value(Winfo_Get(Frame, "reqwidth"))) / 2; begin Delete(RecruitCanvas, "info"); Canvas_Create (RecruitCanvas, "window", Trim(Positive'Image(XPos), Left) & " 0 -anchor nw -window " & Frame & " -tag info"); Tcl_Eval(Interp, "update"); configure (RecruitCanvas, "-scrollregion [list " & BBox(RecruitCanvas, "all") & "]"); return TCL_OK; end Show_Recruit_Tab_Command; -- ****o* RecruitUI/RecruitUI.Negotiate_Command -- FUNCTION -- Show negotation UI to the player -- PARAMETERS -- ClientData - Custom data send to the command. Unused -- Interp - Tcl interpreter in which command was executed. Unused -- Argc - Number of arguments passed to the command. Unused -- Argv - Values of arguments passed to the command. Unused -- RESULT -- This function always return TCL_OK -- COMMANDS -- Negotiate -- SOURCE function Negotiate_Command (ClientData: Integer; Interp: Tcl.Tcl_Interp; Argc: Interfaces.C.int; Argv: CArgv.Chars_Ptr_Ptr) return Interfaces.C.int with Convention => C; -- **** function Negotiate_Command (ClientData: Integer; Interp: Tcl.Tcl_Interp; Argc: Interfaces.C.int; Argv: CArgv.Chars_Ptr_Ptr) return Interfaces.C.int is pragma Unreferenced(ClientData, Interp, Argc, Argv); BaseIndex: constant Positive := SkyMap(Player_Ship.Sky_X, Player_Ship.Sky_Y).BaseIndex; Recruit: constant Recruit_Data := Sky_Bases(BaseIndex).Recruits(RecruitIndex); NegotiateDialog: constant Ttk_Frame := Create_Dialog (".negotiatedialog", "Negotiate with " & To_String(Recruit.Name)); CloseButton, HireButton: Ttk_Button; Frame: constant Ttk_Frame := Create(NegotiateDialog & ".buttonbox"); Label: Ttk_Label; Scale: Ttk_Scale; ContractBox: constant Ttk_ComboBox := Create (NegotiateDialog & ".contract", "-state readonly -values [list {Pernament} {100 days} {30 days} {20 days} {10 days}]"); MoneyIndex2: constant Natural := FindItem(Player_Ship.Cargo, Money_Index); Cost: Positive; begin Label := Create (NegotiateDialog & ".dailylbl", "-text {Daily payment:" & Natural'Image(Recruit.Payment) & "}"); Tcl.Tk.Ada.Grid.Grid(Label, "-pady {5 0}"); Scale := Create (NegotiateDialog & ".daily", "-from 0 -command NegotiateHire -length 250"); Tcl.Tk.Ada.Grid.Grid(Scale); configure (Scale, "-to" & Natural'Image(Recruit.Payment * 2) & " -value" & Natural'Image(Recruit.Payment)); Label := Create (NegotiateDialog & ".percentlbl", "-text {Percent of profit from trades: 0}"); Tcl.Tk.Ada.Grid.Grid(Label, "-padx 5"); Scale := Create (NegotiateDialog & ".percent", "-from 0 -to 10 -command NegotiateHire -length 250"); Tcl.Tk.Ada.Grid.Grid(Scale); configure(Scale, "-value 0"); Label := Create(NegotiateDialog & ".contractlbl", "-text {Contract time:}"); Tcl.Tk.Ada.Grid.Grid(Label); Tcl.Tk.Ada.Grid.Grid(ContractBox); Bind(ContractBox, "<<ComboboxSelected>>", "{NegotiateHire}"); Current(ContractBox, "0"); HireButton := Create (NegotiateDialog & ".buttonbox.hirebutton", "-text Hire -command {Hire}"); Label := Create(NegotiateDialog & ".money"); Tcl.Tk.Ada.Grid.Grid(Label); Cost := Recruit.Price; Count_Price(Cost, FindMember(Talk)); if MoneyIndex2 > 0 then configure (Label, "-text {You have" & Natural'Image(Player_Ship.Cargo(MoneyIndex2).Amount) & " " & To_String(Money_Name) & ".}"); if Player_Ship.Cargo(MoneyIndex2).Amount < Cost then configure(HireButton, "-state disabled"); else configure(HireButton, "-state !disabled"); end if; else configure (Label, "-text {You don't have enough money to recruit anyone}"); configure(HireButton, "-state disabled"); end if; Label := Create(NegotiateDialog & ".cost"); Tcl.Tk.Ada.Grid.Grid(Label); configure (Label, "-text {Hire for" & Positive'Image(Cost) & " " & To_String(Money_Name) & "}"); Tcl.Tk.Ada.Grid.Grid(HireButton); CloseButton := Create (NegotiateDialog & ".buttonbox.button", "-text Close -command {CloseDialog " & NegotiateDialog & "}"); Tcl.Tk.Ada.Grid.Grid(CloseButton, "-row 0 -column 1"); Tcl.Tk.Ada.Grid.Grid(Frame, "-pady {0 5}"); Focus(CloseButton); Bind(CloseButton, "<Tab>", "{focus " & HireButton & ";break}"); Bind(HireButton, "<Tab>", "{focus " & CloseButton & ";break}"); Bind(NegotiateDialog, "<Escape>", "{" & CloseButton & " invoke;break}"); Bind(CloseButton, "<Escape>", "{" & CloseButton & " invoke;break}"); Show_Dialog(Dialog => NegotiateDialog, Relative_Y => 0.2); return TCL_OK; end Negotiate_Command; -- ****it* RecruitUI/RecruitUI.Recruits_Sort_Orders -- FUNCTION -- Sorting orders for the list of available recruits in base -- OPTIONS -- NAMEASC - Sort recruits by name ascending -- NAMEDESC - Sort recruits by name descending -- GENDERASC - Sort recruits by gender ascending -- GENDERDESC - Sort recruits by gender descending -- FACTIONASC - Sort recruits by faction ascending -- FACTIONDESC - Sort recruits by faction descending -- PRICEASC - Sort recruits by price ascending -- PRICEDESC - Sort recruits by price descending -- ATTRIBUTEASC - Sort recruits by attribute ascending -- ATTRIBUTEDESC - Sort recruits by attribute descending -- SKILLASC - Sort recruits by skill ascending -- SKILLDESC - Sort recruits by skill descending -- NONE - No sorting recruits (default) -- HISTORY -- 6.4 - Added -- SOURCE type Recruits_Sort_Orders is (NAMEASC, NAMEDESC, GENDERASC, GENDERDESC, FACTIONDESC, FACTIONASC, PRICEASC, PRICEDESC, ATTRIBUTEASC, ATTRIBUTEDESC, SKILLASC, SKILLDESC, NONE) with Default_Value => NONE; -- **** -- ****id* RecruitUI/RecruitUI.Default_Recruits_Sort_Order -- FUNCTION -- Default sorting order for the available recruits in base -- HISTORY -- 6.4 - Added -- SOURCE Default_Recruits_Sort_Order: constant Recruits_Sort_Orders := NONE; -- **** -- ****iv* RecruitUI/RecruitUI.Recruits_Sort_Order -- FUNCTION -- The current sorting order for the available recruits in base -- HISTORY -- 6.4 - Added -- SOURCE Recruits_Sort_Order: Recruits_Sort_Orders := Default_Recruits_Sort_Order; -- **** -- ****o* RecruitUI/RecruitUI.Sort_Recruits_Command -- FUNCTION -- Sort the list of available recruits in base -- PARAMETERS -- ClientData - Custom data send to the command. -- Interp - Tcl interpreter in which command was executed. -- Argc - Number of arguments passed to the command. Unused -- Argv - Values of arguments passed to the command. -- RESULT -- This function always return TCL_OK -- COMMANDS -- SortRecruits x -- X is X axis coordinate where the player clicked the mouse button -- SOURCE function Sort_Recruits_Command (ClientData: Integer; Interp: Tcl.Tcl_Interp; Argc: Interfaces.C.int; Argv: CArgv.Chars_Ptr_Ptr) return Interfaces.C.int with Convention => C; -- **** function Sort_Recruits_Command (ClientData: Integer; Interp: Tcl.Tcl_Interp; Argc: Interfaces.C.int; Argv: CArgv.Chars_Ptr_Ptr) return Interfaces.C.int is pragma Unreferenced(Argc); Column: constant Positive := Get_Column_Number(RecruitTable, Natural'Value(CArgv.Arg(Argv, 1))); type Local_Module_Data is record Name: Unbounded_String; Gender: Character; Faction: Unbounded_String; Price: Positive; Attribute: Unbounded_String; Skill: Unbounded_String; Id: Positive; end record; type Recruits_Array is array(Positive range <>) of Local_Module_Data; BaseIndex: constant Positive := SkyMap(Player_Ship.Sky_X, Player_Ship.Sky_Y).BaseIndex; Local_Recruits: Recruits_Array (1 .. Positive(Sky_Bases(BaseIndex).Recruits.Length)); function "<"(Left, Right: Local_Module_Data) return Boolean is begin if Recruits_Sort_Order = NAMEASC and then Left.Name < Right.Name then return True; end if; if Recruits_Sort_Order = NAMEDESC and then Left.Name > Right.Name then return True; end if; if Recruits_Sort_Order = GENDERASC and then Left.Gender < Right.Gender then return True; end if; if Recruits_Sort_Order = GENDERDESC and then Left.Gender > Right.Gender then return True; end if; if Recruits_Sort_Order = FACTIONASC and then Left.Faction < Right.Faction then return True; end if; if Recruits_Sort_Order = FACTIONDESC and then Left.Faction > Right.Faction then return True; end if; if Recruits_Sort_Order = PRICEASC and then Left.Price < Right.Price then return True; end if; if Recruits_Sort_Order = PRICEDESC and then Left.Price > Right.Price then return True; end if; if Recruits_Sort_Order = ATTRIBUTEASC and then Left.Attribute < Right.Attribute then return True; end if; if Recruits_Sort_Order = ATTRIBUTEDESC and then Left.Attribute > Right.Attribute then return True; end if; if Recruits_Sort_Order = SKILLASC and then Left.Skill < Right.Skill then return True; end if; if Recruits_Sort_Order = SKILLDESC and then Left.Skill > Right.Skill then return True; end if; return False; end "<"; procedure Sort_Recruits is new Ada.Containers.Generic_Array_Sort (Index_Type => Positive, Element_Type => Local_Module_Data, Array_Type => Recruits_Array); begin case Column is when 1 => if Recruits_Sort_Order = NAMEASC then Recruits_Sort_Order := NAMEDESC; else Recruits_Sort_Order := NAMEASC; end if; when 2 => if Recruits_Sort_Order = GENDERASC then Recruits_Sort_Order := GENDERDESC; else Recruits_Sort_Order := GENDERASC; end if; when 3 => if Recruits_Sort_Order = FACTIONASC then Recruits_Sort_Order := FACTIONDESC; else Recruits_Sort_Order := FACTIONASC; end if; when 4 => if Recruits_Sort_Order = PRICEASC then Recruits_Sort_Order := PRICEDESC; else Recruits_Sort_Order := PRICEASC; end if; when 5 => if Recruits_Sort_Order = ATTRIBUTEASC then Recruits_Sort_Order := ATTRIBUTEDESC; else Recruits_Sort_Order := ATTRIBUTEASC; end if; when 6 => if Recruits_Sort_Order = SKILLASC then Recruits_Sort_Order := SKILLDESC; else Recruits_Sort_Order := SKILLASC; end if; when others => null; end case; if Recruits_Sort_Order = NONE then return TCL_OK; end if; for I in Sky_Bases(BaseIndex).Recruits.Iterate loop Local_Recruits(Recruit_Container.To_Index(I)) := (Name => Sky_Bases(BaseIndex).Recruits(I).Name, Gender => Sky_Bases(BaseIndex).Recruits(I).Gender, Faction => Sky_Bases(BaseIndex).Recruits(I).Faction, Price => Sky_Bases(BaseIndex).Recruits(I).Price, Attribute => Get_Highest_Attribute(BaseIndex, Recruit_Container.To_Index(I)), Skill => Get_Highest_Skill(BaseIndex, Recruit_Container.To_Index(I)), Id => Recruit_Container.To_Index(I)); end loop; Sort_Recruits(Local_Recruits); Recruits_Indexes.Clear; for Recruit of Local_Recruits loop Recruits_Indexes.Append(Recruit.Id); end loop; return Show_Recruit_Command (ClientData, Interp, 2, CArgv.Empty & "ShowRecruits" & "1"); end Sort_Recruits_Command; procedure AddCommands is begin Add_Command("ShowRecruit", Show_Recruit_Command'Access); Add_Command("ShowRecruitMenu", Show_Recruit_Menu_Command'Access); Add_Command("ShowRecruitInfo", Show_Recruit_Info_Command'Access); Add_Command("NegotiateHire", Negotiate_Hire_Command'Access); Add_Command("Hire", Hire_Command'Access); Add_Command("ShowRecruitTab", Show_Recruit_Tab_Command'Access); Add_Command("Negotiate", Negotiate_Command'Access); Add_Command("SortRecruits", Sort_Recruits_Command'Access); end AddCommands; end Bases.RecruitUI;
------------------------------------------------------------------------------ -- -- -- GNAT RUN-TIME COMPONENTS -- -- -- -- A D A . S T R E A M S . S T R E A M _ I O -- -- -- -- B o d y -- -- -- -- Copyright (C) 1992-2019, Free Software Foundation, Inc. -- -- -- -- GNAT is free software; you can redistribute it and/or modify it under -- -- terms of the GNU General Public License as published by the Free Soft- -- -- ware Foundation; either version 3, or (at your option) any later ver- -- -- sion. GNAT is distributed in the hope that it will be useful, but WITH- -- -- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY -- -- or FITNESS FOR A PARTICULAR PURPOSE. -- -- -- -- As a special exception under Section 7 of GPL version 3, you are granted -- -- additional permissions described in the GCC Runtime Library Exception, -- -- version 3.1, as published by the Free Software Foundation. -- -- -- -- You should have received a copy of the GNU General Public License and -- -- a copy of the GCC Runtime Library Exception along with this program; -- -- see the files COPYING3 and COPYING.RUNTIME respectively. If not, see -- -- <http://www.gnu.org/licenses/>. -- -- -- -- GNAT was originally developed by the GNAT team at New York University. -- -- Extensive contributions were provided by Ada Core Technologies Inc. -- -- -- ------------------------------------------------------------------------------ with Interfaces.C_Streams; use Interfaces.C_Streams; with System; use System; with System.Communication; use System.Communication; with System.File_IO; with System.Soft_Links; with System.CRTL; with Ada.Unchecked_Conversion; with Ada.Unchecked_Deallocation; package body Ada.Streams.Stream_IO is package FIO renames System.File_IO; package SSL renames System.Soft_Links; subtype AP is FCB.AFCB_Ptr; function To_FCB is new Ada.Unchecked_Conversion (File_Mode, FCB.File_Mode); function To_SIO is new Ada.Unchecked_Conversion (FCB.File_Mode, File_Mode); use type FCB.File_Mode; use type FCB.Shared_Status_Type; ----------------------- -- Local Subprograms -- ----------------------- procedure Set_Position (File : File_Type); -- Sets file position pointer according to value of current index ------------------- -- AFCB_Allocate -- ------------------- function AFCB_Allocate (Control_Block : Stream_AFCB) return FCB.AFCB_Ptr is pragma Warnings (Off, Control_Block); begin return new Stream_AFCB; end AFCB_Allocate; ---------------- -- AFCB_Close -- ---------------- -- No special processing required for closing Stream_IO file procedure AFCB_Close (File : not null access Stream_AFCB) is pragma Warnings (Off, File); begin null; end AFCB_Close; --------------- -- AFCB_Free -- --------------- procedure AFCB_Free (File : not null access Stream_AFCB) is type FCB_Ptr is access all Stream_AFCB; FT : FCB_Ptr := FCB_Ptr (File); procedure Free is new Ada.Unchecked_Deallocation (Stream_AFCB, FCB_Ptr); begin Free (FT); end AFCB_Free; ----------- -- Close -- ----------- procedure Close (File : in out File_Type) is begin FIO.Close (AP (File)'Unrestricted_Access); end Close; ------------ -- Create -- ------------ procedure Create (File : in out File_Type; Mode : File_Mode := Out_File; Name : String := ""; Form : String := "") is Dummy_File_Control_Block : Stream_AFCB; pragma Warnings (Off, Dummy_File_Control_Block); -- Yes, we know this is never assigned a value, only the tag -- is used for dispatching purposes, so that's expected. begin FIO.Open (File_Ptr => AP (File), Dummy_FCB => Dummy_File_Control_Block, Mode => To_FCB (Mode), Name => Name, Form => Form, Amethod => 'S', Creat => True, Text => False); File.Last_Op := Op_Write; end Create; ------------ -- Delete -- ------------ procedure Delete (File : in out File_Type) is begin FIO.Delete (AP (File)'Unrestricted_Access); end Delete; ----------------- -- End_Of_File -- ----------------- function End_Of_File (File : File_Type) return Boolean is begin FIO.Check_Read_Status (AP (File)); return File.Index > Size (File); end End_Of_File; ----------- -- Flush -- ----------- procedure Flush (File : File_Type) is begin FIO.Flush (AP (File)); end Flush; ---------- -- Form -- ---------- function Form (File : File_Type) return String is begin return FIO.Form (AP (File)); end Form; ----------- -- Index -- ----------- function Index (File : File_Type) return Positive_Count is begin FIO.Check_File_Open (AP (File)); return File.Index; end Index; ------------- -- Is_Open -- ------------- function Is_Open (File : File_Type) return Boolean is begin return FIO.Is_Open (AP (File)); end Is_Open; ---------- -- Mode -- ---------- function Mode (File : File_Type) return File_Mode is begin return To_SIO (FIO.Mode (AP (File))); end Mode; ---------- -- Name -- ---------- function Name (File : File_Type) return String is begin return FIO.Name (AP (File)); end Name; ---------- -- Open -- ---------- procedure Open (File : in out File_Type; Mode : File_Mode; Name : String; Form : String := "") is Dummy_File_Control_Block : Stream_AFCB; pragma Warnings (Off, Dummy_File_Control_Block); -- Yes, we know this is never assigned a value, only the tag -- is used for dispatching purposes, so that's expected. begin FIO.Open (File_Ptr => AP (File), Dummy_FCB => Dummy_File_Control_Block, Mode => To_FCB (Mode), Name => Name, Form => Form, Amethod => 'S', Creat => False, Text => False); -- Ensure that the stream index is set properly (e.g., for Append_File) Reset (File, Mode); -- Set last operation. The purpose here is to ensure proper handling -- of the initial operation. In general, a write after a read requires -- resetting and doing a seek, so we set the last operation as Read -- for an In_Out file, but for an Out file we set the last operation -- to Op_Write, since in this case it is not necessary to do a seek -- (and furthermore there are situations (such as the case of writing -- a sequential Posix FIFO file) where the lseek would cause problems. File.Last_Op := (if Mode = Out_File then Op_Write else Op_Read); end Open; ---------- -- Read -- ---------- procedure Read (File : File_Type; Item : out Stream_Element_Array; Last : out Stream_Element_Offset; From : Positive_Count) is begin Set_Index (File, From); Read (File, Item, Last); end Read; procedure Read (File : File_Type; Item : out Stream_Element_Array; Last : out Stream_Element_Offset) is Nread : size_t; begin FIO.Check_Read_Status (AP (File)); -- If last operation was not a read, or if in file sharing mode, -- then reset the physical pointer of the file to match the index -- We lock out task access over the two operations in this case. if File.Last_Op /= Op_Read or else File.Shared_Status = FCB.Yes then Locked_Processing : begin SSL.Lock_Task.all; Set_Position (File); FIO.Read_Buf (AP (File), Item'Address, Item'Length, Nread); SSL.Unlock_Task.all; exception when others => SSL.Unlock_Task.all; raise; end Locked_Processing; else FIO.Read_Buf (AP (File), Item'Address, Item'Length, Nread); end if; File.Index := File.Index + Count (Nread); File.Last_Op := Op_Read; Last := Last_Index (Item'First, Nread); end Read; -- This version of Read is the primitive operation on the underlying -- Stream type, used when a Stream_IO file is treated as a Stream procedure Read (File : in out Stream_AFCB; Item : out Ada.Streams.Stream_Element_Array; Last : out Ada.Streams.Stream_Element_Offset) is begin Read (File'Unchecked_Access, Item, Last); end Read; ----------- -- Reset -- ----------- procedure Reset (File : in out File_Type; Mode : File_Mode) is begin FIO.Check_File_Open (AP (File)); -- Reset file index to start of file for read/write cases. For -- the append case, the Set_Mode call repositions the index. File.Index := 1; Set_Mode (File, Mode); end Reset; procedure Reset (File : in out File_Type) is begin Reset (File, To_SIO (File.Mode)); end Reset; --------------- -- Set_Index -- --------------- procedure Set_Index (File : File_Type; To : Positive_Count) is begin FIO.Check_File_Open (AP (File)); File.Index := Count (To); File.Last_Op := Op_Other; end Set_Index; -------------- -- Set_Mode -- -------------- procedure Set_Mode (File : in out File_Type; Mode : File_Mode) is begin FIO.Check_File_Open (AP (File)); -- If we are switching from read to write, or vice versa, and -- we are not already open in update mode, then reopen in update -- mode now. Note that we can use Inout_File as the mode for the -- call since File_IO handles all modes for all file types. if ((File.Mode = FCB.In_File) /= (Mode = In_File)) and then not File.Update_Mode then FIO.Reset (AP (File)'Unrestricted_Access, FCB.Inout_File); File.Update_Mode := True; end if; -- Set required mode and position to end of file if append mode File.Mode := To_FCB (Mode); FIO.Append_Set (AP (File)); if File.Mode = FCB.Append_File then if Standard'Address_Size = 64 then File.Index := Count (ftell64 (File.Stream)) + 1; else File.Index := Count (ftell (File.Stream)) + 1; end if; end if; File.Last_Op := Op_Other; end Set_Mode; ------------------ -- Set_Position -- ------------------ procedure Set_Position (File : File_Type) is use type System.CRTL.int64; R : int; begin R := fseek64 (File.Stream, System.CRTL.int64 (File.Index) - 1, SEEK_SET); if R /= 0 then raise Use_Error; end if; end Set_Position; ---------- -- Size -- ---------- function Size (File : File_Type) return Count is begin FIO.Check_File_Open (AP (File)); if File.File_Size = -1 then File.Last_Op := Op_Other; if fseek64 (File.Stream, 0, SEEK_END) /= 0 then raise Device_Error; end if; File.File_Size := Stream_Element_Offset (ftell64 (File.Stream)); if File.File_Size = -1 then raise Use_Error; end if; end if; return Count (File.File_Size); end Size; ------------ -- Stream -- ------------ function Stream (File : File_Type) return Stream_Access is begin FIO.Check_File_Open (AP (File)); return Stream_Access (File); end Stream; ----------- -- Write -- ----------- procedure Write (File : File_Type; Item : Stream_Element_Array; To : Positive_Count) is begin Set_Index (File, To); Write (File, Item); end Write; procedure Write (File : File_Type; Item : Stream_Element_Array) is begin FIO.Check_Write_Status (AP (File)); -- If last operation was not a write, or if in file sharing mode, -- then reset the physical pointer of the file to match the index -- We lock out task access over the two operations in this case. if File.Last_Op /= Op_Write or else File.Shared_Status = FCB.Yes then Locked_Processing : begin SSL.Lock_Task.all; Set_Position (File); FIO.Write_Buf (AP (File), Item'Address, Item'Length); SSL.Unlock_Task.all; exception when others => SSL.Unlock_Task.all; raise; end Locked_Processing; else FIO.Write_Buf (AP (File), Item'Address, Item'Length); end if; File.Index := File.Index + Item'Length; File.Last_Op := Op_Write; File.File_Size := -1; end Write; -- This version of Write is the primitive operation on the underlying -- Stream type, used when a Stream_IO file is treated as a Stream procedure Write (File : in out Stream_AFCB; Item : Ada.Streams.Stream_Element_Array) is begin Write (File'Unchecked_Access, Item); end Write; end Ada.Streams.Stream_IO;
with Ada.Text_IO; use Ada.Text_IO; procedure Greet2 is begin loop Put_Line ("Please enter your name: "); declare Name : String := Get_Line; -- ^ Call to the Get_Line function begin exit when Name = ""; Put_line ("Hi " & Name & "!"); end; -- Name is undefined here end loop; Put_Line ("Bye!"); end Greet2;
----------------------------------------------------------------------- -- awa-counters-modules -- Module counters -- 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 Ada.Containers.Indefinite_Hashed_Maps; with Ada.Calendar; with ASF.Applications; with ADO.Sessions; with AWA.Modules; -- == Counter Module == -- The <tt>Counter_Module</tt> manages the counters associated with database entities. -- To avoid having to update the database each time a counter is incremented, counters -- are kept temporarily in a <tt>Counter_Table</tt> protected type. The table contains -- only the partial increments and not the real counter values. Counters are flushed -- when the table reaches some limit, or, when the table is oldest than some limit. -- Counters are associated with a day so that it becomes possible to gather per-day counters. -- The table is also flushed when a counter is incremented in a different day. -- -- === Integration === -- An instance of the <tt>Counter_Module</tt> must be declared and registered in the -- AWA application. The module instance can be defined as follows: -- -- with AWA.Counters.Modules; -- ... -- type Application is new AWA.Applications.Application with record -- Counter_Module : aliased AWA.Counters.Modules.Counter_Module; -- end record; -- -- And registered in the `Initialize_Modules` procedure by using: -- -- Register (App => App.Self.all'Access, -- Name => AWA.Counters.Modules.NAME, -- Module => App.Counter_Module'Access); -- package AWA.Counters.Modules is -- The name under which the module is registered. NAME : constant String := "counters"; -- Default age limit to flush counters: 5 minutes. DEFAULT_AGE_LIMIT : constant Duration := 5 * 60.0; -- Default maximum number of different counters to keep before flushing. DEFAULT_COUNTER_LIMIT : constant Natural := 1_000; PARAM_AGE_LIMIT : constant String := "counter_age_limit"; PARAM_COUNTER_LIMIT : constant String := "counter_limit"; -- ------------------------------ -- Module counters -- ------------------------------ type Counter_Module is new AWA.Modules.Module with private; type Counter_Module_Access is access all Counter_Module'Class; -- Initialize the counters module. overriding procedure Initialize (Plugin : in out Counter_Module; App : in AWA.Modules.Application_Access; Props : in ASF.Applications.Config); -- Configures the module after its initialization and after having read its XML configuration. overriding procedure Configure (Plugin : in out Counter_Module; Props : in ASF.Applications.Config); -- Get the counters module. function Get_Counter_Module return Counter_Module_Access; -- Increment the counter identified by <tt>Counter</tt> and associated with the -- database object <tt>Object</tt>. procedure Increment (Plugin : in out Counter_Module; Counter : in Counter_Index_Type; Object : in ADO.Objects.Object_Ref'Class); -- Increment the counter identified by <tt>Counter</tt> and associated with the -- database object key <tt>Key</tt>. procedure Increment (Plugin : in out Counter_Module; Counter : in Counter_Index_Type; Key : in ADO.Objects.Object_Key); -- Increment the counter identified by <tt>Counter</tt>. procedure Increment (Plugin : in out Counter_Module; Counter : in Counter_Index_Type); -- Get the current counter value. procedure Get_Counter (Plugin : in out Counter_Module; Counter : in AWA.Counters.Counter_Index_Type; Object : in ADO.Objects.Object_Ref'Class; Result : out Natural); -- Flush the existing counters and update all the database records refered to them. procedure Flush (Plugin : in out Counter_Module); private type Definition_Array_Type is array (Counter_Index_Type range <>) of Natural; type Definition_Array_Type_Access is access all Definition_Array_Type; -- The counter map tracks a counter associated with a database object. -- All the database objects refer to the same counter. package Counter_Maps is new Ada.Containers.Indefinite_Hashed_Maps (Key_Type => ADO.Objects.Object_Key, Element_Type => Positive, Hash => ADO.Objects.Hash, Equivalent_Keys => ADO.Objects."="); -- The <tt>Counter_Map_Array</tt> associate a counter map to each counter definition. type Counter_Map_Array is array (Counter_Index_Type range <>) of Counter_Maps.Map; type Counter_Map_Array_Access is access all Counter_Map_Array; -- Counters are kept temporarily in the <tt>Counter_Table</tt> protected type to avoid -- having to update the database each time a counter is incremented. Counters are flushed -- when the table reaches some limit, or, when the table is oldest than some limit. -- Counters are associated with a day so that it becomes possible to gather per-day counters. -- -- The <tt>Flush</tt> operation on the <tt>Counter_Module</tt> can be used to flush -- the pending counters. For each counter that was updated, it either inserts or -- updates a row in the counters database table. Because such operation is slow, it is not -- implemented in the protected type. Instead, we steal the counter table and replace it -- with a new/empty table. This is done by <tt>Steal_Counters</tt> protected operation. -- While doing the flush, other tasks can increment counters without being blocked by the -- <tt>Flush</tt> operation. protected type Counter_Table is -- Increment the counter identified by <tt>Counter</tt> and associated with the -- database object <tt>Key</tt>. procedure Increment (Counter : in Counter_Index_Type; Key : in ADO.Objects.Object_Key); -- Get the counters that have been collected with the date and prepare to collect -- new counters. procedure Steal_Counters (Result : out Counter_Map_Array_Access; Date : out Ada.Calendar.Time); -- Check if we must flush the counters. function Need_Flush (Limit : in Natural; Seconds : in Duration) return Boolean; -- Get the definition ID associated with the counter. procedure Get_Definition (Session : in out ADO.Sessions.Master_Session; Counter : in Counter_Index_Type; Result : out Natural); private Day : Ada.Calendar.Time; Day_End : Ada.Calendar.Time; Counters : Counter_Map_Array_Access; Definitions : Definition_Array_Type_Access; Nb_Counters : Natural := 0; end Counter_Table; type Counter_Module is new AWA.Modules.Module with record Counters : Counter_Table; Counter_Limit : Natural := DEFAULT_COUNTER_LIMIT; Age_Limit : Duration := DEFAULT_AGE_LIMIT; end record; end AWA.Counters.Modules;
with Ada.Calendar; with Fmt.Time_Argument; with Fmt.String_Argument; with Fmt.Integer_Argument; with Fmt.Duration_Argument; package Fmt.Stdtypes is -- integer support -- edit format (control_char=control_value;...) -- "w=" width -- "a=" align -- "f=" fillchar -- "b=" base (use lowercase extended digit) -- "B=" base (use uppercase extended digit) function "&" (Args : Arguments; X : Integer) return Arguments renames Integer_Argument."&"; function To_Argument (X : Integer) return Argument_Type'Class renames Integer_Argument.To_Argument; function Format is new Generic_Format(Integer); -- time support -- edit format -- "%y" : year (yy) -- "%Y" : year (yyyy) -- "%m" : month (mm) -- "%d" : day (dd) -- "%H" : hour (HH) -- "%M" : min (MM) -- "%S" : sec (SS) function "&" (Args : Arguments; X : Ada.Calendar.Time) return Arguments renames Time_Argument."&"; function To_Argument (X : Ada.Calendar.Time) return Argument_Type'Class renames Time_Argument.To_Argument; function Format is new Generic_Format(Ada.Calendar.Time); function "&" (Args : Arguments; X : Duration) return Arguments renames Duration_Argument."&"; function To_Argument (X : Duration) return Argument_Type'Class renames Duration_Argument.To_Argument; function Format is new Generic_Format(Duration); -- utf8 string support -- edit format : -- "w=" width -- "a=" align -- "f=" fillchar -- "A=" unmask align -- "W=" unmask width -- "F=" maskchar fill -- "s=" style ("O|L|U|F") -- for example -- Format("hello, {:w=10,f= ,W=3,A=l,F=*}", "kylix") -- output : "hello, **lix" function "&" (Args : Arguments; X : String) return Arguments renames String_Argument."&"; function To_Argument (X : String) return Argument_Type'Class renames String_Argument.To_Argument; function Format is new Generic_Format(String); end Fmt.Stdtypes;
-- A pipeline version of the Sieve or Erastosthenes: we create a chain of tasks -- each of which holds several primes. The main program feeds successive integers -- into the pipe; each task tests the integer for divisibility by its own -- primes, and passes it along to the next task if not divisible. Each task has -- a pointer to its successor. The end of the pipeline creates a new task when -- a new prime is discovered and its own complement of primes is full. -- The value of max regulates the coarseness of the parallel computation. package prime_dividers is type int is range 1..1000000 ; -- for primes up to 10**6 task type divider is entry my_first(x: int); -- To initialize the task. entry maybe_prime(x: int) ; -- for successive tests. end divider; end prime_dividers ; with text_io; use text_io; package body prime_dividers is type pointer is access divider ; -- who's next. procedure initialize(ptr: in out pointer; value: int) is begin ptr := new divider ; ptr.my_first(value) ; end initialize; task body divider is max: constant := 10; -- number of primes per task. subtype cap is integer range 1..max; my_primes: array(cap) of int ; last: cap := 1; is_prime: boolean := false ; next: pointer ; candidate: int ; begin accept my_first(x:int) do my_primes(last) := x ; -- now we know. put_line("new task with prime: "& int'image(x)) ; end ; loop select accept maybe_prime(x: int) do candidate := x; is_prime := true ; -- maybe. for i in 1..last loop if candidate mod my_primes(i) = 0 then -- not a prime. is_prime := false ; exit ; elsif my_primes(i)**2 > candidate then exit ; -- must be prime. end if ; end loop ; end maybe_prime ; if is_prime then if last < max then -- keep locally. last := last +1 ; my_primes(last) := candidate ; put_line("new prime: "& int'image(candidate)) ; elsif next = null then -- need new task. initialize(next, candidate) ; else next.maybe_prime(candidate) ; -- needs further test. end if ; end if ; or terminate ; end select ; end loop; end divider; end prime_dividers; with prime_dividers; use prime_dividers ; with text_io; use text_io; procedure main is first_prime: divider ; -- Beginning of pipeline. begin first_prime.my_first(3) ; -- No need to test even numbers for i in int range 2..2000 loop first_prime.maybe_prime(2*i+1) ; end loop; end main ;
package body Person2 is procedure Set_Name (A_Person : out Person; Name : in Unbounded_String) is begin A_Person.Name := Name; end Set_Name; procedure Set_Age (A_Person : out Person; Her_Age : in Age_Type) is begin A_Person.Age := Her_Age; end Set_Age; function Get_Name (A_Person : Person) return Unbounded_String is (A_Person.Name); function Get_Age (A_Person : Person) return Age_Type is (A_Person.Age); function Is_Adult (A_Person : Person) return Boolean is (A_Person.Age >= Adult_Age); end Person2;
with STM32GD.Clock; with STM32GD.Clock.Tree; generic Clock : STM32GD.Clock.Clock_Type; with package Clock_Tree is new STM32GD.Clock.Tree (<>); package STM32GD.RTC is subtype Year_Type is Natural range 2000 .. 2099; subtype Month_Type is Natural range 1 .. 12; subtype Day_Type is Natural range 1 .. 31; subtype Hour_Type is Natural range 0 .. 23; subtype Minute_Type is Natural range 0 .. 59; subtype Second_Type is Natural range 0 .. 59; subtype Second_Delta_Type is Natural range 0 .. (60 * 60 * 24); subtype Minute_Delta_Type is Natural range 0 .. (60 * 24); type Date_Time_Type is record Year : Year_Type; Month : Month_Type; Day : Day_Type; Hour : Hour_Type; Minute : Minute_Type; Second : Second_Type; end record; procedure Init; procedure Unlock; procedure Lock; procedure Read (Date_Time : out Date_Time_Type); generic with procedure Put (S : String); procedure Print (Date_Time : Date_Time_Type); procedure Add_Seconds (Date_Time : in out Date_Time_Type; Second_Delta : Second_Delta_Type); procedure Add_Minutes (Date_Time : in out Date_Time_Type; Minute_Delta : Minute_Delta_Type); procedure Set_Alarm (Date_Time : Date_Time_Type); procedure Wait_For_Alarm; function To_Seconds (Date_Time : Date_Time_Type) return Natural; end STM32GD.RTC;
------------------------------------------------------------------------------ -- -- -- GNU ADA RUN-TIME LIBRARY (GNARL) COMPONENTS -- -- -- -- S Y S T E M - S T A C K _ U S A G E -- -- -- -- B o d y -- -- -- -- Copyright (C) 2004-2006, Free Software Foundation, Inc. -- -- -- -- GNARL is free software; you can redistribute it and/or modify it under -- -- terms of the GNU General Public License as published by the Free Soft- -- -- ware Foundation; either version 2, or (at your option) any later ver- -- -- sion. GNARL is distributed in the hope that it will be useful, but WITH- -- -- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY -- -- or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -- -- for more details. You should have received a copy of the GNU General -- -- Public License distributed with GNARL; see file COPYING. If not, write -- -- to the Free Software Foundation, 51 Franklin Street, Fifth Floor, -- -- Boston, MA 02110-1301, USA. -- -- -- -- As a special exception, if other files instantiate generics from this -- -- unit, or you link this unit with other files to produce an executable, -- -- this unit does not by itself cause the resulting executable to be -- -- covered by the GNU General Public License. This exception does not -- -- however invalidate any other reasons why the executable file might be -- -- covered by the GNU Public License. -- -- -- -- GNARL was developed by the GNARL team at Florida State University. -- -- Extensive contributions were provided by Ada Core Technologies, Inc. -- -- -- ------------------------------------------------------------------------------ with System.Parameters; with System.CRTL; with System.IO; package body System.Stack_Usage is use System.Storage_Elements; use System; use System.IO; procedure Output_Result (Result_Id : Natural; Result : Task_Result); function Report_Result (Analyzer : Stack_Analyzer) return Natural; function Inner_Than (A1 : Stack_Address; A2 : Stack_Address) return Boolean; pragma Inline (Inner_Than); -- Return True if, according to the direction of the stack growth, A1 is -- inner than A2. Inlined to reduce the size of the stack used by the -- instrumentation code. ---------------- -- Inner_Than -- ---------------- function Inner_Than (A1 : Stack_Address; A2 : Stack_Address) return Boolean is begin if System.Parameters.Stack_Grows_Down then return A1 > A2; else return A2 > A1; end if; end Inner_Than; ---------------- -- Initialize -- ---------------- -- Add comments to this procedure ??? -- Other subprograms also need more comment in code??? procedure Initialize (Buffer_Size : Natural) is Bottom_Of_Stack : aliased Integer; Stack_Size_Chars : System.Address; begin Result_Array := new Result_Array_Type (1 .. Buffer_Size); Result_Array.all := (others => (Task_Name => (others => ASCII.NUL), Measure => 0, Max_Size => 0)); Is_Enabled := True; Stack_Size_Chars := System.CRTL.getenv ("GNAT_STACK_LIMIT" & ASCII.NUL); -- If variable GNAT_STACK_LIMIT is set, then we will take care of the -- environment task, using GNAT_STASK_LIMIT as the size of the stack. -- It doens't make sens to process the stack when no bound is set (e.g. -- limit is typically up to 4 GB). if Stack_Size_Chars /= Null_Address then declare Stack_Size : Integer; begin Stack_Size := System.CRTL.atoi (Stack_Size_Chars) * 1024; Initialize_Analyzer (Environment_Task_Analyzer, "ENVIRONMENT TASK", Stack_Size, System.Storage_Elements.To_Integer (Bottom_Of_Stack'Address)); Fill_Stack (Environment_Task_Analyzer); Compute_Environment_Task := True; end; -- GNAT_STACK_LIMIT not set else Compute_Environment_Task := False; end if; end Initialize; ---------------- -- Fill_Stack -- ---------------- procedure Fill_Stack (Analyzer : in out Stack_Analyzer) is -- Change the local variables and parameters of this function with -- super-extra care. The more the stack frame size of this function is -- big, the more an "instrumentation threshold at writing" error is -- likely to happen. type Word_32_Arr is array (1 .. Analyzer.Size / (Word_32_Size / Byte_Size)) of Word_32; pragma Pack (Word_32_Arr); package Arr_Addr is new System.Address_To_Access_Conversions (Word_32_Arr); Arr : aliased Word_32_Arr; begin for J in Word_32_Arr'Range loop Arr (J) := Analyzer.Pattern; end loop; Analyzer.Array_Address := Arr_Addr.To_Address (Arr'Access); Analyzer.Inner_Pattern_Mark := To_Stack_Address (Arr (1)'Address); Analyzer.Outer_Pattern_Mark := To_Stack_Address (Arr (Word_32_Arr'Last)'Address); if Inner_Than (Analyzer.Outer_Pattern_Mark, Analyzer.Inner_Pattern_Mark) then Analyzer.Inner_Pattern_Mark := Analyzer.Outer_Pattern_Mark; Analyzer.Outer_Pattern_Mark := To_Stack_Address (Arr (1)'Address); Analyzer.First_Is_Outermost := True; else Analyzer.First_Is_Outermost := False; end if; -- If Arr has been packed, the following assertion must be true (we add -- the size of the element whose address is: -- -- Min (Analyzer.Inner_Pattern_Mark, Analyzer.Outer_Pattern_Mark)): pragma Assert (Analyzer.Size = Stack_Size (Analyzer.Outer_Pattern_Mark, Analyzer.Inner_Pattern_Mark) + Word_32_Size / Byte_Size); end Fill_Stack; ------------------------- -- Initialize_Analyzer -- ------------------------- procedure Initialize_Analyzer (Analyzer : in out Stack_Analyzer; Task_Name : String; Size : Natural; Bottom : Stack_Address; Pattern : Word_32 := 16#DEAD_BEEF#) is begin Analyzer.Bottom_Of_Stack := Bottom; Analyzer.Size := Size; Analyzer.Pattern := Pattern; Analyzer.Result_Id := Next_Id; Analyzer.Task_Name := (others => ' '); if Task_Name'Length <= Task_Name_Length then Analyzer.Task_Name (1 .. Task_Name'Length) := Task_Name; else Analyzer.Task_Name := Task_Name (Task_Name'First .. Task_Name'First + Task_Name_Length - 1); end if; if Next_Id in Result_Array'Range then Result_Array (Analyzer.Result_Id).Task_Name := Analyzer.Task_Name; end if; Result_Array (Analyzer.Result_Id).Max_Size := Size; Next_Id := Next_Id + 1; end Initialize_Analyzer; ---------------- -- Stack_Size -- ---------------- function Stack_Size (SP_Low : Stack_Address; SP_High : Stack_Address) return Natural is begin if SP_Low > SP_High then return Natural (SP_Low - SP_High + 4); else return Natural (SP_High - SP_Low + 4); end if; end Stack_Size; -------------------- -- Compute_Result -- -------------------- procedure Compute_Result (Analyzer : in out Stack_Analyzer) is -- Change the local variables and parameters of this function with -- super-extra care. The larger the stack frame size of this function -- is, the more an "instrumentation threshold at reading" error is -- likely to happen. type Word_32_Arr is array (1 .. Analyzer.Size / (Word_32_Size / Byte_Size)) of Word_32; pragma Pack (Word_32_Arr); package Arr_Addr is new System.Address_To_Access_Conversions (Word_32_Arr); Arr_Access : Arr_Addr.Object_Pointer; begin Arr_Access := Arr_Addr.To_Pointer (Analyzer.Array_Address); Analyzer.Outermost_Touched_Mark := Analyzer.Inner_Pattern_Mark; for J in Word_32_Arr'Range loop if Arr_Access (J) /= Analyzer.Pattern then Analyzer.Outermost_Touched_Mark := To_Stack_Address (Arr_Access (J)'Address); if Analyzer.First_Is_Outermost then exit; end if; end if; end loop; end Compute_Result; --------------------- -- Output_Result -- --------------------- procedure Output_Result (Result_Id : Natural; Result : Task_Result) is begin Set_Output (Standard_Error); Put (Natural'Image (Result_Id)); Put (" | "); Put (Result.Task_Name); Put (" | "); Put (Natural'Image (Result.Max_Size)); Put (" | "); Put (Natural'Image (Result.Measure)); New_Line; end Output_Result; --------------------- -- Output_Results -- --------------------- procedure Output_Results is begin if Compute_Environment_Task then Compute_Result (Environment_Task_Analyzer); Report_Result (Environment_Task_Analyzer); end if; Set_Output (Standard_Error); Put ("Index | Task Name | Stack Size | Actual Use"); New_Line; for J in Result_Array'Range loop exit when J >= Next_Id; Output_Result (J, Result_Array (J)); end loop; end Output_Results; ------------------- -- Report_Result -- ------------------- procedure Report_Result (Analyzer : Stack_Analyzer) is begin if Analyzer.Result_Id in Result_Array'Range then Result_Array (Analyzer.Result_Id).Measure := Report_Result (Analyzer); else Output_Result (Analyzer.Result_Id, (Task_Name => Analyzer.Task_Name, Max_Size => Analyzer.Size, Measure => Report_Result (Analyzer))); end if; end Report_Result; function Report_Result (Analyzer : Stack_Analyzer) return Natural is begin if Analyzer.Outermost_Touched_Mark = Analyzer.Inner_Pattern_Mark then return Stack_Size (Analyzer.Inner_Pattern_Mark, Analyzer.Bottom_Of_Stack); else return Stack_Size (Analyzer.Outermost_Touched_Mark, Analyzer.Bottom_Of_Stack); end if; end Report_Result; end System.Stack_Usage;
-- -- Copyright 2018 The wookey project team <wookey@ssi.gouv.fr> -- - Ryad Benadjila -- - Arnauld Michelizza -- - Mathieu Renard -- - Philippe Thierry -- - Philippe Trebuchet -- -- Licensed under the Apache License, Version 2.0 (the "License"); -- you may not use this file except in compliance with the License. -- You may obtain a copy of the License at -- -- http://www.apache.org/licenses/LICENSE-2.0 -- -- Unless required by applicable law or agreed to in writing, software -- distributed under the License is distributed on an "AS IS" BASIS, -- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -- See the License for the specific language governing permissions and -- limitations under the License. -- -- package soc.dma.interfaces with spark_mode => off is type t_dma_interrupts is (FIFO_ERROR, DIRECT_MODE_ERROR, TRANSFER_ERROR, HALF_COMPLETE, TRANSFER_COMPLETE); type t_config_mask is record handlers : boolean; buffer_in : boolean; buffer_out : boolean; buffer_size : boolean; mode : boolean; priority : boolean; direction : boolean; end record; for t_config_mask use record handlers at 0 range 0 .. 0; buffer_in at 0 range 1 .. 1; buffer_out at 0 range 2 .. 2; buffer_size at 0 range 3 .. 3; mode at 0 range 4 .. 4; priority at 0 range 5 .. 5; direction at 0 range 6 .. 6; end record; type t_mode is (DIRECT_MODE, FIFO_MODE, CIRCULAR_MODE); type t_transfer_dir is (PERIPHERAL_TO_MEMORY, MEMORY_TO_PERIPHERAL, MEMORY_TO_MEMORY); type t_priority_level is (LOW, MEDIUM, HIGH, VERY_HIGH); type t_data_size is (TRANSFER_BYTE, TRANSFER_HALF_WORD, TRANSFER_WORD); type t_burst_size is (SINGLE_TRANSFER, INCR_4_BEATS, INCR_8_BEATS, INCR_16_BEATS); type t_flow_controller is (DMA_FLOW_CONTROLLER, PERIPH_FLOW_CONTROLLER); type t_dma_config is record dma_id : soc.dma.t_dma_periph_index; stream : soc.dma.t_stream_index; channel : soc.dma.t_channel_index; bytes : unsigned_16; in_addr : system_address; in_priority : t_priority_level; in_handler : system_address; -- ISR out_addr : system_address; out_priority : t_priority_level; out_handler : system_address; -- ISR flow_controller : t_flow_controller; transfer_dir : t_transfer_dir; mode : t_mode; data_size : t_data_size; memory_inc : boolean; periph_inc : boolean; mem_burst_size : t_burst_size; periph_burst_size : t_burst_size; end record; procedure enable_stream (dma_id : in soc.dma.t_dma_periph_index; stream : in soc.dma.t_stream_index); procedure disable_stream (dma_id : in soc.dma.t_dma_periph_index; stream : in soc.dma.t_stream_index); procedure clear_interrupt (dma_id : in soc.dma.t_dma_periph_index; stream : in soc.dma.t_stream_index; interrupt : in t_dma_interrupts); procedure clear_all_interrupts (dma_id : in soc.dma.t_dma_periph_index; stream : in soc.dma.t_stream_index); function get_interrupt_status (dma_id : in soc.dma.t_dma_periph_index; stream : in soc.dma.t_stream_index) return t_dma_stream_int_status; procedure configure_stream (dma_id : in soc.dma.t_dma_periph_index; stream : in soc.dma.t_stream_index; user_config : in t_dma_config); procedure reconfigure_stream (dma_id : in soc.dma.t_dma_periph_index; stream : in soc.dma.t_stream_index; user_config : in t_dma_config; to_configure: in t_config_mask); procedure reset_stream (dma_id : in soc.dma.t_dma_periph_index; stream : in soc.dma.t_stream_index); end soc.dma.interfaces;
----------------------------------------------------------------------- -- babel-strategies -- Strategies to backup files -- Copyright (C) 2014, 2015, 2016 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.Listeners; with Babel.Files; with Babel.Files.Queues; with Babel.Files.Buffers; with Babel.Streams.Refs; with Babel.Stores; with Babel.Filters; with Babel.Base; with Babel.Base.Text; package Babel.Strategies is type Strategy_Type is abstract tagged limited private; type Strategy_Type_Access is access all Strategy_Type'Class; -- Allocate a buffer to read the file content. function Allocate_Buffer (Strategy : in Strategy_Type) return Babel.Files.Buffers.Buffer_Access; -- Release the buffer that was allocated by Allocate_Buffer. procedure Release_Buffer (Strategy : in Strategy_Type; Buffer : in out Babel.Files.Buffers.Buffer_Access); -- Returns true if there is a directory that must be processed by the current strategy. function Has_Directory (Strategy : in Strategy_Type) return Boolean is abstract; -- Get the next directory that must be processed by the strategy. procedure Peek_Directory (Strategy : in out Strategy_Type; Directory : out Babel.Files.Directory_Type) is abstract; -- Scan the directory procedure Scan (Strategy : in out Strategy_Type; Directory : in Babel.Files.Directory_Type; Container : in out Babel.Files.File_Container'Class); -- Scan the directories which are defined in the directory queue and -- use the file container to scan the files and directories. procedure Scan (Strategy : in out Strategy_Type; Queue : in out Babel.Files.Queues.Directory_Queue; Container : in out Babel.Files.File_Container'Class); -- Read the file from the read store into the local buffer. procedure Read_File (Strategy : in Strategy_Type; File : in Babel.Files.File_Type; Stream : in out Babel.Streams.Refs.Stream_Ref); -- Write the file from the local buffer into the write store. procedure Write_File (Strategy : in Strategy_Type; File : in Babel.Files.File_Type; Stream : in Babel.Streams.Refs.Stream_Ref); -- Backup the file from the local buffer into the write store. procedure Backup_File (Strategy : in out Strategy_Type; File : in Babel.Files.File_Type; Stream : in Babel.Streams.Refs.Stream_Ref); procedure Execute (Strategy : in out Strategy_Type) is abstract; -- Set the file filters that will be used when scanning the read store. procedure Set_Filters (Strategy : in out Strategy_Type; Filters : in Babel.Filters.Filter_Type_Access); -- Set the read and write stores that the strategy will use. procedure Set_Stores (Strategy : in out Strategy_Type; Read : in Babel.Stores.Store_Type_Access; Write : in Babel.Stores.Store_Type_Access); -- Set the buffer pool to be used by Allocate_Buffer. procedure Set_Buffers (Strategy : in out Strategy_Type; Buffers : in Babel.Files.Buffers.Buffer_Pool_Access); -- Set the listeners to inform about changes. procedure Set_Listeners (Strategy : in out Strategy_Type; Listeners : access Util.Listeners.List); -- Set the database for use by the strategy. procedure Set_Database (Strategy : in out Strategy_Type; Database : in Babel.Base.Database_Access); private type Strategy_Type is abstract tagged limited record Read_Store : Babel.Stores.Store_Type_Access; Write_Store : Babel.Stores.Store_Type_Access; Filters : Babel.Filters.Filter_Type_Access; Buffers : Babel.Files.Buffers.Buffer_Pool_Access; Listeners : access Util.Listeners.List; Database : Babel.Base.Text.Text_Database; end record; end Babel.Strategies;
package body Ada.Environment_Variables is procedure Start (Object : out Iterator); procedure Start (Object : out Iterator) is begin Object.Block := System.Native_Environment_Variables.Get_Block; end Start; -- implementation procedure Iterate ( Process : not null access procedure (Name, Value : String)) is Ite : Iterator; -- controlled I : Cursor; begin Start (Ite); I := First (Ite); while Has_Element (I) loop Process (Name (I), Value (I)); I := Next (Ite, I); end loop; end Iterate; function Has_Element (Position : Cursor) return Boolean is begin return System.Native_Environment_Variables.Has_Element ( System.Native_Environment_Variables.Cursor (Position)); end Has_Element; function Name (Position : Cursor) return String is begin return System.Native_Environment_Variables.Name ( System.Native_Environment_Variables.Cursor (Position)); end Name; function Value (Position : Cursor) return String is begin return System.Native_Environment_Variables.Value ( System.Native_Environment_Variables.Cursor (Position)); end Value; function Iterate return Iterator_Interfaces.Forward_Iterator'Class is begin return Result : Iterator do Start (Result); end return; end Iterate; overriding procedure Finalize (Object : in out Iterator) is begin System.Native_Environment_Variables.Release_Block (Object.Block); end Finalize; overriding function First (Object : Iterator) return Cursor is begin return Cursor (System.Native_Environment_Variables.First (Object.Block)); end First; overriding function Next (Object : Iterator; Position : Cursor) return Cursor is begin return Cursor ( System.Native_Environment_Variables.Next ( Object.Block, System.Native_Environment_Variables.Cursor (Position))); end Next; end Ada.Environment_Variables;
separate(practica_3) --Esta es la funcion que suma los elementos de la columna de una matriz y los guarda en un vector function Suma_Filas(M:Matriz) return Vector is v:vector(M'range(2)); begin for i in M'Range(2) loop v(I):=m(1,i);--en el vector guardo el primer elemento de la columna la matriz for j in 2..M'last loop v(I):=v(I)+ M(J,I);-- le sumo al vector el resto de los elemento de la columna end loop; end loop; return v; exception when Constraint_error => raise Error_Suma; --lanza error suma si existe un overflow en la suma ya que se sale del rango del tipo end suma_filas;
-- -- Raytracer implementation in Ada -- by John Perry (github: johnperry-math) -- 2021 -- -- implementation for 3d Vectors, which describe positions, directions, etc. -- pragma Ada_2020; -- Ada packages with Ada.Numerics.Generic_Elementary_Functions; -- local packages with RayTracing_Constants; use RayTracing_Constants; package body Vectors is ------------------------------------------------------------------------- -- the next package, and the subsequent subprogram, -- make the square root function available package Float_Numerics is new Ada.Numerics.Generic_Elementary_Functions ( Float_Type => Float15 ); function Sqrt(X: Float15) return Float15 renames Float_Numerics.Sqrt; ------------------------------------------------------------------------- function Create_Vector(X, Y, Z: Float15) return Vector is ( ( X => X, Y => Y, Z => Z ) ); function Cross_Product(First, Second: Vector) return Vector is ( Create_Vector( First.Y * Second.Z - First.Z * Second.Y, First.Z * Second.X - First.X * Second.Z, First.X * Second.Y - First.Y * Second.X ) ); function Length(V: Vector) return Float15 is ( Sqrt( V.X * V.X + V.Y * V.Y + V.Z * V.Z ) ); function Scale(V: Vector; K: Float15) return Vector is ( ( K * V.X, K * V.Y, K * V.Z ) ); procedure Self_Scale(V: in out Vector; K: Float15) is begin V.X := @ * K; V.Y := @ * K; V.Z := @ * K; end Self_Scale; function Normal(V: Vector) return Vector is Mag: Float15 := Length(V); begin return Scale( V, ( if Mag = 0.0 then Far_Away else 1.0 / Mag ) ); end Normal; procedure Self_Norm(V: in out Vector) is Mag: Float15 := Length(V); begin Self_Scale( V, ( if Mag = 0.0 then Far_Away else 1.0 / Mag ) ); end Self_Norm; function Dot_Product(First, Second: Vector) return Float15 is ( First.X * Second.X + First.Y * Second.Y + First.Z * Second.Z ); function "+"(First, Second: Vector) return Vector is ( Create_Vector( First.X + Second.X, First.Y + Second.Y, First.Z + Second.Z ) ); function "-"(First, Second: Vector) return Vector is ( Create_Vector( First.X - Second.X, First.Y - Second.Y, First.Z - Second.Z ) ); end Vectors;
with YAML.Vector; pragma Unreferenced (YAML.Vector); with YAML.Object; pragma Unreferenced (YAML.Object); procedure YAML.Demo is begin null; end YAML.Demo;
with Ada.Text_IO; use Ada.Text_IO; procedure Bonjour is begin -- Bonjour Put("Hello world!"); end Bonjour;
-- { dg-do run } -- { dg-options "-O3 -gnatn" } with Opt50_Pkg; use Opt50_Pkg; procedure Opt50 is B : Boolean; E : Enum; begin Get ("four", E, B); if B = True then raise Program_Error; end if; Get ("three", E, B); if B = False then raise Program_Error; end if; declare A : Enum_Boolean_Array (One .. E) := (others => True); begin Set (A); end; end Opt50;
procedure Procedure_Renaming is procedure Do_It is begin null; end; procedure Do_That renames Do_It; begin Do_That; end Procedure_Renaming;
with STM32_SVD.GPIO; use STM32_SVD.GPIO; with STM32_SVD.SCB; use STM32_SVD.SCB; with STM32_SVD.RCC; use STM32_SVD.RCC; with STM32_SVD.EXTI; use STM32_SVD.EXTI; with STM32_SVD.NVIC; use STM32_SVD.NVIC; with STM32_SVD.SYSCFG; use STM32_SVD.SYSCFG; with STM32GD.GPIO.Port; package body STM32GD.GPIO.Pin is type Port_Periph_Access is access all GPIO_Peripheral; function Index return Natural is begin return GPIO_Pin'Pos (Pin); end Index; function Pin_Mask return UInt16 is begin return GPIO_Pin'Enum_Rep (Pin); end Pin_Mask; function Port_Periph return Port_Periph_Access is begin return (if Port = Port_A then STM32_SVD.GPIO.GPIOA_Periph'Access elsif Port = Port_B then STM32_SVD.GPIO.GPIOB_Periph'Access elsif Port = Port_C then STM32_SVD.GPIO.GPIOC_Periph'Access elsif Port = Port_D then STM32_SVD.GPIO.GPIOD_Periph'Access elsif Port = Port_E then STM32_SVD.GPIO.GPIOD_Periph'Access else STM32_SVD.GPIO.GPIOH_Periph'Access); end Port_Periph; procedure Enable is begin case Port is when Port_A => RCC_Periph.IOPENR.IOPAEN := 1; when Port_B => RCC_Periph.IOPENR.IOPBEN := 1; when Port_C => RCC_Periph.IOPENR.IOPCEN := 1; when Port_D => RCC_Periph.IOPENR.IOPDEN := 1; when Port_E => RCC_Periph.IOPENR.IOPEEN := 1; when Port_H => RCC_Periph.IOPENR.IOPHEN := 1; end case; end Enable; procedure Disable is begin case Port is when Port_A => RCC_Periph.IOPENR.IOPAEN := 0; when Port_B => RCC_Periph.IOPENR.IOPBEN := 0; when Port_C => RCC_Periph.IOPENR.IOPCEN := 0; when Port_D => RCC_Periph.IOPENR.IOPDEN := 0; when Port_E => RCC_Periph.IOPENR.IOPEEN := 0; when Port_H => RCC_Periph.IOPENR.IOPHEN := 0; end case; end Disable; procedure Init is begin if Mode /= Mode_In then Set_Mode (Mode); end if; if Pull_Resistor /= Floating then Set_Pull_Resistor (Pull_Resistor); end if; if Output_Type /= Push_Pull then Set_Type (Output_Type); end if; if Alternate_Function /= 0 then Configure_Alternate_Function (Alternate_Function); end if; end Init; procedure Set_Mode (Mode : Pin_IO_Modes) is begin Port_Periph.MODER.Arr (Index) := Pin_IO_Modes'Enum_Rep (Mode); end Set_Mode; procedure Set_Type (Pin_Type : Pin_Output_Types) is begin Port_Periph.OTYPER.OT.Arr (Index) := Pin_Output_Types'Enum_Rep (Pin_Type); end Set_Type; function Get_Pull_Resistor return Internal_Pin_Resistors is begin if Port_Periph.PUPDR.Arr (Index) = 0 then return Floating; elsif Port_Periph.PUPDR.Arr (Index) = 1 then return Pull_Up; else return Pull_Down; end if; end Get_Pull_Resistor; procedure Set_Pull_Resistor (Pull : Internal_Pin_Resistors) is begin Port_Periph.PUPDR.Arr (Index) := Internal_Pin_Resistors'Enum_Rep (Pull); end Set_Pull_Resistor; function Is_Set return Boolean is begin return (Port_Periph.IDR.ID.Val and Pin_Mask) = Pin_Mask; end Is_Set; procedure Set is begin Port_Periph.BSRR.BS.Val := GPIO_Pin'Enum_Rep (Pin); end Set; procedure Clear is begin Port_Periph.BRR.BR.Val := GPIO_Pin'Enum_Rep (Pin); end Clear; procedure Toggle is begin Port_Periph.ODR.OD.Val := Port_Periph.ODR.OD.Val xor GPIO_Pin'Enum_Rep (Pin); end Toggle; procedure Configure_Alternate_Function (AF : GPIO_Alternate_Function) is begin if Index < 8 then Port_Periph.AFRL.Arr (Index) := UInt4 (AF); else Port_Periph.AFRH.Arr (Index) := UInt4 (AF); end if; end Configure_Alternate_Function; procedure Connect_External_Interrupt is Port_Id : constant UInt4 := GPIO_Port'Enum_Rep (Port); begin case Index is when 0 .. 3 => SYSCFG_COMP_Periph.EXTICR1.EXTI.Arr (Index) := Port_Id; when 4 .. 7 => SYSCFG_COMP_Periph.EXTICR2.EXTI.Arr (Index) := Port_Id; when 8 .. 11 => SYSCFG_COMP_Periph.EXTICR3.EXTI.Arr (Index) := Port_Id; when 12 .. 15 => SYSCFG_COMP_Periph.EXTICR4.EXTI.Arr (Index) := Port_Id; when others => raise Program_Error; end case; end Connect_External_Interrupt; procedure Wait_For_Trigger is begin loop STM32GD.Wait_For_Event; exit when Triggered; end loop; Clear_Trigger; end Wait_For_Trigger; procedure Clear_Trigger is begin EXTI_Periph.PR.PIF.Arr (Index) := 1; NVIC_Periph.ICPR := 2 ** 5; end Clear_Trigger; function Triggered return Boolean is begin return EXTI_Periph.PR.PIF.Arr (Index) = 1; end Triggered; procedure Configure_Trigger (Rising : Boolean := False; Falling : Boolean := False) is begin Connect_External_Interrupt; if Rising then EXTI_Periph.RTSR.RT.Arr (Index) := 1; end if; if Falling then EXTI_Periph.FTSR.FT.Arr (Index) := 1; end if; EXTI_Periph.EMR.EM.Arr (Index) := 1; end Configure_Trigger; end STM32GD.GPIO.Pin;
-- Copyright 2015 Steven Stewart-Gallus -- -- Licensed under the Apache License, Version 2.0 (the "License"); -- you may not use this file except in compliance with the License. -- You may obtain a copy of the License at -- -- http://www.apache.org/licenses/LICENSE-2.0 -- -- Unless required by applicable law or agreed to in writing, software -- distributed under the License is distributed on an "AS IS" BASIS, -- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or -- implied. See the License for the specific language governing -- permissions and limitations under the License. package XKB.Keysyms with SPARK_Mode => Off is pragma Preelaborate; -- XKB_KEY_NoSymbol : constant := #16#000000; -- XKB_KEY_VoidSymbol : constant := #16#ffffff; -- XKB_KEY_BackSpace : constant := #16#ff08; -- XKB_KEY_Tab : constant := #16#ff09; -- XKB_KEY_Linefeed : constant := #16#ff0a; -- XKB_KEY_Clear : constant := #16#ff0b; -- XKB_KEY_Return : constant := #16#ff0d; -- XKB_KEY_Pause : constant := #16#ff13; -- XKB_KEY_Scroll_Lock : constant := #16#ff14; -- XKB_KEY_Sys_Req : constant := #16#ff15; -- XKB_KEY_Escape : constant := #16#ff1b; -- XKB_KEY_Delete : constant := #16#ffff; -- XKB_KEY_Multi_key : constant := #16#ff20; -- XKB_KEY_Codeinput : constant := #16#ff37; -- XKB_KEY_SingleCandidate : constant := #16#ff3c; -- XKB_KEY_MultipleCandidate : constant := #16#ff3d; -- XKB_KEY_PreviousCandidate : constant := #16#ff3e; -- XKB_KEY_Kanji : constant := #16#ff21; -- XKB_KEY_Muhenkan : constant := #16#ff22; -- XKB_KEY_Henkan_Mode : constant := #16#ff23; -- XKB_KEY_Henkan : constant := #16#ff23; -- XKB_KEY_Romaji : constant := #16#ff24; -- XKB_KEY_Hiragana : constant := #16#ff25; -- XKB_KEY_Katakana : constant := #16#ff26; -- XKB_KEY_Hiragana_Katakana : constant := #16#ff27; -- XKB_KEY_Zenkaku : constant := #16#ff28; -- XKB_KEY_Hankaku : constant := #16#ff29; -- XKB_KEY_Zenkaku_Hankaku : constant := #16#ff2a; -- XKB_KEY_Touroku : constant := #16#ff2b; -- XKB_KEY_Massyo : constant := #16#ff2c; -- XKB_KEY_Kana_Lock : constant := #16#ff2d; -- XKB_KEY_Kana_Shift : constant := #16#ff2e; -- XKB_KEY_Eisu_Shift : constant := #16#ff2f; -- XKB_KEY_Eisu_toggle : constant := #16#ff30; -- XKB_KEY_Kanji_Bangou : constant := #16#ff37; -- XKB_KEY_Zen_Koho : constant := #16#ff3d; -- XKB_KEY_Mae_Koho : constant := #16#ff3e; -- XKB_KEY_Home : constant := #16#ff50; -- XKB_KEY_Left : constant := #16#ff51; -- XKB_KEY_Up : constant := #16#ff52; -- XKB_KEY_Right : constant := #16#ff53; -- XKB_KEY_Down : constant := #16#ff54; -- XKB_KEY_Prior : constant := #16#ff55; -- XKB_KEY_Page_Up : constant := #16#ff55; -- XKB_KEY_Next : constant := #16#ff56; -- XKB_KEY_Page_Down : constant := #16#ff56; -- XKB_KEY_End : constant := #16#ff57; -- XKB_KEY_Begin : constant := #16#ff58; -- XKB_KEY_Select : constant := #16#ff60; -- XKB_KEY_Print : constant := #16#ff61; -- XKB_KEY_Execute : constant := #16#ff62; -- XKB_KEY_Insert : constant := #16#ff63; -- XKB_KEY_Undo : constant := #16#ff65; -- XKB_KEY_Redo : constant := #16#ff66; -- XKB_KEY_Menu : constant := #16#ff67; -- XKB_KEY_Find : constant := #16#ff68; -- XKB_KEY_Cancel : constant := #16#ff69; -- XKB_KEY_Help : constant := #16#ff6a; -- XKB_KEY_Break : constant := #16#ff6b; -- XKB_KEY_Mode_switch : constant := #16#ff7e; -- XKB_KEY_script_switch : constant := #16#ff7e; -- XKB_KEY_Num_Lock : constant := #16#ff7f; -- XKB_KEY_KP_Space : constant := #16#ff80; -- XKB_KEY_KP_Tab : constant := #16#ff89; -- XKB_KEY_KP_Enter : constant := #16#ff8d; -- XKB_KEY_KP_F1 : constant := #16#ff91; -- XKB_KEY_KP_F2 : constant := #16#ff92; -- XKB_KEY_KP_F3 : constant := #16#ff93; -- XKB_KEY_KP_F4 : constant := #16#ff94; -- XKB_KEY_KP_Home : constant := #16#ff95; -- XKB_KEY_KP_Left : constant := #16#ff96; -- XKB_KEY_KP_Up : constant := #16#ff97; -- XKB_KEY_KP_Right : constant := #16#ff98; -- XKB_KEY_KP_Down : constant := #16#ff99; -- XKB_KEY_KP_Prior : constant := #16#ff9a; -- XKB_KEY_KP_Page_Up : constant := #16#ff9a; -- XKB_KEY_KP_Next : constant := #16#ff9b; -- XKB_KEY_KP_Page_Down : constant := #16#ff9b; -- XKB_KEY_KP_End : constant := #16#ff9c; -- XKB_KEY_KP_Begin : constant := #16#ff9d; -- XKB_KEY_KP_Insert : constant := #16#ff9e; -- XKB_KEY_KP_Delete : constant := #16#ff9f; -- XKB_KEY_KP_Equal : constant := #16#ffbd; -- XKB_KEY_KP_Multiply : constant := #16#ffaa; -- XKB_KEY_KP_Add : constant := #16#ffab; -- XKB_KEY_KP_Separator : constant := #16#ffac; -- XKB_KEY_KP_Subtract : constant := #16#ffad; -- XKB_KEY_KP_Decimal : constant := #16#ffae; -- XKB_KEY_KP_Divide : constant := #16#ffaf; -- XKB_KEY_KP_0 : constant := #16#ffb0; -- XKB_KEY_KP_1 : constant := #16#ffb1; -- XKB_KEY_KP_2 : constant := #16#ffb2; -- XKB_KEY_KP_3 : constant := #16#ffb3; -- XKB_KEY_KP_4 : constant := #16#ffb4; -- XKB_KEY_KP_5 : constant := #16#ffb5; -- XKB_KEY_KP_6 : constant := #16#ffb6; -- XKB_KEY_KP_7 : constant := #16#ffb7; -- XKB_KEY_KP_8 : constant := #16#ffb8; -- XKB_KEY_KP_9 : constant := #16#ffb9; -- XKB_KEY_F1 : constant := #16#ffbe; -- XKB_KEY_F2 : constant := #16#ffbf; -- XKB_KEY_F3 : constant := #16#ffc0; -- XKB_KEY_F4 : constant := #16#ffc1; -- XKB_KEY_F5 : constant := #16#ffc2; -- XKB_KEY_F6 : constant := #16#ffc3; -- XKB_KEY_F7 : constant := #16#ffc4; -- XKB_KEY_F8 : constant := #16#ffc5; -- XKB_KEY_F9 : constant := #16#ffc6; -- XKB_KEY_F10 : constant := #16#ffc7; -- XKB_KEY_F11 : constant := #16#ffc8; -- XKB_KEY_L1 : constant := #16#ffc8; -- XKB_KEY_F12 : constant := #16#ffc9; -- XKB_KEY_L2 : constant := #16#ffc9; -- XKB_KEY_F13 : constant := #16#ffca; -- XKB_KEY_L3 : constant := #16#ffca; -- XKB_KEY_F14 : constant := #16#ffcb; -- XKB_KEY_L4 : constant := #16#ffcb; -- XKB_KEY_F15 : constant := #16#ffcc; -- XKB_KEY_L5 : constant := #16#ffcc; -- XKB_KEY_F16 : constant := #16#ffcd; -- XKB_KEY_L6 : constant := #16#ffcd; -- XKB_KEY_F17 : constant := #16#ffce; -- XKB_KEY_L7 : constant := #16#ffce; -- XKB_KEY_F18 : constant := #16#ffcf; -- XKB_KEY_L8 : constant := #16#ffcf; -- XKB_KEY_F19 : constant := #16#ffd0; -- XKB_KEY_L9 : constant := #16#ffd0; -- XKB_KEY_F20 : constant := #16#ffd1; -- XKB_KEY_L10 : constant := #16#ffd1; -- XKB_KEY_F21 : constant := #16#ffd2; -- XKB_KEY_R1 : constant := #16#ffd2; -- XKB_KEY_F22 : constant := #16#ffd3; -- XKB_KEY_R2 : constant := #16#ffd3; -- XKB_KEY_F23 : constant := #16#ffd4; -- XKB_KEY_R3 : constant := #16#ffd4; -- XKB_KEY_F24 : constant := #16#ffd5; -- XKB_KEY_R4 : constant := #16#ffd5; -- XKB_KEY_F25 : constant := #16#ffd6; -- XKB_KEY_R5 : constant := #16#ffd6; -- XKB_KEY_F26 : constant := #16#ffd7; -- XKB_KEY_R6 : constant := #16#ffd7; -- XKB_KEY_F27 : constant := #16#ffd8; -- XKB_KEY_R7 : constant := #16#ffd8; -- XKB_KEY_F28 : constant := #16#ffd9; -- XKB_KEY_R8 : constant := #16#ffd9; -- XKB_KEY_F29 : constant := #16#ffda; -- XKB_KEY_R9 : constant := #16#ffda; -- XKB_KEY_F30 : constant := #16#ffdb; -- XKB_KEY_R10 : constant := #16#ffdb; -- XKB_KEY_F31 : constant := #16#ffdc; -- XKB_KEY_R11 : constant := #16#ffdc; -- XKB_KEY_F32 : constant := #16#ffdd; -- XKB_KEY_R12 : constant := #16#ffdd; -- XKB_KEY_F33 : constant := #16#ffde; -- XKB_KEY_R13 : constant := #16#ffde; -- XKB_KEY_F34 : constant := #16#ffdf; -- XKB_KEY_R14 : constant := #16#ffdf; -- XKB_KEY_F35 : constant := #16#ffe0; -- XKB_KEY_R15 : constant := #16#ffe0; -- XKB_KEY_Shift_L : constant := #16#ffe1; -- XKB_KEY_Shift_R : constant := #16#ffe2; -- XKB_KEY_Control_L : constant := #16#ffe3; -- XKB_KEY_Control_R : constant := #16#ffe4; -- XKB_KEY_Caps_Lock : constant := #16#ffe5; -- XKB_KEY_Shift_Lock : constant := #16#ffe6; -- XKB_KEY_Meta_L : constant := #16#ffe7; -- XKB_KEY_Meta_R : constant := #16#ffe8; -- XKB_KEY_Alt_L : constant := #16#ffe9; -- XKB_KEY_Alt_R : constant := #16#ffea; -- XKB_KEY_Super_L : constant := #16#ffeb; -- XKB_KEY_Super_R : constant := #16#ffec; -- XKB_KEY_Hyper_L : constant := #16#ffed; -- XKB_KEY_Hyper_R : constant := #16#ffee; -- XKB_KEY_ISO_Lock : constant := #16#fe01; -- XKB_KEY_ISO_Level2_Latch : constant := #16#fe02; -- XKB_KEY_ISO_Level3_Shift : constant := #16#fe03; -- XKB_KEY_ISO_Level3_Latch : constant := #16#fe04; -- XKB_KEY_ISO_Level3_Lock : constant := #16#fe05; -- XKB_KEY_ISO_Level5_Shift : constant := #16#fe11; -- XKB_KEY_ISO_Level5_Latch : constant := #16#fe12; -- XKB_KEY_ISO_Level5_Lock : constant := #16#fe13; -- XKB_KEY_ISO_Group_Shift : constant := #16#ff7e; -- XKB_KEY_ISO_Group_Latch : constant := #16#fe06; -- XKB_KEY_ISO_Group_Lock : constant := #16#fe07; -- XKB_KEY_ISO_Next_Group : constant := #16#fe08; -- XKB_KEY_ISO_Next_Group_Lock : constant := #16#fe09; -- XKB_KEY_ISO_Prev_Group : constant := #16#fe0a; -- XKB_KEY_ISO_Prev_Group_Lock : constant := #16#fe0b; -- XKB_KEY_ISO_First_Group : constant := #16#fe0c; -- XKB_KEY_ISO_First_Group_Lock : constant := #16#fe0d; -- XKB_KEY_ISO_Last_Group : constant := #16#fe0e; -- XKB_KEY_ISO_Last_Group_Lock : constant := #16#fe0f; -- XKB_KEY_ISO_Left_Tab : constant := #16#fe20; -- XKB_KEY_ISO_Move_Line_Up : constant := #16#fe21; -- XKB_KEY_ISO_Move_Line_Down : constant := #16#fe22; -- XKB_KEY_ISO_Partial_Line_Up : constant := #16#fe23; -- XKB_KEY_ISO_Partial_Line_Down : constant := #16#fe24; -- XKB_KEY_ISO_Partial_Space_Left : constant := #16#fe25; -- XKB_KEY_ISO_Partial_Space_Right : constant := #16#fe26; -- XKB_KEY_ISO_Set_Margin_Left : constant := #16#fe27; -- XKB_KEY_ISO_Set_Margin_Right : constant := #16#fe28; -- XKB_KEY_ISO_Release_Margin_Left : constant := #16#fe29; -- XKB_KEY_ISO_Release_Margin_Right : constant := #16#fe2a; -- XKB_KEY_ISO_Release_Both_Margins : constant := #16#fe2b; -- XKB_KEY_ISO_Fast_Cursor_Left : constant := #16#fe2c; -- XKB_KEY_ISO_Fast_Cursor_Right : constant := #16#fe2d; -- XKB_KEY_ISO_Fast_Cursor_Up : constant := #16#fe2e; -- XKB_KEY_ISO_Fast_Cursor_Down : constant := #16#fe2f; -- XKB_KEY_ISO_Continuous_Underline : constant := #16#fe30; -- XKB_KEY_ISO_Discontinuous_Underline : constant := #16#fe31; -- XKB_KEY_ISO_Emphasize : constant := #16#fe32; -- XKB_KEY_ISO_Center_Object : constant := #16#fe33; -- XKB_KEY_ISO_Enter : constant := #16#fe34; -- XKB_KEY_dead_grave : constant := #16#fe50; -- XKB_KEY_dead_acute : constant := #16#fe51; -- XKB_KEY_dead_circumflex : constant := #16#fe52; -- XKB_KEY_dead_tilde : constant := #16#fe53; -- XKB_KEY_dead_perispomeni : constant := #16#fe53; -- XKB_KEY_dead_macron : constant := #16#fe54; -- XKB_KEY_dead_breve : constant := #16#fe55; -- XKB_KEY_dead_abovedot : constant := #16#fe56; -- XKB_KEY_dead_diaeresis : constant := #16#fe57; -- XKB_KEY_dead_abovering : constant := #16#fe58; -- XKB_KEY_dead_doubleacute : constant := #16#fe59; -- XKB_KEY_dead_caron : constant := #16#fe5a; -- XKB_KEY_dead_cedilla : constant := #16#fe5b; -- XKB_KEY_dead_ogonek : constant := #16#fe5c; -- XKB_KEY_dead_iota : constant := #16#fe5d; -- XKB_KEY_dead_voiced_sound : constant := #16#fe5e; -- XKB_KEY_dead_semivoiced_sound : constant := #16#fe5f; -- XKB_KEY_dead_belowdot : constant := #16#fe60; -- XKB_KEY_dead_hook : constant := #16#fe61; -- XKB_KEY_dead_horn : constant := #16#fe62; -- XKB_KEY_dead_stroke : constant := #16#fe63; -- XKB_KEY_dead_abovecomma : constant := #16#fe64; -- XKB_KEY_dead_psili : constant := #16#fe64; -- XKB_KEY_dead_abovereversedcomma : constant := #16#fe65; -- XKB_KEY_dead_dasia : constant := #16#fe65; -- XKB_KEY_dead_doublegrave : constant := #16#fe66; -- XKB_KEY_dead_belowring : constant := #16#fe67; -- XKB_KEY_dead_belowmacron : constant := #16#fe68; -- XKB_KEY_dead_belowcircumflex : constant := #16#fe69; -- XKB_KEY_dead_belowtilde : constant := #16#fe6a; -- XKB_KEY_dead_belowbreve : constant := #16#fe6b; -- XKB_KEY_dead_belowdiaeresis : constant := #16#fe6c; -- XKB_KEY_dead_invertedbreve : constant := #16#fe6d; -- XKB_KEY_dead_belowcomma : constant := #16#fe6e; -- XKB_KEY_dead_currency : constant := #16#fe6f; -- XKB_KEY_dead_lowline : constant := #16#fe90; -- XKB_KEY_dead_aboveverticalline : constant := #16#fe91; -- XKB_KEY_dead_belowverticalline : constant := #16#fe92; -- XKB_KEY_dead_longsolidusoverlay : constant := #16#fe93; -- XKB_KEY_dead_a : constant := #16#fe80; -- XKB_KEY_dead_A : constant := #16#fe81; -- XKB_KEY_dead_e : constant := #16#fe82; -- XKB_KEY_dead_E : constant := #16#fe83; -- XKB_KEY_dead_i : constant := #16#fe84; -- XKB_KEY_dead_I : constant := #16#fe85; -- XKB_KEY_dead_o : constant := #16#fe86; -- XKB_KEY_dead_O : constant := #16#fe87; -- XKB_KEY_dead_u : constant := #16#fe88; -- XKB_KEY_dead_U : constant := #16#fe89; -- XKB_KEY_dead_small_schwa : constant := #16#fe8a; -- XKB_KEY_dead_capital_schwa : constant := #16#fe8b; -- XKB_KEY_dead_greek : constant := #16#fe8c; -- XKB_KEY_First_Virtual_Screen : constant := #16#fed0; -- XKB_KEY_Prev_Virtual_Screen : constant := #16#fed1; -- XKB_KEY_Next_Virtual_Screen : constant := #16#fed2; -- XKB_KEY_Last_Virtual_Screen : constant := #16#fed4; -- XKB_KEY_Terminate_Server : constant := #16#fed5; -- XKB_KEY_AccessX_Enable : constant := #16#fe70; -- XKB_KEY_AccessX_Feedback_Enable : constant := #16#fe71; -- XKB_KEY_RepeatKeys_Enable : constant := #16#fe72; -- XKB_KEY_SlowKeys_Enable : constant := #16#fe73; -- XKB_KEY_BounceKeys_Enable : constant := #16#fe74; -- XKB_KEY_StickyKeys_Enable : constant := #16#fe75; -- XKB_KEY_MouseKeys_Enable : constant := #16#fe76; -- XKB_KEY_MouseKeys_Accel_Enable : constant := #16#fe77; -- XKB_KEY_Overlay1_Enable : constant := #16#fe78; -- XKB_KEY_Overlay2_Enable : constant := #16#fe79; -- XKB_KEY_AudibleBell_Enable : constant := #16#fe7a; -- XKB_KEY_Pointer_Left : constant := #16#fee0; -- XKB_KEY_Pointer_Right : constant := #16#fee1; -- XKB_KEY_Pointer_Up : constant := #16#fee2; -- XKB_KEY_Pointer_Down : constant := #16#fee3; -- XKB_KEY_Pointer_UpLeft : constant := #16#fee4; -- XKB_KEY_Pointer_UpRight : constant := #16#fee5; -- XKB_KEY_Pointer_DownLeft : constant := #16#fee6; -- XKB_KEY_Pointer_DownRight : constant := #16#fee7; -- XKB_KEY_Pointer_Button_Dflt : constant := #16#fee8; -- XKB_KEY_Pointer_Button1 : constant := #16#fee9; -- XKB_KEY_Pointer_Button2 : constant := #16#feea; -- XKB_KEY_Pointer_Button3 : constant := #16#feeb; -- XKB_KEY_Pointer_Button4 : constant := #16#feec; -- XKB_KEY_Pointer_Button5 : constant := #16#feed; -- XKB_KEY_Pointer_DblClick_Dflt : constant := #16#feee; -- XKB_KEY_Pointer_DblClick1 : constant := #16#feef; -- XKB_KEY_Pointer_DblClick2 : constant := #16#fef0; -- XKB_KEY_Pointer_DblClick3 : constant := #16#fef1; -- XKB_KEY_Pointer_DblClick4 : constant := #16#fef2; -- XKB_KEY_Pointer_DblClick5 : constant := #16#fef3; -- XKB_KEY_Pointer_Drag_Dflt : constant := #16#fef4; -- XKB_KEY_Pointer_Drag1 : constant := #16#fef5; -- XKB_KEY_Pointer_Drag2 : constant := #16#fef6; -- XKB_KEY_Pointer_Drag3 : constant := #16#fef7; -- XKB_KEY_Pointer_Drag4 : constant := #16#fef8; -- XKB_KEY_Pointer_Drag5 : constant := #16#fefd; -- XKB_KEY_Pointer_EnableKeys : constant := #16#fef9; -- XKB_KEY_Pointer_Accelerate : constant := #16#fefa; -- XKB_KEY_Pointer_DfltBtnNext : constant := #16#fefb; -- XKB_KEY_Pointer_DfltBtnPrev : constant := #16#fefc; -- XKB_KEY_ch : constant := #16#fea0; -- XKB_KEY_Ch : constant := #16#fea1; -- XKB_KEY_CH : constant := #16#fea2; -- XKB_KEY_c_h : constant := #16#fea3; -- XKB_KEY_C_h : constant := #16#fea4; -- XKB_KEY_C_H : constant := #16#fea5; -- XKB_KEY_3270_Duplicate : constant := #16#fd01; -- XKB_KEY_3270_FieldMark : constant := #16#fd02; -- XKB_KEY_3270_Right2 : constant := #16#fd03; -- XKB_KEY_3270_Left2 : constant := #16#fd04; -- XKB_KEY_3270_BackTab : constant := #16#fd05; -- XKB_KEY_3270_EraseEOF : constant := #16#fd06; -- XKB_KEY_3270_EraseInput : constant := #16#fd07; -- XKB_KEY_3270_Reset : constant := #16#fd08; -- XKB_KEY_3270_Quit : constant := #16#fd09; -- XKB_KEY_3270_PA1 : constant := #16#fd0a; -- XKB_KEY_3270_PA2 : constant := #16#fd0b; -- XKB_KEY_3270_PA3 : constant := #16#fd0c; -- XKB_KEY_3270_Test : constant := #16#fd0d; -- XKB_KEY_3270_Attn : constant := #16#fd0e; -- XKB_KEY_3270_CursorBlink : constant := #16#fd0f; -- XKB_KEY_3270_AltCursor : constant := #16#fd10; -- XKB_KEY_3270_KeyClick : constant := #16#fd11; -- XKB_KEY_3270_Jump : constant := #16#fd12; -- XKB_KEY_3270_Ident : constant := #16#fd13; -- XKB_KEY_3270_Rule : constant := #16#fd14; -- XKB_KEY_3270_Copy : constant := #16#fd15; -- XKB_KEY_3270_Play : constant := #16#fd16; -- XKB_KEY_3270_Setup : constant := #16#fd17; -- XKB_KEY_3270_Record : constant := #16#fd18; -- XKB_KEY_3270_ChangeScreen : constant := #16#fd19; -- XKB_KEY_3270_DeleteWord : constant := #16#fd1a; -- XKB_KEY_3270_ExSelect : constant := #16#fd1b; -- XKB_KEY_3270_CursorSelect : constant := #16#fd1c; -- XKB_KEY_3270_PrintScreen : constant := #16#fd1d; -- XKB_KEY_3270_Enter : constant := #16#fd1e; -- XKB_KEY_space : constant := #16#0020; -- XKB_KEY_exclam : constant := #16#0021; -- XKB_KEY_quotedbl : constant := #16#0022; -- XKB_KEY_numbersign : constant := #16#0023; -- XKB_KEY_dollar : constant := #16#0024; -- XKB_KEY_percent : constant := #16#0025; -- XKB_KEY_ampersand : constant := #16#0026; -- XKB_KEY_apostrophe : constant := #16#0027; -- XKB_KEY_quoteright : constant := #16#0027; -- XKB_KEY_parenleft : constant := #16#0028; -- XKB_KEY_parenright : constant := #16#0029; -- XKB_KEY_asterisk : constant := #16#002a; -- XKB_KEY_plus : constant := #16#002b; -- XKB_KEY_comma : constant := #16#002c; -- XKB_KEY_minus : constant := #16#002d; -- XKB_KEY_period : constant := #16#002e; -- XKB_KEY_slash : constant := #16#002f; -- XKB_KEY_0 : constant := #16#0030; -- XKB_KEY_1 : constant := #16#0031; -- XKB_KEY_2 : constant := #16#0032; -- XKB_KEY_3 : constant := #16#0033; -- XKB_KEY_4 : constant := #16#0034; -- XKB_KEY_5 : constant := #16#0035; -- XKB_KEY_6 : constant := #16#0036; -- XKB_KEY_7 : constant := #16#0037; -- XKB_KEY_8 : constant := #16#0038; -- XKB_KEY_9 : constant := #16#0039; -- XKB_KEY_colon : constant := #16#003a; -- XKB_KEY_semicolon : constant := #16#003b; -- XKB_KEY_less : constant := #16#003c; -- XKB_KEY_equal : constant := #16#003d; -- XKB_KEY_greater : constant := #16#003e; -- XKB_KEY_question : constant := #16#003f; -- XKB_KEY_at : constant := #16#0040; -- XKB_KEY_A : constant := #16#0041; -- XKB_KEY_B : constant := #16#0042; -- XKB_KEY_C : constant := #16#0043; -- XKB_KEY_D : constant := #16#0044; -- XKB_KEY_E : constant := #16#0045; -- XKB_KEY_F : constant := #16#0046; -- XKB_KEY_G : constant := #16#0047; -- XKB_KEY_H : constant := #16#0048; -- XKB_KEY_I : constant := #16#0049; -- XKB_KEY_J : constant := #16#004a; -- XKB_KEY_K : constant := #16#004b; -- XKB_KEY_L : constant := #16#004c; -- XKB_KEY_M : constant := #16#004d; -- XKB_KEY_N : constant := #16#004e; -- XKB_KEY_O : constant := #16#004f; -- XKB_KEY_P : constant := #16#0050; -- XKB_KEY_Q : constant := #16#0051; -- XKB_KEY_R : constant := #16#0052; -- XKB_KEY_S : constant := #16#0053; -- XKB_KEY_T : constant := #16#0054; -- XKB_KEY_U : constant := #16#0055; -- XKB_KEY_V : constant := #16#0056; -- XKB_KEY_W : constant := #16#0057; -- XKB_KEY_X : constant := #16#0058; -- XKB_KEY_Y : constant := #16#0059; -- XKB_KEY_Z : constant := #16#005a; -- XKB_KEY_bracketleft : constant := #16#005b; -- XKB_KEY_backslash : constant := #16#005c; -- XKB_KEY_bracketright : constant := #16#005d; -- XKB_KEY_asciicircum : constant := #16#005e; -- XKB_KEY_underscore : constant := #16#005f; -- XKB_KEY_grave : constant := #16#0060; -- XKB_KEY_quoteleft : constant := #16#0060; -- XKB_KEY_a : constant := #16#0061; -- XKB_KEY_b : constant := #16#0062; -- XKB_KEY_c : constant := #16#0063; -- XKB_KEY_d : constant := #16#0064; -- XKB_KEY_e : constant := #16#0065; -- XKB_KEY_f : constant := #16#0066; -- XKB_KEY_g : constant := #16#0067; -- XKB_KEY_h : constant := #16#0068; -- XKB_KEY_i : constant := #16#0069; -- XKB_KEY_j : constant := #16#006a; -- XKB_KEY_k : constant := #16#006b; -- XKB_KEY_l : constant := #16#006c; -- XKB_KEY_m : constant := #16#006d; -- XKB_KEY_n : constant := #16#006e; -- XKB_KEY_o : constant := #16#006f; -- XKB_KEY_p : constant := #16#0070; -- XKB_KEY_q : constant := #16#0071; -- XKB_KEY_r : constant := #16#0072; -- XKB_KEY_s : constant := #16#0073; -- XKB_KEY_t : constant := #16#0074; -- XKB_KEY_u : constant := #16#0075; -- XKB_KEY_v : constant := #16#0076; -- XKB_KEY_w : constant := #16#0077; -- XKB_KEY_x : constant := #16#0078; -- XKB_KEY_y : constant := #16#0079; -- XKB_KEY_z : constant := #16#007a; -- XKB_KEY_braceleft : constant := #16#007b; -- XKB_KEY_bar : constant := #16#007c; -- XKB_KEY_braceright : constant := #16#007d; -- XKB_KEY_asciitilde : constant := #16#007e; -- XKB_KEY_nobreakspace : constant := #16#00a0; -- XKB_KEY_exclamdown : constant := #16#00a1; -- XKB_KEY_cent : constant := #16#00a2; -- XKB_KEY_sterling : constant := #16#00a3; -- XKB_KEY_currency : constant := #16#00a4; -- XKB_KEY_yen : constant := #16#00a5; -- XKB_KEY_brokenbar : constant := #16#00a6; -- XKB_KEY_section : constant := #16#00a7; -- XKB_KEY_diaeresis : constant := #16#00a8; -- XKB_KEY_copyright : constant := #16#00a9; -- XKB_KEY_ordfeminine : constant := #16#00aa; -- XKB_KEY_guillemotleft : constant := #16#00ab; -- XKB_KEY_notsign : constant := #16#00ac; -- XKB_KEY_hyphen : constant := #16#00ad; -- XKB_KEY_registered : constant := #16#00ae; -- XKB_KEY_macron : constant := #16#00af; -- XKB_KEY_degree : constant := #16#00b0; -- XKB_KEY_plusminus : constant := #16#00b1; -- XKB_KEY_twosuperior : constant := #16#00b2; -- XKB_KEY_threesuperior : constant := #16#00b3; -- XKB_KEY_acute : constant := #16#00b4; -- XKB_KEY_mu : constant := #16#00b5; -- XKB_KEY_paragraph : constant := #16#00b6; -- XKB_KEY_periodcentered : constant := #16#00b7; -- XKB_KEY_cedilla : constant := #16#00b8; -- XKB_KEY_onesuperior : constant := #16#00b9; -- XKB_KEY_masculine : constant := #16#00ba; -- XKB_KEY_guillemotright : constant := #16#00bb; -- XKB_KEY_onequarter : constant := #16#00bc; -- XKB_KEY_onehalf : constant := #16#00bd; -- XKB_KEY_threequarters : constant := #16#00be; -- XKB_KEY_questiondown : constant := #16#00bf; -- XKB_KEY_Agrave : constant := #16#00c0; -- XKB_KEY_Aacute : constant := #16#00c1; -- XKB_KEY_Acircumflex : constant := #16#00c2; -- XKB_KEY_Atilde : constant := #16#00c3; -- XKB_KEY_Adiaeresis : constant := #16#00c4; -- XKB_KEY_Aring : constant := #16#00c5; -- XKB_KEY_AE : constant := #16#00c6; -- XKB_KEY_Ccedilla : constant := #16#00c7; -- XKB_KEY_Egrave : constant := #16#00c8; -- XKB_KEY_Eacute : constant := #16#00c9; -- XKB_KEY_Ecircumflex : constant := #16#00ca; -- XKB_KEY_Ediaeresis : constant := #16#00cb; -- XKB_KEY_Igrave : constant := #16#00cc; -- XKB_KEY_Iacute : constant := #16#00cd; -- XKB_KEY_Icircumflex : constant := #16#00ce; -- XKB_KEY_Idiaeresis : constant := #16#00cf; -- XKB_KEY_ETH : constant := #16#00d0; -- XKB_KEY_Eth : constant := #16#00d0; -- XKB_KEY_Ntilde : constant := #16#00d1; -- XKB_KEY_Ograve : constant := #16#00d2; -- XKB_KEY_Oacute : constant := #16#00d3; -- XKB_KEY_Ocircumflex : constant := #16#00d4; -- XKB_KEY_Otilde : constant := #16#00d5; -- XKB_KEY_Odiaeresis : constant := #16#00d6; -- XKB_KEY_multiply : constant := #16#00d7; -- XKB_KEY_Oslash : constant := #16#00d8; -- XKB_KEY_Ooblique : constant := #16#00d8; -- XKB_KEY_Ugrave : constant := #16#00d9; -- XKB_KEY_Uacute : constant := #16#00da; -- XKB_KEY_Ucircumflex : constant := #16#00db; -- XKB_KEY_Udiaeresis : constant := #16#00dc; -- XKB_KEY_Yacute : constant := #16#00dd; -- XKB_KEY_THORN : constant := #16#00de; -- XKB_KEY_Thorn : constant := #16#00de; -- XKB_KEY_ssharp : constant := #16#00df; -- XKB_KEY_agrave : constant := #16#00e0; -- XKB_KEY_aacute : constant := #16#00e1; -- XKB_KEY_acircumflex : constant := #16#00e2; -- XKB_KEY_atilde : constant := #16#00e3; -- XKB_KEY_adiaeresis : constant := #16#00e4; -- XKB_KEY_aring : constant := #16#00e5; -- XKB_KEY_ae : constant := #16#00e6; -- XKB_KEY_ccedilla : constant := #16#00e7; -- XKB_KEY_egrave : constant := #16#00e8; -- XKB_KEY_eacute : constant := #16#00e9; -- XKB_KEY_ecircumflex : constant := #16#00ea; -- XKB_KEY_ediaeresis : constant := #16#00eb; -- XKB_KEY_igrave : constant := #16#00ec; -- XKB_KEY_iacute : constant := #16#00ed; -- XKB_KEY_icircumflex : constant := #16#00ee; -- XKB_KEY_idiaeresis : constant := #16#00ef; -- XKB_KEY_eth : constant := #16#00f0; -- XKB_KEY_ntilde : constant := #16#00f1; -- XKB_KEY_ograve : constant := #16#00f2; -- XKB_KEY_oacute : constant := #16#00f3; -- XKB_KEY_ocircumflex : constant := #16#00f4; -- XKB_KEY_otilde : constant := #16#00f5; -- XKB_KEY_odiaeresis : constant := #16#00f6; -- XKB_KEY_division : constant := #16#00f7; -- XKB_KEY_oslash : constant := #16#00f8; -- XKB_KEY_ooblique : constant := #16#00f8; -- XKB_KEY_ugrave : constant := #16#00f9; -- XKB_KEY_uacute : constant := #16#00fa; -- XKB_KEY_ucircumflex : constant := #16#00fb; -- XKB_KEY_udiaeresis : constant := #16#00fc; -- XKB_KEY_yacute : constant := #16#00fd; -- XKB_KEY_thorn : constant := #16#00fe; -- XKB_KEY_ydiaeresis : constant := #16#00ff; -- XKB_KEY_Aogonek : constant := #16#01a1; -- XKB_KEY_breve : constant := #16#01a2; -- XKB_KEY_Lstroke : constant := #16#01a3; -- XKB_KEY_Lcaron : constant := #16#01a5; -- XKB_KEY_Sacute : constant := #16#01a6; -- XKB_KEY_Scaron : constant := #16#01a9; -- XKB_KEY_Scedilla : constant := #16#01aa; -- XKB_KEY_Tcaron : constant := #16#01ab; -- XKB_KEY_Zacute : constant := #16#01ac; -- XKB_KEY_Zcaron : constant := #16#01ae; -- XKB_KEY_Zabovedot : constant := #16#01af; -- XKB_KEY_aogonek : constant := #16#01b1; -- XKB_KEY_ogonek : constant := #16#01b2; -- XKB_KEY_lstroke : constant := #16#01b3; -- XKB_KEY_lcaron : constant := #16#01b5; -- XKB_KEY_sacute : constant := #16#01b6; -- XKB_KEY_caron : constant := #16#01b7; -- XKB_KEY_scaron : constant := #16#01b9; -- XKB_KEY_scedilla : constant := #16#01ba; -- XKB_KEY_tcaron : constant := #16#01bb; -- XKB_KEY_zacute : constant := #16#01bc; -- XKB_KEY_doubleacute : constant := #16#01bd; -- XKB_KEY_zcaron : constant := #16#01be; -- XKB_KEY_zabovedot : constant := #16#01bf; -- XKB_KEY_Racute : constant := #16#01c0; -- XKB_KEY_Abreve : constant := #16#01c3; -- XKB_KEY_Lacute : constant := #16#01c5; -- XKB_KEY_Cacute : constant := #16#01c6; -- XKB_KEY_Ccaron : constant := #16#01c8; -- XKB_KEY_Eogonek : constant := #16#01ca; -- XKB_KEY_Ecaron : constant := #16#01cc; -- XKB_KEY_Dcaron : constant := #16#01cf; -- XKB_KEY_Dstroke : constant := #16#01d0; -- XKB_KEY_Nacute : constant := #16#01d1; -- XKB_KEY_Ncaron : constant := #16#01d2; -- XKB_KEY_Odoubleacute : constant := #16#01d5; -- XKB_KEY_Rcaron : constant := #16#01d8; -- XKB_KEY_Uring : constant := #16#01d9; -- XKB_KEY_Udoubleacute : constant := #16#01db; -- XKB_KEY_Tcedilla : constant := #16#01de; -- XKB_KEY_racute : constant := #16#01e0; -- XKB_KEY_abreve : constant := #16#01e3; -- XKB_KEY_lacute : constant := #16#01e5; -- XKB_KEY_cacute : constant := #16#01e6; -- XKB_KEY_ccaron : constant := #16#01e8; -- XKB_KEY_eogonek : constant := #16#01ea; -- XKB_KEY_ecaron : constant := #16#01ec; -- XKB_KEY_dcaron : constant := #16#01ef; -- XKB_KEY_dstroke : constant := #16#01f0; -- XKB_KEY_nacute : constant := #16#01f1; -- XKB_KEY_ncaron : constant := #16#01f2; -- XKB_KEY_odoubleacute : constant := #16#01f5; -- XKB_KEY_rcaron : constant := #16#01f8; -- XKB_KEY_uring : constant := #16#01f9; -- XKB_KEY_udoubleacute : constant := #16#01fb; -- XKB_KEY_tcedilla : constant := #16#01fe; -- XKB_KEY_abovedot : constant := #16#01ff; -- XKB_KEY_Hstroke : constant := #16#02a1; -- XKB_KEY_Hcircumflex : constant := #16#02a6; -- XKB_KEY_Iabovedot : constant := #16#02a9; -- XKB_KEY_Gbreve : constant := #16#02ab; -- XKB_KEY_Jcircumflex : constant := #16#02ac; -- XKB_KEY_hstroke : constant := #16#02b1; -- XKB_KEY_hcircumflex : constant := #16#02b6; -- XKB_KEY_idotless : constant := #16#02b9; -- XKB_KEY_gbreve : constant := #16#02bb; -- XKB_KEY_jcircumflex : constant := #16#02bc; -- XKB_KEY_Cabovedot : constant := #16#02c5; -- XKB_KEY_Ccircumflex : constant := #16#02c6; -- XKB_KEY_Gabovedot : constant := #16#02d5; -- XKB_KEY_Gcircumflex : constant := #16#02d8; -- XKB_KEY_Ubreve : constant := #16#02dd; -- XKB_KEY_Scircumflex : constant := #16#02de; -- XKB_KEY_cabovedot : constant := #16#02e5; -- XKB_KEY_ccircumflex : constant := #16#02e6; -- XKB_KEY_gabovedot : constant := #16#02f5; -- XKB_KEY_gcircumflex : constant := #16#02f8; -- XKB_KEY_ubreve : constant := #16#02fd; -- XKB_KEY_scircumflex : constant := #16#02fe; -- XKB_KEY_kra : constant := #16#03a2; -- XKB_KEY_kappa : constant := #16#03a2; -- XKB_KEY_Rcedilla : constant := #16#03a3; -- XKB_KEY_Itilde : constant := #16#03a5; -- XKB_KEY_Lcedilla : constant := #16#03a6; -- XKB_KEY_Emacron : constant := #16#03aa; -- XKB_KEY_Gcedilla : constant := #16#03ab; -- XKB_KEY_Tslash : constant := #16#03ac; -- XKB_KEY_rcedilla : constant := #16#03b3; -- XKB_KEY_itilde : constant := #16#03b5; -- XKB_KEY_lcedilla : constant := #16#03b6; -- XKB_KEY_emacron : constant := #16#03ba; -- XKB_KEY_gcedilla : constant := #16#03bb; -- XKB_KEY_tslash : constant := #16#03bc; -- XKB_KEY_ENG : constant := #16#03bd; -- XKB_KEY_eng : constant := #16#03bf; -- XKB_KEY_Amacron : constant := #16#03c0; -- XKB_KEY_Iogonek : constant := #16#03c7; -- XKB_KEY_Eabovedot : constant := #16#03cc; -- XKB_KEY_Imacron : constant := #16#03cf; -- XKB_KEY_Ncedilla : constant := #16#03d1; -- XKB_KEY_Omacron : constant := #16#03d2; -- XKB_KEY_Kcedilla : constant := #16#03d3; -- XKB_KEY_Uogonek : constant := #16#03d9; -- XKB_KEY_Utilde : constant := #16#03dd; -- XKB_KEY_Umacron : constant := #16#03de; -- XKB_KEY_amacron : constant := #16#03e0; -- XKB_KEY_iogonek : constant := #16#03e7; -- XKB_KEY_eabovedot : constant := #16#03ec; -- XKB_KEY_imacron : constant := #16#03ef; -- XKB_KEY_ncedilla : constant := #16#03f1; -- XKB_KEY_omacron : constant := #16#03f2; -- XKB_KEY_kcedilla : constant := #16#03f3; -- XKB_KEY_uogonek : constant := #16#03f9; -- XKB_KEY_utilde : constant := #16#03fd; -- XKB_KEY_umacron : constant := #16#03fe; -- XKB_KEY_Wcircumflex : constant := #16#1000174; -- XKB_KEY_wcircumflex : constant := #16#1000175; -- XKB_KEY_Ycircumflex : constant := #16#1000176; -- XKB_KEY_ycircumflex : constant := #16#1000177; -- XKB_KEY_Babovedot : constant := #16#1001e02; -- XKB_KEY_babovedot : constant := #16#1001e03; -- XKB_KEY_Dabovedot : constant := #16#1001e0a; -- XKB_KEY_dabovedot : constant := #16#1001e0b; -- XKB_KEY_Fabovedot : constant := #16#1001e1e; -- XKB_KEY_fabovedot : constant := #16#1001e1f; -- XKB_KEY_Mabovedot : constant := #16#1001e40; -- XKB_KEY_mabovedot : constant := #16#1001e41; -- XKB_KEY_Pabovedot : constant := #16#1001e56; -- XKB_KEY_pabovedot : constant := #16#1001e57; -- XKB_KEY_Sabovedot : constant := #16#1001e60; -- XKB_KEY_sabovedot : constant := #16#1001e61; -- XKB_KEY_Tabovedot : constant := #16#1001e6a; -- XKB_KEY_tabovedot : constant := #16#1001e6b; -- XKB_KEY_Wgrave : constant := #16#1001e80; -- XKB_KEY_wgrave : constant := #16#1001e81; -- XKB_KEY_Wacute : constant := #16#1001e82; -- XKB_KEY_wacute : constant := #16#1001e83; -- XKB_KEY_Wdiaeresis : constant := #16#1001e84; -- XKB_KEY_wdiaeresis : constant := #16#1001e85; -- XKB_KEY_Ygrave : constant := #16#1001ef2; -- XKB_KEY_ygrave : constant := #16#1001ef3; -- XKB_KEY_OE : constant := #16#13bc; -- XKB_KEY_oe : constant := #16#13bd; -- XKB_KEY_Ydiaeresis : constant := #16#13be; -- XKB_KEY_overline : constant := #16#047e; -- XKB_KEY_kana_fullstop : constant := #16#04a1; -- XKB_KEY_kana_openingbracket : constant := #16#04a2; -- XKB_KEY_kana_closingbracket : constant := #16#04a3; -- XKB_KEY_kana_comma : constant := #16#04a4; -- XKB_KEY_kana_conjunctive : constant := #16#04a5; -- XKB_KEY_kana_middledot : constant := #16#04a5; -- XKB_KEY_kana_WO : constant := #16#04a6; -- XKB_KEY_kana_a : constant := #16#04a7; -- XKB_KEY_kana_i : constant := #16#04a8; -- XKB_KEY_kana_u : constant := #16#04a9; -- XKB_KEY_kana_e : constant := #16#04aa; -- XKB_KEY_kana_o : constant := #16#04ab; -- XKB_KEY_kana_ya : constant := #16#04ac; -- XKB_KEY_kana_yu : constant := #16#04ad; -- XKB_KEY_kana_yo : constant := #16#04ae; -- XKB_KEY_kana_tsu : constant := #16#04af; -- XKB_KEY_kana_tu : constant := #16#04af; -- XKB_KEY_prolongedsound : constant := #16#04b0; -- XKB_KEY_kana_A : constant := #16#04b1; -- XKB_KEY_kana_I : constant := #16#04b2; -- XKB_KEY_kana_U : constant := #16#04b3; -- XKB_KEY_kana_E : constant := #16#04b4; -- XKB_KEY_kana_O : constant := #16#04b5; -- XKB_KEY_kana_KA : constant := #16#04b6; -- XKB_KEY_kana_KI : constant := #16#04b7; -- XKB_KEY_kana_KU : constant := #16#04b8; -- XKB_KEY_kana_KE : constant := #16#04b9; -- XKB_KEY_kana_KO : constant := #16#04ba; -- XKB_KEY_kana_SA : constant := #16#04bb; -- XKB_KEY_kana_SHI : constant := #16#04bc; -- XKB_KEY_kana_SU : constant := #16#04bd; -- XKB_KEY_kana_SE : constant := #16#04be; -- XKB_KEY_kana_SO : constant := #16#04bf; -- XKB_KEY_kana_TA : constant := #16#04c0; -- XKB_KEY_kana_CHI : constant := #16#04c1; -- XKB_KEY_kana_TI : constant := #16#04c1; -- XKB_KEY_kana_TSU : constant := #16#04c2; -- XKB_KEY_kana_TU : constant := #16#04c2; -- XKB_KEY_kana_TE : constant := #16#04c3; -- XKB_KEY_kana_TO : constant := #16#04c4; -- XKB_KEY_kana_NA : constant := #16#04c5; -- XKB_KEY_kana_NI : constant := #16#04c6; -- XKB_KEY_kana_NU : constant := #16#04c7; -- XKB_KEY_kana_NE : constant := #16#04c8; -- XKB_KEY_kana_NO : constant := #16#04c9; -- XKB_KEY_kana_HA : constant := #16#04ca; -- XKB_KEY_kana_HI : constant := #16#04cb; -- XKB_KEY_kana_FU : constant := #16#04cc; -- XKB_KEY_kana_HU : constant := #16#04cc; -- XKB_KEY_kana_HE : constant := #16#04cd; -- XKB_KEY_kana_HO : constant := #16#04ce; -- XKB_KEY_kana_MA : constant := #16#04cf; -- XKB_KEY_kana_MI : constant := #16#04d0; -- XKB_KEY_kana_MU : constant := #16#04d1; -- XKB_KEY_kana_ME : constant := #16#04d2; -- XKB_KEY_kana_MO : constant := #16#04d3; -- XKB_KEY_kana_YA : constant := #16#04d4; -- XKB_KEY_kana_YU : constant := #16#04d5; -- XKB_KEY_kana_YO : constant := #16#04d6; -- XKB_KEY_kana_RA : constant := #16#04d7; -- XKB_KEY_kana_RI : constant := #16#04d8; -- XKB_KEY_kana_RU : constant := #16#04d9; -- XKB_KEY_kana_RE : constant := #16#04da; -- XKB_KEY_kana_RO : constant := #16#04db; -- XKB_KEY_kana_WA : constant := #16#04dc; -- XKB_KEY_kana_N : constant := #16#04dd; -- XKB_KEY_voicedsound : constant := #16#04de; -- XKB_KEY_semivoicedsound : constant := #16#04df; -- XKB_KEY_kana_switch : constant := #16#ff7e; -- XKB_KEY_Farsi_0 : constant := #16#10006f0; -- XKB_KEY_Farsi_1 : constant := #16#10006f1; -- XKB_KEY_Farsi_2 : constant := #16#10006f2; -- XKB_KEY_Farsi_3 : constant := #16#10006f3; -- XKB_KEY_Farsi_4 : constant := #16#10006f4; -- XKB_KEY_Farsi_5 : constant := #16#10006f5; -- XKB_KEY_Farsi_6 : constant := #16#10006f6; -- XKB_KEY_Farsi_7 : constant := #16#10006f7; -- XKB_KEY_Farsi_8 : constant := #16#10006f8; -- XKB_KEY_Farsi_9 : constant := #16#10006f9; -- XKB_KEY_Arabic_percent : constant := #16#100066a; -- XKB_KEY_Arabic_superscript_alef : constant := #16#1000670; -- XKB_KEY_Arabic_tteh : constant := #16#1000679; -- XKB_KEY_Arabic_peh : constant := #16#100067e; -- XKB_KEY_Arabic_tcheh : constant := #16#1000686; -- XKB_KEY_Arabic_ddal : constant := #16#1000688; -- XKB_KEY_Arabic_rreh : constant := #16#1000691; -- XKB_KEY_Arabic_comma : constant := #16#05ac; -- XKB_KEY_Arabic_fullstop : constant := #16#10006d4; -- XKB_KEY_Arabic_0 : constant := #16#1000660; -- XKB_KEY_Arabic_1 : constant := #16#1000661; -- XKB_KEY_Arabic_2 : constant := #16#1000662; -- XKB_KEY_Arabic_3 : constant := #16#1000663; -- XKB_KEY_Arabic_4 : constant := #16#1000664; -- XKB_KEY_Arabic_5 : constant := #16#1000665; -- XKB_KEY_Arabic_6 : constant := #16#1000666; -- XKB_KEY_Arabic_7 : constant := #16#1000667; -- XKB_KEY_Arabic_8 : constant := #16#1000668; -- XKB_KEY_Arabic_9 : constant := #16#1000669; -- XKB_KEY_Arabic_semicolon : constant := #16#05bb; -- XKB_KEY_Arabic_question_mark : constant := #16#05bf; -- XKB_KEY_Arabic_hamza : constant := #16#05c1; -- XKB_KEY_Arabic_maddaonalef : constant := #16#05c2; -- XKB_KEY_Arabic_hamzaonalef : constant := #16#05c3; -- XKB_KEY_Arabic_hamzaonwaw : constant := #16#05c4; -- XKB_KEY_Arabic_hamzaunderalef : constant := #16#05c5; -- XKB_KEY_Arabic_hamzaonyeh : constant := #16#05c6; -- XKB_KEY_Arabic_alef : constant := #16#05c7; -- XKB_KEY_Arabic_beh : constant := #16#05c8; -- XKB_KEY_Arabic_tehmarbuta : constant := #16#05c9; -- XKB_KEY_Arabic_teh : constant := #16#05ca; -- XKB_KEY_Arabic_theh : constant := #16#05cb; -- XKB_KEY_Arabic_jeem : constant := #16#05cc; -- XKB_KEY_Arabic_hah : constant := #16#05cd; -- XKB_KEY_Arabic_khah : constant := #16#05ce; -- XKB_KEY_Arabic_dal : constant := #16#05cf; -- XKB_KEY_Arabic_thal : constant := #16#05d0; -- XKB_KEY_Arabic_ra : constant := #16#05d1; -- XKB_KEY_Arabic_zain : constant := #16#05d2; -- XKB_KEY_Arabic_seen : constant := #16#05d3; -- XKB_KEY_Arabic_sheen : constant := #16#05d4; -- XKB_KEY_Arabic_sad : constant := #16#05d5; -- XKB_KEY_Arabic_dad : constant := #16#05d6; -- XKB_KEY_Arabic_tah : constant := #16#05d7; -- XKB_KEY_Arabic_zah : constant := #16#05d8; -- XKB_KEY_Arabic_ain : constant := #16#05d9; -- XKB_KEY_Arabic_ghain : constant := #16#05da; -- XKB_KEY_Arabic_tatweel : constant := #16#05e0; -- XKB_KEY_Arabic_feh : constant := #16#05e1; -- XKB_KEY_Arabic_qaf : constant := #16#05e2; -- XKB_KEY_Arabic_kaf : constant := #16#05e3; -- XKB_KEY_Arabic_lam : constant := #16#05e4; -- XKB_KEY_Arabic_meem : constant := #16#05e5; -- XKB_KEY_Arabic_noon : constant := #16#05e6; -- XKB_KEY_Arabic_ha : constant := #16#05e7; -- XKB_KEY_Arabic_heh : constant := #16#05e7; -- XKB_KEY_Arabic_waw : constant := #16#05e8; -- XKB_KEY_Arabic_alefmaksura : constant := #16#05e9; -- XKB_KEY_Arabic_yeh : constant := #16#05ea; -- XKB_KEY_Arabic_fathatan : constant := #16#05eb; -- XKB_KEY_Arabic_dammatan : constant := #16#05ec; -- XKB_KEY_Arabic_kasratan : constant := #16#05ed; -- XKB_KEY_Arabic_fatha : constant := #16#05ee; -- XKB_KEY_Arabic_damma : constant := #16#05ef; -- XKB_KEY_Arabic_kasra : constant := #16#05f0; -- XKB_KEY_Arabic_shadda : constant := #16#05f1; -- XKB_KEY_Arabic_sukun : constant := #16#05f2; -- XKB_KEY_Arabic_madda_above : constant := #16#1000653; -- XKB_KEY_Arabic_hamza_above : constant := #16#1000654; -- XKB_KEY_Arabic_hamza_below : constant := #16#1000655; -- XKB_KEY_Arabic_jeh : constant := #16#1000698; -- XKB_KEY_Arabic_veh : constant := #16#10006a4; -- XKB_KEY_Arabic_keheh : constant := #16#10006a9; -- XKB_KEY_Arabic_gaf : constant := #16#10006af; -- XKB_KEY_Arabic_noon_ghunna : constant := #16#10006ba; -- XKB_KEY_Arabic_heh_doachashmee : constant := #16#10006be; -- XKB_KEY_Farsi_yeh : constant := #16#10006cc; -- XKB_KEY_Arabic_farsi_yeh : constant := #16#10006cc; -- XKB_KEY_Arabic_yeh_baree : constant := #16#10006d2; -- XKB_KEY_Arabic_heh_goal : constant := #16#10006c1; -- XKB_KEY_Arabic_switch : constant := #16#ff7e; -- XKB_KEY_Cyrillic_GHE_bar : constant := #16#1000492; -- XKB_KEY_Cyrillic_ghe_bar : constant := #16#1000493; -- XKB_KEY_Cyrillic_ZHE_descender : constant := #16#1000496; -- XKB_KEY_Cyrillic_zhe_descender : constant := #16#1000497; -- XKB_KEY_Cyrillic_KA_descender : constant := #16#100049a; -- XKB_KEY_Cyrillic_ka_descender : constant := #16#100049b; -- XKB_KEY_Cyrillic_KA_vertstroke : constant := #16#100049c; -- XKB_KEY_Cyrillic_ka_vertstroke : constant := #16#100049d; -- XKB_KEY_Cyrillic_EN_descender : constant := #16#10004a2; -- XKB_KEY_Cyrillic_en_descender : constant := #16#10004a3; -- XKB_KEY_Cyrillic_U_straight : constant := #16#10004ae; -- XKB_KEY_Cyrillic_u_straight : constant := #16#10004af; -- XKB_KEY_Cyrillic_U_straight_bar : constant := #16#10004b0; -- XKB_KEY_Cyrillic_u_straight_bar : constant := #16#10004b1; -- XKB_KEY_Cyrillic_HA_descender : constant := #16#10004b2; -- XKB_KEY_Cyrillic_ha_descender : constant := #16#10004b3; -- XKB_KEY_Cyrillic_CHE_descender : constant := #16#10004b6; -- XKB_KEY_Cyrillic_che_descender : constant := #16#10004b7; -- XKB_KEY_Cyrillic_CHE_vertstroke : constant := #16#10004b8; -- XKB_KEY_Cyrillic_che_vertstroke : constant := #16#10004b9; -- XKB_KEY_Cyrillic_SHHA : constant := #16#10004ba; -- XKB_KEY_Cyrillic_shha : constant := #16#10004bb; -- XKB_KEY_Cyrillic_SCHWA : constant := #16#10004d8; -- XKB_KEY_Cyrillic_schwa : constant := #16#10004d9; -- XKB_KEY_Cyrillic_I_macron : constant := #16#10004e2; -- XKB_KEY_Cyrillic_i_macron : constant := #16#10004e3; -- XKB_KEY_Cyrillic_O_bar : constant := #16#10004e8; -- XKB_KEY_Cyrillic_o_bar : constant := #16#10004e9; -- XKB_KEY_Cyrillic_U_macron : constant := #16#10004ee; -- XKB_KEY_Cyrillic_u_macron : constant := #16#10004ef; -- XKB_KEY_Serbian_dje : constant := #16#06a1; -- XKB_KEY_Macedonia_gje : constant := #16#06a2; -- XKB_KEY_Cyrillic_io : constant := #16#06a3; -- XKB_KEY_Ukrainian_ie : constant := #16#06a4; -- XKB_KEY_Ukranian_je : constant := #16#06a4; -- XKB_KEY_Macedonia_dse : constant := #16#06a5; -- XKB_KEY_Ukrainian_i : constant := #16#06a6; -- XKB_KEY_Ukranian_i : constant := #16#06a6; -- XKB_KEY_Ukrainian_yi : constant := #16#06a7; -- XKB_KEY_Ukranian_yi : constant := #16#06a7; -- XKB_KEY_Cyrillic_je : constant := #16#06a8; -- XKB_KEY_Serbian_je : constant := #16#06a8; -- XKB_KEY_Cyrillic_lje : constant := #16#06a9; -- XKB_KEY_Serbian_lje : constant := #16#06a9; -- XKB_KEY_Cyrillic_nje : constant := #16#06aa; -- XKB_KEY_Serbian_nje : constant := #16#06aa; -- XKB_KEY_Serbian_tshe : constant := #16#06ab; -- XKB_KEY_Macedonia_kje : constant := #16#06ac; -- XKB_KEY_Ukrainian_ghe_with_upturn : constant := #16#06ad; -- XKB_KEY_Byelorussian_shortu : constant := #16#06ae; -- XKB_KEY_Cyrillic_dzhe : constant := #16#06af; -- XKB_KEY_Serbian_dze : constant := #16#06af; -- XKB_KEY_numerosign : constant := #16#06b0; -- XKB_KEY_Serbian_DJE : constant := #16#06b1; -- XKB_KEY_Macedonia_GJE : constant := #16#06b2; -- XKB_KEY_Cyrillic_IO : constant := #16#06b3; -- XKB_KEY_Ukrainian_IE : constant := #16#06b4; -- XKB_KEY_Ukranian_JE : constant := #16#06b4; -- XKB_KEY_Macedonia_DSE : constant := #16#06b5; -- XKB_KEY_Ukrainian_I : constant := #16#06b6; -- XKB_KEY_Ukranian_I : constant := #16#06b6; -- XKB_KEY_Ukrainian_YI : constant := #16#06b7; -- XKB_KEY_Ukranian_YI : constant := #16#06b7; -- XKB_KEY_Cyrillic_JE : constant := #16#06b8; -- XKB_KEY_Serbian_JE : constant := #16#06b8; -- XKB_KEY_Cyrillic_LJE : constant := #16#06b9; -- XKB_KEY_Serbian_LJE : constant := #16#06b9; -- XKB_KEY_Cyrillic_NJE : constant := #16#06ba; -- XKB_KEY_Serbian_NJE : constant := #16#06ba; -- XKB_KEY_Serbian_TSHE : constant := #16#06bb; -- XKB_KEY_Macedonia_KJE : constant := #16#06bc; -- XKB_KEY_Ukrainian_GHE_WITH_UPTURN : constant := #16#06bd; -- XKB_KEY_Byelorussian_SHORTU : constant := #16#06be; -- XKB_KEY_Cyrillic_DZHE : constant := #16#06bf; -- XKB_KEY_Serbian_DZE : constant := #16#06bf; -- XKB_KEY_Cyrillic_yu : constant := #16#06c0; -- XKB_KEY_Cyrillic_a : constant := #16#06c1; -- XKB_KEY_Cyrillic_be : constant := #16#06c2; -- XKB_KEY_Cyrillic_tse : constant := #16#06c3; -- XKB_KEY_Cyrillic_de : constant := #16#06c4; -- XKB_KEY_Cyrillic_ie : constant := #16#06c5; -- XKB_KEY_Cyrillic_ef : constant := #16#06c6; -- XKB_KEY_Cyrillic_ghe : constant := #16#06c7; -- XKB_KEY_Cyrillic_ha : constant := #16#06c8; -- XKB_KEY_Cyrillic_i : constant := #16#06c9; -- XKB_KEY_Cyrillic_shorti : constant := #16#06ca; -- XKB_KEY_Cyrillic_ka : constant := #16#06cb; -- XKB_KEY_Cyrillic_el : constant := #16#06cc; -- XKB_KEY_Cyrillic_em : constant := #16#06cd; -- XKB_KEY_Cyrillic_en : constant := #16#06ce; -- XKB_KEY_Cyrillic_o : constant := #16#06cf; -- XKB_KEY_Cyrillic_pe : constant := #16#06d0; -- XKB_KEY_Cyrillic_ya : constant := #16#06d1; -- XKB_KEY_Cyrillic_er : constant := #16#06d2; -- XKB_KEY_Cyrillic_es : constant := #16#06d3; -- XKB_KEY_Cyrillic_te : constant := #16#06d4; -- XKB_KEY_Cyrillic_u : constant := #16#06d5; -- XKB_KEY_Cyrillic_zhe : constant := #16#06d6; -- XKB_KEY_Cyrillic_ve : constant := #16#06d7; -- XKB_KEY_Cyrillic_softsign : constant := #16#06d8; -- XKB_KEY_Cyrillic_yeru : constant := #16#06d9; -- XKB_KEY_Cyrillic_ze : constant := #16#06da; -- XKB_KEY_Cyrillic_sha : constant := #16#06db; -- XKB_KEY_Cyrillic_e : constant := #16#06dc; -- XKB_KEY_Cyrillic_shcha : constant := #16#06dd; -- XKB_KEY_Cyrillic_che : constant := #16#06de; -- XKB_KEY_Cyrillic_hardsign : constant := #16#06df; -- XKB_KEY_Cyrillic_YU : constant := #16#06e0; -- XKB_KEY_Cyrillic_A : constant := #16#06e1; -- XKB_KEY_Cyrillic_BE : constant := #16#06e2; -- XKB_KEY_Cyrillic_TSE : constant := #16#06e3; -- XKB_KEY_Cyrillic_DE : constant := #16#06e4; -- XKB_KEY_Cyrillic_IE : constant := #16#06e5; -- XKB_KEY_Cyrillic_EF : constant := #16#06e6; -- XKB_KEY_Cyrillic_GHE : constant := #16#06e7; -- XKB_KEY_Cyrillic_HA : constant := #16#06e8; -- XKB_KEY_Cyrillic_I : constant := #16#06e9; -- XKB_KEY_Cyrillic_SHORTI : constant := #16#06ea; -- XKB_KEY_Cyrillic_KA : constant := #16#06eb; -- XKB_KEY_Cyrillic_EL : constant := #16#06ec; -- XKB_KEY_Cyrillic_EM : constant := #16#06ed; -- XKB_KEY_Cyrillic_EN : constant := #16#06ee; -- XKB_KEY_Cyrillic_O : constant := #16#06ef; -- XKB_KEY_Cyrillic_PE : constant := #16#06f0; -- XKB_KEY_Cyrillic_YA : constant := #16#06f1; -- XKB_KEY_Cyrillic_ER : constant := #16#06f2; -- XKB_KEY_Cyrillic_ES : constant := #16#06f3; -- XKB_KEY_Cyrillic_TE : constant := #16#06f4; -- XKB_KEY_Cyrillic_U : constant := #16#06f5; -- XKB_KEY_Cyrillic_ZHE : constant := #16#06f6; -- XKB_KEY_Cyrillic_VE : constant := #16#06f7; -- XKB_KEY_Cyrillic_SOFTSIGN : constant := #16#06f8; -- XKB_KEY_Cyrillic_YERU : constant := #16#06f9; -- XKB_KEY_Cyrillic_ZE : constant := #16#06fa; -- XKB_KEY_Cyrillic_SHA : constant := #16#06fb; -- XKB_KEY_Cyrillic_E : constant := #16#06fc; -- XKB_KEY_Cyrillic_SHCHA : constant := #16#06fd; -- XKB_KEY_Cyrillic_CHE : constant := #16#06fe; -- XKB_KEY_Cyrillic_HARDSIGN : constant := #16#06ff; -- XKB_KEY_Greek_ALPHAaccent : constant := #16#07a1; -- XKB_KEY_Greek_EPSILONaccent : constant := #16#07a2; -- XKB_KEY_Greek_ETAaccent : constant := #16#07a3; -- XKB_KEY_Greek_IOTAaccent : constant := #16#07a4; -- XKB_KEY_Greek_IOTAdieresis : constant := #16#07a5; -- XKB_KEY_Greek_IOTAdiaeresis : constant := #16#07a5; -- XKB_KEY_Greek_OMICRONaccent : constant := #16#07a7; -- XKB_KEY_Greek_UPSILONaccent : constant := #16#07a8; -- XKB_KEY_Greek_UPSILONdieresis : constant := #16#07a9; -- XKB_KEY_Greek_OMEGAaccent : constant := #16#07ab; -- XKB_KEY_Greek_accentdieresis : constant := #16#07ae; -- XKB_KEY_Greek_horizbar : constant := #16#07af; -- XKB_KEY_Greek_alphaaccent : constant := #16#07b1; -- XKB_KEY_Greek_epsilonaccent : constant := #16#07b2; -- XKB_KEY_Greek_etaaccent : constant := #16#07b3; -- XKB_KEY_Greek_iotaaccent : constant := #16#07b4; -- XKB_KEY_Greek_iotadieresis : constant := #16#07b5; -- XKB_KEY_Greek_iotaaccentdieresis : constant := #16#07b6; -- XKB_KEY_Greek_omicronaccent : constant := #16#07b7; -- XKB_KEY_Greek_upsilonaccent : constant := #16#07b8; -- XKB_KEY_Greek_upsilondieresis : constant := #16#07b9; -- XKB_KEY_Greek_upsilonaccentdieresis : constant := #16#07ba; -- XKB_KEY_Greek_omegaaccent : constant := #16#07bb; -- XKB_KEY_Greek_ALPHA : constant := #16#07c1; -- XKB_KEY_Greek_BETA : constant := #16#07c2; -- XKB_KEY_Greek_GAMMA : constant := #16#07c3; -- XKB_KEY_Greek_DELTA : constant := #16#07c4; -- XKB_KEY_Greek_EPSILON : constant := #16#07c5; -- XKB_KEY_Greek_ZETA : constant := #16#07c6; -- XKB_KEY_Greek_ETA : constant := #16#07c7; -- XKB_KEY_Greek_THETA : constant := #16#07c8; -- XKB_KEY_Greek_IOTA : constant := #16#07c9; -- XKB_KEY_Greek_KAPPA : constant := #16#07ca; -- XKB_KEY_Greek_LAMDA : constant := #16#07cb; -- XKB_KEY_Greek_LAMBDA : constant := #16#07cb; -- XKB_KEY_Greek_MU : constant := #16#07cc; -- XKB_KEY_Greek_NU : constant := #16#07cd; -- XKB_KEY_Greek_XI : constant := #16#07ce; -- XKB_KEY_Greek_OMICRON : constant := #16#07cf; -- XKB_KEY_Greek_PI : constant := #16#07d0; -- XKB_KEY_Greek_RHO : constant := #16#07d1; -- XKB_KEY_Greek_SIGMA : constant := #16#07d2; -- XKB_KEY_Greek_TAU : constant := #16#07d4; -- XKB_KEY_Greek_UPSILON : constant := #16#07d5; -- XKB_KEY_Greek_PHI : constant := #16#07d6; -- XKB_KEY_Greek_CHI : constant := #16#07d7; -- XKB_KEY_Greek_PSI : constant := #16#07d8; -- XKB_KEY_Greek_OMEGA : constant := #16#07d9; -- XKB_KEY_Greek_alpha : constant := #16#07e1; -- XKB_KEY_Greek_beta : constant := #16#07e2; -- XKB_KEY_Greek_gamma : constant := #16#07e3; -- XKB_KEY_Greek_delta : constant := #16#07e4; -- XKB_KEY_Greek_epsilon : constant := #16#07e5; -- XKB_KEY_Greek_zeta : constant := #16#07e6; -- XKB_KEY_Greek_eta : constant := #16#07e7; -- XKB_KEY_Greek_theta : constant := #16#07e8; -- XKB_KEY_Greek_iota : constant := #16#07e9; -- XKB_KEY_Greek_kappa : constant := #16#07ea; -- XKB_KEY_Greek_lamda : constant := #16#07eb; -- XKB_KEY_Greek_lambda : constant := #16#07eb; -- XKB_KEY_Greek_mu : constant := #16#07ec; -- XKB_KEY_Greek_nu : constant := #16#07ed; -- XKB_KEY_Greek_xi : constant := #16#07ee; -- XKB_KEY_Greek_omicron : constant := #16#07ef; -- XKB_KEY_Greek_pi : constant := #16#07f0; -- XKB_KEY_Greek_rho : constant := #16#07f1; -- XKB_KEY_Greek_sigma : constant := #16#07f2; -- XKB_KEY_Greek_finalsmallsigma : constant := #16#07f3; -- XKB_KEY_Greek_tau : constant := #16#07f4; -- XKB_KEY_Greek_upsilon : constant := #16#07f5; -- XKB_KEY_Greek_phi : constant := #16#07f6; -- XKB_KEY_Greek_chi : constant := #16#07f7; -- XKB_KEY_Greek_psi : constant := #16#07f8; -- XKB_KEY_Greek_omega : constant := #16#07f9; -- XKB_KEY_Greek_switch : constant := #16#ff7e; -- XKB_KEY_leftradical : constant := #16#08a1; -- XKB_KEY_topleftradical : constant := #16#08a2; -- XKB_KEY_horizconnector : constant := #16#08a3; -- XKB_KEY_topintegral : constant := #16#08a4; -- XKB_KEY_botintegral : constant := #16#08a5; -- XKB_KEY_vertconnector : constant := #16#08a6; -- XKB_KEY_topleftsqbracket : constant := #16#08a7; -- XKB_KEY_botleftsqbracket : constant := #16#08a8; -- XKB_KEY_toprightsqbracket : constant := #16#08a9; -- XKB_KEY_botrightsqbracket : constant := #16#08aa; -- XKB_KEY_topleftparens : constant := #16#08ab; -- XKB_KEY_botleftparens : constant := #16#08ac; -- XKB_KEY_toprightparens : constant := #16#08ad; -- XKB_KEY_botrightparens : constant := #16#08ae; -- XKB_KEY_leftmiddlecurlybrace : constant := #16#08af; -- XKB_KEY_rightmiddlecurlybrace : constant := #16#08b0; -- XKB_KEY_topleftsummation : constant := #16#08b1; -- XKB_KEY_botleftsummation : constant := #16#08b2; -- XKB_KEY_topvertsummationconnector : constant := #16#08b3; -- XKB_KEY_botvertsummationconnector : constant := #16#08b4; -- XKB_KEY_toprightsummation : constant := #16#08b5; -- XKB_KEY_botrightsummation : constant := #16#08b6; -- XKB_KEY_rightmiddlesummation : constant := #16#08b7; -- XKB_KEY_lessthanequal : constant := #16#08bc; -- XKB_KEY_notequal : constant := #16#08bd; -- XKB_KEY_greaterthanequal : constant := #16#08be; -- XKB_KEY_integral : constant := #16#08bf; -- XKB_KEY_therefore : constant := #16#08c0; -- XKB_KEY_variation : constant := #16#08c1; -- XKB_KEY_infinity : constant := #16#08c2; -- XKB_KEY_nabla : constant := #16#08c5; -- XKB_KEY_approximate : constant := #16#08c8; -- XKB_KEY_similarequal : constant := #16#08c9; -- XKB_KEY_ifonlyif : constant := #16#08cd; -- XKB_KEY_implies : constant := #16#08ce; -- XKB_KEY_identical : constant := #16#08cf; -- XKB_KEY_radical : constant := #16#08d6; -- XKB_KEY_includedin : constant := #16#08da; -- XKB_KEY_includes : constant := #16#08db; -- XKB_KEY_intersection : constant := #16#08dc; -- XKB_KEY_union : constant := #16#08dd; -- XKB_KEY_logicaland : constant := #16#08de; -- XKB_KEY_logicalor : constant := #16#08df; -- XKB_KEY_partialderivative : constant := #16#08ef; -- XKB_KEY_function : constant := #16#08f6; -- XKB_KEY_leftarrow : constant := #16#08fb; -- XKB_KEY_uparrow : constant := #16#08fc; -- XKB_KEY_rightarrow : constant := #16#08fd; -- XKB_KEY_downarrow : constant := #16#08fe; -- XKB_KEY_blank : constant := #16#09df; -- XKB_KEY_soliddiamond : constant := #16#09e0; -- XKB_KEY_checkerboard : constant := #16#09e1; -- XKB_KEY_ht : constant := #16#09e2; -- XKB_KEY_ff : constant := #16#09e3; -- XKB_KEY_cr : constant := #16#09e4; -- XKB_KEY_lf : constant := #16#09e5; -- XKB_KEY_nl : constant := #16#09e8; -- XKB_KEY_vt : constant := #16#09e9; -- XKB_KEY_lowrightcorner : constant := #16#09ea; -- XKB_KEY_uprightcorner : constant := #16#09eb; -- XKB_KEY_upleftcorner : constant := #16#09ec; -- XKB_KEY_lowleftcorner : constant := #16#09ed; -- XKB_KEY_crossinglines : constant := #16#09ee; -- XKB_KEY_horizlinescan1 : constant := #16#09ef; -- XKB_KEY_horizlinescan3 : constant := #16#09f0; -- XKB_KEY_horizlinescan5 : constant := #16#09f1; -- XKB_KEY_horizlinescan7 : constant := #16#09f2; -- XKB_KEY_horizlinescan9 : constant := #16#09f3; -- XKB_KEY_leftt : constant := #16#09f4; -- XKB_KEY_rightt : constant := #16#09f5; -- XKB_KEY_bott : constant := #16#09f6; -- XKB_KEY_topt : constant := #16#09f7; -- XKB_KEY_vertbar : constant := #16#09f8; -- XKB_KEY_emspace : constant := #16#0aa1; -- XKB_KEY_enspace : constant := #16#0aa2; -- XKB_KEY_em3space : constant := #16#0aa3; -- XKB_KEY_em4space : constant := #16#0aa4; -- XKB_KEY_digitspace : constant := #16#0aa5; -- XKB_KEY_punctspace : constant := #16#0aa6; -- XKB_KEY_thinspace : constant := #16#0aa7; -- XKB_KEY_hairspace : constant := #16#0aa8; -- XKB_KEY_emdash : constant := #16#0aa9; -- XKB_KEY_endash : constant := #16#0aaa; -- XKB_KEY_signifblank : constant := #16#0aac; -- XKB_KEY_ellipsis : constant := #16#0aae; -- XKB_KEY_doubbaselinedot : constant := #16#0aaf; -- XKB_KEY_onethird : constant := #16#0ab0; -- XKB_KEY_twothirds : constant := #16#0ab1; -- XKB_KEY_onefifth : constant := #16#0ab2; -- XKB_KEY_twofifths : constant := #16#0ab3; -- XKB_KEY_threefifths : constant := #16#0ab4; -- XKB_KEY_fourfifths : constant := #16#0ab5; -- XKB_KEY_onesixth : constant := #16#0ab6; -- XKB_KEY_fivesixths : constant := #16#0ab7; -- XKB_KEY_careof : constant := #16#0ab8; -- XKB_KEY_figdash : constant := #16#0abb; -- XKB_KEY_leftanglebracket : constant := #16#0abc; -- XKB_KEY_decimalpoint : constant := #16#0abd; -- XKB_KEY_rightanglebracket : constant := #16#0abe; -- XKB_KEY_marker : constant := #16#0abf; -- XKB_KEY_oneeighth : constant := #16#0ac3; -- XKB_KEY_threeeighths : constant := #16#0ac4; -- XKB_KEY_fiveeighths : constant := #16#0ac5; -- XKB_KEY_seveneighths : constant := #16#0ac6; -- XKB_KEY_trademark : constant := #16#0ac9; -- XKB_KEY_signaturemark : constant := #16#0aca; -- XKB_KEY_trademarkincircle : constant := #16#0acb; -- XKB_KEY_leftopentriangle : constant := #16#0acc; -- XKB_KEY_rightopentriangle : constant := #16#0acd; -- XKB_KEY_emopencircle : constant := #16#0ace; -- XKB_KEY_emopenrectangle : constant := #16#0acf; -- XKB_KEY_leftsinglequotemark : constant := #16#0ad0; -- XKB_KEY_rightsinglequotemark : constant := #16#0ad1; -- XKB_KEY_leftdoublequotemark : constant := #16#0ad2; -- XKB_KEY_rightdoublequotemark : constant := #16#0ad3; -- XKB_KEY_prescription : constant := #16#0ad4; -- XKB_KEY_permille : constant := #16#0ad5; -- XKB_KEY_minutes : constant := #16#0ad6; -- XKB_KEY_seconds : constant := #16#0ad7; -- XKB_KEY_latincross : constant := #16#0ad9; -- XKB_KEY_hexagram : constant := #16#0ada; -- XKB_KEY_filledrectbullet : constant := #16#0adb; -- XKB_KEY_filledlefttribullet : constant := #16#0adc; -- XKB_KEY_filledrighttribullet : constant := #16#0add; -- XKB_KEY_emfilledcircle : constant := #16#0ade; -- XKB_KEY_emfilledrect : constant := #16#0adf; -- XKB_KEY_enopencircbullet : constant := #16#0ae0; -- XKB_KEY_enopensquarebullet : constant := #16#0ae1; -- XKB_KEY_openrectbullet : constant := #16#0ae2; -- XKB_KEY_opentribulletup : constant := #16#0ae3; -- XKB_KEY_opentribulletdown : constant := #16#0ae4; -- XKB_KEY_openstar : constant := #16#0ae5; -- XKB_KEY_enfilledcircbullet : constant := #16#0ae6; -- XKB_KEY_enfilledsqbullet : constant := #16#0ae7; -- XKB_KEY_filledtribulletup : constant := #16#0ae8; -- XKB_KEY_filledtribulletdown : constant := #16#0ae9; -- XKB_KEY_leftpointer : constant := #16#0aea; -- XKB_KEY_rightpointer : constant := #16#0aeb; -- XKB_KEY_club : constant := #16#0aec; -- XKB_KEY_diamond : constant := #16#0aed; -- XKB_KEY_heart : constant := #16#0aee; -- XKB_KEY_maltesecross : constant := #16#0af0; -- XKB_KEY_dagger : constant := #16#0af1; -- XKB_KEY_doubledagger : constant := #16#0af2; -- XKB_KEY_checkmark : constant := #16#0af3; -- XKB_KEY_ballotcross : constant := #16#0af4; -- XKB_KEY_musicalsharp : constant := #16#0af5; -- XKB_KEY_musicalflat : constant := #16#0af6; -- XKB_KEY_malesymbol : constant := #16#0af7; -- XKB_KEY_femalesymbol : constant := #16#0af8; -- XKB_KEY_telephone : constant := #16#0af9; -- XKB_KEY_telephonerecorder : constant := #16#0afa; -- XKB_KEY_phonographcopyright : constant := #16#0afb; -- XKB_KEY_caret : constant := #16#0afc; -- XKB_KEY_singlelowquotemark : constant := #16#0afd; -- XKB_KEY_doublelowquotemark : constant := #16#0afe; -- XKB_KEY_cursor : constant := #16#0aff; -- XKB_KEY_leftcaret : constant := #16#0ba3; -- XKB_KEY_rightcaret : constant := #16#0ba6; -- XKB_KEY_downcaret : constant := #16#0ba8; -- XKB_KEY_upcaret : constant := #16#0ba9; -- XKB_KEY_overbar : constant := #16#0bc0; -- XKB_KEY_downtack : constant := #16#0bc2; -- XKB_KEY_upshoe : constant := #16#0bc3; -- XKB_KEY_downstile : constant := #16#0bc4; -- XKB_KEY_underbar : constant := #16#0bc6; -- XKB_KEY_jot : constant := #16#0bca; -- XKB_KEY_quad : constant := #16#0bcc; -- XKB_KEY_uptack : constant := #16#0bce; -- XKB_KEY_circle : constant := #16#0bcf; -- XKB_KEY_upstile : constant := #16#0bd3; -- XKB_KEY_downshoe : constant := #16#0bd6; -- XKB_KEY_rightshoe : constant := #16#0bd8; -- XKB_KEY_leftshoe : constant := #16#0bda; -- XKB_KEY_lefttack : constant := #16#0bdc; -- XKB_KEY_righttack : constant := #16#0bfc; -- XKB_KEY_hebrew_doublelowline : constant := #16#0cdf; -- XKB_KEY_hebrew_aleph : constant := #16#0ce0; -- XKB_KEY_hebrew_bet : constant := #16#0ce1; -- XKB_KEY_hebrew_beth : constant := #16#0ce1; -- XKB_KEY_hebrew_gimel : constant := #16#0ce2; -- XKB_KEY_hebrew_gimmel : constant := #16#0ce2; -- XKB_KEY_hebrew_dalet : constant := #16#0ce3; -- XKB_KEY_hebrew_daleth : constant := #16#0ce3; -- XKB_KEY_hebrew_he : constant := #16#0ce4; -- XKB_KEY_hebrew_waw : constant := #16#0ce5; -- XKB_KEY_hebrew_zain : constant := #16#0ce6; -- XKB_KEY_hebrew_zayin : constant := #16#0ce6; -- XKB_KEY_hebrew_chet : constant := #16#0ce7; -- XKB_KEY_hebrew_het : constant := #16#0ce7; -- XKB_KEY_hebrew_tet : constant := #16#0ce8; -- XKB_KEY_hebrew_teth : constant := #16#0ce8; -- XKB_KEY_hebrew_yod : constant := #16#0ce9; -- XKB_KEY_hebrew_finalkaph : constant := #16#0cea; -- XKB_KEY_hebrew_kaph : constant := #16#0ceb; -- XKB_KEY_hebrew_lamed : constant := #16#0cec; -- XKB_KEY_hebrew_finalmem : constant := #16#0ced; -- XKB_KEY_hebrew_mem : constant := #16#0cee; -- XKB_KEY_hebrew_finalnun : constant := #16#0cef; -- XKB_KEY_hebrew_nun : constant := #16#0cf0; -- XKB_KEY_hebrew_samech : constant := #16#0cf1; -- XKB_KEY_hebrew_samekh : constant := #16#0cf1; -- XKB_KEY_hebrew_ayin : constant := #16#0cf2; -- XKB_KEY_hebrew_finalpe : constant := #16#0cf3; -- XKB_KEY_hebrew_pe : constant := #16#0cf4; -- XKB_KEY_hebrew_finalzade : constant := #16#0cf5; -- XKB_KEY_hebrew_finalzadi : constant := #16#0cf5; -- XKB_KEY_hebrew_zade : constant := #16#0cf6; -- XKB_KEY_hebrew_zadi : constant := #16#0cf6; -- XKB_KEY_hebrew_qoph : constant := #16#0cf7; -- XKB_KEY_hebrew_kuf : constant := #16#0cf7; -- XKB_KEY_hebrew_resh : constant := #16#0cf8; -- XKB_KEY_hebrew_shin : constant := #16#0cf9; -- XKB_KEY_hebrew_taw : constant := #16#0cfa; -- XKB_KEY_hebrew_taf : constant := #16#0cfa; -- XKB_KEY_Hebrew_switch : constant := #16#ff7e; -- XKB_KEY_Thai_kokai : constant := #16#0da1; -- XKB_KEY_Thai_khokhai : constant := #16#0da2; -- XKB_KEY_Thai_khokhuat : constant := #16#0da3; -- XKB_KEY_Thai_khokhwai : constant := #16#0da4; -- XKB_KEY_Thai_khokhon : constant := #16#0da5; -- XKB_KEY_Thai_khorakhang : constant := #16#0da6; -- XKB_KEY_Thai_ngongu : constant := #16#0da7; -- XKB_KEY_Thai_chochan : constant := #16#0da8; -- XKB_KEY_Thai_choching : constant := #16#0da9; -- XKB_KEY_Thai_chochang : constant := #16#0daa; -- XKB_KEY_Thai_soso : constant := #16#0dab; -- XKB_KEY_Thai_chochoe : constant := #16#0dac; -- XKB_KEY_Thai_yoying : constant := #16#0dad; -- XKB_KEY_Thai_dochada : constant := #16#0dae; -- XKB_KEY_Thai_topatak : constant := #16#0daf; -- XKB_KEY_Thai_thothan : constant := #16#0db0; -- XKB_KEY_Thai_thonangmontho : constant := #16#0db1; -- XKB_KEY_Thai_thophuthao : constant := #16#0db2; -- XKB_KEY_Thai_nonen : constant := #16#0db3; -- XKB_KEY_Thai_dodek : constant := #16#0db4; -- XKB_KEY_Thai_totao : constant := #16#0db5; -- XKB_KEY_Thai_thothung : constant := #16#0db6; -- XKB_KEY_Thai_thothahan : constant := #16#0db7; -- XKB_KEY_Thai_thothong : constant := #16#0db8; -- XKB_KEY_Thai_nonu : constant := #16#0db9; -- XKB_KEY_Thai_bobaimai : constant := #16#0dba; -- XKB_KEY_Thai_popla : constant := #16#0dbb; -- XKB_KEY_Thai_phophung : constant := #16#0dbc; -- XKB_KEY_Thai_fofa : constant := #16#0dbd; -- XKB_KEY_Thai_phophan : constant := #16#0dbe; -- XKB_KEY_Thai_fofan : constant := #16#0dbf; -- XKB_KEY_Thai_phosamphao : constant := #16#0dc0; -- XKB_KEY_Thai_moma : constant := #16#0dc1; -- XKB_KEY_Thai_yoyak : constant := #16#0dc2; -- XKB_KEY_Thai_rorua : constant := #16#0dc3; -- XKB_KEY_Thai_ru : constant := #16#0dc4; -- XKB_KEY_Thai_loling : constant := #16#0dc5; -- XKB_KEY_Thai_lu : constant := #16#0dc6; -- XKB_KEY_Thai_wowaen : constant := #16#0dc7; -- XKB_KEY_Thai_sosala : constant := #16#0dc8; -- XKB_KEY_Thai_sorusi : constant := #16#0dc9; -- XKB_KEY_Thai_sosua : constant := #16#0dca; -- XKB_KEY_Thai_hohip : constant := #16#0dcb; -- XKB_KEY_Thai_lochula : constant := #16#0dcc; -- XKB_KEY_Thai_oang : constant := #16#0dcd; -- XKB_KEY_Thai_honokhuk : constant := #16#0dce; -- XKB_KEY_Thai_paiyannoi : constant := #16#0dcf; -- XKB_KEY_Thai_saraa : constant := #16#0dd0; -- XKB_KEY_Thai_maihanakat : constant := #16#0dd1; -- XKB_KEY_Thai_saraaa : constant := #16#0dd2; -- XKB_KEY_Thai_saraam : constant := #16#0dd3; -- XKB_KEY_Thai_sarai : constant := #16#0dd4; -- XKB_KEY_Thai_saraii : constant := #16#0dd5; -- XKB_KEY_Thai_saraue : constant := #16#0dd6; -- XKB_KEY_Thai_sarauee : constant := #16#0dd7; -- XKB_KEY_Thai_sarau : constant := #16#0dd8; -- XKB_KEY_Thai_sarauu : constant := #16#0dd9; -- XKB_KEY_Thai_phinthu : constant := #16#0dda; -- XKB_KEY_Thai_maihanakat_maitho : constant := #16#0dde; -- XKB_KEY_Thai_baht : constant := #16#0ddf; -- XKB_KEY_Thai_sarae : constant := #16#0de0; -- XKB_KEY_Thai_saraae : constant := #16#0de1; -- XKB_KEY_Thai_sarao : constant := #16#0de2; -- XKB_KEY_Thai_saraaimaimuan : constant := #16#0de3; -- XKB_KEY_Thai_saraaimaimalai : constant := #16#0de4; -- XKB_KEY_Thai_lakkhangyao : constant := #16#0de5; -- XKB_KEY_Thai_maiyamok : constant := #16#0de6; -- XKB_KEY_Thai_maitaikhu : constant := #16#0de7; -- XKB_KEY_Thai_maiek : constant := #16#0de8; -- XKB_KEY_Thai_maitho : constant := #16#0de9; -- XKB_KEY_Thai_maitri : constant := #16#0dea; -- XKB_KEY_Thai_maichattawa : constant := #16#0deb; -- XKB_KEY_Thai_thanthakhat : constant := #16#0dec; -- XKB_KEY_Thai_nikhahit : constant := #16#0ded; -- XKB_KEY_Thai_leksun : constant := #16#0df0; -- XKB_KEY_Thai_leknung : constant := #16#0df1; -- XKB_KEY_Thai_leksong : constant := #16#0df2; -- XKB_KEY_Thai_leksam : constant := #16#0df3; -- XKB_KEY_Thai_leksi : constant := #16#0df4; -- XKB_KEY_Thai_lekha : constant := #16#0df5; -- XKB_KEY_Thai_lekhok : constant := #16#0df6; -- XKB_KEY_Thai_lekchet : constant := #16#0df7; -- XKB_KEY_Thai_lekpaet : constant := #16#0df8; -- XKB_KEY_Thai_lekkao : constant := #16#0df9; -- XKB_KEY_Hangul : constant := #16#ff31; -- XKB_KEY_Hangul_Start : constant := #16#ff32; -- XKB_KEY_Hangul_End : constant := #16#ff33; -- XKB_KEY_Hangul_Hanja : constant := #16#ff34; -- XKB_KEY_Hangul_Jamo : constant := #16#ff35; -- XKB_KEY_Hangul_Romaja : constant := #16#ff36; -- XKB_KEY_Hangul_Codeinput : constant := #16#ff37; -- XKB_KEY_Hangul_Jeonja : constant := #16#ff38; -- XKB_KEY_Hangul_Banja : constant := #16#ff39; -- XKB_KEY_Hangul_PreHanja : constant := #16#ff3a; -- XKB_KEY_Hangul_PostHanja : constant := #16#ff3b; -- XKB_KEY_Hangul_SingleCandidate : constant := #16#ff3c; -- XKB_KEY_Hangul_MultipleCandidate : constant := #16#ff3d; -- XKB_KEY_Hangul_PreviousCandidate : constant := #16#ff3e; -- XKB_KEY_Hangul_Special : constant := #16#ff3f; -- XKB_KEY_Hangul_switch : constant := #16#ff7e; -- XKB_KEY_Hangul_Kiyeog : constant := #16#0ea1; -- XKB_KEY_Hangul_SsangKiyeog : constant := #16#0ea2; -- XKB_KEY_Hangul_KiyeogSios : constant := #16#0ea3; -- XKB_KEY_Hangul_Nieun : constant := #16#0ea4; -- XKB_KEY_Hangul_NieunJieuj : constant := #16#0ea5; -- XKB_KEY_Hangul_NieunHieuh : constant := #16#0ea6; -- XKB_KEY_Hangul_Dikeud : constant := #16#0ea7; -- XKB_KEY_Hangul_SsangDikeud : constant := #16#0ea8; -- XKB_KEY_Hangul_Rieul : constant := #16#0ea9; -- XKB_KEY_Hangul_RieulKiyeog : constant := #16#0eaa; -- XKB_KEY_Hangul_RieulMieum : constant := #16#0eab; -- XKB_KEY_Hangul_RieulPieub : constant := #16#0eac; -- XKB_KEY_Hangul_RieulSios : constant := #16#0ead; -- XKB_KEY_Hangul_RieulTieut : constant := #16#0eae; -- XKB_KEY_Hangul_RieulPhieuf : constant := #16#0eaf; -- XKB_KEY_Hangul_RieulHieuh : constant := #16#0eb0; -- XKB_KEY_Hangul_Mieum : constant := #16#0eb1; -- XKB_KEY_Hangul_Pieub : constant := #16#0eb2; -- XKB_KEY_Hangul_SsangPieub : constant := #16#0eb3; -- XKB_KEY_Hangul_PieubSios : constant := #16#0eb4; -- XKB_KEY_Hangul_Sios : constant := #16#0eb5; -- XKB_KEY_Hangul_SsangSios : constant := #16#0eb6; -- XKB_KEY_Hangul_Ieung : constant := #16#0eb7; -- XKB_KEY_Hangul_Jieuj : constant := #16#0eb8; -- XKB_KEY_Hangul_SsangJieuj : constant := #16#0eb9; -- XKB_KEY_Hangul_Cieuc : constant := #16#0eba; -- XKB_KEY_Hangul_Khieuq : constant := #16#0ebb; -- XKB_KEY_Hangul_Tieut : constant := #16#0ebc; -- XKB_KEY_Hangul_Phieuf : constant := #16#0ebd; -- XKB_KEY_Hangul_Hieuh : constant := #16#0ebe; -- XKB_KEY_Hangul_A : constant := #16#0ebf; -- XKB_KEY_Hangul_AE : constant := #16#0ec0; -- XKB_KEY_Hangul_YA : constant := #16#0ec1; -- XKB_KEY_Hangul_YAE : constant := #16#0ec2; -- XKB_KEY_Hangul_EO : constant := #16#0ec3; -- XKB_KEY_Hangul_E : constant := #16#0ec4; -- XKB_KEY_Hangul_YEO : constant := #16#0ec5; -- XKB_KEY_Hangul_YE : constant := #16#0ec6; -- XKB_KEY_Hangul_O : constant := #16#0ec7; -- XKB_KEY_Hangul_WA : constant := #16#0ec8; -- XKB_KEY_Hangul_WAE : constant := #16#0ec9; -- XKB_KEY_Hangul_OE : constant := #16#0eca; -- XKB_KEY_Hangul_YO : constant := #16#0ecb; -- XKB_KEY_Hangul_U : constant := #16#0ecc; -- XKB_KEY_Hangul_WEO : constant := #16#0ecd; -- XKB_KEY_Hangul_WE : constant := #16#0ece; -- XKB_KEY_Hangul_WI : constant := #16#0ecf; -- XKB_KEY_Hangul_YU : constant := #16#0ed0; -- XKB_KEY_Hangul_EU : constant := #16#0ed1; -- XKB_KEY_Hangul_YI : constant := #16#0ed2; -- XKB_KEY_Hangul_I : constant := #16#0ed3; -- XKB_KEY_Hangul_J_Kiyeog : constant := #16#0ed4; -- XKB_KEY_Hangul_J_SsangKiyeog : constant := #16#0ed5; -- XKB_KEY_Hangul_J_KiyeogSios : constant := #16#0ed6; -- XKB_KEY_Hangul_J_Nieun : constant := #16#0ed7; -- XKB_KEY_Hangul_J_NieunJieuj : constant := #16#0ed8; -- XKB_KEY_Hangul_J_NieunHieuh : constant := #16#0ed9; -- XKB_KEY_Hangul_J_Dikeud : constant := #16#0eda; -- XKB_KEY_Hangul_J_Rieul : constant := #16#0edb; -- XKB_KEY_Hangul_J_RieulKiyeog : constant := #16#0edc; -- XKB_KEY_Hangul_J_RieulMieum : constant := #16#0edd; -- XKB_KEY_Hangul_J_RieulPieub : constant := #16#0ede; -- XKB_KEY_Hangul_J_RieulSios : constant := #16#0edf; -- XKB_KEY_Hangul_J_RieulTieut : constant := #16#0ee0; -- XKB_KEY_Hangul_J_RieulPhieuf : constant := #16#0ee1; -- XKB_KEY_Hangul_J_RieulHieuh : constant := #16#0ee2; -- XKB_KEY_Hangul_J_Mieum : constant := #16#0ee3; -- XKB_KEY_Hangul_J_Pieub : constant := #16#0ee4; -- XKB_KEY_Hangul_J_PieubSios : constant := #16#0ee5; -- XKB_KEY_Hangul_J_Sios : constant := #16#0ee6; -- XKB_KEY_Hangul_J_SsangSios : constant := #16#0ee7; -- XKB_KEY_Hangul_J_Ieung : constant := #16#0ee8; -- XKB_KEY_Hangul_J_Jieuj : constant := #16#0ee9; -- XKB_KEY_Hangul_J_Cieuc : constant := #16#0eea; -- XKB_KEY_Hangul_J_Khieuq : constant := #16#0eeb; -- XKB_KEY_Hangul_J_Tieut : constant := #16#0eec; -- XKB_KEY_Hangul_J_Phieuf : constant := #16#0eed; -- XKB_KEY_Hangul_J_Hieuh : constant := #16#0eee; -- XKB_KEY_Hangul_RieulYeorinHieuh : constant := #16#0eef; -- XKB_KEY_Hangul_SunkyeongeumMieum : constant := #16#0ef0; -- XKB_KEY_Hangul_SunkyeongeumPieub : constant := #16#0ef1; -- XKB_KEY_Hangul_PanSios : constant := #16#0ef2; -- XKB_KEY_Hangul_KkogjiDalrinIeung : constant := #16#0ef3; -- XKB_KEY_Hangul_SunkyeongeumPhieuf : constant := #16#0ef4; -- XKB_KEY_Hangul_YeorinHieuh : constant := #16#0ef5; -- XKB_KEY_Hangul_AraeA : constant := #16#0ef6; -- XKB_KEY_Hangul_AraeAE : constant := #16#0ef7; -- XKB_KEY_Hangul_J_PanSios : constant := #16#0ef8; -- XKB_KEY_Hangul_J_KkogjiDalrinIeung : constant := #16#0ef9; -- XKB_KEY_Hangul_J_YeorinHieuh : constant := #16#0efa; -- XKB_KEY_Korean_Won : constant := #16#0eff; -- XKB_KEY_Armenian_ligature_ew : constant := #16#1000587; -- XKB_KEY_Armenian_full_stop : constant := #16#1000589; -- XKB_KEY_Armenian_verjaket : constant := #16#1000589; -- XKB_KEY_Armenian_separation_mark : constant := #16#100055d; -- XKB_KEY_Armenian_but : constant := #16#100055d; -- XKB_KEY_Armenian_hyphen : constant := #16#100058a; -- XKB_KEY_Armenian_yentamna : constant := #16#100058a; -- XKB_KEY_Armenian_exclam : constant := #16#100055c; -- XKB_KEY_Armenian_amanak : constant := #16#100055c; -- XKB_KEY_Armenian_accent : constant := #16#100055b; -- XKB_KEY_Armenian_shesht : constant := #16#100055b; -- XKB_KEY_Armenian_question : constant := #16#100055e; -- XKB_KEY_Armenian_paruyk : constant := #16#100055e; -- XKB_KEY_Armenian_AYB : constant := #16#1000531; -- XKB_KEY_Armenian_ayb : constant := #16#1000561; -- XKB_KEY_Armenian_BEN : constant := #16#1000532; -- XKB_KEY_Armenian_ben : constant := #16#1000562; -- XKB_KEY_Armenian_GIM : constant := #16#1000533; -- XKB_KEY_Armenian_gim : constant := #16#1000563; -- XKB_KEY_Armenian_DA : constant := #16#1000534; -- XKB_KEY_Armenian_da : constant := #16#1000564; -- XKB_KEY_Armenian_YECH : constant := #16#1000535; -- XKB_KEY_Armenian_yech : constant := #16#1000565; -- XKB_KEY_Armenian_ZA : constant := #16#1000536; -- XKB_KEY_Armenian_za : constant := #16#1000566; -- XKB_KEY_Armenian_E : constant := #16#1000537; -- XKB_KEY_Armenian_e : constant := #16#1000567; -- XKB_KEY_Armenian_AT : constant := #16#1000538; -- XKB_KEY_Armenian_at : constant := #16#1000568; -- XKB_KEY_Armenian_TO : constant := #16#1000539; -- XKB_KEY_Armenian_to : constant := #16#1000569; -- XKB_KEY_Armenian_ZHE : constant := #16#100053a; -- XKB_KEY_Armenian_zhe : constant := #16#100056a; -- XKB_KEY_Armenian_INI : constant := #16#100053b; -- XKB_KEY_Armenian_ini : constant := #16#100056b; -- XKB_KEY_Armenian_LYUN : constant := #16#100053c; -- XKB_KEY_Armenian_lyun : constant := #16#100056c; -- XKB_KEY_Armenian_KHE : constant := #16#100053d; -- XKB_KEY_Armenian_khe : constant := #16#100056d; -- XKB_KEY_Armenian_TSA : constant := #16#100053e; -- XKB_KEY_Armenian_tsa : constant := #16#100056e; -- XKB_KEY_Armenian_KEN : constant := #16#100053f; -- XKB_KEY_Armenian_ken : constant := #16#100056f; -- XKB_KEY_Armenian_HO : constant := #16#1000540; -- XKB_KEY_Armenian_ho : constant := #16#1000570; -- XKB_KEY_Armenian_DZA : constant := #16#1000541; -- XKB_KEY_Armenian_dza : constant := #16#1000571; -- XKB_KEY_Armenian_GHAT : constant := #16#1000542; -- XKB_KEY_Armenian_ghat : constant := #16#1000572; -- XKB_KEY_Armenian_TCHE : constant := #16#1000543; -- XKB_KEY_Armenian_tche : constant := #16#1000573; -- XKB_KEY_Armenian_MEN : constant := #16#1000544; -- XKB_KEY_Armenian_men : constant := #16#1000574; -- XKB_KEY_Armenian_HI : constant := #16#1000545; -- XKB_KEY_Armenian_hi : constant := #16#1000575; -- XKB_KEY_Armenian_NU : constant := #16#1000546; -- XKB_KEY_Armenian_nu : constant := #16#1000576; -- XKB_KEY_Armenian_SHA : constant := #16#1000547; -- XKB_KEY_Armenian_sha : constant := #16#1000577; -- XKB_KEY_Armenian_VO : constant := #16#1000548; -- XKB_KEY_Armenian_vo : constant := #16#1000578; -- XKB_KEY_Armenian_CHA : constant := #16#1000549; -- XKB_KEY_Armenian_cha : constant := #16#1000579; -- XKB_KEY_Armenian_PE : constant := #16#100054a; -- XKB_KEY_Armenian_pe : constant := #16#100057a; -- XKB_KEY_Armenian_JE : constant := #16#100054b; -- XKB_KEY_Armenian_je : constant := #16#100057b; -- XKB_KEY_Armenian_RA : constant := #16#100054c; -- XKB_KEY_Armenian_ra : constant := #16#100057c; -- XKB_KEY_Armenian_SE : constant := #16#100054d; -- XKB_KEY_Armenian_se : constant := #16#100057d; -- XKB_KEY_Armenian_VEV : constant := #16#100054e; -- XKB_KEY_Armenian_vev : constant := #16#100057e; -- XKB_KEY_Armenian_TYUN : constant := #16#100054f; -- XKB_KEY_Armenian_tyun : constant := #16#100057f; -- XKB_KEY_Armenian_RE : constant := #16#1000550; -- XKB_KEY_Armenian_re : constant := #16#1000580; -- XKB_KEY_Armenian_TSO : constant := #16#1000551; -- XKB_KEY_Armenian_tso : constant := #16#1000581; -- XKB_KEY_Armenian_VYUN : constant := #16#1000552; -- XKB_KEY_Armenian_vyun : constant := #16#1000582; -- XKB_KEY_Armenian_PYUR : constant := #16#1000553; -- XKB_KEY_Armenian_pyur : constant := #16#1000583; -- XKB_KEY_Armenian_KE : constant := #16#1000554; -- XKB_KEY_Armenian_ke : constant := #16#1000584; -- XKB_KEY_Armenian_O : constant := #16#1000555; -- XKB_KEY_Armenian_o : constant := #16#1000585; -- XKB_KEY_Armenian_FE : constant := #16#1000556; -- XKB_KEY_Armenian_fe : constant := #16#1000586; -- XKB_KEY_Armenian_apostrophe : constant := #16#100055a; -- XKB_KEY_Georgian_an : constant := #16#10010d0; -- XKB_KEY_Georgian_ban : constant := #16#10010d1; -- XKB_KEY_Georgian_gan : constant := #16#10010d2; -- XKB_KEY_Georgian_don : constant := #16#10010d3; -- XKB_KEY_Georgian_en : constant := #16#10010d4; -- XKB_KEY_Georgian_vin : constant := #16#10010d5; -- XKB_KEY_Georgian_zen : constant := #16#10010d6; -- XKB_KEY_Georgian_tan : constant := #16#10010d7; -- XKB_KEY_Georgian_in : constant := #16#10010d8; -- XKB_KEY_Georgian_kan : constant := #16#10010d9; -- XKB_KEY_Georgian_las : constant := #16#10010da; -- XKB_KEY_Georgian_man : constant := #16#10010db; -- XKB_KEY_Georgian_nar : constant := #16#10010dc; -- XKB_KEY_Georgian_on : constant := #16#10010dd; -- XKB_KEY_Georgian_par : constant := #16#10010de; -- XKB_KEY_Georgian_zhar : constant := #16#10010df; -- XKB_KEY_Georgian_rae : constant := #16#10010e0; -- XKB_KEY_Georgian_san : constant := #16#10010e1; -- XKB_KEY_Georgian_tar : constant := #16#10010e2; -- XKB_KEY_Georgian_un : constant := #16#10010e3; -- XKB_KEY_Georgian_phar : constant := #16#10010e4; -- XKB_KEY_Georgian_khar : constant := #16#10010e5; -- XKB_KEY_Georgian_ghan : constant := #16#10010e6; -- XKB_KEY_Georgian_qar : constant := #16#10010e7; -- XKB_KEY_Georgian_shin : constant := #16#10010e8; -- XKB_KEY_Georgian_chin : constant := #16#10010e9; -- XKB_KEY_Georgian_can : constant := #16#10010ea; -- XKB_KEY_Georgian_jil : constant := #16#10010eb; -- XKB_KEY_Georgian_cil : constant := #16#10010ec; -- XKB_KEY_Georgian_char : constant := #16#10010ed; -- XKB_KEY_Georgian_xan : constant := #16#10010ee; -- XKB_KEY_Georgian_jhan : constant := #16#10010ef; -- XKB_KEY_Georgian_hae : constant := #16#10010f0; -- XKB_KEY_Georgian_he : constant := #16#10010f1; -- XKB_KEY_Georgian_hie : constant := #16#10010f2; -- XKB_KEY_Georgian_we : constant := #16#10010f3; -- XKB_KEY_Georgian_har : constant := #16#10010f4; -- XKB_KEY_Georgian_hoe : constant := #16#10010f5; -- XKB_KEY_Georgian_fi : constant := #16#10010f6; -- XKB_KEY_Xabovedot : constant := #16#1001e8a; -- XKB_KEY_Ibreve : constant := #16#100012c; -- XKB_KEY_Zstroke : constant := #16#10001b5; -- XKB_KEY_Gcaron : constant := #16#10001e6; -- XKB_KEY_Ocaron : constant := #16#10001d1; -- XKB_KEY_Obarred : constant := #16#100019f; -- XKB_KEY_xabovedot : constant := #16#1001e8b; -- XKB_KEY_ibreve : constant := #16#100012d; -- XKB_KEY_zstroke : constant := #16#10001b6; -- XKB_KEY_gcaron : constant := #16#10001e7; -- XKB_KEY_ocaron : constant := #16#10001d2; -- XKB_KEY_obarred : constant := #16#1000275; -- XKB_KEY_SCHWA : constant := #16#100018f; -- XKB_KEY_schwa : constant := #16#1000259; -- XKB_KEY_EZH : constant := #16#10001b7; -- XKB_KEY_ezh : constant := #16#1000292; -- XKB_KEY_Lbelowdot : constant := #16#1001e36; -- XKB_KEY_lbelowdot : constant := #16#1001e37; -- XKB_KEY_Abelowdot : constant := #16#1001ea0; -- XKB_KEY_abelowdot : constant := #16#1001ea1; -- XKB_KEY_Ahook : constant := #16#1001ea2; -- XKB_KEY_ahook : constant := #16#1001ea3; -- XKB_KEY_Acircumflexacute : constant := #16#1001ea4; -- XKB_KEY_acircumflexacute : constant := #16#1001ea5; -- XKB_KEY_Acircumflexgrave : constant := #16#1001ea6; -- XKB_KEY_acircumflexgrave : constant := #16#1001ea7; -- XKB_KEY_Acircumflexhook : constant := #16#1001ea8; -- XKB_KEY_acircumflexhook : constant := #16#1001ea9; -- XKB_KEY_Acircumflextilde : constant := #16#1001eaa; -- XKB_KEY_acircumflextilde : constant := #16#1001eab; -- XKB_KEY_Acircumflexbelowdot : constant := #16#1001eac; -- XKB_KEY_acircumflexbelowdot : constant := #16#1001ead; -- XKB_KEY_Abreveacute : constant := #16#1001eae; -- XKB_KEY_abreveacute : constant := #16#1001eaf; -- XKB_KEY_Abrevegrave : constant := #16#1001eb0; -- XKB_KEY_abrevegrave : constant := #16#1001eb1; -- XKB_KEY_Abrevehook : constant := #16#1001eb2; -- XKB_KEY_abrevehook : constant := #16#1001eb3; -- XKB_KEY_Abrevetilde : constant := #16#1001eb4; -- XKB_KEY_abrevetilde : constant := #16#1001eb5; -- XKB_KEY_Abrevebelowdot : constant := #16#1001eb6; -- XKB_KEY_abrevebelowdot : constant := #16#1001eb7; -- XKB_KEY_Ebelowdot : constant := #16#1001eb8; -- XKB_KEY_ebelowdot : constant := #16#1001eb9; -- XKB_KEY_Ehook : constant := #16#1001eba; -- XKB_KEY_ehook : constant := #16#1001ebb; -- XKB_KEY_Etilde : constant := #16#1001ebc; -- XKB_KEY_etilde : constant := #16#1001ebd; -- XKB_KEY_Ecircumflexacute : constant := #16#1001ebe; -- XKB_KEY_ecircumflexacute : constant := #16#1001ebf; -- XKB_KEY_Ecircumflexgrave : constant := #16#1001ec0; -- XKB_KEY_ecircumflexgrave : constant := #16#1001ec1; -- XKB_KEY_Ecircumflexhook : constant := #16#1001ec2; -- XKB_KEY_ecircumflexhook : constant := #16#1001ec3; -- XKB_KEY_Ecircumflextilde : constant := #16#1001ec4; -- XKB_KEY_ecircumflextilde : constant := #16#1001ec5; -- XKB_KEY_Ecircumflexbelowdot : constant := #16#1001ec6; -- XKB_KEY_ecircumflexbelowdot : constant := #16#1001ec7; -- XKB_KEY_Ihook : constant := #16#1001ec8; -- XKB_KEY_ihook : constant := #16#1001ec9; -- XKB_KEY_Ibelowdot : constant := #16#1001eca; -- XKB_KEY_ibelowdot : constant := #16#1001ecb; -- XKB_KEY_Obelowdot : constant := #16#1001ecc; -- XKB_KEY_obelowdot : constant := #16#1001ecd; -- XKB_KEY_Ohook : constant := #16#1001ece; -- XKB_KEY_ohook : constant := #16#1001ecf; -- XKB_KEY_Ocircumflexacute : constant := #16#1001ed0; -- XKB_KEY_ocircumflexacute : constant := #16#1001ed1; -- XKB_KEY_Ocircumflexgrave : constant := #16#1001ed2; -- XKB_KEY_ocircumflexgrave : constant := #16#1001ed3; -- XKB_KEY_Ocircumflexhook : constant := #16#1001ed4; -- XKB_KEY_ocircumflexhook : constant := #16#1001ed5; -- XKB_KEY_Ocircumflextilde : constant := #16#1001ed6; -- XKB_KEY_ocircumflextilde : constant := #16#1001ed7; -- XKB_KEY_Ocircumflexbelowdot : constant := #16#1001ed8; -- XKB_KEY_ocircumflexbelowdot : constant := #16#1001ed9; -- XKB_KEY_Ohornacute : constant := #16#1001eda; -- XKB_KEY_ohornacute : constant := #16#1001edb; -- XKB_KEY_Ohorngrave : constant := #16#1001edc; -- XKB_KEY_ohorngrave : constant := #16#1001edd; -- XKB_KEY_Ohornhook : constant := #16#1001ede; -- XKB_KEY_ohornhook : constant := #16#1001edf; -- XKB_KEY_Ohorntilde : constant := #16#1001ee0; -- XKB_KEY_ohorntilde : constant := #16#1001ee1; -- XKB_KEY_Ohornbelowdot : constant := #16#1001ee2; -- XKB_KEY_ohornbelowdot : constant := #16#1001ee3; -- XKB_KEY_Ubelowdot : constant := #16#1001ee4; -- XKB_KEY_ubelowdot : constant := #16#1001ee5; -- XKB_KEY_Uhook : constant := #16#1001ee6; -- XKB_KEY_uhook : constant := #16#1001ee7; -- XKB_KEY_Uhornacute : constant := #16#1001ee8; -- XKB_KEY_uhornacute : constant := #16#1001ee9; -- XKB_KEY_Uhorngrave : constant := #16#1001eea; -- XKB_KEY_uhorngrave : constant := #16#1001eeb; -- XKB_KEY_Uhornhook : constant := #16#1001eec; -- XKB_KEY_uhornhook : constant := #16#1001eed; -- XKB_KEY_Uhorntilde : constant := #16#1001eee; -- XKB_KEY_uhorntilde : constant := #16#1001eef; -- XKB_KEY_Uhornbelowdot : constant := #16#1001ef0; -- XKB_KEY_uhornbelowdot : constant := #16#1001ef1; -- XKB_KEY_Ybelowdot : constant := #16#1001ef4; -- XKB_KEY_ybelowdot : constant := #16#1001ef5; -- XKB_KEY_Yhook : constant := #16#1001ef6; -- XKB_KEY_yhook : constant := #16#1001ef7; -- XKB_KEY_Ytilde : constant := #16#1001ef8; -- XKB_KEY_ytilde : constant := #16#1001ef9; -- XKB_KEY_Ohorn : constant := #16#10001a0; -- XKB_KEY_ohorn : constant := #16#10001a1; -- XKB_KEY_Uhorn : constant := #16#10001af; -- XKB_KEY_uhorn : constant := #16#10001b0; -- XKB_KEY_EcuSign : constant := #16#10020a0; -- XKB_KEY_ColonSign : constant := #16#10020a1; -- XKB_KEY_CruzeiroSign : constant := #16#10020a2; -- XKB_KEY_FFrancSign : constant := #16#10020a3; -- XKB_KEY_LiraSign : constant := #16#10020a4; -- XKB_KEY_MillSign : constant := #16#10020a5; -- XKB_KEY_NairaSign : constant := #16#10020a6; -- XKB_KEY_PesetaSign : constant := #16#10020a7; -- XKB_KEY_RupeeSign : constant := #16#10020a8; -- XKB_KEY_WonSign : constant := #16#10020a9; -- XKB_KEY_NewSheqelSign : constant := #16#10020aa; -- XKB_KEY_DongSign : constant := #16#10020ab; -- XKB_KEY_EuroSign : constant := #16#20ac; -- XKB_KEY_zerosuperior : constant := #16#1002070; -- XKB_KEY_foursuperior : constant := #16#1002074; -- XKB_KEY_fivesuperior : constant := #16#1002075; -- XKB_KEY_sixsuperior : constant := #16#1002076; -- XKB_KEY_sevensuperior : constant := #16#1002077; -- XKB_KEY_eightsuperior : constant := #16#1002078; -- XKB_KEY_ninesuperior : constant := #16#1002079; -- XKB_KEY_zerosubscript : constant := #16#1002080; -- XKB_KEY_onesubscript : constant := #16#1002081; -- XKB_KEY_twosubscript : constant := #16#1002082; -- XKB_KEY_threesubscript : constant := #16#1002083; -- XKB_KEY_foursubscript : constant := #16#1002084; -- XKB_KEY_fivesubscript : constant := #16#1002085; -- XKB_KEY_sixsubscript : constant := #16#1002086; -- XKB_KEY_sevensubscript : constant := #16#1002087; -- XKB_KEY_eightsubscript : constant := #16#1002088; -- XKB_KEY_ninesubscript : constant := #16#1002089; -- XKB_KEY_partdifferential : constant := #16#1002202; -- XKB_KEY_emptyset : constant := #16#1002205; -- XKB_KEY_elementof : constant := #16#1002208; -- XKB_KEY_notelementof : constant := #16#1002209; -- XKB_KEY_containsas : constant := #16#100220B; -- XKB_KEY_squareroot : constant := #16#100221A; -- XKB_KEY_cuberoot : constant := #16#100221B; -- XKB_KEY_fourthroot : constant := #16#100221C; -- XKB_KEY_dintegral : constant := #16#100222C; -- XKB_KEY_tintegral : constant := #16#100222D; -- XKB_KEY_because : constant := #16#1002235; -- XKB_KEY_approxeq : constant := #16#1002248; -- XKB_KEY_notapproxeq : constant := #16#1002247; -- XKB_KEY_notidentical : constant := #16#1002262; -- XKB_KEY_stricteq : constant := #16#1002263; -- XKB_KEY_braille_dot_1 : constant := #16#fff1; -- XKB_KEY_braille_dot_2 : constant := #16#fff2; -- XKB_KEY_braille_dot_3 : constant := #16#fff3; -- XKB_KEY_braille_dot_4 : constant := #16#fff4; -- XKB_KEY_braille_dot_5 : constant := #16#fff5; -- XKB_KEY_braille_dot_6 : constant := #16#fff6; -- XKB_KEY_braille_dot_7 : constant := #16#fff7; -- XKB_KEY_braille_dot_8 : constant := #16#fff8; -- XKB_KEY_braille_dot_9 : constant := #16#fff9; -- XKB_KEY_braille_dot_10 : constant := #16#fffa; -- XKB_KEY_braille_blank : constant := #16#1002800; -- XKB_KEY_braille_dots_1 : constant := #16#1002801; -- XKB_KEY_braille_dots_2 : constant := #16#1002802; -- XKB_KEY_braille_dots_12 : constant := #16#1002803; -- XKB_KEY_braille_dots_3 : constant := #16#1002804; -- XKB_KEY_braille_dots_13 : constant := #16#1002805; -- XKB_KEY_braille_dots_23 : constant := #16#1002806; -- XKB_KEY_braille_dots_123 : constant := #16#1002807; -- XKB_KEY_braille_dots_4 : constant := #16#1002808; -- XKB_KEY_braille_dots_14 : constant := #16#1002809; -- XKB_KEY_braille_dots_24 : constant := #16#100280a; -- XKB_KEY_braille_dots_124 : constant := #16#100280b; -- XKB_KEY_braille_dots_34 : constant := #16#100280c; -- XKB_KEY_braille_dots_134 : constant := #16#100280d; -- XKB_KEY_braille_dots_234 : constant := #16#100280e; -- XKB_KEY_braille_dots_1234 : constant := #16#100280f; -- XKB_KEY_braille_dots_5 : constant := #16#1002810; -- XKB_KEY_braille_dots_15 : constant := #16#1002811; -- XKB_KEY_braille_dots_25 : constant := #16#1002812; -- XKB_KEY_braille_dots_125 : constant := #16#1002813; -- XKB_KEY_braille_dots_35 : constant := #16#1002814; -- XKB_KEY_braille_dots_135 : constant := #16#1002815; -- XKB_KEY_braille_dots_235 : constant := #16#1002816; -- XKB_KEY_braille_dots_1235 : constant := #16#1002817; -- XKB_KEY_braille_dots_45 : constant := #16#1002818; -- XKB_KEY_braille_dots_145 : constant := #16#1002819; -- XKB_KEY_braille_dots_245 : constant := #16#100281a; -- XKB_KEY_braille_dots_1245 : constant := #16#100281b; -- XKB_KEY_braille_dots_345 : constant := #16#100281c; -- XKB_KEY_braille_dots_1345 : constant := #16#100281d; -- XKB_KEY_braille_dots_2345 : constant := #16#100281e; -- XKB_KEY_braille_dots_12345 : constant := #16#100281f; -- XKB_KEY_braille_dots_6 : constant := #16#1002820; -- XKB_KEY_braille_dots_16 : constant := #16#1002821; -- XKB_KEY_braille_dots_26 : constant := #16#1002822; -- XKB_KEY_braille_dots_126 : constant := #16#1002823; -- XKB_KEY_braille_dots_36 : constant := #16#1002824; -- XKB_KEY_braille_dots_136 : constant := #16#1002825; -- XKB_KEY_braille_dots_236 : constant := #16#1002826; -- XKB_KEY_braille_dots_1236 : constant := #16#1002827; -- XKB_KEY_braille_dots_46 : constant := #16#1002828; -- XKB_KEY_braille_dots_146 : constant := #16#1002829; -- XKB_KEY_braille_dots_246 : constant := #16#100282a; -- XKB_KEY_braille_dots_1246 : constant := #16#100282b; -- XKB_KEY_braille_dots_346 : constant := #16#100282c; -- XKB_KEY_braille_dots_1346 : constant := #16#100282d; -- XKB_KEY_braille_dots_2346 : constant := #16#100282e; -- XKB_KEY_braille_dots_12346 : constant := #16#100282f; -- XKB_KEY_braille_dots_56 : constant := #16#1002830; -- XKB_KEY_braille_dots_156 : constant := #16#1002831; -- XKB_KEY_braille_dots_256 : constant := #16#1002832; -- XKB_KEY_braille_dots_1256 : constant := #16#1002833; -- XKB_KEY_braille_dots_356 : constant := #16#1002834; -- XKB_KEY_braille_dots_1356 : constant := #16#1002835; -- XKB_KEY_braille_dots_2356 : constant := #16#1002836; -- XKB_KEY_braille_dots_12356 : constant := #16#1002837; -- XKB_KEY_braille_dots_456 : constant := #16#1002838; -- XKB_KEY_braille_dots_1456 : constant := #16#1002839; -- XKB_KEY_braille_dots_2456 : constant := #16#100283a; -- XKB_KEY_braille_dots_12456 : constant := #16#100283b; -- XKB_KEY_braille_dots_3456 : constant := #16#100283c; -- XKB_KEY_braille_dots_13456 : constant := #16#100283d; -- XKB_KEY_braille_dots_23456 : constant := #16#100283e; -- XKB_KEY_braille_dots_123456 : constant := #16#100283f; -- XKB_KEY_braille_dots_7 : constant := #16#1002840; -- XKB_KEY_braille_dots_17 : constant := #16#1002841; -- XKB_KEY_braille_dots_27 : constant := #16#1002842; -- XKB_KEY_braille_dots_127 : constant := #16#1002843; -- XKB_KEY_braille_dots_37 : constant := #16#1002844; -- XKB_KEY_braille_dots_137 : constant := #16#1002845; -- XKB_KEY_braille_dots_237 : constant := #16#1002846; -- XKB_KEY_braille_dots_1237 : constant := #16#1002847; -- XKB_KEY_braille_dots_47 : constant := #16#1002848; -- XKB_KEY_braille_dots_147 : constant := #16#1002849; -- XKB_KEY_braille_dots_247 : constant := #16#100284a; -- XKB_KEY_braille_dots_1247 : constant := #16#100284b; -- XKB_KEY_braille_dots_347 : constant := #16#100284c; -- XKB_KEY_braille_dots_1347 : constant := #16#100284d; -- XKB_KEY_braille_dots_2347 : constant := #16#100284e; -- XKB_KEY_braille_dots_12347 : constant := #16#100284f; -- XKB_KEY_braille_dots_57 : constant := #16#1002850; -- XKB_KEY_braille_dots_157 : constant := #16#1002851; -- XKB_KEY_braille_dots_257 : constant := #16#1002852; -- XKB_KEY_braille_dots_1257 : constant := #16#1002853; -- XKB_KEY_braille_dots_357 : constant := #16#1002854; -- XKB_KEY_braille_dots_1357 : constant := #16#1002855; -- XKB_KEY_braille_dots_2357 : constant := #16#1002856; -- XKB_KEY_braille_dots_12357 : constant := #16#1002857; -- XKB_KEY_braille_dots_457 : constant := #16#1002858; -- XKB_KEY_braille_dots_1457 : constant := #16#1002859; -- XKB_KEY_braille_dots_2457 : constant := #16#100285a; -- XKB_KEY_braille_dots_12457 : constant := #16#100285b; -- XKB_KEY_braille_dots_3457 : constant := #16#100285c; -- XKB_KEY_braille_dots_13457 : constant := #16#100285d; -- XKB_KEY_braille_dots_23457 : constant := #16#100285e; -- XKB_KEY_braille_dots_123457 : constant := #16#100285f; -- XKB_KEY_braille_dots_67 : constant := #16#1002860; -- XKB_KEY_braille_dots_167 : constant := #16#1002861; -- XKB_KEY_braille_dots_267 : constant := #16#1002862; -- XKB_KEY_braille_dots_1267 : constant := #16#1002863; -- XKB_KEY_braille_dots_367 : constant := #16#1002864; -- XKB_KEY_braille_dots_1367 : constant := #16#1002865; -- XKB_KEY_braille_dots_2367 : constant := #16#1002866; -- XKB_KEY_braille_dots_12367 : constant := #16#1002867; -- XKB_KEY_braille_dots_467 : constant := #16#1002868; -- XKB_KEY_braille_dots_1467 : constant := #16#1002869; -- XKB_KEY_braille_dots_2467 : constant := #16#100286a; -- XKB_KEY_braille_dots_12467 : constant := #16#100286b; -- XKB_KEY_braille_dots_3467 : constant := #16#100286c; -- XKB_KEY_braille_dots_13467 : constant := #16#100286d; -- XKB_KEY_braille_dots_23467 : constant := #16#100286e; -- XKB_KEY_braille_dots_123467 : constant := #16#100286f; -- XKB_KEY_braille_dots_567 : constant := #16#1002870; -- XKB_KEY_braille_dots_1567 : constant := #16#1002871; -- XKB_KEY_braille_dots_2567 : constant := #16#1002872; -- XKB_KEY_braille_dots_12567 : constant := #16#1002873; -- XKB_KEY_braille_dots_3567 : constant := #16#1002874; -- XKB_KEY_braille_dots_13567 : constant := #16#1002875; -- XKB_KEY_braille_dots_23567 : constant := #16#1002876; -- XKB_KEY_braille_dots_123567 : constant := #16#1002877; -- XKB_KEY_braille_dots_4567 : constant := #16#1002878; -- XKB_KEY_braille_dots_14567 : constant := #16#1002879; -- XKB_KEY_braille_dots_24567 : constant := #16#100287a; -- XKB_KEY_braille_dots_124567 : constant := #16#100287b; -- XKB_KEY_braille_dots_34567 : constant := #16#100287c; -- XKB_KEY_braille_dots_134567 : constant := #16#100287d; -- XKB_KEY_braille_dots_234567 : constant := #16#100287e; -- XKB_KEY_braille_dots_1234567 : constant := #16#100287f; -- XKB_KEY_braille_dots_8 : constant := #16#1002880; -- XKB_KEY_braille_dots_18 : constant := #16#1002881; -- XKB_KEY_braille_dots_28 : constant := #16#1002882; -- XKB_KEY_braille_dots_128 : constant := #16#1002883; -- XKB_KEY_braille_dots_38 : constant := #16#1002884; -- XKB_KEY_braille_dots_138 : constant := #16#1002885; -- XKB_KEY_braille_dots_238 : constant := #16#1002886; -- XKB_KEY_braille_dots_1238 : constant := #16#1002887; -- XKB_KEY_braille_dots_48 : constant := #16#1002888; -- XKB_KEY_braille_dots_148 : constant := #16#1002889; -- XKB_KEY_braille_dots_248 : constant := #16#100288a; -- XKB_KEY_braille_dots_1248 : constant := #16#100288b; -- XKB_KEY_braille_dots_348 : constant := #16#100288c; -- XKB_KEY_braille_dots_1348 : constant := #16#100288d; -- XKB_KEY_braille_dots_2348 : constant := #16#100288e; -- XKB_KEY_braille_dots_12348 : constant := #16#100288f; -- XKB_KEY_braille_dots_58 : constant := #16#1002890; -- XKB_KEY_braille_dots_158 : constant := #16#1002891; -- XKB_KEY_braille_dots_258 : constant := #16#1002892; -- XKB_KEY_braille_dots_1258 : constant := #16#1002893; -- XKB_KEY_braille_dots_358 : constant := #16#1002894; -- XKB_KEY_braille_dots_1358 : constant := #16#1002895; -- XKB_KEY_braille_dots_2358 : constant := #16#1002896; -- XKB_KEY_braille_dots_12358 : constant := #16#1002897; -- XKB_KEY_braille_dots_458 : constant := #16#1002898; -- XKB_KEY_braille_dots_1458 : constant := #16#1002899; -- XKB_KEY_braille_dots_2458 : constant := #16#100289a; -- XKB_KEY_braille_dots_12458 : constant := #16#100289b; -- XKB_KEY_braille_dots_3458 : constant := #16#100289c; -- XKB_KEY_braille_dots_13458 : constant := #16#100289d; -- XKB_KEY_braille_dots_23458 : constant := #16#100289e; -- XKB_KEY_braille_dots_123458 : constant := #16#100289f; -- XKB_KEY_braille_dots_68 : constant := #16#10028a0; -- XKB_KEY_braille_dots_168 : constant := #16#10028a1; -- XKB_KEY_braille_dots_268 : constant := #16#10028a2; -- XKB_KEY_braille_dots_1268 : constant := #16#10028a3; -- XKB_KEY_braille_dots_368 : constant := #16#10028a4; -- XKB_KEY_braille_dots_1368 : constant := #16#10028a5; -- XKB_KEY_braille_dots_2368 : constant := #16#10028a6; -- XKB_KEY_braille_dots_12368 : constant := #16#10028a7; -- XKB_KEY_braille_dots_468 : constant := #16#10028a8; -- XKB_KEY_braille_dots_1468 : constant := #16#10028a9; -- XKB_KEY_braille_dots_2468 : constant := #16#10028aa; -- XKB_KEY_braille_dots_12468 : constant := #16#10028ab; -- XKB_KEY_braille_dots_3468 : constant := #16#10028ac; -- XKB_KEY_braille_dots_13468 : constant := #16#10028ad; -- XKB_KEY_braille_dots_23468 : constant := #16#10028ae; -- XKB_KEY_braille_dots_123468 : constant := #16#10028af; -- XKB_KEY_braille_dots_568 : constant := #16#10028b0; -- XKB_KEY_braille_dots_1568 : constant := #16#10028b1; -- XKB_KEY_braille_dots_2568 : constant := #16#10028b2; -- XKB_KEY_braille_dots_12568 : constant := #16#10028b3; -- XKB_KEY_braille_dots_3568 : constant := #16#10028b4; -- XKB_KEY_braille_dots_13568 : constant := #16#10028b5; -- XKB_KEY_braille_dots_23568 : constant := #16#10028b6; -- XKB_KEY_braille_dots_123568 : constant := #16#10028b7; -- XKB_KEY_braille_dots_4568 : constant := #16#10028b8; -- XKB_KEY_braille_dots_14568 : constant := #16#10028b9; -- XKB_KEY_braille_dots_24568 : constant := #16#10028ba; -- XKB_KEY_braille_dots_124568 : constant := #16#10028bb; -- XKB_KEY_braille_dots_34568 : constant := #16#10028bc; -- XKB_KEY_braille_dots_134568 : constant := #16#10028bd; -- XKB_KEY_braille_dots_234568 : constant := #16#10028be; -- XKB_KEY_braille_dots_1234568 : constant := #16#10028bf; -- XKB_KEY_braille_dots_78 : constant := #16#10028c0; -- XKB_KEY_braille_dots_178 : constant := #16#10028c1; -- XKB_KEY_braille_dots_278 : constant := #16#10028c2; -- XKB_KEY_braille_dots_1278 : constant := #16#10028c3; -- XKB_KEY_braille_dots_378 : constant := #16#10028c4; -- XKB_KEY_braille_dots_1378 : constant := #16#10028c5; -- XKB_KEY_braille_dots_2378 : constant := #16#10028c6; -- XKB_KEY_braille_dots_12378 : constant := #16#10028c7; -- XKB_KEY_braille_dots_478 : constant := #16#10028c8; -- XKB_KEY_braille_dots_1478 : constant := #16#10028c9; -- XKB_KEY_braille_dots_2478 : constant := #16#10028ca; -- XKB_KEY_braille_dots_12478 : constant := #16#10028cb; -- XKB_KEY_braille_dots_3478 : constant := #16#10028cc; -- XKB_KEY_braille_dots_13478 : constant := #16#10028cd; -- XKB_KEY_braille_dots_23478 : constant := #16#10028ce; -- XKB_KEY_braille_dots_123478 : constant := #16#10028cf; -- XKB_KEY_braille_dots_578 : constant := #16#10028d0; -- XKB_KEY_braille_dots_1578 : constant := #16#10028d1; -- XKB_KEY_braille_dots_2578 : constant := #16#10028d2; -- XKB_KEY_braille_dots_12578 : constant := #16#10028d3; -- XKB_KEY_braille_dots_3578 : constant := #16#10028d4; -- XKB_KEY_braille_dots_13578 : constant := #16#10028d5; -- XKB_KEY_braille_dots_23578 : constant := #16#10028d6; -- XKB_KEY_braille_dots_123578 : constant := #16#10028d7; -- XKB_KEY_braille_dots_4578 : constant := #16#10028d8; -- XKB_KEY_braille_dots_14578 : constant := #16#10028d9; -- XKB_KEY_braille_dots_24578 : constant := #16#10028da; -- XKB_KEY_braille_dots_124578 : constant := #16#10028db; -- XKB_KEY_braille_dots_34578 : constant := #16#10028dc; -- XKB_KEY_braille_dots_134578 : constant := #16#10028dd; -- XKB_KEY_braille_dots_234578 : constant := #16#10028de; -- XKB_KEY_braille_dots_1234578 : constant := #16#10028df; -- XKB_KEY_braille_dots_678 : constant := #16#10028e0; -- XKB_KEY_braille_dots_1678 : constant := #16#10028e1; -- XKB_KEY_braille_dots_2678 : constant := #16#10028e2; -- XKB_KEY_braille_dots_12678 : constant := #16#10028e3; -- XKB_KEY_braille_dots_3678 : constant := #16#10028e4; -- XKB_KEY_braille_dots_13678 : constant := #16#10028e5; -- XKB_KEY_braille_dots_23678 : constant := #16#10028e6; -- XKB_KEY_braille_dots_123678 : constant := #16#10028e7; -- XKB_KEY_braille_dots_4678 : constant := #16#10028e8; -- XKB_KEY_braille_dots_14678 : constant := #16#10028e9; -- XKB_KEY_braille_dots_24678 : constant := #16#10028ea; -- XKB_KEY_braille_dots_124678 : constant := #16#10028eb; -- XKB_KEY_braille_dots_34678 : constant := #16#10028ec; -- XKB_KEY_braille_dots_134678 : constant := #16#10028ed; -- XKB_KEY_braille_dots_234678 : constant := #16#10028ee; -- XKB_KEY_braille_dots_1234678 : constant := #16#10028ef; -- XKB_KEY_braille_dots_5678 : constant := #16#10028f0; -- XKB_KEY_braille_dots_15678 : constant := #16#10028f1; -- XKB_KEY_braille_dots_25678 : constant := #16#10028f2; -- XKB_KEY_braille_dots_125678 : constant := #16#10028f3; -- XKB_KEY_braille_dots_35678 : constant := #16#10028f4; -- XKB_KEY_braille_dots_135678 : constant := #16#10028f5; -- XKB_KEY_braille_dots_235678 : constant := #16#10028f6; -- XKB_KEY_braille_dots_1235678 : constant := #16#10028f7; -- XKB_KEY_braille_dots_45678 : constant := #16#10028f8; -- XKB_KEY_braille_dots_145678 : constant := #16#10028f9; -- XKB_KEY_braille_dots_245678 : constant := #16#10028fa; -- XKB_KEY_braille_dots_1245678 : constant := #16#10028fb; -- XKB_KEY_braille_dots_345678 : constant := #16#10028fc; -- XKB_KEY_braille_dots_1345678 : constant := #16#10028fd; -- XKB_KEY_braille_dots_2345678 : constant := #16#10028fe; -- XKB_KEY_braille_dots_12345678 : constant := #16#10028ff; -- XKB_KEY_Sinh_ng : constant := #16#1000d82; -- XKB_KEY_Sinh_h2 : constant := #16#1000d83; -- XKB_KEY_Sinh_a : constant := #16#1000d85; -- XKB_KEY_Sinh_aa : constant := #16#1000d86; -- XKB_KEY_Sinh_ae : constant := #16#1000d87; -- XKB_KEY_Sinh_aee : constant := #16#1000d88; -- XKB_KEY_Sinh_i : constant := #16#1000d89; -- XKB_KEY_Sinh_ii : constant := #16#1000d8a; -- XKB_KEY_Sinh_u : constant := #16#1000d8b; -- XKB_KEY_Sinh_uu : constant := #16#1000d8c; -- XKB_KEY_Sinh_ri : constant := #16#1000d8d; -- XKB_KEY_Sinh_rii : constant := #16#1000d8e; -- XKB_KEY_Sinh_lu : constant := #16#1000d8f; -- XKB_KEY_Sinh_luu : constant := #16#1000d90; -- XKB_KEY_Sinh_e : constant := #16#1000d91; -- XKB_KEY_Sinh_ee : constant := #16#1000d92; -- XKB_KEY_Sinh_ai : constant := #16#1000d93; -- XKB_KEY_Sinh_o : constant := #16#1000d94; -- XKB_KEY_Sinh_oo : constant := #16#1000d95; -- XKB_KEY_Sinh_au : constant := #16#1000d96; -- XKB_KEY_Sinh_ka : constant := #16#1000d9a; -- XKB_KEY_Sinh_kha : constant := #16#1000d9b; -- XKB_KEY_Sinh_ga : constant := #16#1000d9c; -- XKB_KEY_Sinh_gha : constant := #16#1000d9d; -- XKB_KEY_Sinh_ng2 : constant := #16#1000d9e; -- XKB_KEY_Sinh_nga : constant := #16#1000d9f; -- XKB_KEY_Sinh_ca : constant := #16#1000da0; -- XKB_KEY_Sinh_cha : constant := #16#1000da1; -- XKB_KEY_Sinh_ja : constant := #16#1000da2; -- XKB_KEY_Sinh_jha : constant := #16#1000da3; -- XKB_KEY_Sinh_nya : constant := #16#1000da4; -- XKB_KEY_Sinh_jnya : constant := #16#1000da5; -- XKB_KEY_Sinh_nja : constant := #16#1000da6; -- XKB_KEY_Sinh_tta : constant := #16#1000da7; -- XKB_KEY_Sinh_ttha : constant := #16#1000da8; -- XKB_KEY_Sinh_dda : constant := #16#1000da9; -- XKB_KEY_Sinh_ddha : constant := #16#1000daa; -- XKB_KEY_Sinh_nna : constant := #16#1000dab; -- XKB_KEY_Sinh_ndda : constant := #16#1000dac; -- XKB_KEY_Sinh_tha : constant := #16#1000dad; -- XKB_KEY_Sinh_thha : constant := #16#1000dae; -- XKB_KEY_Sinh_dha : constant := #16#1000daf; -- XKB_KEY_Sinh_dhha : constant := #16#1000db0; -- XKB_KEY_Sinh_na : constant := #16#1000db1; -- XKB_KEY_Sinh_ndha : constant := #16#1000db3; -- XKB_KEY_Sinh_pa : constant := #16#1000db4; -- XKB_KEY_Sinh_pha : constant := #16#1000db5; -- XKB_KEY_Sinh_ba : constant := #16#1000db6; -- XKB_KEY_Sinh_bha : constant := #16#1000db7; -- XKB_KEY_Sinh_ma : constant := #16#1000db8; -- XKB_KEY_Sinh_mba : constant := #16#1000db9; -- XKB_KEY_Sinh_ya : constant := #16#1000dba; -- XKB_KEY_Sinh_ra : constant := #16#1000dbb; -- XKB_KEY_Sinh_la : constant := #16#1000dbd; -- XKB_KEY_Sinh_va : constant := #16#1000dc0; -- XKB_KEY_Sinh_sha : constant := #16#1000dc1; -- XKB_KEY_Sinh_ssha : constant := #16#1000dc2; -- XKB_KEY_Sinh_sa : constant := #16#1000dc3; -- XKB_KEY_Sinh_ha : constant := #16#1000dc4; -- XKB_KEY_Sinh_lla : constant := #16#1000dc5; -- XKB_KEY_Sinh_fa : constant := #16#1000dc6; -- XKB_KEY_Sinh_al : constant := #16#1000dca; -- XKB_KEY_Sinh_aa2 : constant := #16#1000dcf; -- XKB_KEY_Sinh_ae2 : constant := #16#1000dd0; -- XKB_KEY_Sinh_aee2 : constant := #16#1000dd1; -- XKB_KEY_Sinh_i2 : constant := #16#1000dd2; -- XKB_KEY_Sinh_ii2 : constant := #16#1000dd3; -- XKB_KEY_Sinh_u2 : constant := #16#1000dd4; -- XKB_KEY_Sinh_uu2 : constant := #16#1000dd6; -- XKB_KEY_Sinh_ru2 : constant := #16#1000dd8; -- XKB_KEY_Sinh_e2 : constant := #16#1000dd9; -- XKB_KEY_Sinh_ee2 : constant := #16#1000dda; -- XKB_KEY_Sinh_ai2 : constant := #16#1000ddb; -- XKB_KEY_Sinh_o2 : constant := #16#1000ddc; -- XKB_KEY_Sinh_oo2 : constant := #16#1000ddd; -- XKB_KEY_Sinh_au2 : constant := #16#1000dde; -- XKB_KEY_Sinh_lu2 : constant := #16#1000ddf; -- XKB_KEY_Sinh_ruu2 : constant := #16#1000df2; -- XKB_KEY_Sinh_luu2 : constant := #16#1000df3; -- XKB_KEY_Sinh_kunddaliya : constant := #16#1000df4; -- XKB_KEY_XF86ModeLock : constant := #16#1008FF01; -- XKB_KEY_XF86MonBrightnessUp : constant := #16#1008FF02; -- XKB_KEY_XF86MonBrightnessDown : constant := #16#1008FF03; -- XKB_KEY_XF86KbdLightOnOff : constant := #16#1008FF04; -- XKB_KEY_XF86KbdBrightnessUp : constant := #16#1008FF05; -- XKB_KEY_XF86KbdBrightnessDown : constant := #16#1008FF06; -- XKB_KEY_XF86Standby : constant := #16#1008FF10; -- XKB_KEY_XF86AudioLowerVolume : constant := #16#1008FF11; -- XKB_KEY_XF86AudioMute : constant := #16#1008FF12; -- XKB_KEY_XF86AudioRaiseVolume : constant := #16#1008FF13; -- XKB_KEY_XF86AudioPlay : constant := #16#1008FF14; -- XKB_KEY_XF86AudioStop : constant := #16#1008FF15; -- XKB_KEY_XF86AudioPrev : constant := #16#1008FF16; -- XKB_KEY_XF86AudioNext : constant := #16#1008FF17; -- XKB_KEY_XF86HomePage : constant := #16#1008FF18; -- XKB_KEY_XF86Mail : constant := #16#1008FF19; -- XKB_KEY_XF86Start : constant := #16#1008FF1A; -- XKB_KEY_XF86Search : constant := #16#1008FF1B; -- XKB_KEY_XF86AudioRecord : constant := #16#1008FF1C; -- XKB_KEY_XF86Calculator : constant := #16#1008FF1D; -- XKB_KEY_XF86Memo : constant := #16#1008FF1E; -- XKB_KEY_XF86ToDoList : constant := #16#1008FF1F; -- XKB_KEY_XF86Calendar : constant := #16#1008FF20; -- XKB_KEY_XF86PowerDown : constant := #16#1008FF21; -- XKB_KEY_XF86ContrastAdjust : constant := #16#1008FF22; -- XKB_KEY_XF86RockerUp : constant := #16#1008FF23; -- XKB_KEY_XF86RockerDown : constant := #16#1008FF24; -- XKB_KEY_XF86RockerEnter : constant := #16#1008FF25; -- XKB_KEY_XF86Back : constant := #16#1008FF26; -- XKB_KEY_XF86Forward : constant := #16#1008FF27; -- XKB_KEY_XF86Stop : constant := #16#1008FF28; -- XKB_KEY_XF86Refresh : constant := #16#1008FF29; -- XKB_KEY_XF86PowerOff : constant := #16#1008FF2A; -- XKB_KEY_XF86WakeUp : constant := #16#1008FF2B; -- XKB_KEY_XF86Eject : constant := #16#1008FF2C; -- XKB_KEY_XF86ScreenSaver : constant := #16#1008FF2D; -- XKB_KEY_XF86WWW : constant := #16#1008FF2E; -- XKB_KEY_XF86Sleep : constant := #16#1008FF2F; -- XKB_KEY_XF86Favorites : constant := #16#1008FF30; -- XKB_KEY_XF86AudioPause : constant := #16#1008FF31; -- XKB_KEY_XF86AudioMedia : constant := #16#1008FF32; -- XKB_KEY_XF86MyComputer : constant := #16#1008FF33; -- XKB_KEY_XF86VendorHome : constant := #16#1008FF34; -- XKB_KEY_XF86LightBulb : constant := #16#1008FF35; -- XKB_KEY_XF86Shop : constant := #16#1008FF36; -- XKB_KEY_XF86History : constant := #16#1008FF37; -- XKB_KEY_XF86OpenURL : constant := #16#1008FF38; -- XKB_KEY_XF86AddFavorite : constant := #16#1008FF39; -- XKB_KEY_XF86HotLinks : constant := #16#1008FF3A; -- XKB_KEY_XF86BrightnessAdjust : constant := #16#1008FF3B; -- XKB_KEY_XF86Finance : constant := #16#1008FF3C; -- XKB_KEY_XF86Community : constant := #16#1008FF3D; -- XKB_KEY_XF86AudioRewind : constant := #16#1008FF3E; -- XKB_KEY_XF86BackForward : constant := #16#1008FF3F; -- XKB_KEY_XF86Launch0 : constant := #16#1008FF40; -- XKB_KEY_XF86Launch1 : constant := #16#1008FF41; -- XKB_KEY_XF86Launch2 : constant := #16#1008FF42; -- XKB_KEY_XF86Launch3 : constant := #16#1008FF43; -- XKB_KEY_XF86Launch4 : constant := #16#1008FF44; -- XKB_KEY_XF86Launch5 : constant := #16#1008FF45; -- XKB_KEY_XF86Launch6 : constant := #16#1008FF46; -- XKB_KEY_XF86Launch7 : constant := #16#1008FF47; -- XKB_KEY_XF86Launch8 : constant := #16#1008FF48; -- XKB_KEY_XF86Launch9 : constant := #16#1008FF49; -- XKB_KEY_XF86LaunchA : constant := #16#1008FF4A; -- XKB_KEY_XF86LaunchB : constant := #16#1008FF4B; -- XKB_KEY_XF86LaunchC : constant := #16#1008FF4C; -- XKB_KEY_XF86LaunchD : constant := #16#1008FF4D; -- XKB_KEY_XF86LaunchE : constant := #16#1008FF4E; -- XKB_KEY_XF86LaunchF : constant := #16#1008FF4F; -- XKB_KEY_XF86ApplicationLeft : constant := #16#1008FF50; -- XKB_KEY_XF86ApplicationRight : constant := #16#1008FF51; -- XKB_KEY_XF86Book : constant := #16#1008FF52; -- XKB_KEY_XF86CD : constant := #16#1008FF53; -- XKB_KEY_XF86Calculater : constant := #16#1008FF54; -- XKB_KEY_XF86Clear : constant := #16#1008FF55; -- XKB_KEY_XF86Close : constant := #16#1008FF56; -- XKB_KEY_XF86Copy : constant := #16#1008FF57; -- XKB_KEY_XF86Cut : constant := #16#1008FF58; -- XKB_KEY_XF86Display : constant := #16#1008FF59; -- XKB_KEY_XF86DOS : constant := #16#1008FF5A; -- XKB_KEY_XF86Documents : constant := #16#1008FF5B; -- XKB_KEY_XF86Excel : constant := #16#1008FF5C; -- XKB_KEY_XF86Explorer : constant := #16#1008FF5D; -- XKB_KEY_XF86Game : constant := #16#1008FF5E; -- XKB_KEY_XF86Go : constant := #16#1008FF5F; -- XKB_KEY_XF86iTouch : constant := #16#1008FF60; -- XKB_KEY_XF86LogOff : constant := #16#1008FF61; -- XKB_KEY_XF86Market : constant := #16#1008FF62; -- XKB_KEY_XF86Meeting : constant := #16#1008FF63; -- XKB_KEY_XF86MenuKB : constant := #16#1008FF65; -- XKB_KEY_XF86MenuPB : constant := #16#1008FF66; -- XKB_KEY_XF86MySites : constant := #16#1008FF67; -- XKB_KEY_XF86New : constant := #16#1008FF68; -- XKB_KEY_XF86News : constant := #16#1008FF69; -- XKB_KEY_XF86OfficeHome : constant := #16#1008FF6A; -- XKB_KEY_XF86Open : constant := #16#1008FF6B; -- XKB_KEY_XF86Option : constant := #16#1008FF6C; -- XKB_KEY_XF86Paste : constant := #16#1008FF6D; -- XKB_KEY_XF86Phone : constant := #16#1008FF6E; -- XKB_KEY_XF86Q : constant := #16#1008FF70; -- XKB_KEY_XF86Reply : constant := #16#1008FF72; -- XKB_KEY_XF86Reload : constant := #16#1008FF73; -- XKB_KEY_XF86RotateWindows : constant := #16#1008FF74; -- XKB_KEY_XF86RotationPB : constant := #16#1008FF75; -- XKB_KEY_XF86RotationKB : constant := #16#1008FF76; -- XKB_KEY_XF86Save : constant := #16#1008FF77; -- XKB_KEY_XF86ScrollUp : constant := #16#1008FF78; -- XKB_KEY_XF86ScrollDown : constant := #16#1008FF79; -- XKB_KEY_XF86ScrollClick : constant := #16#1008FF7A; -- XKB_KEY_XF86Send : constant := #16#1008FF7B; -- XKB_KEY_XF86Spell : constant := #16#1008FF7C; -- XKB_KEY_XF86SplitScreen : constant := #16#1008FF7D; -- XKB_KEY_XF86Support : constant := #16#1008FF7E; -- XKB_KEY_XF86TaskPane : constant := #16#1008FF7F; -- XKB_KEY_XF86Terminal : constant := #16#1008FF80; -- XKB_KEY_XF86Tools : constant := #16#1008FF81; -- XKB_KEY_XF86Travel : constant := #16#1008FF82; -- XKB_KEY_XF86UserPB : constant := #16#1008FF84; -- XKB_KEY_XF86User1KB : constant := #16#1008FF85; -- XKB_KEY_XF86User2KB : constant := #16#1008FF86; -- XKB_KEY_XF86Video : constant := #16#1008FF87; -- XKB_KEY_XF86WheelButton : constant := #16#1008FF88; -- XKB_KEY_XF86Word : constant := #16#1008FF89; -- XKB_KEY_XF86Xfer : constant := #16#1008FF8A; -- XKB_KEY_XF86ZoomIn : constant := #16#1008FF8B; -- XKB_KEY_XF86ZoomOut : constant := #16#1008FF8C; -- XKB_KEY_XF86Away : constant := #16#1008FF8D; -- XKB_KEY_XF86Messenger : constant := #16#1008FF8E; -- XKB_KEY_XF86WebCam : constant := #16#1008FF8F; -- XKB_KEY_XF86MailForward : constant := #16#1008FF90; -- XKB_KEY_XF86Pictures : constant := #16#1008FF91; -- XKB_KEY_XF86Music : constant := #16#1008FF92; -- XKB_KEY_XF86Battery : constant := #16#1008FF93; -- XKB_KEY_XF86Bluetooth : constant := #16#1008FF94; -- XKB_KEY_XF86WLAN : constant := #16#1008FF95; -- XKB_KEY_XF86UWB : constant := #16#1008FF96; -- XKB_KEY_XF86AudioForward : constant := #16#1008FF97; -- XKB_KEY_XF86AudioRepeat : constant := #16#1008FF98; -- XKB_KEY_XF86AudioRandomPlay : constant := #16#1008FF99; -- XKB_KEY_XF86Subtitle : constant := #16#1008FF9A; -- XKB_KEY_XF86AudioCycleTrack : constant := #16#1008FF9B; -- XKB_KEY_XF86CycleAngle : constant := #16#1008FF9C; -- XKB_KEY_XF86FrameBack : constant := #16#1008FF9D; -- XKB_KEY_XF86FrameForward : constant := #16#1008FF9E; -- XKB_KEY_XF86Time : constant := #16#1008FF9F; -- XKB_KEY_XF86Select : constant := #16#1008FFA0; -- XKB_KEY_XF86View : constant := #16#1008FFA1; -- XKB_KEY_XF86TopMenu : constant := #16#1008FFA2; -- XKB_KEY_XF86Red : constant := #16#1008FFA3; -- XKB_KEY_XF86Green : constant := #16#1008FFA4; -- XKB_KEY_XF86Yellow : constant := #16#1008FFA5; -- XKB_KEY_XF86Blue : constant := #16#1008FFA6; -- XKB_KEY_XF86Suspend : constant := #16#1008FFA7; -- XKB_KEY_XF86Hibernate : constant := #16#1008FFA8; -- XKB_KEY_XF86TouchpadToggle : constant := #16#1008FFA9; -- XKB_KEY_XF86TouchpadOn : constant := #16#1008FFB0; -- XKB_KEY_XF86TouchpadOff : constant := #16#1008FFB1; -- XKB_KEY_XF86AudioMicMute : constant := #16#1008FFB2; -- XKB_KEY_XF86Switch_VT_1 : constant := #16#1008FE01; -- XKB_KEY_XF86Switch_VT_2 : constant := #16#1008FE02; -- XKB_KEY_XF86Switch_VT_3 : constant := #16#1008FE03; -- XKB_KEY_XF86Switch_VT_4 : constant := #16#1008FE04; -- XKB_KEY_XF86Switch_VT_5 : constant := #16#1008FE05; -- XKB_KEY_XF86Switch_VT_6 : constant := #16#1008FE06; -- XKB_KEY_XF86Switch_VT_7 : constant := #16#1008FE07; -- XKB_KEY_XF86Switch_VT_8 : constant := #16#1008FE08; -- XKB_KEY_XF86Switch_VT_9 : constant := #16#1008FE09; -- XKB_KEY_XF86Switch_VT_10 : constant := #16#1008FE0A; -- XKB_KEY_XF86Switch_VT_11 : constant := #16#1008FE0B; -- XKB_KEY_XF86Switch_VT_12 : constant := #16#1008FE0C; -- XKB_KEY_XF86Ungrab : constant := #16#1008FE20; -- XKB_KEY_XF86ClearGrab : constant := #16#1008FE21; -- XKB_KEY_XF86Next_VMode : constant := #16#1008FE22; -- XKB_KEY_XF86Prev_VMode : constant := #16#1008FE23; -- XKB_KEY_XF86LogWindowTree : constant := #16#1008FE24; -- XKB_KEY_XF86LogGrabInfo : constant := #16#1008FE25; -- XKB_KEY_SunFA_Grave : constant := #16#1005FF00; -- XKB_KEY_SunFA_Circum : constant := #16#1005FF01; -- XKB_KEY_SunFA_Tilde : constant := #16#1005FF02; -- XKB_KEY_SunFA_Acute : constant := #16#1005FF03; -- XKB_KEY_SunFA_Diaeresis : constant := #16#1005FF04; -- XKB_KEY_SunFA_Cedilla : constant := #16#1005FF05; -- XKB_KEY_SunF36 : constant := #16#1005FF10; -- XKB_KEY_SunF37 : constant := #16#1005FF11; -- XKB_KEY_SunSys_Req : constant := #16#1005FF60; -- XKB_KEY_SunPrint_Screen : constant := #16#0000FF61; -- XKB_KEY_SunCompose : constant := #16#0000FF20; -- XKB_KEY_SunAltGraph : constant := #16#0000FF7E; -- XKB_KEY_SunPageUp : constant := #16#0000FF55; -- XKB_KEY_SunPageDown : constant := #16#0000FF56; -- XKB_KEY_SunUndo : constant := #16#0000FF65; -- XKB_KEY_SunAgain : constant := #16#0000FF66; -- XKB_KEY_SunFind : constant := #16#0000FF68; -- XKB_KEY_SunStop : constant := #16#0000FF69; -- XKB_KEY_SunProps : constant := #16#1005FF70; -- XKB_KEY_SunFront : constant := #16#1005FF71; -- XKB_KEY_SunCopy : constant := #16#1005FF72; -- XKB_KEY_SunOpen : constant := #16#1005FF73; -- XKB_KEY_SunPaste : constant := #16#1005FF74; -- XKB_KEY_SunCut : constant := #16#1005FF75; -- XKB_KEY_SunPowerSwitch : constant := #16#1005FF76; -- XKB_KEY_SunAudioLowerVolume : constant := #16#1005FF77; -- XKB_KEY_SunAudioMute : constant := #16#1005FF78; -- XKB_KEY_SunAudioRaiseVolume : constant := #16#1005FF79; -- XKB_KEY_SunVideoDegauss : constant := #16#1005FF7A; -- XKB_KEY_SunVideoLowerBrightness : constant := #16#1005FF7B; -- XKB_KEY_SunVideoRaiseBrightness : constant := #16#1005FF7C; -- XKB_KEY_SunPowerSwitchShift : constant := #16#1005FF7D; -- XKB_KEY_Dring_accent : constant := #16#1000FEB0; -- XKB_KEY_Dcircumflex_accent : constant := #16#1000FE5E; -- XKB_KEY_Dcedilla_accent : constant := #16#1000FE2C; -- XKB_KEY_Dacute_accent : constant := #16#1000FE27; -- XKB_KEY_Dgrave_accent : constant := #16#1000FE60; -- XKB_KEY_Dtilde : constant := #16#1000FE7E; -- XKB_KEY_Ddiaeresis : constant := #16#1000FE22; -- XKB_KEY_DRemove : constant := #16#1000FF00; -- XKB_KEY_hpClearLine : constant := #16#1000FF6F; -- XKB_KEY_hpInsertLine : constant := #16#1000FF70; -- XKB_KEY_hpDeleteLine : constant := #16#1000FF71; -- XKB_KEY_hpInsertChar : constant := #16#1000FF72; -- XKB_KEY_hpDeleteChar : constant := #16#1000FF73; -- XKB_KEY_hpBackTab : constant := #16#1000FF74; -- XKB_KEY_hpKP_BackTab : constant := #16#1000FF75; -- XKB_KEY_hpModelock1 : constant := #16#1000FF48; -- XKB_KEY_hpModelock2 : constant := #16#1000FF49; -- XKB_KEY_hpReset : constant := #16#1000FF6C; -- XKB_KEY_hpSystem : constant := #16#1000FF6D; -- XKB_KEY_hpUser : constant := #16#1000FF6E; -- XKB_KEY_hpmute_acute : constant := #16#100000A8; -- XKB_KEY_hpmute_grave : constant := #16#100000A9; -- XKB_KEY_hpmute_asciicircum : constant := #16#100000AA; -- XKB_KEY_hpmute_diaeresis : constant := #16#100000AB; -- XKB_KEY_hpmute_asciitilde : constant := #16#100000AC; -- XKB_KEY_hplira : constant := #16#100000AF; -- XKB_KEY_hpguilder : constant := #16#100000BE; -- XKB_KEY_hpYdiaeresis : constant := #16#100000EE; -- XKB_KEY_hpIO : constant := #16#100000EE; -- XKB_KEY_hplongminus : constant := #16#100000F6; -- XKB_KEY_hpblock : constant := #16#100000FC; -- XKB_KEY_osfCopy : constant := #16#1004FF02; -- XKB_KEY_osfCut : constant := #16#1004FF03; -- XKB_KEY_osfPaste : constant := #16#1004FF04; -- XKB_KEY_osfBackTab : constant := #16#1004FF07; -- XKB_KEY_osfBackSpace : constant := #16#1004FF08; -- XKB_KEY_osfClear : constant := #16#1004FF0B; -- XKB_KEY_osfEscape : constant := #16#1004FF1B; -- XKB_KEY_osfAddMode : constant := #16#1004FF31; -- XKB_KEY_osfPrimaryPaste : constant := #16#1004FF32; -- XKB_KEY_osfQuickPaste : constant := #16#1004FF33; -- XKB_KEY_osfPageLeft : constant := #16#1004FF40; -- XKB_KEY_osfPageUp : constant := #16#1004FF41; -- XKB_KEY_osfPageDown : constant := #16#1004FF42; -- XKB_KEY_osfPageRight : constant := #16#1004FF43; -- XKB_KEY_osfActivate : constant := #16#1004FF44; -- XKB_KEY_osfMenuBar : constant := #16#1004FF45; -- XKB_KEY_osfLeft : constant := #16#1004FF51; -- XKB_KEY_osfUp : constant := #16#1004FF52; -- XKB_KEY_osfRight : constant := #16#1004FF53; -- XKB_KEY_osfDown : constant := #16#1004FF54; -- XKB_KEY_osfEndLine : constant := #16#1004FF57; -- XKB_KEY_osfBeginLine : constant := #16#1004FF58; -- XKB_KEY_osfEndData : constant := #16#1004FF59; -- XKB_KEY_osfBeginData : constant := #16#1004FF5A; -- XKB_KEY_osfPrevMenu : constant := #16#1004FF5B; -- XKB_KEY_osfNextMenu : constant := #16#1004FF5C; -- XKB_KEY_osfPrevField : constant := #16#1004FF5D; -- XKB_KEY_osfNextField : constant := #16#1004FF5E; -- XKB_KEY_osfSelect : constant := #16#1004FF60; -- XKB_KEY_osfInsert : constant := #16#1004FF63; -- XKB_KEY_osfUndo : constant := #16#1004FF65; -- XKB_KEY_osfMenu : constant := #16#1004FF67; -- XKB_KEY_osfCancel : constant := #16#1004FF69; -- XKB_KEY_osfHelp : constant := #16#1004FF6A; -- XKB_KEY_osfSelectAll : constant := #16#1004FF71; -- XKB_KEY_osfDeselectAll : constant := #16#1004FF72; -- XKB_KEY_osfReselect : constant := #16#1004FF73; -- XKB_KEY_osfExtend : constant := #16#1004FF74; -- XKB_KEY_osfRestore : constant := #16#1004FF78; -- XKB_KEY_osfDelete : constant := #16#1004FFFF; -- XKB_KEY_Reset : constant := #16#1000FF6C; -- XKB_KEY_System : constant := #16#1000FF6D; -- XKB_KEY_User : constant := #16#1000FF6E; -- XKB_KEY_ClearLine : constant := #16#1000FF6F; -- XKB_KEY_InsertLine : constant := #16#1000FF70; -- XKB_KEY_DeleteLine : constant := #16#1000FF71; -- XKB_KEY_InsertChar : constant := #16#1000FF72; -- XKB_KEY_DeleteChar : constant := #16#1000FF73; -- XKB_KEY_BackTab : constant := #16#1000FF74; -- XKB_KEY_KP_BackTab : constant := #16#1000FF75; -- XKB_KEY_Ext16bit_L : constant := #16#1000FF76; -- XKB_KEY_Ext16bit_R : constant := #16#1000FF77; -- XKB_KEY_mute_acute : constant := #16#100000a8; -- XKB_KEY_mute_grave : constant := #16#100000a9; -- XKB_KEY_mute_asciicircum : constant := #16#100000aa; -- XKB_KEY_mute_diaeresis : constant := #16#100000ab; -- XKB_KEY_mute_asciitilde : constant := #16#100000ac; -- XKB_KEY_lira : constant := #16#100000af; -- XKB_KEY_guilder : constant := #16#100000be; -- XKB_KEY_IO : constant := #16#100000ee; -- XKB_KEY_longminus : constant := #16#100000f6; -- XKB_KEY_block : constant := #16#100000fc; end XKB.Keysyms;
-- -- Copyright (C) 2016 secunet Security Networks AG -- -- This program is free software; you can redistribute it and/or modify -- it under the terms of the GNU General Public License as published by -- the Free Software Foundation; either version 2 of the License, or -- (at your option) any later version. -- -- This program is distributed in the hope that it will be useful, -- but WITHOUT ANY WARRANTY; without even the implied warranty of -- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -- GNU General Public License for more details. -- with HW.Time; with HW.GFX.GMA.Config; with HW.GFX.GMA.Registers; package body HW.GFX.GMA.Power_And_Clocks is FSB_FREQ_SEL_MASK : constant := 7 * 2 ** 0; CLKCFG_FSB_400 : constant Frequency_Type := 100_000_000; CLKCFG_FSB_533 : constant Frequency_Type := 133_333_333; CLKCFG_FSB_667 : constant Frequency_Type := 166_666_666; CLKCFG_FSB_800 : constant Frequency_Type := 200_000_000; CLKCFG_FSB_1067 : constant Frequency_Type := 266_666_666; CLKCFG_FSB_1333 : constant Frequency_Type := 333_333_333; -- The Raw Freq is 1/4 of the FSB freq procedure Initialize is CLK_CFG : Word32; type Freq_Sel is new Natural range 0 .. 7; begin Registers.Read (Register => Registers.GMCH_CLKCFG, Value => CLK_CFG); case Freq_Sel (CLK_CFG and FSB_FREQ_SEL_MASK) is when 0 => Config.Raw_Clock := CLKCFG_FSB_1067; when 1 => Config.Raw_Clock := CLKCFG_FSB_533; when 2 => Config.Raw_Clock := CLKCFG_FSB_800; when 3 => Config.Raw_Clock := CLKCFG_FSB_667; when 4 => Config.Raw_Clock := CLKCFG_FSB_1333; when 5 => Config.Raw_Clock := CLKCFG_FSB_400; when 6 => Config.Raw_Clock := CLKCFG_FSB_1067; when 7 => Config.Raw_Clock := CLKCFG_FSB_1333; end case; end Initialize; end HW.GFX.GMA.Power_And_Clocks;
with Terminal_Interface.Curses; use Terminal_Interface.Curses; with Ada.Characters.Latin_1; use Ada.Characters.Latin_1; with GNAT.Regpat; use GNAT.Regpat; with Ada.Strings.Unbounded; use Ada.Strings.Unbounded; with Ada.Text_IO.Unbounded_IO; with Ada.Strings.Fixed; with Ada.Containers; use Ada.Containers; with Ada.Containers.Vectors; with Ada.Containers.Indefinite_Ordered_Maps; with gnatcoll.SQL.Postgres; use gnatcoll.SQL.Postgres; with gnatcoll.SQL.Exec; use gnatcoll.SQL.Exec; with Ada.Calendar; use Ada.Calendar; with Ada.Calendar.Formatting; use Ada.Calendar.Formatting; with Dbase; with Texaco; with Process_Menu; with Formatter; -- with Dbase.DrackSpace; with Ada.Numerics.Generic_Elementary_Functions; with Ada.Numerics.discrete_Random; with Ada.Containers.Synchronized_Queue_Interfaces; with Ada.Containers.Unbounded_Synchronized_Queues; generic package Templates is package SU renames Ada.Strings.Unbounded; package SUIO renames Ada.Text_IO.Unbounded_IO; package SF renames Ada.Strings.Fixed; package Screen_Vector is new Ada.Containers.Vectors (Natural, Unbounded_String); use Screen_Vector; type Edit_Fields_Record is record Name : Unbounded_String; Row : Line_Position; Col : Column_Position; Length : Integer; Edited : Boolean := False; NoEdit : Boolean := False; end record; package Edit_Fields_Vector is new Ada.Containers.Vectors (Natural, Edit_Fields_Record); use Edit_Fields_Vector; package Current_Record_Maps is new Ada.Containers.Indefinite_Ordered_Maps (Key_Type => Unbounded_String, Element_Type => Unbounded_String); use Current_Record_Maps; Current_Record : Map; Current_Record_Updated : Boolean := False; ScreenList : Screen_Vector.Vector; FieldsList : Screen_Vector.Vector; EditFieldsList : Edit_Fields_Vector.Vector; Display_Window : Window; SaveTableName : Unbounded_String; DebugMode : Boolean := False; type Days_of_Week is (Sunday, Monday, Tuesday, Wednesday, Thursday, Friday, Saturday); package Ada_Format is new Formatter (Enumerated => Days_of_Week); use Ada_Format; -- Direct visibility of F conversion functions subtype Value_Type is Long_Long_Float; package Value_Functions is new Ada.Numerics.Generic_Elementary_Functions ( Value_Type); use Value_Functions; type Work_Item is record Ship_ID :Unbounded_String; -- new Integer; --range 1 .. 100; end record; package Work_Item_Queue_Interfaces is new Ada.Containers.Synchronized_Queue_Interfaces (Element_Type => Unbounded_String); package Work_Item_Queues is new Ada.Containers.Unbounded_Synchronized_Queues (Queue_Interfaces => Work_Item_Queue_Interfaces); Firing_Queue : Work_Item_Queues.Queue; Torpedo_Firing_Queue : Work_Item_Queues.Queue; Torpedo_Tube2_Firing_Queue : Work_Item_Queues.Queue; procedure Redraw_Page ; procedure Edit_Page ; procedure Command_Screen; procedure Set_Default (Fldnme : String; Default : String); procedure Close_Page; -- function Initialise (CI :Direct_Cursor; TableName : String) return Boolean; function Initialise (CI :Direct_Cursor; TableName : String; NewRecord : Boolean := False; NoWindow : Boolean := False ) return Boolean; procedure Inflict_Damage (ShipID : Unbounded_String; DamageX : Integer := 1; WeaponRange : Long_Long_Float := 200.0; Win : Window); procedure Fire_Lasers (Ship_ID : Unbounded_String); procedure Fire_Torpedo (Ship_ID : Unbounded_String); procedure Fire_Tube2_Torpedo (Ship_ID : Unbounded_String); procedure Torpedo_Control (ShipID : Unbounded_String; Win : Window); end Templates;
-- Ada regular expression library -- (c) Kristian Klomsten Skordal 2020 <kristian.skordal@wafflemail.net> -- Report bugs and issues on <https://github.com/skordal/ada-regex> with Regex.Syntax_Trees; with Regex.State_Machines; private with Ada.Finalization; package Regex.Regular_Expressions is -- Regex engine exceptions: Syntax_Error : exception; Unsupported_Feature : exception; -- Regular expression object: type Regular_Expression is tagged limited private; -- Creates a regular expression object from a regular expression string: function Create (Input : in String) return Regular_Expression; -- Creates a regular expression object from an existing syntax tree: function Create (Input : in Regex.Syntax_Trees.Syntax_Tree_Node_Access) return Regular_Expression; -- Gets the syntax tree of a regular expression: function Get_Syntax_Tree (This : in Regular_Expression) return Regex.Syntax_Trees.Syntax_Tree_Node_Access with Inline; -- Gets the state machine generated by a regular expression: function Get_State_Machine (This : in Regular_Expression) return Regex.State_Machines.State_Machine_State_Vectors.Vector with Inline; -- Gets the start state of a regular expression: function Get_Start_State (This : in Regular_Expression) return Regex.State_Machines.State_Machine_State_Access with Inline; private use Regex.State_Machines; use Regex.Syntax_Trees; -- Complete regular expression object type: type Regular_Expression is new Ada.Finalization.Limited_Controlled with record Syntax_Tree : Syntax_Tree_Node_Access := null; -- Syntax tree kept around for debugging Syntax_Tree_Node_Count : Natural := 1; -- Counter used to number nodes and keep count State_Machine_States : State_Machine_State_Vectors.Vector := State_Machine_State_Vectors.Empty_Vector; Start_State : State_Machine_State_Access; end record; -- Frees a regular expression object: overriding procedure Finalize (This : in out Regular_Expression); -- Gets the next node ID: function Get_Next_Node_Id (This : in out Regular_Expression) return Natural with Inline; -- Parses a regular expression and constructs a syntax tree: procedure Parse (Input : in String; Output : in out Regular_Expression); -- Compiles a regular expression into a state machine: procedure Compile (Output : in out Regular_Expression); end Regex.Regular_Expressions;
with Ada.Colors; with Ada.Numerics; procedure Color is use type Ada.Colors.RGB; P : constant := 16#0.0001#; -- 1/65536 begin -- distances in HSV pragma Assert ( abs ( Ada.Colors.HSV_Distance ( (Hue => 0.0, Saturation => 0.0, Value => 1.0), (Hue => Ada.Numerics.Pi / 2.0, Saturation => 0.0, Value => 1.0)) - 0.0) < P); pragma Assert ( abs ( Ada.Colors.HSV_Distance ( (Hue => 0.0, Saturation => 1.0, Value => 1.0), (Hue => Ada.Numerics.Pi / 2.0, Saturation => 1.0, Value => 1.0)) - 0.5) < P); -- Sqrt (2.0) ** 2 / 2.0 = 0.5 pragma Assert ( abs ( Ada.Colors.HSV_Distance ( (Hue => 0.0, Saturation => 1.0, Value => 1.0), (Hue => Ada.Numerics.Pi, Saturation => 1.0, Value => 1.0)) - 1.0) < P); -- distances in HSL pragma Assert ( abs ( Ada.Colors.HSL_Distance ( (Hue => 0.0, Saturation => 1.0, Lightness => 1.0), (Hue => Ada.Numerics.Pi / 2.0, Saturation => 1.0, Lightness => 1.0)) - 0.0) < P); pragma Assert ( abs ( Ada.Colors.HSL_Distance ( (Hue => 0.0, Saturation => 1.0, Lightness => 0.5), (Hue => Ada.Numerics.Pi / 2.0, Saturation => 1.0, Lightness => 0.5)) - 0.5) < P); -- Sqrt (2.0) ** 2 / 2.0 = 0.5 pragma Assert ( abs ( Ada.Colors.HSL_Distance ( (Hue => 0.0, Saturation => 1.0, Lightness => 0.0), (Hue => Ada.Numerics.Pi / 2.0, Saturation => 1.0, Lightness => 0.0)) - 0.0) < P); -- conversions for R in 0 .. 4 loop for G in 0 .. 4 loop for B in 0 .. 4 loop declare Original_RGB : constant Ada.Colors.RGB := ( Red => Ada.Colors.Brightness'Base (R) / 4.0, Green => Ada.Colors.Brightness'Base (G) / 4.0, Blue => Ada.Colors.Brightness'Base (B) / 4.0); HSV : constant Ada.Colors.HSV := Ada.Colors.To_HSV (Original_RGB); HSV_RGB : constant Ada.Colors.RGB := Ada.Colors.To_RGB (HSV); HSV_HSL : constant Ada.Colors.HSL := Ada.Colors.To_HSL (HSV); HSL : constant Ada.Colors.HSL := Ada.Colors.To_HSL (Original_RGB); HSL_RGB : constant Ada.Colors.RGB := Ada.Colors.To_RGB (HSL); HSL_HSV : constant Ada.Colors.HSV := Ada.Colors.To_HSV (HSL); begin -- RGB / HSV pragma Assert ( abs (HSV_RGB.Red - Original_RGB.Red) < P and then abs (HSV_RGB.Green - Original_RGB.Green) < P and then abs (HSV_RGB.Blue - Original_RGB.Blue) < P); pragma Assert (Ada.Colors.RGB_Distance (HSV_RGB, Original_RGB) < P); -- RGB / HSL pragma Assert ( abs (HSL_RGB.Red - Original_RGB.Red) < P and then abs (HSL_RGB.Green - Original_RGB.Green) < P and then abs (HSL_RGB.Blue - Original_RGB.Blue) < P); pragma Assert (Ada.Colors.RGB_Distance (HSL_RGB, Original_RGB) < P); -- HSV / HSL pragma Assert ( abs (HSL_HSV.Hue - HSV.Hue) < P and then abs (HSL_HSV.Saturation - HSV.Saturation) < P and then abs (HSL_HSV.Value - HSV.Value) < P); pragma Assert ( abs (HSV_HSL.Hue - HSL.Hue) < P and then abs (HSV_HSL.Saturation - HSL.Saturation) < P and then abs (HSV_HSL.Lightness - HSL.Lightness) < P); null; end; end loop; end loop; end loop; pragma Debug (Ada.Debug.Put ("OK")); end Color;
-- The Cupcake GUI Toolkit -- (c) Kristian Klomsten Skordal 2012 <kristian.skordal@gmail.com> -- Report bugs and issues on <http://github.com/skordal/cupcake/issues> -- vim:ts=3:sw=3:et:si:sta package Cupcake.Primitives is -- Simple point type: type Point is record X, Y : Integer; end record; -- Point operators: function "+" (Left, Right : in Point) return Point with Inline, Pure_Function; function "-" (Left, Right : in Point) return Point with Inline, Pure_Function; function "=" (Left, Right : in Point) return Boolean with Inline, Pure_Function; -- Type for specifying dimensions: type Dimension is record Width, Height : Natural; end record; -- Dimension operators: function "<" (Left, Right : in Dimension) return Boolean with Inline, Pure_Function; function ">" (Left, Right : in Dimension) return Boolean with Inline, Pure_Function; function "=" (Left, Right : in Dimension) return Boolean with Inline, Pure_Function; -- Rectangle type: type Rectangle is record Origin : Point; Size : Dimension; end record; -- Line type: type Line is record Start : Point; Endpoint : Point; end record; end Cupcake.Primitives;
-- Recurve - recover curves from a chart (in JPEG, PNG, or other image format) -- -- Currently supports only charts on a white background -- -- By David Malinge and Gautier de Montmollin -- -- Started 28-Jun-2016 with GID; with Ada.Calendar; with Ada.Characters.Handling; use Ada.Characters.Handling; with Ada.Command_Line; use Ada.Command_Line; with Ada.Streams.Stream_IO; with Ada.Text_IO; use Ada.Text_IO; with Ada.Unchecked_Deallocation; with Interfaces; procedure Recurve is -- Parameters thres_grid : constant := 0.925; -- avg intensity below thres_grid => grid line thres_curve : constant := 0.8; -- intensity below thres_curve => curve thres_simil_2 : constant := 0.16 ** 2; -- similarity within curve thres_simil_start_2 : constant := 0.40 ** 2; -- similarity when scanning for curves radius : constant := 0.08; -- in proportion of image width full_disc_radius : constant := 0.003; full_disc_radius_pix : constant := 3; interval_verticals : constant := 15; start_verticals : constant := 0; -- > 0 for more vertical initial scans sep: constant Character:= ';'; procedure Blurb is begin Put_Line(Standard_Error, "Recurve * Recover from a chart in any image format"); New_Line(Standard_Error); Put_Line(Standard_Error, "GID version " & GID.version & " dated " & GID.reference); Put_Line(Standard_Error, "URL: " & GID.web); New_Line(Standard_Error); Put_Line(Standard_Error, "Syntax:"); Put_Line(Standard_Error, " recurve <image>"); New_Line(Standard_Error); Put_Line(Standard_Error, "Output:"); Put_Line(Standard_Error, " <image>.csv"); New_Line(Standard_Error); end Blurb; use Interfaces; subtype Primary_color_range is Unsigned_8; subtype Real is Long_Float; type RGB is record r,g,b: Real; end record; function Grey(c: RGB) return Real is begin return (c.r + c.g + c.b) / 3.0; end Grey; function Dist2(c1,c2: RGB) return Real is begin return (c1.r - c2.r) ** 2 + (c1.g - c2.g) ** 2 + (c1.b - c2.b) ** 2; end Dist2; function Img(c: RGB) return String is begin return " R:" & Integer'Image(Integer(c.r * 255.0)) & " G:" & Integer'Image(Integer(c.g * 255.0)) & " B:" & Integer'Image(Integer(c.b * 255.0)); end Img; -- Bidimensional array. Slower than unidimensional, but fits our purpose. type Bitmap is array(Integer range <>, Integer range <>) of RGB; type p_Bitmap is access Bitmap; procedure Dispose is new Ada.Unchecked_Deallocation(Bitmap, p_Bitmap); -- Load image procedure Load_raw_image( image : in out GID.Image_descriptor; bmp : in out p_Bitmap; next_frame: out Ada.Calendar.Day_Duration ) is image_width : constant Positive:= GID.Pixel_width(image); image_height: constant Positive:= GID.Pixel_height(image); pos_x, pos_y: Natural; -- -- Generic parameters to feed GID.Load_image_contents with. -- procedure Set_X_Y (x, y: Natural) is begin pos_x:= x; pos_y:= y; end Set_X_Y; -- procedure Put_Pixel ( red, green, blue : Primary_color_range; alpha : Primary_color_range ) is pragma Warnings(off, alpha); -- alpha is just ignored begin bmp(pos_x, bmp'Last(2) - pos_y):= (Real(red) / 255.0, Real(green) / 255.0, Real(blue) / 255.0 ); pos_x:= pos_x + 1; -- ^ GID requires us to look to next pixel on the right for next time. end Put_Pixel; -- stars: Natural:= 0; procedure Feedback(percents: Natural) is so_far: constant Natural:= percents / 5; begin for i in stars+1..so_far loop Put( Standard_Error, '*'); end loop; stars:= so_far; end Feedback; -- -- Instantiation of GID.Load_image_contents. -- procedure Load_image is new GID.Load_image_contents( Primary_color_range, Set_X_Y, Put_Pixel, Feedback, GID.fast ); -- begin Dispose(bmp); bmp:= new Bitmap(0..image_width-1, 0..image_height-1); Load_image(image, next_frame); end Load_raw_image; bmp: p_Bitmap:= null; -------------------------------------------------------------------------------- -- Identify curves in an image file; write a .csv file with the data points -- -------------------------------------------------------------------------------- procedure Detect_curves(file_name: String) is grid_hor: array(bmp'Range(2)) of Boolean:= (others => False); grid_ver: array(bmp'Range(1)) of Boolean:= (others => False); v: Real; done: array(bmp'Range(1), bmp'Range(2)) of Boolean:= (others => (others => False)); -- color_scanned: array(0..255, 0..255, 0..255) of Boolean:= ... mmmh too big type Curve_ys is array(bmp'Range(1)) of Real; type Curve_descr is record ys: Curve_ys:= (others => -1.0); -- Convention: undefined y-value is < 0 min_x: Integer:= Integer'Last; max_x: Integer:= Integer'First; color: RGB; end record; procedure Interpolate(c: in out Curve_descr) is -- We will interpolate between (x1, c.ys(x1)) and (x2, c.ys(x2)). -- -- y1 none [...] y2 -- -- x1 x1+1 [...] x2 y1, y2: Real; begin for x1 in c.min_x .. c.max_x loop y1:= c.ys(x1); if y1 >= 0.0 and then x1+1 <= c.max_x and then c.ys(x1+1) < 0.0 then for x2 in x1+2 .. c.max_x loop y2:= c.ys(x2); if y2 >= 0.0 then -- Linear interpolation is happening here. for x in x1+1 .. x2-1 loop c.ys(x):= (Real(x-x1) / Real(x2-x1)) * (y2-y1) + y1; end loop; exit; end if; end loop; end if; end loop; end Interpolate; Curve_Stack: array(1..bmp'Length(2)) of Curve_descr; curve_top: Natural:= 0; procedure Scan_curve(x0, y0, xd: Integer) is curv: Curve_descr renames Curve_Stack(curve_top); c: RGB renames curv.color; -- procedure Mark_point(x, y: Integer) is begin done(x,y):= True; curv.min_x:= Integer'Min(curv.min_x, x); curv.max_x:= Integer'Max(curv.max_x, x); end Mark_point; -- x_sum, y_sum: Natural; found: Natural; procedure Test_point(xt, yt: Integer) is begin if xt in bmp'Range(1) and then yt in bmp'Range(2) and then (not done(xt, yt)) and then Dist2(bmp(xt,yt), c) < thres_simil_2 then x_sum:= x_sum + xt; y_sum:= y_sum + yt; Mark_point(xt, yt); found:= found + 1; end if; end Test_point; -- x: Integer:= x0; y: Integer:= y0; -- procedure Check_single_radius(r: Positive) is begin for xs in 1..r loop for ys in 0..r loop if xs**2 + ys**2 in (r-1)**2 .. r**2 then Test_point( x + xs * xd, -- xd = direction, left or right y - ys -- Below ); Test_point( x + xs * xd, -- xd = direction, left or right y + ys -- Above ); end if; end loop; end loop; end Check_single_radius; -- ring_rad: constant Integer:= Integer(radius*Real(bmp'Length(1))); disc_rad: constant Integer:= Integer'Max ( full_disc_radius_pix, Integer (full_disc_radius * Real(bmp'Length(1))) ); y_subpixel : Real := Real (y); begin Mark_point (x,y); Scan: loop -- We register (x, y) into the curve information. -- It is either the starting point, or the average -- matching point of previous iteration. curv.ys (x):= Real(bmp'Last(2)) - y_subpixel; -- Now, try to find the next point of the curve in the direction xd. found := 0; x_sum := 0; y_sum := 0; -- Explore a half-disc for rad in 1 .. disc_rad loop Check_single_radius (rad); end loop; if found = 0 then -- Continue searching, but stop when one half-ring is successful for rad in disc_rad+1 .. ring_rad loop Check_single_radius (rad); exit when found > 0; end loop; end if; exit Scan when found = 0; -- No matching point anywhere in search half-disc. -- Next (x,y) point will be the average of near matching points found x := x_sum / found; y := y_sum / found; y_subpixel := Real (y_sum) / Real (found); -- Non-rounded average y value. -- At this point, we are ready to scan next pixel (x, y) of the curve. exit Scan when x not in bmp'Range(1); end loop Scan; end Scan_curve; x0: Integer; color0: RGB; f: File_Type; min_min_x: Integer:= Integer'Last; max_max_x: Integer:= Integer'First; mid: constant Integer:= bmp'Last(1) / 2; begin New_Line; -- -- Detect vertical gridlines - and some noise... -- for x in bmp'Range(1) loop v:= 0.0; for y in bmp'Range(2) loop v:= v + Grey(bmp(x,y)); end loop; v:= v / Real(bmp'Length(2)); if v < thres_grid then grid_ver(x):= True; Put_Line("Vertical: " & Integer'Image(x)); end if; end loop; -- -- Detect horizontal gridlines - and some noise... -- for y in bmp'Range(2) loop v:= 0.0; for x in bmp'Range(1) loop v:= v + Grey(bmp(x,y)); end loop; v:= v / Real(bmp'Length(1)); if v < thres_grid then grid_hor(y):= True; Put_Line("Horizontal: " & Integer'Image(y)); end if; end loop; -- -- Main scan for curves, start in a band in the middle -- Why not just a single vertical line ? -- A curve could be hidden by another one just in that place. -- for sv in -start_verticals/2 .. start_verticals/2 loop x0:= mid + sv * interval_verticals; if x0 in bmp'Range(1) and then not grid_ver(x0) then for y in bmp'Range(2) loop color0:= bmp(x0,y); if (not grid_hor(y)) and then Grey(color0) < thres_curve and then not done(x0,y) then if y > 0 and then done(x0,y-1) and then Dist2(bmp(x0,y-1), color0) < thres_simil_start_2 then done(x0,y):= True; -- Actually the same, fat curve as one pixel above -- elsif x0 > 0 and then done(x0-1,y) and then Dist2(bmp(x0-1,y), color0) < thres_simil_start_2 then -- done(x0,y):= True; -- Actually the same curve as one pixel left else Put_Line("curve: " & Integer'Image(x0) & Integer'Image(y)); curve_top:= curve_top + 1; Curve_Stack(curve_top).color:= color0; -- Following idea is from a humanitarian star who used to send -- two camera teams in opposite directions in conflict areas: Scan_curve(x0, y, -1); Scan_curve(x0, y, +1); end if; end if; end loop; end if; end loop; -- -- Finalization -- for i in 1..curve_top loop min_min_x:= Integer'Min(min_min_x, Curve_Stack(i).min_x); max_max_x:= Integer'Max(max_max_x, Curve_Stack(i).max_x); Interpolate(Curve_Stack(i)); end loop; -- -- Output curves -- Create(f, Out_File, file_name & ".csv"); Put_Line(f, "Recurve output"); Put(f, "Color"); for i in 1..curve_top loop Put(f, sep & Img(Curve_Stack(i).color)); end loop; New_Line(f); Put(f, 'x'); for i in 1..curve_top loop Put(f, sep & 'y' & Integer'Image(i)); end loop; New_Line(f); for x in min_min_x .. max_max_x loop Put(f, Integer'Image(x)); for i in 1..curve_top loop Put(f, sep); if x in Curve_Stack(i).min_x .. Curve_Stack(i).max_x and then Curve_Stack(i).ys(x) >= 0.0 then Put(f, Real'Image(Curve_Stack(i).ys(x))); end if; end loop; New_Line(f); end loop; Close(f); end Detect_curves; procedure Process(file_name: String) is use Ada.Streams.Stream_IO; f: Ada.Streams.Stream_IO.File_Type; i: GID.Image_descriptor; up_name: constant String:= To_Upper(file_name); -- next_frame: Ada.Calendar.Day_Duration:= 0.0; begin -- -- Load the image in its original format -- Open(f, In_File, file_name); Put_Line(Standard_Error, "Processing " & file_name & "..."); -- GID.Load_image_header( i, Stream(f).all, try_tga => file_name'Length >= 4 and then up_name(up_name'Last-3..up_name'Last) = ".TGA" ); Put_Line(Standard_Error, ".........v.........v"); -- Load_raw_image(i, bmp, next_frame); Detect_curves(file_name); New_Line(Standard_Error); Close(f); end Process; begin if Argument_Count=0 then Blurb; return; end if; for i in 1..Argument_Count loop Process(Argument(i)); end loop; end Recurve;
pragma License (Unrestricted); with System.Storage_Elements; with System.Storage_Pools.Standard_Pools; package GNAT.Debug_Pools is type Debug_Pool is new System.Storage_Pools.Standard_Pools.Standard_Pool with null record; subtype SSC is System.Storage_Elements.Storage_Count; Default_Max_Freed : constant SSC := 50_000_000; Default_Stack_Trace_Depth : constant Natural := 20; Default_Reset_Content : constant Boolean := False; Default_Raise_Exceptions : constant Boolean := True; Default_Advanced_Scanning : constant Boolean := False; Default_Min_Freed : constant SSC := 0; Default_Errors_To_Stdout : constant Boolean := True; Default_Low_Level_Traces : constant Boolean := False; procedure Configure ( Pool : in out Debug_Pool; Stack_Trace_Depth : Natural := Default_Stack_Trace_Depth; Maximum_Logically_Freed_Memory : SSC := Default_Max_Freed; Minimum_To_Free : SSC := Default_Min_Freed; Reset_Content_On_Free : Boolean := Default_Reset_Content; Raise_Exceptions : Boolean := Default_Raise_Exceptions; Advanced_Scanning : Boolean := Default_Advanced_Scanning; Errors_To_Stdout : Boolean := Default_Errors_To_Stdout; Low_Level_Traces : Boolean := Default_Low_Level_Traces) is null; -- unimplemented type Report_Type is (All_Reports); generic with procedure Put_Line (S : String) is <>; with procedure Put (S : String) is <>; procedure Dump ( Pool : Debug_Pool; Size : Positive; Report : Report_Type := All_Reports); procedure Dump_Stdout ( Pool : Debug_Pool; Size : Positive; Report : Report_Type := All_Reports); procedure Reset is null; -- unimplemented procedure Get_Size ( Storage_Address : System.Address; Size_In_Storage_Elements : out System.Storage_Elements.Storage_Count; Valid : out Boolean); type Byte_Count is mod System.Max_Binary_Modulus; function High_Water_Mark (Pool : Debug_Pool) return Byte_Count; function Current_Water_Mark (Pool : Debug_Pool) return Byte_Count; procedure System_Memory_Debug_Pool ( Has_Unhandled_Memory : Boolean := True) is null; -- unimplemented end GNAT.Debug_Pools;
with Ada.Numerics.Generic_Elementary_Functions; with Ada.Text_IO; procedure Closest is package Math is new Ada.Numerics.Generic_Elementary_Functions (Float); Dimension : constant := 2; type Vector is array (1 .. Dimension) of Float; type Matrix is array (Positive range <>) of Vector; -- calculate the distance of two points function Distance (Left, Right : Vector) return Float is Result : Float := 0.0; Offset : Natural := 0; begin loop Result := Result + (Left(Left'First + Offset) - Right(Right'First + Offset))**2; Offset := Offset + 1; exit when Offset >= Left'Length; end loop; return Math.Sqrt (Result); end Distance; -- determine the two closest points inside a cloud of vectors function Get_Closest_Points (Cloud : Matrix) return Matrix is Result : Matrix (1..2); Min_Distance : Float; begin if Cloud'Length(1) < 2 then raise Constraint_Error; end if; Result := (Cloud (Cloud'First), Cloud (Cloud'First + 1)); Min_Distance := Distance (Cloud (Cloud'First), Cloud (Cloud'First + 1)); for I in Cloud'First (1) .. Cloud'Last(1) - 1 loop for J in I + 1 .. Cloud'Last(1) loop if Distance (Cloud (I), Cloud (J)) < Min_Distance then Min_Distance := Distance (Cloud (I), Cloud (J)); Result := (Cloud (I), Cloud (J)); end if; end loop; end loop; return Result; end Get_Closest_Points; Test_Cloud : constant Matrix (1 .. 10) := ( (5.0, 9.0), (9.0, 3.0), (2.0, 0.0), (8.0, 4.0), (7.0, 4.0), (9.0, 10.0), (1.0, 9.0), (8.0, 2.0), (0.0, 10.0), (9.0, 6.0)); Closest_Points : Matrix := Get_Closest_Points (Test_Cloud); Second_Test : constant Matrix (1 .. 10) := ( (0.654682, 0.925557), (0.409382, 0.619391), (0.891663, 0.888594), (0.716629, 0.9962), (0.477721, 0.946355), (0.925092, 0.81822), (0.624291, 0.142924), (0.211332, 0.221507), (0.293786, 0.691701), (0.839186, 0.72826)); Second_Points : Matrix := Get_Closest_Points (Second_Test); begin Ada.Text_IO.Put_Line ("Closest Points:"); Ada.Text_IO.Put_Line ("P1: " & Float'Image (Closest_Points (1) (1)) & " " & Float'Image (Closest_Points (1) (2))); Ada.Text_IO.Put_Line ("P2: " & Float'Image (Closest_Points (2) (1)) & " " & Float'Image (Closest_Points (2) (2))); Ada.Text_IO.Put_Line ("Distance: " & Float'Image (Distance (Closest_Points (1), Closest_Points (2)))); Ada.Text_IO.Put_Line ("Closest Points 2:"); Ada.Text_IO.Put_Line ("P1: " & Float'Image (Second_Points (1) (1)) & " " & Float'Image (Second_Points (1) (2))); Ada.Text_IO.Put_Line ("P2: " & Float'Image (Second_Points (2) (1)) & " " & Float'Image (Second_Points (2) (2))); Ada.Text_IO.Put_Line ("Distance: " & Float'Image (Distance (Second_Points (1), Second_Points (2)))); end Closest;
------------------------------------------------------------------------------ -- -- -- GNAT COMPILER COMPONENTS -- -- -- -- F N A M E -- -- -- -- B o d y -- -- -- -- Copyright (C) 1992-2004, 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. -- -- -- ------------------------------------------------------------------------------ with Alloc; with Hostparm; use Hostparm; with Namet; use Namet; with Table; package body Fname is ----------------------------- -- Dummy Table Definitions -- ----------------------------- -- The following table was used in old versions of the compiler. We retain -- the declarations here for compatibility with old tree files. The new -- version of the compiler does not use this table, and will write out a -- dummy empty table for Tree_Write. type SFN_Entry is record U : Unit_Name_Type; F : File_Name_Type; end record; package SFN_Table is new Table.Table ( Table_Component_Type => SFN_Entry, Table_Index_Type => Int, Table_Low_Bound => 0, Table_Initial => Alloc.SFN_Table_Initial, Table_Increment => Alloc.SFN_Table_Increment, Table_Name => "Fname_Dummy_Table"); --------------------------- -- Is_Internal_File_Name -- --------------------------- function Is_Internal_File_Name (Fname : File_Name_Type; Renamings_Included : Boolean := True) return Boolean is begin if Is_Predefined_File_Name (Fname, Renamings_Included) then return True; -- Once Is_Predefined_File_Name has been called and returns False, -- Name_Buffer contains Fname and Name_Len is set to 8. elsif Name_Buffer (1 .. 2) = "g-" or else Name_Buffer (1 .. 8) = "gnat " then return True; elsif OpenVMS and then (Name_Buffer (1 .. 4) = "dec-" or else Name_Buffer (1 .. 8) = "dec ") then return True; else return False; end if; end Is_Internal_File_Name; ----------------------------- -- Is_Predefined_File_Name -- ----------------------------- -- This should really be a test of unit name, given the possibility of -- pragma Source_File_Name setting arbitrary file names for any files??? -- Once Is_Predefined_File_Name has been called and returns False, -- Name_Buffer contains Fname and Name_Len is set to 8. This is used -- only by Is_Internal_File_Name, and is not part of the official -- external interface of this function. function Is_Predefined_File_Name (Fname : File_Name_Type; Renamings_Included : Boolean := True) return Boolean is begin Get_Name_String (Fname); return Is_Predefined_File_Name (Renamings_Included); end Is_Predefined_File_Name; function Is_Predefined_File_Name (Renamings_Included : Boolean := True) return Boolean is subtype Str8 is String (1 .. 8); Predef_Names : constant array (1 .. 11) of Str8 := ("ada ", -- Ada "calendar", -- Calendar "interfac", -- Interfaces "system ", -- System "machcode", -- Machine_Code "unchconv", -- Unchecked_Conversion "unchdeal", -- Unchecked_Deallocation -- Remaining entries are only considered if Renamings_Included true "directio", -- Direct_IO "ioexcept", -- IO_Exceptions "sequenio", -- Sequential_IO "text_io "); -- Text_IO Num_Entries : constant Natural := 7 + 4 * Boolean'Pos (Renamings_Included); begin -- Remove extension (if present) if Name_Len > 4 and then Name_Buffer (Name_Len - 3) = '.' then Name_Len := Name_Len - 4; end if; -- Definitely false if longer than 12 characters (8.3) if Name_Len > 8 then return False; -- Definitely predefined if prefix is a- i- or s- followed by letter elsif Name_Len >= 3 and then Name_Buffer (2) = '-' and then (Name_Buffer (1) = 'a' or else Name_Buffer (1) = 'i' or else Name_Buffer (1) = 's') and then (Name_Buffer (3) in 'a' .. 'z' or else Name_Buffer (3) in 'A' .. 'Z') then return True; end if; -- Otherwise check against special list, first padding to 8 characters while Name_Len < 8 loop Name_Len := Name_Len + 1; Name_Buffer (Name_Len) := ' '; end loop; for J in 1 .. Num_Entries loop if Name_Buffer (1 .. 8) = Predef_Names (J) then return True; end if; end loop; -- Note: when we return False here, the Name_Buffer contains the -- padded file name. This is not defined for clients of the package, -- but is used by Is_Internal_File_Name. return False; end Is_Predefined_File_Name; --------------- -- Tree_Read -- --------------- procedure Tree_Read is begin SFN_Table.Tree_Read; end Tree_Read; ---------------- -- Tree_Write -- ---------------- procedure Tree_Write is begin SFN_Table.Tree_Write; end Tree_Write; end Fname;
package body Adda.Generator is use Successors; overriding procedure Initialize (Object : in out Decision_Diagram) is begin if Object.Data /= null then Object.Data.Reference_Counter.all := Object.Data.Reference_Counter.all + 1; end if; end Initialize; overriding procedure Adjust (Object : in out Decision_Diagram) renames Initialize; overriding procedure Finalize (Object : in out Decision_Diagram) is begin if Object.Data /= null then Object.Data.Reference_Counter.all := Object.Data.Reference_Counter.all - 1; if Object.Data.Reference_Counter.all = 0 then null; -- FIXME end if; end if; end Finalize; function Hash (Element : in Decision_Diagram) return Hash_Type is begin return Hash_Type (Element.Data.Identifier); end Hash; function "=" (Left, Right : in Decision_Diagram) return Boolean is begin return Left.Data = Right.Data; -- TODO: check that it is a pointer comparison end "="; function Hash (Element : in Structure) return Hash_Type is begin case Element.Of_Type is when Terminal => return Hash_Terminal (Element.Value); when Non_Terminal => declare Result : Hash_Type := Hash_Variable (Element.Variable); Current : Successors.Cursor := Successors.First (Element.Alpha); begin while Successors.Has_Element (Current) loop Result := Result xor (Hash_Value (Successors.Key (Current)) xor Hash (Successors.Element (Current))); Successors.Next (Current); end loop; return Result; end; end case; end Hash; overriding function "=" (Left, Right : in Structure) return Boolean is begin if Left.Of_Type = Right.Of_Type then case Left.Of_Type is when Terminal => return Left.Value = Right.Value; when Non_Terminal => return Left.Variable = Right.Variable and then Left.Alpha = Right.Alpha; end case; else return False; end if; end "="; function Make (Value : in Terminal_Type) return Decision_Diagram is To_Insert : constant Structure := (Of_Type => Terminal, Identifier => 0, Reference_Counter => null, Value => Value); Position : Unicity.Cursor; Inserted : Boolean; begin Unicity_Table.Insert (New_Item => To_Insert, Position => Position, Inserted => Inserted); declare Subdata : aliased Structure := Unicity.Element (Position); Data : constant Any_Structure := Subdata'Unchecked_Access; begin if Inserted then Identifier := Identifier + 1; Subdata.Identifier := Identifier + 1; Subdata.Reference_Counter := new Natural'(0); end if; return (Controlled with Data => Data); end; end Make; function Make (Variable : in Variable_Type; Value : in Value_Type; Successor : in Decision_Diagram) return Decision_Diagram is Result : Decision_Diagram; begin return Result; end Make; begin null; end Adda.Generator;
package Rational is type Rat is private; function Create(num : in Long_Long_Integer; den : in Long_Long_Integer) return Rat; function Numerator(r : in Rat) return Long_Long_Integer; function Denomonator(r : in Rat) return Long_Long_Integer; function "+" (left, right: in Rat) return Rat; function "-" (left, right: in Rat) return Rat; function "*" (left, right: in Rat) return Rat; function Inverse(r : in Rat) return Rat; function Normalize(r : in Rat) return Rat; procedure Inverse(r : in out Rat); procedure Add(left : in out Rat; right : in Rat); procedure Subtract(left : in out Rat; right : in Rat); procedure Multiply(left : in out Rat; right : in Rat); procedure Normalize(r : in out Rat); function ToString(r : in Rat) return String; private type Rat is record numerator : Long_Long_Integer; denomonator : Long_Long_Integer; end record; end Rational;
with HAL.Touch_Panel; use HAL.Touch_Panel; with HAL.Bitmap; use HAL.Bitmap; with STM32.Board; use STM32.Board; with AdaPhysics2DDemo; with STM32.User_Button; use STM32; with BMP_Fonts; with LCD_Std_Out; with Utils; package body MainMenu is procedure ShowMainMenu is StartMenu : Menu; begin Utils.Clear(False); StartMenu.Init(Black, White, BMP_Fonts.Font16x24, Menu_Default); StartMenu.AddItem(Text => "START", Pos => (20, 220, 20, 120), Action => AdaPhysics2DDemo.Start'Access); StartMenu.AddItem(Text => "HELP", Action => ShowHelpScreen'Access); StartMenu.Show; StartMenu.Listen; end ShowMainMenu; procedure ShowHelpScreen(This : in out Menu) is Tick : Natural := 0; begin This.Free; Utils.Clear(True); Utils.Clear(True); LCD_Std_Out.Clear_Screen; LCD_Std_Out.Put_Line("Demo of AdaPhysics2D by Kidev"); LCD_Std_Out.New_Line; LCD_Std_Out.New_Line; LCD_Std_Out.Put_Line("Blue button to change mode:"); LCD_Std_Out.Put_Line("- Touch screen is off"); LCD_Std_Out.Put_Line("- Touch to create a circle"); LCD_Std_Out.Put_Line("- Touch to create a rectangle"); LCD_Std_Out.Put_Line("- Touch to change materials"); LCD_Std_Out.Put_Line(" Also freezes the physics"); LCD_Std_Out.New_Line; LCD_Std_Out.Put_Line("Try to shake the board !"); LCD_Std_Out.New_Line; LCD_Std_Out.New_Line; LCD_Std_Out.Put_Line("TOUCH TO GO BACK TO MENU"); loop declare State : constant TP_State := Touch_Panel.Get_All_Touch_Points; begin exit when Tick > Menus.WaitTicks and (State'Length >= 1 or User_Button.Has_Been_Pressed); end; Tick := Tick + 1; end loop; ShowMainMenu; end ShowHelpScreen; end MainMenu;
----------------------------------------------------------------------- -- mat-callbacks - Callbacks for Gtk -- Copyright (C) 2014 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 Gtkada.Builder; with MAT.Targets.Gtkmat; package MAT.Callbacks is -- Initialize and register the callbacks. procedure Initialize (Target : in MAT.Targets.Gtkmat.Target_Type_Access; Builder : in Gtkada.Builder.Gtkada_Builder); -- Callback executed when the "quit" action is executed from the menu. procedure On_Menu_Quit (Object : access Gtkada.Builder.Gtkada_Builder_Record'Class); -- Callback executed when the "about" action is executed from the menu. procedure On_Menu_About (Object : access Gtkada.Builder.Gtkada_Builder_Record'Class); -- Callback executed when the "close-about" action is executed from the about box. procedure On_Close_About (Object : access Gtkada.Builder.Gtkada_Builder_Record'Class); -- Callback executed when the "cmd-sizes" action is executed from the "Sizes" action. procedure On_Btn_Sizes (Object : access Gtkada.Builder.Gtkada_Builder_Record'Class); -- Callback executed when the "cmd-threads" action is executed from the "Threads" action. procedure On_Btn_Threads (Object : access Gtkada.Builder.Gtkada_Builder_Record'Class); end MAT.Callbacks;
package Vole_Goto is type Small_Integer is range -32_000 .. 32_000; type Goto_Entry is record Nonterm : Small_Integer; Newstate : Small_Integer; end record; --pragma suppress(index_check); subtype Row is Integer range -1 .. Integer'Last; type Goto_Parse_Table is array (Row range <>) of Goto_Entry; Goto_Matrix : constant Goto_Parse_Table := ((-1,-1) -- Dummy Entry. -- State 0 ,(-6, 3),(-5, 2),(-3, 1),(-2, 4) -- State 1 ,(-9, 5),(-7, 9),(-4, 8) -- State 2 -- State 3 -- State 4 -- State 5 -- State 6 ,(-8, 13) -- State 7 ,(-8, 14) -- State 8 -- State 9 -- State 10 -- State 11 ,(-10, 17),(-9, 5),(-5, 15) ,(-4, 16) -- State 12 -- State 13 -- State 14 -- State 15 -- State 16 -- State 17 -- State 18 -- State 19 ,(-14, 23),(-13, 22),(-11, 26) ,(-5, 21) -- State 20 ,(-8, 27) -- State 21 -- State 22 -- State 23 ,(-14, 23),(-13, 22) ,(-11, 28),(-5, 21) -- State 24 ,(-8, 29) -- State 25 ,(-8, 30) -- State 26 ,(-29, 31),(-12, 36) -- State 27 -- State 28 -- State 29 -- State 30 ,(-16, 41) -- State 31 -- State 32 ,(-8, 43) -- State 33 ,(-8, 44) -- State 34 ,(-8, 45) -- State 35 ,(-31, 47) -- State 36 -- State 37 ,(-14, 23) ,(-13, 22),(-11, 49),(-5, 21) -- State 38 ,(-24, 56) ,(-23, 55),(-22, 54),(-21, 53),(-20, 52) ,(-19, 51),(-18, 50),(-15, 64) -- State 39 -- State 40 ,(-17, 67) -- State 41 -- State 42 ,(-30, 70),(-29, 31),(-12, 69),(-5, 68) -- State 43 ,(-31, 71) -- State 44 -- State 45 ,(-31, 73) -- State 46 ,(-35, 76),(-34, 75) ,(-33, 78),(-8, 77),(-5, 74) -- State 47 ,(-32, 80) -- State 48 -- State 49 ,(-29, 31),(-12, 81) -- State 50 -- State 51 -- State 52 -- State 53 -- State 54 -- State 55 -- State 56 -- State 57 -- State 58 -- State 59 -- State 60 -- State 61 -- State 62 -- State 63 -- State 64 -- State 65 -- State 66 -- State 67 -- State 68 -- State 69 -- State 70 -- State 71 -- State 72 ,(-8, 92) -- State 73 -- State 74 -- State 75 -- State 76 -- State 77 -- State 78 -- State 79 ,(-58, 110) ,(-56, 111),(-46, 107),(-45, 106),(-44, 105) ,(-43, 104),(-42, 103),(-41, 102),(-40, 101) ,(-39, 100),(-38, 99),(-37, 98),(-36, 121) ,(-8, 119),(-5, 97) -- State 80 -- State 81 -- State 82 ,(-63, 129),(-58, 128) ,(-25, 123),(-17, 133),(-8, 119) -- State 83 ,(-63, 129) ,(-58, 128),(-25, 134),(-17, 133),(-8, 119) -- State 84 -- State 85 -- State 86 ,(-8, 137) -- State 87 ,(-27, 140) -- State 88 ,(-63, 129),(-58, 128) ,(-25, 141),(-17, 133),(-8, 119) -- State 89 -- State 90 -- State 91 ,(-31, 142) -- State 92 ,(-31, 143) -- State 93 ,(-31, 144) -- State 94 ,(-35, 76),(-34, 145) ,(-8, 77) -- State 95 ,(-28, 152) -- State 96 -- State 97 -- State 98 -- State 99 -- State 100 -- State 101 -- State 102 -- State 103 -- State 104 -- State 105 -- State 106 -- State 107 -- State 108 ,(-63, 129),(-58, 128) ,(-25, 154),(-17, 133),(-8, 119) -- State 109 ,(-63, 129) ,(-58, 161),(-54, 160),(-53, 159),(-52, 158) ,(-51, 164),(-27, 157),(-25, 156),(-17, 133) ,(-8, 119),(-5, 155) -- State 110 -- State 111 -- State 112 ,(-8, 167) -- State 113 ,(-63, 129) ,(-58, 128),(-25, 168),(-17, 133),(-8, 119) -- State 114 ,(-58, 172),(-49, 170),(-48, 169),(-47, 173) ,(-8, 119) -- State 115 ,(-63, 129),(-58, 128),(-25, 174) ,(-17, 133),(-8, 119) -- State 116 ,(-63, 129),(-58, 128) ,(-25, 175),(-17, 133),(-8, 119) -- State 117 ,(-32, 176) -- State 118 -- State 119 -- State 120 ,(-58, 179),(-57, 180),(-8, 119),(-5, 178) -- State 121 -- State 122 -- State 123 -- State 124 ,(-63, 129),(-58, 128),(-25, 199),(-17, 133) ,(-8, 119) -- State 125 ,(-63, 129),(-58, 128),(-25, 200) ,(-17, 133),(-8, 119) -- State 126 ,(-63, 129),(-58, 128) ,(-25, 201),(-17, 133),(-8, 119) -- State 127 ,(-63, 129) ,(-58, 128),(-25, 202),(-17, 133),(-8, 119) -- State 128 -- State 129 -- State 130 -- State 131 -- State 132 -- State 133 -- State 134 -- State 135 -- State 136 -- State 137 -- State 138 ,(-8, 203) -- State 139 ,(-63, 129),(-62, 205),(-58, 128) ,(-55, 207),(-25, 206),(-17, 133),(-8, 119) ,(-5, 204) -- State 140 -- State 141 -- State 142 ,(-32, 208) -- State 143 -- State 144 ,(-32, 210) -- State 145 -- State 146 -- State 147 -- State 148 -- State 149 -- State 150 -- State 151 -- State 152 -- State 153 ,(-58, 110) ,(-56, 111),(-46, 107),(-45, 106),(-44, 105) ,(-43, 104),(-42, 103),(-41, 102),(-40, 101) ,(-39, 100),(-38, 99),(-37, 98),(-36, 211) ,(-8, 119),(-5, 97) -- State 154 -- State 155 -- State 156 -- State 157 -- State 158 -- State 159 -- State 160 -- State 161 -- State 162 -- State 163 -- State 164 -- State 165 ,(-63, 129),(-60, 219) ,(-59, 221),(-58, 161),(-54, 218),(-52, 217) ,(-25, 216),(-17, 133),(-8, 119) -- State 166 ,(-63, 129) ,(-60, 219),(-59, 222),(-58, 161),(-54, 218) ,(-52, 217),(-25, 216),(-17, 133),(-8, 119) -- State 167 -- State 168 -- State 169 -- State 170 -- State 171 -- State 172 -- State 173 -- State 174 -- State 175 -- State 176 -- State 177 ,(-8, 227) -- State 178 -- State 179 -- State 180 -- State 181 -- State 182 ,(-63, 129),(-58, 128),(-25, 231) ,(-17, 133),(-8, 119) -- State 183 ,(-63, 129),(-58, 128) ,(-25, 232),(-17, 133),(-8, 119) -- State 184 ,(-63, 129) ,(-58, 128),(-25, 233),(-17, 133),(-8, 119) -- State 185 ,(-63, 129),(-58, 128),(-25, 234),(-17, 133) ,(-8, 119) -- State 186 ,(-63, 129),(-58, 128),(-25, 235) ,(-17, 133),(-8, 119) -- State 187 ,(-63, 129),(-58, 128) ,(-25, 236),(-17, 133),(-8, 119) -- State 188 ,(-63, 129) ,(-58, 128),(-25, 237),(-17, 133),(-8, 119) -- State 189 ,(-63, 129),(-58, 128),(-25, 238),(-17, 133) ,(-8, 119) -- State 190 ,(-63, 129),(-58, 128),(-25, 239) ,(-17, 133),(-8, 119) -- State 191 ,(-63, 129),(-58, 128) ,(-25, 240),(-17, 133),(-8, 119) -- State 192 ,(-63, 129) ,(-58, 128),(-25, 241),(-17, 133),(-8, 119) -- State 193 ,(-63, 129),(-58, 128),(-25, 242),(-17, 133) ,(-8, 119) -- State 194 ,(-63, 129),(-58, 128),(-25, 243) ,(-17, 133),(-8, 119) -- State 195 ,(-63, 129),(-58, 128) ,(-25, 244),(-17, 133),(-8, 119) -- State 196 ,(-63, 129) ,(-58, 128),(-25, 245),(-17, 133),(-8, 119) -- State 197 ,(-63, 129),(-58, 128),(-25, 246),(-17, 133) ,(-8, 119) -- State 198 ,(-63, 129),(-58, 128),(-25, 247) ,(-17, 133),(-8, 119) -- State 199 -- State 200 -- State 201 -- State 202 -- State 203 ,(-26, 250) -- State 204 -- State 205 -- State 206 -- State 207 -- State 208 -- State 209 ,(-31, 253) -- State 210 -- State 211 -- State 212 -- State 213 ,(-8, 255) -- State 214 ,(-8, 256) -- State 215 ,(-8, 257) -- State 216 -- State 217 -- State 218 -- State 219 -- State 220 ,(-61, 259) ,(-8, 258) -- State 221 -- State 222 -- State 223 ,(-24, 56),(-23, 55),(-22, 54) ,(-21, 53),(-20, 52),(-19, 51),(-18, 50) ,(-15, 260) -- State 224 ,(-8, 261) -- State 225 ,(-8, 262) -- State 226 ,(-32, 263) -- State 227 -- State 228 ,(-58, 179),(-57, 264),(-8, 119),(-5, 178) -- State 229 ,(-58, 179),(-57, 265),(-8, 119),(-5, 178) -- State 230 -- State 231 -- State 232 -- State 233 -- State 234 -- State 235 -- State 236 -- State 237 -- State 238 -- State 239 -- State 240 -- State 241 -- State 242 -- State 243 -- State 244 -- State 245 -- State 246 -- State 247 -- State 248 -- State 249 ,(-63, 129),(-62, 205),(-58, 128),(-55, 266) ,(-25, 206),(-17, 133),(-8, 119),(-5, 204) -- State 250 -- State 251 ,(-63, 129),(-62, 267),(-58, 128),(-25, 206) ,(-17, 133),(-8, 119) -- State 252 -- State 253 ,(-32, 268) -- State 254 ,(-58, 110) ,(-56, 111),(-46, 107),(-45, 106),(-44, 105) ,(-43, 104),(-42, 103),(-41, 102),(-40, 101) ,(-39, 100),(-38, 99),(-37, 98),(-36, 269) ,(-8, 119),(-5, 97) -- State 255 ,(-26, 270) -- State 256 ,(-26, 271) -- State 257 ,(-26, 272) -- State 258 ,(-26, 273) -- State 259 -- State 260 -- State 261 ,(-26, 274) -- State 262 ,(-26, 275) -- State 263 -- State 264 -- State 265 -- State 266 -- State 267 -- State 268 -- State 269 ,(-50, 278) -- State 270 -- State 271 -- State 272 -- State 273 -- State 274 -- State 275 -- State 276 -- State 277 -- State 278 -- State 279 ,(-32, 281) -- State 280 ,(-63, 129),(-58, 128) ,(-25, 282),(-17, 133),(-8, 119) -- State 281 -- State 282 -- State 283 -- State 284 ,(-58, 110) ,(-56, 111),(-46, 107),(-45, 106),(-44, 105) ,(-43, 104),(-42, 103),(-41, 102),(-40, 101) ,(-39, 100),(-38, 99),(-37, 98),(-36, 285) ,(-8, 119),(-5, 97) -- State 285 ,(-50, 286) -- State 286 ); -- The offset vector GOTO_OFFSET : array (0.. 286) of Integer := ( 0, 4, 7, 7, 7, 7, 7, 8, 9, 9, 9, 9, 13, 13, 13, 13, 13, 13, 13, 13, 17, 18, 18, 18, 22, 23, 24, 26, 26, 26, 26, 27, 27, 28, 29, 30, 31, 31, 35, 43, 43, 44, 44, 48, 49, 49, 50, 55, 56, 56, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 59, 59, 59, 59, 59, 59, 59, 74, 74, 74, 79, 84, 84, 84, 85, 86, 91, 91, 91, 92, 93, 94, 97, 98, 98, 98, 98, 98, 98, 98, 98, 98, 98, 98, 98, 98, 103, 114, 114, 114, 115, 120, 125, 130, 135, 136, 136, 136, 140, 140, 140, 140, 145, 150, 155, 160, 160, 160, 160, 160, 160, 160, 160, 160, 160, 160, 161, 169, 169, 169, 170, 170, 171, 171, 171, 171, 171, 171, 171, 171, 171, 186, 186, 186, 186, 186, 186, 186, 186, 186, 186, 186, 186, 195, 204, 204, 204, 204, 204, 204, 204, 204, 204, 204, 204, 205, 205, 205, 205, 205, 210, 215, 220, 225, 230, 235, 240, 245, 250, 255, 260, 265, 270, 275, 280, 285, 290, 290, 290, 290, 290, 291, 291, 291, 291, 291, 291, 292, 292, 292, 292, 293, 294, 295, 295, 295, 295, 295, 297, 297, 297, 305, 306, 307, 308, 308, 312, 316, 316, 316, 316, 316, 316, 316, 316, 316, 316, 316, 316, 316, 316, 316, 316, 316, 316, 316, 316, 324, 324, 330, 330, 331, 346, 347, 348, 349, 350, 350, 350, 351, 352, 352, 352, 352, 352, 352, 352, 353, 353, 353, 353, 353, 353, 353, 353, 353, 353, 354, 359, 359, 359, 359, 374, 375); subtype Rule is Natural; subtype Nonterminal is Integer; Rule_Length : array (Rule range 0 .. 146) of Natural := ( 2, 2, 0, 1, 1, 2, 3, 3, 1, 1, 6, 8, 1, 1, 2, 5, 3, 1, 3, 1, 1, 1, 1, 1, 1, 1, 1, 3, 1, 3, 1, 3, 1, 3, 1, 3, 5, 1, 3, 1, 3, 1, 1, 1, 1, 1, 1, 3, 1, 1, 6, 8, 6, 3, 3, 1, 1, 1, 3, 3, 1, 3, 1, 1, 3, 1, 1, 1, 1, 1, 1, 1, 1, 4, 2, 2, 2, 1, 1, 6, 1, 3, 7, 2, 1, 1, 1, 1, 1, 1, 3, 3, 3, 4, 4, 4, 4, 4, 3, 3, 1, 1, 1, 1, 2, 2, 3, 1, 1, 1, 3, 3, 1, 1, 1, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 2, 2, 2, 1, 1, 1, 1, 1, 1, 1, 1, 4, 2); Get_LHS_Rule: array (Rule range 0 .. 146) of Nonterminal := (-1, -2,-5,-3,-3,-6,-7,-4,-10, -10,-9,-9,-11,-11,-13,-14,-14, -16,-16,-15,-15,-15,-15,-15,-15, -15,-18,-18,-19,-19,-20,-20,-21, -21,-22,-22,-22,-23,-23,-24,-24, -28,-28,-28,-28,-28,-28,-12,-30, -30,-29,-29,-29,-29,-31,-33,-33, -34,-34,-35,-8,-32,-36,-36,-37, -38,-38,-38,-38,-38,-38,-38,-38, -46,-46,-45,-44,-47,-47,-39,-50, -50,-50,-40,-51,-51,-51,-51,-51, -51,-26,-27,-56,-48,-49,-52,-53, -54,-41,-41,-59,-59,-59,-59,-60, -61,-58,-58,-57,-57,-57,-57,-55, -55,-62,-62,-25,-25,-25,-25,-25, -25,-25,-25,-25,-25,-25,-25,-25, -25,-25,-25,-25,-25,-25,-25,-25, -25,-25,-63,-63,-63,-63,-17,-17, -42,-43); end Vole_Goto;
with Protypo.Scanning; with Protypo.Code_Trees; with Protypo.Api.Interpreters; use Protypo.Api.Interpreters; procedure Protypo.Parsing.Test is S : constant Template_Type := Slurp ("test-data/parsing.txt"); Tk : Scanning.Token_List := Scanning.Tokenize (S, ""); Code : Code_Trees.Parsed_Code; -- pragma Unreferenced (Code); begin Scanning.Dump (Tk); Code := Parse_Statement_Sequence (Tk); Code_Trees.Dump (Code); end Protypo.Parsing.Test;
------------------------------------------------------------------------ -- Copyright (C) 2010-2020 by Heisenbug Ltd. (github@heisenbug.eu) -- -- This work is free. You can redistribute it and/or modify it under -- the terms of the Do What The Fuck You Want To Public License, -- Version 2, as published by Sam Hocevar. See the LICENSE file for -- more details. ------------------------------------------------------------------------ pragma License (Unrestricted); with Ada.IO_Exceptions; with Ada.Text_IO; -- Using Ada.Text_IO in tasking context is not task -- safe, but use it for the sake of a simple example. with Local_Message_Passing; with Message_Types; ------------------------------------------------------------------------ -- The receiver task package. ------------------------------------------------------------------------ package body Receiver is -- Instantiate the Local_Message_Passing package, so we get the -- Mailbox type and Handle type to access the mailbox. package LMP is new Local_Message_Passing (Message => Message_Types.The_Message); -- A mailbox should be declared at library level. -- -- It is perfectly possible to declare it locally in the task, but -- if the task dies, any other task accessing the mailbox via an -- acquired handle to it will then access invalid memory. The_Mailbox : LMP.Mailbox (Size => 8); -- Declares our mailbox. task Receive_Messages; task body Receive_Messages is MB : LMP.Handle; Our_Message : Message_Types.The_Message; use type Message_Types.The_Message; begin Ada.Text_IO.Put_Line ("Receiver: Waiting a second before exporting mailbox."); delay 1.0; -- Export the mailbox. This also initializes our Handle. LMP.Open_Mailbox (Mbx => The_Mailbox, Hnd => MB, Export_Name => "MY_MAILBOX"); Ada.Text_IO.Put_Line ("Receiver: Mailbox exported, sender task should see it now."); loop -- Blocking receive. Waits until a message becomes available. LMP.Receive (Mbx => MB, Msg => Our_Message); if Our_Message (1 .. 16) = "Can you hear me?" then Ada.Text_IO.Put_Line ("Loud and clear."); else raise Ada.IO_Exceptions.Data_Error; end if; end loop; exception when Ada.IO_Exceptions.Data_Error => Ada.Text_IO.Put_Line ("Receiver died: Unexpected message!"); end Receive_Messages; end Receiver;
------------------------------------------------------------ -- -- GNAT RUN-TIME EXTENSIONS -- -- XADA . DISPATCHING . TIME-TRIGGERED SCHEDULING -- -- @file x-distts.ads / xada-dispatching-tts.ads -- -- @package XAda.Dispatching.TTS (SPEC) -- -- @author Jorge Real <jorge@disca.upv.es> -- @author Sergio Saez <ssaez@disca.upv.es> -- ------------------------------------------------------------ pragma Profile (Ravenscar); with Ada.Real_Time, System; private with Ada.Real_Time.Timing_Events; generic Number_Of_Work_IDs : Positive; Number_Of_Sync_IDs : Positive := 1; TT_Priority : System.Priority := System.Priority'Last; package XAda.Dispatching.TTS is -- TT tasks use a Work_Id of this type to identify themselves -- when they call the scheduler type TT_Work_Id is new Positive range 1 .. Number_Of_Work_IDs; -- ET tasks use a Sync_Id of this type to identify themselves -- when they call the scheduler type TT_Sync_Id is new Positive range 1 .. Number_Of_Sync_IDs; -- An abstract time slot in the TT plan. type Time_Slot is abstract tagged record Slot_Duration : Ada.Real_Time.Time_Span; end record; type Time_Slot_Access is access all Time_Slot'Class; -- An empty time slot type Empty_Slot is new Time_Slot with null record; type Empty_Slot_Access is access all Empty_Slot'Class; -- A mode change time slot type Mode_Change_Slot is new Time_Slot with null record; type Mode_Change_Slot_Access is access all Mode_Change_Slot'Class; -- A sync slot type Sync_Slot is new Time_Slot with record Sync_Id : TT_Sync_Id; end record; type Sync_Slot_Access is access all Sync_Slot'Class; -- A work slot type Work_Slot is abstract new Time_Slot with record Work_Id : TT_Work_Id; Is_Continuation : Boolean := False; Padding : Ada.Real_Time.Time_Span := Ada.Real_Time.Time_Span_Zero; end record; type Work_Slot_Access is access all Work_Slot'Class; -- A regular slot type Regular_Slot is new Work_Slot with null record; type Regular_Slot_Access is access all Regular_Slot'Class; -- An optional work slot type Optional_Slot is new Work_Slot with null record; type Optional_Slot_Access is access all Optional_Slot'Class; -- Types representing/accessing TT plans type Time_Triggered_Plan is array (Natural range <>) of Time_Slot_Access; type Time_Triggered_Plan_Access is access all Time_Triggered_Plan; -- Set new TT plan to start at the end of the next mode change slot procedure Set_Plan (TTP : Time_Triggered_Plan_Access); -- TT works use this procedure to wait for their next assigned slot -- The When_Was_Released result informs caller of slot starting time procedure Wait_For_Activation (Work_Id : TT_Work_Id; When_Was_Released : out Ada.Real_Time.Time); -- TT works use this procedure to inform that the critical part -- of the current slot has been finished. It tranforms the current -- slot in a continuation slot procedure Continue_Sliced; -- TT works use this procedure to inform the TT scheduler that -- there is no more work to do at TT priority level procedure Leave_TT_Level; -- Returns the first time the first slot of the current plan was released. -- It is equivalent to an Epoch for the current plan. function Get_First_Plan_Release return Ada.Real_Time.Time; -- Returns the last time the first slot of the plan was released function Get_Last_Plan_Release return Ada.Real_Time.Time; -- ET works use this procedure to wait for their next asigned sync slot procedure Wait_For_Sync (Sync_Id : TT_Sync_Id; When_Was_Released : out Ada.Real_Time.Time); private protected Time_Triggered_Scheduler with Priority => System.Interrupt_Priority'Last is -- Setting a new TT plan procedure Set_Plan (TTP : Time_Triggered_Plan_Access); -- Prepare work to wait for next activation procedure Prepare_For_Activation (Work_Id : TT_Work_Id); -- Transform current slot in a continuation slot procedure Continue_Sliced; -- Inform the scheduler that you have no more work as a TT task procedure Leave_TT_Level; -- Returns the first time the first slot of the plan was released function Get_First_Plan_Release return Ada.Real_Time.Time; -- Returns the last time the first slot of the plan was released function Get_Last_Plan_Release return Ada.Real_Time.Time; -- Prepare work to wait for next synchronization point procedure Prepare_For_Sync (Sync_Id : TT_Sync_Id); private -- New slot timing event NS_Event : Ada.Real_Time.Timing_Events.Timing_Event; -- New slot handler procedure procedure NS_Handler (Event : in out Ada.Real_Time.Timing_Events.Timing_Event); -- This access object is the reason why the scheduler is declared -- in this private part, given that this is a generic package. -- It should be a constant, but a PO can't have constant components. NS_Handler_Access : Ada.Real_Time.Timing_Events.Timing_Event_Handler := NS_Handler'Access; -- Hold timing event Hold_Event : Ada.Real_Time.Timing_Events.Timing_Event; -- Padding slot handler procedure procedure Hold_Handler (Event : in out Ada.Real_Time.Timing_Events.Timing_Event); -- This access object is the reason why the scheduler is declared -- in this private part, given that this is a generic package. -- It should be a constant, but a PO can't have constant components. Hold_Handler_Access : Ada.Real_Time.Timing_Events.Timing_Event_Handler := Hold_Handler'Access; -- Procedure to enforce plan change procedure Change_Plan (At_Time : Ada.Real_Time.Time); -- Currently running plan and next plan to switch to, if any Current_Plan : Time_Triggered_Plan_Access := null; Next_Plan : Time_Triggered_Plan_Access := null; -- Index numbers of current and next slots in the plan Current_Slot_Index : Natural := 0; Next_Slot_Index : Natural := 0; -- Start time of next slot Next_Slot_Release : Ada.Real_Time.Time := Ada.Real_Time.Time_Last; -- Start time of the current plan Plan_Start_Pending : Boolean := True; First_Plan_Release : Ada.Real_Time.Time := Ada.Real_Time.Time_First; -- Start time of the first slot First_Slot_Release : Ada.Real_Time.Time := Ada.Real_Time.Time_First; end Time_Triggered_Scheduler; end XAda.Dispatching.TTS;
package body Planet is package body Origin_Define is function Build (name : String; colony: Integer; starship: Integer; station: Integer) return Object is planet: Object; add_error: exception; begin if (colony + starship + station) = 5 then planet.Name := SU.To_Unbounded_String (name); planet.Colony := colony; planet.Starship := starship; planet.Station := station; planet.Damage := false; return planet; else raise add_error; end if; end Build; ----------------------- -- Operator ----------------------- function show (planet: in Object) return String is begin return SU.To_String (planet.Name); end show; procedure attack (planet: in out Object) is begin planet.damage := true; end attack; function "=" (Left, Right : Object) return Boolean is begin if SU."=" (Left.Name, Right.Name) then return True; else return False; end if; end "="; end Origin_Define; end Planet;
with Ada.IO_Exceptions; with Interfaces.C.Strings; with Interfaces.C; with System; package body OpenAL.Context is package C renames Interfaces.C; package C_Strings renames Interfaces.C.Strings; -- -- Close_Device -- procedure Close_Device (Device : in out Device_t) is Return_Code : constant Boolean := Boolean (ALC_Thin.Close_Device (Device.Device_Data)); begin Device := Invalid_Device; pragma Assert (Return_Code'Size > 0); end Close_Device; -- -- Create_Context -- -- -- Mapping between attribute selection and constants. -- type Attribute_Map_t is array (Attribute_t) of Types.Integer_t; Attribute_Map : constant Attribute_Map_t := (Attribute_Frequency => ALC_Thin.ALC_FREQUENCY, Attribute_Refresh => ALC_Thin.ALC_REFRESH, Attribute_Synchronous => ALC_Thin.ALC_SYNC, Attribute_Mono_Sources => ALC_Thin.ALC_MONO_SOURCES, Attribute_Stereo_Sources => ALC_Thin.ALC_STEREO_SOURCES); -- -- The input to alcCreateContext is a list of 'integer pairs' terminated -- with zeroes: -- -- [ALC_FREQUENCY][44100][AL_SYNC][1][0][0] -- Input_Size : constant Natural := (Attribute_Array_t'Length + 1) * 2; type Input_Array_t is array (1 .. Input_Size) of aliased Types.Integer_t; function Create_Context (Device : in Device_t) return Context_t is begin return Context_t (ALC_Thin.Create_Context (Device => Device.Device_Data, Attribute_List => System.Null_Address)); end Create_Context; function Create_Context_With_Attributes (Device : in Device_t; Attributes : in Context_Attributes_t) return Context_t is Input : Input_Array_t := (others => 0); Position : Positive := Input_Array_t'First; begin for Attribute in Attribute_t'Range loop if Attributes.Specified (Attribute) then Input (Position) := Attribute_Map (Attribute); Input (Position + 1) := Attributes.Values (Attribute); Position := Position + 2; end if; end loop; return Context_t (ALC_Thin.Create_Context (Device => Device.Device_Data, Attribute_List => Input (Input'First)'Address)); end Create_Context_With_Attributes; -- -- Destroy_Context -- procedure Destroy_Context (Context : in Context_t) is begin ALC_Thin.Destroy_Context (ALC_Thin.Context_t (Context)); end Destroy_Context; -- -- Device_Data -- function Device_Data (Device : in Device_t) return ALC_Thin.Device_t is begin return Device.Device_Data; end Device_Data; -- -- Get_* -- function Get_String (Device : ALC_Thin.Device_t; Parameter : Types.Enumeration_t) return C_Strings.chars_ptr; pragma Import (C, Get_String, "alcGetString"); use type C_Strings.chars_ptr; use type ALC_Thin.Device_t; use type System.Address; Null_Device : constant ALC_Thin.Device_t := ALC_Thin.Device_t (System.Null_Address); function Get_Available_Capture_Devices return OpenAL.List.String_Vector_t is Address : System.Address; List : OpenAL.List.String_Vector_t; begin Address := ALC_Thin.Get_String (Device => ALC_Thin.Device_t (System.Null_Address), Token => ALC_Thin.ALC_CAPTURE_DEVICE_SPECIFIER); if Address /= System.Null_Address then OpenAL.List.Address_To_Vector (Address => Address, List => List); end if; return List; end Get_Available_Capture_Devices; function Get_Available_Playback_Devices return OpenAL.List.String_Vector_t is Address : System.Address; List : OpenAL.List.String_Vector_t; begin Address := ALC_Thin.Get_String (Device => ALC_Thin.Device_t (System.Null_Address), Token => ALC_Thin.ALC_DEVICE_SPECIFIER); if Address /= System.Null_Address then OpenAL.List.Address_To_Vector (Address => Address, List => List); end if; return List; end Get_Available_Playback_Devices; function Get_Capture_Samples (Device : in Device_t) return Natural is Value : aliased Types.Integer_t := 0; begin ALC_Thin.Get_Integerv (Device => Device.Device_Data, Token => ALC_Thin.ALC_CAPTURE_SAMPLES, Size => 1, Data => Value'Address); return Natural (Value); end Get_Capture_Samples; function Get_Context_Device (Context : in Context_t) return Device_t is Device : Device_t; begin Device.Device_Data := ALC_Thin.Get_Contexts_Device (ALC_Thin.Context_t (Context)); return Device; end Get_Context_Device; function Get_Current_Context return Context_t is begin return Context_t (ALC_Thin.Get_Current_Context); end Get_Current_Context; function Get_Default_Capture_Device_Specifier return String is CS : constant C_Strings.chars_ptr := Get_String (Device => Null_Device, Parameter => ALC_Thin.ALC_CAPTURE_DEFAULT_DEVICE_SPECIFIER); begin if CS /= C_Strings.Null_Ptr then return C_Strings.Value (CS); else raise Ada.IO_Exceptions.Device_Error with "no capture device available"; end if; end Get_Default_Capture_Device_Specifier; function Get_Default_Device_Specifier return String is CS : constant C_Strings.chars_ptr := Get_String (Device => Null_Device, Parameter => ALC_Thin.ALC_DEFAULT_DEVICE_SPECIFIER); begin if CS /= C_Strings.Null_Ptr then return C_Strings.Value (CS); else raise Ada.IO_Exceptions.Device_Error with "no device available"; end if; end Get_Default_Device_Specifier; function Get_Device_Specifier (Device : in Device_t) return String is begin if Device.Device_Data = Null_Device then raise Ada.IO_Exceptions.Device_Error with "invalid device"; end if; return C_Strings.Value (Get_String (Device => Device.Device_Data, Parameter => ALC_Thin.ALC_DEVICE_SPECIFIER)); end Get_Device_Specifier; function Get_Extensions (Device : in Device_t) return String is begin if Device.Device_Data = Null_Device then raise Ada.IO_Exceptions.Device_Error with "invalid device"; end if; return C_Strings.Value (Get_String (Device => Device.Device_Data, Parameter => ALC_Thin.ALC_EXTENSIONS)); end Get_Extensions; function Get_Frequency (Device : in Device_t) return Types.Frequency_t is Value : aliased Types.Integer_t := Types.Integer_t (Types.Frequency_t'First); begin ALC_Thin.Get_Integerv (Device => Device.Device_Data, Token => ALC_Thin.ALC_FREQUENCY, Size => 1, Data => Value'Address); return Types.Frequency_t (Value); end Get_Frequency; function Get_Major_Version (Device : in Device_t) return Natural is Value : aliased Types.Integer_t := 0; begin ALC_Thin.Get_Integerv (Device => Device.Device_Data, Token => ALC_Thin.ALC_MAJOR_VERSION, Size => 1, Data => Value'Address); return Natural (Value); end Get_Major_Version; function Get_Minor_Version (Device : in Device_t) return Natural is Value : aliased Types.Integer_t := 0; begin ALC_Thin.Get_Integerv (Device => Device.Device_Data, Token => ALC_Thin.ALC_MINOR_VERSION, Size => 1, Data => Value'Address); return Natural (Value); end Get_Minor_Version; function Get_Mono_Sources (Device : in Device_t) return Natural is Value : aliased Types.Integer_t := 0; begin ALC_Thin.Get_Integerv (Device => Device.Device_Data, Token => ALC_Thin.ALC_MONO_SOURCES, Size => 1, Data => Value'Address); return Natural (Value); end Get_Mono_Sources; function Get_Refresh (Device : in Device_t) return Natural is Value : aliased Types.Integer_t := 0; begin ALC_Thin.Get_Integerv (Device => Device.Device_Data, Token => ALC_Thin.ALC_REFRESH, Size => 1, Data => Value'Address); return Natural (Value); end Get_Refresh; function Get_Stereo_Sources (Device : in Device_t) return Natural is Value : aliased Types.Integer_t := 0; begin ALC_Thin.Get_Integerv (Device => Device.Device_Data, Token => ALC_Thin.ALC_STEREO_SOURCES, Size => 1, Data => Value'Address); return Natural (Value); end Get_Stereo_Sources; function Get_Synchronous (Device : in Device_t) return Boolean is Value : aliased Types.Integer_t := 0; begin ALC_Thin.Get_Integerv (Device => Device.Device_Data, Token => ALC_Thin.ALC_SYNC, Size => 1, Data => Value'Address); return Boolean'Val (Value); end Get_Synchronous; -- -- Is_Extension_Present -- function Is_Extension_Present (Device : in Device_t; Name : in String) return Boolean is C_Name : aliased C.char_array := C.To_C (Name); begin return Boolean (ALC_Thin.Is_Extension_Present (Device => Device.Device_Data, Extension_Name => C_Name (C_Name'First)'Address)); end Is_Extension_Present; -- -- Make_Context_Current -- function Make_Context_Current (Context : in Context_t) return Boolean is begin return Boolean (ALC_Thin.Make_Context_Current (ALC_Thin.Context_t (Context))); end Make_Context_Current; -- -- Open_Device -- function Open_Default_Device return Device_t is Device : Device_t; begin Device.Device_Data := ALC_Thin.Open_Device (Specifier => System.Null_Address); return Device; end Open_Default_Device; function Open_Device (Specifier : in String) return Device_t is C_Spec : aliased C.char_array := C.To_C (Specifier); Device : Device_t; begin Device.Device_Data := ALC_Thin.Open_Device (Specifier => C_Spec (C_Spec'First)'Address); return Device; end Open_Device; -- -- Process_Context -- procedure Process_Context (Context : in Context_t) is begin ALC_Thin.Process_Context (ALC_Thin.Context_t (Context)); end Process_Context; -- -- Set_* -- procedure Set_Frequency (Attributes : in out Context_Attributes_t; Frequency : in Types.Frequency_t) is begin Attributes.Values (Attribute_Frequency) := Types.Integer_t (Frequency); Attributes.Specified (Attribute_Frequency) := True; end Set_Frequency; procedure Set_Mono_Sources (Attributes : in out Context_Attributes_t; Sources : in Natural) is begin Attributes.Values (Attribute_Mono_Sources) := Types.Integer_t (Sources); Attributes.Specified (Attribute_Mono_Sources) := True; end Set_Mono_Sources; procedure Set_Refresh (Attributes : in out Context_Attributes_t; Refresh : in Positive) is begin Attributes.Values (Attribute_Refresh) := Types.Integer_t (Refresh); Attributes.Specified (Attribute_Refresh) := True; end Set_Refresh; procedure Set_Stereo_Sources (Attributes : in out Context_Attributes_t; Sources : in Natural) is begin Attributes.Values (Attribute_Stereo_Sources) := Types.Integer_t (Sources); Attributes.Specified (Attribute_Stereo_Sources) := True; end Set_Stereo_Sources; procedure Set_Synchronous (Attributes : in out Context_Attributes_t; Synchronous : in Boolean) is begin Attributes.Values (Attribute_Synchronous) := Types.Integer_t (Boolean'Pos (Synchronous)); Attributes.Specified (Attribute_Synchronous) := True; end Set_Synchronous; -- -- Suspend_Context -- procedure Suspend_Context (Context : in Context_t) is begin ALC_Thin.Suspend_Context (ALC_Thin.Context_t (Context)); end Suspend_Context; end OpenAL.Context;
-- 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.Unchecked_Conversion; package GL.Pixels.Extensions is pragma Preelaborate; subtype Floating_Point_Format is Format range Red .. RG; subtype Integer_Format is Format range RG_Integer .. BGRA_Integer with Static_Predicate => Integer_Format /= Depth_Stencil; ----------------------------------------------------------------------------- subtype Non_Packed_Data_Type is Data_Type range Byte .. Half_Float; subtype Packed_Data_Type is Data_Type range Unsigned_Byte_3_3_2 .. Float_32_Unsigned_Int_24_8_Rev; subtype Floating_Point_Data_Type is Data_Type with Static_Predicate => Floating_Point_Data_Type in Half_Float | Float | Unsigned_Int_10F_11F_11F_Rev | Unsigned_Int_5_9_9_9_Rev; ----------------------------------------------------------------------------- type Format_Type is (Float_Or_Normalized_Type, Int_Type, Unsigned_Int_Type, Depth_Type); function Texture_Format_Type (Format : Pixels.Internal_Format) return Format_Type is (case Format is -- Shadow samplers when Depth_Component16 | Depth_Component24 | Depth_Component32F | Depth24_Stencil8 | Depth32F_Stencil8 => Depth_Type, -- Floating point or (un)signed normalized fixed-point when R8 | R8_SNorm | R16 | R16_SNorm | R16F | R32F => Float_Or_Normalized_Type, when RG8 | RG8_SNorm | RG16 | RG16_SNorm | RG16F | RG32F => Float_Or_Normalized_Type, when R3_G3_B2 | RGB4 | RGB5 | RGB8 | RGB8_SNorm | RGB10 | RGB12 | RGB16 | RGB16_SNorm | RGB16F | RGB32F | R11F_G11F_B10F | RGB9_E5 | SRGB8 => Float_Or_Normalized_Type, when RGBA2 | RGBA4 | RGB5_A1 | RGBA8 | RGBA8_SNorm | RGB10_A2 | RGBA12 | RGBA16 | RGBA16_SNorm | RGBA16F | RGBA32F | SRGB8_Alpha8 => Float_Or_Normalized_Type, -- Integer samplers when R8I | R16I | R32I => Int_Type, when RG8I | RG16I | RG32I => Int_Type, when RGB8I | RGB16I | RGB32I => Int_Type, when RGBA8I | RGBA16I | RGBA32I => Int_Type, -- Unsigned integer samplers when R8UI | R16UI | R32UI => Unsigned_Int_Type, when RG8UI | RG16UI | RG32UI => Unsigned_Int_Type, when RGB8UI | RGB16UI | RGB32UI => Unsigned_Int_Type, when RGBA8UI | RGBA16UI | RGBA32UI | RGB10_A2UI => Unsigned_Int_Type, when others => raise Constraint_Error with "Invalid format " & Format'Image & " for sampler"); function Image_Format_Type (Format : Pixels.Internal_Format) return Format_Type is (case Format is -- Floating point or (un)signed normalized fixed-point when R8_SNorm | R16_SNorm | RG8_SNorm | RG16_SNorm | RGBA8_SNorm | RGBA16_SNorm => Float_Or_Normalized_Type, when R8 | R16 | RG8 | RG16 => Float_Or_Normalized_Type, when RGBA8 | RGB10_A2 | RGBA16 => Float_Or_Normalized_Type, when R16F | R32F | R11F_G11F_B10F | RG16F | RG32F | RGBA16F | RGBA32F => Float_Or_Normalized_Type, -- Integer samplers when R8I | R16I | R32I => Int_Type, when RG8I | RG16I | RG32I => Int_Type, when RGBA8I | RGBA16I | RGBA32I => Int_Type, -- Unsigned integer samplers when R8UI | R16UI | R32UI => Unsigned_Int_Type, when RG8UI | RG16UI | RG32UI => Unsigned_Int_Type, when RGBA8UI | RGBA16UI | RGBA32UI | RGB10_A2UI => Unsigned_Int_Type, when others => raise Constraint_Error with "Invalid format " & Format'Image & " for image sampler"); function Texture_Format (Format : Pixels.Internal_Format) return Pixels.Format is (case Format is when Depth_Component16 | Depth_Component24 | Depth_Component32F => Depth_Component, when Depth24_Stencil8 | Depth32F_Stencil8 => Depth_Stencil, when Stencil_Index8 => Stencil_Index, when R8 | R8_SNorm | R16 | R16_SNorm | R16F | R32F => Red, when RG8 | RG8_SNorm | RG16 | RG16_SNorm | RG16F | RG32F => RG, when R3_G3_B2 | RGB4 | RGB5 | RGB8 | RGB8_SNorm | RGB10 | RGB12 | RGB16 | RGB16_SNorm | RGB16F | RGB32F | R11F_G11F_B10F | RGB9_E5 | SRGB8 => RGB, when RGBA2 | RGBA4 | RGB5_A1 | RGBA8 | RGBA8_SNorm | RGB10_A2 | RGBA12 | RGBA16 | RGBA16_SNorm | RGBA16F | RGBA32F | SRGB8_Alpha8 => RGBA, when R8I | R8UI | R16I | R16UI | R32I | R32UI => Red_Integer, when RG8I | RG8UI | RG16I | RG16UI | RG32I | RG32UI => RG_Integer, when RGB8I | RGB8UI | RGB16I | RGB16UI | RGB32I | RGB32UI => RGB_Integer, when RGBA8I | RGBA8UI | RGBA16I | RGBA16UI | RGBA32I | RGBA32UI | RGB10_A2UI => RGBA_Integer); function Texture_Data_Type (Format : Pixels.Internal_Format) return Pixels.Data_Type is (case Format is when Depth_Component16 => Unsigned_Short, when Depth_Component24 => Unsigned_Int, when Depth24_Stencil8 => Unsigned_Int_24_8, when Depth32F_Stencil8 => Float_32_Unsigned_Int_24_8_Rev, when Depth_Component32F => Float, when Stencil_Index8 => Unsigned_Byte, -- Educated guesses, might be wrong -- Based on Table 8.13 of the OpenGL specification when R3_G3_B2 => Unsigned_Byte_2_3_3_Rev, when RGB5_A1 => Unsigned_Short_1_5_5_5_Rev, when RGB9_E5 => Unsigned_Int_5_9_9_9_Rev, when R11F_G11F_B10F => Unsigned_Int_10F_11F_11F_Rev, when RGB10_A2UI | RGB10_A2 => Unsigned_Int_2_10_10_10_Rev, when R8I | RG8I | RGB8I | RGBA8I | R8_SNorm | RG8_SNorm | RGB8_SNorm | RGBA8_SNorm => Byte, when R8UI | RG8UI | RGB8UI | RGBA8UI | R8 | RG8 | RGB8 | SRGB8 | RGBA8 | SRGB8_Alpha8 => Unsigned_Byte, when R16I | RG16I | RGB16I | RGBA16I | R16_SNorm | RG16_SNorm | RGB16_SNorm | RGBA16_SNorm => Short, when R16UI | RG16UI | RGB16UI | RGBA16UI | R16 | RG16 | RGB16 | RGBA16 => Unsigned_Short, when R32I | RG32I | RGB32I | RGBA32I => Int, when R32UI | RG32UI | RGB32UI | RGBA32UI => Unsigned_Int, when R32F | RG32F | RGB32F | RGBA32F => Float, when R16F | RG16F | RGB16F | RGBA16F => Half_Float, -- Based on Table 8.8 and 8.27 of the OpenGL specification when RGB4 | RGB5 | RGB10 | RGB12 | RGBA2 | RGBA4 | RGBA12 => raise Constraint_Error); ----------------------------------------------------------------------------- function Compatible (Format : Pixels.Format; Data_Type : Pixels.Data_Type) return Boolean is (not (Format in Integer_Format and Data_Type in Floating_Point_Data_Type)); -- Floating point types are incompatible with integer formats according -- to Table 8.2 of the OpenGL specification function Components (Format : Pixels.Format) return Component_Count is (case Format is when Red | Green | Blue | Red_Integer | Green_Integer | Blue_Integer => 1, when RG | RG_Integer => 2, when RGB | BGR | RGB_Integer | BGR_Integer => 3, when RGBA | BGRA | RGBA_Integer | BGRA_Integer => 4, when others => raise Constraint_Error with "Unexpected format " & Format'Image); function Bytes (Data_Type : Non_Packed_Data_Type) return Byte_Count is (case Data_Type is when Byte | Unsigned_Byte => 1, when Short | Unsigned_Short | Half_Float => 2, when Int | Unsigned_Int | Float => 4); function Packed_Bytes (Data_Type : Packed_Data_Type) return Byte_Count is (case Data_Type is -- Unsigned_Byte formats (Table 8.6) when Unsigned_Byte_3_3_2 => 1, when Unsigned_Byte_2_3_3_Rev => 1, -- Unsigned_Short formats (Table 8.7) when Unsigned_Short_5_6_5 => 2, when Unsigned_Short_5_6_5_Rev => 2, when Unsigned_Short_4_4_4_4 => 2, when Unsigned_Short_4_4_4_4_Rev => 2, when Unsigned_Short_5_5_5_1 => 2, when Unsigned_Short_1_5_5_5_Rev => 2, -- Unsigned_Int formats (Table 8.8) when Unsigned_Int_8_8_8_8 => 4, when Unsigned_Int_8_8_8_8_Rev => 4, when Unsigned_Int_10_10_10_2 => 4, when Unsigned_Int_2_10_10_10_Rev => 4, when Unsigned_Int_24_8 => 4, when Unsigned_Int_10F_11F_11F_Rev => 4, when Unsigned_Int_5_9_9_9_Rev => 4, -- Float_Unsigned_Int formats (Table 8.9) when Float_32_Unsigned_Int_24_8_Rev => raise Constraint_Error); function Byte_Alignment (Value : Alignment) return Byte_Count; ----------------------------------------------------------------------------- subtype Compressed_Byte_Count is Types.Int range 8 .. 16 with Static_Predicate => Compressed_Byte_Count in 8 | 16; function Block_Bytes (Format : Pixels.Compressed_Format) return Compressed_Byte_Count is (case Format is -- RGTC when Compressed_Red_RGTC1 => 8, when Compressed_Signed_Red_RGTC1 => 8, when Compressed_RG_RGTC2 => 16, when Compressed_Signed_RG_RGTC2 => 16, -- BPTC when Compressed_RGBA_BPTC_Unorm => 16, when Compressed_SRGB_Alpha_BPTC_UNorm => 16, when Compressed_RGB_BPTC_Signed_Float => 16, when Compressed_RGB_BPTC_Unsigned_Float => 16, -- EAC / ETC when Compressed_R11_EAC => 8, when Compressed_Signed_R11_EAC => 8, when Compressed_RG11_EAC => 16, when Compressed_Signed_RG11_EAC => 16, when Compressed_RGB8_ETC2 => 8, when Compressed_SRGB8_ETC2 => 8, when Compressed_RGB8_Punchthrough_Alpha1_ETC2 => 8, when Compressed_SRGB8_Punchthrough_Alpha1_ETC2 => 8, when Compressed_RGBA8_ETC2_EAC => 16, when Compressed_SRGB8_Alpha8_ETC2_EAC => 16, -- ASTC when Compressed_RGBA_ASTC_4x4_KHR => 16, when Compressed_RGBA_ASTC_5x4_KHR => 16, when Compressed_RGBA_ASTC_5x5_KHR => 16, when Compressed_RGBA_ASTC_6x5_KHR => 16, when Compressed_RGBA_ASTC_6x6_KHR => 16, when Compressed_RGBA_ASTC_8x5_KHR => 16, when Compressed_RGBA_ASTC_8x6_KHR => 16, when Compressed_RGBA_ASTC_8x8_KHR => 16, when Compressed_RGBA_ASTC_10x5_KHR => 16, when Compressed_RGBA_ASTC_10x6_KHR => 16, when Compressed_RGBA_ASTC_10x8_KHR => 16, when Compressed_RGBA_ASTC_10x10_KHR => 16, when Compressed_RGBA_ASTC_12x10_KHR => 16, when Compressed_RGBA_ASTC_12x12_KHR => 16, when Compressed_SRGB8_ALPHA8_ASTC_4x4_KHR => 16, when Compressed_SRGB8_ALPHA8_ASTC_5x4_KHR => 16, when Compressed_SRGB8_ALPHA8_ASTC_5x5_KHR => 16, when Compressed_SRGB8_ALPHA8_ASTC_6x5_KHR => 16, when Compressed_SRGB8_ALPHA8_ASTC_6x6_KHR => 16, when Compressed_SRGB8_ALPHA8_ASTC_8x5_KHR => 16, when Compressed_SRGB8_ALPHA8_ASTC_8x6_KHR => 16, when Compressed_SRGB8_ALPHA8_ASTC_8x8_KHR => 16, when Compressed_SRGB8_ALPHA8_ASTC_10x5_KHR => 16, when Compressed_SRGB8_ALPHA8_ASTC_10x6_KHR => 16, when Compressed_SRGB8_ALPHA8_ASTC_10x8_KHR => 16, when Compressed_SRGB8_ALPHA8_ASTC_10x10_KHR => 16, when Compressed_SRGB8_ALPHA8_ASTC_12x10_KHR => 16, when Compressed_SRGB8_ALPHA8_ASTC_12x12_KHR => 16); ----------------------------------------------------------------------------- function Depth_Stencil_Format (Format : Internal_Format) return Boolean is (Format in Depth24_Stencil8 | Depth32F_Stencil8); function Depth_Format (Format : Internal_Format) return Boolean is (Format in Depth_Component16 | Depth_Component24 | Depth_Component32F); function Stencil_Format (Format : Internal_Format) return Boolean is (Format in Stencil_Index8); private function Convert is new Ada.Unchecked_Conversion (Source => Alignment, Target => Types.Int); function Byte_Alignment (Value : Alignment) return Byte_Count is (Convert (Value)); end GL.Pixels.Extensions;
with openGL.Visual, ada.unchecked_Deallocation; with ada.Text_IO; use ada.Text_IO; package body gel.Camera is use linear_Algebra_3D; -------- -- Forge -- procedure define (Self : in out Item) is begin Self.view_Transform := Look_at (Eye => Self.Clipper.eye_Position, Center => (Self.Clipper.eye_Position (1), Self.Clipper.eye_Position (2), -100.0), Up => (0.0, 1.0, 0.0)); Self.world_Rotation := y_Rotation_from (0.0); Self.GL.define; end define; procedure destroy (Self : in out Item) is begin Self.GL.destroy; end destroy; procedure free (Self : in out View) is procedure deallocate is new ada.unchecked_Deallocation (Item'Class, View); begin Self.destroy; deallocate (Self); end free; -------------- -- Attributes -- function to_world_Site (Self : in Item'Class; Site : in Vector_3) return Vector_3 is the_perspective_Transform : constant Matrix_4x4 := to_Perspective (FoVy => 60.0, Aspect => Self.Aspect, zNear => Self.near_plane_Distance, zFar => Self. far_plane_Distance); Viewport : constant Rectangle := Self.Clipper.main_Clipping; Position_window_space : constant Vector_3 := (Site (1), Real (Viewport.Max (2)) - Site (2), Site (3)); Site_world_space : constant Vector_3 := unProject (Position_window_space, Model => Self.GL.view_Transform, Projection => the_perspective_Transform, Viewport => Viewport); begin return Site_world_space; end to_world_Site; procedure Site_is (Self : in out Item'Class; Now : in Vector_3) is begin Self.Clipper.eye_Position := Now; Self.view_Transform := to_transform_Matrix ((Self.world_Rotation, -Self.Site)); Self.GL.Site_is (Now); end Site_is; function Site (Self : in Item'Class) return Vector_3 is begin return Self.Clipper.eye_Position; end Site; procedure Position_is (Self : in out Item'Class; Site : in Vector_3; Spin : in Matrix_3x3) is begin Self.Clipper.eye_position := Site; Self.world_Rotation := Spin; Self.view_Transform := to_transform_Matrix ((Self.world_Rotation, -Self.Site)); Self.GL.Position_is (Site, Spin); end Position_is; procedure world_Rotation_is (Self : in out Item'Class; Now : in Matrix_3x3) is begin Self.world_Rotation := Now; Self.view_Transform := to_transform_Matrix ((Self.world_Rotation, -Self.Site)); Self.GL.Spin_is (Now); end world_Rotation_is; function world_Rotation (Self : in Item'Class) return Matrix_3x3 is begin return Self.world_Rotation; end world_Rotation; procedure view_Transform_is (Self : in out Item'Class; Now : in Matrix_4x4) is begin Self.view_Transform := Now; end view_Transform_is; procedure rotation_Speed_is (Self : in out Item'Class; Now : Vector_3) is begin null; -- TODO end rotation_Speed_is; function rotation_Speed (Self : in Item'Class) return Vector_3 is pragma unreferenced (Self); begin return (0.0, 0.0, 0.0); -- TODO end rotation_Speed; function Speed (Self : in Item'Class) return Vector_3 is pragma Unreferenced (Self); begin return (0.0, 0.0, 0.0); -- TODO end Speed; procedure Speed_is (Self : in out Item'Class; Now : in Vector_3) is begin null; -- TODO end Speed_is; function FoVy (Self : in Item'Class) return Degrees is begin return Self.FOVy; end FOVy; function Aspect (Self : in Item'Class) return Real is begin return Self.Aspect; end Aspect; procedure Aspect_is (Self : in out Item'Class; Now : in Real) is begin Self.Aspect := Now; end Aspect_is; function near_plane_Distance (Self : in Item'Class) return Real is begin return Self.near_plane_Distance; end near_plane_Distance; function far_plane_Distance (Self : in Item'Class) return Real is begin return Self.far_plane_Distance; end far_plane_Distance; procedure far_plane_Distance_is (Self : in out Item'Class; Now : in Real) is begin Self.far_plane_Distance := Now; end far_plane_Distance_is; procedure near_plane_Distance_is (Self : in out Item'Class; Now : in Real) is begin Self.near_plane_Distance := Now; Self.GL.near_plane_Distance_is (Now); end near_plane_Distance_is; function ModelView_Matrix (Self : in Item'Class) return Matrix_4x4 is R : Matrix_3x3 renames Self.world_Rotation; S : Vector_3 renames Self.Site; begin return ((R (1, 1), R (1, 2), R (1, 3), 0.0), (R (2, 1), R (2, 2), R (2, 3), 0.0), (R (3, 1), R (3, 2), R (3, 3), 0.0), ( -S (1), -S (2), -S (3), 1.0)); end ModelView_Matrix; -------------- -- Operations -- procedure set_viewport_Size (Self : in out Item'Class; Width, Height : in Integer) is use math.Functions; half_FoV_max_Rads : Real; Tan_of_half_FoV_max_Rads : Real; begin Self.Clipper.main_Clipping.Min (1) := 0; Self.Clipper.main_Clipping.Min (2) := 0; Self.Clipper.main_Clipping.Max (1) := width - 1; Self.Clipper.main_Clipping.Max (2) := height - 1; if Width = 0 or Height = 0 then Self.Aspect := 1.0; else Self.Aspect := Real (Width) / Real (Height); end if; half_FoV_max_Rads := to_Radians (0.5 * Self.FoVy); Tan_of_half_FoV_max_Rads := Tan (half_FoV_max_Rads); Self.near_plane_Height := Self.near_plane_Distance * Tan_of_half_FoV_max_Rads; Self.near_plane_Width := Self.near_plane_Height * Self.Aspect; Self.far_plane_Height := Self.far_plane_Distance * Tan_of_half_FoV_max_Rads; Self.far_plane_Width := Self.far_plane_Height * Self.Aspect; if Self.aspect > 1.0 then -- X side angle is broader than Y side angle. half_FoV_max_Rads := arcTan (Self.Aspect * Tan_of_half_FoV_max_Rads); end if; Self.Clipper.max_dot_product := Sin (half_FoV_max_Rads); Self.projection_Matrix := to_Perspective (FoVy => Self.FoVy, Aspect => Self.Aspect, zNear => Self.near_plane_Distance, zFar => Self. far_plane_Distance); Self.GL.Viewport_is (Width, Height); end set_viewport_Size; procedure Renderer_is (Self : in out Item'Class; Now : in openGL.Renderer.lean.view) is begin Self. Renderer := Now; Self.GL.Renderer_is (Now); end Renderer_is; procedure render (Self : in out Item; the_World : in gel.World.view; To : in openGL.Surface.view) is all_Sprites : gel.World.sprite_transform_Pairs renames the_World.sprite_Transforms; the_Visuals : openGL.Visual.views (1 .. all_Sprites'Length); Count : Natural := 0; begin for i in all_Sprites'Range loop if not all_Sprites (i).Sprite.is_Destroyed and then all_Sprites (i).Sprite.is_Visible then Count := Count + 1; the_Visuals (Count) := all_Sprites (i).Sprite.Visual; the_Visuals (Count).Transform_is (all_Sprites (i).Transform); the_Visuals (Count).Scale_is ((1.0, 1.0, 1.0)); the_Visuals (Count).program_Parameters_are (all_Sprites (i).Sprite.program_Parameters); end if; end loop; Self.GL.render (the_Visuals (1 .. Count)); end render; function cull_Completed (Self : in Item) return Boolean is begin return Self.GL.cull_Completed; end cull_Completed; procedure disable_Cull (Self : in out Item) is begin Self.is_Culling := False; Self.GL.disable_Cull; end disable_Cull; end gel.Camera;
with Ada.Exception_Identification.From_Here; with System.Zero_Terminated_Strings; with C.copyfile; with C.errno; with C.stdio; -- rename(2) package body System.Native_Directories.Copying is use Ada.Exception_Identification.From_Here; use type C.signed_int; use type C.size_t; use type C.unsigned_int; -- implementation procedure Copy_File ( Source_Name : String; Target_Name : String; Overwrite : Boolean := True) is C_Source_Name : C.char_array ( 0 .. Source_Name'Length * Zero_Terminated_Strings.Expanding); C_Target_Name : C.char_array ( 0 .. Target_Name'Length * Zero_Terminated_Strings.Expanding); Flag : C.unsigned_int := C.copyfile.COPYFILE_ALL or C.copyfile.COPYFILE_NOFOLLOW; begin Zero_Terminated_Strings.To_C (Source_Name, C_Source_Name (0)'Access); Zero_Terminated_Strings.To_C (Target_Name, C_Target_Name (0)'Access); if not Overwrite then Flag := Flag or C.copyfile.COPYFILE_EXCL; end if; if C.copyfile.copyfile ( C_Source_Name (0)'Access, C_Target_Name (0)'Access, null, Flag) < 0 then declare errno : constant C.signed_int := C.errno.errno; begin case errno is when C.errno.ENOTSUP => -- the source is not a regular file Raise_Exception (Name_Error'Identity); when others => Raise_Exception (Named_IO_Exception_Id (errno)); end case; end; end if; end Copy_File; procedure Replace_File ( Source_Name : String; Target_Name : String) is C_Source_Name : C.char_array ( 0 .. Source_Name'Length * Zero_Terminated_Strings.Expanding); C_Target_Name : C.char_array ( 0 .. Target_Name'Length * Zero_Terminated_Strings.Expanding); Info : aliased C.sys.stat.struct_stat; Error : Boolean; begin Zero_Terminated_Strings.To_C (Source_Name, C_Source_Name (0)'Access); Zero_Terminated_Strings.To_C (Target_Name, C_Target_Name (0)'Access); -- check whether the source is existing or not. Error := C.sys.stat.lstat (C_Source_Name (0)'Access, Info'Access) < 0; if not Error then -- copy attributes from the target to the source. Error := C.copyfile.copyfile ( C_Target_Name (0)'Access, C_Source_Name (0)'Access, null, C.copyfile.COPYFILE_METADATA or C.copyfile.COPYFILE_NOFOLLOW) < 0; if not Error or else C.errno.errno = C.errno.ENOENT -- target is not existing then -- overwrite the target with the source. Error := C.stdio.rename ( C_Source_Name (0)'Access, C_Target_Name (0)'Access) < 0; end if; end if; if Error then declare errno : constant C.signed_int := C.errno.errno; begin case errno is when C.errno.ENOTSUP => -- the source is not a regular file Raise_Exception (Name_Error'Identity); when others => Raise_Exception (Named_IO_Exception_Id (errno)); end case; end; end if; end Replace_File; end System.Native_Directories.Copying;
-- Mojang API -- No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) -- -- OpenAPI spec version: 2020_06_05 -- -- -- NOTE: This package is auto generated by the swagger code generator 3.3.4. -- https://openapi-generator.tech -- Do not edit the class manually. package body com.github.asyncmc.mojang.api.ada.server.model.Models is use Swagger.Streams; procedure Serialize (Into : in out Swagger.Streams.Output_Stream'Class; Name : in String; Value : in SecurityQuestion_Type) is begin Into.Start_Entity (Name); Into.Write_Entity ("id", Value.Id); Into.Write_Entity ("question", Value.Question); Into.End_Entity (Name); end Serialize; procedure Serialize (Into : in out Swagger.Streams.Output_Stream'Class; Name : in String; Value : in SecurityQuestion_Type_Vectors.Vector) is begin Into.Start_Array (Name); for Item of Value loop Serialize (Into, "", Item); end loop; Into.End_Array (Name); end Serialize; procedure Deserialize (From : in Swagger.Value_Type; Name : in String; Value : out SecurityQuestion_Type) is Object : Swagger.Value_Type; begin Swagger.Streams.Deserialize (From, Name, Object); Swagger.Streams.Deserialize (Object, "id", Value.Id); Swagger.Streams.Deserialize (Object, "question", Value.Question); end Deserialize; procedure Deserialize (From : in Swagger.Value_Type; Name : in String; Value : out SecurityQuestion_Type_Vectors.Vector) is List : Swagger.Value_Array_Type; Item : SecurityQuestion_Type; begin Value.Clear; Swagger.Streams.Deserialize (From, Name, List); for Data of List loop Deserialize (Data, "", Item); Value.Append (Item); end loop; end Deserialize; procedure Serialize (Into : in out Swagger.Streams.Output_Stream'Class; Name : in String; Value : in SecurityAnswerId_Type) is begin Into.Start_Entity (Name); Into.Write_Entity ("id", Value.Id); Into.End_Entity (Name); end Serialize; procedure Serialize (Into : in out Swagger.Streams.Output_Stream'Class; Name : in String; Value : in SecurityAnswerId_Type_Vectors.Vector) is begin Into.Start_Array (Name); for Item of Value loop Serialize (Into, "", Item); end loop; Into.End_Array (Name); end Serialize; procedure Deserialize (From : in Swagger.Value_Type; Name : in String; Value : out SecurityAnswerId_Type) is Object : Swagger.Value_Type; begin Swagger.Streams.Deserialize (From, Name, Object); Swagger.Streams.Deserialize (Object, "id", Value.Id); end Deserialize; procedure Deserialize (From : in Swagger.Value_Type; Name : in String; Value : out SecurityAnswerId_Type_Vectors.Vector) is List : Swagger.Value_Array_Type; Item : SecurityAnswerId_Type; begin Value.Clear; Swagger.Streams.Deserialize (From, Name, List); for Data of List loop Deserialize (Data, "", Item); Value.Append (Item); end loop; end Deserialize; procedure Serialize (Into : in out Swagger.Streams.Output_Stream'Class; Name : in String; Value : in SecurityChallenge_Type) is begin Into.Start_Entity (Name); Serialize (Into, "question", Value.Question); Serialize (Into, "answer", Value.Answer); Into.End_Entity (Name); end Serialize; procedure Serialize (Into : in out Swagger.Streams.Output_Stream'Class; Name : in String; Value : in SecurityChallenge_Type_Vectors.Vector) is begin Into.Start_Array (Name); for Item of Value loop Serialize (Into, "", Item); end loop; Into.End_Array (Name); end Serialize; procedure Deserialize (From : in Swagger.Value_Type; Name : in String; Value : out SecurityChallenge_Type) is Object : Swagger.Value_Type; begin Swagger.Streams.Deserialize (From, Name, Object); Deserialize (Object, "question", Value.Question); Deserialize (Object, "answer", Value.Answer); end Deserialize; procedure Deserialize (From : in Swagger.Value_Type; Name : in String; Value : out SecurityChallenge_Type_Vectors.Vector) is List : Swagger.Value_Array_Type; Item : SecurityChallenge_Type; begin Value.Clear; Swagger.Streams.Deserialize (From, Name, List); for Data of List loop Deserialize (Data, "", Item); Value.Append (Item); end loop; end Deserialize; procedure Serialize (Into : in out Swagger.Streams.Output_Stream'Class; Name : in String; Value : in Error_Type) is begin Into.Start_Entity (Name); Into.Write_Entity ("error", Value.Error); Into.Write_Entity ("errorMessage", Value.Error_Message); Into.End_Entity (Name); end Serialize; procedure Serialize (Into : in out Swagger.Streams.Output_Stream'Class; Name : in String; Value : in Error_Type_Vectors.Vector) is begin Into.Start_Array (Name); for Item of Value loop Serialize (Into, "", Item); end loop; Into.End_Array (Name); end Serialize; procedure Deserialize (From : in Swagger.Value_Type; Name : in String; Value : out Error_Type) is Object : Swagger.Value_Type; begin Swagger.Streams.Deserialize (From, Name, Object); Swagger.Streams.Deserialize (Object, "error", Value.Error); Swagger.Streams.Deserialize (Object, "errorMessage", Value.Error_Message); end Deserialize; procedure Deserialize (From : in Swagger.Value_Type; Name : in String; Value : out Error_Type_Vectors.Vector) is List : Swagger.Value_Array_Type; Item : Error_Type; begin Value.Clear; Swagger.Streams.Deserialize (From, Name, List); for Data of List loop Deserialize (Data, "", Item); Value.Append (Item); end loop; end Deserialize; procedure Serialize (Into : in out Swagger.Streams.Output_Stream'Class; Name : in String; Value : in CurrentPlayerIDs_Type) is begin Into.Start_Entity (Name); Into.Write_Entity ("id", Value.Id); Into.Write_Entity ("name", Value.Name); Into.Write_Entity ("legacy", Value.Legacy); Into.Write_Entity ("demo", Value.Demo); Into.End_Entity (Name); end Serialize; procedure Serialize (Into : in out Swagger.Streams.Output_Stream'Class; Name : in String; Value : in CurrentPlayerIDs_Type_Vectors.Vector) is begin Into.Start_Array (Name); for Item of Value loop Serialize (Into, "", Item); end loop; Into.End_Array (Name); end Serialize; procedure Deserialize (From : in Swagger.Value_Type; Name : in String; Value : out CurrentPlayerIDs_Type) is Object : Swagger.Value_Type; begin Swagger.Streams.Deserialize (From, Name, Object); Swagger.Streams.Deserialize (Object, "id", Value.Id); Swagger.Streams.Deserialize (Object, "name", Value.Name); Swagger.Streams.Deserialize (Object, "legacy", Value.Legacy); Swagger.Streams.Deserialize (Object, "demo", Value.Demo); end Deserialize; procedure Deserialize (From : in Swagger.Value_Type; Name : in String; Value : out CurrentPlayerIDs_Type_Vectors.Vector) is List : Swagger.Value_Array_Type; Item : CurrentPlayerIDs_Type; begin Value.Clear; Swagger.Streams.Deserialize (From, Name, List); for Data of List loop Deserialize (Data, "", Item); Value.Append (Item); end loop; end Deserialize; procedure Serialize (Into : in out Swagger.Streams.Output_Stream'Class; Name : in String; Value : in NameChange_Type) is begin Into.Start_Entity (Name); Into.Write_Entity ("name", Value.Name); Serialize (Into, "changedToAt", Value.Changed_To_At); Into.End_Entity (Name); end Serialize; procedure Serialize (Into : in out Swagger.Streams.Output_Stream'Class; Name : in String; Value : in NameChange_Type_Vectors.Vector) is begin Into.Start_Array (Name); for Item of Value loop Serialize (Into, "", Item); end loop; Into.End_Array (Name); end Serialize; procedure Deserialize (From : in Swagger.Value_Type; Name : in String; Value : out NameChange_Type) is Object : Swagger.Value_Type; begin Swagger.Streams.Deserialize (From, Name, Object); Swagger.Streams.Deserialize (Object, "name", Value.Name); Swagger.Streams.Deserialize (Object, "changedToAt", Value.Changed_To_At); end Deserialize; procedure Deserialize (From : in Swagger.Value_Type; Name : in String; Value : out NameChange_Type_Vectors.Vector) is List : Swagger.Value_Array_Type; Item : NameChange_Type; begin Value.Clear; Swagger.Streams.Deserialize (From, Name, List); for Data of List loop Deserialize (Data, "", Item); Value.Append (Item); end loop; end Deserialize; procedure Serialize (Into : in out Swagger.Streams.Output_Stream'Class; Name : in String; Value : in SkinModel_Type) is begin Into.Start_Entity (Name); Into.End_Entity (Name); end Serialize; procedure Serialize (Into : in out Swagger.Streams.Output_Stream'Class; Name : in String; Value : in SkinModel_Type_Vectors.Vector) is begin Into.Start_Array (Name); for Item of Value loop Serialize (Into, "", Item); end loop; Into.End_Array (Name); end Serialize; procedure Deserialize (From : in Swagger.Value_Type; Name : in String; Value : out SkinModel_Type) is Object : Swagger.Value_Type; begin Swagger.Streams.Deserialize (From, Name, Object); end Deserialize; procedure Deserialize (From : in Swagger.Value_Type; Name : in String; Value : out SkinModel_Type_Vectors.Vector) is List : Swagger.Value_Array_Type; Item : SkinModel_Type; begin Value.Clear; Swagger.Streams.Deserialize (From, Name, List); for Data of List loop Deserialize (Data, "", Item); Value.Append (Item); end loop; end Deserialize; procedure Serialize (Into : in out Swagger.Streams.Output_Stream'Class; Name : in String; Value : in ChangeSkinRequest_Type) is begin Into.Start_Entity (Name); Serialize (Into, "model", Value.Model); Into.Write_Entity ("url", Value.Url); Into.End_Entity (Name); end Serialize; procedure Serialize (Into : in out Swagger.Streams.Output_Stream'Class; Name : in String; Value : in ChangeSkinRequest_Type_Vectors.Vector) is begin Into.Start_Array (Name); for Item of Value loop Serialize (Into, "", Item); end loop; Into.End_Array (Name); end Serialize; procedure Deserialize (From : in Swagger.Value_Type; Name : in String; Value : out ChangeSkinRequest_Type) is Object : Swagger.Value_Type; begin Swagger.Streams.Deserialize (From, Name, Object); Deserialize (Object, "model", Value.Model); Swagger.Streams.Deserialize (Object, "url", Value.Url); end Deserialize; procedure Deserialize (From : in Swagger.Value_Type; Name : in String; Value : out ChangeSkinRequest_Type_Vectors.Vector) is List : Swagger.Value_Array_Type; Item : ChangeSkinRequest_Type; begin Value.Clear; Swagger.Streams.Deserialize (From, Name, List); for Data of List loop Deserialize (Data, "", Item); Value.Append (Item); end loop; end Deserialize; procedure Serialize (Into : in out Swagger.Streams.Output_Stream'Class; Name : in String; Value : in SecurityAnswer_Type) is begin Into.Start_Entity (Name); Into.Write_Entity ("id", Value.Id); Into.End_Entity (Name); end Serialize; procedure Serialize (Into : in out Swagger.Streams.Output_Stream'Class; Name : in String; Value : in SecurityAnswer_Type_Vectors.Vector) is begin Into.Start_Array (Name); for Item of Value loop Serialize (Into, "", Item); end loop; Into.End_Array (Name); end Serialize; procedure Deserialize (From : in Swagger.Value_Type; Name : in String; Value : out SecurityAnswer_Type) is Object : Swagger.Value_Type; begin Swagger.Streams.Deserialize (From, Name, Object); Swagger.Streams.Deserialize (Object, "id", Value.Id); end Deserialize; procedure Deserialize (From : in Swagger.Value_Type; Name : in String; Value : out SecurityAnswer_Type_Vectors.Vector) is List : Swagger.Value_Array_Type; Item : SecurityAnswer_Type; begin Value.Clear; Swagger.Streams.Deserialize (From, Name, List); for Data of List loop Deserialize (Data, "", Item); Value.Append (Item); end loop; end Deserialize; procedure Serialize (Into : in out Swagger.Streams.Output_Stream'Class; Name : in String; Value : in OrderStatisticsResponse_Type) is begin Into.Start_Entity (Name); Serialize (Into, "total", Value.Total); Serialize (Into, "last24h", Value.Last24h); Into.Write_Entity ("saleVelocityPerSeconds", Value.Sale_Velocity_Per_Seconds); Into.End_Entity (Name); end Serialize; procedure Serialize (Into : in out Swagger.Streams.Output_Stream'Class; Name : in String; Value : in OrderStatisticsResponse_Type_Vectors.Vector) is begin Into.Start_Array (Name); for Item of Value loop Serialize (Into, "", Item); end loop; Into.End_Array (Name); end Serialize; procedure Deserialize (From : in Swagger.Value_Type; Name : in String; Value : out OrderStatisticsResponse_Type) is Object : Swagger.Value_Type; begin Swagger.Streams.Deserialize (From, Name, Object); Swagger.Streams.Deserialize (Object, "total", Value.Total); Swagger.Streams.Deserialize (Object, "last24h", Value.Last24h); Swagger.Streams.Deserialize (Object, "saleVelocityPerSeconds", Value.Sale_Velocity_Per_Seconds); end Deserialize; procedure Deserialize (From : in Swagger.Value_Type; Name : in String; Value : out OrderStatisticsResponse_Type_Vectors.Vector) is List : Swagger.Value_Array_Type; Item : OrderStatisticsResponse_Type; begin Value.Clear; Swagger.Streams.Deserialize (From, Name, List); for Data of List loop Deserialize (Data, "", Item); Value.Append (Item); end loop; end Deserialize; procedure Serialize (Into : in out Swagger.Streams.Output_Stream'Class; Name : in String; Value : in OrderStatistic_Type) is begin Into.Start_Entity (Name); Into.End_Entity (Name); end Serialize; procedure Serialize (Into : in out Swagger.Streams.Output_Stream'Class; Name : in String; Value : in OrderStatistic_Type_Vectors.Vector) is begin Into.Start_Array (Name); for Item of Value loop Serialize (Into, "", Item); end loop; Into.End_Array (Name); end Serialize; procedure Deserialize (From : in Swagger.Value_Type; Name : in String; Value : out OrderStatistic_Type) is Object : Swagger.Value_Type; begin Swagger.Streams.Deserialize (From, Name, Object); end Deserialize; procedure Deserialize (From : in Swagger.Value_Type; Name : in String; Value : out OrderStatistic_Type_Vectors.Vector) is List : Swagger.Value_Array_Type; Item : OrderStatistic_Type; begin Value.Clear; Swagger.Streams.Deserialize (From, Name, List); for Data of List loop Deserialize (Data, "", Item); Value.Append (Item); end loop; end Deserialize; procedure Serialize (Into : in out Swagger.Streams.Output_Stream'Class; Name : in String; Value : in OrderStatisticsRequest_Type) is begin Into.Start_Entity (Name); Serialize (Into, "metricKeys", Value.Metric_Keys); Into.End_Entity (Name); end Serialize; procedure Serialize (Into : in out Swagger.Streams.Output_Stream'Class; Name : in String; Value : in OrderStatisticsRequest_Type_Vectors.Vector) is begin Into.Start_Array (Name); for Item of Value loop Serialize (Into, "", Item); end loop; Into.End_Array (Name); end Serialize; procedure Deserialize (From : in Swagger.Value_Type; Name : in String; Value : out OrderStatisticsRequest_Type) is Object : Swagger.Value_Type; begin Swagger.Streams.Deserialize (From, Name, Object); Deserialize (Object, "metricKeys", Value.Metric_Keys); end Deserialize; procedure Deserialize (From : in Swagger.Value_Type; Name : in String; Value : out OrderStatisticsRequest_Type_Vectors.Vector) is List : Swagger.Value_Array_Type; Item : OrderStatisticsRequest_Type; begin Value.Clear; Swagger.Streams.Deserialize (From, Name, List); for Data of List loop Deserialize (Data, "", Item); Value.Append (Item); end loop; end Deserialize; procedure Serialize (Into : in out Swagger.Streams.Output_Stream'Class; Name : in String; Value : in UploadSkinRequest_Type) is begin Into.Start_Entity (Name); Serialize (Into, "model", Value.Model); Serialize (Into, "file", Value.File); Into.End_Entity (Name); end Serialize; procedure Serialize (Into : in out Swagger.Streams.Output_Stream'Class; Name : in String; Value : in UploadSkinRequest_Type_Vectors.Vector) is begin Into.Start_Array (Name); for Item of Value loop Serialize (Into, "", Item); end loop; Into.End_Array (Name); end Serialize; procedure Deserialize (From : in Swagger.Value_Type; Name : in String; Value : out UploadSkinRequest_Type) is Object : Swagger.Value_Type; begin Swagger.Streams.Deserialize (From, Name, Object); Deserialize (Object, "model", Value.Model); Deserialize (Object, "file", Value.File); end Deserialize; procedure Deserialize (From : in Swagger.Value_Type; Name : in String; Value : out UploadSkinRequest_Type_Vectors.Vector) is List : Swagger.Value_Array_Type; Item : UploadSkinRequest_Type; begin Value.Clear; Swagger.Streams.Deserialize (From, Name, List); for Data of List loop Deserialize (Data, "", Item); Value.Append (Item); end loop; end Deserialize; end com.github.asyncmc.mojang.api.ada.server.model.Models;
-- RUN: %llvmgcc -S -g %s package Debug_Var_Size is subtype Length_Type is Positive range 1 .. 64; type T (Length : Length_Type := 1) is record Varying_Length : String (1 .. Length); Fixed_Length : Boolean; end record; end;
-- Copyright (c) 2019 Maxim Reznik <reznikmm@gmail.com> -- -- SPDX-License-Identifier: MIT -- License-Filename: LICENSE ------------------------------------------------------------- with Slim.Players; with League.Strings; package Slim.Menu_Commands.Play_Radio_Commands is type Play_Radio_Command (Player : Slim.Players.Player_Access) is new Menu_Command with record URL : League.Strings.Universal_String; end record; overriding procedure Run (Self : Play_Radio_Command); end Slim.Menu_Commands.Play_Radio_Commands;