repo_name
stringlengths
9
74
language
stringclasses
1 value
length_bytes
int64
11
9.34M
extension
stringclasses
2 values
content
stringlengths
11
9.34M
NormanDunbar/Sarge
Ada
1,147
adb
-- sarge_test.cpp - Implementation file for the Sarge command line argument parser test. -- Revision 0 -- Features: -- - -- Notes: -- - -- 2019/04/10, Maya Posch with Sarge; with Ada.Text_IO; use Ada.Text_IO; procedure Sarge_test is begin -- Create Sarge instance, set stuff, parse stuff. Sarge.setArgument("h", "help", "Get help.", Boolean.False); Sarge.setArgument("k", "kittens", "K is for kittens. Everyone needs kittens in their life.", Boolean.True); Sarge.setArgument("n", "number", "Gimme a number. Any number.", Boolean.True); Sarge.setArgument("a", "apple", "Just an apple.", Boolean.False); Sarge.setArgument("b", "bear", "Look, it's a bear.", Boolean.False); Sarge.setDescription("Sarge command line argument parsing testing app. For demonstration purposes and testing."); Sarge.setUsage("sarge_test <options>"); if Sarge.parseArguments /= True then put_line("Couldn't parse arguments..."); return; end if; put_line("Number of flags found: " & Sarge.flagCount); if Sarge.exists("help") /= False then Sarge.printHelp; else put_line("No help requested..."); end if; -- end Sarge_test;
simonjwright/sdlada
Ada
2,874
adb
-------------------------------------------------------------------------------------------------------------------- -- Copyright (c) 2013-2020, Luke A. Guest -- -- This software is provided 'as-is', without any express or implied -- warranty. In no event will the authors be held liable for any damages -- arising from the use of this software. -- -- Permission is granted to anyone to use this software for any purpose, -- including commercial applications, and to alter it and redistribute it -- freely, subject to the following restrictions: -- -- 1. The origin of this software must not be misrepresented; you must not -- claim that you wrote the original software. If you use this software -- in a product, an acknowledgment in the product documentation would be -- appreciated but is not required. -- -- 2. Altered source versions must be plainly marked as such, and must not be -- misrepresented as being the original software. -- -- 3. This notice may not be removed or altered from any source -- distribution. -------------------------------------------------------------------------------------------------------------------- with Interfaces.C.Strings; with SDL.Error; with SDL.Video.Windows; package body SDL.Clipboard is package C renames Interfaces.C; procedure Check_For_Window is Init_Value : constant SDL.Init_Flags := SDL.Was_Initialised and SDL.Enable_Screen; begin if Init_Value /= SDL.Enable_Screen then raise Clipboard_Error with "SDL screen subsystem has not been initialised."; end if; if SDL.Video.Windows.Exist = False then raise Clipboard_Error with "No windows have been created."; end if; end Check_For_Window; function Get return Ada.Strings.UTF_Encoding.UTF_8_String is function SDL_Get_Clipboard_Text return C.Strings.chars_ptr with Import => True, Convention => C, External_Name => "SDL_GetClipboardText"; begin Check_For_Window; return C.Strings.Value (SDL_Get_Clipboard_Text); end Get; function Is_Empty return Boolean is function SDL_Has_Clipboard_Text return SDL_Bool with Import => True, Convention => C, External_Name => "SDL_HasClipboardText"; begin Check_For_Window; return (if SDL_Has_Clipboard_Text = SDL_True then False else True); end Is_Empty; procedure Set (Text : in Ada.Strings.UTF_Encoding.UTF_8_String) is function SDL_Set_Clipboard_Text (C_Str : in C.char_array) return C.int with Import => True, Convention => C, External_Name => "SDL_SetClipboardText"; begin Check_For_Window; if SDL_Set_Clipboard_Text (C.To_C (Text)) /= Success then raise Clipboard_Error with SDL.Error.Get; end if; end Set; end SDL.Clipboard;
osannolik/Ada_Drivers_Library
Ada
62,520
ads
-- This spec has been automatically generated from STM32F446x.svd pragma Restrictions (No_Elaboration_Code); pragma Ada_2012; pragma Style_Checks (Off); with HAL; with System; package STM32_SVD.CAN is pragma Preelaborate; --------------- -- Registers -- --------------- -- master control register type MCR_Register is record -- INRQ INRQ : Boolean := False; -- SLEEP SLEEP : Boolean := True; -- TXFP TXFP : Boolean := False; -- RFLM RFLM : Boolean := False; -- NART NART : Boolean := False; -- AWUM AWUM : Boolean := False; -- ABOM ABOM : Boolean := False; -- TTCM TTCM : Boolean := False; -- unspecified Reserved_8_14 : HAL.UInt7 := 16#0#; -- RESET RESET : Boolean := False; -- DBF DBF : Boolean := True; -- unspecified Reserved_17_31 : HAL.UInt15 := 16#0#; end record with Volatile_Full_Access, Size => 32, Bit_Order => System.Low_Order_First; for MCR_Register use record INRQ at 0 range 0 .. 0; SLEEP at 0 range 1 .. 1; TXFP at 0 range 2 .. 2; RFLM at 0 range 3 .. 3; NART at 0 range 4 .. 4; AWUM at 0 range 5 .. 5; ABOM at 0 range 6 .. 6; TTCM at 0 range 7 .. 7; Reserved_8_14 at 0 range 8 .. 14; RESET at 0 range 15 .. 15; DBF at 0 range 16 .. 16; Reserved_17_31 at 0 range 17 .. 31; end record; -- master status register type MSR_Register is record -- Read-only. INAK INAK : Boolean := False; -- Read-only. SLAK SLAK : Boolean := True; -- ERRI ERRI : Boolean := False; -- WKUI WKUI : Boolean := False; -- SLAKI SLAKI : Boolean := False; -- unspecified Reserved_5_7 : HAL.UInt3 := 16#0#; -- Read-only. TXM TXM : Boolean := False; -- Read-only. RXM RXM : Boolean := False; -- Read-only. SAMP SAMP : Boolean := True; -- Read-only. RX RX : Boolean := True; -- unspecified Reserved_12_31 : HAL.UInt20 := 16#0#; end record with Volatile_Full_Access, Size => 32, Bit_Order => System.Low_Order_First; for MSR_Register use record INAK at 0 range 0 .. 0; SLAK at 0 range 1 .. 1; ERRI at 0 range 2 .. 2; WKUI at 0 range 3 .. 3; SLAKI at 0 range 4 .. 4; Reserved_5_7 at 0 range 5 .. 7; TXM at 0 range 8 .. 8; RXM at 0 range 9 .. 9; SAMP at 0 range 10 .. 10; RX at 0 range 11 .. 11; Reserved_12_31 at 0 range 12 .. 31; end record; subtype TSR_CODE_Field is HAL.UInt2; -- TSR_TME array type TSR_TME_Field_Array is array (0 .. 2) of Boolean with Component_Size => 1, Size => 3; -- Type definition for TSR_TME type TSR_TME_Field (As_Array : Boolean := False) is record case As_Array is when False => -- TME as a value Val : HAL.UInt3; when True => -- TME as an array Arr : TSR_TME_Field_Array; end case; end record with Unchecked_Union, Size => 3; for TSR_TME_Field use record Val at 0 range 0 .. 2; Arr at 0 range 0 .. 2; end record; -- TSR_LOW array type TSR_LOW_Field_Array is array (0 .. 2) of Boolean with Component_Size => 1, Size => 3; -- Type definition for TSR_LOW type TSR_LOW_Field (As_Array : Boolean := False) is record case As_Array is when False => -- LOW as a value Val : HAL.UInt3; when True => -- LOW as an array Arr : TSR_LOW_Field_Array; end case; end record with Unchecked_Union, Size => 3; for TSR_LOW_Field use record Val at 0 range 0 .. 2; Arr at 0 range 0 .. 2; end record; -- transmit status register type TSR_Register is record -- RQCP0 RQCP0 : Boolean := False; -- TXOK0 TXOK0 : Boolean := False; -- ALST0 ALST0 : Boolean := False; -- TERR0 TERR0 : Boolean := False; -- unspecified Reserved_4_6 : HAL.UInt3 := 16#0#; -- ABRQ0 ABRQ0 : Boolean := False; -- RQCP1 RQCP1 : Boolean := False; -- TXOK1 TXOK1 : Boolean := False; -- ALST1 ALST1 : Boolean := False; -- TERR1 TERR1 : Boolean := False; -- unspecified Reserved_12_14 : HAL.UInt3 := 16#0#; -- ABRQ1 ABRQ1 : Boolean := False; -- RQCP2 RQCP2 : Boolean := False; -- TXOK2 TXOK2 : Boolean := False; -- ALST2 ALST2 : Boolean := False; -- TERR2 TERR2 : Boolean := False; -- unspecified Reserved_20_22 : HAL.UInt3 := 16#0#; -- ABRQ2 ABRQ2 : Boolean := False; -- Read-only. CODE CODE : TSR_CODE_Field := 16#0#; -- Read-only. Lowest priority flag for mailbox 0 TME : TSR_TME_Field := (As_Array => False, Val => 16#1#); -- Read-only. Lowest priority flag for mailbox 0 LOW : TSR_LOW_Field := (As_Array => False, Val => 16#0#); end record with Volatile_Full_Access, Size => 32, Bit_Order => System.Low_Order_First; for TSR_Register use record RQCP0 at 0 range 0 .. 0; TXOK0 at 0 range 1 .. 1; ALST0 at 0 range 2 .. 2; TERR0 at 0 range 3 .. 3; Reserved_4_6 at 0 range 4 .. 6; ABRQ0 at 0 range 7 .. 7; RQCP1 at 0 range 8 .. 8; TXOK1 at 0 range 9 .. 9; ALST1 at 0 range 10 .. 10; TERR1 at 0 range 11 .. 11; Reserved_12_14 at 0 range 12 .. 14; ABRQ1 at 0 range 15 .. 15; RQCP2 at 0 range 16 .. 16; TXOK2 at 0 range 17 .. 17; ALST2 at 0 range 18 .. 18; TERR2 at 0 range 19 .. 19; Reserved_20_22 at 0 range 20 .. 22; ABRQ2 at 0 range 23 .. 23; CODE at 0 range 24 .. 25; TME at 0 range 26 .. 28; LOW at 0 range 29 .. 31; end record; subtype RF0R_FMP0_Field is HAL.UInt2; -- receive FIFO 0 register type RF0R_Register is record -- Read-only. FMP0 FMP0 : RF0R_FMP0_Field := 16#0#; -- unspecified Reserved_2_2 : HAL.Bit := 16#0#; -- FULL0 FULL0 : Boolean := False; -- FOVR0 FOVR0 : Boolean := False; -- RFOM0 RFOM0 : Boolean := False; -- unspecified Reserved_6_31 : HAL.UInt26 := 16#0#; end record with Volatile_Full_Access, Size => 32, Bit_Order => System.Low_Order_First; for RF0R_Register use record FMP0 at 0 range 0 .. 1; Reserved_2_2 at 0 range 2 .. 2; FULL0 at 0 range 3 .. 3; FOVR0 at 0 range 4 .. 4; RFOM0 at 0 range 5 .. 5; Reserved_6_31 at 0 range 6 .. 31; end record; subtype RF1R_FMP1_Field is HAL.UInt2; -- receive FIFO 1 register type RF1R_Register is record -- Read-only. FMP1 FMP1 : RF1R_FMP1_Field := 16#0#; -- unspecified Reserved_2_2 : HAL.Bit := 16#0#; -- FULL1 FULL1 : Boolean := False; -- FOVR1 FOVR1 : Boolean := False; -- RFOM1 RFOM1 : Boolean := False; -- unspecified Reserved_6_31 : HAL.UInt26 := 16#0#; end record with Volatile_Full_Access, Size => 32, Bit_Order => System.Low_Order_First; for RF1R_Register use record FMP1 at 0 range 0 .. 1; Reserved_2_2 at 0 range 2 .. 2; FULL1 at 0 range 3 .. 3; FOVR1 at 0 range 4 .. 4; RFOM1 at 0 range 5 .. 5; Reserved_6_31 at 0 range 6 .. 31; end record; -- interrupt enable register type IER_Register is record -- TMEIE TMEIE : Boolean := False; -- FMPIE0 FMPIE0 : Boolean := False; -- FFIE0 FFIE0 : Boolean := False; -- FOVIE0 FOVIE0 : Boolean := False; -- FMPIE1 FMPIE1 : Boolean := False; -- FFIE1 FFIE1 : Boolean := False; -- FOVIE1 FOVIE1 : Boolean := False; -- unspecified Reserved_7_7 : HAL.Bit := 16#0#; -- EWGIE EWGIE : Boolean := False; -- EPVIE EPVIE : Boolean := False; -- BOFIE BOFIE : Boolean := False; -- LECIE LECIE : Boolean := False; -- unspecified Reserved_12_14 : HAL.UInt3 := 16#0#; -- ERRIE ERRIE : Boolean := False; -- WKUIE WKUIE : Boolean := False; -- SLKIE SLKIE : Boolean := False; -- unspecified Reserved_18_31 : HAL.UInt14 := 16#0#; end record with Volatile_Full_Access, Size => 32, Bit_Order => System.Low_Order_First; for IER_Register use record TMEIE at 0 range 0 .. 0; FMPIE0 at 0 range 1 .. 1; FFIE0 at 0 range 2 .. 2; FOVIE0 at 0 range 3 .. 3; FMPIE1 at 0 range 4 .. 4; FFIE1 at 0 range 5 .. 5; FOVIE1 at 0 range 6 .. 6; Reserved_7_7 at 0 range 7 .. 7; EWGIE at 0 range 8 .. 8; EPVIE at 0 range 9 .. 9; BOFIE at 0 range 10 .. 10; LECIE at 0 range 11 .. 11; Reserved_12_14 at 0 range 12 .. 14; ERRIE at 0 range 15 .. 15; WKUIE at 0 range 16 .. 16; SLKIE at 0 range 17 .. 17; Reserved_18_31 at 0 range 18 .. 31; end record; subtype ESR_LEC_Field is HAL.UInt3; subtype ESR_TEC_Field is HAL.UInt8; subtype ESR_REC_Field is HAL.UInt8; -- interrupt enable register type ESR_Register is record -- Read-only. EWGF EWGF : Boolean := False; -- Read-only. EPVF EPVF : Boolean := False; -- Read-only. BOFF BOFF : Boolean := False; -- unspecified Reserved_3_3 : HAL.Bit := 16#0#; -- LEC LEC : ESR_LEC_Field := 16#0#; -- unspecified Reserved_7_15 : HAL.UInt9 := 16#0#; -- Read-only. TEC TEC : ESR_TEC_Field := 16#0#; -- Read-only. REC REC : ESR_REC_Field := 16#0#; end record with Volatile_Full_Access, Size => 32, Bit_Order => System.Low_Order_First; for ESR_Register use record EWGF at 0 range 0 .. 0; EPVF at 0 range 1 .. 1; BOFF at 0 range 2 .. 2; Reserved_3_3 at 0 range 3 .. 3; LEC at 0 range 4 .. 6; Reserved_7_15 at 0 range 7 .. 15; TEC at 0 range 16 .. 23; REC at 0 range 24 .. 31; end record; subtype BTR_BRP_Field is HAL.UInt10; subtype BTR_TS1_Field is HAL.UInt4; subtype BTR_TS2_Field is HAL.UInt3; subtype BTR_SJW_Field is HAL.UInt2; -- bit timing register type BTR_Register is record -- BRP BRP : BTR_BRP_Field := 16#0#; -- unspecified Reserved_10_15 : HAL.UInt6 := 16#0#; -- TS1 TS1 : BTR_TS1_Field := 16#0#; -- TS2 TS2 : BTR_TS2_Field := 16#0#; -- unspecified Reserved_23_23 : HAL.Bit := 16#0#; -- SJW SJW : BTR_SJW_Field := 16#0#; -- unspecified Reserved_26_29 : HAL.UInt4 := 16#0#; -- LBKM LBKM : Boolean := False; -- SILM SILM : Boolean := False; end record with Volatile_Full_Access, Size => 32, Bit_Order => System.Low_Order_First; for BTR_Register use record BRP at 0 range 0 .. 9; Reserved_10_15 at 0 range 10 .. 15; TS1 at 0 range 16 .. 19; TS2 at 0 range 20 .. 22; Reserved_23_23 at 0 range 23 .. 23; SJW at 0 range 24 .. 25; Reserved_26_29 at 0 range 26 .. 29; LBKM at 0 range 30 .. 30; SILM at 0 range 31 .. 31; end record; subtype TI0R_EXID_Field is HAL.UInt18; subtype TI0R_STID_Field is HAL.UInt11; -- TX mailbox identifier register type TI0R_Register is record -- TXRQ TXRQ : Boolean := False; -- RTR RTR : Boolean := False; -- IDE IDE : Boolean := False; -- EXID EXID : TI0R_EXID_Field := 16#0#; -- STID STID : TI0R_STID_Field := 16#0#; end record with Volatile_Full_Access, Size => 32, Bit_Order => System.Low_Order_First; for TI0R_Register use record TXRQ at 0 range 0 .. 0; RTR at 0 range 1 .. 1; IDE at 0 range 2 .. 2; EXID at 0 range 3 .. 20; STID at 0 range 21 .. 31; end record; subtype TDT0R_DLC_Field is HAL.UInt4; subtype TDT0R_TIME_Field is HAL.UInt16; -- mailbox data length control and time stamp register type TDT0R_Register is record -- DLC DLC : TDT0R_DLC_Field := 16#0#; -- unspecified Reserved_4_7 : HAL.UInt4 := 16#0#; -- TGT TGT : Boolean := False; -- unspecified Reserved_9_15 : HAL.UInt7 := 16#0#; -- TIME TIME : TDT0R_TIME_Field := 16#0#; end record with Volatile_Full_Access, Size => 32, Bit_Order => System.Low_Order_First; for TDT0R_Register use record DLC at 0 range 0 .. 3; Reserved_4_7 at 0 range 4 .. 7; TGT at 0 range 8 .. 8; Reserved_9_15 at 0 range 9 .. 15; TIME at 0 range 16 .. 31; end record; -- TDL0R_DATA array element subtype TDL0R_DATA_Element is HAL.UInt8; -- TDL0R_DATA array type TDL0R_DATA_Field_Array is array (0 .. 3) of TDL0R_DATA_Element with Component_Size => 8, Size => 32; -- mailbox data low register type TDL0R_Register (As_Array : Boolean := False) is record case As_Array is when False => -- DATA as a value Val : HAL.UInt32; when True => -- DATA as an array Arr : TDL0R_DATA_Field_Array; end case; end record with Unchecked_Union, Size => 32, Volatile_Full_Access, Bit_Order => System.Low_Order_First; for TDL0R_Register use record Val at 0 range 0 .. 31; Arr at 0 range 0 .. 31; end record; -- TDH0R_DATA array element subtype TDH0R_DATA_Element is HAL.UInt8; -- TDH0R_DATA array type TDH0R_DATA_Field_Array is array (4 .. 7) of TDH0R_DATA_Element with Component_Size => 8, Size => 32; -- mailbox data high register type TDH0R_Register (As_Array : Boolean := False) is record case As_Array is when False => -- DATA as a value Val : HAL.UInt32; when True => -- DATA as an array Arr : TDH0R_DATA_Field_Array; end case; end record with Unchecked_Union, Size => 32, Volatile_Full_Access, Bit_Order => System.Low_Order_First; for TDH0R_Register use record Val at 0 range 0 .. 31; Arr at 0 range 0 .. 31; end record; subtype TI1R_EXID_Field is HAL.UInt18; subtype TI1R_STID_Field is HAL.UInt11; -- mailbox identifier register type TI1R_Register is record -- TXRQ TXRQ : Boolean := False; -- RTR RTR : Boolean := False; -- IDE IDE : Boolean := False; -- EXID EXID : TI1R_EXID_Field := 16#0#; -- STID STID : TI1R_STID_Field := 16#0#; end record with Volatile_Full_Access, Size => 32, Bit_Order => System.Low_Order_First; for TI1R_Register use record TXRQ at 0 range 0 .. 0; RTR at 0 range 1 .. 1; IDE at 0 range 2 .. 2; EXID at 0 range 3 .. 20; STID at 0 range 21 .. 31; end record; subtype TDT1R_DLC_Field is HAL.UInt4; subtype TDT1R_TIME_Field is HAL.UInt16; -- mailbox data length control and time stamp register type TDT1R_Register is record -- DLC DLC : TDT1R_DLC_Field := 16#0#; -- unspecified Reserved_4_7 : HAL.UInt4 := 16#0#; -- TGT TGT : Boolean := False; -- unspecified Reserved_9_15 : HAL.UInt7 := 16#0#; -- TIME TIME : TDT1R_TIME_Field := 16#0#; end record with Volatile_Full_Access, Size => 32, Bit_Order => System.Low_Order_First; for TDT1R_Register use record DLC at 0 range 0 .. 3; Reserved_4_7 at 0 range 4 .. 7; TGT at 0 range 8 .. 8; Reserved_9_15 at 0 range 9 .. 15; TIME at 0 range 16 .. 31; end record; -- TDL1R_DATA array element subtype TDL1R_DATA_Element is HAL.UInt8; -- TDL1R_DATA array type TDL1R_DATA_Field_Array is array (0 .. 3) of TDL1R_DATA_Element with Component_Size => 8, Size => 32; -- mailbox data low register type TDL1R_Register (As_Array : Boolean := False) is record case As_Array is when False => -- DATA as a value Val : HAL.UInt32; when True => -- DATA as an array Arr : TDL1R_DATA_Field_Array; end case; end record with Unchecked_Union, Size => 32, Volatile_Full_Access, Bit_Order => System.Low_Order_First; for TDL1R_Register use record Val at 0 range 0 .. 31; Arr at 0 range 0 .. 31; end record; -- TDH1R_DATA array element subtype TDH1R_DATA_Element is HAL.UInt8; -- TDH1R_DATA array type TDH1R_DATA_Field_Array is array (4 .. 7) of TDH1R_DATA_Element with Component_Size => 8, Size => 32; -- mailbox data high register type TDH1R_Register (As_Array : Boolean := False) is record case As_Array is when False => -- DATA as a value Val : HAL.UInt32; when True => -- DATA as an array Arr : TDH1R_DATA_Field_Array; end case; end record with Unchecked_Union, Size => 32, Volatile_Full_Access, Bit_Order => System.Low_Order_First; for TDH1R_Register use record Val at 0 range 0 .. 31; Arr at 0 range 0 .. 31; end record; subtype TI2R_EXID_Field is HAL.UInt18; subtype TI2R_STID_Field is HAL.UInt11; -- mailbox identifier register type TI2R_Register is record -- TXRQ TXRQ : Boolean := False; -- RTR RTR : Boolean := False; -- IDE IDE : Boolean := False; -- EXID EXID : TI2R_EXID_Field := 16#0#; -- STID STID : TI2R_STID_Field := 16#0#; end record with Volatile_Full_Access, Size => 32, Bit_Order => System.Low_Order_First; for TI2R_Register use record TXRQ at 0 range 0 .. 0; RTR at 0 range 1 .. 1; IDE at 0 range 2 .. 2; EXID at 0 range 3 .. 20; STID at 0 range 21 .. 31; end record; subtype TDT2R_DLC_Field is HAL.UInt4; subtype TDT2R_TIME_Field is HAL.UInt16; -- mailbox data length control and time stamp register type TDT2R_Register is record -- DLC DLC : TDT2R_DLC_Field := 16#0#; -- unspecified Reserved_4_7 : HAL.UInt4 := 16#0#; -- TGT TGT : Boolean := False; -- unspecified Reserved_9_15 : HAL.UInt7 := 16#0#; -- TIME TIME : TDT2R_TIME_Field := 16#0#; end record with Volatile_Full_Access, Size => 32, Bit_Order => System.Low_Order_First; for TDT2R_Register use record DLC at 0 range 0 .. 3; Reserved_4_7 at 0 range 4 .. 7; TGT at 0 range 8 .. 8; Reserved_9_15 at 0 range 9 .. 15; TIME at 0 range 16 .. 31; end record; -- TDL2R_DATA array element subtype TDL2R_DATA_Element is HAL.UInt8; -- TDL2R_DATA array type TDL2R_DATA_Field_Array is array (0 .. 3) of TDL2R_DATA_Element with Component_Size => 8, Size => 32; -- mailbox data low register type TDL2R_Register (As_Array : Boolean := False) is record case As_Array is when False => -- DATA as a value Val : HAL.UInt32; when True => -- DATA as an array Arr : TDL2R_DATA_Field_Array; end case; end record with Unchecked_Union, Size => 32, Volatile_Full_Access, Bit_Order => System.Low_Order_First; for TDL2R_Register use record Val at 0 range 0 .. 31; Arr at 0 range 0 .. 31; end record; -- TDH2R_DATA array element subtype TDH2R_DATA_Element is HAL.UInt8; -- TDH2R_DATA array type TDH2R_DATA_Field_Array is array (4 .. 7) of TDH2R_DATA_Element with Component_Size => 8, Size => 32; -- mailbox data high register type TDH2R_Register (As_Array : Boolean := False) is record case As_Array is when False => -- DATA as a value Val : HAL.UInt32; when True => -- DATA as an array Arr : TDH2R_DATA_Field_Array; end case; end record with Unchecked_Union, Size => 32, Volatile_Full_Access, Bit_Order => System.Low_Order_First; for TDH2R_Register use record Val at 0 range 0 .. 31; Arr at 0 range 0 .. 31; end record; subtype RI0R_EXID_Field is HAL.UInt18; subtype RI0R_STID_Field is HAL.UInt11; -- receive FIFO mailbox identifier register type RI0R_Register is record -- unspecified Reserved_0_0 : HAL.Bit; -- Read-only. RTR RTR : Boolean; -- Read-only. IDE IDE : Boolean; -- Read-only. EXID EXID : RI0R_EXID_Field; -- Read-only. STID STID : RI0R_STID_Field; end record with Volatile_Full_Access, Size => 32, Bit_Order => System.Low_Order_First; for RI0R_Register use record Reserved_0_0 at 0 range 0 .. 0; RTR at 0 range 1 .. 1; IDE at 0 range 2 .. 2; EXID at 0 range 3 .. 20; STID at 0 range 21 .. 31; end record; subtype RDT0R_DLC_Field is HAL.UInt4; subtype RDT0R_FMI_Field is HAL.UInt8; subtype RDT0R_TIME_Field is HAL.UInt16; -- mailbox data high register type RDT0R_Register is record -- Read-only. DLC DLC : RDT0R_DLC_Field; -- unspecified Reserved_4_7 : HAL.UInt4; -- Read-only. FMI FMI : RDT0R_FMI_Field; -- Read-only. TIME TIME : RDT0R_TIME_Field; end record with Volatile_Full_Access, Size => 32, Bit_Order => System.Low_Order_First; for RDT0R_Register use record DLC at 0 range 0 .. 3; Reserved_4_7 at 0 range 4 .. 7; FMI at 0 range 8 .. 15; TIME at 0 range 16 .. 31; end record; -- RDL0R_DATA array element subtype RDL0R_DATA_Element is HAL.UInt8; -- RDL0R_DATA array type RDL0R_DATA_Field_Array is array (0 .. 3) of RDL0R_DATA_Element with Component_Size => 8, Size => 32; -- mailbox data high register type RDL0R_Register (As_Array : Boolean := False) is record case As_Array is when False => -- DATA as a value Val : HAL.UInt32; when True => -- DATA as an array Arr : RDL0R_DATA_Field_Array; end case; end record with Unchecked_Union, Size => 32, Volatile_Full_Access, Bit_Order => System.Low_Order_First; for RDL0R_Register use record Val at 0 range 0 .. 31; Arr at 0 range 0 .. 31; end record; -- RDH0R_DATA array element subtype RDH0R_DATA_Element is HAL.UInt8; -- RDH0R_DATA array type RDH0R_DATA_Field_Array is array (4 .. 7) of RDH0R_DATA_Element with Component_Size => 8, Size => 32; -- receive FIFO mailbox data high register type RDH0R_Register (As_Array : Boolean := False) is record case As_Array is when False => -- DATA as a value Val : HAL.UInt32; when True => -- DATA as an array Arr : RDH0R_DATA_Field_Array; end case; end record with Unchecked_Union, Size => 32, Volatile_Full_Access, Bit_Order => System.Low_Order_First; for RDH0R_Register use record Val at 0 range 0 .. 31; Arr at 0 range 0 .. 31; end record; subtype RI1R_EXID_Field is HAL.UInt18; subtype RI1R_STID_Field is HAL.UInt11; -- mailbox data high register type RI1R_Register is record -- unspecified Reserved_0_0 : HAL.Bit; -- Read-only. RTR RTR : Boolean; -- Read-only. IDE IDE : Boolean; -- Read-only. EXID EXID : RI1R_EXID_Field; -- Read-only. STID STID : RI1R_STID_Field; end record with Volatile_Full_Access, Size => 32, Bit_Order => System.Low_Order_First; for RI1R_Register use record Reserved_0_0 at 0 range 0 .. 0; RTR at 0 range 1 .. 1; IDE at 0 range 2 .. 2; EXID at 0 range 3 .. 20; STID at 0 range 21 .. 31; end record; subtype RDT1R_DLC_Field is HAL.UInt4; subtype RDT1R_FMI_Field is HAL.UInt8; subtype RDT1R_TIME_Field is HAL.UInt16; -- mailbox data high register type RDT1R_Register is record -- Read-only. DLC DLC : RDT1R_DLC_Field; -- unspecified Reserved_4_7 : HAL.UInt4; -- Read-only. FMI FMI : RDT1R_FMI_Field; -- Read-only. TIME TIME : RDT1R_TIME_Field; end record with Volatile_Full_Access, Size => 32, Bit_Order => System.Low_Order_First; for RDT1R_Register use record DLC at 0 range 0 .. 3; Reserved_4_7 at 0 range 4 .. 7; FMI at 0 range 8 .. 15; TIME at 0 range 16 .. 31; end record; -- RDL1R_DATA array element subtype RDL1R_DATA_Element is HAL.UInt8; -- RDL1R_DATA array type RDL1R_DATA_Field_Array is array (0 .. 3) of RDL1R_DATA_Element with Component_Size => 8, Size => 32; -- mailbox data high register type RDL1R_Register (As_Array : Boolean := False) is record case As_Array is when False => -- DATA as a value Val : HAL.UInt32; when True => -- DATA as an array Arr : RDL1R_DATA_Field_Array; end case; end record with Unchecked_Union, Size => 32, Volatile_Full_Access, Bit_Order => System.Low_Order_First; for RDL1R_Register use record Val at 0 range 0 .. 31; Arr at 0 range 0 .. 31; end record; -- RDH1R_DATA array element subtype RDH1R_DATA_Element is HAL.UInt8; -- RDH1R_DATA array type RDH1R_DATA_Field_Array is array (4 .. 7) of RDH1R_DATA_Element with Component_Size => 8, Size => 32; -- mailbox data high register type RDH1R_Register (As_Array : Boolean := False) is record case As_Array is when False => -- DATA as a value Val : HAL.UInt32; when True => -- DATA as an array Arr : RDH1R_DATA_Field_Array; end case; end record with Unchecked_Union, Size => 32, Volatile_Full_Access, Bit_Order => System.Low_Order_First; for RDH1R_Register use record Val at 0 range 0 .. 31; Arr at 0 range 0 .. 31; end record; subtype FMR_CAN2SB_Field is HAL.UInt6; -- filter master register type FMR_Register is record -- FINIT FINIT : Boolean := True; -- unspecified Reserved_1_7 : HAL.UInt7 := 16#0#; -- CAN2SB CAN2SB : FMR_CAN2SB_Field := 16#E#; -- unspecified Reserved_14_31 : HAL.UInt18 := 16#A870#; end record with Volatile_Full_Access, Size => 32, Bit_Order => System.Low_Order_First; for FMR_Register use record FINIT at 0 range 0 .. 0; Reserved_1_7 at 0 range 1 .. 7; CAN2SB at 0 range 8 .. 13; Reserved_14_31 at 0 range 14 .. 31; end record; -- FM1R_FBM array type FM1R_FBM_Field_Array is array (0 .. 27) of Boolean with Component_Size => 1, Size => 28; -- Type definition for FM1R_FBM type FM1R_FBM_Field (As_Array : Boolean := False) is record case As_Array is when False => -- FBM as a value Val : HAL.UInt28; when True => -- FBM as an array Arr : FM1R_FBM_Field_Array; end case; end record with Unchecked_Union, Size => 28; for FM1R_FBM_Field use record Val at 0 range 0 .. 27; Arr at 0 range 0 .. 27; end record; -- filter mode register type FM1R_Register is record -- Filter mode FBM : FM1R_FBM_Field := (As_Array => False, Val => 16#0#); -- unspecified Reserved_28_31 : HAL.UInt4 := 16#0#; end record with Volatile_Full_Access, Size => 32, Bit_Order => System.Low_Order_First; for FM1R_Register use record FBM at 0 range 0 .. 27; Reserved_28_31 at 0 range 28 .. 31; end record; -- FS1R_FSC array type FS1R_FSC_Field_Array is array (0 .. 27) of Boolean with Component_Size => 1, Size => 28; -- Type definition for FS1R_FSC type FS1R_FSC_Field (As_Array : Boolean := False) is record case As_Array is when False => -- FSC as a value Val : HAL.UInt28; when True => -- FSC as an array Arr : FS1R_FSC_Field_Array; end case; end record with Unchecked_Union, Size => 28; for FS1R_FSC_Field use record Val at 0 range 0 .. 27; Arr at 0 range 0 .. 27; end record; -- filter scale register type FS1R_Register is record -- Filter scale configuration FSC : FS1R_FSC_Field := (As_Array => False, Val => 16#0#); -- unspecified Reserved_28_31 : HAL.UInt4 := 16#0#; end record with Volatile_Full_Access, Size => 32, Bit_Order => System.Low_Order_First; for FS1R_Register use record FSC at 0 range 0 .. 27; Reserved_28_31 at 0 range 28 .. 31; end record; -- FFA1R_FFA array type FFA1R_FFA_Field_Array is array (0 .. 27) of Boolean with Component_Size => 1, Size => 28; -- Type definition for FFA1R_FFA type FFA1R_FFA_Field (As_Array : Boolean := False) is record case As_Array is when False => -- FFA as a value Val : HAL.UInt28; when True => -- FFA as an array Arr : FFA1R_FFA_Field_Array; end case; end record with Unchecked_Union, Size => 28; for FFA1R_FFA_Field use record Val at 0 range 0 .. 27; Arr at 0 range 0 .. 27; end record; -- filter FIFO assignment register type FFA1R_Register is record -- Filter FIFO assignment for filter 0 FFA : FFA1R_FFA_Field := (As_Array => False, Val => 16#0#); -- unspecified Reserved_28_31 : HAL.UInt4 := 16#0#; end record with Volatile_Full_Access, Size => 32, Bit_Order => System.Low_Order_First; for FFA1R_Register use record FFA at 0 range 0 .. 27; Reserved_28_31 at 0 range 28 .. 31; end record; -- FA1R_FACT array type FA1R_FACT_Field_Array is array (0 .. 27) of Boolean with Component_Size => 1, Size => 28; -- Type definition for FA1R_FACT type FA1R_FACT_Field (As_Array : Boolean := False) is record case As_Array is when False => -- FACT as a value Val : HAL.UInt28; when True => -- FACT as an array Arr : FA1R_FACT_Field_Array; end case; end record with Unchecked_Union, Size => 28; for FA1R_FACT_Field use record Val at 0 range 0 .. 27; Arr at 0 range 0 .. 27; end record; -- filter activation register type FA1R_Register is record -- Filter active FACT : FA1R_FACT_Field := (As_Array => False, Val => 16#0#); -- unspecified Reserved_28_31 : HAL.UInt4 := 16#0#; end record with Volatile_Full_Access, Size => 32, Bit_Order => System.Low_Order_First; for FA1R_Register use record FACT at 0 range 0 .. 27; Reserved_28_31 at 0 range 28 .. 31; end record; -- F0R_FB array type F0R_FB_Field_Array is array (0 .. 31) of Boolean with Component_Size => 1, Size => 32; -- Filter bank 0 register 1 type F0R_Register (As_Array : Boolean := False) is record case As_Array is when False => -- FB as a value Val : HAL.UInt32; when True => -- FB as an array Arr : F0R_FB_Field_Array; end case; end record with Unchecked_Union, Size => 32, Volatile_Full_Access, Bit_Order => System.Low_Order_First; for F0R_Register use record Val at 0 range 0 .. 31; Arr at 0 range 0 .. 31; end record; -- F1R_FB array type F1R_FB_Field_Array is array (0 .. 31) of Boolean with Component_Size => 1, Size => 32; -- Filter bank 1 register 1 type F1R_Register (As_Array : Boolean := False) is record case As_Array is when False => -- FB as a value Val : HAL.UInt32; when True => -- FB as an array Arr : F1R_FB_Field_Array; end case; end record with Unchecked_Union, Size => 32, Volatile_Full_Access, Bit_Order => System.Low_Order_First; for F1R_Register use record Val at 0 range 0 .. 31; Arr at 0 range 0 .. 31; end record; -- F2R_FB array type F2R_FB_Field_Array is array (0 .. 31) of Boolean with Component_Size => 1, Size => 32; -- Filter bank 2 register 1 type F2R_Register (As_Array : Boolean := False) is record case As_Array is when False => -- FB as a value Val : HAL.UInt32; when True => -- FB as an array Arr : F2R_FB_Field_Array; end case; end record with Unchecked_Union, Size => 32, Volatile_Full_Access, Bit_Order => System.Low_Order_First; for F2R_Register use record Val at 0 range 0 .. 31; Arr at 0 range 0 .. 31; end record; -- F3R_FB array type F3R_FB_Field_Array is array (0 .. 31) of Boolean with Component_Size => 1, Size => 32; -- Filter bank 3 register 1 type F3R_Register (As_Array : Boolean := False) is record case As_Array is when False => -- FB as a value Val : HAL.UInt32; when True => -- FB as an array Arr : F3R_FB_Field_Array; end case; end record with Unchecked_Union, Size => 32, Volatile_Full_Access, Bit_Order => System.Low_Order_First; for F3R_Register use record Val at 0 range 0 .. 31; Arr at 0 range 0 .. 31; end record; -- F4R_FB array type F4R_FB_Field_Array is array (0 .. 31) of Boolean with Component_Size => 1, Size => 32; -- Filter bank 4 register 1 type F4R_Register (As_Array : Boolean := False) is record case As_Array is when False => -- FB as a value Val : HAL.UInt32; when True => -- FB as an array Arr : F4R_FB_Field_Array; end case; end record with Unchecked_Union, Size => 32, Volatile_Full_Access, Bit_Order => System.Low_Order_First; for F4R_Register use record Val at 0 range 0 .. 31; Arr at 0 range 0 .. 31; end record; -- F5R_FB array type F5R_FB_Field_Array is array (0 .. 31) of Boolean with Component_Size => 1, Size => 32; -- Filter bank 5 register 1 type F5R_Register (As_Array : Boolean := False) is record case As_Array is when False => -- FB as a value Val : HAL.UInt32; when True => -- FB as an array Arr : F5R_FB_Field_Array; end case; end record with Unchecked_Union, Size => 32, Volatile_Full_Access, Bit_Order => System.Low_Order_First; for F5R_Register use record Val at 0 range 0 .. 31; Arr at 0 range 0 .. 31; end record; -- F6R_FB array type F6R_FB_Field_Array is array (0 .. 31) of Boolean with Component_Size => 1, Size => 32; -- Filter bank 6 register 1 type F6R_Register (As_Array : Boolean := False) is record case As_Array is when False => -- FB as a value Val : HAL.UInt32; when True => -- FB as an array Arr : F6R_FB_Field_Array; end case; end record with Unchecked_Union, Size => 32, Volatile_Full_Access, Bit_Order => System.Low_Order_First; for F6R_Register use record Val at 0 range 0 .. 31; Arr at 0 range 0 .. 31; end record; -- F7R_FB array type F7R_FB_Field_Array is array (0 .. 31) of Boolean with Component_Size => 1, Size => 32; -- Filter bank 7 register 1 type F7R_Register (As_Array : Boolean := False) is record case As_Array is when False => -- FB as a value Val : HAL.UInt32; when True => -- FB as an array Arr : F7R_FB_Field_Array; end case; end record with Unchecked_Union, Size => 32, Volatile_Full_Access, Bit_Order => System.Low_Order_First; for F7R_Register use record Val at 0 range 0 .. 31; Arr at 0 range 0 .. 31; end record; -- F8R_FB array type F8R_FB_Field_Array is array (0 .. 31) of Boolean with Component_Size => 1, Size => 32; -- Filter bank 8 register 1 type F8R_Register (As_Array : Boolean := False) is record case As_Array is when False => -- FB as a value Val : HAL.UInt32; when True => -- FB as an array Arr : F8R_FB_Field_Array; end case; end record with Unchecked_Union, Size => 32, Volatile_Full_Access, Bit_Order => System.Low_Order_First; for F8R_Register use record Val at 0 range 0 .. 31; Arr at 0 range 0 .. 31; end record; -- F9R_FB array type F9R_FB_Field_Array is array (0 .. 31) of Boolean with Component_Size => 1, Size => 32; -- Filter bank 9 register 1 type F9R_Register (As_Array : Boolean := False) is record case As_Array is when False => -- FB as a value Val : HAL.UInt32; when True => -- FB as an array Arr : F9R_FB_Field_Array; end case; end record with Unchecked_Union, Size => 32, Volatile_Full_Access, Bit_Order => System.Low_Order_First; for F9R_Register use record Val at 0 range 0 .. 31; Arr at 0 range 0 .. 31; end record; -- F10R_FB array type F10R_FB_Field_Array is array (0 .. 31) of Boolean with Component_Size => 1, Size => 32; -- Filter bank 10 register 1 type F10R_Register (As_Array : Boolean := False) is record case As_Array is when False => -- FB as a value Val : HAL.UInt32; when True => -- FB as an array Arr : F10R_FB_Field_Array; end case; end record with Unchecked_Union, Size => 32, Volatile_Full_Access, Bit_Order => System.Low_Order_First; for F10R_Register use record Val at 0 range 0 .. 31; Arr at 0 range 0 .. 31; end record; -- F11R_FB array type F11R_FB_Field_Array is array (0 .. 31) of Boolean with Component_Size => 1, Size => 32; -- Filter bank 11 register 1 type F11R_Register (As_Array : Boolean := False) is record case As_Array is when False => -- FB as a value Val : HAL.UInt32; when True => -- FB as an array Arr : F11R_FB_Field_Array; end case; end record with Unchecked_Union, Size => 32, Volatile_Full_Access, Bit_Order => System.Low_Order_First; for F11R_Register use record Val at 0 range 0 .. 31; Arr at 0 range 0 .. 31; end record; -- F12R_FB array type F12R_FB_Field_Array is array (0 .. 31) of Boolean with Component_Size => 1, Size => 32; -- Filter bank 4 register 1 type F12R_Register (As_Array : Boolean := False) is record case As_Array is when False => -- FB as a value Val : HAL.UInt32; when True => -- FB as an array Arr : F12R_FB_Field_Array; end case; end record with Unchecked_Union, Size => 32, Volatile_Full_Access, Bit_Order => System.Low_Order_First; for F12R_Register use record Val at 0 range 0 .. 31; Arr at 0 range 0 .. 31; end record; -- F13R_FB array type F13R_FB_Field_Array is array (0 .. 31) of Boolean with Component_Size => 1, Size => 32; -- Filter bank 13 register 1 type F13R_Register (As_Array : Boolean := False) is record case As_Array is when False => -- FB as a value Val : HAL.UInt32; when True => -- FB as an array Arr : F13R_FB_Field_Array; end case; end record with Unchecked_Union, Size => 32, Volatile_Full_Access, Bit_Order => System.Low_Order_First; for F13R_Register use record Val at 0 range 0 .. 31; Arr at 0 range 0 .. 31; end record; -- F14R_FB array type F14R_FB_Field_Array is array (0 .. 31) of Boolean with Component_Size => 1, Size => 32; -- Filter bank 14 register 1 type F14R_Register (As_Array : Boolean := False) is record case As_Array is when False => -- FB as a value Val : HAL.UInt32; when True => -- FB as an array Arr : F14R_FB_Field_Array; end case; end record with Unchecked_Union, Size => 32, Volatile_Full_Access, Bit_Order => System.Low_Order_First; for F14R_Register use record Val at 0 range 0 .. 31; Arr at 0 range 0 .. 31; end record; -- F15R_FB array type F15R_FB_Field_Array is array (0 .. 31) of Boolean with Component_Size => 1, Size => 32; -- Filter bank 15 register 1 type F15R_Register (As_Array : Boolean := False) is record case As_Array is when False => -- FB as a value Val : HAL.UInt32; when True => -- FB as an array Arr : F15R_FB_Field_Array; end case; end record with Unchecked_Union, Size => 32, Volatile_Full_Access, Bit_Order => System.Low_Order_First; for F15R_Register use record Val at 0 range 0 .. 31; Arr at 0 range 0 .. 31; end record; -- F16R_FB array type F16R_FB_Field_Array is array (0 .. 31) of Boolean with Component_Size => 1, Size => 32; -- Filter bank 16 register 1 type F16R_Register (As_Array : Boolean := False) is record case As_Array is when False => -- FB as a value Val : HAL.UInt32; when True => -- FB as an array Arr : F16R_FB_Field_Array; end case; end record with Unchecked_Union, Size => 32, Volatile_Full_Access, Bit_Order => System.Low_Order_First; for F16R_Register use record Val at 0 range 0 .. 31; Arr at 0 range 0 .. 31; end record; -- F17R_FB array type F17R_FB_Field_Array is array (0 .. 31) of Boolean with Component_Size => 1, Size => 32; -- Filter bank 17 register 1 type F17R_Register (As_Array : Boolean := False) is record case As_Array is when False => -- FB as a value Val : HAL.UInt32; when True => -- FB as an array Arr : F17R_FB_Field_Array; end case; end record with Unchecked_Union, Size => 32, Volatile_Full_Access, Bit_Order => System.Low_Order_First; for F17R_Register use record Val at 0 range 0 .. 31; Arr at 0 range 0 .. 31; end record; -- F18R_FB array type F18R_FB_Field_Array is array (0 .. 31) of Boolean with Component_Size => 1, Size => 32; -- Filter bank 18 register 1 type F18R_Register (As_Array : Boolean := False) is record case As_Array is when False => -- FB as a value Val : HAL.UInt32; when True => -- FB as an array Arr : F18R_FB_Field_Array; end case; end record with Unchecked_Union, Size => 32, Volatile_Full_Access, Bit_Order => System.Low_Order_First; for F18R_Register use record Val at 0 range 0 .. 31; Arr at 0 range 0 .. 31; end record; -- F19R_FB array type F19R_FB_Field_Array is array (0 .. 31) of Boolean with Component_Size => 1, Size => 32; -- Filter bank 19 register 1 type F19R_Register (As_Array : Boolean := False) is record case As_Array is when False => -- FB as a value Val : HAL.UInt32; when True => -- FB as an array Arr : F19R_FB_Field_Array; end case; end record with Unchecked_Union, Size => 32, Volatile_Full_Access, Bit_Order => System.Low_Order_First; for F19R_Register use record Val at 0 range 0 .. 31; Arr at 0 range 0 .. 31; end record; -- F20R_FB array type F20R_FB_Field_Array is array (0 .. 31) of Boolean with Component_Size => 1, Size => 32; -- Filter bank 20 register 1 type F20R_Register (As_Array : Boolean := False) is record case As_Array is when False => -- FB as a value Val : HAL.UInt32; when True => -- FB as an array Arr : F20R_FB_Field_Array; end case; end record with Unchecked_Union, Size => 32, Volatile_Full_Access, Bit_Order => System.Low_Order_First; for F20R_Register use record Val at 0 range 0 .. 31; Arr at 0 range 0 .. 31; end record; -- F21R_FB array type F21R_FB_Field_Array is array (0 .. 31) of Boolean with Component_Size => 1, Size => 32; -- Filter bank 21 register 1 type F21R_Register (As_Array : Boolean := False) is record case As_Array is when False => -- FB as a value Val : HAL.UInt32; when True => -- FB as an array Arr : F21R_FB_Field_Array; end case; end record with Unchecked_Union, Size => 32, Volatile_Full_Access, Bit_Order => System.Low_Order_First; for F21R_Register use record Val at 0 range 0 .. 31; Arr at 0 range 0 .. 31; end record; -- F22R_FB array type F22R_FB_Field_Array is array (0 .. 31) of Boolean with Component_Size => 1, Size => 32; -- Filter bank 22 register 1 type F22R_Register (As_Array : Boolean := False) is record case As_Array is when False => -- FB as a value Val : HAL.UInt32; when True => -- FB as an array Arr : F22R_FB_Field_Array; end case; end record with Unchecked_Union, Size => 32, Volatile_Full_Access, Bit_Order => System.Low_Order_First; for F22R_Register use record Val at 0 range 0 .. 31; Arr at 0 range 0 .. 31; end record; -- F23R_FB array type F23R_FB_Field_Array is array (0 .. 31) of Boolean with Component_Size => 1, Size => 32; -- Filter bank 23 register 1 type F23R_Register (As_Array : Boolean := False) is record case As_Array is when False => -- FB as a value Val : HAL.UInt32; when True => -- FB as an array Arr : F23R_FB_Field_Array; end case; end record with Unchecked_Union, Size => 32, Volatile_Full_Access, Bit_Order => System.Low_Order_First; for F23R_Register use record Val at 0 range 0 .. 31; Arr at 0 range 0 .. 31; end record; -- F24R_FB array type F24R_FB_Field_Array is array (0 .. 31) of Boolean with Component_Size => 1, Size => 32; -- Filter bank 24 register 1 type F24R_Register (As_Array : Boolean := False) is record case As_Array is when False => -- FB as a value Val : HAL.UInt32; when True => -- FB as an array Arr : F24R_FB_Field_Array; end case; end record with Unchecked_Union, Size => 32, Volatile_Full_Access, Bit_Order => System.Low_Order_First; for F24R_Register use record Val at 0 range 0 .. 31; Arr at 0 range 0 .. 31; end record; -- F25R_FB array type F25R_FB_Field_Array is array (0 .. 31) of Boolean with Component_Size => 1, Size => 32; -- Filter bank 25 register 1 type F25R_Register (As_Array : Boolean := False) is record case As_Array is when False => -- FB as a value Val : HAL.UInt32; when True => -- FB as an array Arr : F25R_FB_Field_Array; end case; end record with Unchecked_Union, Size => 32, Volatile_Full_Access, Bit_Order => System.Low_Order_First; for F25R_Register use record Val at 0 range 0 .. 31; Arr at 0 range 0 .. 31; end record; -- F26R_FB array type F26R_FB_Field_Array is array (0 .. 31) of Boolean with Component_Size => 1, Size => 32; -- Filter bank 26 register 1 type F26R_Register (As_Array : Boolean := False) is record case As_Array is when False => -- FB as a value Val : HAL.UInt32; when True => -- FB as an array Arr : F26R_FB_Field_Array; end case; end record with Unchecked_Union, Size => 32, Volatile_Full_Access, Bit_Order => System.Low_Order_First; for F26R_Register use record Val at 0 range 0 .. 31; Arr at 0 range 0 .. 31; end record; -- F27R_FB array type F27R_FB_Field_Array is array (0 .. 31) of Boolean with Component_Size => 1, Size => 32; -- Filter bank 27 register 1 type F27R_Register (As_Array : Boolean := False) is record case As_Array is when False => -- FB as a value Val : HAL.UInt32; when True => -- FB as an array Arr : F27R_FB_Field_Array; end case; end record with Unchecked_Union, Size => 32, Volatile_Full_Access, Bit_Order => System.Low_Order_First; for F27R_Register use record Val at 0 range 0 .. 31; Arr at 0 range 0 .. 31; end record; ----------------- -- Peripherals -- ----------------- -- Controller area network type CAN_Peripheral is record -- master control register MCR : aliased MCR_Register; -- master status register MSR : aliased MSR_Register; -- transmit status register TSR : aliased TSR_Register; -- receive FIFO 0 register RF0R : aliased RF0R_Register; -- receive FIFO 1 register RF1R : aliased RF1R_Register; -- interrupt enable register IER : aliased IER_Register; -- interrupt enable register ESR : aliased ESR_Register; -- bit timing register BTR : aliased BTR_Register; -- TX mailbox identifier register TI0R : aliased TI0R_Register; -- mailbox data length control and time stamp register TDT0R : aliased TDT0R_Register; -- mailbox data low register TDL0R : aliased TDL0R_Register; -- mailbox data high register TDH0R : aliased TDH0R_Register; -- mailbox identifier register TI1R : aliased TI1R_Register; -- mailbox data length control and time stamp register TDT1R : aliased TDT1R_Register; -- mailbox data low register TDL1R : aliased TDL1R_Register; -- mailbox data high register TDH1R : aliased TDH1R_Register; -- mailbox identifier register TI2R : aliased TI2R_Register; -- mailbox data length control and time stamp register TDT2R : aliased TDT2R_Register; -- mailbox data low register TDL2R : aliased TDL2R_Register; -- mailbox data high register TDH2R : aliased TDH2R_Register; -- receive FIFO mailbox identifier register RI0R : aliased RI0R_Register; -- mailbox data high register RDT0R : aliased RDT0R_Register; -- mailbox data high register RDL0R : aliased RDL0R_Register; -- receive FIFO mailbox data high register RDH0R : aliased RDH0R_Register; -- mailbox data high register RI1R : aliased RI1R_Register; -- mailbox data high register RDT1R : aliased RDT1R_Register; -- mailbox data high register RDL1R : aliased RDL1R_Register; -- mailbox data high register RDH1R : aliased RDH1R_Register; -- filter master register FMR : aliased FMR_Register; -- filter mode register FM1R : aliased FM1R_Register; -- filter scale register FS1R : aliased FS1R_Register; -- filter FIFO assignment register FFA1R : aliased FFA1R_Register; -- filter activation register FA1R : aliased FA1R_Register; -- Filter bank 0 register 1 F0R1 : aliased F0R_Register; -- Filter bank 0 register 2 F0R2 : aliased F0R_Register; -- Filter bank 1 register 1 F1R1 : aliased F1R_Register; -- Filter bank 1 register 2 F1R2 : aliased F1R_Register; -- Filter bank 2 register 1 F2R1 : aliased F2R_Register; -- Filter bank 2 register 2 F2R2 : aliased F2R_Register; -- Filter bank 3 register 1 F3R1 : aliased F3R_Register; -- Filter bank 3 register 2 F3R2 : aliased F3R_Register; -- Filter bank 4 register 1 F4R1 : aliased F4R_Register; -- Filter bank 4 register 2 F4R2 : aliased F4R_Register; -- Filter bank 5 register 1 F5R1 : aliased F5R_Register; -- Filter bank 5 register 2 F5R2 : aliased F5R_Register; -- Filter bank 6 register 1 F6R1 : aliased F6R_Register; -- Filter bank 6 register 2 F6R2 : aliased F6R_Register; -- Filter bank 7 register 1 F7R1 : aliased F7R_Register; -- Filter bank 7 register 2 F7R2 : aliased F7R_Register; -- Filter bank 8 register 1 F8R1 : aliased F8R_Register; -- Filter bank 8 register 2 F8R2 : aliased F8R_Register; -- Filter bank 9 register 1 F9R1 : aliased F9R_Register; -- Filter bank 9 register 2 F9R2 : aliased F9R_Register; -- Filter bank 10 register 1 F10R1 : aliased F10R_Register; -- Filter bank 10 register 2 F10R2 : aliased F10R_Register; -- Filter bank 11 register 1 F11R1 : aliased F11R_Register; -- Filter bank 11 register 2 F11R2 : aliased F11R_Register; -- Filter bank 4 register 1 F12R1 : aliased F12R_Register; -- Filter bank 12 register 2 F12R2 : aliased F12R_Register; -- Filter bank 13 register 1 F13R1 : aliased F13R_Register; -- Filter bank 13 register 2 F13R2 : aliased F13R_Register; -- Filter bank 14 register 1 F14R1 : aliased F14R_Register; -- Filter bank 14 register 2 F14R2 : aliased F14R_Register; -- Filter bank 15 register 1 F15R1 : aliased F15R_Register; -- Filter bank 15 register 2 F15R2 : aliased F15R_Register; -- Filter bank 16 register 1 F16R1 : aliased F16R_Register; -- Filter bank 16 register 2 F16R2 : aliased F16R_Register; -- Filter bank 17 register 1 F17R1 : aliased F17R_Register; -- Filter bank 17 register 2 F17R2 : aliased F17R_Register; -- Filter bank 18 register 1 F18R1 : aliased F18R_Register; -- Filter bank 18 register 2 F18R2 : aliased F18R_Register; -- Filter bank 19 register 1 F19R1 : aliased F19R_Register; -- Filter bank 19 register 2 F19R2 : aliased F19R_Register; -- Filter bank 20 register 1 F20R1 : aliased F20R_Register; -- Filter bank 20 register 2 F20R2 : aliased F20R_Register; -- Filter bank 21 register 1 F21R1 : aliased F21R_Register; -- Filter bank 21 register 2 F21R2 : aliased F21R_Register; -- Filter bank 22 register 1 F22R1 : aliased F22R_Register; -- Filter bank 22 register 2 F22R2 : aliased F22R_Register; -- Filter bank 23 register 1 F23R1 : aliased F23R_Register; -- Filter bank 23 register 2 F23R2 : aliased F23R_Register; -- Filter bank 24 register 1 F24R1 : aliased F24R_Register; -- Filter bank 24 register 2 F24R2 : aliased F24R_Register; -- Filter bank 25 register 1 F25R1 : aliased F25R_Register; -- Filter bank 25 register 2 F25R2 : aliased F25R_Register; -- Filter bank 26 register 1 F26R1 : aliased F26R_Register; -- Filter bank 26 register 2 F26R2 : aliased F26R_Register; -- Filter bank 27 register 1 F27R1 : aliased F27R_Register; -- Filter bank 27 register 2 F27R2 : aliased F27R_Register; end record with Volatile; for CAN_Peripheral use record MCR at 16#0# range 0 .. 31; MSR at 16#4# range 0 .. 31; TSR at 16#8# range 0 .. 31; RF0R at 16#C# range 0 .. 31; RF1R at 16#10# range 0 .. 31; IER at 16#14# range 0 .. 31; ESR at 16#18# range 0 .. 31; BTR at 16#1C# range 0 .. 31; TI0R at 16#180# range 0 .. 31; TDT0R at 16#184# range 0 .. 31; TDL0R at 16#188# range 0 .. 31; TDH0R at 16#18C# range 0 .. 31; TI1R at 16#190# range 0 .. 31; TDT1R at 16#194# range 0 .. 31; TDL1R at 16#198# range 0 .. 31; TDH1R at 16#19C# range 0 .. 31; TI2R at 16#1A0# range 0 .. 31; TDT2R at 16#1A4# range 0 .. 31; TDL2R at 16#1A8# range 0 .. 31; TDH2R at 16#1AC# range 0 .. 31; RI0R at 16#1B0# range 0 .. 31; RDT0R at 16#1B4# range 0 .. 31; RDL0R at 16#1B8# range 0 .. 31; RDH0R at 16#1BC# range 0 .. 31; RI1R at 16#1C0# range 0 .. 31; RDT1R at 16#1C4# range 0 .. 31; RDL1R at 16#1C8# range 0 .. 31; RDH1R at 16#1CC# range 0 .. 31; FMR at 16#200# range 0 .. 31; FM1R at 16#204# range 0 .. 31; FS1R at 16#20C# range 0 .. 31; FFA1R at 16#214# range 0 .. 31; FA1R at 16#21C# range 0 .. 31; F0R1 at 16#240# range 0 .. 31; F0R2 at 16#244# range 0 .. 31; F1R1 at 16#248# range 0 .. 31; F1R2 at 16#24C# range 0 .. 31; F2R1 at 16#250# range 0 .. 31; F2R2 at 16#254# range 0 .. 31; F3R1 at 16#258# range 0 .. 31; F3R2 at 16#25C# range 0 .. 31; F4R1 at 16#260# range 0 .. 31; F4R2 at 16#264# range 0 .. 31; F5R1 at 16#268# range 0 .. 31; F5R2 at 16#26C# range 0 .. 31; F6R1 at 16#270# range 0 .. 31; F6R2 at 16#274# range 0 .. 31; F7R1 at 16#278# range 0 .. 31; F7R2 at 16#27C# range 0 .. 31; F8R1 at 16#280# range 0 .. 31; F8R2 at 16#284# range 0 .. 31; F9R1 at 16#288# range 0 .. 31; F9R2 at 16#28C# range 0 .. 31; F10R1 at 16#290# range 0 .. 31; F10R2 at 16#294# range 0 .. 31; F11R1 at 16#298# range 0 .. 31; F11R2 at 16#29C# range 0 .. 31; F12R1 at 16#2A0# range 0 .. 31; F12R2 at 16#2A4# range 0 .. 31; F13R1 at 16#2A8# range 0 .. 31; F13R2 at 16#2AC# range 0 .. 31; F14R1 at 16#2B0# range 0 .. 31; F14R2 at 16#2B4# range 0 .. 31; F15R1 at 16#2B8# range 0 .. 31; F15R2 at 16#2BC# range 0 .. 31; F16R1 at 16#2C0# range 0 .. 31; F16R2 at 16#2C4# range 0 .. 31; F17R1 at 16#2C8# range 0 .. 31; F17R2 at 16#2CC# range 0 .. 31; F18R1 at 16#2D0# range 0 .. 31; F18R2 at 16#2D4# range 0 .. 31; F19R1 at 16#2D8# range 0 .. 31; F19R2 at 16#2DC# range 0 .. 31; F20R1 at 16#2E0# range 0 .. 31; F20R2 at 16#2E4# range 0 .. 31; F21R1 at 16#2E8# range 0 .. 31; F21R2 at 16#2EC# range 0 .. 31; F22R1 at 16#2F0# range 0 .. 31; F22R2 at 16#2F4# range 0 .. 31; F23R1 at 16#2F8# range 0 .. 31; F23R2 at 16#2FC# range 0 .. 31; F24R1 at 16#300# range 0 .. 31; F24R2 at 16#304# range 0 .. 31; F25R1 at 16#308# range 0 .. 31; F25R2 at 16#30C# range 0 .. 31; F26R1 at 16#310# range 0 .. 31; F26R2 at 16#314# range 0 .. 31; F27R1 at 16#318# range 0 .. 31; F27R2 at 16#31C# range 0 .. 31; end record; -- Controller area network CAN1_Periph : aliased CAN_Peripheral with Import, Address => System'To_Address (16#40006400#); -- Controller area network CAN2_Periph : aliased CAN_Peripheral with Import, Address => System'To_Address (16#40006800#); end STM32_SVD.CAN;
MinimSecure/unum-sdk
Ada
1,172
ads
-- Copyright 2007-2019 Free Software Foundation, Inc. -- -- This program is free software; you can redistribute it and/or modify -- it under the terms of the GNU General Public License as published by -- the Free Software Foundation; either version 3 of the License, or -- (at your option) any later version. -- -- This program is distributed in the hope that it will be useful, -- but WITHOUT ANY WARRANTY; without even the implied warranty of -- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -- GNU General Public License for more details. -- -- You should have received a copy of the GNU General Public License -- along with this program. If not, see <http://www.gnu.org/licenses/>. with System; package Pck is type Struct is record A : Integer; B : Integer; end record; type Arr is array (1 .. 3) of Integer; procedure Call_Me (Int : Integer; Flt : Float; Bln : Boolean; Ary : Arr; -- Non scalar Chr : Character; Sad : System.Address; Rec : Struct); -- Non scalar end Pck;
reznikmm/matreshka
Ada
6,764
ads
------------------------------------------------------------------------------ -- -- -- Matreshka Project -- -- -- -- Ada Modeling Framework -- -- -- -- Runtime Library Component -- -- -- ------------------------------------------------------------------------------ -- -- -- Copyright © 2011-2012, Vadim Godunko <[email protected]> -- -- 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 AMF.Internals.UML_Elements; with AMF.UML.Elements.Collections; with AMF.UML.Package_Merges; with AMF.UML.Packages; with AMF.Visitors; package AMF.Internals.UML_Package_Merges is type UML_Package_Merge_Proxy is limited new AMF.Internals.UML_Elements.UML_Element_Proxy and AMF.UML.Package_Merges.UML_Package_Merge with null record; overriding function Get_Merged_Package (Self : not null access constant UML_Package_Merge_Proxy) return AMF.UML.Packages.UML_Package_Access; -- Getter of PackageMerge::mergedPackage. -- -- References the Package that is to be merged with the receiving package -- of the PackageMerge. overriding procedure Set_Merged_Package (Self : not null access UML_Package_Merge_Proxy; To : AMF.UML.Packages.UML_Package_Access); -- Setter of PackageMerge::mergedPackage. -- -- References the Package that is to be merged with the receiving package -- of the PackageMerge. overriding function Get_Receiving_Package (Self : not null access constant UML_Package_Merge_Proxy) return AMF.UML.Packages.UML_Package_Access; -- Getter of PackageMerge::receivingPackage. -- -- References the Package that is being extended with the contents of the -- merged package of the PackageMerge. overriding procedure Set_Receiving_Package (Self : not null access UML_Package_Merge_Proxy; To : AMF.UML.Packages.UML_Package_Access); -- Setter of PackageMerge::receivingPackage. -- -- References the Package that is being extended with the contents of the -- merged package of the PackageMerge. overriding function Get_Source (Self : not null access constant UML_Package_Merge_Proxy) return AMF.UML.Elements.Collections.Set_Of_UML_Element; -- Getter of DirectedRelationship::source. -- -- Specifies the sources of the DirectedRelationship. overriding function Get_Target (Self : not null access constant UML_Package_Merge_Proxy) return AMF.UML.Elements.Collections.Set_Of_UML_Element; -- Getter of DirectedRelationship::target. -- -- Specifies the targets of the DirectedRelationship. overriding function Get_Related_Element (Self : not null access constant UML_Package_Merge_Proxy) return AMF.UML.Elements.Collections.Set_Of_UML_Element; -- Getter of Relationship::relatedElement. -- -- Specifies the elements related by the Relationship. overriding procedure Enter_Element (Self : not null access constant UML_Package_Merge_Proxy; Visitor : in out AMF.Visitors.Abstract_Visitor'Class; Control : in out AMF.Visitors.Traverse_Control); -- Dispatch call to corresponding subprogram of visitor interface. overriding procedure Leave_Element (Self : not null access constant UML_Package_Merge_Proxy; Visitor : in out AMF.Visitors.Abstract_Visitor'Class; Control : in out AMF.Visitors.Traverse_Control); -- Dispatch call to corresponding subprogram of visitor interface. overriding procedure Visit_Element (Self : not null access constant UML_Package_Merge_Proxy; Iterator : in out AMF.Visitors.Abstract_Iterator'Class; Visitor : in out AMF.Visitors.Abstract_Visitor'Class; Control : in out AMF.Visitors.Traverse_Control); -- Dispatch call to corresponding subprogram of iterator interface. end AMF.Internals.UML_Package_Merges;
AdaCore/libadalang
Ada
583
adb
procedure Test is function Foo return Boolean is (True); procedure Process is null; begin begin -- Foo should be resolved even though Bar fails in the -- first alternative. if Foo then Process; elsif Bar then Process; else Process; end if; -- Bar will fail but this should not impact the resolution -- of Foo in the first alternative. if Bar then Process; elsif Foo then Process; else Process; end if; end; pragma Test_Block; end Test;
micahwelf/FLTK-Ada
Ada
11,500
adb
with Interfaces.C, System; use type Interfaces.C.int, System.Address; package body FLTK.Widgets.Charts is procedure chart_set_draw_hook (W, D : in System.Address); pragma Import (C, chart_set_draw_hook, "chart_set_draw_hook"); pragma Inline (chart_set_draw_hook); procedure chart_set_handle_hook (W, H : in System.Address); pragma Import (C, chart_set_handle_hook, "chart_set_handle_hook"); pragma Inline (chart_set_handle_hook); function new_fl_chart (X, Y, W, H : in Interfaces.C.int; Text : in Interfaces.C.char_array) return System.Address; pragma Import (C, new_fl_chart, "new_fl_chart"); pragma Inline (new_fl_chart); procedure free_fl_chart (B : in System.Address); pragma Import (C, free_fl_chart, "free_fl_chart"); pragma Inline (free_fl_chart); procedure fl_chart_add (C : in System.Address; V : in Interfaces.C.double; L : in Interfaces.C.char_array; P : in Interfaces.C.unsigned); pragma Import (C, fl_chart_add, "fl_chart_add"); pragma Inline (fl_chart_add); procedure fl_chart_insert (C : in System.Address; I : in Interfaces.C.int; V : in Interfaces.C.double; L : in Interfaces.C.char_array; P : in Interfaces.C.unsigned); pragma Import (C, fl_chart_insert, "fl_chart_insert"); pragma Inline (fl_chart_insert); procedure fl_chart_replace (C : in System.Address; I : in Interfaces.C.int; V : in Interfaces.C.double; L : in Interfaces.C.char_array; P : in Interfaces.C.unsigned); pragma Import (C, fl_chart_replace, "fl_chart_replace"); pragma Inline (fl_chart_replace); procedure fl_chart_clear (C : in System.Address); pragma Import (C, fl_chart_clear, "fl_chart_clear"); pragma Inline (fl_chart_clear); function fl_chart_get_autosize (C : in System.Address) return Interfaces.C.int; pragma Import (C, fl_chart_get_autosize, "fl_chart_get_autosize"); pragma Inline (fl_chart_get_autosize); procedure fl_chart_set_autosize (C : in System.Address; A : in Interfaces.C.int); pragma Import (C, fl_chart_set_autosize, "fl_chart_set_autosize"); pragma Inline (fl_chart_set_autosize); procedure fl_chart_get_bounds (C : in System.Address; L, U : out Interfaces.C.double); pragma Import (C, fl_chart_get_bounds, "fl_chart_get_bounds"); pragma Inline (fl_chart_get_bounds); procedure fl_chart_set_bounds (C : in System.Address; L, U : in Interfaces.C.double); pragma Import (C, fl_chart_set_bounds, "fl_chart_set_bounds"); pragma Inline (fl_chart_set_bounds); function fl_chart_get_maxsize (C : in System.Address) return Interfaces.C.int; pragma Import (C, fl_chart_get_maxsize, "fl_chart_get_maxsize"); pragma Inline (fl_chart_get_maxsize); procedure fl_chart_set_maxsize (C : in System.Address; T : in Interfaces.C.int); pragma Import (C, fl_chart_set_maxsize, "fl_chart_set_maxsize"); pragma Inline (fl_chart_set_maxsize); function fl_chart_size (C : in System.Address) return Interfaces.C.int; pragma Import (C, fl_chart_size, "fl_chart_size"); pragma Inline (fl_chart_size); function fl_chart_get_textcolor (C : in System.Address) return Interfaces.C.unsigned; pragma Import (C, fl_chart_get_textcolor, "fl_chart_get_textcolor"); pragma Inline (fl_chart_get_textcolor); procedure fl_chart_set_textcolor (C : in System.Address; T : in Interfaces.C.unsigned); pragma Import (C, fl_chart_set_textcolor, "fl_chart_set_textcolor"); pragma Inline (fl_chart_set_textcolor); function fl_chart_get_textfont (C : in System.Address) return Interfaces.C.int; pragma Import (C, fl_chart_get_textfont, "fl_chart_get_textfont"); pragma Inline (fl_chart_get_textfont); procedure fl_chart_set_textfont (C : in System.Address; T : in Interfaces.C.int); pragma Import (C, fl_chart_set_textfont, "fl_chart_set_textfont"); pragma Inline (fl_chart_set_textfont); function fl_chart_get_textsize (C : in System.Address) return Interfaces.C.int; pragma Import (C, fl_chart_get_textsize, "fl_chart_get_textsize"); pragma Inline (fl_chart_get_textsize); procedure fl_chart_set_textsize (C : in System.Address; T : in Interfaces.C.int); pragma Import (C, fl_chart_set_textsize, "fl_chart_set_textsize"); pragma Inline (fl_chart_set_textsize); procedure fl_chart_size2 (C : in System.Address; W, H : in Interfaces.C.int); pragma Import (C, fl_chart_size2, "fl_chart_size2"); pragma Inline (fl_chart_size2); procedure fl_chart_draw (W : in System.Address); pragma Import (C, fl_chart_draw, "fl_chart_draw"); pragma Inline (fl_chart_draw); function fl_chart_handle (W : in System.Address; E : in Interfaces.C.int) return Interfaces.C.int; pragma Import (C, fl_chart_handle, "fl_chart_handle"); pragma Inline (fl_chart_handle); procedure Finalize (This : in out Chart) is begin if This.Void_Ptr /= System.Null_Address and then This in Chart'Class then free_fl_chart (This.Void_Ptr); This.Void_Ptr := System.Null_Address; end if; Finalize (Widget (This)); end Finalize; package body Forge is function Create (X, Y, W, H : in Integer; Text : in String) return Chart is begin return This : Chart do This.Void_Ptr := new_fl_chart (Interfaces.C.int (X), Interfaces.C.int (Y), Interfaces.C.int (W), Interfaces.C.int (H), Interfaces.C.To_C (Text)); fl_widget_set_user_data (This.Void_Ptr, Widget_Convert.To_Address (This'Unchecked_Access)); chart_set_draw_hook (This.Void_Ptr, Draw_Hook'Address); chart_set_handle_hook (This.Void_Ptr, Handle_Hook'Address); end return; end Create; end Forge; procedure Add (This : in out Chart; Data_Value : in Long_Float; Data_Label : in String := ""; Data_Color : in Color := No_Color) is begin fl_chart_add (This.Void_Ptr, Interfaces.C.double (Data_Value), Interfaces.C.To_C (Data_Label), Interfaces.C.unsigned (Data_Color)); end Add; procedure Insert (This : in out Chart; Position : in Natural; Data_Value : in Long_Float; Data_Label : in String := ""; Data_Color : in Color := No_Color) is begin fl_chart_insert (This.Void_Ptr, Interfaces.C.int (Position), Interfaces.C.double (Data_Value), Interfaces.C.To_C (Data_Label), Interfaces.C.unsigned (Data_Color)); end Insert; procedure Replace (This : in out Chart; Position : in Natural; Data_Value : in Long_Float; Data_Label : in String := ""; Data_Color : in Color := No_Color) is begin fl_chart_replace (This.Void_Ptr, Interfaces.C.int (Position), Interfaces.C.double (Data_Value), Interfaces.C.To_C (Data_Label), Interfaces.C.unsigned (Data_Color)); end Replace; procedure Clear (This : in out Chart) is begin fl_chart_clear (This.Void_Ptr); end Clear; function Will_Autosize (This : in Chart) return Boolean is begin return fl_chart_get_autosize (This.Void_Ptr) /= 0; end Will_Autosize; procedure Set_Autosize (This : in out Chart; To : in Boolean) is begin fl_chart_set_autosize (This.Void_Ptr, Boolean'Pos (To)); end Set_Autosize; procedure Get_Bounds (This : in Chart; Lower, Upper : out Long_Float) is begin fl_chart_get_bounds (This.Void_Ptr, Interfaces.C.double (Lower), Interfaces.C.double (Upper)); end Get_Bounds; procedure Set_Bounds (This : in out Chart; Lower, Upper : in Long_Float) is begin fl_chart_set_bounds (This.Void_Ptr, Interfaces.C.double (Lower), Interfaces.C.double (Upper)); end Set_Bounds; function Get_Maximum_Size (This : in Chart) return Natural is begin return Natural (fl_chart_get_maxsize (This.Void_Ptr)); end Get_Maximum_Size; procedure Set_Maximum_Size (This : in out Chart; To : in Natural) is begin fl_chart_set_maxsize (This.Void_Ptr, Interfaces.C.int (To)); end Set_Maximum_Size; function Get_Size (This : in Chart) return Natural is begin return Natural (fl_chart_size (This.Void_Ptr)); end Get_Size; function Get_Text_Color (This : in Chart) return Color is begin return Color (fl_chart_get_textcolor (This.Void_Ptr)); end Get_Text_Color; procedure Set_Text_Color (This : in out Chart; To : in Color) is begin fl_chart_set_textcolor (This.Void_Ptr, Interfaces.C.unsigned (To)); end Set_Text_Color; function Get_Text_Font (This : in Chart) return Font_Kind is begin return Font_Kind'Val (fl_chart_get_textfont (This.Void_Ptr)); end Get_Text_Font; procedure Set_Text_Font (This : in out Chart; To : in Font_Kind) is begin fl_chart_set_textfont (This.Void_Ptr, Font_Kind'Pos (To)); end Set_Text_Font; function Get_Text_Size (This : in Chart) return Font_Size is begin return Font_Size (fl_chart_get_textsize (This.Void_Ptr)); end Get_Text_Size; procedure Set_Text_Size (This : in out Chart; To : in Font_Size) is begin fl_chart_set_textsize (This.Void_Ptr, Interfaces.C.int (To)); end Set_Text_Size; procedure Resize (This : in out Chart; W, H : in Integer) is begin fl_chart_size2 (This.Void_Ptr, Interfaces.C.int (W), Interfaces.C.int (H)); end Resize; procedure Draw (This : in out Chart) is begin fl_chart_draw (This.Void_Ptr); end Draw; function Handle (This : in out Chart; Event : in Event_Kind) return Event_Outcome is begin return Event_Outcome'Val (fl_chart_handle (This.Void_Ptr, Event_Kind'Pos (Event))); end Handle; end FLTK.Widgets.Charts;
Asier98/AdaCar
Ada
63
adb
procedure Prueba_Alarmas is begin null; end Prueba_Alarmas;
reznikmm/matreshka
Ada
4,599
adb
------------------------------------------------------------------------------ -- -- -- Matreshka Project -- -- -- -- Open Document Toolkit -- -- -- -- Runtime Library Component -- -- -- ------------------------------------------------------------------------------ -- -- -- Copyright © 2014, Vadim Godunko <[email protected]> -- -- All rights reserved. -- -- -- -- Redistribution and use in source and binary forms, with or without -- -- modification, are permitted provided that the following conditions -- -- are met: -- -- -- -- * Redistributions of source code must retain the above copyright -- -- notice, this list of conditions and the following disclaimer. -- -- -- -- * Redistributions in binary form must reproduce the above copyright -- -- notice, this list of conditions and the following disclaimer in the -- -- documentation and/or other materials provided with the distribution. -- -- -- -- * Neither the name of the Vadim Godunko, IE nor the names of its -- -- contributors may be used to endorse or promote products derived from -- -- this software without specific prior written permission. -- -- -- -- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -- -- "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -- -- LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -- -- A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -- -- HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -- -- SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED -- -- TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -- -- PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -- -- LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -- -- NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -- -- SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -- -- -- ------------------------------------------------------------------------------ -- $Revision$ $Date$ ------------------------------------------------------------------------------ with Matreshka.DOM_Documents; with Matreshka.ODF_String_Constants; with ODF.DOM.Iterators; with ODF.DOM.Visitors; package body Matreshka.ODF_Form.Tab_Cycle_Attributes is ------------ -- Create -- ------------ overriding function Create (Parameters : not null access Matreshka.DOM_Attributes.Attribute_L2_Parameters) return Form_Tab_Cycle_Attribute_Node is begin return Self : Form_Tab_Cycle_Attribute_Node do Matreshka.ODF_Form.Constructors.Initialize (Self'Unchecked_Access, Parameters.Document, Matreshka.ODF_String_Constants.Form_Prefix); end return; end Create; -------------------- -- Get_Local_Name -- -------------------- overriding function Get_Local_Name (Self : not null access constant Form_Tab_Cycle_Attribute_Node) return League.Strings.Universal_String is pragma Unreferenced (Self); begin return Matreshka.ODF_String_Constants.Tab_Cycle_Attribute; end Get_Local_Name; begin Matreshka.DOM_Documents.Register_Attribute (Matreshka.ODF_String_Constants.Form_URI, Matreshka.ODF_String_Constants.Tab_Cycle_Attribute, Form_Tab_Cycle_Attribute_Node'Tag); end Matreshka.ODF_Form.Tab_Cycle_Attributes;
LedgerHQ/lib-ledger-core
Ada
24,422
adb
with SOCI; with SOCI.PostgreSQL; with Ada.Text_IO; with Ada.Calendar; with Ada.Exceptions; with Ada.Numerics.Discrete_Random; with Ada.Command_Line; procedure PostgreSQL_Test is procedure Test_1 (Connection_String : in String) is begin Ada.Text_IO.Put_Line ("testing basic constructor function"); declare S : SOCI.Session := SOCI.Make_Session (Connection_String); begin null; end; exception when E : SOCI.Database_Error => Ada.Text_IO.Put_Line ("Database_Error: "); Ada.Text_IO.Put_Line (Ada.Exceptions.Exception_Message (E)); end Test_1; procedure Test_2 (Connection_String : in String) is S : SOCI.Session; begin Ada.Text_IO.Put_Line ("testing open/close"); S.Close; S.Open (Connection_String); S.Close; end Test_2; procedure Test_3 (Connection_String : in String) is begin Ada.Text_IO.Put_Line ("testing empty start/commit"); declare S : SOCI.Session := SOCI.Make_Session (Connection_String); begin S.Start; S.Commit; end; end Test_3; procedure Test_4 (Connection_String : in String) is begin Ada.Text_IO.Put_Line ("testing simple statements"); declare SQL : SOCI.Session := SOCI.Make_Session (Connection_String); begin SQL.Execute ("create table ada_test ( i integer )"); SQL.Execute ("drop table ada_test"); end; end Test_4; procedure Test_5 (Connection_String : in String) is begin Ada.Text_IO.Put_Line ("testing independent statements"); declare SQL : SOCI.Session := SOCI.Make_Session (Connection_String); St_1 : SOCI.Statement := SOCI.Make_Statement (SQL); St_2 : SOCI.Statement := SOCI.Make_Statement (SQL); begin St_1.Prepare ("create table ada_test ( i integer )"); St_2.Prepare ("drop table ada_test"); St_1.Execute; St_2.Execute; end; end Test_5; procedure Test_6 (Connection_String : in String) is begin Ada.Text_IO.Put_Line ("testing data types and into elements"); declare SQL : SOCI.Session := SOCI.Make_Session (Connection_String); begin declare St : SOCI.Statement := SOCI.Make_Statement (SQL); Pos : SOCI.Into_Position; begin Pos := St.Into_String; St.Prepare ("select 'Hello'"); St.Execute (True); pragma Assert (St.Get_Into_String (Pos) = "Hello"); end; declare St : SOCI.Statement := SOCI.Make_Statement (SQL); Pos : SOCI.Into_Position; Value : SOCI.DB_Integer; use type SOCI.DB_Integer; begin Pos := St.Into_Integer; St.Prepare ("select 123"); St.Execute (True); Value := St.Get_Into_Integer (Pos); pragma Assert (Value = 123); end; declare St : SOCI.Statement := SOCI.Make_Statement (SQL); Pos : SOCI.Into_Position; Value : SOCI.DB_Long_Long_Integer; use type SOCI.DB_Long_Long_Integer; begin Pos := St.Into_Long_Long_Integer; St.Prepare ("select 10000000000"); St.Execute (True); Value := St.Get_Into_Long_Long_Integer (Pos); pragma Assert (Value = 10_000_000_000); end; declare St : SOCI.Statement := SOCI.Make_Statement (SQL); Pos : SOCI.Into_Position; Value : SOCI.DB_Long_Float; use type SOCI.DB_Long_Float; begin Pos := St.Into_Long_Float; St.Prepare ("select 3.625"); St.Execute (True); Value := St.Get_Into_Long_Float (Pos); pragma Assert (Value = SOCI.DB_Long_Float (3.625)); end; declare St : SOCI.Statement := SOCI.Make_Statement (SQL); Pos : SOCI.Into_Position; Value : Ada.Calendar.Time; begin Pos := St.Into_Time; St.Prepare ("select timestamp '2008-06-30 21:01:02'"); St.Execute (True); Value := St.Get_Into_Time (Pos); pragma Assert (Ada.Calendar.Year (Value) = 2008); pragma Assert (Ada.Calendar.Month (Value) = 6); pragma Assert (Ada.Calendar.Day (Value) = 30); pragma Assert (Ada.Calendar.Seconds (Value) = Ada.Calendar.Day_Duration (21 * 3_600 + 1 * 60 + 2)); end; end; end Test_6; procedure Test_7 (Connection_String : in String) is begin Ada.Text_IO.Put_Line ("testing types with into vectors"); declare SQL : SOCI.Session := SOCI.Make_Session (Connection_String); St : SOCI.Statement := SOCI.Make_Statement (SQL); Pos_Id : SOCI.Into_Position; Pos_Str : SOCI.Into_Position; Pos_LL : SOCI.Into_Position; Pos_LF : SOCI.Into_Position; Pos_TM : SOCI.Into_Position; use type SOCI.Data_State; use type Ada.Calendar.Time; use type SOCI.DB_Integer; use type SOCI.DB_Long_Long_Integer; use type SOCI.DB_Long_Float; begin SQL.Execute ("create table soci_test (" & " id integer," & " str varchar (20)," & " ll bigint," & " lf double precision," & " tm timestamp" & ")"); SQL.Execute ("insert into soci_test (id, str, ll, lf, tm)" & " values (1, 'abc', 10000000000, 3.0, timestamp '2008-06-30 21:01:02')"); SQL.Execute ("insert into soci_test (id, str, ll, lf, tm)" & " values (2, 'xyz', -10000000001, -3.125, timestamp '2008-07-01 21:01:03')"); SQL.Execute ("insert into soci_test (id, str, ll, lf, tm)" & " values (3, null, null, null, null)"); Pos_Id := St.Into_Vector_Integer; Pos_Str := St.Into_Vector_String; Pos_LL := St.Into_Vector_Long_Long_Integer; Pos_LF := St.Into_Vector_Long_Float; Pos_TM := St.Into_Vector_Time; St.Into_Vectors_Resize (10); -- arbitrary batch size St.Prepare ("select id, str, ll, lf, tm from soci_test order by id"); St.Execute (True); pragma Assert (St.Get_Into_Vectors_Size = 3); pragma Assert (St.Get_Into_Vector_Integer (Pos_Id, 0) = 1); pragma Assert (St.Get_Into_Vector_State (Pos_Str, 0) = SOCI.Data_Not_Null); pragma Assert (St.Get_Into_Vector_String (Pos_Str, 0) = "abc"); pragma Assert (St.Get_Into_Vector_Long_Long_Integer (Pos_LL, 0) = 10_000_000_000); pragma Assert (St.Get_Into_Vector_Long_Float (Pos_LF, 0) = SOCI.DB_Long_Float (3.0)); pragma Assert (St.Get_Into_Vector_Time (Pos_TM, 0) = Ada.Calendar.Time_Of (2008, 6, 30, Duration (21 * 3_600 + 1 * 60 + 2))); pragma Assert (St.Get_Into_Vector_Integer (Pos_Id, 1) = 2); pragma Assert (St.Get_Into_Vector_State (Pos_Str, 1) = SOCI.Data_Not_Null); pragma Assert (St.Get_Into_Vector_String (Pos_Str, 1) = "xyz"); pragma Assert (St.Get_Into_Vector_Long_Long_Integer (Pos_LL, 1) = -10_000_000_001); pragma Assert (St.Get_Into_Vector_Long_Float (Pos_LF, 1) = SOCI.DB_Long_Float (-3.125)); pragma Assert (St.Get_Into_Vector_Time (Pos_TM, 1) = Ada.Calendar.Time_Of (2008, 7, 1, Duration (21 * 3_600 + 1 * 60 + 3))); pragma Assert (St.Get_Into_Vector_Integer (Pos_Id, 2) = 3); pragma Assert (St.Get_Into_Vector_State (Pos_Str, 2) = SOCI.Data_Null); pragma Assert (St.Get_Into_Vector_State (Pos_LL, 2) = SOCI.Data_Null); pragma Assert (St.Get_Into_Vector_State (Pos_LF, 2) = SOCI.Data_Null); pragma Assert (St.Get_Into_Vector_State (Pos_TM, 2) = SOCI.Data_Null); SQL.Execute ("drop table soci_test"); end; end Test_7; procedure Test_8 (Connection_String : in String) is begin Ada.Text_IO.Put_Line ("testing multi-batch operation with into vectors"); declare SQL : SOCI.Session := SOCI.Make_Session (Connection_String); St : SOCI.Statement := SOCI.Make_Statement (SQL); Pos_Id : SOCI.Into_Position; Got_Data : Boolean; use type SOCI.DB_Integer; begin SQL.Execute ("create table soci_test (" & " id integer" & ")"); SQL.Execute ("insert into soci_test (id) values (1)"); SQL.Execute ("insert into soci_test (id) values (2)"); SQL.Execute ("insert into soci_test (id) values (3)"); SQL.Execute ("insert into soci_test (id) values (4)"); SQL.Execute ("insert into soci_test (id) values (5)"); SQL.Execute ("insert into soci_test (id) values (6)"); SQL.Execute ("insert into soci_test (id) values (7)"); SQL.Execute ("insert into soci_test (id) values (8)"); SQL.Execute ("insert into soci_test (id) values (9)"); SQL.Execute ("insert into soci_test (id) values (10)"); Pos_Id := St.Into_Vector_Integer; St.Into_Vectors_Resize (4); -- batch of 4 elements St.Prepare ("select id from soci_test order by id"); St.Execute; Got_Data := St.Fetch; pragma Assert (Got_Data); pragma Assert (St.Get_Into_Vectors_Size = 4); pragma Assert (St.Get_Into_Vector_Integer (Pos_Id, 0) = 1); pragma Assert (St.Get_Into_Vector_Integer (Pos_Id, 1) = 2); pragma Assert (St.Get_Into_Vector_Integer (Pos_Id, 2) = 3); pragma Assert (St.Get_Into_Vector_Integer (Pos_Id, 3) = 4); Got_Data := St.Fetch; pragma Assert (Got_Data); pragma Assert (St.Get_Into_Vectors_Size = 4); pragma Assert (St.Get_Into_Vector_Integer (Pos_Id, 0) = 5); pragma Assert (St.Get_Into_Vector_Integer (Pos_Id, 1) = 6); pragma Assert (St.Get_Into_Vector_Integer (Pos_Id, 2) = 7); pragma Assert (St.Get_Into_Vector_Integer (Pos_Id, 3) = 8); Got_Data := St.Fetch; pragma Assert (Got_Data); pragma Assert (St.Get_Into_Vectors_Size = 2); pragma Assert (St.Get_Into_Vector_Integer (Pos_Id, 0) = 9); pragma Assert (St.Get_Into_Vector_Integer (Pos_Id, 1) = 10); Got_Data := St.Fetch; pragma Assert (not Got_Data); pragma Assert (St.Get_Into_Vectors_Size = 0); SQL.Execute ("drop table soci_test"); end; end Test_8; procedure Test_9 (Connection_String : in String) is begin Ada.Text_IO.Put_Line ("testing data types and use elements"); declare SQL : SOCI.Session := SOCI.Make_Session (Connection_String); use type SOCI.DB_Integer; use type SOCI.DB_Long_Long_Integer; use type SOCI.DB_Long_Float; begin declare St : SOCI.Statement := SOCI.Make_Statement (SQL); Pos : SOCI.Into_Position; begin St.Use_String ("value"); St.Set_Use_String ("value", "123"); Pos := St.Into_Integer; St.Prepare ("select cast(:value as integer)"); St.Execute (True); pragma Assert (St.Get_Into_Integer (Pos) = 123); end; declare St : SOCI.Statement := SOCI.Make_Statement (SQL); Pos : SOCI.Into_Position; begin St.Use_Integer ("value"); St.Set_Use_Integer ("value", 123); Pos := St.Into_String; St.Prepare ("select cast(:value as text)"); St.Execute (True); pragma Assert (St.Get_Into_String (Pos) = "123"); end; declare St : SOCI.Statement := SOCI.Make_Statement (SQL); Pos : SOCI.Into_Position; begin St.Use_Long_Long_Integer ("value"); St.Set_Use_Long_Long_Integer ("value", 10_000_000_000); Pos := St.Into_String; St.Prepare ("select cast(:value as text)"); St.Execute (True); pragma Assert (St.Get_Into_String (Pos) = "10000000000"); end; declare St : SOCI.Statement := SOCI.Make_Statement (SQL); Pos : SOCI.Into_Position; begin St.Use_Long_Float ("value"); St.Set_Use_Long_Float ("value", SOCI.DB_Long_Float (5.625)); Pos := St.Into_String; St.Prepare ("select cast(:value as text)"); St.Execute (True); pragma Assert (St.Get_Into_String (Pos) = "5.625"); end; declare St : SOCI.Statement := SOCI.Make_Statement (SQL); Pos : SOCI.Into_Position; begin St.Use_Time ("value"); St.Set_Use_Time ("value", Ada.Calendar.Time_Of (2008, 7, 1, Ada.Calendar.Day_Duration (3723))); Pos := St.Into_String; St.Prepare ("select cast(:value as text)"); St.Execute (True); pragma Assert (St.Get_Into_String (Pos) = "2008-07-01 01:02:03"); end; declare St : SOCI.Statement := SOCI.Make_Statement (SQL); Pos : SOCI.Into_Position; use type SOCI.Data_State; begin St.Use_Integer ("value"); St.Set_Use_State ("value", SOCI.Data_Null); Pos := St.Into_Integer; St.Prepare ("select cast(:value as integer)"); St.Execute (True); pragma Assert (St.Get_Into_State (Pos) = SOCI.Data_Null); end; end; end Test_9; procedure Test_10 (Connection_String : in String) is begin Ada.Text_IO.Put_Line ("testing vector use elements and row traversal with single into elements"); declare SQL : SOCI.Session := SOCI.Make_Session (Connection_String); Time_1 : constant Ada.Calendar.Time := Ada.Calendar.Time_Of (2008, 7, 1, Ada.Calendar.Day_Duration (1)); Time_2 : constant Ada.Calendar.Time := Ada.Calendar.Time_Of (2008, 7, 2, Ada.Calendar.Day_Duration (2)); Time_3 : constant Ada.Calendar.Time := Ada.Calendar.Time_Of (2008, 7, 3, Ada.Calendar.Day_Duration (3)); Time_4 : constant Ada.Calendar.Time := Ada.Calendar.Time_Of (2008, 7, 4, Ada.Calendar.Day_Duration (4)); Time_5 : constant Ada.Calendar.Time := Ada.Calendar.Time_Of (2008, 7, 5, Ada.Calendar.Day_Duration (5)); begin SQL.Execute ("create table soci_test (" & " id integer," & " str varchar (20)," & " ll bigint," & " lf double precision," & " tm timestamp" & ")"); declare St : SOCI.Statement := SOCI.Make_Statement (SQL); begin St.Use_Vector_Integer ("id"); St.Use_Vector_String ("str"); St.Use_Vector_Long_Long_Integer ("ll"); St.Use_Vector_Long_Float ("lf"); St.Use_Vector_Time ("tm"); St.Use_Vectors_Resize (6); St.Set_Use_Vector_Integer ("id", 0, 1); St.Set_Use_Vector_Integer ("id", 1, 2); St.Set_Use_Vector_Integer ("id", 2, 3); St.Set_Use_Vector_Integer ("id", 3, 4); St.Set_Use_Vector_Integer ("id", 4, 5); St.Set_Use_Vector_Integer ("id", 5, 6); St.Set_Use_Vector_String ("str", 0, "abc"); St.Set_Use_Vector_String ("str", 1, "def"); St.Set_Use_Vector_String ("str", 2, "ghi"); St.Set_Use_Vector_String ("str", 3, "jklm"); St.Set_Use_Vector_String ("str", 4, "no"); St.Set_Use_Vector_State ("str", 5, SOCI.Data_Null); St.Set_Use_Vector_Long_Long_Integer ("ll", 0, 10_000_000_000); St.Set_Use_Vector_Long_Long_Integer ("ll", 1, 10_000_000_001); St.Set_Use_Vector_Long_Long_Integer ("ll", 2, 10_000_000_002); St.Set_Use_Vector_Long_Long_Integer ("ll", 3, 10_000_000_003); St.Set_Use_Vector_Long_Long_Integer ("ll", 4, 10_000_000_004); St.Set_Use_Vector_State ("ll", 5, SOCI.Data_Null); St.Set_Use_Vector_Long_Float ("lf", 0, SOCI.DB_Long_Float (0.0)); St.Set_Use_Vector_Long_Float ("lf", 1, SOCI.DB_Long_Float (0.125)); St.Set_Use_Vector_Long_Float ("lf", 2, SOCI.DB_Long_Float (0.25)); St.Set_Use_Vector_Long_Float ("lf", 3, SOCI.DB_Long_Float (0.5)); St.Set_Use_Vector_Long_Float ("lf", 4, SOCI.DB_Long_Float (0.625)); St.Set_Use_Vector_State ("lf", 5, SOCI.Data_Null); St.Set_Use_Vector_Time ("tm", 0, Time_1); St.Set_Use_Vector_Time ("tm", 1, Time_2); St.Set_Use_Vector_Time ("tm", 2, Time_3); St.Set_Use_Vector_Time ("tm", 3, Time_4); St.Set_Use_Vector_Time ("tm", 4, Time_5); St.Set_Use_Vector_State ("tm", 5, SOCI.Data_Null); St.Prepare ("insert into soci_test (id, str, ll, lf, tm)" & " values (:id, :str, :ll, :lf, :tm)"); St.Execute (True); end; declare St : SOCI.Statement := SOCI.Make_Statement (SQL); Pos_Id : SOCI.Into_Position; Pos_Str : SOCI.Into_Position; Pos_LL : SOCI.Into_Position; Pos_LF : SOCI.Into_Position; Pos_TM : SOCI.Into_Position; Got_Data : Boolean; use type Ada.Calendar.Time; use type SOCI.Data_State; use type SOCI.DB_Integer; use type SOCI.DB_Long_Long_Integer; use type SOCI.DB_Long_Float; begin Pos_Id := St.Into_Integer; Pos_Str := St.Into_String; Pos_LL := St.Into_Long_Long_Integer; Pos_LF := St.Into_Long_Float; Pos_TM := St.Into_Time; St.Prepare ("select id, str, ll, lf, tm from soci_test order by id"); St.Execute; Got_Data := St.Fetch; pragma Assert (Got_Data); pragma Assert (St.Get_Into_Integer (Pos_Id) = 1); pragma Assert (St.Get_Into_String (Pos_Str) = "abc"); pragma Assert (St.Get_Into_Long_Long_Integer (Pos_LL) = 10_000_000_000); pragma Assert (St.Get_Into_Long_Float (Pos_LF) = SOCI.DB_Long_Float (0.0)); pragma Assert (St.Get_Into_Time (Pos_TM) = Time_1); Got_Data := St.Fetch; pragma Assert (Got_Data); pragma Assert (St.Get_Into_Integer (Pos_Id) = 2); pragma Assert (St.Get_Into_String (Pos_Str) = "def"); pragma Assert (St.Get_Into_Long_Long_Integer (Pos_LL) = 10_000_000_001); pragma Assert (St.Get_Into_Long_Float (Pos_LF) = SOCI.DB_Long_Float (0.125)); pragma Assert (St.Get_Into_Time (Pos_TM) = Time_2); Got_Data := St.Fetch; pragma Assert (Got_Data); pragma Assert (St.Get_Into_Integer (Pos_Id) = 3); pragma Assert (St.Get_Into_String (Pos_Str) = "ghi"); pragma Assert (St.Get_Into_Long_Long_Integer (Pos_LL) = 10_000_000_002); pragma Assert (St.Get_Into_Long_Float (Pos_LF) = SOCI.DB_Long_Float (0.25)); pragma Assert (St.Get_Into_Time (Pos_TM) = Time_3); Got_Data := St.Fetch; pragma Assert (Got_Data); pragma Assert (St.Get_Into_Integer (Pos_Id) = 4); pragma Assert (St.Get_Into_String (Pos_Str) = "jklm"); pragma Assert (St.Get_Into_Long_Long_Integer (Pos_LL) = 10_000_000_003); pragma Assert (St.Get_Into_Long_Float (Pos_LF) = SOCI.DB_Long_Float (0.5)); pragma Assert (St.Get_Into_Time (Pos_TM) = Time_4); Got_Data := St.Fetch; pragma Assert (Got_Data); pragma Assert (St.Get_Into_Integer (Pos_Id) = 5); pragma Assert (St.Get_Into_String (Pos_Str) = "no"); pragma Assert (St.Get_Into_Long_Long_Integer (Pos_LL) = 10_000_000_004); pragma Assert (St.Get_Into_Long_Float (Pos_LF) = SOCI.DB_Long_Float (0.625)); pragma Assert (St.Get_Into_Time (Pos_TM) = Time_5); Got_Data := St.Fetch; pragma Assert (Got_Data); pragma Assert (St.Get_Into_State (Pos_Id) = SOCI.Data_Not_Null); pragma Assert (St.Get_Into_Integer (Pos_Id) = 6); pragma Assert (St.Get_Into_State (Pos_Str) = SOCI.Data_Null); pragma Assert (St.Get_Into_State (Pos_LL) = SOCI.Data_Null); pragma Assert (St.Get_Into_State (Pos_LF) = SOCI.Data_Null); pragma Assert (St.Get_Into_State (Pos_TM) = SOCI.Data_Null); Got_Data := St.Fetch; pragma Assert (not Got_Data); end; SQL.Execute ("drop table soci_test"); end; end Test_10; procedure Test_11 (Connection_String : in String) is -- test parameters: Pool_Size : constant := 3; Number_Of_Tasks : constant := 10; Iterations_Per_Task : constant := 1000; type Small_Integer is mod 20; package My_Random is new Ada.Numerics.Discrete_Random (Small_Integer); Rand : My_Random.Generator; Pool : SOCI.Connection_Pool (Pool_Size); begin Ada.Text_IO.Put_Line ("testing connection pool"); My_Random.Reset (Rand); for I in 1 .. Pool_Size loop Pool.Open (I, Connection_String); end loop; declare SQL : SOCI.Session := SOCI.Make_Session (Connection_String); begin SQL.Execute ("create table soci_test ( id integer )"); end; declare task type Worker; task body Worker is begin for I in 1 .. Iterations_Per_Task loop declare SQL : SOCI.Session; V : Small_Integer; begin Pool.Lease (SQL); V := My_Random.Random (Rand); SQL.Execute ("insert into soci_test (id) values (" & Small_Integer'Image (V) & ")"); end; end loop; exception when others => Ada.Text_IO.Put_Line ("An exception occured in the worker task."); end Worker; W : array (1 .. Number_Of_Tasks) of Worker; begin Ada.Text_IO.Put_Line ("--> waiting for the tasks to complete (might take a while)"); end; declare SQL : SOCI.Session := SOCI.Make_Session (Connection_String); begin SQL.Execute ("drop table soci_test"); end; end Test_11; begin if Ada.Command_Line.Argument_Count /= 1 then Ada.Text_IO.Put_Line ("Expecting one argument: connection string"); return; end if; declare Connection_String : String := Ada.Command_Line.Argument (1); begin Ada.Text_IO.Put_Line ("testing with " & Connection_String); SOCI.PostgreSQL.Register_Factory_PostgreSQL; Test_1 (Connection_String); Test_2 (Connection_String); Test_3 (Connection_String); Test_4 (Connection_String); Test_5 (Connection_String); Test_6 (Connection_String); Test_7 (Connection_String); Test_8 (Connection_String); Test_9 (Connection_String); Test_10 (Connection_String); Test_11 (Connection_String); end; end PostgreSQL_Test;
fengjixuchui/ewok-kernel
Ada
3,051
adb
-- -- Copyright 2018 The wookey project team <[email protected]> -- - Ryad Benadjila -- - Arnauld Michelizza -- - Mathieu Renard -- - Philippe Thierry -- - Philippe Trebuchet -- -- Licensed under the Apache License, Version 2.0 (the "License"); -- you may not use this file except in compliance with the License. -- You may obtain a copy of the License at -- -- http://www.apache.org/licenses/LICENSE-2.0 -- -- Unless required by applicable law or agreed to in writing, software -- distributed under the License is distributed on an "AS IS" BASIS, -- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -- See the License for the specific language governing permissions and -- limitations under the License. -- -- with m4.scb; use m4.scb; package body m4.mpu with spark_mode => on is function address_to_bits_27 (addr : system_address) return bits_27 is pragma warnings (off); function to_bits_27 is new ada.unchecked_conversion (unsigned_32, bits_27); pragma warnings (on); begin return to_bits_27 (shift_right (addr, 5)); end address_to_bits_27; procedure is_mpu_available (success : out boolean) is begin if to_unsigned_32 (MPU.TYPER) = 0 then success := false; else success := true; end if; end is_mpu_available; procedure enable is begin MPU.CTRL.ENABLE := true; end enable; procedure disable is begin MPU.CTRL.ENABLE := false; end disable; procedure init is begin -- Enable privileged software access to default memory map m4.mpu.MPU.CTRL.PRIVDEFENA := true; -- Enable the memory fault exception m4.scb.SCB.SHCSR.MEMFAULTENA := true; end init; procedure configure_region (region : in t_region_config) is begin -- Selects which memory region is referenced MPU.RNR.REGION := region.region_number; -- Defines the base address of the MPU region MPU.RBAR := (VALID => false, REGION => 0, ADDR => address_to_bits_27 (region.addr)); -- Defines the region size and memory attributes MPU.RASR := (ENABLE => true, SIZE => region.size, SRD => 0, B => region.b, C => false, S => region.S, TEX => 0, AP => region.access_perm, XN => region.xn); end configure_region; procedure disable_region (region_number : in t_region_number) is begin MPU.RNR.REGION := region_number; MPU.RASR.ENABLE := false; end disable_region; procedure update_subregion_mask (region : in t_region_config) is begin -- Selects which memory region is referenced MPU.RNR.REGION := region.region_number; -- Defines the region size and memory attributes MPU.RASR.SRD := region.subregion_mask; end update_subregion_mask; end m4.mpu;
zhmu/ananas
Ada
2,583
ads
------------------------------------------------------------------------------ -- -- -- GNAT RUN-TIME COMPONENTS -- -- -- -- S Y S T E M . E X N _ L F L T -- -- -- -- S p e c -- -- -- -- Copyright (C) 2021-2022, 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. -- -- -- ------------------------------------------------------------------------------ -- Long_Float exponentiation (checks off) with System.Exponr; package System.Exn_LFlt is function Exn_Long_Float is new Exponr (Long_Float); pragma Pure_Function (Exn_Long_Float); end System.Exn_LFlt;
sungyeon/drake
Ada
26,974
adb
pragma Check_Policy (Trace => Ignore); with Ada.Exception_Identification.From_Here; with System.Address_To_Constant_Access_Conversions; with System.UTF_Conversions.From_16_To_32; with System.UTF_Conversions.From_32_To_16; with System.Zero_Terminated_WStrings; with C.winbase; with C.winerror; with C.winnt; package body System.Native_Environment_Encoding is use Ada.Exception_Identification.From_Here; use type UTF_Conversions.From_Status_Type; use type UTF_Conversions.To_Status_Type; use type C.signed_int; -- C.windef.WINBOOL package LPCSTR_Conv is new Address_To_Constant_Access_Conversions (C.char, C.winnt.LPCSTR); procedure Default_Substitute ( Encoding : Encoding_Id; Item : out Ada.Streams.Stream_Element_Array; Last : out Ada.Streams.Stream_Element_Offset; Is_Overflow : out Boolean); procedure Default_Substitute ( Encoding : Encoding_Id; Item : out Ada.Streams.Stream_Element_Array; Last : out Ada.Streams.Stream_Element_Offset; Is_Overflow : out Boolean) is begin case Encoding is when UTF_16 => Last := Item'First - 1; Is_Overflow := Item'First + 1 > Item'Last; if not Is_Overflow then case Default_Bit_Order is when High_Order_First => Last := Last + 1; Item (Last) := 0; Last := Last + 1; Item (Last) := Character'Pos ('?'); when Low_Order_First => Last := Last + 1; Item (Last) := Character'Pos ('?'); Last := Last + 1; Item (Last) := 0; end case; end if; when UTF_32 => Last := Item'First - 1; Is_Overflow := Item'First + 3 > Item'Last; if not Is_Overflow then case Default_Bit_Order is when High_Order_First => Last := Last + 1; Item (Last) := 0; Last := Last + 1; Item (Last) := 0; Last := Last + 1; Item (Last) := 0; Last := Last + 1; Item (Last) := Character'Pos ('?'); when Low_Order_First => Last := Last + 1; Item (Last) := Character'Pos ('?'); Last := Last + 1; Item (Last) := 0; Last := Last + 1; Item (Last) := 0; Last := Last + 1; Item (Last) := 0; end case; end if; when others => Last := Item'First - 1; Is_Overflow := Item'First > Item'Last; if not Is_Overflow then Last := Last + 1; Item (Last) := Character'Pos ('?'); end if; end case; end Default_Substitute; -- implementation function Get_Image (Encoding : Encoding_Id) return String is Info : aliased C.winnls.CPINFOEX; begin if C.winnls.GetCPInfoEx (C.windef.UINT (Encoding), 0, Info'Access) = C.windef.FALSE then Raise_Exception (Use_Error'Identity); -- ? end if; return Zero_Terminated_WStrings.Value (Info.CodePageName (0)'Access); end Get_Image; function Get_Default_Substitute (Encoding : Encoding_Id) return Ada.Streams.Stream_Element_Array is Result : Ada.Streams.Stream_Element_Array ( 0 .. -- from 0 for a result value Max_Substitute_Length - 1); Last : Ada.Streams.Stream_Element_Offset; Is_Overflow : Boolean; begin Default_Substitute (Encoding, Result, Last, Is_Overflow); pragma Assert (not Is_Overflow); return Result (Result'First .. Last); end Get_Default_Substitute; function Get_Min_Size_In_Stream_Elements (Encoding : Encoding_Id) return Ada.Streams.Stream_Element_Offset is begin case Encoding is when UTF_16 => return 2; when UTF_32 => return 4; when others => return 1; end case; end Get_Min_Size_In_Stream_Elements; function Get_Current_Encoding return Encoding_Id is begin return Encoding_Id (C.winnls.GetACP); end Get_Current_Encoding; procedure Open (Object : out Converter; From, To : Encoding_Id) is begin Object.From := From; Object.To := To; Object.Substitute_Length := -1; end Open; function Is_Open (Object : Converter) return Boolean is begin return Object.From /= Invalid_Encoding_Id; end Is_Open; function Min_Size_In_From_Stream_Elements_No_Check (Object : Converter) return Ada.Streams.Stream_Element_Offset is begin return Get_Min_Size_In_Stream_Elements (Object.From); end Min_Size_In_From_Stream_Elements_No_Check; function Substitute_No_Check (Object : Converter) return Ada.Streams.Stream_Element_Array is begin if Object.Substitute_Length < 0 then return Get_Default_Substitute (Object.To); else return Object.Substitute (1 .. Object.Substitute_Length); end if; end Substitute_No_Check; procedure Set_Substitute_No_Check ( Object : in out Converter; Substitute : Ada.Streams.Stream_Element_Array) is begin if Substitute'Length > Object.Substitute'Length - 1 then raise Constraint_Error; end if; Object.Substitute_Length := Substitute'Length; Object.Substitute (1 .. Object.Substitute_Length) := Substitute; Object.Substitute (Object.Substitute_Length + 1) := 0; -- zero terminator end Set_Substitute_No_Check; procedure Convert_No_Check ( Object : Converter; Item : Ada.Streams.Stream_Element_Array; Last : out Ada.Streams.Stream_Element_Offset; Out_Item : out Ada.Streams.Stream_Element_Array; Out_Last : out Ada.Streams.Stream_Element_Offset; Finish : Boolean; Status : out Subsequence_Status_Type) is Buffer : aliased Wide_String (1 .. 2); Buffer_As_C : aliased C.winnt.WCHAR_array (0 .. 1); for Buffer_As_C'Address use Buffer'Address; Buffer_As_SEA : aliased Ada.Streams.Stream_Element_Array (1 .. 4); for Buffer_As_SEA'Address use Buffer'Address; Buffer_Length : C.signed_int; begin pragma Check (Trace, Ada.Debug.Put ("enter")); if Item'First > Item'Last then Last := Item'First - 1; Out_Last := Out_Item'First - 1; else case Object.From is when UTF_8 => declare Length : C.signed_int; From_Status : UTF_Conversions.From_Status_Type; begin declare Item_As_String : aliased String (1 .. Item'Length); for Item_As_String'Address use Item'Address; Dummy_Code : UTF_Conversions.UCS_4; begin UTF_Conversions.From_UTF_8 ( Item_As_String, Integer (Length), Dummy_Code, From_Status); end; case From_Status is when UTF_Conversions.Success => null; when UTF_Conversions.Illegal_Sequence | UTF_Conversions.Non_Shortest => Last := Item'First - 1; Out_Last := Out_Item'First - 1; Status := Illegal_Sequence; pragma Check (Trace, Check => Ada.Debug.Put ("illegal sequence")); return; -- error when UTF_Conversions.Truncated => Last := Item'First - 1; Out_Last := Out_Item'First - 1; Status := Truncated; pragma Check (Trace, Ada.Debug.Put ("truncated")); return; -- error end case; declare Item_As_C : aliased C.char_array (0 .. 0); -- at least for Item_As_C'Address use Item'Address; begin Buffer_Length := C.winnls.MultiByteToWideChar ( C.windef.UINT (Object.From), C.winnls.MB_ERR_INVALID_CHARS, Item_As_C (0)'Access, Length, Buffer_As_C (0)'Access, Buffer'Length); end; if Buffer_Length = 0 then Last := Item'First - 1; Out_Last := Out_Item'First - 1; Status := Illegal_Sequence; pragma Check (Trace, Ada.Debug.Put ("illegal sequence")); return; -- error end if; Last := Item'First + (Ada.Streams.Stream_Element_Offset (Length) - 1); end; when UTF_16 => if Item'First + 1 > Item'Last then Last := Item'First - 1; Out_Last := Out_Item'First - 1; Status := Truncated; pragma Check (Trace, Ada.Debug.Put ("truncated")); return; -- error end if; if Item'First + 3 > Item'Last then Last := Item'First + 1; else Last := Item'First + 3; end if; Buffer_As_SEA (1 .. Last - Item'First + 1) := Item (Item'First .. Last); declare Dummy_Code : UTF_Conversions.UCS_4; From_Status : UTF_Conversions.From_Status_Type; begin UTF_Conversions.From_UTF_16 ( Buffer, Integer (Buffer_Length), Dummy_Code, From_Status); case From_Status is when UTF_Conversions.Success => null; when UTF_Conversions.Illegal_Sequence | UTF_Conversions.Non_Shortest => -- Non_Shortest do not returned in UTF_16 Last := Item'First - 1; Out_Last := Out_Item'First - 1; Status := Illegal_Sequence; pragma Check (Trace, Check => Ada.Debug.Put ("illegal sequence")); return; -- error when UTF_Conversions.Truncated => Last := Item'First - 1; Out_Last := Out_Item'First - 1; Status := Truncated; pragma Check (Trace, Ada.Debug.Put ("truncated")); return; -- error end case; end; Last := 2 * Ada.Streams.Stream_Element_Offset (Buffer_Length); when UTF_32 => if Item'First + 3 > Item'Last then Last := Item'First - 1; Out_Last := Out_Item'First - 1; Status := Truncated; pragma Check (Trace, Ada.Debug.Put ("truncated")); return; -- error end if; declare Code : aliased UTF_Conversions.UCS_4; Code_As_SEA : Ada.Streams.Stream_Element_Array (1 .. 4); for Code_As_SEA'Address use Code'Address; To_Status : UTF_Conversions.To_Status_Type; begin Last := Item'First + 3; Code_As_SEA := Item (Item'First .. Last); UTF_Conversions.To_UTF_16 ( Code, Buffer, Integer (Buffer_Length), To_Status); if To_Status /= UTF_Conversions.Success then Last := Item'First - 1; Out_Last := Out_Item'First - 1; pragma Assert (To_Status = UTF_Conversions.Unmappable); Status := Illegal_Sequence; pragma Check (Trace, Ada.Debug.Put ("illegal sequence")); return; -- error end if; end; when others => declare Item_As_C : aliased C.char_array (0 .. 0); -- at least for Item_As_C'Address use Item'Address; Length : C.signed_int; begin if C.winnls.IsDBCSLeadByteEx ( C.windef.UINT (Object.From), C.char'Pos (Item_As_C (0))) /= C.windef.FALSE then if Item'First + 1 > Item'Last then Last := Item'First - 1; Out_Last := Out_Item'First - 1; Status := Truncated; pragma Check (Trace, Ada.Debug.Put ("truncated")); return; -- error end if; Length := 2; else Length := 1; end if; Last := Item'First + (Ada.Streams.Stream_Element_Offset (Length) - 1); Buffer_Length := C.winnls.MultiByteToWideChar ( C.windef.UINT (Object.From), C.winnls.MB_ERR_INVALID_CHARS, Item_As_C (0)'Access, Length, Buffer_As_C (0)'Access, Buffer'Length); if Buffer_Length = 0 then Out_Last := Out_Item'First - 1; Status := Illegal_Sequence; pragma Check (Trace, Ada.Debug.Put ("illegal sequence")); return; -- error end if; end; end case; case Object.To is when UTF_16 => declare Buffer_SEA_Length : constant Ada.Streams.Stream_Element_Offset := 2 * Ada.Streams.Stream_Element_Offset (Buffer_Length); begin if Out_Item'First + (Buffer_SEA_Length - 1) > Out_Item'Last then Last := Item'First - 1; Out_Last := Out_Item'First - 1; Status := Overflow; pragma Check (Trace, Ada.Debug.Put ("overflow")); return; -- error end if; Out_Last := Out_Item'First + (Buffer_SEA_Length - 1); Out_Item (Out_Item'First .. Out_Last) := Buffer_As_SEA (1 .. Buffer_SEA_Length); end; when UTF_32 => if Out_Item'First + 3 > Out_Item'Last then Last := Item'First - 1; Out_Last := Out_Item'First - 1; Status := Overflow; pragma Check (Trace, Ada.Debug.Put ("overflow")); return; -- error end if; declare Out_Code : aliased UTF_Conversions.UCS_4; Out_Code_As_SEA : Ada.Streams.Stream_Element_Array (1 .. 4); for Out_Code_As_SEA'Address use Out_Code'Address; Buffer_Used : Natural; From_Status : UTF_Conversions.From_Status_Type; begin UTF_Conversions.From_UTF_16 ( Buffer (1 .. Integer (Buffer_Length)), Buffer_Used, Out_Code, From_Status); if From_Status /= UTF_Conversions.Success or else Buffer_Used /= Integer (Buffer_Length) then Last := Item'First - 1; Out_Last := Out_Item'First - 1; Status := Illegal_Sequence; pragma Check (Trace, Ada.Debug.Put ("illegal sequence")); return; -- error end if; Out_Last := Out_Item'First + 3; Out_Item (Out_Item'First .. Out_Last) := Out_Code_As_SEA; end; when others => -- including UTF_8 declare Out_Item_As_C : aliased C.char_array (0 .. 0); -- at least for Out_Item_As_C'Address use Out_Item'Address; Out_Length : C.signed_int; begin Out_Length := C.winnls.WideCharToMultiByte ( C.windef.UINT (Object.To), 0, -- MB_ERR_INVALID_CHARS ? Buffer_As_C (0)'Access, Buffer_Length, Out_Item_As_C (0)'Access, Out_Item'Length, null, null); if Out_Length = 0 then Last := Item'First - 1; Out_Last := Out_Item'First - 1; case C.winbase.GetLastError is when C.winerror.ERROR_INSUFFICIENT_BUFFER => Status := Overflow; pragma Check (Trace, Ada.Debug.Put ("overflow")); when others => Status := Illegal_Sequence; pragma Check (Trace, Check => Ada.Debug.Put ("illegal sequence")); end case; return; -- error end if; Out_Last := Out_Item'First + (Ada.Streams.Stream_Element_Offset (Out_Length) - 1); end; end case; end if; if Finish and then Last = Item'Last then Status := Finished; pragma Check (Trace, Ada.Debug.Put ("finished")); else Status := Success; pragma Check (Trace, Ada.Debug.Put ("success")); end if; pragma Check (Trace, Ada.Debug.Put ("leave")); end Convert_No_Check; procedure Convert_No_Check ( Object : Converter; Item : Ada.Streams.Stream_Element_Array; Last : out Ada.Streams.Stream_Element_Offset; Out_Item : out Ada.Streams.Stream_Element_Array; Out_Last : out Ada.Streams.Stream_Element_Offset; Status : out Continuing_Status_Type) is Subsequence_Status : Subsequence_Status_Type; begin Convert_No_Check ( Object, Item, Last, Out_Item, Out_Last, False, Subsequence_Status); pragma Assert ( Subsequence_Status in Subsequence_Status_Type (Continuing_Status_Type'First) .. Subsequence_Status_Type (Continuing_Status_Type'Last)); Status := Continuing_Status_Type (Subsequence_Status); end Convert_No_Check; procedure Convert_No_Check ( Object : Converter; Out_Item : out Ada.Streams.Stream_Element_Array; Out_Last : out Ada.Streams.Stream_Element_Offset; Finish : True_Only; Status : out Finishing_Status_Type) is pragma Unreferenced (Object); pragma Unmodified (Out_Item); pragma Unreferenced (Finish); begin Out_Last := Out_Item'First - 1; Status := Finished; end Convert_No_Check; procedure Convert_No_Check ( Object : Converter; Item : Ada.Streams.Stream_Element_Array; Last : out Ada.Streams.Stream_Element_Offset; Out_Item : out Ada.Streams.Stream_Element_Array; Out_Last : out Ada.Streams.Stream_Element_Offset; Finish : True_Only; Status : out Substituting_Status_Type) is pragma Unreferenced (Finish); Item_Length : constant Ada.Streams.Stream_Element_Offset := Item'Length; Buffer : aliased Wide_String (1 .. Natural (Item_Length)); Buffer_As_C : aliased C.winnt.WCHAR_array (0 .. 0); -- at least for Buffer_As_C'Address use Buffer'Address; Buffer_As_SEA : aliased Ada.Streams.Stream_Element_Array (1 .. 2 * Item_Length); for Buffer_As_SEA'Address use Buffer'Address; Buffer_Length : C.signed_int; begin Last := Item'Last; case Object.From is when UTF_16 => Buffer_As_SEA (1 .. Item_Length) := Item; Buffer_Length := C.signed_int (Item_Length / 2); if Item_Length rem 2 /= 0 then Buffer_Length := Buffer_Length + 1; Buffer (Integer (Buffer_Length)) := '?'; -- use Substitute end if; when UTF_32 => declare WW : aliased Wide_Wide_String (1 .. Natural (Item_Length / 4)); WW_As_SEA : Ada.Streams.Stream_Element_Array (1 .. Item_Length); for WW_As_SEA'Address use WW'Address; begin WW_As_SEA := Item; -- alignment UTF_Conversions.From_32_To_16.Convert ( WW, Buffer, Natural (Buffer_Length), Substitute => "?"); -- use Substitute end; if Item_Length rem 4 /= 0 then Buffer_Length := Buffer_Length + 1; Buffer (Integer (Buffer_Length)) := '?'; -- use Substitute end if; when others => -- including UTF_8 declare Item_As_C : aliased C.char_array (0 .. 0); -- at least for Item_As_C'Address use Item'Address; begin Buffer_Length := C.winnls.MultiByteToWideChar ( C.windef.UINT (Object.From), 0, -- no C.winnls.MB_ERR_INVALID_CHARS for converting all Item_As_C (0)'Access, C.signed_int (Item_Length), Buffer_As_C (0)'Access, Buffer'Length); end; end case; case Object.To is when UTF_16 => declare Buffer_Length_In_SEA : constant Ada.Streams.Stream_Element_Offset := 2 * Ada.Streams.Stream_Element_Offset (Buffer_Length); begin Out_Last := Out_Item'First + (Buffer_Length_In_SEA - 1); if Out_Last > Out_Item'Last then Last := Item'First - 1; Out_Last := Out_Item'First - 1; Status := Overflow; pragma Check (Trace, Ada.Debug.Put ("overflow")); return; -- error end if; Out_Item (Out_Item'First .. Out_Last) := Buffer_As_SEA (1 .. Buffer_Length_In_SEA); end; when UTF_32 => declare Out_WW : aliased Wide_Wide_String (1 .. Natural (Buffer_Length)); Out_WW_As_SEA : Ada.Streams.Stream_Element_Array ( 1 .. 4 * Ada.Streams.Stream_Element_Offset (Buffer_Length)); for Out_WW_As_SEA'Address use Out_WW'Address; Out_WW_Length : Natural; begin UTF_Conversions.From_16_To_32.Convert ( Buffer, Out_WW, Out_WW_Length, Substitute => "?"); -- use Substitute declare Out_WW_Length_In_SEA : constant Ada.Streams.Stream_Element_Offset := 4 * Ada.Streams.Stream_Element_Offset (Out_WW_Length); begin Out_Last := Out_Item'First + (Out_WW_Length_In_SEA - 1); if Out_Last > Out_Item'Last then Last := Item'First - 1; Out_Last := Out_Item'First - 1; Status := Overflow; pragma Check (Trace, Ada.Debug.Put ("overflow")); return; -- error end if; Out_Item (Out_Item'First .. Out_Last) := Out_WW_As_SEA (1 .. Out_WW_Length_In_SEA); -- un-alignment end; end; when others => -- including UTF_8 declare Out_Item_As_C : aliased C.char_array (0 .. 0); -- at least for Out_Item_As_C'Address use Out_Item'Address; Out_Length : C.signed_int; Substitute_P : C.winnt.LPCSTR; begin if Object.Substitute_Length < 0 or else Object.To = UTF_8 then Substitute_P := null; else Substitute_P := LPCSTR_Conv.To_Pointer (Object.Substitute (1)'Address); end if; Out_Length := C.winnls.WideCharToMultiByte ( C.windef.UINT (Object.To), 0, -- no C.winnls.MB_ERR_INVALID_CHARS for converting all Buffer_As_C (0)'Access, Buffer_Length, Out_Item_As_C (0)'Access, Out_Item'Length, Substitute_P, null); if Out_Length = 0 and then Item'First <= Item'Last then Last := Item'First - 1; Out_Last := Out_Item'First - 1; Status := Overflow; pragma Check (Trace, Ada.Debug.Put ("overflow")); return; -- error end if; Out_Last := Out_Item'First + (Ada.Streams.Stream_Element_Offset (Out_Length) - 1); end; end case; Status := Finished; end Convert_No_Check; procedure Put_Substitute ( Object : Converter; Out_Item : out Ada.Streams.Stream_Element_Array; Out_Last : out Ada.Streams.Stream_Element_Offset; Is_Overflow : out Boolean) is begin if Object.Substitute_Length < 0 then Default_Substitute ( Object.To, Out_Item, Out_Last, Is_Overflow); else Is_Overflow := Out_Item'Length < Object.Substitute_Length; if Is_Overflow then Out_Last := Out_Item'First - 1; else Out_Last := Out_Item'First + (Object.Substitute_Length - 1); Out_Item (Out_Item'First .. Out_Last) := Object.Substitute (1 .. Object.Substitute_Length); end if; end if; end Put_Substitute; end System.Native_Environment_Encoding;
stcarrez/ada-asf
Ada
12,132
ads
----------------------------------------------------------------------- -- asf-components-html-forms -- ASF HTML Form Components -- Copyright (C) 2010 - 2023 Stephane Carrez -- Written by Stephane Carrez ([email protected]) -- -- 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.Components.Holders; with ASF.Components.Html.Text; with ASF.Validators; with ASF.Events.Faces; with EL.Objects; with EL.Expressions; package ASF.Components.Html.Forms is -- A UIComponent can have several validators. To keep the implementation light and -- simple, a fixed array is used. Most components will have one or two validators. -- Define the number of validators per component (UIInput). MAX_VALIDATORS_PER_COMPONENT : constant Positive := 5; -- Message displayed when the submitted value is required but is empty. REQUIRED_MESSAGE_ID : constant String := "asf.faces.component.UIInput.REQUIRED"; -- Message displayed when setting a value on the bean fails during the update values phase. ERROR_MESSAGE_ID : constant String := "asf.faces.component.UIInput.ERROR"; -- Message displayed when the form submussion contains an invalid CSRF token. EXPIRED_MESSAGE_ID : constant String := "asf.faces.component.UIForm.EXPIRED"; -- ------------------------------ -- Form Component -- ------------------------------ type UIForm is new UIHtmlComponent with private; type UIForm_Access is access all UIForm'Class; -- Check whether the form is submitted. function Is_Submitted (UI : in UIForm) return Boolean; -- Called during the <b>Apply Request</b> phase to indicate that this -- form is submitted. procedure Set_Submitted (UI : in out UIForm); -- Get the action URL to set on the HTML form function Get_Action (UI : in UIForm; Context : in Faces_Context'Class) return String; -- Get the CSRF token validity. Returns 0 if the form has no CSRF token. function Get_Token_Validity (UI : in UIForm; Context : in Faces_Context'Class) return Natural; -- Create the CSRF token for the form submission and the given form ID. function Create_Token (UI : in UIForm; Id : in String; Context : in Faces_Context'Class) return String; overriding procedure Encode_Begin (UI : in UIForm; Context : in out Faces_Context'Class); overriding procedure Encode_End (UI : in UIForm; Context : in out Faces_Context'Class); overriding procedure Decode (UI : in out UIForm; Context : in out Faces_Context'Class); overriding procedure Process_Decodes (UI : in out UIForm; Context : in out Faces_Context'Class); -- ------------------------------ -- Input Component -- ------------------------------ type UIInput is new Text.UIOutput and Holders.Editable_Value_Holder with private; type UIInput_Access is access all UIInput'Class; -- Check if this component has the required attribute set. function Is_Required (UI : in UIInput; Context : in Faces_Context'Class) return Boolean; -- Find the form component which contains the input component. -- Returns null if the input is not within a form component. function Get_Form (UI : in UIInput) return UIForm_Access; -- Get the value of the component. If the component has a submitted value, returns it. -- If the component has a local value which is not null, returns it. -- Otherwise, if we have a Value_Expression evaluate and returns the value. overriding function Get_Value (UI : in UIInput) return EL.Objects.Object; -- Convert the string into a value. If a converter is specified on the component, -- use it to convert the value. function Convert_Value (UI : in UIInput; Value : in String; Context : in Faces_Context'Class) return EL.Objects.Object; -- Get the input parameter from the submitted context. This operation is called by -- <tt>Process_Decodes</tt> to retrieve the request parameter associated with the component. function Get_Parameter (UI : in UIInput; Context : in Faces_Context'Class) return String; -- Set the input component as a password field. procedure Set_Secret (UI : in out UIInput; Value : in Boolean); -- Render the input element. procedure Render_Input (UI : in UIInput; Context : in out Faces_Context'Class; Write_Id : in Boolean := True); overriding procedure Encode_Begin (UI : in UIInput; Context : in out Faces_Context'Class); overriding procedure Process_Decodes (UI : in out UIInput; Context : in out Faces_Context'Class); -- Perform the component tree processing required by the <b>Process Validations</b> -- phase of the request processing lifecycle for all facets of this component, -- all children of this component, and this component itself, as follows: -- <ul> -- <li>If this component <b>rendered</b> property is false, skip further processing. -- <li>Call the <b>Process_Validators</b> of all facets and children. -- <ul> overriding procedure Process_Validators (UI : in out UIInput; Context : in out Faces_Context'Class); overriding procedure Process_Updates (UI : in out UIInput; Context : in out Faces_Context'Class); -- Validate the submitted value. -- <ul> -- <li>Retreive the submitted value -- <li>If the value is null, exit without further processing. -- <li>Validate the value by calling <b>Validate_Value</b> -- </ul> procedure Validate (UI : in out UIInput; Context : in out Faces_Context'Class); -- Set the <b>valid</b> property: -- <ul> -- <li>If the <b>required</b> property is true, ensure the -- value is not empty -- <li>Call the <b>Validate</b> procedure on each validator -- registered on this component. -- <li>Set the <b>valid</b> property if all validator passed. -- </ul> procedure Validate_Value (UI : in out UIInput; Value : in EL.Objects.Object; Context : in out Faces_Context'Class); -- Add the validator to be used on the component. The ASF implementation limits -- to 5 the number of validators that can be set on a component (See UIInput). -- The validator instance will be freed when the editable value holder is deleted -- unless <b>Shared</b> is true. overriding procedure Add_Validator (UI : in out UIInput; Validator : in ASF.Validators.Validator_Access; Shared : in Boolean := False); -- Delete the UI input instance. overriding procedure Finalize (UI : in out UIInput); -- ------------------------------ -- InputTextarea Component -- ------------------------------ type UIInputTextarea is new UIInput with private; type UIInputTextarea_Access is access all UIInputTextarea'Class; -- Render the textarea element. overriding procedure Render_Input (UI : in UIInputTextarea; Context : in out Faces_Context'Class; Write_Id : in Boolean := True); -- ------------------------------ -- Input_Hidden Component -- ------------------------------ type UIInput_Hidden is new UIInput with private; type UIInput_Hidden_Access is access all UIInput_Hidden'Class; -- Render the inputHidden element. overriding procedure Render_Input (UI : in UIInput_Hidden; Context : in out Faces_Context'Class; Write_Id : in Boolean := True); -- ------------------------------ -- InputFile Component -- ------------------------------ type UIInput_File is new UIInput with private; type UIInput_File_Access is access all UIInput_File'Class; -- Render the input file element. overriding procedure Render_Input (UI : in UIInput_File; Context : in out Faces_Context'Class; Write_Id : in Boolean := True); -- Validate the submitted file. -- <ul> -- <li>Retreive the submitted value -- <li>If the value is null, exit without further processing. -- <li>Validate the value by calling <b>Validate_Value</b> -- </ul> overriding procedure Validate (UI : in out UIInput_File; Context : in out Faces_Context'Class); overriding procedure Process_Updates (UI : in out UIInput_File; Context : in out Faces_Context'Class); -- ------------------------------ -- Button Component -- ------------------------------ type UICommand is new UIHtmlComponent with private; overriding procedure Encode_Begin (UI : in UICommand; Context : in out Faces_Context'Class); -- Get the value to write on the output. function Get_Value (UI : in UICommand) return EL.Objects.Object; -- Set the value to write on the output. procedure Set_Value (UI : in out UICommand; Value : in EL.Objects.Object); -- Get the action method expression to invoke if the command is pressed. function Get_Action_Expression (UI : in UICommand; Context : in Faces_Context'Class) return EL.Expressions.Method_Expression; overriding procedure Process_Decodes (UI : in out UICommand; Context : in out Faces_Context'Class); -- Broadcast the event to the event listeners installed on this component. -- Listeners are called in the order in which they were added. overriding procedure Broadcast (UI : in out UICommand; Event : not null access ASF.Events.Faces.Faces_Event'Class; Context : in out Faces_Context'Class); private type Validator is record Validator : ASF.Validators.Validator_Access := null; Shared : Boolean := False; end record; type Validator_Array is array (1 .. MAX_VALIDATORS_PER_COMPONENT) of Validator; type UIInput is new Text.UIOutput and Holders.Editable_Value_Holder with record Submitted_Value : EL.Objects.Object; Is_Valid : Boolean := False; Is_Secret : Boolean := False; Is_Submitted : Boolean := False; Validators : Validator_Array; end record; type UIInputTextarea is new UIInput with record Rows : Natural; Cols : Natural; end record; type UIInput_Hidden is new UIInput with null record; type UIInput_File is new UIInput with null record; type UICommand is new UIHtmlComponent with record Value : EL.Objects.Object; end record; type UIForm is new UIHtmlComponent with record Is_Submitted : Boolean := False; Is_Valid : Boolean := False; end record; end ASF.Components.Html.Forms;
MinimSecure/unum-sdk
Ada
799
ads
-- Copyright 2013-2016 Free Software Foundation, Inc. -- -- This program is free software; you can redistribute it and/or modify -- it under the terms of the GNU General Public License as published by -- the Free Software Foundation; either version 3 of the License, or -- (at your option) any later version. -- -- This program is distributed in the hope that it will be useful, -- but WITHOUT ANY WARRANTY; without even the implied warranty of -- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -- GNU General Public License for more details. -- -- You should have received a copy of the GNU General Public License -- along with this program. If not, see <http://www.gnu.org/licenses/>. with System; package Pck is procedure Do_Nothing (A : System.Address); end Pck;
AdaCore/Ada_Drivers_Library
Ada
2,642
ads
------------------------------------------------------------------------------ -- -- -- Copyright (C) 2017, AdaCore -- -- -- -- Redistribution and use in source and binary forms, with or without -- -- modification, are permitted provided that the following conditions are -- -- met: -- -- 1. Redistributions of source code must retain the above copyright -- -- notice, this list of conditions and the following disclaimer. -- -- 2. Redistributions in binary form must reproduce the above copyright -- -- notice, this list of conditions and the following disclaimer in -- -- the documentation and/or other materials provided with the -- -- distribution. -- -- 3. Neither the name of the copyright holder nor the names of its -- -- contributors may be used to endorse or promote products derived -- -- from this software without specific prior written permission. -- -- -- -- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -- -- "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -- -- LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -- -- A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -- -- HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -- -- SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -- -- LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -- -- DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -- -- THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -- -- (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -- -- OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -- -- -- ------------------------------------------------------------------------------ with HAL; package Hex_Dump is type Put_Line_Procedure is access procedure (Str : String); procedure Hex_Dump (Data : HAL.UInt8_Array; Put_Line : Put_Line_Procedure; Base_Addr : HAL.UInt64 := 0); end Hex_Dump;
reznikmm/matreshka
Ada
3,754
ads
------------------------------------------------------------------------------ -- -- -- Matreshka Project -- -- -- -- Open Document Toolkit -- -- -- -- Runtime Library Component -- -- -- ------------------------------------------------------------------------------ -- -- -- Copyright © 2014, Vadim Godunko <[email protected]> -- -- 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 XML.DOM.Attributes; package ODF.DOM.Presentation_Style_Name_Attributes is pragma Preelaborate; type ODF_Presentation_Style_Name_Attribute is limited interface and XML.DOM.Attributes.DOM_Attribute; type ODF_Presentation_Style_Name_Attribute_Access is access all ODF_Presentation_Style_Name_Attribute'Class with Storage_Size => 0; end ODF.DOM.Presentation_Style_Name_Attributes;
charlie5/lace
Ada
907
ads
with lace.make_Observer.deferred, lace.Any; private with ada.Strings.unbounded; package lace.Observer.deferred -- -- Provides a concrete deferred event observer. -- is type Item is limited new Any.limited_item and Observer .item with private; type View is access all Item'Class; package Forge is function to_Observer (Name : in Event.observer_Name) return Item; function new_Observer (Name : in Event.observer_Name) return View; end Forge; overriding function Name (Self : in Item) return Event.observer_Name; private use ada.Strings.unbounded; package Observer is new lace.make_Observer (Any.limited_item); package Deferred is new Observer.deferred (Observer.item); type Item is limited new Deferred.item with record Name : unbounded_String; end record; end lace.Observer.deferred;
eqcola/ada-ado
Ada
7,573
ads
----------------------------------------------------------------------- -- ADO Drivers -- Database Drivers -- Copyright (C) 2010, 2011, 2012, 2016, 2017 Stephane Carrez -- Written by Stephane Carrez ([email protected]) -- -- Licensed under the Apache License, Version 2.0 (the "License"); -- you may not use this file except in compliance with the License. -- You may obtain a copy of the License at -- -- http://www.apache.org/licenses/LICENSE-2.0 -- -- Unless required by applicable law or agreed to in writing, software -- distributed under the License is distributed on an "AS IS" BASIS, -- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -- See the License for the specific language governing permissions and -- limitations under the License. ----------------------------------------------------------------------- with Ada.Finalization; with ADO.Statements; with ADO.Schemas; with Util.Properties; with Util.Strings; with Util.Refs; -- The <b>ADO.Drivers</b> package represents the database driver that will create -- database connections and provide the database specific implementation. package ADO.Drivers.Connections is use ADO.Statements; type Driver is abstract tagged limited private; type Driver_Access is access all Driver'Class; -- ------------------------------ -- Database connection implementation -- ------------------------------ -- type Database_Connection is abstract new Util.Refs.Ref_Entity with record Ident : String (1 .. 8) := (others => ' '); end record; type Database_Connection_Access is access all Database_Connection'Class; -- Get the database driver index. function Get_Driver_Index (Database : in Database_Connection) return Driver_Index; function Create_Statement (Database : in Database_Connection; Table : in ADO.Schemas.Class_Mapping_Access) return Query_Statement_Access is abstract; function Create_Statement (Database : in Database_Connection; Query : in String) return Query_Statement_Access is abstract; -- Create a delete statement. function Create_Statement (Database : in Database_Connection; Table : in ADO.Schemas.Class_Mapping_Access) return Delete_Statement_Access is abstract; -- Create an insert statement. function Create_Statement (Database : in Database_Connection; Table : in ADO.Schemas.Class_Mapping_Access) return Insert_Statement_Access is abstract; -- Create an update statement. function Create_Statement (Database : in Database_Connection; Table : in ADO.Schemas.Class_Mapping_Access) return Update_Statement_Access is abstract; -- Start a transaction. procedure Begin_Transaction (Database : in out Database_Connection) is abstract; -- Commit the current transaction. procedure Commit (Database : in out Database_Connection) is abstract; -- Rollback the current transaction. procedure Rollback (Database : in out Database_Connection) is abstract; -- Load the database schema definition for the current database. procedure Load_Schema (Database : in Database_Connection; Schema : out ADO.Schemas.Schema_Definition) is abstract; -- Get the database driver which manages this connection. function Get_Driver (Database : in Database_Connection) return Driver_Access is abstract; -- Closes the database connection procedure Close (Database : in out Database_Connection) is abstract; package Ref is new Util.Refs.Indefinite_References (Element_Type => Database_Connection'Class, Element_Access => Database_Connection_Access); -- ------------------------------ -- The database configuration properties -- ------------------------------ type Configuration is new Ada.Finalization.Controlled with private; type Configuration_Access is access all Configuration'Class; -- Set the connection URL to connect to the database. -- The driver connection is a string of the form: -- -- driver://[host][:port]/[database][?property1][=value1]... -- -- If the string is invalid or if the driver cannot be found, -- the Connection_Error exception is raised. procedure Set_Connection (Controller : in out Configuration; URI : in String); -- Set a property on the datasource for the driver. -- The driver can retrieve the property to configure and open -- the database connection. procedure Set_Property (Controller : in out Configuration; Name : in String; Value : in String); -- Get a property from the data source configuration. -- If the property does not exist, an empty string is returned. function Get_Property (Controller : in Configuration; Name : in String) return String; -- Set the server hostname. procedure Set_Server (Controller : in out Configuration; Server : in String); -- Get the server hostname. function Get_Server (Controller : in Configuration) return String; -- Set the server port. procedure Set_Port (Controller : in out Configuration; Port : in Natural); -- Get the server port. function Get_Port (Controller : in Configuration) return Natural; -- Set the database name. procedure Set_Database (Controller : in out Configuration; Database : in String); -- Get the database name. function Get_Database (Controller : in Configuration) return String; -- Get the database driver name. function Get_Driver (Controller : in Configuration) return String; -- Create a new connection using the configuration parameters. procedure Create_Connection (Config : in Configuration'Class; Result : in out Ref.Ref'Class); -- ------------------------------ -- Database Driver -- ------------------------------ -- Create a new connection using the configuration parameters. procedure Create_Connection (D : in out Driver; Config : in Configuration'Class; Result : in out Ref.Ref'Class) is abstract; -- Get the driver unique index. function Get_Driver_Index (D : in Driver) return Driver_Index; -- Get the driver name. function Get_Driver_Name (D : in Driver) return String; -- Register a database driver. procedure Register (Driver : in Driver_Access); -- Get a database driver given its name. function Get_Driver (Name : in String) return Driver_Access; private type Driver is abstract new Ada.Finalization.Limited_Controlled with record Name : Util.Strings.Name_Access; Index : Driver_Index; end record; type Configuration is new Ada.Finalization.Controlled with record URI : Unbounded_String; Log_URI : Unbounded_String; Server : Unbounded_String; Port : Natural := 0; Database : Unbounded_String; Properties : Util.Properties.Manager; Driver : Driver_Access; end record; end ADO.Drivers.Connections;
charlie5/lace
Ada
1,115
ads
with glx.Pointers; package GLX.Pointer_Pointers is use glx.Pointers; type VisualID_Pointer_Pointer is access all VisualID_Pointer; type XVisualInfo_Pointer_Pointer is access all XVisualInfo_Pointer; type Pixmap_Pointer_Pointer is access all Pixmap_Pointer; type Font_Pointer_Pointer is access all Font_Pointer; type Window_Pointer_Pointer is access all Window_Pointer; type Bool_Pointer_Pointer is access all Bool_Pointer; type ContextRec_Pointer_Pointer is access all ContextRec_Pointer; type XID_Pointer_Pointer is access all XID_Pointer; type GLXPixmap_Pointer_Pointer is access all GLXPixmap_Pointer; type Drawable_Pointer_Pointer is access all Drawable_Pointer; type FBConfig_Pointer_Pointer is access all FBConfig_Pointer; type FBConfigID_Pointer_Pointer is access all FBConfigID_Pointer; type ContextID_Pointer_Pointer is access all ContextID_Pointer; type GLXWindow_Pointer_Pointer is access all Window_Pointer; type PBuffer_Pointer_Pointer is access all PBuffer_Pointer; end GLX.Pointer_Pointers;
psyomn/ash
Ada
1,115
ads
-- Copyright 2019 Simon Symeonidis (psyomn) -- -- Licensed under the Apache License, Version 2.0 (the "License"); -- you may not use this file except in compliance with the License. -- You may obtain a copy of the License at -- -- http://www.apache.org/licenses/LICENSE-2.0 -- -- Unless required by applicable law or agreed to in writing, software -- distributed under the License is distributed on an "AS IS" BASIS, -- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -- See the License for the specific language governing permissions and -- limitations under the License. with AUnit; with AUnit.Test_Fixtures; package Common_Utils_Test is type Test is new AUnit.Test_Fixtures.Test_Fixture with null record; procedure Test_Integer_To_Trimmed_String (T : in out Test); procedure Test_Header_String (T : in out Test); procedure Test_Header_String_Integer (T : in out Test); procedure Test_Empty_String (T : in out Test); procedure Test_Empty_String_Range (T : in out Test); procedure Test_Concat_Null_String (T : in out Test); end Common_Utils_Test;
reznikmm/matreshka
Ada
4,647
ads
------------------------------------------------------------------------------ -- -- -- Matreshka Project -- -- -- -- Open Document Toolkit -- -- -- -- Runtime Library Component -- -- -- ------------------------------------------------------------------------------ -- -- -- Copyright © 2014, Vadim Godunko <[email protected]> -- -- 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 XML.DOM.Visitors; with ODF.DOM.Db_Column_Elements; package Matreshka.ODF_Db.Column_Elements is type Db_Column_Element_Node is new Matreshka.ODF_Db.Abstract_Db_Element_Node and ODF.DOM.Db_Column_Elements.ODF_Db_Column with null record; overriding function Create (Parameters : not null access Matreshka.DOM_Elements.Element_L2_Parameters) return Db_Column_Element_Node; overriding function Get_Local_Name (Self : not null access constant Db_Column_Element_Node) return League.Strings.Universal_String; overriding procedure Enter_Node (Self : not null access Db_Column_Element_Node; Visitor : in out XML.DOM.Visitors.Abstract_Visitor'Class; Control : in out XML.DOM.Visitors.Traverse_Control); overriding procedure Leave_Node (Self : not null access Db_Column_Element_Node; Visitor : in out XML.DOM.Visitors.Abstract_Visitor'Class; Control : in out XML.DOM.Visitors.Traverse_Control); overriding procedure Visit_Node (Self : not null access Db_Column_Element_Node; Iterator : in out XML.DOM.Visitors.Abstract_Iterator'Class; Visitor : in out XML.DOM.Visitors.Abstract_Visitor'Class; Control : in out XML.DOM.Visitors.Traverse_Control); end Matreshka.ODF_Db.Column_Elements;
persan/A-gst
Ada
12,432
ads
pragma Ada_2005; pragma Style_Checks (Off); pragma Warnings (Off); with Interfaces.C; use Interfaces.C; with glib; with glib.Values; with System; with GStreamer.GST_Low_Level.gstreamer_0_10_gst_base_gstbasesink_h; limited with GStreamer.GST_Low_Level.gstreamer_0_10_gst_audio_gstringbuffer_h; with GLIB; -- with GStreamer.GST_Low_Level.glibconfig_h; with GStreamer.GST_Low_Level.gstreamer_0_10_gst_gstclock_h; with System; limited with GStreamer.GST_Low_Level.gstreamer_0_10_gst_gstbuffer_h; with glib; package GStreamer.GST_Low_Level.gstreamer_0_10_gst_audio_gstbaseaudiosink_h is -- unsupported macro: GST_TYPE_BASE_AUDIO_SINK (gst_base_audio_sink_get_type()) -- arg-macro: function GST_BASE_AUDIO_SINK (obj) -- return G_TYPE_CHECK_INSTANCE_CAST((obj),GST_TYPE_BASE_AUDIO_SINK,GstBaseAudioSink); -- arg-macro: function GST_BASE_AUDIO_SINK_CLASS (klass) -- return G_TYPE_CHECK_CLASS_CAST((klass),GST_TYPE_BASE_AUDIO_SINK,GstBaseAudioSinkClass); -- arg-macro: function GST_BASE_AUDIO_SINK_GET_CLASS (obj) -- return G_TYPE_INSTANCE_GET_CLASS ((obj), GST_TYPE_BASE_AUDIO_SINK, GstBaseAudioSinkClass); -- arg-macro: function GST_IS_BASE_AUDIO_SINK (obj) -- return G_TYPE_CHECK_INSTANCE_TYPE((obj),GST_TYPE_BASE_AUDIO_SINK); -- arg-macro: function GST_IS_BASE_AUDIO_SINK_CLASS (klass) -- return G_TYPE_CHECK_CLASS_TYPE((klass),GST_TYPE_BASE_AUDIO_SINK); -- arg-macro: function GST_BASE_AUDIO_SINK_CLOCK (obj) -- return GST_BASE_AUDIO_SINK (obj).clock; -- arg-macro: function GST_BASE_AUDIO_SINK_PAD (obj) -- return GST_BASE_SINK (obj).sinkpad; -- unsupported macro: GST_TYPE_BASE_AUDIO_SINK_SLAVE_METHOD (gst_base_audio_sink_slave_method_get_type ()) -- GStreamer -- * Copyright (C) 1999,2000 Erik Walthinsen <[email protected]> -- * 2005 Wim Taymans <[email protected]> -- * -- * gstbaseaudiosink.h: -- * -- * This library is free software; you can redistribute it and/or -- * modify it under the terms of the GNU Library General Public -- * License as published by the Free Software Foundation; either -- * version 2 of the License, or (at your option) any later version. -- * -- * This library is distributed in the hope that it will be useful, -- * but WITHOUT ANY WARRANTY; without even the implied warranty of -- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -- * Library General Public License for more details. -- * -- * You should have received a copy of the GNU Library General Public -- * License along with this library; if not, write to the -- * Free Software Foundation, Inc., 59 Temple Place - Suite 330, -- * Boston, MA 02111-1307, USA. -- -- a base class for audio sinks. -- * -- * It uses a ringbuffer to schedule playback of samples. This makes -- * it very easy to drop or insert samples to align incoming -- * buffers to the exact playback timestamp. -- * -- * Subclasses must provide a ringbuffer pointing to either DMA -- * memory or regular memory. A subclass should also call a callback -- * function when it has played N segments in the buffer. The subclass -- * is free to use a thread to signal this callback, use EIO or any -- * other mechanism. -- * -- * The base class is able to operate in push or pull mode. The chain -- * mode will queue the samples in the ringbuffer as much as possible. -- * The available space is calculated in the callback function. -- * -- * The pull mode will pull_range() a new buffer of N samples with a -- * configurable latency. This allows for high-end real time -- * audio processing pipelines driven by the audiosink. The callback -- * function will be used to perform a pull_range() on the sinkpad. -- * The thread scheduling the callback can be a real-time thread. -- * -- * Subclasses must implement a GstRingBuffer in addition to overriding -- * the methods in GstBaseSink and this class. -- --* -- * GST_BASE_AUDIO_SINK_CLOCK: -- * @obj: a #GstBaseAudioSink -- * -- * Get the #GstClock of @obj. -- --* -- * GST_BASE_AUDIO_SINK_PAD: -- * @obj: a #GstBaseAudioSink -- * -- * Get the sink #GstPad of @obj. -- --* -- * GstBaseAudioSinkSlaveMethod: -- * @GST_BASE_AUDIO_SINK_SLAVE_RESAMPLE: Resample to match the master clock -- * @GST_BASE_AUDIO_SINK_SLAVE_SKEW: Adjust playout pointer when master clock -- * drifts too much. -- * @GST_BASE_AUDIO_SINK_SLAVE_NONE: No adjustment is done. -- * -- * Different possible clock slaving algorithms used when the internal audio -- * clock is not selected as the pipeline master clock. -- type GstBaseAudioSinkSlaveMethod is (GST_BASE_AUDIO_SINK_SLAVE_RESAMPLE, GST_BASE_AUDIO_SINK_SLAVE_SKEW, GST_BASE_AUDIO_SINK_SLAVE_NONE); pragma Convention (C, GstBaseAudioSinkSlaveMethod); -- gst/audio/gstbaseaudiosink.h:96 type GstBaseAudioSink; type anon_355; type anon_356 is record eos_rendering : aliased GLIB.gboolean; -- gst/audio/gstbaseaudiosink.h:134 end record; pragma Convention (C_Pass_By_Copy, anon_356); type u_GstBaseAudioSink_u_gst_reserved_array is array (0 .. 2) of System.Address; type anon_355 (discr : unsigned := 0) is record case discr is when 0 => ABI : aliased anon_356; -- gst/audio/gstbaseaudiosink.h:135 when others => u_gst_reserved : u_GstBaseAudioSink_u_gst_reserved_array; -- gst/audio/gstbaseaudiosink.h:136 end case; end record; pragma Convention (C_Pass_By_Copy, anon_355); pragma Unchecked_Union (anon_355);--subtype GstBaseAudioSink is u_GstBaseAudioSink; -- gst/audio/gstbaseaudiosink.h:100 type GstBaseAudioSinkClass; type u_GstBaseAudioSinkClass_u_gst_reserved_array is array (0 .. 2) of System.Address; --subtype GstBaseAudioSinkClass is u_GstBaseAudioSinkClass; -- gst/audio/gstbaseaudiosink.h:101 -- skipped empty struct u_GstBaseAudioSinkPrivate -- skipped empty struct GstBaseAudioSinkPrivate --* -- * GstBaseAudioSink: -- * -- * Opaque #GstBaseAudioSink. -- type GstBaseAudioSink is record element : aliased GStreamer.GST_Low_Level.gstreamer_0_10_gst_base_gstbasesink_h.GstBaseSink; -- gst/audio/gstbaseaudiosink.h:110 ringbuffer : access GStreamer.GST_Low_Level.gstreamer_0_10_gst_audio_gstringbuffer_h.GstRingBuffer; -- gst/audio/gstbaseaudiosink.h:114 buffer_time : aliased GLIB.guint64; -- gst/audio/gstbaseaudiosink.h:117 latency_time : aliased GLIB.guint64; -- gst/audio/gstbaseaudiosink.h:118 next_sample : aliased GLIB.guint64; -- gst/audio/gstbaseaudiosink.h:121 provide_clock : aliased GLIB.gboolean; -- gst/audio/gstbaseaudiosink.h:124 provided_clock : access GStreamer.GST_Low_Level.gstreamer_0_10_gst_gstclock_h.GstClock; -- gst/audio/gstbaseaudiosink.h:125 priv : System.Address; -- gst/audio/gstbaseaudiosink.h:128 abidata : aliased anon_355; -- gst/audio/gstbaseaudiosink.h:137 end record; pragma Convention (C_Pass_By_Copy, GstBaseAudioSink); -- gst/audio/gstbaseaudiosink.h:109 --< protected > -- with LOCK -- our ringbuffer -- required buffer and latency in microseconds -- the next sample to write -- clock --< private > --< protected > -- with g_atomic_; currently rendering eos --* -- * GstBaseAudioSinkClass: -- * @parent_class: the parent class. -- * @create_ringbuffer: create and return a #GstRingBuffer to write to. -- * @payload: payload data in a format suitable to write to the sink. If no -- * payloading is required, returns a reffed copy of the original -- * buffer, else returns the payloaded buffer with all other metadata -- * copied. (Since: 0.10.36) -- * -- * #GstBaseAudioSink class. Override the vmethod to implement -- * functionality. -- type GstBaseAudioSinkClass is record parent_class : aliased GStreamer.GST_Low_Level.gstreamer_0_10_gst_base_gstbasesink_h.GstBaseSinkClass; -- gst/audio/gstbaseaudiosink.h:153 create_ringbuffer : access function (arg1 : access GstBaseAudioSink) return access GStreamer.GST_Low_Level.gstreamer_0_10_gst_audio_gstringbuffer_h.GstRingBuffer; -- gst/audio/gstbaseaudiosink.h:156 payload : access function (arg1 : access GstBaseAudioSink; arg2 : access GStreamer.GST_Low_Level.gstreamer_0_10_gst_gstbuffer_h.GstBuffer) return access GStreamer.GST_Low_Level.gstreamer_0_10_gst_gstbuffer_h.GstBuffer; -- gst/audio/gstbaseaudiosink.h:160 u_gst_reserved : u_GstBaseAudioSinkClass_u_gst_reserved_array; -- gst/audio/gstbaseaudiosink.h:163 end record; pragma Convention (C_Pass_By_Copy, GstBaseAudioSinkClass); -- gst/audio/gstbaseaudiosink.h:152 -- subclass ringbuffer allocation -- subclass payloader --< private > function gst_base_audio_sink_get_type return GLIB.GType; -- gst/audio/gstbaseaudiosink.h:166 pragma Import (C, gst_base_audio_sink_get_type, "gst_base_audio_sink_get_type"); function gst_base_audio_sink_slave_method_get_type return GLIB.GType; -- gst/audio/gstbaseaudiosink.h:167 pragma Import (C, gst_base_audio_sink_slave_method_get_type, "gst_base_audio_sink_slave_method_get_type"); function gst_base_audio_sink_create_ringbuffer (sink : access GstBaseAudioSink) return access GStreamer.GST_Low_Level.gstreamer_0_10_gst_audio_gstringbuffer_h.GstRingBuffer; -- gst/audio/gstbaseaudiosink.h:169 pragma Import (C, gst_base_audio_sink_create_ringbuffer, "gst_base_audio_sink_create_ringbuffer"); procedure gst_base_audio_sink_set_provide_clock (sink : access GstBaseAudioSink; provide : GLIB.gboolean); -- gst/audio/gstbaseaudiosink.h:171 pragma Import (C, gst_base_audio_sink_set_provide_clock, "gst_base_audio_sink_set_provide_clock"); function gst_base_audio_sink_get_provide_clock (sink : access GstBaseAudioSink) return GLIB.gboolean; -- gst/audio/gstbaseaudiosink.h:172 pragma Import (C, gst_base_audio_sink_get_provide_clock, "gst_base_audio_sink_get_provide_clock"); procedure gst_base_audio_sink_set_slave_method (sink : access GstBaseAudioSink; method : GstBaseAudioSinkSlaveMethod); -- gst/audio/gstbaseaudiosink.h:174 pragma Import (C, gst_base_audio_sink_set_slave_method, "gst_base_audio_sink_set_slave_method"); function gst_base_audio_sink_get_slave_method (sink : access GstBaseAudioSink) return GstBaseAudioSinkSlaveMethod; -- gst/audio/gstbaseaudiosink.h:177 pragma Import (C, gst_base_audio_sink_get_slave_method, "gst_base_audio_sink_get_slave_method"); procedure gst_base_audio_sink_set_drift_tolerance (sink : access GstBaseAudioSink; drift_tolerance : GLIB.gint64); -- gst/audio/gstbaseaudiosink.h:179 pragma Import (C, gst_base_audio_sink_set_drift_tolerance, "gst_base_audio_sink_set_drift_tolerance"); function gst_base_audio_sink_get_drift_tolerance (sink : access GstBaseAudioSink) return GLIB.gint64; -- gst/audio/gstbaseaudiosink.h:181 pragma Import (C, gst_base_audio_sink_get_drift_tolerance, "gst_base_audio_sink_get_drift_tolerance"); procedure gst_base_audio_sink_set_alignment_threshold (sink : access GstBaseAudioSink; alignment_threshold : GStreamer.GST_Low_Level.gstreamer_0_10_gst_gstclock_h.GstClockTime); -- gst/audio/gstbaseaudiosink.h:183 pragma Import (C, gst_base_audio_sink_set_alignment_threshold, "gst_base_audio_sink_set_alignment_threshold"); function gst_base_audio_sink_get_alignment_threshold (sink : access GstBaseAudioSink) return GStreamer.GST_Low_Level.gstreamer_0_10_gst_gstclock_h.GstClockTime; -- gst/audio/gstbaseaudiosink.h:186 pragma Import (C, gst_base_audio_sink_get_alignment_threshold, "gst_base_audio_sink_get_alignment_threshold"); procedure gst_base_audio_sink_set_discont_wait (sink : access GstBaseAudioSink; discont_wait : GStreamer.GST_Low_Level.gstreamer_0_10_gst_gstclock_h.GstClockTime); -- gst/audio/gstbaseaudiosink.h:188 pragma Import (C, gst_base_audio_sink_set_discont_wait, "gst_base_audio_sink_set_discont_wait"); function gst_base_audio_sink_get_discont_wait (sink : access GstBaseAudioSink) return GStreamer.GST_Low_Level.gstreamer_0_10_gst_gstclock_h.GstClockTime; -- gst/audio/gstbaseaudiosink.h:191 pragma Import (C, gst_base_audio_sink_get_discont_wait, "gst_base_audio_sink_get_discont_wait"); end GStreamer.GST_Low_Level.gstreamer_0_10_gst_audio_gstbaseaudiosink_h;
reznikmm/matreshka
Ada
4,762
ads
------------------------------------------------------------------------------ -- -- -- Matreshka Project -- -- -- -- XML Processor -- -- -- -- Runtime Library Component -- -- -- ------------------------------------------------------------------------------ -- -- -- Copyright © 2014, Vadim Godunko <[email protected]> -- -- All rights reserved. -- -- -- -- Redistribution and use in source and binary forms, with or without -- -- modification, are permitted provided that the following conditions -- -- are met: -- -- -- -- * Redistributions of source code must retain the above copyright -- -- notice, this list of conditions and the following disclaimer. -- -- -- -- * Redistributions in binary form must reproduce the above copyright -- -- notice, this list of conditions and the following disclaimer in the -- -- documentation and/or other materials provided with the distribution. -- -- -- -- * Neither the name of the Vadim Godunko, IE nor the names of its -- -- contributors may be used to endorse or promote products derived from -- -- this software without specific prior written permission. -- -- -- -- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -- -- "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -- -- LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -- -- A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -- -- HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -- -- SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED -- -- TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -- -- PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -- -- LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -- -- NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -- -- SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -- -- -- ------------------------------------------------------------------------------ -- $Revision$ $Date$ ------------------------------------------------------------------------------ with League.Strings; with Matreshka.DOM_Nodes; with XML.DOM.Character_Datas; package Matreshka.DOM_Character_Datas is pragma Preelaborate; type Character_Data_Node is abstract new Matreshka.DOM_Nodes.Node and XML.DOM.Character_Datas.DOM_Character_Data with record Data : League.Strings.Universal_String; end record; overriding function Get_Data (Self : not null access constant Character_Data_Node) return League.Strings.Universal_String; overriding function Get_Node_Value (Self : not null access constant Character_Data_Node) return League.Strings.Universal_String renames Get_Data; overriding procedure Replace_Data (Self : not null access Character_Data_Node; Offset : Positive; Count : Natural; Arg : League.Strings.Universal_String); overriding procedure Set_Data (Self : not null access Character_Data_Node; New_Value : League.Strings.Universal_String); overriding procedure Set_Node_Value (Self : not null access Character_Data_Node; New_Value : League.Strings.Universal_String) renames Set_Data; package Constructors is procedure Initialize (Self : not null access Character_Data_Node'Class; Document : not null Matreshka.DOM_Nodes.Document_Access; Data : League.Strings.Universal_String); end Constructors; end Matreshka.DOM_Character_Datas;
osannolik/ada-canopen
Ada
271
ads
with AUnit; with AUnit.Simple_Test_Cases; package Generic_Table_Test is type Test is new AUnit.Simple_Test_Cases.Test_Case with null record; function Name (T : Test) return AUnit.Message_String; procedure Run_Test (T : in out Test); end Generic_Table_Test;
reznikmm/matreshka
Ada
3,633
ads
------------------------------------------------------------------------------ -- -- -- Matreshka Project -- -- -- -- Ada Modeling Framework -- -- -- -- Runtime Library Component -- -- -- ------------------------------------------------------------------------------ -- -- -- Copyright © 2011-2012, Vadim Godunko <[email protected]> -- -- All rights reserved. -- -- -- -- Redistribution and use in source and binary forms, with or without -- -- modification, are permitted provided that the following conditions -- -- are met: -- -- -- -- * Redistributions of source code must retain the above copyright -- -- notice, this list of conditions and the following disclaimer. -- -- -- -- * Redistributions in binary form must reproduce the above copyright -- -- notice, this list of conditions and the following disclaimer in the -- -- documentation and/or other materials provided with the distribution. -- -- -- -- * Neither the name of the Vadim Godunko, IE nor the names of its -- -- contributors may be used to endorse or promote products derived from -- -- this software without specific prior written permission. -- -- -- -- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -- -- "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -- -- LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -- -- A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -- -- HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -- -- SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED -- -- TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -- -- PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -- -- LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -- -- NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -- -- SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -- -- -- ------------------------------------------------------------------------------ -- $Revision$ $Date$ ------------------------------------------------------------------------------ -- This file is generated, don't edit it. ------------------------------------------------------------------------------ with AMF.Elements.Generic_Hash; function AMF.UML.Destroy_Link_Actions.Hash is new AMF.Elements.Generic_Hash (UML_Destroy_Link_Action, UML_Destroy_Link_Action_Access);
reznikmm/matreshka
Ada
5,031
ads
------------------------------------------------------------------------------ -- -- -- Matreshka Project -- -- -- -- Ada Modeling Framework -- -- -- -- Runtime Library Component -- -- -- ------------------------------------------------------------------------------ -- -- -- Copyright © 2011-2012, Vadim Godunko <[email protected]> -- -- All rights reserved. -- -- -- -- Redistribution and use in source and binary forms, with or without -- -- modification, are permitted provided that the following conditions -- -- are met: -- -- -- -- * Redistributions of source code must retain the above copyright -- -- notice, this list of conditions and the following disclaimer. -- -- -- -- * Redistributions in binary form must reproduce the above copyright -- -- notice, this list of conditions and the following disclaimer in the -- -- documentation and/or other materials provided with the distribution. -- -- -- -- * Neither the name of the Vadim Godunko, IE nor the names of its -- -- contributors may be used to endorse or promote products derived from -- -- this software without specific prior written permission. -- -- -- -- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -- -- "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -- -- LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -- -- A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -- -- HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -- -- SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED -- -- TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -- -- PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -- -- LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -- -- NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -- -- SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -- -- -- ------------------------------------------------------------------------------ -- $Revision$ $Date$ ------------------------------------------------------------------------------ -- This file is generated, don't edit it. ------------------------------------------------------------------------------ with AMF.Generic_Collections; package AMF.UML.Literal_Nulls.Collections is pragma Preelaborate; package UML_Literal_Null_Collections is new AMF.Generic_Collections (UML_Literal_Null, UML_Literal_Null_Access); type Set_Of_UML_Literal_Null is new UML_Literal_Null_Collections.Set with null record; Empty_Set_Of_UML_Literal_Null : constant Set_Of_UML_Literal_Null; type Ordered_Set_Of_UML_Literal_Null is new UML_Literal_Null_Collections.Ordered_Set with null record; Empty_Ordered_Set_Of_UML_Literal_Null : constant Ordered_Set_Of_UML_Literal_Null; type Bag_Of_UML_Literal_Null is new UML_Literal_Null_Collections.Bag with null record; Empty_Bag_Of_UML_Literal_Null : constant Bag_Of_UML_Literal_Null; type Sequence_Of_UML_Literal_Null is new UML_Literal_Null_Collections.Sequence with null record; Empty_Sequence_Of_UML_Literal_Null : constant Sequence_Of_UML_Literal_Null; private Empty_Set_Of_UML_Literal_Null : constant Set_Of_UML_Literal_Null := (UML_Literal_Null_Collections.Set with null record); Empty_Ordered_Set_Of_UML_Literal_Null : constant Ordered_Set_Of_UML_Literal_Null := (UML_Literal_Null_Collections.Ordered_Set with null record); Empty_Bag_Of_UML_Literal_Null : constant Bag_Of_UML_Literal_Null := (UML_Literal_Null_Collections.Bag with null record); Empty_Sequence_Of_UML_Literal_Null : constant Sequence_Of_UML_Literal_Null := (UML_Literal_Null_Collections.Sequence with null record); end AMF.UML.Literal_Nulls.Collections;
reznikmm/matreshka
Ada
3,679
ads
------------------------------------------------------------------------------ -- -- -- Matreshka Project -- -- -- -- Open Document Toolkit -- -- -- -- Runtime Library Component -- -- -- ------------------------------------------------------------------------------ -- -- -- Copyright © 2014, Vadim Godunko <[email protected]> -- -- 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 XML.DOM.Elements; package ODF.DOM.Text_Table_Index_Elements is pragma Preelaborate; type ODF_Text_Table_Index is limited interface and XML.DOM.Elements.DOM_Element; type ODF_Text_Table_Index_Access is access all ODF_Text_Table_Index'Class with Storage_Size => 0; end ODF.DOM.Text_Table_Index_Elements;
charlie5/cBound
Ada
1,486
ads
-- This file is generated by SWIG. Please do not modify by hand. -- with Interfaces; with Interfaces.C; with Interfaces.C.Pointers; package xcb.xcb_query_tree_request_t is -- Item -- type Item is record major_opcode : aliased Interfaces.Unsigned_8; pad0 : aliased Interfaces.Unsigned_8; length : aliased Interfaces.Unsigned_16; window : aliased xcb.xcb_window_t; end record; -- Item_Array -- type Item_Array is array (Interfaces.C.size_t range <>) of aliased xcb.xcb_query_tree_request_t .Item; -- Pointer -- package C_Pointers is new Interfaces.C.Pointers (Index => Interfaces.C.size_t, Element => xcb.xcb_query_tree_request_t.Item, Element_Array => xcb.xcb_query_tree_request_t.Item_Array, Default_Terminator => (others => <>)); subtype Pointer is C_Pointers.Pointer; -- Pointer_Array -- type Pointer_Array is array (Interfaces.C.size_t range <>) of aliased xcb.xcb_query_tree_request_t .Pointer; -- Pointer_Pointer -- package C_Pointer_Pointers is new Interfaces.C.Pointers (Index => Interfaces.C.size_t, Element => xcb.xcb_query_tree_request_t.Pointer, Element_Array => xcb.xcb_query_tree_request_t.Pointer_Array, Default_Terminator => null); subtype Pointer_Pointer is C_Pointer_Pointers.Pointer; end xcb.xcb_query_tree_request_t;
reznikmm/matreshka
Ada
3,663
ads
------------------------------------------------------------------------------ -- -- -- Matreshka Project -- -- -- -- Web Framework -- -- -- -- Tools Component -- -- -- ------------------------------------------------------------------------------ -- -- -- Copyright © 2015, Vadim Godunko <[email protected]> -- -- 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 Asis; with Engines.Contexts; with League.Strings; package Properties.Expressions.Allocation is function Code (Engine : access Engines.Contexts.Context; Element : Asis.Expression; Name : Engines.Text_Property) return League.Strings.Universal_String; end Properties.Expressions.Allocation;
zhmu/ananas
Ada
5,862
adb
------------------------------------------------------------------------------ -- -- -- GNAT LIBRARY COMPONENTS -- -- -- -- ADA.CONTAINERS.FUNCTIONAL_SETS -- -- -- -- B o d y -- -- -- -- Copyright (C) 2016-2022, Free Software Foundation, Inc. -- -- -- -- This specification is derived from the Ada Reference Manual for use with -- -- GNAT. The copyright notice above, and the license provisions that follow -- -- apply solely to the contents of the part following the private keyword. -- -- -- -- GNAT is free software; you can redistribute it and/or modify it under -- -- terms of the GNU General Public License as published by the Free Soft- -- -- ware Foundation; either version 3, or (at your option) any later ver- -- -- sion. GNAT is distributed in the hope that it will be useful, but WITH- -- -- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY -- -- or FITNESS FOR A PARTICULAR PURPOSE. -- -- -- -- As a special exception under Section 7 of GPL version 3, you are granted -- -- additional permissions described in the GCC Runtime Library Exception, -- -- version 3.1, as published by the Free Software Foundation. -- -- -- -- You should have received a copy of the GNU General Public License and -- -- a copy of the GCC Runtime Library Exception along with this program; -- -- see the files COPYING3 and COPYING.RUNTIME respectively. If not, see -- -- <http://www.gnu.org/licenses/>. -- ------------------------------------------------------------------------------ pragma Ada_2012; package body Ada.Containers.Functional_Sets with SPARK_Mode => Off is use Containers; --------- -- "=" -- --------- function "=" (Left : Set; Right : Set) return Boolean is (Left.Content <= Right.Content and Right.Content <= Left.Content); ---------- -- "<=" -- ---------- function "<=" (Left : Set; Right : Set) return Boolean is (Left.Content <= Right.Content); --------- -- Add -- --------- function Add (Container : Set; Item : Element_Type) return Set is (Content => Add (Container.Content, Length (Container.Content) + 1, Item)); -------------- -- Contains -- -------------- function Contains (Container : Set; Item : Element_Type) return Boolean is (Find (Container.Content, Item) > 0); --------------------- -- Included_Except -- --------------------- function Included_Except (Left : Set; Right : Set; Item : Element_Type) return Boolean is (for all E of Left => Equivalent_Elements (E, Item) or Contains (Right, E)); ----------------------- -- Included_In_Union -- ----------------------- function Included_In_Union (Container : Set; Left : Set; Right : Set) return Boolean is (for all Item of Container => Contains (Left, Item) or Contains (Right, Item)); --------------------------- -- Includes_Intersection -- --------------------------- function Includes_Intersection (Container : Set; Left : Set; Right : Set) return Boolean is (for all Item of Left => (if Contains (Right, Item) then Contains (Container, Item))); ------------------ -- Intersection -- ------------------ function Intersection (Left : Set; Right : Set) return Set is (Content => Intersection (Left.Content, Right.Content)); -------------- -- Is_Empty -- -------------- function Is_Empty (Container : Set) return Boolean is (Length (Container.Content) = 0); ------------------ -- Is_Singleton -- ------------------ function Is_Singleton (Container : Set; New_Item : Element_Type) return Boolean is (Length (Container.Content) = 1 and New_Item = Get (Container.Content, 1)); ------------ -- Length -- ------------ function Length (Container : Set) return Count_Type is (Length (Container.Content)); ----------------- -- Not_In_Both -- ----------------- function Not_In_Both (Container : Set; Left : Set; Right : Set) return Boolean is (for all Item of Container => not Contains (Right, Item) or not Contains (Left, Item)); ---------------- -- No_Overlap -- ---------------- function No_Overlap (Left : Set; Right : Set) return Boolean is (Num_Overlaps (Left.Content, Right.Content) = 0); ------------------ -- Num_Overlaps -- ------------------ function Num_Overlaps (Left : Set; Right : Set) return Count_Type is (Num_Overlaps (Left.Content, Right.Content)); ------------ -- Remove -- ------------ function Remove (Container : Set; Item : Element_Type) return Set is (Content => Remove (Container.Content, Find (Container.Content, Item))); ----------- -- Union -- ----------- function Union (Left : Set; Right : Set) return Set is (Content => Union (Left.Content, Right.Content)); end Ada.Containers.Functional_Sets;
leonhxx/pok
Ada
771
adb
-- POK header -- -- The following file is a part of the POK project. Any modification should -- be made according to the POK licence. You CANNOT use this file or a part -- of a file for your own project. -- -- For more information on the POK licence, please see our LICENCE FILE -- -- Please follow the coding guidelines described in doc/CODING_GUIDELINES -- -- Copyright (c) 2007-2021 POK team package body Activity is procedure Printf (String : in Interfaces.C.char_array); pragma Import (C, Printf, "printf"); procedure Thr1_Job is Ret : Return_Code_Type; begin loop Printf ("beep "); Timed_Wait (1000, Ret); end loop; end Thr1_Job; end Activity;
AdaCore/libadalang
Ada
83
adb
separate (Pkg4) package body Nested1 is procedure Foo is separate; end Nested1;
damaki/Verhoeff
Ada
4,225
adb
------------------------------------------------------------------------------- -- Copyright (c) 2016 Daniel King -- -- Permission is hereby granted, free of charge, to any person obtaining a copy -- of this software and associated documentation files (the "Software"), to -- deal in the Software without restriction, including without limitation the -- rights to use, copy, modify, merge, publish, distribute, sublicense, and/or -- sell copies of the Software, and to permit persons to whom the Software is -- furnished to do so, subject to the following conditions: -- -- The above copyright notice and this permission notice shall be included in -- all copies or substantial portions of the Software. -- -- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING -- FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS -- IN THE SOFTWARE. ------------------------------------------------------------------------------- package body Verhoeff with SPARK_Mode => On is type Digit_Number is new Natural range 0 .. 9; D : constant array(Digit_Number, Digit_Number) of Digit_Number := ((0, 1, 2, 3, 4, 5, 6, 7, 8, 9), (1, 2, 3, 4, 0, 6, 7, 8, 9, 5), (2, 3, 4, 0, 1, 7, 8, 9, 5, 6), (3, 4, 0, 1, 2, 8, 9, 5, 6, 7), (4, 0, 1, 2, 3, 9, 5, 6, 7, 8), (5, 9, 8, 7, 6, 0, 4, 3, 2, 1), (6, 5, 9, 8, 7, 1, 0, 4, 3, 2), (7, 6, 5, 9, 8, 2, 1, 0, 4, 3), (8, 7, 6, 5, 9, 3, 2, 1, 0, 4), (9, 8, 7, 6, 5, 4, 3, 2, 1, 0)); Inv : constant array(Digit_Number) of Digit_Number := (0, 4, 3, 2, 1, 5, 6, 7, 8, 9); P : constant array(Digit_Number range 0 .. 7, Digit_Number) of Digit_Number := ((0, 1, 2, 3, 4, 5, 6, 7, 8, 9), (1, 5, 7, 6, 2, 8, 3, 0, 9, 4), (5, 8, 0, 3, 7, 9, 6, 1, 4, 2), (8, 9, 1, 6, 0, 4, 3, 5, 2, 7), (9, 4, 5, 3, 1, 2, 6, 8, 7, 0), (4, 2, 8, 6, 5, 7, 3, 9, 0, 1), (2, 7, 9, 3, 8, 0, 6, 4, 1, 5), (7, 0, 4, 6, 9, 1, 3, 2, 5, 8)); -- Check that Inv(Inv(j)) == j pragma Assert(for all J in Digit_Number => Inv(Inv(J)) = J); -- Check that D(j, Inv(j)) = 0 pragma Assert(for all J in Digit_Number => D(J, Inv(J)) = 0); -- Check that P(i+j, n) = P(i, P(j, n)) pragma Assert(for all I in Digit_Number => (for all J in Digit_Number => (for all N in Digit_Number => P((I+J) mod 8, N) = P(I mod 8, P(J mod 8, N)) ) ) ); function To_Digit_Number(Value : in Digit_Character) return Digit_Number is (Digit_Number(Digit_Character'Pos(Value) - Digit_Character'Pos('0'))) with Inline; function To_Digit_Character(Value : in Digit_Number) return Digit_Character is (Digit_Character'Val(Digit_Character'Pos('0') + Integer(Value))) with Inline; function Compute_Verhoeff(Seq : in String; Initial : in Digit_Character) return Digit_Number with Pre => (for all I in Seq'Range => (Seq(I) in Digit_Character)) is C : Digit_Number := To_Digit_Number(Initial); I : Natural := 0; X : Natural := Seq'Length; begin while X > 0 loop pragma Loop_Variant(Decreases => X); pragma Loop_Invariant((I+X) = Seq'Length); I := I + 1; X := X - 1; C := D(C, P(Digit_Number(I mod 8), To_Digit_Number(Seq(Seq'First + X)))); end loop; return C; end Compute_Verhoeff; function Check_Digit(Seq : in String) return Digit_Character is begin return To_Digit_Character(Inv(Compute_Verhoeff(Seq, '0'))); end Check_Digit; function Is_Valid(Seq : in String) return Boolean is begin return 0 = Compute_Verhoeff(Seq(Seq'First .. Seq'Last - 1), Seq(Seq'Last)); end Is_Valid; end Verhoeff;
charlesdaniels/libagar
Ada
2,523
adb
------------------------------------------------------------------------------ -- AGAR CORE LIBRARY -- -- A G A R . T I M E R -- -- B o d y -- -- -- -- Copyright (c) 2018-2019, Julien Nadeau Carriere ([email protected]) -- -- -- -- Permission to use, copy, modify, and/or distribute this software for any -- -- purpose with or without fee is hereby granted, provided that the above -- -- copyright notice and this permission notice appear in all copies. -- -- -- -- THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES -- -- WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF -- -- MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR -- -- ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES -- -- WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN -- -- ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF -- -- OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. -- ------------------------------------------------------------------------------ package body Agar.Timer is use type C.int; procedure Init_Timer (Timer : in Timer_not_null_Access; Name : in String) is Ch_Name : aliased C.char_array := C.To_C(Name); begin AG_InitTimer (Timer => Timer, Name => CS.To_Chars_Ptr(Ch_Name'Unchecked_Access), Flags => 0); end; function Add_Timer (Timer : in Timer_not_null_Access; Interval : in Interfaces.Unsigned_32; Func : in Timer_Callback) return Boolean is begin return 0 = AG_AddTimer (Object => System.Null_Address, Timer => Timer, Interval => Interval, Func => Func, Flags => 0, Format => CS.Null_Ptr); end; function Add_Timer (Interval : in Interfaces.Unsigned_32; Func : in Timer_Callback) return Boolean is begin return null /= AG_AddTimerAuto (Object => System.Null_Address, Interval => Interval, Func => Func, Format => CS.Null_Ptr); end; end Agar.Timer;
osannolik/ada-canopen
Ada
739
ads
with ACO.Messages; with Ada.Real_Time; package ACO.Drivers is type Driver is abstract tagged limited null record; type Driver_Access is access all Driver'Class; procedure Receive_Message_Blocking (This : in out Driver; Msg : out ACO.Messages.Message) is abstract; procedure Send_Message (This : in out Driver; Msg : in ACO.Messages.Message) is abstract; procedure Initialize (This : in out Driver) is abstract; procedure Finalize (This : in out Driver) is abstract; function Is_Message_Pending (This : Driver) return Boolean is abstract; function Current_Time (This : Driver) return Ada.Real_Time.Time is abstract; end ACO.Drivers;
reznikmm/matreshka
Ada
6,758
adb
------------------------------------------------------------------------------ -- -- -- Matreshka Project -- -- -- -- Open Document Toolkit -- -- -- -- Runtime Library Component -- -- -- ------------------------------------------------------------------------------ -- -- -- Copyright © 2014, Vadim Godunko <[email protected]> -- -- All rights reserved. -- -- -- -- Redistribution and use in source and binary forms, with or without -- -- modification, are permitted provided that the following conditions -- -- are met: -- -- -- -- * Redistributions of source code must retain the above copyright -- -- notice, this list of conditions and the following disclaimer. -- -- -- -- * Redistributions in binary form must reproduce the above copyright -- -- notice, this list of conditions and the following disclaimer in the -- -- documentation and/or other materials provided with the distribution. -- -- -- -- * Neither the name of the Vadim Godunko, IE nor the names of its -- -- contributors may be used to endorse or promote products derived from -- -- this software without specific prior written permission. -- -- -- -- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -- -- "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -- -- LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -- -- A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -- -- HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -- -- SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED -- -- TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -- -- PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -- -- LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -- -- NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -- -- SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -- -- -- ------------------------------------------------------------------------------ -- $Revision$ $Date$ ------------------------------------------------------------------------------ with Matreshka.DOM_Documents; with Matreshka.ODF_String_Constants; with ODF.DOM.Iterators; with ODF.DOM.Visitors; package body Matreshka.ODF_Db.Indices_Elements is ------------ -- Create -- ------------ overriding function Create (Parameters : not null access Matreshka.DOM_Elements.Element_L2_Parameters) return Db_Indices_Element_Node is begin return Self : Db_Indices_Element_Node do Matreshka.ODF_Db.Constructors.Initialize (Self'Unchecked_Access, Parameters.Document, Matreshka.ODF_String_Constants.Db_Prefix); end return; end Create; ---------------- -- Enter_Node -- ---------------- overriding procedure Enter_Node (Self : not null access Db_Indices_Element_Node; Visitor : in out XML.DOM.Visitors.Abstract_Visitor'Class; Control : in out XML.DOM.Visitors.Traverse_Control) is begin if Visitor in ODF.DOM.Visitors.Abstract_ODF_Visitor'Class then ODF.DOM.Visitors.Abstract_ODF_Visitor'Class (Visitor).Enter_Db_Indices (ODF.DOM.Db_Indices_Elements.ODF_Db_Indices_Access (Self), Control); else Matreshka.DOM_Elements.Abstract_Element_Node (Self.all).Enter_Node (Visitor, Control); end if; end Enter_Node; -------------------- -- Get_Local_Name -- -------------------- overriding function Get_Local_Name (Self : not null access constant Db_Indices_Element_Node) return League.Strings.Universal_String is pragma Unreferenced (Self); begin return Matreshka.ODF_String_Constants.Indices_Element; end Get_Local_Name; ---------------- -- Leave_Node -- ---------------- overriding procedure Leave_Node (Self : not null access Db_Indices_Element_Node; Visitor : in out XML.DOM.Visitors.Abstract_Visitor'Class; Control : in out XML.DOM.Visitors.Traverse_Control) is begin if Visitor in ODF.DOM.Visitors.Abstract_ODF_Visitor'Class then ODF.DOM.Visitors.Abstract_ODF_Visitor'Class (Visitor).Leave_Db_Indices (ODF.DOM.Db_Indices_Elements.ODF_Db_Indices_Access (Self), Control); else Matreshka.DOM_Elements.Abstract_Element_Node (Self.all).Leave_Node (Visitor, Control); end if; end Leave_Node; ---------------- -- Visit_Node -- ---------------- overriding procedure Visit_Node (Self : not null access Db_Indices_Element_Node; Iterator : in out XML.DOM.Visitors.Abstract_Iterator'Class; Visitor : in out XML.DOM.Visitors.Abstract_Visitor'Class; Control : in out XML.DOM.Visitors.Traverse_Control) is begin if Iterator in ODF.DOM.Iterators.Abstract_ODF_Iterator'Class then ODF.DOM.Iterators.Abstract_ODF_Iterator'Class (Iterator).Visit_Db_Indices (Visitor, ODF.DOM.Db_Indices_Elements.ODF_Db_Indices_Access (Self), Control); else Matreshka.DOM_Elements.Abstract_Element_Node (Self.all).Visit_Node (Iterator, Visitor, Control); end if; end Visit_Node; begin Matreshka.DOM_Documents.Register_Element (Matreshka.ODF_String_Constants.Db_URI, Matreshka.ODF_String_Constants.Indices_Element, Db_Indices_Element_Node'Tag); end Matreshka.ODF_Db.Indices_Elements;
reznikmm/matreshka
Ada
9,505
ads
------------------------------------------------------------------------------ -- -- -- Matreshka Project -- -- -- -- XML Processor -- -- -- -- Runtime Library Component -- -- -- ------------------------------------------------------------------------------ -- -- -- Copyright © 2010, Vadim Godunko <[email protected]> -- -- All rights reserved. -- -- -- -- Redistribution and use in source and binary forms, with or without -- -- modification, are permitted provided that the following conditions -- -- are met: -- -- -- -- * Redistributions of source code must retain the above copyright -- -- notice, this list of conditions and the following disclaimer. -- -- -- -- * Redistributions in binary form must reproduce the above copyright -- -- notice, this list of conditions and the following disclaimer in the -- -- documentation and/or other materials provided with the distribution. -- -- -- -- * Neither the name of the Vadim Godunko, IE nor the names of its -- -- contributors may be used to endorse or promote products derived from -- -- this software without specific prior written permission. -- -- -- -- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -- -- "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -- -- LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -- -- A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -- -- HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -- -- SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED -- -- TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -- -- PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -- -- LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -- -- NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -- -- SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -- -- -- ------------------------------------------------------------------------------ -- $Revision$ $Date$ ------------------------------------------------------------------------------ with Matreshka.Internals.Strings; package Matreshka.Internals.XML.Attribute_Tables is pragma Preelaborate; type Attribute_Table is limited private; procedure New_CDATA_Attribute (Self : in out Attribute_Table; Name : Symbol_Identifier; Attribute : out Attribute_Identifier); -- Allocates new attribute of CDATA type. procedure New_Entity_Attribute (Self : in out Attribute_Table; Name : Symbol_Identifier; Attribute : out Attribute_Identifier); -- Allocates new attribute of ENTITY type. procedure New_Entities_Attribute (Self : in out Attribute_Table; Name : Symbol_Identifier; Attribute : out Attribute_Identifier); -- Allocates new attribute of ENTITIES type. procedure New_Id_Attribute (Self : in out Attribute_Table; Name : Symbol_Identifier; Attribute : out Attribute_Identifier); -- Allocates new attribute of ID type. procedure New_IdRef_Attribute (Self : in out Attribute_Table; Name : Symbol_Identifier; Attribute : out Attribute_Identifier); -- Allocates new attribute of IDREF type. procedure New_IdRefs_Attribute (Self : in out Attribute_Table; Name : Symbol_Identifier; Attribute : out Attribute_Identifier); -- Allocates new attribute of IDREFS type. procedure New_NmToken_Attribute (Self : in out Attribute_Table; Name : Symbol_Identifier; Attribute : out Attribute_Identifier); -- Allocates new attribute of NMTOKEN type. procedure New_NmTokens_Attribute (Self : in out Attribute_Table; Name : Symbol_Identifier; Attribute : out Attribute_Identifier); -- Allocates new attribute of NMTOKENS type. procedure New_Notation_Attribute (Self : in out Attribute_Table; Name : Symbol_Identifier; Attribute : out Attribute_Identifier); -- Allocates new attribute of NOTATION type. procedure New_Enumeration_Attribute (Self : in out Attribute_Table; Name : Symbol_Identifier; Attribute : out Attribute_Identifier); -- Allocates new attribute of enumeration type. function Is_ID (Self : Attribute_Table; Attribute : Attribute_Identifier) return Boolean; -- Returns True when attribute has ID type. function Is_CDATA (Self : Attribute_Table; Attribute : Attribute_Identifier) return Boolean; -- Returns True when attribute has CDATA type. procedure Append (Self : in out Attribute_Table; Attribute : Attribute_Identifier; Next : Attribute_Identifier); -- Append attribute specified by Next to the list of attributes started -- by Attribute. function Name (Self : Attribute_Table; Attribute : Attribute_Identifier) return Symbol_Identifier; -- Returns name of the attribute. function Next (Self : Attribute_Table; Attribute : Attribute_Identifier) return Attribute_Identifier; -- Returns next attribute in the list of attributes of the element. function Is_Required (Self : Attribute_Table; Attribute : Attribute_Identifier) return Boolean; procedure Set_Is_Required (Self : in out Attribute_Table; Attribute : Attribute_Identifier; Value : Boolean); function Is_Implied (Self : Attribute_Table; Attribute : Attribute_Identifier) return Boolean; procedure Set_Is_Implied (Self : in out Attribute_Table; Attribute : Attribute_Identifier; Value : Boolean); function Is_Fixed (Self : Attribute_Table; Attribute : Attribute_Identifier) return Boolean; procedure Set_Is_Fixed (Self : in out Attribute_Table; Attribute : Attribute_Identifier; Value : Boolean); function Default (Self : Attribute_Table; Attribute : Attribute_Identifier) return not null Matreshka.Internals.Strings.Shared_String_Access; procedure Set_Default (Self : in out Attribute_Table; Attribute : Attribute_Identifier; Value : not null Matreshka.Internals.Strings.Shared_String_Access); function Has_Default (Self : Attribute_Table; Attribute : Attribute_Identifier) return Boolean; -- Returns True when attribute has default value. This is synthetic value, -- attribute has default value when it is not declared as REQUIRED or -- IMPLIED. function Symbol_Of_Type_Name (Self : Attribute_Table; Attribute : Attribute_Identifier) return Symbol_Identifier; -- Returns symbol of type name of the attribute. procedure Reset (Self : in out Attribute_Table); -- Resets internal structures to initial state. procedure Finalize (Self : in out Attribute_Table); -- Releases all ocupied resources. private type Attribute_Types is (CDATA, ENTITY, ENTITIES, ID, IDREF, IDREFS, NMTOKEN, NMTOKENS, NOTATION, ENUMERATION); type Attribute_Record is record Name : Symbol_Identifier; The_Type : Attribute_Types; Is_Required : Boolean; Is_Implied : Boolean; Is_Fixed : Boolean; Default : Matreshka.Internals.Strings.Shared_String_Access; Next : Attribute_Identifier; -- Next attribute for the same element type. end record; type Attribute_Array is array (Attribute_Identifier range <>) of Attribute_Record; type Attribute_Array_Access is access all Attribute_Array; type Attribute_Table is limited record Table : Attribute_Array_Access := new Attribute_Array (1 .. 16); Last : Attribute_Identifier := No_Attribute; end record; pragma Inline (Name); pragma Inline (Next); pragma Inline (Default); pragma Inline (Is_CDATA); pragma Inline (Is_Fixed); pragma Inline (Is_ID); pragma Inline (Is_Implied); pragma Inline (Is_Required); pragma Inline (Set_Default); pragma Inline (Set_Is_Fixed); pragma Inline (Set_Is_Implied); pragma Inline (Set_Is_Required); end Matreshka.Internals.XML.Attribute_Tables;
reznikmm/matreshka
Ada
4,624
adb
------------------------------------------------------------------------------ -- -- -- Matreshka Project -- -- -- -- Open Document Toolkit -- -- -- -- Runtime Library Component -- -- -- ------------------------------------------------------------------------------ -- -- -- Copyright © 2014, Vadim Godunko <[email protected]> -- -- All rights reserved. -- -- -- -- Redistribution and use in source and binary forms, with or without -- -- modification, are permitted provided that the following conditions -- -- are met: -- -- -- -- * Redistributions of source code must retain the above copyright -- -- notice, this list of conditions and the following disclaimer. -- -- -- -- * Redistributions in binary form must reproduce the above copyright -- -- notice, this list of conditions and the following disclaimer in the -- -- documentation and/or other materials provided with the distribution. -- -- -- -- * Neither the name of the Vadim Godunko, IE nor the names of its -- -- contributors may be used to endorse or promote products derived from -- -- this software without specific prior written permission. -- -- -- -- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -- -- "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -- -- LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -- -- A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -- -- HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -- -- SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED -- -- TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -- -- PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -- -- LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -- -- NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -- -- SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -- -- -- ------------------------------------------------------------------------------ -- $Revision$ $Date$ ------------------------------------------------------------------------------ with Matreshka.DOM_Documents; with Matreshka.ODF_String_Constants; with ODF.DOM.Iterators; with ODF.DOM.Visitors; package body Matreshka.ODF_Style.Script_Type_Attributes is ------------ -- Create -- ------------ overriding function Create (Parameters : not null access Matreshka.DOM_Attributes.Attribute_L2_Parameters) return Style_Script_Type_Attribute_Node is begin return Self : Style_Script_Type_Attribute_Node do Matreshka.ODF_Style.Constructors.Initialize (Self'Unchecked_Access, Parameters.Document, Matreshka.ODF_String_Constants.Style_Prefix); end return; end Create; -------------------- -- Get_Local_Name -- -------------------- overriding function Get_Local_Name (Self : not null access constant Style_Script_Type_Attribute_Node) return League.Strings.Universal_String is pragma Unreferenced (Self); begin return Matreshka.ODF_String_Constants.Script_Type_Attribute; end Get_Local_Name; begin Matreshka.DOM_Documents.Register_Attribute (Matreshka.ODF_String_Constants.Style_URI, Matreshka.ODF_String_Constants.Script_Type_Attribute, Style_Script_Type_Attribute_Node'Tag); end Matreshka.ODF_Style.Script_Type_Attributes;
charlie5/lace
Ada
482
adb
package body lace.Observer.instant is package body Forge is function new_Observer (Name : in Event.observer_Name) return View is Self : constant View := new Item; begin Self.Name := to_unbounded_String (Name); return Self; end new_Observer; end Forge; overriding function Name (Self : in Item) return Event.observer_Name is begin return to_String (Self.Name); end Name; end lace.Observer.instant;
optikos/oasis
Ada
9,215
adb
-- Copyright (c) 2019 Maxim Reznik <[email protected]> -- -- SPDX-License-Identifier: MIT -- License-Filename: LICENSE ------------------------------------------------------------- package body Program.Nodes.Anonymous_Access_To_Functions is function Create (Not_Token : Program.Lexical_Elements.Lexical_Element_Access; Null_Token : Program.Lexical_Elements.Lexical_Element_Access; Access_Token : not null Program.Lexical_Elements .Lexical_Element_Access; Protected_Token : Program.Lexical_Elements.Lexical_Element_Access; Function_Token : not null Program.Lexical_Elements .Lexical_Element_Access; Left_Bracket_Token : Program.Lexical_Elements.Lexical_Element_Access; Parameters : Program.Elements.Parameter_Specifications .Parameter_Specification_Vector_Access; Right_Bracket_Token : Program.Lexical_Elements.Lexical_Element_Access; Return_Token : not null Program.Lexical_Elements .Lexical_Element_Access; Not_Token_2 : Program.Lexical_Elements.Lexical_Element_Access; Null_Token_2 : Program.Lexical_Elements.Lexical_Element_Access; Result_Subtype : not null Program.Elements.Element_Access) return Anonymous_Access_To_Function is begin return Result : Anonymous_Access_To_Function := (Not_Token => Not_Token, Null_Token => Null_Token, Access_Token => Access_Token, Protected_Token => Protected_Token, Function_Token => Function_Token, Left_Bracket_Token => Left_Bracket_Token, Parameters => Parameters, Right_Bracket_Token => Right_Bracket_Token, Return_Token => Return_Token, Not_Token_2 => Not_Token_2, Null_Token_2 => Null_Token_2, Result_Subtype => Result_Subtype, Enclosing_Element => null) do Initialize (Result); end return; end Create; function Create (Parameters : Program.Elements.Parameter_Specifications .Parameter_Specification_Vector_Access; Result_Subtype : not null Program.Elements.Element_Access; Is_Part_Of_Implicit : Boolean := False; Is_Part_Of_Inherited : Boolean := False; Is_Part_Of_Instance : Boolean := False; Has_Not_Null : Boolean := False; Has_Protected : Boolean := False; Has_Not_Null_2 : Boolean := False) return Implicit_Anonymous_Access_To_Function is begin return Result : Implicit_Anonymous_Access_To_Function := (Parameters => Parameters, Result_Subtype => Result_Subtype, Is_Part_Of_Implicit => Is_Part_Of_Implicit, Is_Part_Of_Inherited => Is_Part_Of_Inherited, Is_Part_Of_Instance => Is_Part_Of_Instance, Has_Not_Null => Has_Not_Null, Has_Protected => Has_Protected, Has_Not_Null_2 => Has_Not_Null_2, Enclosing_Element => null) do Initialize (Result); end return; end Create; overriding function Parameters (Self : Base_Anonymous_Access_To_Function) return Program.Elements.Parameter_Specifications .Parameter_Specification_Vector_Access is begin return Self.Parameters; end Parameters; overriding function Result_Subtype (Self : Base_Anonymous_Access_To_Function) return not null Program.Elements.Element_Access is begin return Self.Result_Subtype; end Result_Subtype; overriding function Not_Token (Self : Anonymous_Access_To_Function) return Program.Lexical_Elements.Lexical_Element_Access is begin return Self.Not_Token; end Not_Token; overriding function Null_Token (Self : Anonymous_Access_To_Function) return Program.Lexical_Elements.Lexical_Element_Access is begin return Self.Null_Token; end Null_Token; overriding function Access_Token (Self : Anonymous_Access_To_Function) return not null Program.Lexical_Elements.Lexical_Element_Access is begin return Self.Access_Token; end Access_Token; overriding function Protected_Token (Self : Anonymous_Access_To_Function) return Program.Lexical_Elements.Lexical_Element_Access is begin return Self.Protected_Token; end Protected_Token; overriding function Function_Token (Self : Anonymous_Access_To_Function) return not null Program.Lexical_Elements.Lexical_Element_Access is begin return Self.Function_Token; end Function_Token; overriding function Left_Bracket_Token (Self : Anonymous_Access_To_Function) return Program.Lexical_Elements.Lexical_Element_Access is begin return Self.Left_Bracket_Token; end Left_Bracket_Token; overriding function Right_Bracket_Token (Self : Anonymous_Access_To_Function) return Program.Lexical_Elements.Lexical_Element_Access is begin return Self.Right_Bracket_Token; end Right_Bracket_Token; overriding function Return_Token (Self : Anonymous_Access_To_Function) return not null Program.Lexical_Elements.Lexical_Element_Access is begin return Self.Return_Token; end Return_Token; overriding function Not_Token_2 (Self : Anonymous_Access_To_Function) return Program.Lexical_Elements.Lexical_Element_Access is begin return Self.Not_Token_2; end Not_Token_2; overriding function Null_Token_2 (Self : Anonymous_Access_To_Function) return Program.Lexical_Elements.Lexical_Element_Access is begin return Self.Null_Token_2; end Null_Token_2; overriding function Has_Not_Null (Self : Anonymous_Access_To_Function) return Boolean is begin return Self.Null_Token.Assigned; end Has_Not_Null; overriding function Has_Protected (Self : Anonymous_Access_To_Function) return Boolean is begin return Self.Protected_Token.Assigned; end Has_Protected; overriding function Has_Not_Null_2 (Self : Anonymous_Access_To_Function) return Boolean is begin return Self.Null_Token_2.Assigned; end Has_Not_Null_2; overriding function Is_Part_Of_Implicit (Self : Implicit_Anonymous_Access_To_Function) return Boolean is begin return Self.Is_Part_Of_Implicit; end Is_Part_Of_Implicit; overriding function Is_Part_Of_Inherited (Self : Implicit_Anonymous_Access_To_Function) return Boolean is begin return Self.Is_Part_Of_Inherited; end Is_Part_Of_Inherited; overriding function Is_Part_Of_Instance (Self : Implicit_Anonymous_Access_To_Function) return Boolean is begin return Self.Is_Part_Of_Instance; end Is_Part_Of_Instance; overriding function Has_Not_Null (Self : Implicit_Anonymous_Access_To_Function) return Boolean is begin return Self.Has_Not_Null; end Has_Not_Null; overriding function Has_Protected (Self : Implicit_Anonymous_Access_To_Function) return Boolean is begin return Self.Has_Protected; end Has_Protected; overriding function Has_Not_Null_2 (Self : Implicit_Anonymous_Access_To_Function) return Boolean is begin return Self.Has_Not_Null_2; end Has_Not_Null_2; procedure Initialize (Self : aliased in out Base_Anonymous_Access_To_Function'Class) is begin for Item in Self.Parameters.Each_Element loop Set_Enclosing_Element (Item.Element, Self'Unchecked_Access); end loop; Set_Enclosing_Element (Self.Result_Subtype, Self'Unchecked_Access); null; end Initialize; overriding function Is_Anonymous_Access_To_Function_Element (Self : Base_Anonymous_Access_To_Function) return Boolean is pragma Unreferenced (Self); begin return True; end Is_Anonymous_Access_To_Function_Element; overriding function Is_Anonymous_Access_Definition_Element (Self : Base_Anonymous_Access_To_Function) return Boolean is pragma Unreferenced (Self); begin return True; end Is_Anonymous_Access_Definition_Element; overriding function Is_Definition_Element (Self : Base_Anonymous_Access_To_Function) return Boolean is pragma Unreferenced (Self); begin return True; end Is_Definition_Element; overriding procedure Visit (Self : not null access Base_Anonymous_Access_To_Function; Visitor : in out Program.Element_Visitors.Element_Visitor'Class) is begin Visitor.Anonymous_Access_To_Function (Self); end Visit; overriding function To_Anonymous_Access_To_Function_Text (Self : aliased in out Anonymous_Access_To_Function) return Program.Elements.Anonymous_Access_To_Functions .Anonymous_Access_To_Function_Text_Access is begin return Self'Unchecked_Access; end To_Anonymous_Access_To_Function_Text; overriding function To_Anonymous_Access_To_Function_Text (Self : aliased in out Implicit_Anonymous_Access_To_Function) return Program.Elements.Anonymous_Access_To_Functions .Anonymous_Access_To_Function_Text_Access is pragma Unreferenced (Self); begin return null; end To_Anonymous_Access_To_Function_Text; end Program.Nodes.Anonymous_Access_To_Functions;
zhmu/ananas
Ada
8,828
ads
------------------------------------------------------------------------------ -- -- -- GNAT RUN-TIME COMPONENTS -- -- -- -- S Y S T E M -- -- -- -- S p e c -- -- (Compiler Version) -- -- -- -- Copyright (C) 1992-2021, Free Software Foundation, Inc. -- -- -- -- This specification is derived from the Ada Reference Manual for use with -- -- GNAT. The copyright notice above, and the license provisions that follow -- -- apply solely to the contents of the part following the private keyword. -- -- -- -- GNAT is free software; you can redistribute it and/or modify it under -- -- terms of the GNU General Public License as published by the Free Soft- -- -- ware Foundation; either version 3, or (at your option) any later ver- -- -- sion. GNAT is distributed in the hope that it will be useful, but WITH- -- -- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY -- -- or FITNESS FOR A PARTICULAR PURPOSE. -- -- -- -- As a special exception under Section 7 of GPL version 3, you are granted -- -- additional permissions described in the GCC Runtime Library Exception, -- -- version 3.1, as published by the Free Software Foundation. -- -- -- -- You should have received a copy of the GNU General Public License and -- -- a copy of the GCC Runtime Library Exception along with this program; -- -- see the files COPYING3 and COPYING.RUNTIME respectively. If not, see -- -- <http://www.gnu.org/licenses/>. -- -- -- -- GNAT was originally developed by the GNAT team at New York University. -- -- Extensive contributions were provided by Ada Core Technologies Inc. -- -- -- ------------------------------------------------------------------------------ -- This version of System is a generic version that is used in building the -- compiler. Right now, we have a host/target problem if we try to use the -- "proper" System, and since the compiler itself does not care about most -- System parameters, this generic version works fine. pragma Restrictions (No_Implicit_Dynamic_Code); -- We want to avoid trampolines in the compiler, so it can be used in systems -- which prevent execution of code on the stack, e.g. in windows environments -- with DEP (Data Execution Protection) enabled. pragma Restrictions (No_Finalization); -- Use restriction No_Finalization to avoid pulling finalization (not allowed -- in GNAT) inside sem_spark.adb, when defining type Perm_Tree_Access as an -- access type on incomplete type Perm_Tree_Wrapper (which is required for -- defining a recursive type). pragma Restrictions (No_Tasking); -- Make it explicit that tasking is not used in the compiler, which also -- allows generating simpler and more efficient code. package System is pragma Pure; -- Note that we take advantage of the implementation permission to make -- this unit Pure instead of Preelaborable; see RM 13.7.1(15). In Ada -- 2005, this is Pure in any case (AI-362). pragma No_Elaboration_Code_All; -- Allow the use of that restriction in units that WITH this unit type Name is (SYSTEM_NAME_GNAT); System_Name : constant Name := SYSTEM_NAME_GNAT; -- System-Dependent Named Numbers Min_Int : constant := Long_Long_Integer'First; Max_Int : constant := Long_Long_Integer'Last; Max_Binary_Modulus : constant := 2 ** Long_Long_Integer'Size; Max_Nonbinary_Modulus : constant := 2 ** Integer'Size - 1; Max_Base_Digits : constant := Long_Long_Float'Digits; Max_Digits : constant := Long_Long_Float'Digits; Max_Mantissa : constant := 63; Fine_Delta : constant := 2.0 ** (-Max_Mantissa); Tick : constant := 0.01; -- Storage-related Declarations type Address is private; -- Note that we do NOT add pragma Preelaborable_Initialization in this -- version of System, since it is used for the compiler only, and typical -- earlier bootstrap compilers don't support this pragma. We don't need -- it in this context, so there is no problem in omitting it. Null_Address : constant Address; Storage_Unit : constant := Standard'Storage_Unit; Word_Size : constant := Standard'Word_Size; Memory_Size : constant := 2 ** Standard'Address_Size; -- Address comparison function "<" (Left, Right : Address) return Boolean; function "<=" (Left, Right : Address) return Boolean; function ">" (Left, Right : Address) return Boolean; function ">=" (Left, Right : Address) return Boolean; function "=" (Left, Right : Address) return Boolean; pragma Import (Intrinsic, "<"); pragma Import (Intrinsic, "<="); pragma Import (Intrinsic, ">"); pragma Import (Intrinsic, ">="); pragma Import (Intrinsic, "="); -- Other System-Dependent Declarations type Bit_Order is (High_Order_First, Low_Order_First); Default_Bit_Order : constant Bit_Order := Bit_Order'Val (Standard'Default_Bit_Order); pragma Warnings (Off, Default_Bit_Order); -- kill constant condition warning -- Priority-related Declarations (RM D.1) Max_Priority : constant Positive := 30; Max_Interrupt_Priority : constant Positive := 31; subtype Any_Priority is Integer range 0 .. 31; subtype Priority is Any_Priority range 0 .. 30; subtype Interrupt_Priority is Any_Priority range 31 .. 31; Default_Priority : constant Priority := 15; private type Address is mod Memory_Size; Null_Address : constant Address := 0; -------------------------------------- -- System Implementation Parameters -- -------------------------------------- -- These parameters provide information about the target that is used by -- the compiler. They are in the private part of System, where they can be -- accessed using the special circuitry in the Targparm unit whose source -- should be consulted for more detailed descriptions of the individual -- switch values. -- This version of system.ads is used only for building the compiler. -- We really ought to use the proper target system (i.e. the one that -- corresponds to the host for the compiler), but that causes as yet -- unsolved makefile problems. For the most part the setting of these -- parameters is not too critical for the compiler version (e.g. we -- do not use floating-point anyway in the compiler). Backend_Divide_Checks : constant Boolean := False; Backend_Overflow_Checks : constant Boolean := False; Command_Line_Args : constant Boolean := True; Configurable_Run_Time : constant Boolean := False; Denorm : constant Boolean := True; Duration_32_Bits : constant Boolean := False; Exit_Status_Supported : constant Boolean := True; Machine_Overflows : constant Boolean := False; Machine_Rounds : constant Boolean := True; Preallocated_Stacks : constant Boolean := False; Signed_Zeros : constant Boolean := True; Stack_Check_Default : constant Boolean := False; Stack_Check_Probes : constant Boolean := False; Stack_Check_Limits : constant Boolean := False; Support_Aggregates : constant Boolean := True; Support_Composite_Assign : constant Boolean := True; Support_Composite_Compare : constant Boolean := True; Support_Long_Shifts : constant Boolean := True; Always_Compatible_Rep : constant Boolean := True; Suppress_Standard_Library : constant Boolean := False; Use_Ada_Main_Program_Name : constant Boolean := False; Frontend_Exceptions : constant Boolean := False; ZCX_By_Default : constant Boolean := True; end System;
reznikmm/matreshka
Ada
3,919
ads
------------------------------------------------------------------------------ -- -- -- Matreshka Project -- -- -- -- Open Document Toolkit -- -- -- -- Runtime Library Component -- -- -- ------------------------------------------------------------------------------ -- -- -- Copyright © 2014, Vadim Godunko <[email protected]> -- -- 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 ODF.DOM.Svg_X_Attributes; package Matreshka.ODF_Svg.X_Attributes is type Svg_X_Attribute_Node is new Matreshka.ODF_Svg.Abstract_Svg_Attribute_Node and ODF.DOM.Svg_X_Attributes.ODF_Svg_X_Attribute with null record; overriding function Create (Parameters : not null access Matreshka.DOM_Attributes.Attribute_L2_Parameters) return Svg_X_Attribute_Node; overriding function Get_Local_Name (Self : not null access constant Svg_X_Attribute_Node) return League.Strings.Universal_String; end Matreshka.ODF_Svg.X_Attributes;
Fabien-Chouteau/GESTE
Ada
8,923
ads
package GESTE_Fonts.FreeMono6pt7b is Font : constant Bitmap_Font_Ref; private FreeMono6pt7bBitmaps : aliased constant Font_Bitmap := ( 16#00#, 16#00#, 16#00#, 16#81#, 16#02#, 16#04#, 16#00#, 16#00#, 16#20#, 16#00#, 16#00#, 16#00#, 16#00#, 16#01#, 16#42#, 16#85#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#42#, 16#8F#, 16#8A#, 16#3E#, 16#30#, 16#60#, 16#00#, 16#00#, 16#00#, 16#00#, 16#41#, 16#E4#, 16#46#, 16#03#, 16#22#, 16#78#, 16#20#, 16#00#, 16#00#, 16#00#, 16#00#, 16#C2#, 16#85#, 16#06#, 16#07#, 16#3C#, 16#24#, 16#30#, 16#00#, 16#00#, 16#00#, 16#00#, 16#01#, 16#C2#, 16#04#, 16#19#, 16#2C#, 16#48#, 16#68#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#81#, 16#02#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#40#, 16#81#, 16#02#, 16#04#, 16#08#, 16#10#, 16#20#, 16#00#, 16#00#, 16#00#, 16#01#, 16#02#, 16#04#, 16#04#, 16#08#, 16#10#, 16#40#, 16#80#, 16#00#, 16#00#, 16#00#, 16#00#, 16#87#, 16#43#, 16#0A#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#01#, 16#02#, 16#1F#, 16#08#, 16#10#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#60#, 16#81#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#1F#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#20#, 16#00#, 16#00#, 16#00#, 16#00#, 16#10#, 16#40#, 16#82#, 16#04#, 16#10#, 16#20#, 16#81#, 16#00#, 16#00#, 16#00#, 16#00#, 16#E2#, 16#24#, 16#48#, 16#91#, 16#22#, 16#24#, 16#70#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#87#, 16#02#, 16#04#, 16#08#, 16#10#, 16#F8#, 16#00#, 16#00#, 16#00#, 16#00#, 16#E2#, 16#44#, 16#41#, 16#04#, 16#10#, 16#40#, 16#F8#, 16#00#, 16#00#, 16#00#, 16#00#, 16#E0#, 16#20#, 16#43#, 16#01#, 16#02#, 16#44#, 16#70#, 16#00#, 16#00#, 16#00#, 16#00#, 16#20#, 16#C2#, 16#85#, 16#12#, 16#3E#, 16#08#, 16#38#, 16#00#, 16#00#, 16#00#, 16#00#, 16#F2#, 16#04#, 16#0B#, 16#09#, 16#02#, 16#44#, 16#70#, 16#00#, 16#00#, 16#00#, 16#00#, 16#71#, 16#82#, 16#07#, 16#09#, 16#12#, 16#24#, 16#30#, 16#00#, 16#00#, 16#00#, 16#01#, 16#F0#, 16#20#, 16#81#, 16#02#, 16#08#, 16#10#, 16#20#, 16#00#, 16#00#, 16#00#, 16#00#, 16#E2#, 16#24#, 16#47#, 16#19#, 16#22#, 16#44#, 16#70#, 16#00#, 16#00#, 16#00#, 16#00#, 16#E1#, 16#22#, 16#45#, 16#8F#, 16#02#, 16#08#, 16#60#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#02#, 16#00#, 16#00#, 16#00#, 16#20#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#06#, 16#00#, 16#00#, 16#30#, 16#40#, 16#80#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#43#, 16#18#, 16#10#, 16#1C#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#0F#, 16#C0#, 16#3F#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#06#, 16#02#, 16#03#, 16#04#, 16#70#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#01#, 16#C0#, 16#40#, 16#82#, 16#08#, 16#00#, 16#20#, 16#00#, 16#00#, 16#00#, 16#00#, 16#E2#, 16#44#, 16#CA#, 16#99#, 16#2E#, 16#40#, 16#80#, 16#E0#, 16#00#, 16#00#, 16#00#, 16#03#, 16#82#, 16#85#, 16#12#, 16#3E#, 16#45#, 16#CC#, 16#00#, 16#00#, 16#00#, 16#00#, 16#03#, 16#C4#, 16#48#, 16#9E#, 16#22#, 16#44#, 16#F8#, 16#00#, 16#00#, 16#00#, 16#00#, 16#01#, 16#C4#, 16#48#, 16#10#, 16#20#, 16#40#, 16#78#, 16#00#, 16#00#, 16#00#, 16#00#, 16#03#, 16#C4#, 16#48#, 16#91#, 16#22#, 16#44#, 16#F0#, 16#00#, 16#00#, 16#00#, 16#00#, 16#03#, 16#E4#, 16#0A#, 16#1C#, 16#28#, 16#40#, 16#F8#, 16#00#, 16#00#, 16#00#, 16#00#, 16#03#, 16#E4#, 16#0A#, 16#1C#, 16#28#, 16#40#, 16#E0#, 16#00#, 16#00#, 16#00#, 16#00#, 16#01#, 16#C4#, 16#48#, 16#10#, 16#27#, 16#44#, 16#78#, 16#00#, 16#00#, 16#00#, 16#00#, 16#03#, 16#64#, 16#48#, 16#8F#, 16#22#, 16#44#, 16#DC#, 16#00#, 16#00#, 16#00#, 16#00#, 16#03#, 16#E1#, 16#02#, 16#04#, 16#08#, 16#10#, 16#F8#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#F0#, 16#40#, 16#81#, 16#22#, 16#48#, 16#70#, 16#00#, 16#00#, 16#00#, 16#00#, 16#03#, 16#74#, 16#8A#, 16#1C#, 16#24#, 16#44#, 16#CC#, 16#00#, 16#00#, 16#00#, 16#00#, 16#03#, 16#82#, 16#04#, 16#08#, 16#10#, 16#20#, 16#F8#, 16#00#, 16#00#, 16#00#, 16#00#, 16#06#, 16#3C#, 16#55#, 16#AB#, 16#4A#, 16#85#, 16#CC#, 16#00#, 16#00#, 16#00#, 16#00#, 16#06#, 16#76#, 16#4C#, 16#95#, 16#26#, 16#4C#, 16#C8#, 16#00#, 16#00#, 16#00#, 16#00#, 16#01#, 16#C4#, 16#48#, 16#90#, 16#A2#, 16#44#, 16#70#, 16#00#, 16#00#, 16#00#, 16#00#, 16#03#, 16#C4#, 16#48#, 16#91#, 16#3C#, 16#40#, 16#E0#, 16#00#, 16#00#, 16#00#, 16#00#, 16#01#, 16#C4#, 16#48#, 16#90#, 16#A2#, 16#44#, 16#70#, 16#E9#, 16#20#, 16#00#, 16#00#, 16#03#, 16#C4#, 16#48#, 16#9E#, 16#24#, 16#44#, 16#C4#, 16#00#, 16#00#, 16#00#, 16#00#, 16#01#, 16#E4#, 16#48#, 16#0E#, 16#02#, 16#44#, 16#F0#, 16#00#, 16#00#, 16#00#, 16#00#, 16#03#, 16#E1#, 16#02#, 16#04#, 16#08#, 16#10#, 16#70#, 16#00#, 16#00#, 16#00#, 16#00#, 16#07#, 16#74#, 16#48#, 16#91#, 16#22#, 16#44#, 16#70#, 16#00#, 16#00#, 16#00#, 16#00#, 16#07#, 16#34#, 16#48#, 16#92#, 16#14#, 16#28#, 16#20#, 16#00#, 16#00#, 16#00#, 16#00#, 16#07#, 16#38#, 16#52#, 16#9B#, 16#36#, 16#64#, 16#88#, 16#00#, 16#00#, 16#00#, 16#00#, 16#03#, 16#34#, 16#45#, 16#04#, 16#14#, 16#45#, 16#DC#, 16#00#, 16#00#, 16#00#, 16#00#, 16#03#, 16#34#, 16#45#, 16#04#, 16#08#, 16#10#, 16#70#, 16#00#, 16#00#, 16#00#, 16#00#, 16#03#, 16#E4#, 16#81#, 16#04#, 16#10#, 16#44#, 16#F8#, 16#00#, 16#00#, 16#00#, 16#00#, 16#60#, 16#81#, 16#02#, 16#04#, 16#08#, 16#10#, 16#20#, 16#60#, 16#00#, 16#00#, 16#01#, 16#02#, 16#02#, 16#04#, 16#04#, 16#08#, 16#08#, 16#10#, 16#10#, 16#00#, 16#00#, 16#00#, 16#C0#, 16#81#, 16#02#, 16#04#, 16#08#, 16#10#, 16#20#, 16#C0#, 16#00#, 16#00#, 16#00#, 16#00#, 16#82#, 16#88#, 16#80#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#07#, 16#F0#, 16#00#, 16#00#, 16#01#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#07#, 16#0F#, 16#22#, 16#44#, 16#F8#, 16#00#, 16#00#, 16#00#, 16#03#, 16#02#, 16#04#, 16#0B#, 16#19#, 16#22#, 16#45#, 16#F0#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#07#, 16#11#, 16#20#, 16#40#, 16#78#, 16#00#, 16#00#, 16#00#, 16#00#, 16#10#, 16#20#, 16#47#, 16#91#, 16#22#, 16#44#, 16#74#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#07#, 16#11#, 16#3E#, 16#40#, 16#78#, 16#00#, 16#00#, 16#00#, 16#00#, 16#71#, 16#02#, 16#0F#, 16#88#, 16#10#, 16#20#, 16#F8#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#07#, 16#D1#, 16#22#, 16#44#, 16#78#, 16#11#, 16#C0#, 16#00#, 16#01#, 16#02#, 16#04#, 16#0B#, 16#19#, 16#22#, 16#44#, 16#DC#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#80#, 16#06#, 16#04#, 16#08#, 16#10#, 16#F8#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#40#, 16#0F#, 16#02#, 16#04#, 16#08#, 16#10#, 16#23#, 16#C0#, 16#00#, 16#01#, 16#02#, 16#04#, 16#09#, 16#94#, 16#18#, 16#48#, 16#98#, 16#00#, 16#00#, 16#00#, 16#00#, 16#C0#, 16#81#, 16#02#, 16#04#, 16#08#, 16#10#, 16#F8#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#15#, 16#B5#, 16#4A#, 16#95#, 16#B4#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#0B#, 16#19#, 16#22#, 16#44#, 16#C8#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#07#, 16#11#, 16#22#, 16#44#, 16#70#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#1F#, 16#11#, 16#22#, 16#44#, 16#F1#, 16#07#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#07#, 16#51#, 16#22#, 16#44#, 16#78#, 16#10#, 16#70#, 16#00#, 16#00#, 16#00#, 16#00#, 16#0D#, 16#8C#, 16#10#, 16#20#, 16#F0#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#07#, 16#99#, 16#0E#, 16#44#, 16#F0#, 16#00#, 16#00#, 16#00#, 16#00#, 16#02#, 16#04#, 16#0F#, 16#10#, 16#20#, 16#40#, 16#70#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#09#, 16#91#, 16#22#, 16#44#, 16#78#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#1D#, 16#D1#, 16#14#, 16#28#, 16#20#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#18#, 16#D1#, 16#2A#, 16#6C#, 16#50#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#0D#, 16#8A#, 16#08#, 16#68#, 16#DC#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#0C#, 16#D1#, 16#14#, 16#28#, 16#20#, 16#83#, 16#80#, 16#00#, 16#00#, 16#00#, 16#00#, 16#0F#, 16#92#, 16#08#, 16#20#, 16#F8#, 16#00#, 16#00#, 16#00#, 16#00#, 16#20#, 16#81#, 16#02#, 16#08#, 16#08#, 16#10#, 16#20#, 16#20#, 16#00#, 16#00#, 16#00#, 16#00#, 16#81#, 16#02#, 16#04#, 16#08#, 16#10#, 16#20#, 16#40#, 16#00#, 16#00#, 16#00#, 16#C0#, 16#81#, 16#02#, 16#02#, 16#08#, 16#10#, 16#20#, 16#C0#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#06#, 16#03#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#); Font_D : aliased constant Bitmap_Font := ( Bytes_Per_Glyph => 11, Glyph_Width => 7, Glyph_Height => 12, Data => FreeMono6pt7bBitmaps'Access); Font : constant Bitmap_Font_Ref := Font_D'Access; end GESTE_Fonts.FreeMono6pt7b;
OneWingedShark/Byron
Ada
126
ads
Pragma Ada_2012; Pragma Assertion_Policy( Check ); Package Lexington.Aux.Constants with Pure is End Lexington.Aux.Constants;
AdaCore/gpr
Ada
3,167
adb
-- -- Copyright (C) 2019-2023, AdaCore -- -- SPDX-License-Identifier: Apache-2.0 -- with Ada.Text_IO; with Ada.Directories; with Ada.Strings.Fixed; with GPR2.Context; with GPR2.Log; with GPR2.Project.View; with GPR2.Project.Tree; with GPR2.Project.Attribute.Set; with GPR2.Project.Variable.Set; procedure Main is use Ada; use GPR2; use GPR2.Project; procedure Display (Prj : Project.View.Object; Full : Boolean := True); procedure Display (Att : Project.Attribute.Object); ------------- -- Display -- ------------- procedure Display (Att : Project.Attribute.Object) is begin Text_IO.Put (" " & Image (Att.Name.Id.Attr)); if Att.Has_Index then Text_IO.Put (" (" & Att.Index.Text & ")"); end if; Text_IO.Put (" ->"); for V of Att.Values loop Text_IO.Put (" " & V.Text); end loop; Text_IO.New_Line; end Display; procedure Display (Prj : Project.View.Object; Full : Boolean := True) is use GPR2.Project.Attribute.Set; use GPR2.Project.Variable.Set.Set; begin Text_IO.Put (String (Prj.Name) & " "); Text_IO.Set_Col (10); Text_IO.Put_Line (Prj.Qualifier'Img); if Full then for A of Prj.Attributes (With_Defaults => False, With_Config => False) loop Text_IO.Put ("A: " & Image (A.Name.Id.Attr)); Text_IO.Put (" ->"); for V of A.Values loop Text_IO.Put (" " & V.Text); end loop; Text_IO.New_Line; end loop; if Prj.Has_Variables then for V in Prj.Variables.Iterate loop Text_IO.Put ("V: " & String (Key (V))); Text_IO.Put (" -> "); Text_IO.Put (String (Element (V).Value.Text)); Text_IO.New_Line; end loop; end if; for Pck of Prj.Packages (With_Defaults => False, With_Config => False) loop Text_IO.Put_Line (" " & Image (Pck)); for A of Prj.Attributes (Pack => Pck, With_Defaults => False, With_Config => False) loop Display (A); end loop; end loop; end if; end Display; Prj : Project.Tree.Object; Ctx : Context.Object; begin Ctx.Include ("OS", "Linux"); Project.Tree.Load (Prj, Create ("demo.gpr"), Ctx); Project.Tree.Load_Configuration (Prj, Create ("config.cgpr")); Display (Prj.Root_Project); exception when GPR2.Project_Error => if Prj.Has_Messages then Text_IO.Put_Line ("Messages found:"); for M of Prj.Log_Messages.all loop declare F : constant String := M.Sloc.Filename; I : constant Natural := Strings.Fixed.Index (F, "/config"); begin Text_IO.Put_Line ("> " & F (I .. F'Last)); Text_IO.Put_Line (M.Level'Img); Text_IO.Put_Line (M.Format); end; end loop; end if; end Main;
reznikmm/matreshka
Ada
6,798
adb
------------------------------------------------------------------------------ -- -- -- Matreshka Project -- -- -- -- Open Document Toolkit -- -- -- -- Runtime Library Component -- -- -- ------------------------------------------------------------------------------ -- -- -- Copyright © 2014, Vadim Godunko <[email protected]> -- -- All rights reserved. -- -- -- -- Redistribution and use in source and binary forms, with or without -- -- modification, are permitted provided that the following conditions -- -- are met: -- -- -- -- * Redistributions of source code must retain the above copyright -- -- notice, this list of conditions and the following disclaimer. -- -- -- -- * Redistributions in binary form must reproduce the above copyright -- -- notice, this list of conditions and the following disclaimer in the -- -- documentation and/or other materials provided with the distribution. -- -- -- -- * Neither the name of the Vadim Godunko, IE nor the names of its -- -- contributors may be used to endorse or promote products derived from -- -- this software without specific prior written permission. -- -- -- -- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -- -- "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -- -- LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -- -- A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -- -- HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -- -- SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED -- -- TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -- -- PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -- -- LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -- -- NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -- -- SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -- -- -- ------------------------------------------------------------------------------ -- $Revision$ $Date$ ------------------------------------------------------------------------------ with Matreshka.DOM_Documents; with Matreshka.ODF_String_Constants; with ODF.DOM.Iterators; with ODF.DOM.Visitors; package body Matreshka.ODF_Db.Component_Elements is ------------ -- Create -- ------------ overriding function Create (Parameters : not null access Matreshka.DOM_Elements.Element_L2_Parameters) return Db_Component_Element_Node is begin return Self : Db_Component_Element_Node do Matreshka.ODF_Db.Constructors.Initialize (Self'Unchecked_Access, Parameters.Document, Matreshka.ODF_String_Constants.Db_Prefix); end return; end Create; ---------------- -- Enter_Node -- ---------------- overriding procedure Enter_Node (Self : not null access Db_Component_Element_Node; Visitor : in out XML.DOM.Visitors.Abstract_Visitor'Class; Control : in out XML.DOM.Visitors.Traverse_Control) is begin if Visitor in ODF.DOM.Visitors.Abstract_ODF_Visitor'Class then ODF.DOM.Visitors.Abstract_ODF_Visitor'Class (Visitor).Enter_Db_Component (ODF.DOM.Db_Component_Elements.ODF_Db_Component_Access (Self), Control); else Matreshka.DOM_Elements.Abstract_Element_Node (Self.all).Enter_Node (Visitor, Control); end if; end Enter_Node; -------------------- -- Get_Local_Name -- -------------------- overriding function Get_Local_Name (Self : not null access constant Db_Component_Element_Node) return League.Strings.Universal_String is pragma Unreferenced (Self); begin return Matreshka.ODF_String_Constants.Component_Element; end Get_Local_Name; ---------------- -- Leave_Node -- ---------------- overriding procedure Leave_Node (Self : not null access Db_Component_Element_Node; Visitor : in out XML.DOM.Visitors.Abstract_Visitor'Class; Control : in out XML.DOM.Visitors.Traverse_Control) is begin if Visitor in ODF.DOM.Visitors.Abstract_ODF_Visitor'Class then ODF.DOM.Visitors.Abstract_ODF_Visitor'Class (Visitor).Leave_Db_Component (ODF.DOM.Db_Component_Elements.ODF_Db_Component_Access (Self), Control); else Matreshka.DOM_Elements.Abstract_Element_Node (Self.all).Leave_Node (Visitor, Control); end if; end Leave_Node; ---------------- -- Visit_Node -- ---------------- overriding procedure Visit_Node (Self : not null access Db_Component_Element_Node; Iterator : in out XML.DOM.Visitors.Abstract_Iterator'Class; Visitor : in out XML.DOM.Visitors.Abstract_Visitor'Class; Control : in out XML.DOM.Visitors.Traverse_Control) is begin if Iterator in ODF.DOM.Iterators.Abstract_ODF_Iterator'Class then ODF.DOM.Iterators.Abstract_ODF_Iterator'Class (Iterator).Visit_Db_Component (Visitor, ODF.DOM.Db_Component_Elements.ODF_Db_Component_Access (Self), Control); else Matreshka.DOM_Elements.Abstract_Element_Node (Self.all).Visit_Node (Iterator, Visitor, Control); end if; end Visit_Node; begin Matreshka.DOM_Documents.Register_Element (Matreshka.ODF_String_Constants.Db_URI, Matreshka.ODF_String_Constants.Component_Element, Db_Component_Element_Node'Tag); end Matreshka.ODF_Db.Component_Elements;
zhmu/ananas
Ada
3,756
ads
------------------------------------------------------------------------------ -- -- -- GNAT RUN-TIME COMPONENTS -- -- -- -- A D A . N U M E R I C S . A U X . L O N G _ L O N G _ F L O A T -- -- -- -- S p e c -- -- (Long Long Float Wrapper in terms of Long Float) -- -- -- -- Copyright (C) 1992-2022, Free Software Foundation, Inc. -- -- -- -- GNAT is free software; you can redistribute it and/or modify it under -- -- terms of the GNU General Public License as published by the Free Soft- -- -- ware Foundation; either version 3, or (at your option) any later ver- -- -- sion. GNAT is distributed in the hope that it will be useful, but WITH- -- -- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY -- -- or FITNESS FOR A PARTICULAR PURPOSE. -- -- -- -- As a special exception under Section 7 of GPL version 3, you are granted -- -- additional permissions described in the GCC Runtime Library Exception, -- -- version 3.1, as published by the Free Software Foundation. -- -- -- -- You should have received a copy of the GNU General Public License and -- -- a copy of the GCC Runtime Library Exception along with this program; -- -- see the files COPYING3 and COPYING.RUNTIME respectively. If not, see -- -- <http://www.gnu.org/licenses/>. -- -- -- -- GNAT was originally developed by the GNAT team at New York University. -- -- Extensive contributions were provided by Ada Core Technologies Inc. -- -- -- ------------------------------------------------------------------------------ -- This package provides the basic computational interface for the -- generic elementary functions. The functions in this unit are -- wrappers for those in the Long Float package. with Ada.Numerics.Aux_Long_Float; package Ada.Numerics.Aux_Long_Long_Float is pragma Pure; subtype T is Long_Long_Float; package Aux renames Ada.Numerics.Aux_Long_Float; subtype W is Aux.T; -- Use the Aux implementation. function Sin (X : T) return T is (T (Aux.Sin (W (X)))); function Cos (X : T) return T is (T (Aux.Cos (W (X)))); function Tan (X : T) return T is (T (Aux.Tan (W (X)))); function Exp (X : T) return T is (T (Aux.Exp (W (X)))); function Sqrt (X : T) return T is (T (Aux.Sqrt (W (X)))); function Log (X : T) return T is (T (Aux.Log (W (X)))); function Acos (X : T) return T is (T (Aux.Acos (W (X)))); function Asin (X : T) return T is (T (Aux.Asin (W (X)))); function Atan (X : T) return T is (T (Aux.Atan (W (X)))); function Sinh (X : T) return T is (T (Aux.Sinh (W (X)))); function Cosh (X : T) return T is (T (Aux.Cosh (W (X)))); function Tanh (X : T) return T is (T (Aux.Tanh (W (X)))); function Pow (X, Y : T) return T is (T (Aux.Pow (W (X), W (Y)))); end Ada.Numerics.Aux_Long_Long_Float;
reznikmm/matreshka
Ada
3,576
adb
------------------------------------------------------------------------------ -- -- -- Matreshka Project -- -- -- -- Localization, Internationalization, Globalization for Ada -- -- -- -- Testsuite Component -- -- -- ------------------------------------------------------------------------------ -- -- -- Copyright © 2014, Vadim Godunko <[email protected]> -- -- All rights reserved. -- -- -- -- Redistribution and use in source and binary forms, with or without -- -- modification, are permitted provided that the following conditions -- -- are met: -- -- -- -- * Redistributions of source code must retain the above copyright -- -- notice, this list of conditions and the following disclaimer. -- -- -- -- * Redistributions in binary form must reproduce the above copyright -- -- notice, this list of conditions and the following disclaimer in the -- -- documentation and/or other materials provided with the distribution. -- -- -- -- * Neither the name of the Vadim Godunko, IE nor the names of its -- -- contributors may be used to endorse or promote products derived from -- -- this software without specific prior written permission. -- -- -- -- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -- -- "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -- -- LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -- -- A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -- -- HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -- -- SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED -- -- TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -- -- PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -- -- LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -- -- NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -- -- SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -- -- -- ------------------------------------------------------------------------------ -- $Revision$ $Date$ ------------------------------------------------------------------------------ with League.Application; pragma Unreferenced (League.Application); with League.Strings; procedure Test_388 is Index_1 : constant Natural := League.Strings.Empty_Universal_String.Last_Index ('.'); begin null; end Test_388;
reznikmm/matreshka
Ada
4,394
ads
------------------------------------------------------------------------------ -- -- -- Matreshka Project -- -- -- -- Web Framework -- -- -- -- Runtime Library Component -- -- -- ------------------------------------------------------------------------------ -- -- -- Copyright © 2014-2015, Vadim Godunko <[email protected]> -- -- 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 Wiki.Block_Parsers.Nestables; package Wiki.Block_Parsers.Paragraphs is -- pragma Preelaborate; type Paragraph_Block_Parser is new Wiki.Block_Parsers.Nestables.Nestable_Block_Parser with record Space_Needed : Boolean; -- Whether to output or to suppress space character before emitting text -- of line. end record; overriding function Start_Block (Self : not null access Paragraph_Block_Parser; Previous : access Abstract_Block_Parser'Class) return Block_Parser_Access; overriding function End_Block (Self : not null access Paragraph_Block_Parser; Next : access Abstract_Block_Parser'Class) return End_Block_Action; overriding procedure Line (Self : not null access Paragraph_Block_Parser; Text : League.Strings.Universal_String); overriding function Create (Parameters : not null access Constructor_Parameters) return Paragraph_Block_Parser; procedure Register; -- Registers block parser to handle paragraphs. end Wiki.Block_Parsers.Paragraphs;
optikos/oasis
Ada
7,525
adb
-- Copyright (c) 2019 Maxim Reznik <[email protected]> -- -- SPDX-License-Identifier: MIT -- License-Filename: LICENSE ------------------------------------------------------------- package body Program.Nodes.While_Loop_Statements is function Create (Statement_Identifier : Program.Elements.Defining_Identifiers .Defining_Identifier_Access; Colon_Token : Program.Lexical_Elements .Lexical_Element_Access; While_Token : not null Program.Lexical_Elements .Lexical_Element_Access; Condition : not null Program.Elements.Expressions .Expression_Access; Loop_Token : not null Program.Lexical_Elements .Lexical_Element_Access; Statements : not null Program.Element_Vectors .Element_Vector_Access; End_Token : not null Program.Lexical_Elements .Lexical_Element_Access; Loop_Token_2 : not null Program.Lexical_Elements .Lexical_Element_Access; End_Statement_Identifier : Program.Elements.Identifiers.Identifier_Access; Semicolon_Token : not null Program.Lexical_Elements .Lexical_Element_Access) return While_Loop_Statement is begin return Result : While_Loop_Statement := (Statement_Identifier => Statement_Identifier, Colon_Token => Colon_Token, While_Token => While_Token, Condition => Condition, Loop_Token => Loop_Token, Statements => Statements, End_Token => End_Token, Loop_Token_2 => Loop_Token_2, End_Statement_Identifier => End_Statement_Identifier, Semicolon_Token => Semicolon_Token, Enclosing_Element => null) do Initialize (Result); end return; end Create; function Create (Statement_Identifier : Program.Elements.Defining_Identifiers .Defining_Identifier_Access; Condition : not null Program.Elements.Expressions .Expression_Access; Statements : not null Program.Element_Vectors .Element_Vector_Access; End_Statement_Identifier : Program.Elements.Identifiers.Identifier_Access; Is_Part_Of_Implicit : Boolean := False; Is_Part_Of_Inherited : Boolean := False; Is_Part_Of_Instance : Boolean := False) return Implicit_While_Loop_Statement is begin return Result : Implicit_While_Loop_Statement := (Statement_Identifier => Statement_Identifier, Condition => Condition, Statements => Statements, End_Statement_Identifier => End_Statement_Identifier, Is_Part_Of_Implicit => Is_Part_Of_Implicit, Is_Part_Of_Inherited => Is_Part_Of_Inherited, Is_Part_Of_Instance => Is_Part_Of_Instance, Enclosing_Element => null) do Initialize (Result); end return; end Create; overriding function Statement_Identifier (Self : Base_While_Loop_Statement) return Program.Elements.Defining_Identifiers .Defining_Identifier_Access is begin return Self.Statement_Identifier; end Statement_Identifier; overriding function Condition (Self : Base_While_Loop_Statement) return not null Program.Elements.Expressions.Expression_Access is begin return Self.Condition; end Condition; overriding function Statements (Self : Base_While_Loop_Statement) return not null Program.Element_Vectors.Element_Vector_Access is begin return Self.Statements; end Statements; overriding function End_Statement_Identifier (Self : Base_While_Loop_Statement) return Program.Elements.Identifiers.Identifier_Access is begin return Self.End_Statement_Identifier; end End_Statement_Identifier; overriding function Colon_Token (Self : While_Loop_Statement) return Program.Lexical_Elements.Lexical_Element_Access is begin return Self.Colon_Token; end Colon_Token; overriding function While_Token (Self : While_Loop_Statement) return not null Program.Lexical_Elements.Lexical_Element_Access is begin return Self.While_Token; end While_Token; overriding function Loop_Token (Self : While_Loop_Statement) return not null Program.Lexical_Elements.Lexical_Element_Access is begin return Self.Loop_Token; end Loop_Token; overriding function End_Token (Self : While_Loop_Statement) return not null Program.Lexical_Elements.Lexical_Element_Access is begin return Self.End_Token; end End_Token; overriding function Loop_Token_2 (Self : While_Loop_Statement) return not null Program.Lexical_Elements.Lexical_Element_Access is begin return Self.Loop_Token_2; end Loop_Token_2; overriding function Semicolon_Token (Self : While_Loop_Statement) return not null Program.Lexical_Elements.Lexical_Element_Access is begin return Self.Semicolon_Token; end Semicolon_Token; overriding function Is_Part_Of_Implicit (Self : Implicit_While_Loop_Statement) return Boolean is begin return Self.Is_Part_Of_Implicit; end Is_Part_Of_Implicit; overriding function Is_Part_Of_Inherited (Self : Implicit_While_Loop_Statement) return Boolean is begin return Self.Is_Part_Of_Inherited; end Is_Part_Of_Inherited; overriding function Is_Part_Of_Instance (Self : Implicit_While_Loop_Statement) return Boolean is begin return Self.Is_Part_Of_Instance; end Is_Part_Of_Instance; procedure Initialize (Self : aliased in out Base_While_Loop_Statement'Class) is begin if Self.Statement_Identifier.Assigned then Set_Enclosing_Element (Self.Statement_Identifier, Self'Unchecked_Access); end if; Set_Enclosing_Element (Self.Condition, Self'Unchecked_Access); for Item in Self.Statements.Each_Element loop Set_Enclosing_Element (Item.Element, Self'Unchecked_Access); end loop; if Self.End_Statement_Identifier.Assigned then Set_Enclosing_Element (Self.End_Statement_Identifier, Self'Unchecked_Access); end if; null; end Initialize; overriding function Is_While_Loop_Statement_Element (Self : Base_While_Loop_Statement) return Boolean is pragma Unreferenced (Self); begin return True; end Is_While_Loop_Statement_Element; overriding function Is_Statement_Element (Self : Base_While_Loop_Statement) return Boolean is pragma Unreferenced (Self); begin return True; end Is_Statement_Element; overriding procedure Visit (Self : not null access Base_While_Loop_Statement; Visitor : in out Program.Element_Visitors.Element_Visitor'Class) is begin Visitor.While_Loop_Statement (Self); end Visit; overriding function To_While_Loop_Statement_Text (Self : aliased in out While_Loop_Statement) return Program.Elements.While_Loop_Statements .While_Loop_Statement_Text_Access is begin return Self'Unchecked_Access; end To_While_Loop_Statement_Text; overriding function To_While_Loop_Statement_Text (Self : aliased in out Implicit_While_Loop_Statement) return Program.Elements.While_Loop_Statements .While_Loop_Statement_Text_Access is pragma Unreferenced (Self); begin return null; end To_While_Loop_Statement_Text; end Program.Nodes.While_Loop_Statements;
reznikmm/matreshka
Ada
3,657
ads
------------------------------------------------------------------------------ -- -- -- Matreshka Project -- -- -- -- Ada Modeling Framework -- -- -- -- Runtime Library Component -- -- -- ------------------------------------------------------------------------------ -- -- -- Copyright © 2011, Vadim Godunko <[email protected]> -- -- 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 AMF.Stores; with AMF.URI_Extents; package AMF.URI_Stores is pragma Preelaborate; type URI_Store is limited interface and AMF.Stores.Store and AMF.URI_Extents.URI_Extent; type URI_Store_Access is access all URI_Store'Class; for URI_Store_Access'Storage_Size use 0; end AMF.URI_Stores;
charlie5/lace
Ada
1,353
adb
-- with -- glx.Pointers; with OSMesa_C.Binding, System; package body openGL.Context is procedure define (Self : in out Item; the_Display : access openGL.Display.item'Class; the_surface_Profile : in openGL.surface_Profile.item'Class) is pragma Unreferenced (the_surface_Profile); -- use Glx, -- glx.Pointers; use OSMesa_C.Binding; use type System.Address; begin Self.Context := OSMesaCreateContext (format => GL.GL_RGBA, -- OSMESA_RGBA, sharelist => system.Null_Address); if Self.Context = System.Null_Address then raise Program_Error with "no openGL context"; end if; Self.Display := the_Display; end define; procedure make_Current (Self : in Item; read_Surface : in openGL.Surface.item; write_Surface : in openGL.Surface.item) is pragma Unreferenced (write_Surface); -- Success : glx.Bool; pragma Unreferenced (Success); begin null; end make_Current; -- function glx_Context_debug (Self : in Item'Class) return GLX.GLXContext.item -- is -- begin -- return self.glx_Context; -- end glx_Context_debug; end openGL.Context;
zhmu/ananas
Ada
108
adb
package body Lto24_Pkg2 is function Get return Natural is begin return 16; end; end Lto24_Pkg2;
reznikmm/matreshka
Ada
3,592
ads
------------------------------------------------------------------------------ -- -- -- Matreshka Project -- -- -- -- Ada Modeling Framework -- -- -- -- Runtime Library Component -- -- -- ------------------------------------------------------------------------------ -- -- -- Copyright © 2012, Vadim Godunko <[email protected]> -- -- All rights reserved. -- -- -- -- Redistribution and use in source and binary forms, with or without -- -- modification, are permitted provided that the following conditions -- -- are met: -- -- -- -- * Redistributions of source code must retain the above copyright -- -- notice, this list of conditions and the following disclaimer. -- -- -- -- * Redistributions in binary form must reproduce the above copyright -- -- notice, this list of conditions and the following disclaimer in the -- -- documentation and/or other materials provided with the distribution. -- -- -- -- * Neither the name of the Vadim Godunko, IE nor the names of its -- -- contributors may be used to endorse or promote products derived from -- -- this software without specific prior written permission. -- -- -- -- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -- -- "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -- -- LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -- -- A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -- -- HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -- -- SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED -- -- TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -- -- PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -- -- LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -- -- NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -- -- SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -- -- -- ------------------------------------------------------------------------------ -- $Revision$ $Date$ ------------------------------------------------------------------------------ -- This file is generated, don't edit it. ------------------------------------------------------------------------------ with AMF.Elements.Generic_Hash; function AMF.DG.Canvases.Hash is new AMF.Elements.Generic_Hash (DG_Canvas, DG_Canvas_Access);
Dioxylin/ada_shopping_tally
Ada
2,424
adb
with Ada.Text_IO; use Ada.Text_IO; -- Item\tQuantity\tPrice\tTaxable[\tTax] procedure Main is type Money_Type is delta 0.01 range -1_000_000_000.0 .. 1_000_000_000.0; for Money_Type'Small use 0.0001; subtype Tax_Type is Money_Type range 0.0 .. 1.0; subtype Quantity_Type is Integer range 0..1000; subtype Buffer_Length is Integer range 1..256; subtype Input_String is String(Buffer_Length'First..Buffer_Length'Last); package Fixed_IO is new Ada.Text_IO.Fixed_IO(Money_Type); package Integer_IO is new Ada.Text_IO.Integer_IO(Integer); Sub_Total : Money_Type := 0.0; Total : Money_Type; Taxable_Total : Money_Type := 0.0; begin Set_Line_Length(To => Count'Val(Buffer_Length'Last)); loop declare Item_Name : Input_String; Item_Name_Length : Buffer_Length; Item_Quantity : Quantity_Type; Item_Price : Money_Type; Item_Taxable_Input : Character; --Item_Taxable_Length : Buffer_Length; Item_Taxable : Boolean; --Item_Tax : Tax_Type; begin Put("Item name: "); Get_Line(Item_Name, Item_Name_Length); if Item_Name_Length = Buffer_Length'Last then Put_Line("Item name is too long. Limit is " & Integer'Image(Buffer_Length'Last-1) & " characters."); raise Data_Error; end if; Put_Line("Item name set to " & Item_Name(Input_String'First..Item_Name_Length)); Put_Line(""); Put("Item quantity: "); Integer_IO.Get(Item_Quantity); Put_Line("Item quantity set to " & Integer'Image(Item_Quantity)); Put_Line(""); Skip_Line; Put("Item price: "); Fixed_IO.Get(Item_Price); Put_Line("Item price set to " & Money_Type'Image(Item_Price)); Put_Line(""); Skip_Line; Put("Item taxable (y/n): "); Get(Item_Taxable_Input); Item_Taxable := Item_Taxable_Input = 'y'; Put_Line("Item taxability set to " & Boolean'Image(Item_Taxable)); Put_Line(""); Skip_Line; if Item_Taxable then Taxable_Total := Taxable_Total + Item_Price; end if; Sub_Total := Sub_Total + Item_Price; exception -- EOF is End_Error. when End_Error => exit; -- If invalid input, we'll retry. when Data_Error => Put_Line(""); Put_Line("***ERROR: Please try again."); Skip_Line; end; end loop; Put_Line("Transaction:"); Total := Taxable_Total*0.07125 + Sub_Total; Put_Line("Subtotal: " & Money_Type'Image(Sub_Total)); Put_Line("Taxable total: " & Money_Type'Image(Taxable_Total)); Put_Line("Total: " & Money_Type'Image(Total)); end Main;
reznikmm/matreshka
Ada
4,624
adb
------------------------------------------------------------------------------ -- -- -- Matreshka Project -- -- -- -- Open Document Toolkit -- -- -- -- Runtime Library Component -- -- -- ------------------------------------------------------------------------------ -- -- -- Copyright © 2014, Vadim Godunko <[email protected]> -- -- All rights reserved. -- -- -- -- Redistribution and use in source and binary forms, with or without -- -- modification, are permitted provided that the following conditions -- -- are met: -- -- -- -- * Redistributions of source code must retain the above copyright -- -- notice, this list of conditions and the following disclaimer. -- -- -- -- * Redistributions in binary form must reproduce the above copyright -- -- notice, this list of conditions and the following disclaimer in the -- -- documentation and/or other materials provided with the distribution. -- -- -- -- * Neither the name of the Vadim Godunko, IE nor the names of its -- -- contributors may be used to endorse or promote products derived from -- -- this software without specific prior written permission. -- -- -- -- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -- -- "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -- -- LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -- -- A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -- -- HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -- -- SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED -- -- TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -- -- PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -- -- LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -- -- NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -- -- SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -- -- -- ------------------------------------------------------------------------------ -- $Revision$ $Date$ ------------------------------------------------------------------------------ with Matreshka.DOM_Documents; with Matreshka.ODF_String_Constants; with ODF.DOM.Iterators; with ODF.DOM.Visitors; package body Matreshka.ODF_Table.Object_Name_Attributes is ------------ -- Create -- ------------ overriding function Create (Parameters : not null access Matreshka.DOM_Attributes.Attribute_L2_Parameters) return Table_Object_Name_Attribute_Node is begin return Self : Table_Object_Name_Attribute_Node do Matreshka.ODF_Table.Constructors.Initialize (Self'Unchecked_Access, Parameters.Document, Matreshka.ODF_String_Constants.Table_Prefix); end return; end Create; -------------------- -- Get_Local_Name -- -------------------- overriding function Get_Local_Name (Self : not null access constant Table_Object_Name_Attribute_Node) return League.Strings.Universal_String is pragma Unreferenced (Self); begin return Matreshka.ODF_String_Constants.Object_Name_Attribute; end Get_Local_Name; begin Matreshka.DOM_Documents.Register_Attribute (Matreshka.ODF_String_Constants.Table_URI, Matreshka.ODF_String_Constants.Object_Name_Attribute, Table_Object_Name_Attribute_Node'Tag); end Matreshka.ODF_Table.Object_Name_Attributes;
RREE/ada-util
Ada
2,197
ads
----------------------------------------------------------------------- -- util-dates-formats-tests - Test for date formats -- Copyright (C) 2011, 2013, 2014, 2015, 2016, 2018, 2020 Stephane Carrez -- Written by Stephane Carrez ([email protected]) -- -- Licensed under the Apache License, Version 2.0 (the "License"); -- you may not use this file except in compliance with the License. -- You may obtain a copy of the License at -- -- http://www.apache.org/licenses/LICENSE-2.0 -- -- Unless required by applicable law or agreed to in writing, software -- distributed under the License is distributed on an "AS IS" BASIS, -- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -- See the License for the specific language governing permissions and -- limitations under the License. ----------------------------------------------------------------------- with Util.Tests; package Util.Dates.Formats.Tests is procedure Add_Tests (Suite : in Util.Tests.Access_Test_Suite); type Test is new Util.Tests.Test with null record; procedure Test_Format (T : in out Test); -- Test parsing a date using several formats and different locales. procedure Test_Parse (T : in out Test); -- Test parsing a date using several formats and having several errors. procedure Test_Parse_Error (T : in out Test); -- Test the Get_Day_Start operation. procedure Test_Get_Day_Start (T : in out Test); -- Test the Get_Week_Start operation. procedure Test_Get_Week_Start (T : in out Test); -- Test the Get_Month_Start operation. procedure Test_Get_Month_Start (T : in out Test); -- Test the Get_Day_End operation. procedure Test_Get_Day_End (T : in out Test); -- Test the Get_Week_End operation. procedure Test_Get_Week_End (T : in out Test); -- Test the Get_Month_End operation. procedure Test_Get_Month_End (T : in out Test); -- Test the Split operation. procedure Test_Split (T : in out Test); -- Test the Append_Date operation procedure Test_Append_Date (T : in out Test); -- Test the ISO8601 operations. procedure Test_ISO8601 (T : in out Test); end Util.Dates.Formats.Tests;
AdaCore/gpr
Ada
101
ads
package very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_long_pkg is end;
rogermc2/GA_Ada
Ada
1,401
ads
with GA_Maths; package Multivector_Type_Base is -- Object_Type mvtypebase.h lines 8 - 13 and 36 -- A versor is also a multivetor -- A blade is also a versor and, therfore, also a multivector type Object_Type is (Unspecified_Object_Type, Blade_MV, Versor_MV, MV_Object); type Parity is (No_Parity, Even_Parity, Odd_Parity); -- line 43 -- mvtypebase.h lines 33 - 43 type MV_Typebase is record M_Zero : boolean := False; -- True if multivector is zero M_Type : Object_Type := Unspecified_Object_Type; M_Grade : integer := -1; -- Top grade occupied by the multivector M_Grade_Use : GA_Maths.Grade_Usage := 0; -- Bit map indicating which grades are present M_Parity : Parity := No_Parity; end record; -- procedure Set_Grade_Usage (Base : in out Type_Base; GU : GA_Maths.Grade_Usage); -- procedure Set_M_Type (Base : in out Type_Base; theType : Object_Type); -- procedure Set_Parity (Base : in out Type_Base; Par : Parity); -- procedure Set_Top_Grade (Base : in out Type_Base; Grade : Integer); procedure Set_Type_Base (Base : in out MV_Typebase; Zero : boolean; Object : Object_Type; Grade : integer; GU : GA_Maths.Grade_Usage; Par : Parity := No_Parity); private type Flag is (Valid); end Multivector_Type_Base;
mirror/ncurses
Ada
5,284
adb
------------------------------------------------------------------------------ -- -- -- GNAT ncurses Binding Samples -- -- -- -- ncurses -- -- -- -- B O D Y -- -- -- ------------------------------------------------------------------------------ -- Copyright 2020 Thomas E. Dickey -- -- Copyright 2000-2008,2009 Free Software Foundation, Inc. -- -- -- -- Permission is hereby granted, free of charge, to any person obtaining a -- -- copy of this software and associated documentation files (the -- -- "Software"), to deal in the Software without restriction, including -- -- without limitation the rights to use, copy, modify, merge, publish, -- -- distribute, distribute with modifications, sublicense, and/or sell -- -- copies of the Software, and to permit persons to whom the Software is -- -- furnished to do so, subject to the following conditions: -- -- -- -- The above copyright notice and this permission notice shall be included -- -- in all copies or substantial portions of the Software. -- -- -- -- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS -- -- OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -- -- MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. -- -- IN NO EVENT SHALL THE ABOVE COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, -- -- DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR -- -- OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR -- -- THE USE OR OTHER DEALINGS IN THE SOFTWARE. -- -- -- -- Except as contained in this notice, the name(s) of the above copyright -- -- holders shall not be used in advertising or otherwise to promote the -- -- sale, use or other dealings in this Software without prior written -- -- authorization. -- ------------------------------------------------------------------------------ -- Author: Eugene V. Melaragno <[email protected]> 2000 -- Version Control -- $Revision: 1.5 $ -- $Date: 2020/02/02 23:34:34 $ -- Binding Version 01.00 ------------------------------------------------------------------------------ with Terminal_Interface.Curses; use Terminal_Interface.Curses; with Terminal_Interface.Curses.Aux; use Terminal_Interface.Curses.Aux; package body ncurses2.genericPuts is procedure myGet (Win : Window := Standard_Window; Str : out BS.Bounded_String; Len : Integer := -1) is function Wgetnstr (Win : Window; Str : char_array; Len : int) return int; pragma Import (C, Wgetnstr, "wgetnstr"); N : Integer := Len; Txt : char_array (0 .. size_t (Max_Length)); xStr : String (1 .. Max_Length); Cnt : Natural; begin if N < 0 then N := Max_Length; end if; if N > Max_Length then raise Constraint_Error; end if; Txt (0) := Interfaces.C.char'First; if Wgetnstr (Win, Txt, C_Int (N)) = Curses_Err then raise Curses_Exception; end if; To_Ada (Txt, xStr, Cnt, True); Str := To_Bounded_String (xStr (1 .. Cnt)); end myGet; procedure myPut (Str : out BS.Bounded_String; i : Integer; Base : Number_Base := 10) is package Int_IO is new Integer_IO (Integer); use Int_IO; tmp : String (1 .. BS.Max_Length); begin Put (tmp, i, Base); Str := To_Bounded_String (tmp); Trim (Str, Ada.Strings.Trim_End'(Ada.Strings.Left)); end myPut; procedure myAdd (Str : BS.Bounded_String) is begin Add (Str => To_String (Str)); end myAdd; -- from ncurses-aux procedure Fill_String (Cp : chars_ptr; Str : out BS.Bounded_String) is -- Fill the string with the characters referenced by the -- chars_ptr. -- Len : Natural; begin if Cp /= Null_Ptr then Len := Natural (Strlen (Cp)); if Max_Length < Len then raise Constraint_Error; end if; declare S : String (1 .. Len); begin S := Value (Cp); Str := To_Bounded_String (S); end; else Str := Null_Bounded_String; end if; end Fill_String; end ncurses2.genericPuts;
reznikmm/matreshka
Ada
3,773
adb
------------------------------------------------------------------------------ -- -- -- Matreshka Project -- -- -- -- XML Processor -- -- -- -- Runtime Library Component -- -- -- ------------------------------------------------------------------------------ -- -- -- Copyright © 2013, Vadim Godunko <[email protected]> -- -- All rights reserved. -- -- -- -- Redistribution and use in source and binary forms, with or without -- -- modification, are permitted provided that the following conditions -- -- are met: -- -- -- -- * Redistributions of source code must retain the above copyright -- -- notice, this list of conditions and the following disclaimer. -- -- -- -- * Redistributions in binary form must reproduce the above copyright -- -- notice, this list of conditions and the following disclaimer in the -- -- documentation and/or other materials provided with the distribution. -- -- -- -- * Neither the name of the Vadim Godunko, IE nor the names of its -- -- contributors may be used to endorse or promote products derived from -- -- this software without specific prior written permission. -- -- -- -- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -- -- "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -- -- LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -- -- A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -- -- HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -- -- SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED -- -- TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -- -- PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -- -- LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -- -- NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -- -- SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -- -- -- ------------------------------------------------------------------------------ -- $Revision$ $Date$ ------------------------------------------------------------------------------ with Matreshka.XML_Schema.AST.Particles; package body XML.Schema.Objects.Particles.Internals is ------------ -- Create -- ------------ function Create (Node : Matreshka.XML_Schema.AST.Particle_Access) return XS_Particle is begin return (Ada.Finalization.Controlled with Node => Matreshka.XML_Schema.AST.Object_Access (Node)); end Create; end XML.Schema.Objects.Particles.Internals;
MinimSecure/unum-sdk
Ada
855
adb
-- Copyright 2008-2019 Free Software Foundation, Inc. -- -- This program is free software; you can redistribute it and/or modify -- it under the terms of the GNU General Public License as published by -- the Free Software Foundation; either version 3 of the License, or -- (at your option) any later version. -- -- This program is distributed in the hope that it will be useful, -- but WITHOUT ANY WARRANTY; without even the implied warranty of -- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -- GNU General Public License for more details. -- -- You should have received a copy of the GNU General Public License -- along with this program. If not, see <http://www.gnu.org/licenses/>. with Ident; procedure Assign is Q: array (1..5) of Integer := (2, 3, 5, 7, 11); begin Q(1) := Ident (Q(3)); -- START end Assign;
reznikmm/matreshka
Ada
4,534
adb
------------------------------------------------------------------------------ -- -- -- Matreshka Project -- -- -- -- Open Document Toolkit -- -- -- -- Runtime Library Component -- -- -- ------------------------------------------------------------------------------ -- -- -- Copyright © 2014, Vadim Godunko <[email protected]> -- -- All rights reserved. -- -- -- -- Redistribution and use in source and binary forms, with or without -- -- modification, are permitted provided that the following conditions -- -- are met: -- -- -- -- * Redistributions of source code must retain the above copyright -- -- notice, this list of conditions and the following disclaimer. -- -- -- -- * Redistributions in binary form must reproduce the above copyright -- -- notice, this list of conditions and the following disclaimer in the -- -- documentation and/or other materials provided with the distribution. -- -- -- -- * Neither the name of the Vadim Godunko, IE nor the names of its -- -- contributors may be used to endorse or promote products derived from -- -- this software without specific prior written permission. -- -- -- -- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -- -- "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -- -- LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -- -- A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -- -- HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -- -- SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED -- -- TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -- -- PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -- -- LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -- -- NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -- -- SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -- -- -- ------------------------------------------------------------------------------ -- $Revision$ $Date$ ------------------------------------------------------------------------------ with Matreshka.DOM_Documents; with Matreshka.ODF_String_Constants; with ODF.DOM.Iterators; with ODF.DOM.Visitors; package body Matreshka.ODF_Svg.Rx_Attributes is ------------ -- Create -- ------------ overriding function Create (Parameters : not null access Matreshka.DOM_Attributes.Attribute_L2_Parameters) return Svg_Rx_Attribute_Node is begin return Self : Svg_Rx_Attribute_Node do Matreshka.ODF_Svg.Constructors.Initialize (Self'Unchecked_Access, Parameters.Document, Matreshka.ODF_String_Constants.Svg_Prefix); end return; end Create; -------------------- -- Get_Local_Name -- -------------------- overriding function Get_Local_Name (Self : not null access constant Svg_Rx_Attribute_Node) return League.Strings.Universal_String is pragma Unreferenced (Self); begin return Matreshka.ODF_String_Constants.Rx_Attribute; end Get_Local_Name; begin Matreshka.DOM_Documents.Register_Attribute (Matreshka.ODF_String_Constants.Svg_URI, Matreshka.ODF_String_Constants.Rx_Attribute, Svg_Rx_Attribute_Node'Tag); end Matreshka.ODF_Svg.Rx_Attributes;
reznikmm/matreshka
Ada
10,422
ads
------------------------------------------------------------------------------ -- -- -- Matreshka Project -- -- -- -- Localization, Internationalization, Globalization for Ada -- -- -- -- Runtime Library Component -- -- -- ------------------------------------------------------------------------------ -- -- -- Copyright © 2012-2015, Vadim Godunko <[email protected]> -- -- 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$ ------------------------------------------------------------------------------ pragma Restrictions (No_Elaboration_Code); -- GNAT: enforce generation of preinitialized data section instead of -- generation of elaboration code. package Matreshka.Internals.Unicode.Ucd.Core_0116 is pragma Preelaborate; Group_0116 : aliased constant Core_Second_Stage := (16#00# .. 16#2F# => -- 011600 .. 01162F (Other_Letter, Neutral, Other, A_Letter, O_Letter, Alphabetic, (Alphabetic | Grapheme_Base | ID_Continue | ID_Start | XID_Continue | XID_Start => True, others => False)), 16#30# .. 16#32# => -- 011630 .. 011632 (Spacing_Mark, Neutral, Spacing_Mark, Extend, Extend, Combining_Mark, (Other_Alphabetic | Alphabetic | Grapheme_Base | ID_Continue | XID_Continue => True, others => False)), 16#33# .. 16#3A# => -- 011633 .. 01163A (Nonspacing_Mark, Neutral, Extend, Extend, Extend, Combining_Mark, (Other_Alphabetic | Alphabetic | Case_Ignorable | Grapheme_Extend | ID_Continue | XID_Continue => True, others => False)), 16#3B# .. 16#3C# => -- 01163B .. 01163C (Spacing_Mark, Neutral, Spacing_Mark, Extend, Extend, Combining_Mark, (Other_Alphabetic | Alphabetic | Grapheme_Base | ID_Continue | XID_Continue => True, others => False)), 16#3D# => -- 01163D (Nonspacing_Mark, Neutral, Extend, Extend, Extend, Combining_Mark, (Other_Alphabetic | Alphabetic | Case_Ignorable | Grapheme_Extend | ID_Continue | XID_Continue => True, others => False)), 16#3E# => -- 01163E (Spacing_Mark, Neutral, Spacing_Mark, Extend, Extend, Combining_Mark, (Other_Alphabetic | Alphabetic | Grapheme_Base | ID_Continue | XID_Continue => True, others => False)), 16#3F# => -- 01163F (Nonspacing_Mark, Neutral, Extend, Extend, Extend, Combining_Mark, (Diacritic | Case_Ignorable | Grapheme_Extend | Grapheme_Link | ID_Continue | XID_Continue => True, others => False)), 16#40# => -- 011640 (Nonspacing_Mark, Neutral, Extend, Extend, Extend, Combining_Mark, (Other_Alphabetic | Alphabetic | Case_Ignorable | Grapheme_Extend | ID_Continue | XID_Continue => True, others => False)), 16#41# .. 16#42# => -- 011641 .. 011642 (Other_Punctuation, Neutral, Other, Other, S_Term, Break_After, (STerm | Terminal_Punctuation | Grapheme_Base => True, others => False)), 16#43# => -- 011643 (Other_Punctuation, Neutral, Other, Other, Other, Alphabetic, (Grapheme_Base => True, others => False)), 16#44# => -- 011644 (Other_Letter, Neutral, Other, A_Letter, O_Letter, Alphabetic, (Alphabetic | Grapheme_Base | ID_Continue | ID_Start | XID_Continue | XID_Start => True, others => False)), 16#50# .. 16#59# => -- 011650 .. 011659 (Decimal_Number, Neutral, Other, Numeric, Numeric, Numeric, (Grapheme_Base | ID_Continue | XID_Continue => True, others => False)), 16#80# .. 16#AA# => -- 011680 .. 0116AA (Other_Letter, Neutral, Other, A_Letter, O_Letter, Alphabetic, (Alphabetic | Grapheme_Base | ID_Continue | ID_Start | XID_Continue | XID_Start => True, others => False)), 16#AB# => -- 0116AB (Nonspacing_Mark, Neutral, Extend, Extend, Extend, Combining_Mark, (Other_Alphabetic | Alphabetic | Case_Ignorable | Grapheme_Extend | ID_Continue | XID_Continue => True, others => False)), 16#AC# => -- 0116AC (Spacing_Mark, Neutral, Spacing_Mark, Extend, Extend, Combining_Mark, (Other_Alphabetic | Alphabetic | Grapheme_Base | ID_Continue | XID_Continue => True, others => False)), 16#AD# => -- 0116AD (Nonspacing_Mark, Neutral, Extend, Extend, Extend, Combining_Mark, (Other_Alphabetic | Alphabetic | Case_Ignorable | Grapheme_Extend | ID_Continue | XID_Continue => True, others => False)), 16#AE# .. 16#AF# => -- 0116AE .. 0116AF (Spacing_Mark, Neutral, Spacing_Mark, Extend, Extend, Combining_Mark, (Other_Alphabetic | Alphabetic | Grapheme_Base | ID_Continue | XID_Continue => True, others => False)), 16#B0# .. 16#B5# => -- 0116B0 .. 0116B5 (Nonspacing_Mark, Neutral, Extend, Extend, Extend, Combining_Mark, (Other_Alphabetic | Alphabetic | Case_Ignorable | Grapheme_Extend | ID_Continue | XID_Continue => True, others => False)), 16#B6# => -- 0116B6 (Spacing_Mark, Neutral, Spacing_Mark, Extend, Extend, Combining_Mark, (Diacritic | Grapheme_Base | Grapheme_Link | ID_Continue | XID_Continue => True, others => False)), 16#B7# => -- 0116B7 (Nonspacing_Mark, Neutral, Extend, Extend, Extend, Combining_Mark, (Diacritic | Case_Ignorable | Grapheme_Extend | ID_Continue | XID_Continue => True, others => False)), 16#C0# .. 16#C9# => -- 0116C0 .. 0116C9 (Decimal_Number, Neutral, Other, Numeric, Numeric, Numeric, (Grapheme_Base | ID_Continue | XID_Continue => True, others => False)), others => (Unassigned, Neutral, Other, Other, Other, Unknown, (others => False))); end Matreshka.Internals.Unicode.Ucd.Core_0116;
reznikmm/matreshka
Ada
4,568
adb
------------------------------------------------------------------------------ -- -- -- Matreshka Project -- -- -- -- Open Document Toolkit -- -- -- -- Runtime Library Component -- -- -- ------------------------------------------------------------------------------ -- -- -- Copyright © 2014, Vadim Godunko <[email protected]> -- -- All rights reserved. -- -- -- -- Redistribution and use in source and binary forms, with or without -- -- modification, are permitted provided that the following conditions -- -- are met: -- -- -- -- * Redistributions of source code must retain the above copyright -- -- notice, this list of conditions and the following disclaimer. -- -- -- -- * Redistributions in binary form must reproduce the above copyright -- -- notice, this list of conditions and the following disclaimer in the -- -- documentation and/or other materials provided with the distribution. -- -- -- -- * Neither the name of the Vadim Godunko, IE nor the names of its -- -- contributors may be used to endorse or promote products derived from -- -- this software without specific prior written permission. -- -- -- -- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -- -- "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -- -- LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -- -- A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -- -- HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -- -- SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED -- -- TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -- -- PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -- -- LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -- -- NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -- -- SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -- -- -- ------------------------------------------------------------------------------ -- $Revision$ $Date$ ------------------------------------------------------------------------------ with Matreshka.DOM_Documents; with Matreshka.ODF_String_Constants; with ODF.DOM.Iterators; with ODF.DOM.Visitors; package body Matreshka.ODF_Chart.Deep_Attributes is ------------ -- Create -- ------------ overriding function Create (Parameters : not null access Matreshka.DOM_Attributes.Attribute_L2_Parameters) return Chart_Deep_Attribute_Node is begin return Self : Chart_Deep_Attribute_Node do Matreshka.ODF_Chart.Constructors.Initialize (Self'Unchecked_Access, Parameters.Document, Matreshka.ODF_String_Constants.Chart_Prefix); end return; end Create; -------------------- -- Get_Local_Name -- -------------------- overriding function Get_Local_Name (Self : not null access constant Chart_Deep_Attribute_Node) return League.Strings.Universal_String is pragma Unreferenced (Self); begin return Matreshka.ODF_String_Constants.Deep_Attribute; end Get_Local_Name; begin Matreshka.DOM_Documents.Register_Attribute (Matreshka.ODF_String_Constants.Chart_URI, Matreshka.ODF_String_Constants.Deep_Attribute, Chart_Deep_Attribute_Node'Tag); end Matreshka.ODF_Chart.Deep_Attributes;
jrmarino/zstd-ada
Ada
2,642
adb
with Zstandard.Functions; use Zstandard.Functions; with Ada.Command_line; use Ada.Command_Line; with Ada.Directories; use Ada.Directories; with Ada.Text_IO; use Ada.Text_IO; procedure Demo_Ada is begin if Argument_Count < 2 then Put_Line ("Zstandard version: " & Zstd_Version); Put_Line ("usage:"); Put_Line (Command_Name & " <file#1> [additional files] <dictionary>"); return; end if; for z in 1 .. Argument_Count loop if not Exists (Argument (z)) then Put_Line ("File '" & Argument (z) & "' does not exist, aborting."); return; end if; end loop; declare dictionary : String renames Argument (Argument_Count); srcsize : Zstandard.Functions.File_Size; dstsize : Zstandard.Functions.File_Size; goodcomp : Boolean; gooddict : Boolean; units : Natural; tenths : Natural; tenthstr : String (1 .. 2); digest : Compression_Dictionary; begin digest := Create_Compression_Dictionary_From_File (sample_file => dictionary, quality => 3, successful => gooddict); if not gooddict then Put_Line ("Failed to load dictionary"); return; end if; for z in 1 .. Argument_Count - 1 loop declare orig_file : String renames Argument (z); dest_file : String := orig_file & ".zst"; error_msg : String := Compress_File (source_file => orig_file, output_file => dest_file, digest => digest, source_size => srcsize, output_size => dstsize, successful => goodcomp); begin if goodcomp then units := Natural (100 * dstsize / srcsize); tenths := (Natural (10 * dstsize / srcsize)) mod 10; tenthstr := tenths'Img; Put_Line (""); Put_Line (" original file size:" & srcsize'Img); Put_Line (" compressed file size:" & dstsize'Img); Put_Line ("percentage compressed:" & units'Img & "." & tenthstr (2 ..2)); Put_Line (" new file: " & dest_file); else Put_Line (error_msg); end if; end; end loop; Destroy_Compression_Dictionary (digest); end; end Demo_Ada;
Fabien-Chouteau/samd51-hal
Ada
3,190
ads
-- Generated by a script from an "avr tools device file" (atdf) package SAM.Clock_Generator.IDs is TRACE : constant Peripheral_Id := 47; AC : constant Peripheral_Id := 32; ADC0 : constant Peripheral_Id := 40; ADC1 : constant Peripheral_Id := 41; CCL : constant Peripheral_Id := 33; DAC : constant Peripheral_Id := 42; EIC : constant Peripheral_Id := 4; EVSYS_0 : constant Peripheral_Id := 11; EVSYS_1 : constant Peripheral_Id := 12; EVSYS_2 : constant Peripheral_Id := 13; EVSYS_3 : constant Peripheral_Id := 14; EVSYS_4 : constant Peripheral_Id := 15; EVSYS_5 : constant Peripheral_Id := 16; EVSYS_6 : constant Peripheral_Id := 17; EVSYS_7 : constant Peripheral_Id := 18; EVSYS_8 : constant Peripheral_Id := 19; EVSYS_9 : constant Peripheral_Id := 20; EVSYS_10 : constant Peripheral_Id := 21; EVSYS_11 : constant Peripheral_Id := 22; FREQM_MSR : constant Peripheral_Id := 5; FREQM_REF : constant Peripheral_Id := 6; I2S_0 : constant Peripheral_Id := 43; I2S_1 : constant Peripheral_Id := 44; OSCCTRL_DFLL48 : constant Peripheral_Id := 0; OSCCTRL_FDPLL0 : constant Peripheral_Id := 1; OSCCTRL_FDPLL1 : constant Peripheral_Id := 2; OSCCTRL_FDPLL032K : constant Peripheral_Id := 3; OSCCTRL_FDPLL132K : constant Peripheral_Id := 3; PDEC : constant Peripheral_Id := 31; SDHC0 : constant Peripheral_Id := 45; SDHC0_SLOW : constant Peripheral_Id := 3; SERCOM0_CORE : constant Peripheral_Id := 7; SERCOM0_SLOW : constant Peripheral_Id := 3; SERCOM1_CORE : constant Peripheral_Id := 8; SERCOM1_SLOW : constant Peripheral_Id := 3; SERCOM2_CORE : constant Peripheral_Id := 23; SERCOM2_SLOW : constant Peripheral_Id := 3; SERCOM3_CORE : constant Peripheral_Id := 24; SERCOM3_SLOW : constant Peripheral_Id := 3; SERCOM4_CORE : constant Peripheral_Id := 34; SERCOM4_SLOW : constant Peripheral_Id := 3; SERCOM5_CORE : constant Peripheral_Id := 35; SERCOM5_SLOW : constant Peripheral_Id := 3; TC0 : constant Peripheral_Id := 9; TC1 : constant Peripheral_Id := 9; TC2 : constant Peripheral_Id := 26; TC3 : constant Peripheral_Id := 26; TC4 : constant Peripheral_Id := 30; TC5 : constant Peripheral_Id := 30; TCC0 : constant Peripheral_Id := 25; TCC1 : constant Peripheral_Id := 25; TCC2 : constant Peripheral_Id := 29; TCC3 : constant Peripheral_Id := 29; TCC4 : constant Peripheral_Id := 38; USB : constant Peripheral_Id := 10; end SAM.Clock_Generator.IDs;
reznikmm/matreshka
Ada
3,993
ads
------------------------------------------------------------------------------ -- -- -- Matreshka Project -- -- -- -- Open Document Toolkit -- -- -- -- Runtime Library Component -- -- -- ------------------------------------------------------------------------------ -- -- -- Copyright © 2014, Vadim Godunko <[email protected]> -- -- 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 ODF.DOM.Draw_Show_Unit_Attributes; package Matreshka.ODF_Draw.Show_Unit_Attributes is type Draw_Show_Unit_Attribute_Node is new Matreshka.ODF_Draw.Abstract_Draw_Attribute_Node and ODF.DOM.Draw_Show_Unit_Attributes.ODF_Draw_Show_Unit_Attribute with null record; overriding function Create (Parameters : not null access Matreshka.DOM_Attributes.Attribute_L2_Parameters) return Draw_Show_Unit_Attribute_Node; overriding function Get_Local_Name (Self : not null access constant Draw_Show_Unit_Attribute_Node) return League.Strings.Universal_String; end Matreshka.ODF_Draw.Show_Unit_Attributes;
MinimSecure/unum-sdk
Ada
798
adb
-- Copyright 2013-2016 Free Software Foundation, Inc. -- -- This program is free software; you can redistribute it and/or modify -- it under the terms of the GNU General Public License as published by -- the Free Software Foundation; either version 3 of the License, or -- (at your option) any later version. -- -- This program is distributed in the hope that it will be useful, -- but WITHOUT ANY WARRANTY; without even the implied warranty of -- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -- GNU General Public License for more details. -- -- You should have received a copy of the GNU General Public License -- along with this program. If not, see <http://www.gnu.org/licenses/>. with Const; use Const; procedure Foo is begin raise Aint_Global_GDB_E; end Foo;
Tim-Tom/project-euler
Ada
4,480
adb
with Ada.Text_IO; with Ada.Integer_Text_IO; with Ada.Containers.Vectors; package body Problem_59 is package IO renames Ada.Text_IO; package I_IO renames Ada.Integer_Text_IO; package Character_Vector is new Ada.Containers.Vectors(Index_Type => Positive, Element_Type => Character); procedure Solve is function Count_Input return Natural is input : IO.File_Type; count : Natural := 0; unused : Integer := 0; begin IO.Open(input, IO.In_File, "input/Problem_59.txt"); while not IO.End_Of_File(input) loop I_IO.Get(input, unused); count := count + 1; end loop; IO.Close(input); return count; end; Length : constant Natural := Count_Input; type Byte is mod 2**8; type Text_Array is Array (1 .. Length) of Byte; type Key_Array is Array (1 .. 3) of Byte; encrypted : Text_Array; -- decrypted : Text_Array; procedure Read_Input(result : out Text_Array) is input : IO.File_Type; begin IO.Open(input, IO.In_File, "input/Problem_59.txt"); for index in result'Range loop I_IO.Get(input, Natural(result(index))); end loop; IO.Close(input); end Read_Input; function Is_Valid(b : Byte) return Boolean is begin return (b >= 10 and then b <= 13) or else (b >= 32 and then b <= 126); end Is_Valid; pragma Pure_Function(Is_Valid); function Validate(encrypted : Text_Array; key: in Byte; offset : in Natural) return Boolean is index : Positive range Text_Array'Range := Text_Array'First + offset; begin loop if not Is_Valid(encrypted(index) xor key) then return False; end if; exit when index + Key_Array'Length > Text_Array'Last; index := index + Key_Array'Length; end loop; return True; end Validate; procedure Decrypt(encrypted : Text_Array; key : in Key_Array ; decrypted : out Text_Array) is current_key : Positive := key'First; begin for index in encrypted'Range loop decrypted(index) := encrypted(index) xor key(current_key); current_key := current_key + 1; if current_key > 3 then current_key := 1; end if; end loop; end Decrypt; valid_Characters : Array (Key_Array'Range) of Character_Vector.Vector; possible_solutions : Natural := 1; begin IO.Put_Line("GOD"); return; Read_Input(encrypted); for ch in Character range 'a' .. 'z' loop for index in valid_Characters'Range loop if Validate(encrypted, Character'Pos(ch), index - 1) then valid_Characters(index).Append(ch); end if; end loop; end loop; for valid_Vector of valid_Characters loop possible_solutions := possible_solutions * Natural(valid_Vector.Length); end loop; if possible_solutions = 0 then IO.Put_Line("Unable to encounter a solution in printable ASCII"); return; end if; declare solutions : Array (1 .. possible_solutions) of Text_Array; begin declare solution_index : Positive := solutions'First; key : Key_Array; begin for fst of valid_Characters(1) loop key(1) := Character'Pos(fst); for snd of valid_Characters(2) loop key(2) := Character'Pos(snd); for thd of valid_Characters(3) loop key(3) := Character'Pos(thd); Decrypt(encrypted, key, solutions(solution_index)); solution_index := solution_index + 1; end loop; end loop; end loop; end; for solution_index in solutions'Range loop declare solution : Text_Array renames solutions(solution_index); combined : String(solution'Range); begin for index in solution'Range loop combined(index) := Character'Val(solutions(solution_index)(index)); end loop; IO.Put_Line(combined); end; end loop; end; IO.Put_Line("The Answer"); end Solve; end Problem_59;
AdaDoom3/wayland_ada_binding
Ada
3,815
ads
------------------------------------------------------------------------------ -- Copyright (C) 2015-2016, AdaCore -- -- -- -- This library is free software; you can redistribute it and/or modify it -- -- under terms of the GNU General Public License as published by the Free -- -- Software Foundation; either version 3, or (at your option) any later -- -- version. This library is distributed in the hope that it will be useful, -- -- but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHAN- -- -- TABILITY or FITNESS FOR A PARTICULAR PURPOSE. -- -- -- -- As a special exception under Section 7 of GPL version 3, you are granted -- -- additional permissions described in the GCC Runtime Library Exception, -- -- version 3.1, as published by the Free Software Foundation. -- -- -- -- 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/>. -- -- -- ------------------------------------------------------------------------------ -- The implementation for bounded vectors of definite elements. -- This implementation does not perform any memory allocation. -- It is compatible with SPARK. pragma Ada_2012; with Conts.Elements.Definite; generic with package Elements is new Conts.Elements.Definite (<>); package Conts.Vectors.Storage.Bounded_Definite with SPARK_Mode is subtype Stored_Type is Elements.Traits.Stored; package Impl is type Container (Capacity : Count_Type) is abstract tagged private; function Max_Capacity (Self : Container'Class) return Count_Type is (Self.Capacity) with Inline; function Capacity (Self : Container'Class) return Count_Type is (Self.Capacity) with Inline; procedure Set_Element (Self : in out Container'Class; Index : Count_Type; Element : Stored_Type) with Inline; function Get_Element (Self : Container'Class; Index : Count_Type) return Stored_Type with Inline; procedure Assign (Self : in out Container'Class; Source : Container'Class; Last : Count_Type); procedure Copy (Self : in out Container'Class; Source : Container'Class; Source_From, Source_To : Count_Type; Self_From : Count_Type) with Inline; private pragma SPARK_Mode (Off); type Elem_Array is array (Count_Type range <>) of Stored_Type; type Container (Capacity : Count_Type) is abstract tagged record Nodes : Elem_Array (Min_Index .. Capacity); end record; function Get_Element (Self : Container'Class; Index : Count_Type) return Stored_Type is (Self.Nodes (Index)); end Impl; package Traits is new Conts.Vectors.Storage.Traits (Elements => Elements.Traits, Container => Impl.Container, Max_Capacity => Impl.Max_Capacity, Capacity => Impl.Capacity, Set_Element => Impl.Set_Element, Get_Element => Impl.Get_Element, Assign => Impl.Assign, Copy => Impl.Copy); end Conts.Vectors.Storage.Bounded_Definite;
reznikmm/matreshka
Ada
4,043
ads
------------------------------------------------------------------------------ -- -- -- Matreshka Project -- -- -- -- Open Document Toolkit -- -- -- -- Runtime Library Component -- -- -- ------------------------------------------------------------------------------ -- -- -- Copyright © 2014, Vadim Godunko <[email protected]> -- -- 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 ODF.DOM.Grddl_Transformation_Attributes; package Matreshka.ODF_Grddl.Transformation_Attributes is type Grddl_Transformation_Attribute_Node is new Matreshka.ODF_Grddl.Abstract_Grddl_Attribute_Node and ODF.DOM.Grddl_Transformation_Attributes.ODF_Grddl_Transformation_Attribute with null record; overriding function Create (Parameters : not null access Matreshka.DOM_Attributes.Attribute_L2_Parameters) return Grddl_Transformation_Attribute_Node; overriding function Get_Local_Name (Self : not null access constant Grddl_Transformation_Attribute_Node) return League.Strings.Universal_String; end Matreshka.ODF_Grddl.Transformation_Attributes;
Letractively/ada-ado
Ada
7,815
ads
----------------------------------------------------------------------- -- ADO Sessions -- Sessions Management -- Copyright (C) 2009, 2010, 2011, 2012, 2013 Stephane Carrez -- Written by Stephane Carrez ([email protected]) -- -- Licensed under the Apache License, Version 2.0 (the "License"); -- you may not use this file except in compliance with the License. -- You may obtain a copy of the License at -- -- http://www.apache.org/licenses/LICENSE-2.0 -- -- Unless required by applicable law or agreed to in writing, software -- distributed under the License is distributed on an "AS IS" BASIS, -- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -- See the License for the specific language governing permissions and -- limitations under the License. ----------------------------------------------------------------------- with Ada.Finalization; with ADO.Schemas; with ADO.Statements; with ADO.Objects; with ADO.Objects.Cache; with ADO.Databases; with ADO.Queries; with ADO.SQL; with Util.Concurrent.Counters; limited with ADO.Sequences; limited with ADO.Schemas.Entities; package ADO.Sessions is use ADO.Statements; -- Raised for all errors reported by the database DB_Error : exception; -- Raised if the database connection is not open. NOT_OPEN : exception; NOT_FOUND : exception; NO_DATABASE : exception; -- Raised when the connection URI is invalid. Connection_Error : exception; type Object_Factory is tagged private; -- --------- -- Session -- --------- -- Read-only database connection (or slave connection). -- type Session is tagged private; -- Get the session status. function Get_Status (Database : in Session) return ADO.Databases.Connection_Status; -- Close the session. procedure Close (Database : in out Session); -- Get the database connection. function Get_Connection (Database : in Session) return ADO.Databases.Connection'Class; -- Attach the object to the session. procedure Attach (Database : in out Session; Object : in ADO.Objects.Object_Ref'Class); -- Check if the session contains the object identified by the given key. function Contains (Database : in Session; Item : in ADO.Objects.Object_Key) return Boolean; -- Remove the object from the session cache. procedure Evict (Database : in out Session; Item : in ADO.Objects.Object_Key); -- Create a query statement. The statement is not prepared function Create_Statement (Database : in Session; Table : in ADO.Schemas.Class_Mapping_Access) return Query_Statement; -- Create a query statement. The statement is not prepared function Create_Statement (Database : in Session; Query : in String) return Query_Statement; -- Create a query statement. The statement is not prepared function Create_Statement (Database : in Session; Query : in ADO.Queries.Context'Class) return Query_Statement; -- Create a query statement and initialize the SQL statement with the query definition. function Create_Statement (Database : in Session; Query : in ADO.Queries.Query_Definition_Access) return Query_Statement; -- Create a query statement. The statement is not prepared function Create_Statement (Database : in Session; Query : in ADO.SQL.Query'Class; Table : in ADO.Schemas.Class_Mapping_Access) return Query_Statement; -- --------- -- Master Session -- --------- -- Read-write session. -- type Master_Session is new Session with private; -- Start a transaction. procedure Begin_Transaction (Database : in out Master_Session); -- Commit the current transaction. procedure Commit (Database : in out Master_Session); -- Rollback the current transaction. procedure Rollback (Database : in out Master_Session); -- Allocate an identifier for the table. procedure Allocate (Database : in out Master_Session; Id : in out ADO.Objects.Object_Record'Class); -- Flush the objects that were modified. procedure Flush (Database : in out Master_Session); -- Create a delete statement function Create_Statement (Database : in Master_Session; Table : in ADO.Schemas.Class_Mapping_Access) return Delete_Statement; -- Create an update statement function Create_Statement (Database : in Master_Session; Table : in ADO.Schemas.Class_Mapping_Access) return Update_Statement; -- Create an insert statement function Create_Statement (Database : in Master_Session; Table : in ADO.Schemas.Class_Mapping_Access) return Insert_Statement; -- Internal method to get the session proxy associated with the given database session. -- The session proxy is associated with some ADO objects to be able to retrieve the database -- session for the implementation of lazy loading. The session proxy is kept until the -- session exist and at least one ADO object is refering to it. function Get_Session_Proxy (Database : in Session) return ADO.Objects.Session_Proxy_Access; type Session_Record is limited private; type Session_Record_Access is access all Session_Record; private type Entity_Cache_Access is access constant ADO.Schemas.Entities.Entity_Cache; type Object_Factory is tagged record A : Integer; end record; type Object_Factory_Access is access all Object_Factory'Class; -- -- type Session_Proxy is limited record -- Counter : Util.Concurrent.Counters.Counter; -- Session : Session_Record_Access; -- Factory : Object_Factory_Access; -- end record; -- The <b>Session_Record</b> maintains the connection information to the database for -- the duration of the session. It also maintains a cache of application objects -- which is used when session objects are fetched (either through Load or a Find). -- The connection is released and the session record is deleted when the session -- is closed with <b>Close</b>. -- -- For the lazy loading support, each object is associated with a shared <b>Session_Proxy</b> -- object that allows to give access to the session record associated with the object. -- When a session is closed, the <b>Session_Proxy</b> is not deleted but it is simply -- unlinked from the session record. type Session_Record is limited record Counter : Util.Concurrent.Counters.Counter := Util.Concurrent.Counters.ONE; Database : ADO.Databases.Master_Connection; Proxy : ADO.Objects.Session_Proxy_Access; Cache : ADO.Objects.Cache.Object_Cache; Entities : Entity_Cache_Access; end record; type Session is new Ada.Finalization.Controlled with record Impl : Session_Record_Access := null; end record; overriding procedure Adjust (Object : in out Session); overriding procedure Finalize (Object : in out Session); type Factory_Access is access all ADO.Sequences.Factory; type Master_Session is new Session with record Sequences : Factory_Access; end record; procedure Check_Session (Database : in Session'Class; Message : in String := ""); pragma Inline (Check_Session); end ADO.Sessions;
caqg/linux-home
Ada
1,688
ads
-- Abstract : -- -- Run the Ada LALR parser standalone. Useful for debugging grammar issues. -- -- Copyright (C) 2017 - 2020, 2022 Free Software Foundation, Inc. -- -- This program is free software; you can redistribute it and/or -- modify it under terms of the GNU General Public License as -- published by the Free Software Foundation; either version 3, or (at -- your option) any later version. This 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 -- distributed with this program; see file COPYING. If not, write to -- the Free Software Foundation, 51 Franklin Street, Suite 500, Boston, -- MA 02110-1335, USA. pragma License (GPL); with Ada_Annex_P_Process_Actions; with Ada_Annex_P_Process_LALR_Main; with Gen_Run_Wisi_LR_Parse; with WisiToken.Parse.LR.McKenzie_Recover.Ada; with Wisi.Ada; procedure Run_Ada_LALR_Parse is new Gen_Run_Wisi_LR_Parse (Wisi.Ada.Parse_Data_Type, Ada_Annex_P_Process_Actions.Descriptor'Access, Ada_Annex_P_Process_Actions.Partial_Parse_Active'Access, Ada_Annex_P_Process_Actions.Partial_Parse_Byte_Goal'Access, WisiToken.Parse.LR.McKenzie_Recover.Ada.Language_Fixes'Access, WisiToken.Parse.LR.McKenzie_Recover.Ada.Matching_Begin_Tokens'Access, WisiToken.Parse.LR.McKenzie_Recover.Ada.String_ID_Set'Access, Ada_Annex_P_Process_LALR_Main.Create_Lexer, Ada_Annex_P_Process_LALR_Main.Create_Parse_Table, Ada_Annex_P_Process_LALR_Main.Create_Productions);
GLADORG/glad-cli
Ada
1,634
adb
with Ada.Text_IO; with Ada.Directories; with Ada.Containers.Vectors; with Init_Project; with Blueprint; use Blueprint; package body Commands.Create is package IO renames Ada.Text_IO; package TT renames CLIC.TTY; package Dir renames Ada.Directories; use Ada.Directories; use Ada.Containers; ------------- -- Execute -- ------------- overriding procedure Execute ( Cmd : in out Command; Args : AAA.Strings.Vector) is begin if Args.Length > 0 then declare Path : String := Args.First_Element; ToDo : Action := Write; begin if Cmd.Dry_Run then IO.Put_Line(TT.Emph("You specified the dry-run flag, so no changes will be written.")); ToDo := DryRun; end if; if not Dir.Exists(Path) then if ToDo = Write then Dir.Create_Directory(Path); end if; end if; if Dir.Kind(Path) = Ada.Directories.Directory then Init_Project.Init(Path,ToDo); else IO.Put_Line(TT.Error(Path & " exists and is not a directory.")); end if; end; else IO.Put_Line(TT.Error("Command requires a project name to be specified.")); end if; end Execute; -------------------- -- Setup_Switches -- -------------------- overriding procedure Setup_Switches (Cmd : in out Command; Config : in out CLIC.Subcommand.Switches_Configuration) is use CLIC.Subcommand; begin Define_Switch (Config, Cmd.Dry_Run'Access, "", "-dry-run", "Dry-run"); end Setup_Switches; end Commands.Create;
charlie5/cBound
Ada
1,612
ads
-- This file is generated by SWIG. Please do not modify by hand. -- with Interfaces; with swig; with Interfaces.C; with Interfaces.C.Pointers; package xcb.xcb_list_extensions_reply_t is -- Item -- type Item is record response_type : aliased Interfaces.Unsigned_8; names_len : aliased Interfaces.Unsigned_8; sequence : aliased Interfaces.Unsigned_16; length : aliased Interfaces.Unsigned_32; pad0 : aliased swig.int8_t_Array (0 .. 23); end record; -- Item_Array -- type Item_Array is array (Interfaces.C .size_t range <>) of aliased xcb.xcb_list_extensions_reply_t .Item; -- Pointer -- package C_Pointers is new Interfaces.C.Pointers (Index => Interfaces.C.size_t, Element => xcb.xcb_list_extensions_reply_t.Item, Element_Array => xcb.xcb_list_extensions_reply_t.Item_Array, Default_Terminator => (others => <>)); subtype Pointer is C_Pointers.Pointer; -- Pointer_Array -- type Pointer_Array is array (Interfaces.C .size_t range <>) of aliased xcb.xcb_list_extensions_reply_t .Pointer; -- Pointer_Pointer -- package C_Pointer_Pointers is new Interfaces.C.Pointers (Index => Interfaces.C.size_t, Element => xcb.xcb_list_extensions_reply_t.Pointer, Element_Array => xcb.xcb_list_extensions_reply_t.Pointer_Array, Default_Terminator => null); subtype Pointer_Pointer is C_Pointer_Pointers.Pointer; end xcb.xcb_list_extensions_reply_t;
mfkiwl/ewok-kernel-security-OS
Ada
10,015
adb
-- -- Copyright 2018 The wookey project team <[email protected]> -- - Ryad Benadjila -- - Arnauld Michelizza -- - Mathieu Renard -- - Philippe Thierry -- - Philippe Trebuchet -- -- Licensed under the Apache License, Version 2.0 (the "License"); -- you may not use this file except in compliance with the License. -- You may obtain a copy of the License at -- -- http://www.apache.org/licenses/LICENSE-2.0 -- -- Unless required by applicable law or agreed to in writing, software -- distributed under the License is distributed on an "AS IS" BASIS, -- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -- See the License for the specific language governing permissions and -- limitations under the License. -- -- with ewok.tasks; use ewok.tasks; with ewok.tasks_shared; use ewok.tasks_shared; with ewok.sched; with ewok.sanitize; with ewok.syscalls.cfg.dev; with ewok.syscalls.cfg.gpio; with ewok.syscalls.gettick; with ewok.syscalls.init; with ewok.syscalls.ipc; with ewok.syscalls.lock; with ewok.syscalls.log; with ewok.syscalls.reset; with ewok.syscalls.rng; with ewok.syscalls.sleep; with ewok.syscalls.yield; with ewok.syscalls.exiting; with ewok.syscalls.alarm; with ewok.exported.interrupts; use type ewok.exported.interrupts.t_interrupt_config_access; with ewok.debug; #if CONFIG_KERNEL_DMA_ENABLE with ewok.syscalls.dma; #end if; with m4.cpu.instructions; package body ewok.syscalls.handler with spark_mode => off is type t_task_access is access all ewok.tasks.t_task; function svc_handler (frame_a : t_stack_frame_access) return t_stack_frame_access is current_id : constant t_task_id := ewok.sched.current_task_id; current_a : constant t_task_access := ewok.tasks.tasks_list(current_id)'access; svc_params_a : t_parameters_access := NULL; svc : t_svc; begin -- -- We must save the frame pointer because synchronous syscall don't refer -- to the parameters on the stack indexed by 'frame_a' but to -- 'current_a' (they access 'frame_a' via 'current_a.all.ctx.frame_a' -- or 'current_a.all.isr_ctx.frame_a') -- if current_a.all.mode = TASK_MODE_MAINTHREAD then current_a.all.ctx.frame_a := frame_a; else current_a.all.isr_ctx.frame_a := frame_a; end if; -- -- Getting the svc number from the SVC instruction -- declare inst : m4.cpu.instructions.t_svc_instruction with import, address => to_address (frame_a.all.PC - 2); begin if not inst.opcode'valid then raise program_error; end if; declare svc_type : t_svc with address => inst.svc_num'address; begin if not svc_type'valid then ewok.tasks.set_state (current_id, TASK_MODE_MAINTHREAD, TASK_STATE_FAULT); set_return_value (current_id, current_a.all.mode, SYS_E_DENIED); return frame_a; end if; svc := svc_type; end; end; -- -- Getting svc parameters from caller's stack -- if ewok.sanitize.is_range_in_data_region (frame_a.all.R0, t_parameters'size/8, current_id, current_a.all.mode) then svc_params_a := to_parameters_access (frame_a.all.R0); else if svc /= SVC_EXIT and svc /= SVC_YIELD and svc /= SVC_RESET and svc /= SVC_INIT_DONE and svc /= SVC_LOCK_ENTER and svc /= SVC_LOCK_EXIT and svc /= SVC_PANIC then -- R0 points outside the caller's data area pragma DEBUG (debug.log (debug.ERROR, current_a.all.name & "svc_handler(): invalid @parameters: " & unsigned_32'image (frame_a.all.R0))); ewok.tasks.set_state (current_id, TASK_MODE_MAINTHREAD, TASK_STATE_RUNNABLE); set_return_value (current_id, current_a.all.mode, SYS_E_DENIED); return frame_a; end if; end if; ------------------- -- Managing SVCs -- ------------------- case svc is when SVC_EXIT => ewok.syscalls.exiting.svc_exit (current_id, current_a.all.mode); return ewok.sched.do_schedule (frame_a); when SVC_YIELD => ewok.syscalls.yield.svc_yield (current_id, current_a.all.mode); return frame_a; when SVC_GET_TIME => ewok.syscalls.gettick.svc_gettick (current_id, svc_params_a.all, current_a.all.mode); return frame_a; when SVC_RESET => ewok.syscalls.reset.svc_reset (current_id, current_a.all.mode); return frame_a; when SVC_SLEEP => ewok.syscalls.sleep.svc_sleep (current_id, svc_params_a.all, current_a.all.mode); return frame_a; when SVC_GET_RANDOM => ewok.syscalls.rng.svc_get_random (current_id, svc_params_a.all, current_a.all.mode); return frame_a; when SVC_LOG => ewok.syscalls.log.svc_log (current_id, svc_params_a.all, current_a.all.mode); return frame_a; when SVC_REGISTER_DEVICE => ewok.syscalls.init.svc_register_device (current_id, svc_params_a.all, current_a.all.mode); return frame_a; when SVC_REGISTER_DMA => #if CONFIG_KERNEL_DMA_ENABLE ewok.syscalls.dma.svc_register_dma (current_id, svc_params_a.all, current_a.all.mode); #else set_return_value (current_id, current_a.all.mode, SYS_E_DENIED); #end if; return frame_a; when SVC_REGISTER_DMA_SHM => #if CONFIG_KERNEL_DMA_ENABLE ewok.syscalls.dma.svc_register_dma_shm (current_id, svc_params_a.all, current_a.all.mode); #else set_return_value (current_id, current_a.all.mode, SYS_E_DENIED); #end if; return frame_a; when SVC_GET_TASKID => ewok.syscalls.init.svc_get_taskid (current_id, svc_params_a.all, current_a.all.mode); return frame_a; when SVC_INIT_DONE => ewok.syscalls.init.svc_init_done (current_id, current_a.all.mode); return frame_a; when SVC_IPC_RECV_SYNC => ewok.syscalls.ipc.svc_ipc_do_recv (current_id, svc_params_a.all, true, current_a.all.mode); return ewok.sched.do_schedule (frame_a); when SVC_IPC_SEND_SYNC => ewok.syscalls.ipc.svc_ipc_do_send (current_id, svc_params_a.all, true, current_a.all.mode); return ewok.sched.do_schedule (frame_a); when SVC_IPC_RECV_ASYNC => ewok.syscalls.ipc.svc_ipc_do_recv (current_id, svc_params_a.all, false, current_a.all.mode); return ewok.sched.do_schedule (frame_a); when SVC_IPC_SEND_ASYNC => ewok.syscalls.ipc.svc_ipc_do_send (current_id, svc_params_a.all, false, current_a.all.mode); return ewok.sched.do_schedule (frame_a); when SVC_GPIO_SET => ewok.syscalls.cfg.gpio.svc_gpio_set (current_id, svc_params_a.all, current_a.all.mode); return frame_a; when SVC_GPIO_GET => ewok.syscalls.cfg.gpio.svc_gpio_get (current_id, svc_params_a.all, current_a.all.mode); return frame_a; when SVC_GPIO_UNLOCK_EXTI => ewok.syscalls.cfg.gpio.svc_gpio_unlock_exti (current_id, svc_params_a.all, current_a.all.mode); return frame_a; when SVC_DMA_RECONF => #if CONFIG_KERNEL_DMA_ENABLE ewok.syscalls.dma.svc_dma_reconf (current_id, svc_params_a.all, current_a.all.mode); #else set_return_value (current_id, current_a.all.mode, SYS_E_DENIED); #end if; return frame_a; when SVC_DMA_RELOAD => #if CONFIG_KERNEL_DMA_ENABLE ewok.syscalls.dma.svc_dma_reload (current_id, svc_params_a.all, current_a.all.mode); #else set_return_value (current_id, current_a.all.mode, SYS_E_DENIED); #end if; return frame_a; when SVC_DMA_DISABLE => #if CONFIG_KERNEL_DMA_ENABLE ewok.syscalls.dma.svc_dma_disable (current_id, svc_params_a.all, current_a.all.mode); #else set_return_value (current_id, current_a.all.mode, SYS_E_DENIED); #end if; return frame_a; when SVC_DEV_MAP => ewok.syscalls.cfg.dev.svc_dev_map (current_id, svc_params_a.all, current_a.all.mode); return frame_a; when SVC_DEV_UNMAP => ewok.syscalls.cfg.dev.svc_dev_unmap (current_id, svc_params_a.all, current_a.all.mode); return frame_a; when SVC_DEV_RELEASE => ewok.syscalls.cfg.dev.svc_dev_release (current_id, svc_params_a.all, current_a.all.mode); return frame_a; when SVC_LOCK_ENTER => ewok.syscalls.lock.svc_lock_enter (current_id, current_a.all.mode); return frame_a; when SVC_LOCK_EXIT => ewok.syscalls.lock.svc_lock_exit (current_id, current_a.all.mode); return frame_a; when SVC_PANIC => ewok.syscalls.exiting.svc_panic (current_id); return ewok.sched.do_schedule (frame_a); when SVC_ALARM => ewok.syscalls.alarm.svc_alarm (current_id, svc_params_a.all, current_a.all.mode); return frame_a; end case; end svc_handler; end ewok.syscalls.handler;
reznikmm/matreshka
Ada
3,951
ads
------------------------------------------------------------------------------ -- -- -- Matreshka Project -- -- -- -- Open Document Toolkit -- -- -- -- Runtime Library Component -- -- -- ------------------------------------------------------------------------------ -- -- -- Copyright © 2014, Vadim Godunko <[email protected]> -- -- 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 ODF.DOM.Svg_Stemh_Attributes; package Matreshka.ODF_Svg.Stemh_Attributes is type Svg_Stemh_Attribute_Node is new Matreshka.ODF_Svg.Abstract_Svg_Attribute_Node and ODF.DOM.Svg_Stemh_Attributes.ODF_Svg_Stemh_Attribute with null record; overriding function Create (Parameters : not null access Matreshka.DOM_Attributes.Attribute_L2_Parameters) return Svg_Stemh_Attribute_Node; overriding function Get_Local_Name (Self : not null access constant Svg_Stemh_Attribute_Node) return League.Strings.Universal_String; end Matreshka.ODF_Svg.Stemh_Attributes;
reznikmm/matreshka
Ada
4,613
adb
------------------------------------------------------------------------------ -- -- -- Matreshka Project -- -- -- -- Open Document Toolkit -- -- -- -- Runtime Library Component -- -- -- ------------------------------------------------------------------------------ -- -- -- Copyright © 2014, Vadim Godunko <[email protected]> -- -- All rights reserved. -- -- -- -- Redistribution and use in source and binary forms, with or without -- -- modification, are permitted provided that the following conditions -- -- are met: -- -- -- -- * Redistributions of source code must retain the above copyright -- -- notice, this list of conditions and the following disclaimer. -- -- -- -- * Redistributions in binary form must reproduce the above copyright -- -- notice, this list of conditions and the following disclaimer in the -- -- documentation and/or other materials provided with the distribution. -- -- -- -- * Neither the name of the Vadim Godunko, IE nor the names of its -- -- contributors may be used to endorse or promote products derived from -- -- this software without specific prior written permission. -- -- -- -- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -- -- "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -- -- LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -- -- A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -- -- HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -- -- SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED -- -- TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -- -- PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -- -- LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -- -- NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -- -- SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -- -- -- ------------------------------------------------------------------------------ -- $Revision$ $Date$ ------------------------------------------------------------------------------ with Matreshka.DOM_Documents; with Matreshka.ODF_String_Constants; with ODF.DOM.Iterators; with ODF.DOM.Visitors; package body Matreshka.ODF_Fo.Margin_Bottom_Attributes is ------------ -- Create -- ------------ overriding function Create (Parameters : not null access Matreshka.DOM_Attributes.Attribute_L2_Parameters) return Fo_Margin_Bottom_Attribute_Node is begin return Self : Fo_Margin_Bottom_Attribute_Node do Matreshka.ODF_Fo.Constructors.Initialize (Self'Unchecked_Access, Parameters.Document, Matreshka.ODF_String_Constants.Fo_Prefix); end return; end Create; -------------------- -- Get_Local_Name -- -------------------- overriding function Get_Local_Name (Self : not null access constant Fo_Margin_Bottom_Attribute_Node) return League.Strings.Universal_String is pragma Unreferenced (Self); begin return Matreshka.ODF_String_Constants.Margin_Bottom_Attribute; end Get_Local_Name; begin Matreshka.DOM_Documents.Register_Attribute (Matreshka.ODF_String_Constants.Fo_URI, Matreshka.ODF_String_Constants.Margin_Bottom_Attribute, Fo_Margin_Bottom_Attribute_Node'Tag); end Matreshka.ODF_Fo.Margin_Bottom_Attributes;
AdaCore/training_material
Ada
22,517
ads
pragma Ada_2005; pragma Style_Checks (Off); with Interfaces.C; use Interfaces.C; with SDL_SDL_stdinc_h; with System; with Interfaces.C.Extensions; with Interfaces.C.Strings; limited with SDL_SDL_rwops_h; package SDL_SDL_video_h is SDL_ALPHA_OPAQUE : constant := 255; -- ../include/SDL/SDL_video.h:44 SDL_ALPHA_TRANSPARENT : constant := 0; -- ../include/SDL/SDL_video.h:45 -- unsupported macro: SDL_Colour SDL_Color SDL_SWSURFACE : constant := 16#00000000#; -- ../include/SDL/SDL_video.h:131 SDL_HWSURFACE : constant := 16#00000001#; -- ../include/SDL/SDL_video.h:132 SDL_ASYNCBLIT : constant := 16#00000004#; -- ../include/SDL/SDL_video.h:133 SDL_ANYFORMAT : constant := 16#10000000#; -- ../include/SDL/SDL_video.h:138 SDL_HWPALETTE : constant := 16#20000000#; -- ../include/SDL/SDL_video.h:139 SDL_DOUBLEBUF : constant := 16#40000000#; -- ../include/SDL/SDL_video.h:140 SDL_FULLSCREEN : constant := 16#80000000#; -- ../include/SDL/SDL_video.h:141 SDL_OPENGL : constant := 16#00000002#; -- ../include/SDL/SDL_video.h:142 SDL_OPENGLBLIT : constant := 16#0000000A#; -- ../include/SDL/SDL_video.h:143 SDL_RESIZABLE : constant := 16#00000010#; -- ../include/SDL/SDL_video.h:144 SDL_NOFRAME : constant := 16#00000020#; -- ../include/SDL/SDL_video.h:145 SDL_HWACCEL : constant := 16#00000100#; -- ../include/SDL/SDL_video.h:150 SDL_SRCCOLORKEY : constant := 16#00001000#; -- ../include/SDL/SDL_video.h:151 SDL_RLEACCELOK : constant := 16#00002000#; -- ../include/SDL/SDL_video.h:152 SDL_RLEACCEL : constant := 16#00004000#; -- ../include/SDL/SDL_video.h:153 SDL_SRCALPHA : constant := 16#00010000#; -- ../include/SDL/SDL_video.h:154 SDL_PREALLOC : constant := 16#01000000#; -- ../include/SDL/SDL_video.h:155 -- arg-macro: function SDL_MUSTLOCK (surface) -- return surface.offset or else ((surface.flags and (SDL_HWSURFACEorSDL_ASYNCBLITorSDL_RLEACCEL)) /= 0); SDL_YV12_OVERLAY : constant := 16#32315659#; -- ../include/SDL/SDL_video.h:200 SDL_IYUV_OVERLAY : constant := 16#56555949#; -- ../include/SDL/SDL_video.h:201 SDL_YUY2_OVERLAY : constant := 16#32595559#; -- ../include/SDL/SDL_video.h:202 SDL_UYVY_OVERLAY : constant := 16#59565955#; -- ../include/SDL/SDL_video.h:203 SDL_YVYU_OVERLAY : constant := 16#55595659#; -- ../include/SDL/SDL_video.h:204 SDL_LOGPAL : constant := 16#01#; -- ../include/SDL/SDL_video.h:252 SDL_PHYSPAL : constant := 16#02#; -- ../include/SDL/SDL_video.h:253 -- unsupported macro: SDL_AllocSurface SDL_CreateRGBSurface -- arg-macro: procedure SDL_LoadBMP (file) -- SDL_LoadBMP_RW(SDL_RWFromFile(file, "rb"), 1) -- arg-macro: procedure SDL_SaveBMP (surface, file) -- SDL_SaveBMP_RW(surface, SDL_RWFromFile(file, "wb"), 1) -- unsupported macro: SDL_BlitSurface SDL_UpperBlit type SDL_Rect is record x : aliased SDL_SDL_stdinc_h.Sint16; -- ../include/SDL/SDL_video.h:51 y : aliased SDL_SDL_stdinc_h.Sint16; -- ../include/SDL/SDL_video.h:51 w : aliased SDL_SDL_stdinc_h.Uint16; -- ../include/SDL/SDL_video.h:52 h : aliased SDL_SDL_stdinc_h.Uint16; -- ../include/SDL/SDL_video.h:52 end record; pragma Convention (C_Pass_By_Copy, SDL_Rect); -- ../include/SDL/SDL_video.h:50 type SDL_Color is record r : aliased SDL_SDL_stdinc_h.Uint8; -- ../include/SDL/SDL_video.h:56 g : aliased SDL_SDL_stdinc_h.Uint8; -- ../include/SDL/SDL_video.h:57 b : aliased SDL_SDL_stdinc_h.Uint8; -- ../include/SDL/SDL_video.h:58 unused : aliased SDL_SDL_stdinc_h.Uint8; -- ../include/SDL/SDL_video.h:59 end record; pragma Convention (C_Pass_By_Copy, SDL_Color); -- ../include/SDL/SDL_video.h:55 type SDL_Palette is record ncolors : aliased int; -- ../include/SDL/SDL_video.h:64 colors : access SDL_Color; -- ../include/SDL/SDL_video.h:65 end record; pragma Convention (C_Pass_By_Copy, SDL_Palette); -- ../include/SDL/SDL_video.h:63 type SDL_PixelFormat is record palette : access SDL_Palette; -- ../include/SDL/SDL_video.h:71 BitsPerPixel : aliased SDL_SDL_stdinc_h.Uint8; -- ../include/SDL/SDL_video.h:72 BytesPerPixel : aliased SDL_SDL_stdinc_h.Uint8; -- ../include/SDL/SDL_video.h:73 Rloss : aliased SDL_SDL_stdinc_h.Uint8; -- ../include/SDL/SDL_video.h:74 Gloss : aliased SDL_SDL_stdinc_h.Uint8; -- ../include/SDL/SDL_video.h:75 Bloss : aliased SDL_SDL_stdinc_h.Uint8; -- ../include/SDL/SDL_video.h:76 Aloss : aliased SDL_SDL_stdinc_h.Uint8; -- ../include/SDL/SDL_video.h:77 Rshift : aliased SDL_SDL_stdinc_h.Uint8; -- ../include/SDL/SDL_video.h:78 Gshift : aliased SDL_SDL_stdinc_h.Uint8; -- ../include/SDL/SDL_video.h:79 Bshift : aliased SDL_SDL_stdinc_h.Uint8; -- ../include/SDL/SDL_video.h:80 Ashift : aliased SDL_SDL_stdinc_h.Uint8; -- ../include/SDL/SDL_video.h:81 Rmask : aliased SDL_SDL_stdinc_h.Uint32; -- ../include/SDL/SDL_video.h:82 Gmask : aliased SDL_SDL_stdinc_h.Uint32; -- ../include/SDL/SDL_video.h:83 Bmask : aliased SDL_SDL_stdinc_h.Uint32; -- ../include/SDL/SDL_video.h:84 Amask : aliased SDL_SDL_stdinc_h.Uint32; -- ../include/SDL/SDL_video.h:85 colorkey : aliased SDL_SDL_stdinc_h.Uint32; -- ../include/SDL/SDL_video.h:88 alpha : aliased SDL_SDL_stdinc_h.Uint8; -- ../include/SDL/SDL_video.h:90 end record; pragma Convention (C_Pass_By_Copy, SDL_PixelFormat); -- ../include/SDL/SDL_video.h:70 type SDL_Surface is record flags : aliased SDL_SDL_stdinc_h.Uint32; -- ../include/SDL/SDL_video.h:97 format : access SDL_PixelFormat; -- ../include/SDL/SDL_video.h:98 w : aliased int; -- ../include/SDL/SDL_video.h:99 h : aliased int; -- ../include/SDL/SDL_video.h:99 pitch : aliased SDL_SDL_stdinc_h.Uint16; -- ../include/SDL/SDL_video.h:100 pixels : System.Address; -- ../include/SDL/SDL_video.h:101 offset : aliased int; -- ../include/SDL/SDL_video.h:102 hwdata : System.Address; -- ../include/SDL/SDL_video.h:105 clip_rect : aliased SDL_Rect; -- ../include/SDL/SDL_video.h:108 unused1 : aliased SDL_SDL_stdinc_h.Uint32; -- ../include/SDL/SDL_video.h:109 locked : aliased SDL_SDL_stdinc_h.Uint32; -- ../include/SDL/SDL_video.h:112 map : System.Address; -- ../include/SDL/SDL_video.h:115 format_version : aliased unsigned; -- ../include/SDL/SDL_video.h:118 refcount : aliased int; -- ../include/SDL/SDL_video.h:121 end record; pragma Convention (C_Pass_By_Copy, SDL_Surface); -- ../include/SDL/SDL_video.h:96 -- skipped empty struct private_hwdata -- skipped empty struct SDL_BlitMap type SDL_blit is access function (arg1 : access SDL_Surface; arg2 : access SDL_Rect; arg3 : access SDL_Surface; arg4 : access SDL_Rect) return int; pragma Convention (C, SDL_blit); -- ../include/SDL/SDL_video.h:166 type SDL_VideoInfo is record hw_available : Extensions.Unsigned_1; -- ../include/SDL/SDL_video.h:172 wm_available : Extensions.Unsigned_1; -- ../include/SDL/SDL_video.h:173 UnusedBits1 : Extensions.Unsigned_6; -- ../include/SDL/SDL_video.h:174 UnusedBits2 : Extensions.Unsigned_1; -- ../include/SDL/SDL_video.h:175 blit_hw : Extensions.Unsigned_1; -- ../include/SDL/SDL_video.h:176 blit_hw_CC : Extensions.Unsigned_1; -- ../include/SDL/SDL_video.h:177 blit_hw_A : Extensions.Unsigned_1; -- ../include/SDL/SDL_video.h:178 blit_sw : Extensions.Unsigned_1; -- ../include/SDL/SDL_video.h:179 blit_sw_CC : Extensions.Unsigned_1; -- ../include/SDL/SDL_video.h:180 blit_sw_A : Extensions.Unsigned_1; -- ../include/SDL/SDL_video.h:181 blit_fill : Extensions.Unsigned_1; -- ../include/SDL/SDL_video.h:182 UnusedBits3 : aliased unsigned_short; -- ../include/SDL/SDL_video.h:183 video_mem : aliased SDL_SDL_stdinc_h.Uint32; -- ../include/SDL/SDL_video.h:184 vfmt : access SDL_PixelFormat; -- ../include/SDL/SDL_video.h:185 current_w : aliased int; -- ../include/SDL/SDL_video.h:186 current_h : aliased int; -- ../include/SDL/SDL_video.h:187 end record; pragma Convention (C_Pass_By_Copy, SDL_VideoInfo); pragma Pack (SDL_VideoInfo); -- ../include/SDL/SDL_video.h:171 type SDL_Overlay is record format : aliased SDL_SDL_stdinc_h.Uint32; -- ../include/SDL/SDL_video.h:209 w : aliased int; -- ../include/SDL/SDL_video.h:210 h : aliased int; -- ../include/SDL/SDL_video.h:210 planes : aliased int; -- ../include/SDL/SDL_video.h:211 pitches : access SDL_SDL_stdinc_h.Uint16; -- ../include/SDL/SDL_video.h:212 pixels : System.Address; -- ../include/SDL/SDL_video.h:213 hwfuncs : System.Address; -- ../include/SDL/SDL_video.h:217 hwdata : System.Address; -- ../include/SDL/SDL_video.h:218 hw_overlay : Extensions.Unsigned_1; -- ../include/SDL/SDL_video.h:223 UnusedBits : Extensions.Unsigned_31; -- ../include/SDL/SDL_video.h:224 end record; pragma Convention (C_Pass_By_Copy, SDL_Overlay); pragma Pack (SDL_Overlay); -- ../include/SDL/SDL_video.h:208 -- skipped empty struct private_yuvhwfuncs -- skipped empty struct private_yuvhwdata type SDL_GLattr is (SDL_GL_RED_SIZE, SDL_GL_GREEN_SIZE, SDL_GL_BLUE_SIZE, SDL_GL_ALPHA_SIZE, SDL_GL_BUFFER_SIZE, SDL_GL_DOUBLEBUFFER, SDL_GL_DEPTH_SIZE, SDL_GL_STENCIL_SIZE, SDL_GL_ACCUM_RED_SIZE, SDL_GL_ACCUM_GREEN_SIZE, SDL_GL_ACCUM_BLUE_SIZE, SDL_GL_ACCUM_ALPHA_SIZE, SDL_GL_STEREO, SDL_GL_MULTISAMPLEBUFFERS, SDL_GL_MULTISAMPLESAMPLES, SDL_GL_ACCELERATED_VISUAL, SDL_GL_SWAP_CONTROL); pragma Convention (C, SDL_GLattr); -- ../include/SDL/SDL_video.h:248 function SDL_VideoInit (driver_name : Interfaces.C.Strings.chars_ptr; flags : SDL_SDL_stdinc_h.Uint32) return int; -- ../include/SDL/SDL_video.h:275 pragma Import (C, SDL_VideoInit, "SDL_VideoInit"); procedure SDL_VideoQuit; -- ../include/SDL/SDL_video.h:276 pragma Import (C, SDL_VideoQuit, "SDL_VideoQuit"); function SDL_VideoDriverName (namebuf : Interfaces.C.Strings.chars_ptr; maxlen : int) return Interfaces.C.Strings.chars_ptr; -- ../include/SDL/SDL_video.h:284 pragma Import (C, SDL_VideoDriverName, "SDL_VideoDriverName"); function SDL_GetVideoSurface return access SDL_Surface; -- ../include/SDL/SDL_video.h:292 pragma Import (C, SDL_GetVideoSurface, "SDL_GetVideoSurface"); function SDL_GetVideoInfo return System.Address; -- ../include/SDL/SDL_video.h:300 pragma Import (C, SDL_GetVideoInfo, "SDL_GetVideoInfo"); function SDL_VideoModeOK (width : int; height : int; bpp : int; flags : SDL_SDL_stdinc_h.Uint32) return int; -- ../include/SDL/SDL_video.h:313 pragma Import (C, SDL_VideoModeOK, "SDL_VideoModeOK"); function SDL_ListModes (format : access SDL_PixelFormat; flags : SDL_SDL_stdinc_h.Uint32) return System.Address; -- ../include/SDL/SDL_video.h:324 pragma Import (C, SDL_ListModes, "SDL_ListModes"); function SDL_SetVideoMode (width : int; height : int; bpp : int; flags : SDL_SDL_stdinc_h.Uint32) return access SDL_Surface; -- ../include/SDL/SDL_video.h:384 pragma Import (C, SDL_SetVideoMode, "SDL_SetVideoMode"); procedure SDL_UpdateRects (screen : access SDL_Surface; numrects : int; rects : access SDL_Rect); -- ../include/SDL/SDL_video.h:394 pragma Import (C, SDL_UpdateRects, "SDL_UpdateRects"); procedure SDL_UpdateRect (screen : access SDL_Surface; x : SDL_SDL_stdinc_h.Sint32; y : SDL_SDL_stdinc_h.Sint32; w : SDL_SDL_stdinc_h.Uint32; h : SDL_SDL_stdinc_h.Uint32); -- ../include/SDL/SDL_video.h:400 pragma Import (C, SDL_UpdateRect, "SDL_UpdateRect"); function SDL_Flip (screen : access SDL_Surface) return int; -- ../include/SDL/SDL_video.h:414 pragma Import (C, SDL_Flip, "SDL_Flip"); function SDL_SetGamma (red : float; green : float; blue : float) return int; -- ../include/SDL/SDL_video.h:424 pragma Import (C, SDL_SetGamma, "SDL_SetGamma"); function SDL_SetGammaRamp (red : access SDL_SDL_stdinc_h.Uint16; green : access SDL_SDL_stdinc_h.Uint16; blue : access SDL_SDL_stdinc_h.Uint16) return int; -- ../include/SDL/SDL_video.h:438 pragma Import (C, SDL_SetGammaRamp, "SDL_SetGammaRamp"); function SDL_GetGammaRamp (red : access SDL_SDL_stdinc_h.Uint16; green : access SDL_SDL_stdinc_h.Uint16; blue : access SDL_SDL_stdinc_h.Uint16) return int; -- ../include/SDL/SDL_video.h:449 pragma Import (C, SDL_GetGammaRamp, "SDL_GetGammaRamp"); function SDL_SetColors (surface : access SDL_Surface; colors : access SDL_Color; firstcolor : int; ncolors : int) return int; -- ../include/SDL/SDL_video.h:466 pragma Import (C, SDL_SetColors, "SDL_SetColors"); function SDL_SetPalette (surface : access SDL_Surface; flags : int; colors : access SDL_Color; firstcolor : int; ncolors : int) return int; -- ../include/SDL/SDL_video.h:485 pragma Import (C, SDL_SetPalette, "SDL_SetPalette"); function SDL_MapRGB (format : System.Address; r : SDL_SDL_stdinc_h.Uint8; g : SDL_SDL_stdinc_h.Uint8; b : SDL_SDL_stdinc_h.Uint8) return SDL_SDL_stdinc_h.Uint32; -- ../include/SDL/SDL_video.h:492 pragma Import (C, SDL_MapRGB, "SDL_MapRGB"); function SDL_MapRGBA (format : System.Address; r : SDL_SDL_stdinc_h.Uint8; g : SDL_SDL_stdinc_h.Uint8; b : SDL_SDL_stdinc_h.Uint8; a : SDL_SDL_stdinc_h.Uint8) return SDL_SDL_stdinc_h.Uint32; -- ../include/SDL/SDL_video.h:499 pragma Import (C, SDL_MapRGBA, "SDL_MapRGBA"); procedure SDL_GetRGB (pixel : SDL_SDL_stdinc_h.Uint32; fmt : System.Address; r : access SDL_SDL_stdinc_h.Uint8; g : access SDL_SDL_stdinc_h.Uint8; b : access SDL_SDL_stdinc_h.Uint8); -- ../include/SDL/SDL_video.h:506 pragma Import (C, SDL_GetRGB, "SDL_GetRGB"); procedure SDL_GetRGBA (pixel : SDL_SDL_stdinc_h.Uint32; fmt : System.Address; r : access SDL_SDL_stdinc_h.Uint8; g : access SDL_SDL_stdinc_h.Uint8; b : access SDL_SDL_stdinc_h.Uint8; a : access SDL_SDL_stdinc_h.Uint8); -- ../include/SDL/SDL_video.h:513 pragma Import (C, SDL_GetRGBA, "SDL_GetRGBA"); function SDL_CreateRGBSurface (flags : SDL_SDL_stdinc_h.Uint32; width : int; height : int; depth : int; Rmask : SDL_SDL_stdinc_h.Uint32; Gmask : SDL_SDL_stdinc_h.Uint32; Bmask : SDL_SDL_stdinc_h.Uint32; Amask : SDL_SDL_stdinc_h.Uint32) return access SDL_Surface; -- ../include/SDL/SDL_video.h:553 pragma Import (C, SDL_CreateRGBSurface, "SDL_CreateRGBSurface"); function SDL_CreateRGBSurfaceFrom (pixels : System.Address; width : int; height : int; depth : int; pitch : int; Rmask : SDL_SDL_stdinc_h.Uint32; Gmask : SDL_SDL_stdinc_h.Uint32; Bmask : SDL_SDL_stdinc_h.Uint32; Amask : SDL_SDL_stdinc_h.Uint32) return access SDL_Surface; -- ../include/SDL/SDL_video.h:557 pragma Import (C, SDL_CreateRGBSurfaceFrom, "SDL_CreateRGBSurfaceFrom"); procedure SDL_FreeSurface (surface : access SDL_Surface); -- ../include/SDL/SDL_video.h:560 pragma Import (C, SDL_FreeSurface, "SDL_FreeSurface"); function SDL_LockSurface (surface : access SDL_Surface) return int; -- ../include/SDL/SDL_video.h:580 pragma Import (C, SDL_LockSurface, "SDL_LockSurface"); procedure SDL_UnlockSurface (surface : access SDL_Surface); -- ../include/SDL/SDL_video.h:581 pragma Import (C, SDL_UnlockSurface, "SDL_UnlockSurface"); function SDL_LoadBMP_RW (src : access SDL_SDL_rwops_h.SDL_RWops; freesrc : int) return access SDL_Surface; -- ../include/SDL/SDL_video.h:589 pragma Import (C, SDL_LoadBMP_RW, "SDL_LoadBMP_RW"); function SDL_SaveBMP_RW (surface : access SDL_Surface; dst : access SDL_SDL_rwops_h.SDL_RWops; freedst : int) return int; -- ../include/SDL/SDL_video.h:599 pragma Import (C, SDL_SaveBMP_RW, "SDL_SaveBMP_RW"); function SDL_SetColorKey (surface : access SDL_Surface; flag : SDL_SDL_stdinc_h.Uint32; key : SDL_SDL_stdinc_h.Uint32) return int; -- ../include/SDL/SDL_video.h:615 pragma Import (C, SDL_SetColorKey, "SDL_SetColorKey"); function SDL_SetAlpha (surface : access SDL_Surface; flag : SDL_SDL_stdinc_h.Uint32; alpha : SDL_SDL_stdinc_h.Uint8) return int; -- ../include/SDL/SDL_video.h:633 pragma Import (C, SDL_SetAlpha, "SDL_SetAlpha"); function SDL_SetClipRect (surface : access SDL_Surface; rect : System.Address) return SDL_SDL_stdinc_h.SDL_bool; -- ../include/SDL/SDL_video.h:647 pragma Import (C, SDL_SetClipRect, "SDL_SetClipRect"); procedure SDL_GetClipRect (surface : access SDL_Surface; rect : access SDL_Rect); -- ../include/SDL/SDL_video.h:654 pragma Import (C, SDL_GetClipRect, "SDL_GetClipRect"); function SDL_ConvertSurface (src : access SDL_Surface; fmt : access SDL_PixelFormat; flags : SDL_SDL_stdinc_h.Uint32) return access SDL_Surface; -- ../include/SDL/SDL_video.h:668 pragma Import (C, SDL_ConvertSurface, "SDL_ConvertSurface"); function SDL_UpperBlit (src : access SDL_Surface; srcrect : access SDL_Rect; dst : access SDL_Surface; dstrect : access SDL_Rect) return int; -- ../include/SDL/SDL_video.h:748 pragma Import (C, SDL_UpperBlit, "SDL_UpperBlit"); function SDL_LowerBlit (src : access SDL_Surface; srcrect : access SDL_Rect; dst : access SDL_Surface; dstrect : access SDL_Rect) return int; -- ../include/SDL/SDL_video.h:754 pragma Import (C, SDL_LowerBlit, "SDL_LowerBlit"); function SDL_FillRect (dst : access SDL_Surface; dstrect : access SDL_Rect; color : SDL_SDL_stdinc_h.Uint32) return int; -- ../include/SDL/SDL_video.h:767 pragma Import (C, SDL_FillRect, "SDL_FillRect"); function SDL_DisplayFormat (surface : access SDL_Surface) return access SDL_Surface; -- ../include/SDL/SDL_video.h:781 pragma Import (C, SDL_DisplayFormat, "SDL_DisplayFormat"); function SDL_DisplayFormatAlpha (surface : access SDL_Surface) return access SDL_Surface; -- ../include/SDL/SDL_video.h:795 pragma Import (C, SDL_DisplayFormatAlpha, "SDL_DisplayFormatAlpha"); function SDL_CreateYUVOverlay (width : int; height : int; format : SDL_SDL_stdinc_h.Uint32; display : access SDL_Surface) return access SDL_Overlay; -- ../include/SDL/SDL_video.h:807 pragma Import (C, SDL_CreateYUVOverlay, "SDL_CreateYUVOverlay"); function SDL_LockYUVOverlay (overlay : access SDL_Overlay) return int; -- ../include/SDL/SDL_video.h:811 pragma Import (C, SDL_LockYUVOverlay, "SDL_LockYUVOverlay"); procedure SDL_UnlockYUVOverlay (overlay : access SDL_Overlay); -- ../include/SDL/SDL_video.h:812 pragma Import (C, SDL_UnlockYUVOverlay, "SDL_UnlockYUVOverlay"); function SDL_DisplayYUVOverlay (overlay : access SDL_Overlay; dstrect : access SDL_Rect) return int; -- ../include/SDL/SDL_video.h:820 pragma Import (C, SDL_DisplayYUVOverlay, "SDL_DisplayYUVOverlay"); procedure SDL_FreeYUVOverlay (overlay : access SDL_Overlay); -- ../include/SDL/SDL_video.h:823 pragma Import (C, SDL_FreeYUVOverlay, "SDL_FreeYUVOverlay"); function SDL_GL_LoadLibrary (path : Interfaces.C.Strings.chars_ptr) return int; -- ../include/SDL/SDL_video.h:837 pragma Import (C, SDL_GL_LoadLibrary, "SDL_GL_LoadLibrary"); function SDL_GL_GetProcAddress (proc : Interfaces.C.Strings.chars_ptr) return System.Address; -- ../include/SDL/SDL_video.h:842 pragma Import (C, SDL_GL_GetProcAddress, "SDL_GL_GetProcAddress"); function SDL_GL_SetAttribute (attr : SDL_GLattr; value : int) return int; -- ../include/SDL/SDL_video.h:847 pragma Import (C, SDL_GL_SetAttribute, "SDL_GL_SetAttribute"); function SDL_GL_GetAttribute (attr : SDL_GLattr; value : access int) return int; -- ../include/SDL/SDL_video.h:858 pragma Import (C, SDL_GL_GetAttribute, "SDL_GL_GetAttribute"); procedure SDL_GL_SwapBuffers; -- ../include/SDL/SDL_video.h:863 pragma Import (C, SDL_GL_SwapBuffers, "SDL_GL_SwapBuffers"); procedure SDL_GL_UpdateRects (numrects : int; rects : access SDL_Rect); -- ../include/SDL/SDL_video.h:870 pragma Import (C, SDL_GL_UpdateRects, "SDL_GL_UpdateRects"); procedure SDL_GL_Lock; -- ../include/SDL/SDL_video.h:871 pragma Import (C, SDL_GL_Lock, "SDL_GL_Lock"); procedure SDL_GL_Unlock; -- ../include/SDL/SDL_video.h:872 pragma Import (C, SDL_GL_Unlock, "SDL_GL_Unlock"); procedure SDL_WM_SetCaption (title : Interfaces.C.Strings.chars_ptr; icon : Interfaces.C.Strings.chars_ptr); -- ../include/SDL/SDL_video.h:885 pragma Import (C, SDL_WM_SetCaption, "SDL_WM_SetCaption"); procedure SDL_WM_GetCaption (title : System.Address; icon : System.Address); -- ../include/SDL/SDL_video.h:889 pragma Import (C, SDL_WM_GetCaption, "SDL_WM_GetCaption"); procedure SDL_WM_SetIcon (icon : access SDL_Surface; mask : access SDL_SDL_stdinc_h.Uint8); -- ../include/SDL/SDL_video.h:897 pragma Import (C, SDL_WM_SetIcon, "SDL_WM_SetIcon"); function SDL_WM_IconifyWindow return int; -- ../include/SDL/SDL_video.h:904 pragma Import (C, SDL_WM_IconifyWindow, "SDL_WM_IconifyWindow"); function SDL_WM_ToggleFullScreen (surface : access SDL_Surface) return int; -- ../include/SDL/SDL_video.h:921 pragma Import (C, SDL_WM_ToggleFullScreen, "SDL_WM_ToggleFullScreen"); subtype SDL_GrabMode is unsigned; SDL_GRAB_QUERY : constant SDL_GrabMode := -1; SDL_GRAB_OFF : constant SDL_GrabMode := 0; SDL_GRAB_ON : constant SDL_GrabMode := 1; SDL_GRAB_FULLSCREEN : constant SDL_GrabMode := 2; -- ../include/SDL/SDL_video.h:928 function SDL_WM_GrabInput (mode : SDL_GrabMode) return SDL_GrabMode; -- ../include/SDL/SDL_video.h:937 pragma Import (C, SDL_WM_GrabInput, "SDL_WM_GrabInput"); function SDL_SoftStretch (src : access SDL_Surface; srcrect : access SDL_Rect; dst : access SDL_Surface; dstrect : access SDL_Rect) return int; -- ../include/SDL/SDL_video.h:942 pragma Import (C, SDL_SoftStretch, "SDL_SoftStretch"); end SDL_SDL_video_h;
AdaCore/libadalang
Ada
51
ads
generic procedure Proc2; pragma Import (C, Proc2);
reznikmm/matreshka
Ada
4,673
ads
------------------------------------------------------------------------------ -- -- -- Matreshka Project -- -- -- -- Open Document Toolkit -- -- -- -- Runtime Library Component -- -- -- ------------------------------------------------------------------------------ -- -- -- Copyright © 2014, Vadim Godunko <[email protected]> -- -- 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 XML.DOM.Visitors; with ODF.DOM.Form_Option_Elements; package Matreshka.ODF_Form.Option_Elements is type Form_Option_Element_Node is new Matreshka.ODF_Form.Abstract_Form_Element_Node and ODF.DOM.Form_Option_Elements.ODF_Form_Option with null record; overriding function Create (Parameters : not null access Matreshka.DOM_Elements.Element_L2_Parameters) return Form_Option_Element_Node; overriding function Get_Local_Name (Self : not null access constant Form_Option_Element_Node) return League.Strings.Universal_String; overriding procedure Enter_Node (Self : not null access Form_Option_Element_Node; Visitor : in out XML.DOM.Visitors.Abstract_Visitor'Class; Control : in out XML.DOM.Visitors.Traverse_Control); overriding procedure Leave_Node (Self : not null access Form_Option_Element_Node; Visitor : in out XML.DOM.Visitors.Abstract_Visitor'Class; Control : in out XML.DOM.Visitors.Traverse_Control); overriding procedure Visit_Node (Self : not null access Form_Option_Element_Node; Iterator : in out XML.DOM.Visitors.Abstract_Iterator'Class; Visitor : in out XML.DOM.Visitors.Abstract_Visitor'Class; Control : in out XML.DOM.Visitors.Traverse_Control); end Matreshka.ODF_Form.Option_Elements;
reznikmm/matreshka
Ada
4,851
ads
------------------------------------------------------------------------------ -- -- -- Matreshka Project -- -- -- -- Open Document Toolkit -- -- -- -- Runtime Library Component -- -- -- ------------------------------------------------------------------------------ -- -- -- Copyright © 2014, Vadim Godunko <[email protected]> -- -- 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 XML.DOM.Visitors; with ODF.DOM.Style_List_Level_Properties_Elements; package Matreshka.ODF_Style.List_Level_Properties_Elements is type Style_List_Level_Properties_Element_Node is new Matreshka.ODF_Style.Abstract_Style_Element_Node and ODF.DOM.Style_List_Level_Properties_Elements.ODF_Style_List_Level_Properties with null record; overriding function Create (Parameters : not null access Matreshka.DOM_Elements.Element_L2_Parameters) return Style_List_Level_Properties_Element_Node; overriding function Get_Local_Name (Self : not null access constant Style_List_Level_Properties_Element_Node) return League.Strings.Universal_String; overriding procedure Enter_Node (Self : not null access Style_List_Level_Properties_Element_Node; Visitor : in out XML.DOM.Visitors.Abstract_Visitor'Class; Control : in out XML.DOM.Visitors.Traverse_Control); overriding procedure Leave_Node (Self : not null access Style_List_Level_Properties_Element_Node; Visitor : in out XML.DOM.Visitors.Abstract_Visitor'Class; Control : in out XML.DOM.Visitors.Traverse_Control); overriding procedure Visit_Node (Self : not null access Style_List_Level_Properties_Element_Node; Iterator : in out XML.DOM.Visitors.Abstract_Iterator'Class; Visitor : in out XML.DOM.Visitors.Abstract_Visitor'Class; Control : in out XML.DOM.Visitors.Traverse_Control); end Matreshka.ODF_Style.List_Level_Properties_Elements;
reznikmm/matreshka
Ada
4,640
adb
------------------------------------------------------------------------------ -- -- -- Matreshka Project -- -- -- -- Open Document Toolkit -- -- -- -- Runtime Library Component -- -- -- ------------------------------------------------------------------------------ -- -- -- Copyright © 2014, Vadim Godunko <[email protected]> -- -- All rights reserved. -- -- -- -- Redistribution and use in source and binary forms, with or without -- -- modification, are permitted provided that the following conditions -- -- are met: -- -- -- -- * Redistributions of source code must retain the above copyright -- -- notice, this list of conditions and the following disclaimer. -- -- -- -- * Redistributions in binary form must reproduce the above copyright -- -- notice, this list of conditions and the following disclaimer in the -- -- documentation and/or other materials provided with the distribution. -- -- -- -- * Neither the name of the Vadim Godunko, IE nor the names of its -- -- contributors may be used to endorse or promote products derived from -- -- this software without specific prior written permission. -- -- -- -- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -- -- "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -- -- LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -- -- A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -- -- HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -- -- SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED -- -- TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -- -- PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -- -- LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -- -- NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -- -- SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -- -- -- ------------------------------------------------------------------------------ -- $Revision$ $Date$ ------------------------------------------------------------------------------ with Matreshka.DOM_Documents; with Matreshka.ODF_String_Constants; with ODF.DOM.Iterators; with ODF.DOM.Visitors; package body Matreshka.ODF_Table.Sql_Statement_Attributes is ------------ -- Create -- ------------ overriding function Create (Parameters : not null access Matreshka.DOM_Attributes.Attribute_L2_Parameters) return Table_Sql_Statement_Attribute_Node is begin return Self : Table_Sql_Statement_Attribute_Node do Matreshka.ODF_Table.Constructors.Initialize (Self'Unchecked_Access, Parameters.Document, Matreshka.ODF_String_Constants.Table_Prefix); end return; end Create; -------------------- -- Get_Local_Name -- -------------------- overriding function Get_Local_Name (Self : not null access constant Table_Sql_Statement_Attribute_Node) return League.Strings.Universal_String is pragma Unreferenced (Self); begin return Matreshka.ODF_String_Constants.Sql_Statement_Attribute; end Get_Local_Name; begin Matreshka.DOM_Documents.Register_Attribute (Matreshka.ODF_String_Constants.Table_URI, Matreshka.ODF_String_Constants.Sql_Statement_Attribute, Table_Sql_Statement_Attribute_Node'Tag); end Matreshka.ODF_Table.Sql_Statement_Attributes;
vpodzime/ada-util
Ada
9,485
ads
----------------------------------------------------------------------- -- properties -- Generic name/value property management -- Copyright (C) 2001, 2002, 2003, 2006, 2008, 2009, 2010, 2014, 2017 Stephane Carrez -- Written by Stephane Carrez ([email protected]) -- -- Licensed under the Apache License, Version 2.0 (the "License"); -- you may not use this file except in compliance with the License. -- You may obtain a copy of the License at -- -- http://www.apache.org/licenses/LICENSE-2.0 -- -- Unless required by applicable law or agreed to in writing, software -- distributed under the License is distributed on an "AS IS" BASIS, -- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -- See the License for the specific language governing permissions and -- limitations under the License. ----------------------------------------------------------------------- with Ada.Strings.Unbounded; with Ada.Finalization; with Ada.Text_IO; with Util.Beans.Objects; with Util.Beans.Basic; with Util.Strings.Vectors; private with Util.Concurrent.Counters; package Util.Properties is NO_PROPERTY : exception; use Ada.Strings.Unbounded; subtype Value is Util.Beans.Objects.Object; function "+" (S : String) return Unbounded_String renames To_Unbounded_String; function "-" (S : Unbounded_String) return String renames To_String; function To_String (V : in Value) return String renames Util.Beans.Objects.To_String; -- The manager holding the name/value pairs and providing the operations -- to get and set the properties. type Manager is new Ada.Finalization.Controlled and Util.Beans.Basic.Bean with private; type Manager_Access is access all Manager'Class; -- Get the value identified by the name. -- If the name cannot be found, the method should return the Null object. overriding function Get_Value (From : in Manager; Name : in String) return Util.Beans.Objects.Object; -- Set the value identified by the name. -- If the map contains the given name, the value changed. -- Otherwise name is added to the map and the value associated with it. overriding procedure Set_Value (From : in out Manager; Name : in String; Value : in Util.Beans.Objects.Object); -- Returns TRUE if the property exists. function Exists (Self : in Manager'Class; Name : in Unbounded_String) return Boolean; -- Returns TRUE if the property exists. function Exists (Self : in Manager'Class; Name : in String) return Boolean; -- Returns the property value. Raises an exception if not found. function Get (Self : in Manager'Class; Name : in String) return String; -- Returns the property value. Raises an exception if not found. function Get (Self : in Manager'Class; Name : in String) return Unbounded_String; -- Returns the property value. Raises an exception if not found. function Get (Self : in Manager'Class; Name : in Unbounded_String) return Unbounded_String; -- Returns the property value. Raises an exception if not found. function Get (Self : in Manager'Class; Name : in Unbounded_String) return String; -- Returns the property value or Default if it does not exist. function Get (Self : in Manager'Class; Name : in String; Default : in String) return String; -- Returns a property manager that is associated with the given name. -- Raises NO_PROPERTY if there is no such property manager or if a property exists -- but is not a property manager. function Get (Self : in Manager'Class; Name : in String) return Manager; -- Create a property manager and associated it with the given name. function Create (Self : in out Manager'Class; Name : in String) return Manager; -- Set the value of the property. The property is created if it -- does not exists. procedure Set (Self : in out Manager'Class; Name : in String; Item : in String); -- Set the value of the property. The property is created if it -- does not exists. procedure Set (Self : in out Manager'Class; Name : in String; Item : in Unbounded_String); -- Set the value of the property. The property is created if it -- does not exists. procedure Set (Self : in out Manager'Class; Name : in Unbounded_String; Item : in Unbounded_String); -- Remove the property given its name. If the property does not -- exist, raises NO_PROPERTY exception. procedure Remove (Self : in out Manager'Class; Name : in String); -- Remove the property given its name. If the property does not -- exist, raises NO_PROPERTY exception. procedure Remove (Self : in out Manager'Class; Name : in Unbounded_String); -- Iterate over the properties and execute the given procedure passing the -- property name and its value. procedure Iterate (Self : in Manager'Class; Process : access procedure (Name : in String; Item : in Value)); -- Collect the name of the properties defined in the manager. -- When a prefix is specified, only the properties starting with the prefix are -- returned. procedure Get_Names (Self : in Manager; Into : in out Util.Strings.Vectors.Vector; Prefix : in String := ""); -- Load the properties from the file input stream. The file must follow -- the definition of Java property files. When a prefix is specified, keep -- only the properties that starts with the prefix. When <b>Strip</b> is True, -- the prefix part is removed from the property name. procedure Load_Properties (Self : in out Manager'Class; File : in Ada.Text_IO.File_Type; Prefix : in String := ""; Strip : in Boolean := False); -- Load the properties from the file. The file must follow the -- definition of Java property files. When a prefix is specified, keep -- only the properties that starts with the prefix. When <b>Strip</b> is True, -- the prefix part is removed from the property name. -- Raises NAME_ERROR if the file does not exist. procedure Load_Properties (Self : in out Manager'Class; Path : in String; Prefix : in String := ""; Strip : in Boolean := False); -- Save the properties in the given file path. procedure Save_Properties (Self : in out Manager'Class; Path : in String; Prefix : in String := ""); -- Copy the properties from FROM which start with a given prefix. -- If the prefix is empty, all properties are copied. When <b>Strip</b> is True, -- the prefix part is removed from the property name. procedure Copy (Self : in out Manager'Class; From : in Manager'Class; Prefix : in String := ""; Strip : in Boolean := False); -- Get the property manager represented by the item value. -- Raise the Conversion_Error exception if the value is not a property manager. function To_Manager (Item : in Value) return Manager; -- Returns True if the item value represents a property manager. function Is_Manager (Item : in Value) return Boolean; private -- Abstract interface for the implementation of Properties -- (this allows to decouples the implementation from the API) package Interface_P is type Manager is abstract limited new Util.Beans.Basic.Bean with record Count : Util.Concurrent.Counters.Counter; Shared : Boolean := False; end record; type Manager_Access is access all Manager'Class; -- Returns TRUE if the property exists. function Exists (Self : in Manager; Name : in String) return Boolean is abstract; -- Remove the property given its name. procedure Remove (Self : in out Manager; Name : in String) is abstract; -- Iterate over the properties and execute the given procedure passing the -- property name and its value. procedure Iterate (Self : in Manager; Process : access procedure (Name : in String; Item : in Value)) is abstract; -- Deep copy of properties stored in 'From' to 'To'. function Create_Copy (Self : in Manager) return Manager_Access is abstract; end Interface_P; -- Create a property implementation if there is none yet. procedure Check_And_Create_Impl (Self : in out Manager); type Manager is new Ada.Finalization.Controlled and Util.Beans.Basic.Bean with record Impl : Interface_P.Manager_Access := null; end record; overriding procedure Adjust (Object : in out Manager); overriding procedure Finalize (Object : in out Manager); end Util.Properties;
reznikmm/matreshka
Ada
4,965
ads
------------------------------------------------------------------------------ -- -- -- Matreshka Project -- -- -- -- Ada Modeling Framework -- -- -- -- Runtime Library Component -- -- -- ------------------------------------------------------------------------------ -- -- -- Copyright © 2011-2012, Vadim Godunko <[email protected]> -- -- All rights reserved. -- -- -- -- Redistribution and use in source and binary forms, with or without -- -- modification, are permitted provided that the following conditions -- -- are met: -- -- -- -- * Redistributions of source code must retain the above copyright -- -- notice, this list of conditions and the following disclaimer. -- -- -- -- * Redistributions in binary form must reproduce the above copyright -- -- notice, this list of conditions and the following disclaimer in the -- -- documentation and/or other materials provided with the distribution. -- -- -- -- * Neither the name of the Vadim Godunko, IE nor the names of its -- -- contributors may be used to endorse or promote products derived from -- -- this software without specific prior written permission. -- -- -- -- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -- -- "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -- -- LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -- -- A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -- -- HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -- -- SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED -- -- TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -- -- PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -- -- LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -- -- NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -- -- SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -- -- -- ------------------------------------------------------------------------------ -- $Revision$ $Date$ ------------------------------------------------------------------------------ -- This file is generated, don't edit it. ------------------------------------------------------------------------------ with AMF.Generic_Collections; package AMF.CMOF.Operations.Collections is pragma Preelaborate; package CMOF_Operation_Collections is new AMF.Generic_Collections (CMOF_Operation, CMOF_Operation_Access); type Set_Of_CMOF_Operation is new CMOF_Operation_Collections.Set with null record; Empty_Set_Of_CMOF_Operation : constant Set_Of_CMOF_Operation; type Ordered_Set_Of_CMOF_Operation is new CMOF_Operation_Collections.Ordered_Set with null record; Empty_Ordered_Set_Of_CMOF_Operation : constant Ordered_Set_Of_CMOF_Operation; type Bag_Of_CMOF_Operation is new CMOF_Operation_Collections.Bag with null record; Empty_Bag_Of_CMOF_Operation : constant Bag_Of_CMOF_Operation; type Sequence_Of_CMOF_Operation is new CMOF_Operation_Collections.Sequence with null record; Empty_Sequence_Of_CMOF_Operation : constant Sequence_Of_CMOF_Operation; private Empty_Set_Of_CMOF_Operation : constant Set_Of_CMOF_Operation := (CMOF_Operation_Collections.Set with null record); Empty_Ordered_Set_Of_CMOF_Operation : constant Ordered_Set_Of_CMOF_Operation := (CMOF_Operation_Collections.Ordered_Set with null record); Empty_Bag_Of_CMOF_Operation : constant Bag_Of_CMOF_Operation := (CMOF_Operation_Collections.Bag with null record); Empty_Sequence_Of_CMOF_Operation : constant Sequence_Of_CMOF_Operation := (CMOF_Operation_Collections.Sequence with null record); end AMF.CMOF.Operations.Collections;
MinimSecure/unum-sdk
Ada
886
adb
-- Copyright 2017-2019 Free Software Foundation, Inc. -- -- This program is free software; you can redistribute it and/or modify -- it under the terms of the GNU General Public License as published by -- the Free Software Foundation; either version 3 of the License, or -- (at your option) any later version. -- -- This program is distributed in the hope that it will be useful, -- but WITHOUT ANY WARRANTY; without even the implied warranty of -- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -- GNU General Public License for more details. -- -- You should have received a copy of the GNU General Public License -- along with this program. If not, see <http://www.gnu.org/licenses/>. with Pck; use Pck; procedure Foo_P708_025 is Val : Integer; begin Val := Get_Val (8, False); Do_Nothing (Val); Call_Me; Increment (Val); end Foo_P708_025;
AdaCore/gpr
Ada
33,149
ads
-- -- Copyright (C) 2014-2022, AdaCore -- SPDX-License-Identifier: Apache-2.0 -- with Ada.Containers; use Ada.Containers; with Ada.Containers.Hashed_Maps; with Ada.Containers.Ordered_Maps; with Ada.Exceptions; with Ada.Unchecked_Conversion; with Ada.Unchecked_Deallocation; with Gpr_Parser_Support.Hashes; use Gpr_Parser_Support.Hashes; with Gpr_Parser_Support.Lexical_Envs; use Gpr_Parser_Support.Lexical_Envs; with Gpr_Parser_Support.Symbols; use Gpr_Parser_Support.Symbols; with Gpr_Parser_Support.Text; use Gpr_Parser_Support.Text; with Gpr_Parser_Support.Types; use Gpr_Parser_Support.Types; with Gpr_Parser_Support.Vectors; -- This package implements a scoped lexical environment data structure that -- will then be used in AST nodes. Particularities: -- -- - This data structure implements simple nesting via a Parent_Env link in -- each env. If the parent is null you are at the topmost env. -- -- - You can reference other envs, which are virtually treated like parent -- envs too. -- -- - You can annotate both whole environments and nodes with metadata, giving -- more information about the fnodes. The consequence is that metadata needs -- to be combinable, eg. you need to be able to create a single metadata -- record from two metadata records. -- -- TODO??? For the moment, everything is public, because it is not yet clear -- what the interaction interface will be with the generated library. We might -- want to make the type private at some point (or not). generic with function Get_Unit_Version (Unit : Generic_Unit_Ptr) return Version_Number; -- Used to retrieve the version number of the given Unit, for cache -- invalidation purposes. type Node_Type is private; type Node_Metadata is private; No_Node : Node_Type; Empty_Metadata : Node_Metadata; with function "<" (Left, Right : Node_Type) return Boolean is <>; with function "=" (Left, Right : Node_Type) return Boolean is <>; type Ref_Category is (<>); type Ref_Categories is array (Ref_Category) of Boolean; with function Node_Unit (Node : Node_Type) return Generic_Unit_Ptr is <>; with function Node_Hash (Node : Node_Type) return Hash_Type; with function Metadata_Hash (Metadata : Node_Metadata) return Hash_Type; with function Combine (L, R : Node_Metadata) return Node_Metadata; with function Can_Reach (Node, From : Node_Type) return Boolean is <>; -- Return whether ``Node`` can be reached from ``From``. -- -- This function is used to filter the result of a lexical env lookup: for -- a lookup triggered on node ``From`` (formal ``From`` in -- ``Get``/``Get_First`` functions), nodes ``Node`` for which ``Can_Reach -- (Node, From)`` returns False are excluded from the result. -- -- This is used to implement sequential semantics: in the following -- example, looking for ``D`` from the second line should return the -- definition in the first line (``E`` can reach ``D`` line 1), but not the -- one in the third line (``E`` cannot reach ``D`` line 3):: -- -- def D = 1 -- def E = D -- def D = 2 with function Is_Rebindable (Node : Node_Type) return Boolean is <>; -- Return whether a lexical environment whose node is Node can be rebound with function Node_Text_Image (Node : Node_Type; Short : Boolean := True) return Text_Type; with function Acquire_Rebinding (Node : Node_Type; Parent : Env_Rebindings; Old_Env, New_Env : Lexical_Env) return Env_Rebindings is <>; -- Allocate if needed, initialize return a record to store env rebindings with procedure Register_Rebinding (Node : Node_Type; Rebinding : Env_Rebindings); -- Register a rebinding to be destroyed when Node is destroyed with function Get_Context_Version (Node : Node_Type) return Version_Number is <>; -- Return the current version number of caches corresponding to Node's -- context, for cache invalidation purposes. type Inner_Env_Assoc is private; with function Get_Key (Self : Inner_Env_Assoc) return Symbol_Type is <>; with function Get_Node (Self : Inner_Env_Assoc) return Node_Type is <>; with function Get_Metadata (Self : Inner_Env_Assoc) return Node_Metadata is <>; type Inner_Env_Assoc_Array is private; with function Length (Self : Inner_Env_Assoc_Array) return Natural is <>; with function Get (Self : Inner_Env_Assoc_Array; Index : Positive) return Inner_Env_Assoc is <>; with procedure Dec_Ref (Self : in out Inner_Env_Assoc_Array) is <>; with function Properties_May_Raise (Exc : Ada.Exceptions.Exception_Occurrence) return Boolean is <>; package Gpr_Parser_Support.Lexical_Envs_Impl is All_Cats : Ref_Categories := (others => True); pragma Compile_Time_Error (Ref_Categories'Length > 32, "Categories has to fit in a 32 bits Integer"); function Text_Image (Cats : Ref_Categories) return Text_Type; pragma Suppress (Container_Checks); -- Remove container checks for standard containers -------------- -- Entities -- -------------- type Entity_Info is record Md : Node_Metadata; -- External metadata for the node Rebindings : Env_Rebindings := null; -- Rebindings applying to this entity From_Rebound : Boolean := False; -- Whether this entity has been obtained out of a rebound environment end record with Convention => C; type Entity is record Node : Node_Type; Info : Entity_Info; end record; -- Wrapper structure to contain both the 'real' node that the user wanted -- to store, and its associated metadata. function Create_Entity (Node : Node_Type; Md : Node_Metadata) return Entity; -- Constructor that returns an Entity from an Node_Type and an -- Node_Metadata instances. function Equivalent (L, R : Entity) return Boolean; -- Return whether we can consider that L and R are equivalent entities function Equivalent (L, R : Entity_Info) return Boolean; -- Return whether we can consider that L and R are equivalent entity info ---------------------- -- Lexical_Env Type -- ---------------------- type Lexical_Env_Record; -- Value type for lexical envs type Lexical_Env_Access is access all Lexical_Env_Record; type Lexical_Env_Resolver is access function (Ref : Entity) return Lexical_Env; -- Callback type for the lazy referenced env resolution mechanism ---------------- -- Env_Getter -- ---------------- type Env_Getter (Dynamic : Boolean := False) is record Env : Lexical_Env := Null_Lexical_Env; -- If Dynamic, cache for the resolved lexical environment. To be used -- only when No_Entity_Info is used for the resolution. We consider that -- this cache contains a valid entry when Env is not Null_Lexical_Env -- and that it is not stale. -- -- Note that we process Empty_Env in a very specific way here: resolvers -- often return Empty_Env when they fail to compute the result, for -- instance because of a missing unit. When that unit is parsed, we want -- to invalidate the cache (the Env component) so that the resolver has -- another chance to fetch the result from that new unit. -- -- To achieve this, when putting Empty_Env in the cache, we set -- Env.Version to the version of the owning context, and when trying to -- use the cache, we check that the version is still the same. -- -- We do not have this problem with other envs thanks to their own unit -- version number (Empty_Env is a global singleton, so it does not has a -- owning unit nor an owning context). case Dynamic is when True => Node : Node_Type; Resolver : Lexical_Env_Resolver; -- Data and callable to resolve this getter when False => null; end case; end record; -- Link to an environment. It can be either a simple link (just a pointer) -- or a dynamic link (a function that recomputes the link when needed). See -- the two constructors below. No_Env_Getter : constant Env_Getter := (False, Null_Lexical_Env); procedure Resolve (Self : in out Env_Getter; Info : Entity_Info); -- Resolve the reference for this env getter. Info is forwarded to the -- resolver callback. function Simple_Env_Getter (E : Lexical_Env) return Env_Getter; -- Create a static Env_Getter (i.e. pointer to environment) function Dyn_Env_Getter (Resolver : Lexical_Env_Resolver; Node : Node_Type) return Env_Getter; -- Create a dynamic Env_Getter (i.e. function and closure to compute an -- environment). function Get_Env (Self : in out Env_Getter; Info : Entity_Info) return Lexical_Env; -- Return the environment associated to the Self env getter. If Self is -- dynamic, Info is forwarded to the resolver callback. function Equivalent (L, R : Env_Getter) return Boolean; -- If at least one of L and R is a dynamic env getter, raise a -- Constraint_Error. Otherwise, return whether the pointed environments are -- equal. procedure Inc_Ref (Self : Env_Getter); -- Shortcut to run Inc_Ref of the potentially embedded lexical environment procedure Dec_Ref (Self : in out Env_Getter); -- Shortcut to run Dec_Ref of the potentially embedded lexical environment -------------------- -- Env_Rebindings -- -------------------- function Combine (L, R : Env_Rebindings) return Env_Rebindings; -- Return a new Env_Rebindings that combines rebindings from both L and R function OK_For_Rebindings (Self : Lexical_Env) return Boolean; -- Return whether Self is a lexical environment that can be used in -- environment rebindings (for old or new env). function Append (Self : Env_Rebindings; Old_Env, New_Env : Lexical_Env) return Env_Rebindings with Pre => OK_For_Rebindings (Old_Env) and then OK_For_Rebindings (New_Env); -- Create a new rebindings and register it to Self and to -- Old_Env/New_Env's analysis units. function Append_Rebinding (Self : Env_Rebindings; Old_Env : Lexical_Env; New_Env : Lexical_Env) return Env_Rebindings with Pre => OK_For_Rebindings (Old_Env) and then OK_For_Rebindings (New_Env); function Text_Image (Self : Env_Rebindings) return Text_Type; ---------------------------------- -- Arrays of nodes and entities -- ---------------------------------- package Entity_Vectors is new Gpr_Parser_Support.Vectors (Entity, Small_Vector_Capacity => 2); -- Vectors used to store collections of nodes, as values of a lexical -- environment map. We want to use vectors internally. type Node_Array is array (Positive range <>) of Node_Type; subtype Entity_Array is Entity_Vectors.Elements_Array; -- Arrays of wrapped nodes stored in the environment maps ----------------------------- -- Referenced environments -- ----------------------------- type Referenced_Env is record Kind : Ref_Kind := Normal; -- Kind for this referenced env Getter : Env_Getter; -- Closure to fetch the environment that is referenced Being_Visited : Boolean; -- Flag set to true when Referenced_Env is being visited. Used as a -- recursion guard. WARNING: Not thread safe. State : Refd_Env_State := Inactive; -- State of the referenced env, whether active or inactive Categories : Ref_Categories := All_Cats; end record; -- Represents a referenced env package Referenced_Envs_Vectors is new Gpr_Parser_Support.Vectors (Referenced_Env); -- Vectors of referenced envs, used to store referenced environments ------------------------------------ -- Lexical environment public API -- ------------------------------------ type Entity_Resolver is access function (Ref : Entity) return Entity; -- Callback type for the lazy entity resolution mechanism. Such functions -- must take a "reference" entity (e.g. a name) and return the referenced -- entity. type Inner_Env_Assocs_Resolver is access function (Self : Entity) return Inner_Env_Assoc_Array; Empty_Env : constant Lexical_Env; -- Empty_Env is a magical lexical environment that will always be empty. We -- allow users to call Add on it anyway as a convenience, but this is a -- no-op. This makes sense as Empty_Env's purpose is to be used to -- represent missing scopes from erroneous trees. function Create_Lexical_Env (Parent : Lexical_Env; Node : Node_Type; Transitive_Parent : Boolean := False; Owner : Generic_Unit_Ptr) return Lexical_Env with Post => Create_Lexical_Env'Result.Kind = Static_Primary; -- Create a new static-primary lexical env function Create_Dynamic_Lexical_Env (Parent : Lexical_Env; Node : Node_Type; Transitive_Parent : Boolean := False; Owner : Generic_Unit_Ptr; Assocs_Getter : Inner_Env_Assocs_Resolver; Assoc_Resolver : Entity_Resolver := null) return Lexical_Env with Pre => Node /= No_Node, Post => Create_Dynamic_Lexical_Env'Result.Kind = Dynamic_Primary; -- Create a new dynamic-primary lexical env procedure Add (Self : Lexical_Env; Key : Symbol_Type; Value : Node_Type; Md : Node_Metadata := Empty_Metadata; Resolver : Entity_Resolver := null) with Pre => Self.Kind = Static_Primary; -- Add Value to the list of values for the key Key, with the metadata Md procedure Remove (Self : Lexical_Env; Key : Symbol_Type; Value : Node_Type) with Pre => Self.Kind = Static_Primary; -- Remove Value from the list of values for the key Key. This does nothing -- if Self is the empty environment. procedure Reference (Self : Lexical_Env; Referenced_From : Node_Type; Resolver : Lexical_Env_Resolver; Kind : Ref_Kind := Normal; Categories : Ref_Categories := All_Cats; Rebindings_Assoc : Boolean := False) with Pre => Self.Kind = Static_Primary; -- Add a dynamic reference from Self to the lexical environment computed -- calling Resolver on Referenced_From. This makes the content of this -- dynamic environment accessible when performing lookups on Self (see the -- Get function). -- -- Unless the reference is transitive, requests with an origin point (From -- parameter), the content will only be visible if: -- -- * Can_Reach (Referenced_From, From) is True. Practically this means -- that the origin point of the request needs to be *after* -- Referenced_From in the file. -- -- If ``Rebindings_Assoc`` is True, then the referenced env will be -- considered just as Self when shedding rebindings. procedure Reference (Self : Lexical_Env; To_Reference : Lexical_Env; Kind : Ref_Kind := Normal; Categories : Ref_Categories := All_Cats; Rebindings_Assoc : Boolean := False) with Pre => Self.Kind = Static_Primary; -- Add a static reference from Self to To_Reference. See above for the -- meaning of arguments. procedure Deactivate_Referenced_Envs (Self : Lexical_Env) with Pre => Self.Kind = Static_Primary; -- Invalidate caches in Self. This: -- -- * invalidates the environment lookup cache; -- * invalidates the cached parent environment link (if the parent link -- is dynamic); -- * deactivate referenced environments. procedure Recompute_Referenced_Envs (Self : Lexical_Env) with Pre => Self.Kind = Static_Primary; -- Recompute the referenced environments for this environment. In other -- words, re-resolve the R.Getter for all referenced environments R in -- Self. -- -- Before calling this, one must call Deactivate_Referenced_Envs on every -- referenced environment reachable from Self: referenced environments in -- Self, but also referenced environments in Self's parents. procedure Reset_Caches (Self : Lexical_Env) with Pre => Self.Kind = Static_Primary; --- Reset the caches for this env function Get (Self : Lexical_Env; Key : Symbol_Type; From : Node_Type := No_Node; Lookup_Kind : Lookup_Kind_Type := Recursive; Categories : Ref_Categories := All_Cats) return Entity_Vectors.Vector; -- Get the array of entities for this Key. If From is given, then nodes -- will be filtered according to the Can_Reach primitive given as parameter -- for the generic package. -- -- If Recursive, look for Key in all Self's parents as well, and in -- referenced envs. Otherwise, limit the search to Self. -- -- If Filter is not null, use it as a filter to disable lookup on envs for -- which Filter.all (From, Env) returns False. -- -- If ``Key`` is null, return every entity in the scope regardless of name. function Get (Self : Lexical_Env; Key : Symbol_Type; From : Node_Type := No_Node; Lookup_Kind : Lookup_Kind_Type := Recursive; Categories : Ref_Categories := All_Cats) return Entity_Array; function Get_First (Self : Lexical_Env; Key : Symbol_Type; From : Node_Type := No_Node; Lookup_Kind : Lookup_Kind_Type := Recursive; Categories : Ref_Categories := All_Cats) return Entity; -- Like Get, but return only the first matching entity. Return a null -- entity if no entity is found. function Orphan (Self : Lexical_Env) return Lexical_Env; -- Return a dynamically allocated copy of Self that has no parent. If Self -- is a grouped environment or if it has any transitive parent, this raises -- a property error. function Parent (Self : Lexical_Env) return Lexical_Env; -- Return the parent lexical env for env Self or Empty_Env if Self has no -- parent. function Env_Node (Self : Lexical_Env) return Node_Type; -- Return the node associated to Self, if any function Group (Envs : Lexical_Env_Array; With_Md : Node_Metadata := Empty_Metadata) return Lexical_Env; -- Return a lexical environment that logically groups together multiple -- lexical environments. Note that this does not modify the input -- environments, however it returns a new owning reference. -- -- If this array is empty, Empty_Env is returned. Note that if Envs'Length -- is greater than 1, the result is dynamically allocated. -- -- If With_Md is passed, the resulting env will have the passed metadata -- instance as default metadata. As a result, any node returned will have -- its metadata combined with the default metadata. function Rebind_Env (Base_Env : Lexical_Env; E_Info : Entity_Info) return Lexical_Env; function Rebind_Env (Base_Env : Lexical_Env; Rebindings : Env_Rebindings) return Lexical_Env; -- Return a new env based on Base_Env to include the given Rebindings procedure Inc_Ref (Self : Lexical_Env); -- If Self is a ref-counted lexical env, increment this reference count. Do -- nothing otherwise. procedure Dec_Ref (Self : in out Lexical_Env); -- If Self is a ref-counted lexical env, decrement this reference count and -- set it to null. Also destroy it if the count drops to 0. Do nothing -- otherwise. function Shed_Rebindings (E_Info : Entity_Info; Env : Lexical_Env) return Entity_Info; -- Return a new entity info from E_Info, shedding env rebindings that are -- not in the parent chain for the env From_Env. function Equivalent (Left, Right : Lexical_Env) return Boolean; -- Return whether L and R are equivalent lexical environments: same -- envs topology, same internal map, etc. --------------------------------------- -- Lexical environment lookup caches -- --------------------------------------- type Lookup_Result_Item is record E : Entity; -- Returned entity Filter_From : Boolean; -- Whether to filter with Can_Reach Override_Filter_Node : Node_Type := No_Node; -- Node to use when filtering with Can_Reach, if different from the -- Entity. end record; -- Lexical environment lookup result item. Lookups return arrays of these. package Lookup_Result_Item_Vectors is new Gpr_Parser_Support.Vectors (Lookup_Result_Item, Small_Vector_Capacity => 2); subtype Lookup_Result_Vector is Lookup_Result_Item_Vectors.Vector; Empty_Lookup_Result_Vector : Lookup_Result_Vector renames Lookup_Result_Item_Vectors.Empty_Vector; subtype Lookup_Result_Array is Lookup_Result_Item_Vectors.Elements_Array; Empty_Lookup_Result_Array : Lookup_Result_Array renames Lookup_Result_Item_Vectors.Empty_Array; type Lookup_Cache_Key is record Symbol : Symbol_Type; -- Symbol for this lookup Rebindings : Env_Rebindings; -- Rebindings used for this lookup Metadata : Node_Metadata; -- Metadata used for this lookup Categories : Ref_Categories := All_Cats; end record; -- Key in environment lookup caches. Basically the parameters for the Get -- functions that are relevant for caching. type Lookup_Cache_Entry_State is (Computing, Computed, None); -- Status of an entry in lexical environment lookup caches. -- -- Computing represents the dummy entry that is inserted during original -- computation. That means that a cache hit that returns a Computing entry -- reveals an infinite recursion (a lexical environment lookup that calls -- itself recursively). -- -- Computed represents an entry whose elements are fine to be used as a -- cache hit. -- -- None represents a cleared cache entry, i.e. getting it out of a cache -- means there's a cache miss. Using this state instead of just removing -- the cache is used to avoid destroying the cache map when clearing -- caches. type Lookup_Cache_Entry is record State : Lookup_Cache_Entry_State; Elements : Lookup_Result_Item_Vectors.Vector; end record; -- Result of a lexical environment lookup No_Lookup_Cache_Entry : constant Lookup_Cache_Entry := (None, Empty_Lookup_Result_Vector); function Hash (Self : Lookup_Cache_Key) return Hash_Type is (Combine (Combine (Hash (Self.Symbol), Hash (Self.Rebindings)), Metadata_Hash (Self.Metadata))); package Lookup_Cache_Maps is new Ada.Containers.Hashed_Maps (Key_Type => Lookup_Cache_Key, Element_Type => Lookup_Cache_Entry, Hash => Hash, Equivalent_Keys => "=", "=" => "="); ---------------------------------------- -- Lexical environment representation -- ---------------------------------------- package Lexical_Env_Vectors is new Gpr_Parser_Support.Vectors (Lexical_Env); type Internal_Map_Node is record Node : Node_Type; -- If Resolver is null, this is the node that lexical env lookup must -- return. Otherwise, it is the argument to pass to Resolver in order to -- get the result. Md : Node_Metadata; -- Metadata associated to Node Resolver : Entity_Resolver; end record; package Internal_Map_Node_Vectors is new Gpr_Parser_Support.Vectors (Internal_Map_Node); subtype Internal_Map_Node_Array is Internal_Map_Node_Vectors.Elements_Array; package Internal_Map_Node_Maps is new Ada.Containers.Ordered_Maps (Key_Type => Node_Type, Element_Type => Internal_Map_Node); type Internal_Map_Node_Map is access all Internal_Map_Node_Maps.Map; type Internal_Map_Element is record Native_Nodes : Internal_Map_Node_Vectors.Vector; -- List of node that belong to the same unit as the lexical env that -- owns the map. Foreign_Nodes : Internal_Map_Node_Map := null; -- List of nodes that belong to other units (as keys), and associated -- metadata/resolvers when applicable (as values). Nodes are sorted by -- unit filename/sloc range to preserve determinism. -- -- NOTE: The list is null if there is no foreign node. end record; -- Set of nodes associated to a symbol in a lexical environment Empty_Internal_Map_Element : constant Internal_Map_Element := (others => <>); package Internal_Envs is new Ada.Containers.Hashed_Maps (Key_Type => Symbol_Type, Element_Type => Internal_Map_Element, Hash => Hash, Equivalent_Keys => "="); type Internal_Map is access all Internal_Envs.Map; -- Internal maps of Symbols to vectors of nodes procedure Destroy is new Ada.Unchecked_Deallocation (Internal_Envs.Map, Internal_Map); type Lexical_Env_Array_Access is access all Lexical_Env_Array; procedure Destroy is new Ada.Unchecked_Deallocation (Lexical_Env_Array, Lexical_Env_Array_Access); type Lexical_Env_Record (Kind : Lexical_Env_Kind) is new Base_Lexical_Env_Record with record case Kind is when Primary_Kind => Parent : Lexical_Env := Null_Lexical_Env; -- Parent environment for this env. Null by default. Transitive_Parent : Boolean := False; -- Whether the parent link is transitive or not Node : Node_Type := No_Node; -- Node for which this environment was created Rebindings_Pool : Env_Rebindings_Pool := null; -- Cache for all parent-less env rebindings whose Old_Env is the -- lexical environment that owns this pool. As a consequence, this -- is allocated only for primary lexical environments that are -- rebindable. case Kind is when Static_Primary => Lookup_Cache : Lookup_Cache_Maps.Map; -- Cache for lexical environment lookups Lookup_Cache_Valid : Boolean := True; -- Whether Cached_Results contains lookup results that can -- be currently reused (i.e. whether they are not stale). Referenced_Envs : Referenced_Envs_Vectors.Vector; -- A list of environments referenced by this environment Rebindings_Assoc_Ref_Env : Integer := -1; -- If present, index to the Referenced_Envs vector that -- points to an environment we want to look at when shedding -- rebindings. If the referenced env is not none, it will be -- considered in place of Self when shedding rebindings. Map : Internal_Map := null; -- Map containing mappings from symbols to nodes for this -- env instance. If the lexical env is refcounted, then it -- does not own this env. when Dynamic_Primary => Assocs_Getter : Inner_Env_Assocs_Resolver; -- Callback to query environment associations Assoc_Resolver : Entity_Resolver; -- Callback to resolve returned entities when others => null; -- Unreachable end case; when others => Ref_Count : Integer := 1; -- Number of owners. It is initially set to 1. When it drops to 0, -- the env can be destroyed. case Kind is when Primary_Kind => null; -- Unreachable when Orphaned => Orphaned_Env : Lexical_Env; -- Lexical environment that is orphaned when Grouped => Grouped_Envs : Lexical_Env_Array_Access; -- Array of lexical environment that are grouped together Default_Md : Node_Metadata := Empty_Metadata; -- Default metadata to use for lookups when Rebound => Rebound_Env : Lexical_Env; -- Lexical environment that is rebound Rebindings : Env_Rebindings; -- Rebindings for this rebound environment Rebindings_Version : Version_Number; -- Version of Rebindings at the time of creation of this -- rebound env. This is used to determine if the rebindings -- has become stale. end case; end case; end record; function Wrap (Env : Lexical_Env_Access; Owner : Generic_Unit_Ptr := No_Generic_Unit) return Lexical_Env; function Wrap is new Ada.Unchecked_Conversion (Lexical_Env_Access, Generic_Lexical_Env_Ptr); function Unwrap is new Ada.Unchecked_Conversion (Generic_Lexical_Env_Ptr, Lexical_Env_Access); function Unwrap (Self : Lexical_Env) return Lexical_Env_Access is (Unwrap (Self.Env)); procedure Destroy (Self : in out Lexical_Env); -- Deallocate the resources allocated to the Self lexical environment. Must -- not be used directly for ref-counted envs. function Is_Foreign (Self : Lexical_Env; Node : Node_Type) return Boolean is (Unwrap (Self).Node = No_Node or else Node_Unit (Unwrap (Self).Node) /= Node_Unit (Node)) with Pre => Self.Kind in Primary_Kind; -- Return whether Node is a foreign node relative to Self (i.e. whether -- they both belong to different units). This is true even for the empty -- env and the root one, which are not tied to any unit. function Is_Foreign_Not_Empty (Self : Lexical_Env; Node : Node_Type) return Boolean is (Self /= Empty_Env and then Is_Foreign (Self, Node)); -- Same as Is_Foreign, but return False for the empty env function Is_Foreign_Strict (Self : Lexical_Env; Node : Node_Type) return Boolean is (Unwrap (Self).Node /= No_Node and then Is_Foreign (Self, Node)); -- Same as Is_Foreign, but return False for the empty and root envs ------------------- -- Debug helpers -- ------------------- function Lexical_Env_Image (Self : Lexical_Env; Env_Id : String := ""; Parent_Env_Id : String := ""; Dump_Addresses : Boolean := False; Dump_Content : Boolean := True; Prefix : String := ""; Short_Node : Boolean := False) return String; -- Return a textual representation of Self. -- -- If provided, Env_Id and Parent_Env_Id are used to designate Self and its -- parent environment. -- -- If Dump_Addresses, include the hexadecimal address of each represented -- lexical environment. -- -- If Dump_Content, show the inner data in lexical environments: referenced -- environments and internal map for primary environments, pointed -- environment in orphaned environments, etc. If Dump_Content is true, the -- result is a multi-line string, otherwise it's guaranteed to fit on a -- single line. -- -- Prefix is used to prefix each emitted line. function Env_Image (Self : Lexical_Env) return String is (Lexical_Env_Image (Self, Dump_Content => False, Short_Node => True)); function Lexical_Env_Parent_Chain (Self : Lexical_Env) return String; procedure Dump_One_Lexical_Env (Self : Lexical_Env; Env_Id : String := ""; Parent_Env_Id : String := ""; Dump_Addresses : Boolean := False; Dump_Content : Boolean := True); procedure Dump_Lexical_Env_Parent_Chain (Self : Lexical_Env); private function Hash (Env : Lexical_Env_Access) return Hash_Type; Empty_Env_Map : aliased Internal_Envs.Map := Internal_Envs.Empty_Map; Empty_Env_Record : aliased Lexical_Env_Record := (Kind => Static_Primary, Parent => Null_Lexical_Env, Transitive_Parent => False, Node => No_Node, Referenced_Envs => <>, Map => Empty_Env_Map'Access, Rebindings_Pool => null, Lookup_Cache_Valid => False, Lookup_Cache => Lookup_Cache_Maps.Empty_Map, Rebindings_Assoc_Ref_Env => -1); -- Because of circular elaboration issues, we cannot call Hash here to -- compute the real hash. Using a dummy precomputed one is probably enough. Empty_Env : constant Lexical_Env := (Env => Empty_Env_Record'Access, Hash => 0, Kind => Static_Primary, Owner => No_Generic_Unit, Version => 0); end Gpr_Parser_Support.Lexical_Envs_Impl;
jrcarter/Ada_GUI
Ada
6,846
adb
-- Ada_GUI implementation based on Gnoga. Adapted 2021 -- -- -- GNOGA - The GNU Omnificent GUI for Ada -- -- -- -- G N O G A . C L I E N T . S T O R A G E -- -- -- -- B o d y -- -- -- -- -- -- Copyright (C) 2014 David Botton -- -- -- -- This library is free software; you can redistribute it and/or modify -- -- it under terms of the GNU General Public License as published by the -- -- Free Software Foundation; either version 3, or (at your option) any -- -- later version. This library is distributed in the hope that it will be -- -- useful, but WITHOUT ANY WARRANTY; without even the implied warranty of -- -- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. -- -- -- -- As a special exception under Section 7 of GPL version 3, you are -- -- granted additional permissions described in the GCC Runtime Library -- -- Exception, version 3.1, as published by the Free Software Foundation. -- -- -- -- You should have received a copy of the GNU General Public License and -- -- a copy of the GCC Runtime Library Exception along with this program; -- -- see the files COPYING3 and COPYING.RUNTIME respectively. If not, see -- -- <http://www.gnu.org/licenses/>. -- -- -- -- As a special exception, if other files instantiate generics from this -- -- unit, or you link this unit with other files to produce an executable, -- -- this unit does not by itself cause the resulting executable to be -- -- covered by the GNU General Public License. This exception does not -- -- however invalidate any other reasons why the executable file might be -- -- covered by the GNU Public License. -- -- -- -- For more information please go to http://www.gnoga.com -- ------------------------------------------------------------------------------ with Ada_GUI.Gnoga.Server.Connection; package body Ada_GUI.Gnoga.Client_Storage is -- One local and one session storage is available across an entire -- scheme://domain:port. Give that there is no point in supporting access -- to non-Gnoga iFrames or Popups since if they are not form the same -- scheme://domain:port the browser security would not allow access -- anyways. procedure Execute (Storage : in out Storage_Type'Class; Method : in String); function Execute (Storage : Storage_Type'Class; Method : String) return String; -- Execute access to Storage on its Connection_ID ------------- -- Execute -- ------------- procedure Execute (Storage : in out Storage_Type'Class; Method : in String) is Message_Script : constant String := Storage.Script_Accessor & "." & Method; begin if Storage.Connection_ID = Gnoga.No_Connection then raise Program_Error with "Use of Storage without Connection"; end if; Gnoga.Server.Connection.Execute_Script (ID => Storage.Connection_ID, Script => Message_Script); end Execute; function Execute (Storage : Storage_Type'Class; Method : String) return String is Message_Script : constant String := Storage.Script_Accessor & "." & Method; begin if Storage.Connection_ID = Gnoga.No_Connection then raise Program_Error with "Use of Storage without Connection"; end if; return Gnoga.Server.Connection.Execute_Script (ID => Storage.Connection_ID, Script => Message_Script); end Execute; ------------ -- Length -- ------------ function Length (Storage : Storage_Type) return Natural is begin return Natural'Value (Execute (Storage, "length")); end Length; --------- -- Key -- --------- function Key (Storage : Storage_Type; Value : Positive) return String is JS_Value : constant Natural := Value - 1; begin return Execute (Storage, "key(" & JS_Value'Img & ")"); end Key; --------- -- Set -- --------- procedure Set (Storage : in out Storage_Type; Name, Value : String) is begin Execute (Storage, "setItem ('" & Escape_Quotes (Name) & "','" & Escape_Quotes (Value) & "')"); end Set; --------- -- Get -- --------- function Get (Storage : Storage_Type; Name : String) return String is begin return Execute (Storage, "getItem('" & Escape_Quotes (Name) & "')"); end Get; --------------------- -- Script_Accessor -- --------------------- function Script_Accessor (Storage : Storage_Type) return String is begin raise Program_Error with "Use Session_Storage_Type or Local_Storage_Type"; return ""; end Script_Accessor; ------------------- -- Local_Storage -- ------------------- function Local_Storage (Object : Gnoga.Gui.Base_Type'Class) return Local_Storage_Type is begin return Local_Storage_Type'(Connection_ID => Object.Connection_ID); end Local_Storage; --------------------- -- Script_Accessor -- --------------------- overriding function Script_Accessor (Storage : Local_Storage_Type) return String is pragma Unreferenced (Storage); begin return "localStorage"; end Script_Accessor; --------------------- -- Session_Storage -- --------------------- function Session_Storage (Object : Gnoga.Gui.Base_Type'Class) return Session_Storage_Type is begin return Session_Storage_Type'(Connection_ID => Object.Connection_ID); end Session_Storage; --------------------- -- Script_Accessor -- --------------------- overriding function Script_Accessor (Storage : Session_Storage_Type) return String is pragma Unreferenced (Storage); begin return "sessionStorage"; end Script_Accessor; end Ada_GUI.Gnoga.Client_Storage;
stcarrez/ada-keystore
Ada
2,333
adb
----------------------------------------------------------------------- -- intl -- Small libintl binding -- Copyright (C) 2019 Stephane Carrez -- Written by Stephane Carrez ([email protected]) -- -- Licensed under the Apache License, Version 2.0 (the "License"); -- you may not use this file except in compliance with the License. -- You may obtain a copy of the License at -- -- http://www.apache.org/licenses/LICENSE-2.0 -- -- Unless required by applicable law or agreed to in writing, software -- distributed under the License is distributed on an "AS IS" BASIS, -- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -- See the License for the specific language governing permissions and -- limitations under the License. ----------------------------------------------------------------------- with Interfaces.C.Strings; package body Intl is function Sys_Gettext (Msg : in String) return Interfaces.C.Strings.chars_ptr with Import => True, Convention => C, Link_Name => "gettext"; procedure Sys_Textdomain (Domain : in String) with Import => True, Convention => C, Link_Name => "textdomain"; procedure Sys_Bindtextdomain (Domain : in String; Dirname : in String) with Import => True, Convention => C, Link_Name => "bindtextdomain"; function Sys_Setlocale (Category : in Integer; Locale : in String) return Interfaces.C.Strings.chars_ptr with Import => True, Convention => C, Link_Name => "setlocale"; function Gettext (Message : in String) return String is begin return Interfaces.C.Strings.Value (Sys_Gettext (Message & ASCII.NUL)); end Gettext; LC_ALL : constant Integer := 6; Locale : Interfaces.C.Strings.chars_ptr; procedure Initialize (Domain : in String; Dirname : in String) is begin Locale := Sys_Setlocale (LC_ALL, "" & ASCII.NUL); Sys_Textdomain (Domain & ASCII.NUL); Sys_Bindtextdomain (Domain & ASCII.NUL, Dirname & ASCII.NUL); end Initialize; function Current_Locale return String is use type Interfaces.C.Strings.chars_ptr; begin if Locale = Interfaces.C.Strings.Null_Ptr then return "C"; else return Interfaces.C.Strings.Value (Locale); end if; end Current_Locale; end Intl;
shintakezou/drake
Ada
2,345
adb
-- reference: -- https://blogs.msdn.microsoft.com/oldnewthing/20140307-00/?p=1573 with Ada.Exception_Identification.From_Here; with System.Native_Time; with C.winbase; with C.windef; package body System.Native_Calendar.Time_Zones is use Ada.Exception_Identification.From_Here; use type System.Native_Time.Nanosecond_Number; use type C.windef.WINBOOL; -- Raymond Chen explains: -- SystemTimeToTzSpecificLocalTime uses the time zone in effect at the time -- being converted, whereas the FileTimeToLocalFileTime function uses the -- time zone in effect right now. function UTC_Time_Offset (Date : Time) return Time_Offset is Offset : System.Native_Time.Nanosecond_Number; begin declare File_Time : aliased constant C.windef.FILETIME := To_Native_Time (Duration (Date)); System_Time : aliased C.winbase.SYSTEMTIME; Local_System_Time : aliased C.winbase.SYSTEMTIME; Local_File_Time : aliased C.windef.FILETIME; Backed_File_Time : aliased C.windef.FILETIME; begin if not ( C.winbase.FileTimeToSystemTime ( File_Time'Access, System_Time'Access) /= C.windef.FALSE and then C.winbase.SystemTimeToTzSpecificLocalTime ( null, System_Time'Access, Local_System_Time'Access) /= C.windef.FALSE and then C.winbase.SystemTimeToFileTime ( Local_System_Time'Access, Local_File_Time'Access) /= C.windef.FALSE and then C.winbase.SystemTimeToFileTime ( System_Time'Access, Backed_File_Time'Access) /= C.windef.FALSE) then Raise_Exception (Time_Error'Identity); end if; -- Use Backed_File_Time instead of Date (or File_Time) because the -- unit of FILETIME is 100 nano-seconds but the unit of SYSTEMTIME -- is one milli-second. Offset := System.Native_Time.Nanosecond_Number'Integer_Value ( To_Time (Local_File_Time) - To_Time (Backed_File_Time)); end; return Time_Offset (Offset / 60_000_000_000); end UTC_Time_Offset; end System.Native_Calendar.Time_Zones;
stcarrez/ada-util
Ada
11,665
adb
----------------------------------------------------------------------- -- util-commands-drivers -- Support to make command line tools -- Copyright (C) 2017, 2018, 2019, 2021, 2022, 2023 Stephane Carrez -- Written by Stephane Carrez ([email protected]) -- -- Licensed under the Apache License, Version 2.0 (the "License"); -- you may not use this file except in compliance with the License. -- You may obtain a copy of the License at -- -- http://www.apache.org/licenses/LICENSE-2.0 -- -- Unless required by applicable law or agreed to in writing, software -- distributed under the License is distributed on an "AS IS" BASIS, -- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -- See the License for the specific language governing permissions and -- limitations under the License. ----------------------------------------------------------------------- with Util.Log.Loggers; with Util.Strings.Formats; package body Util.Commands.Drivers is use Ada.Strings.Unbounded; -- The logger Logs : constant Util.Log.Loggers.Logger := Util.Log.Loggers.Create (Driver_Name); function "-" (Message : in String) return String is (Translate (Message)) with Inline; -- ------------------------------ -- Get the description associated with the command. -- ------------------------------ function Get_Description (Command : in Command_Type) return String is begin return To_String (Command.Description); end Get_Description; -- ------------------------------ -- Get the name used to register the command. -- ------------------------------ function Get_Name (Command : in Command_Type) return String is begin return To_String (Command.Name); end Get_Name; -- ------------------------------ -- Write the command usage. -- ------------------------------ procedure Usage (Command : in out Command_Type; Name : in String; Context : in out Context_Type) is Config : Config_Type; begin Command_Type'Class (Command).Setup (Config, Context); Config_Parser.Usage (Name, Config); end Usage; -- ------------------------------ -- Print a message for the command. The level indicates whether the message is an error, -- warning or informational. The command name can be used to known the originator. -- The <tt>Log</tt> operation is redirected to the driver's <tt>Log</tt> procedure. -- ------------------------------ procedure Log (Command : in Command_Type; Level : in Util.Log.Level_Type; Name : in String; Message : in String) is begin Command.Driver.Log (Level, Name, Message); end Log; -- ------------------------------ -- Execute the help command with the arguments. -- Print the help for every registered command. -- ------------------------------ overriding procedure Execute (Command : in out Help_Command_Type; Name : in String; Args : in Argument_List'Class; Context : in out Context_Type) is procedure Compute_Size (Position : in Command_Sets.Cursor); procedure Print (Position : in Command_Sets.Cursor); Column : Positive := 1; procedure Compute_Size (Position : in Command_Sets.Cursor) is Cmd : constant Command_Access := Command_Sets.Element (Position); Len : constant Natural := Length (Cmd.Name); begin if Natural (Column) < Len then Column := Positive (Len); end if; end Compute_Size; procedure Print (Position : in Command_Sets.Cursor) is Cmd : constant Command_Access := Command_Sets.Element (Position); Name : constant String := To_String (Cmd.Name); Desc : constant String := To_String (Cmd.Description); Max : constant Positive := 3 + Column + Desc'Length; Line : String (1 .. Max) := (others => ' '); begin Line (3 .. 3 + Name'Length - 1) := Name; Line (Column + 4 .. Line'Last) := Desc; IO.Put_Line (Line); end Print; begin Logs.Debug ("Execute command {0}", Name); if Args.Get_Count = 0 then Usage (Command.Driver.all, Args, Context); IO.New_Line (IO.Count_Type'First); IO.Put_Line (Strings.Formats.Format (-("Type '{0} help {command}' for help " & "on a specific command."), Driver_Name)); IO.Put_Line (-("Available subcommands:")); Command.Driver.List.Iterate (Process => Compute_Size'Access); Command.Driver.List.Iterate (Process => Print'Access); else declare Cmd_Name : constant String := Args.Get_Argument (1); Target_Cmd : constant Command_Access := Command.Driver.Find_Command (Cmd_Name); begin if Target_Cmd = null then Logs.Error (-("unknown command '{0}'"), Cmd_Name); raise Not_Found; else Target_Cmd.Help (Cmd_Name, Context); end if; end; end if; end Execute; -- ------------------------------ -- Write the help associated with the command. -- ------------------------------ overriding procedure Help (Command : in out Help_Command_Type; Name : in String; Context : in out Context_Type) is begin null; end Help; -- ------------------------------ -- Report the command usage. -- ------------------------------ procedure Usage (Driver : in Driver_Type; Args : in Argument_List'Class; Context : in out Context_Type; Name : in String := "") is begin IO.Put_Line (To_String (Driver.Desc)); IO.New_Line (IO.Count_Type'First); if Name'Length > 0 then declare Command : constant Command_Access := Driver.Find_Command (Name); begin if Command /= null then Command.Usage (Name, Context); else IO.Put_Line (-("Invalid command")); end if; end; else IO.Put_Line (-("Usage: ") & Args.Get_Command_Name & " " & To_String (Driver.Usage)); end if; end Usage; -- ------------------------------ -- Set the driver description printed in the usage. -- ------------------------------ procedure Set_Description (Driver : in out Driver_Type; Description : in String) is begin Driver.Desc := Ada.Strings.Unbounded.To_Unbounded_String (Description); end Set_Description; -- ------------------------------ -- Set the driver usage printed in the usage. -- ------------------------------ procedure Set_Usage (Driver : in out Driver_Type; Usage : in String) is begin Driver.Usage := Ada.Strings.Unbounded.To_Unbounded_String (Usage); end Set_Usage; -- ------------------------------ -- Register the command under the given name. -- ------------------------------ procedure Add_Command (Driver : in out Driver_Type; Name : in String; Command : in Command_Access) is begin Command.Name := To_Unbounded_String (Name); Command.Driver := Driver'Unchecked_Access; Driver.List.Include (Command); end Add_Command; procedure Add_Command (Driver : in out Driver_Type; Name : in String; Description : in String; Command : in Command_Access) is begin Command.Name := To_Unbounded_String (Name); Command.Description := To_Unbounded_String (Description); Add_Command (Driver, Name, Command); end Add_Command; -- ------------------------------ -- Register the command under the given name. -- ------------------------------ procedure Add_Command (Driver : in out Driver_Type; Name : in String; Description : in String; Handler : in Command_Handler) is Command : constant Command_Access := new Handler_Command_Type '(Driver => Driver'Unchecked_Access, Description => To_Unbounded_String (Description), Name => To_Unbounded_String (Name), Handler => Handler); begin Driver.List.Include (Command); end Add_Command; -- ------------------------------ -- Find the command having the given name. -- Returns null if the command was not found. -- ------------------------------ function Find_Command (Driver : in Driver_Type; Name : in String) return Command_Access is Cmd : aliased Help_Command_Type; Pos : Command_Sets.Cursor; begin Cmd.Name := To_Unbounded_String (Name); Pos := Driver.List.Find (Cmd'Unchecked_Access); if Command_Sets.Has_Element (Pos) then return Command_Sets.Element (Pos); else return null; end if; end Find_Command; -- ------------------------------ -- Execute the command registered under the given name. -- ------------------------------ procedure Execute (Driver : in Driver_Type; Name : in String; Args : in Argument_List'Class; Context : in out Context_Type) is procedure Execute (Cmd_Args : in Argument_List'Class); Command : constant Command_Access := Driver.Find_Command (Name); procedure Execute (Cmd_Args : in Argument_List'Class) is begin Command.Execute (Name, Cmd_Args, Context); end Execute; begin if Command /= null then declare Config : Config_Type; begin Command.Setup (Config, Context); Config_Parser.Execute (Config, Args, Execute'Access); end; else Logs.Error (-("unknown command '{0}'"), Name); raise Not_Found; end if; end Execute; -- ------------------------------ -- Print a message for the command. The level indicates whether the message is an error, -- warning or informational. The command name can be used to known the originator. -- ------------------------------ procedure Log (Driver : in Driver_Type; Level : in Util.Log.Level_Type; Name : in String; Message : in String) is pragma Unreferenced (Driver); begin Logs.Print (Level, "{0}: {1}", Name, Message); end Log; -- ------------------------------ -- Execute the command with the arguments. -- ------------------------------ overriding procedure Execute (Command : in out Handler_Command_Type; Name : in String; Args : in Argument_List'Class; Context : in out Context_Type) is begin Command.Handler (Name, Args, Context); end Execute; -- ------------------------------ -- Write the help associated with the command. -- ------------------------------ overriding procedure Help (Command : in out Handler_Command_Type; Name : in String; Context : in out Context_Type) is begin null; end Help; end Util.Commands.Drivers;
AdaCore/Ada_Drivers_Library
Ada
3,345
ads
------------------------------------------------------------------------------ -- -- -- Copyright (C) 2015-2016, AdaCore -- -- -- -- Redistribution and use in source and binary forms, with or without -- -- modification, are permitted provided that the following conditions are -- -- met: -- -- 1. Redistributions of source code must retain the above copyright -- -- notice, this list of conditions and the following disclaimer. -- -- 2. Redistributions in binary form must reproduce the above copyright -- -- notice, this list of conditions and the following disclaimer in -- -- the documentation and/or other materials provided with the -- -- distribution. -- -- 3. Neither the name of the copyright holder nor the names of its -- -- contributors may be used to endorse or promote products derived -- -- from this software without specific prior written permission. -- -- -- -- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -- -- "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -- -- LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -- -- A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -- -- HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -- -- SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -- -- LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -- -- DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -- -- THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -- -- (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -- -- OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -- -- -- ------------------------------------------------------------------------------ -- Simulate a disk by readind into a file with HAL.Block_Drivers; use HAL.Block_Drivers; with HAL; use HAL; with File_IO; use File_IO; package File_Block_Drivers is type File_Block_Driver is limited new Block_Driver with private; function Open (This : in out File_Block_Driver; Path : String; Mode : File_Mode) return Status_Code; procedure Close (This : in out File_Block_Driver); overriding function Read (This : in out File_Block_Driver; Block_Number : UInt64; Data : out Block) return Boolean; overriding function Write (This : in out File_Block_Driver; Block_Number : UInt64; Data : Block) return Boolean; private type File_Block_Driver is limited new Block_Driver with record FD : File_Descriptor; Mode : File_Mode; end record; end File_Block_Drivers;
sungyeon/drake
Ada
36
adb
../machine-apple-darwin/s-nadite.adb
reznikmm/matreshka
Ada
7,380
ads
------------------------------------------------------------------------------ -- -- -- Matreshka Project -- -- -- -- SQL Database Access -- -- -- -- Runtime Library Component -- -- -- ------------------------------------------------------------------------------ -- -- -- Copyright © 2011-2012, Vadim Godunko <[email protected]> -- -- 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: 1793 $ $Date: 2011-06-11 10:40:44 +0300 (Сб, 11 июн 2011) $ ------------------------------------------------------------------------------ -- This package provides implementation of Query abstraction for PostgreSQL. ------------------------------------------------------------------------------ with Ada.Finalization; with League.Calendars; with League.Text_Codecs; package Matreshka.Internals.SQL_Drivers.Firebird.Fields is type Isc_Sqlvar_Access is access all Isc_Sqlvar; type Byte is mod 2 ** 8; type Sql_Data_Array is array (Isc_Short range <>) of Byte; for Sql_Data_Array'Component_Size use 8; pragma Convention (C, Sql_Data_Array); type Sql_Data_Array_Access is access all Sql_Data_Array; type Field is new Ada.Finalization.Controlled with record Srv_Sql_Type : Isc_Sqltype := Isc_Type_Empty; Srv_Sql_Subtype : Isc_Short := 0; Srv_Sql_Scale : Isc_Short := 0; Srv_Sql_Len : Isc_Short := 0; -- Point to the sqlvar in the owner object Sqlvar : Isc_Sqlvar_Access := null; Sql_Dada_Space : Sql_Data_Array_Access := null; Codec : access League.Text_Codecs.Text_Codec; Utf : Boolean; end record; type Field_Access is access all Field; overriding procedure Finalize (Self : in out Field); procedure Free_Sqldata (Self : in out Field); procedure Adjust_Sqldata (Self : not null access Field); procedure Adjust_Sqlind (Self : not null access Field); procedure Alloc_Sqlind (Self : not null access Field); function Is_Nullable (Self : not null access Field) return Boolean; procedure Is_Nullable (Self : not null access Field; Value : Boolean); procedure Reserv_Sqldata (Self : not null access Field; Size : Isc_Short); procedure Alloc_Sqldata (Self : not null access Field; Size : Isc_Short); procedure Set_Null (Self : not null access Field; Value : Boolean); function Value (Self : not null access Field) return League.Holders.Holder; procedure Value (Self : not null access Field; Holder : League.Holders.Holder); procedure As_String (Self : not null access Field; Value : League.Strings.Universal_String); function As_String (Self : not null access Field) return League.Strings.Universal_String; function Server_Sql_Type (Self : not null access Field) return Isc_Sqltype; function As_Date (Self : not null access Field) return League.Calendars.Date; procedure As_Date (Self : not null access Field; Value : League.Calendars.Date); function As_Time (Self : not null access Field) return League.Calendars.Time; procedure As_Time (Self : not null access Field; Value : League.Calendars.Time); function As_Date_Time (Self : not null access Field) return League.Calendars.Date_Time; procedure As_Date_Time (Self : not null access Field; Value : League.Calendars.Date_Time); function As_Universal_Integer (Self : not null access Field) return League.Holders.Universal_Integer; procedure As_Universal_Integer (Self : not null access Field; Value : League.Holders.Universal_Integer); function As_Universal_Float (Self : not null access Field) return League.Holders.Universal_Float; procedure As_Universal_Float (Self : not null access Field; Value : League.Holders.Universal_Float); function As_Short_Float (Self : not null access Field) return Short_Float; function As_Long_Float (Self : not null access Field) return Long_Float; function As_Short_Integer (Self : not null access Field) return Short_Integer; function As_Long_Integer (Self : not null access Field) return Long_Integer; function As_Boolean (Self : not null access Field) return Boolean; procedure Set_Value (Self : not null access Field; Sql_Type : Isc_Sqltype; Size : Isc_Short; Value : Isc_Address); function Is_Null (Self : not null access Field) return Boolean; function Sql_Type (Self : not null access Field) return Isc_Sqltype; end Matreshka.Internals.SQL_Drivers.Firebird.Fields;
persan/a-cups
Ada
1,680
ads
pragma Ada_2005; pragma Style_Checks (Off); with Interfaces.C; use Interfaces.C; with Interfaces.C.Strings; with System; with CUPS.stdint_h; private package CUPS.bits_netdb_h is -- Copyright (C) 1996-2016 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 -- <http://www.gnu.org/licenses/>. -- Description of data base entry for a single network. NOTE: here a -- poor assumption is made. The network number is expected to fit -- into an unsigned long int variable. -- Official name of network. type netent is record n_name : Interfaces.C.Strings.chars_ptr; -- bits/netdb.h:28 n_aliases : System.Address; -- bits/netdb.h:29 n_addrtype : aliased int; -- bits/netdb.h:30 n_net : aliased CUPS.stdint_h.uint32_t; -- bits/netdb.h:31 end record; pragma Convention (C_Pass_By_Copy, netent); -- bits/netdb.h:26 -- Alias list. -- Net address type. -- Network number. end CUPS.bits_netdb_h;
mfkiwl/ewok-kernel-security-OS
Ada
960
ads
-- -- Copyright 2018 The wookey project team <[email protected]> -- - 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 ewok.syscalls.handler with spark_mode => on is function svc_handler (frame_a : t_stack_frame_access) return t_stack_frame_access; end ewok.syscalls.handler;
reznikmm/matreshka
Ada
6,152
adb
------------------------------------------------------------------------------ -- -- -- Matreshka Project -- -- -- -- Open Document Toolkit -- -- -- -- Runtime Library Component -- -- -- ------------------------------------------------------------------------------ -- -- -- Copyright © 2013, Vadim Godunko <[email protected]> -- -- 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 ODF.Constants; with ODF.DOM.Elements.Table.Table_Row.Internals; with ODF.DOM.Iterators; with ODF.DOM.Visitors; package body Matreshka.ODF_Elements.Table.Table_Row is ------------------- -- Enter_Element -- ------------------- overriding procedure Enter_Element (Self : not null access Table_Table_Row_Node; Visitor : in out XML.DOM.Visitors.Abstract_Visitor'Class; Control : in out XML.DOM.Visitors.Traverse_Control) is begin if Visitor in ODF.DOM.Visitors.ODF_Visitor'Class then ODF.DOM.Visitors.ODF_Visitor'Class (Visitor).Enter_Table_Table_Row (ODF.DOM.Elements.Table.Table_Row.Internals.Create (Table_Table_Row_Access (Self)), Control); else Matreshka.DOM_Nodes.Elements.Abstract_Element (Self.all).Enter_Element (Visitor, Control); end if; end Enter_Element; -------------------- -- Get_Local_Name -- -------------------- overriding function Get_Local_Name (Self : not null access constant Table_Table_Row_Node) return League.Strings.Universal_String is begin return ODF.Constants.Table_Row_Name; end Get_Local_Name; ------------------- -- Leave_Element -- ------------------- overriding procedure Leave_Element (Self : not null access Table_Table_Row_Node; Visitor : in out XML.DOM.Visitors.Abstract_Visitor'Class; Control : in out XML.DOM.Visitors.Traverse_Control) is begin if Visitor in ODF.DOM.Visitors.ODF_Visitor'Class then ODF.DOM.Visitors.ODF_Visitor'Class (Visitor).Leave_Table_Table_Row (ODF.DOM.Elements.Table.Table_Row.Internals.Create (Table_Table_Row_Access (Self)), Control); else Matreshka.DOM_Nodes.Elements.Abstract_Element (Self.all).Leave_Element (Visitor, Control); end if; end Leave_Element; ------------------- -- Visit_Element -- ------------------- overriding procedure Visit_Element (Self : not null access Table_Table_Row_Node; Iterator : in out XML.DOM.Visitors.Abstract_Iterator'Class; Visitor : in out XML.DOM.Visitors.Abstract_Visitor'Class; Control : in out XML.DOM.Visitors.Traverse_Control) is begin if Iterator in ODF.DOM.Iterators.ODF_Iterator'Class then ODF.DOM.Iterators.ODF_Iterator'Class (Iterator).Visit_Table_Table_Row (Visitor, ODF.DOM.Elements.Table.Table_Row.Internals.Create (Table_Table_Row_Access (Self)), Control); else Matreshka.DOM_Nodes.Elements.Abstract_Element (Self.all).Visit_Element (Iterator, Visitor, Control); end if; end Visit_Element; end Matreshka.ODF_Elements.Table.Table_Row;
reznikmm/matreshka
Ada
7,774
adb
------------------------------------------------------------------------------ -- -- -- Matreshka Project -- -- -- -- XML Processor -- -- -- -- Runtime Library Component -- -- -- ------------------------------------------------------------------------------ -- -- -- Copyright © 2010, Vadim Godunko <[email protected]> -- -- 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.Wide_Wide_Text_IO; with League.Application; with League.Holders; with League.String_Vectors; with League.Strings; with XML.SAX.Error_Handlers; with XML.SAX.HTML5_Writers; with XML.SAX.Input_Sources.Streams.Files; with XML.SAX.Output_Destinations.Strings; with XML.SAX.Parse_Exceptions; with XML.SAX.Simple_Readers; with XML.Templates.Processors; procedure XHTML2HTML5 is use type League.Strings.Universal_String; function "+" (Text : Wide_Wide_String) return League.Strings.Universal_String renames League.Strings.To_Universal_String; package Error_Handlers is type Error_Handler is new XML.SAX.Error_Handlers.SAX_Error_Handler with record Clean : Boolean := True; end record; overriding procedure Error (Self : in out Error_Handler; Occurrence : XML.SAX.Parse_Exceptions.SAX_Parse_Exception; Success : in out Boolean); overriding function Error_String (Self : Error_Handler) return League.Strings.Universal_String is (League.Strings.Empty_Universal_String); overriding procedure Fatal_Error (Self : in out Error_Handler; Occurrence : XML.SAX.Parse_Exceptions.SAX_Parse_Exception); end Error_Handlers; -------------------- -- Error_Handlers -- -------------------- package body Error_Handlers is ----------- -- Error -- ----------- overriding procedure Error (Self : in out Error_Handler; Occurrence : XML.SAX.Parse_Exceptions.SAX_Parse_Exception; Success : in out Boolean) is begin Ada.Wide_Wide_Text_IO.Put_Line (Ada.Wide_Wide_Text_IO.Standard_Error, "Error:"); Ada.Wide_Wide_Text_IO.Put_Line (Ada.Wide_Wide_Text_IO.Standard_Error, Occurrence.Message.To_Wide_Wide_String); Ada.Wide_Wide_Text_IO.Put_Line (Ada.Wide_Wide_Text_IO.Standard_Error, " at " & Natural'Wide_Wide_Image (Occurrence.Line) & ":" & Natural'Wide_Wide_Image (Occurrence.Column)); Ada.Wide_Wide_Text_IO.Put_Line (Ada.Wide_Wide_Text_IO.Standard_Error, " of " & Occurrence.System_Id.To_Wide_Wide_String & " - " & Occurrence.Public_Id.To_Wide_Wide_String); Ada.Wide_Wide_Text_IO.New_Line (Ada.Wide_Wide_Text_IO.Standard_Error); end Error; ----------------- -- Fatal_Error -- ----------------- overriding procedure Fatal_Error (Self : in out Error_Handler; Occurrence : XML.SAX.Parse_Exceptions.SAX_Parse_Exception) is Success : Boolean := True; begin Ada.Wide_Wide_Text_IO.Put (Ada.Wide_Wide_Text_IO.Standard_Error, "Fatal_"); Self.Error (Occurrence, Success); end Fatal_Error; end Error_Handlers; Args : constant League.String_Vectors.Universal_String_Vector := League.Application.Arguments; Input : aliased XML.SAX.Input_Sources.Streams.Files.File_Input_Source; Reader : aliased XML.SAX.Simple_Readers.Simple_Reader; Filter : aliased XML.Templates.Processors.Template_Processor; Writer : aliased XML.SAX.HTML5_Writers.HTML5_Writer; Output : aliased XML.SAX.Output_Destinations.Strings .String_Output_Destination; Error : aliased Error_Handlers.Error_Handler; begin for J in 1 .. (Args.Length - 1) / 3 loop if Args.Element (J * 3 - 2) = +"--bind-string" then Filter.Set_Parameter (Args.Element (J * 3 - 1), League.Holders.To_Holder (Args.Element (J * 3))); end if; end loop; Input.Open_By_File_Name (Args.Element (Args.Length)); Reader.Set_Input_Source (Input'Unchecked_Access); Reader.Set_Content_Handler (Filter'Unchecked_Access); Reader.Set_Lexical_Handler (Filter'Unchecked_Access); Filter.Set_Content_Handler (Writer'Unchecked_Access); Filter.Set_Lexical_Handler (Writer'Unchecked_Access); Reader.Set_Error_Handler (Error'Unchecked_Access); Writer.Set_Output_Destination (Output'Unchecked_Access); -- Writer.Set_Error_Handler (Error'Unchecked_Access); Reader.Parse; if Error.Clean then Ada.Wide_Wide_Text_IO.Put (Output.Get_Text.To_Wide_Wide_String); else Ada.Command_Line.Set_Exit_Status (Ada.Command_Line.Failure); end if; end XHTML2HTML5;