repo_name
stringlengths
9
74
language
stringclasses
1 value
length_bytes
int64
11
9.34M
extension
stringclasses
2 values
content
stringlengths
11
9.34M
Componolit/libsparkcrypto
Ada
2,761
ads
------------------------------------------------------------------------------- -- This file is part of libsparkcrypto. -- -- @author Alexander Senier -- @date 2019-01-21 -- -- Copyright (C) 2018 Componolit GmbH -- All rights reserved. -- -- Redistribution and use in source and binary forms, with or without -- modification, are permitted provided that the following conditions are met: -- -- * Redistributions of source code must retain the above copyright notice, -- this list of conditions and the following disclaimer. -- -- * Redistributions in binary form must reproduce the above copyright -- notice, this list of conditions and the following disclaimer in the -- documentation and/or other materials provided with the distribution. -- -- * Neither the name of the nor the names of its contributors may be used -- to endorse or promote products derived from this software without -- specific prior written permission. -- -- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" -- AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -- IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE -- ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS -- BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR -- CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF -- SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS -- INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN -- CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) -- ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -- POSSIBILITY OF SUCH DAMAGE. ------------------------------------------------------------------------------- with LSC.SHA2; with LSC.SHA2.HMAC_Generic; with LSC.Types; pragma Elaborate_All (LSC.SHA2.HMAC_Generic); package LSC.SHA2.HMAC is pragma Pure; function HMAC_SHA256 is new SHA2.HMAC_Generic.HMAC_SHA256 (Types.Natural_Index, Types.Byte, Types.Bytes, Types.Natural_Index, Types.Byte, Types.Bytes, SHA2.SHA256_Hash_Index, Types.Byte, SHA2.SHA256_Hash_Type); function HMAC_SHA384 is new SHA2.HMAC_Generic.HMAC_SHA384 (Types.Natural_Index, Types.Byte, Types.Bytes, Types.Natural_Index, Types.Byte, Types.Bytes, SHA2.SHA384_Hash_Index, Types.Byte, SHA2.SHA384_Hash_Type); function HMAC_SHA512 is new SHA2.HMAC_Generic.HMAC_SHA512 (Types.Natural_Index, Types.Byte, Types.Bytes, Types.Natural_Index, Types.Byte, Types.Bytes, SHA2.SHA512_Hash_Index, Types.Byte, SHA2.SHA512_Hash_Type); end LSC.SHA2.HMAC;
onox/orka
Ada
1,646
ads
-- SPDX-License-Identifier: Apache-2.0 -- -- Copyright (c) 2019 onox <[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 Orka.Resources.Locations; generic Location : Orka.Resources.Locations.Writable_Location_Ptr; Capacity_Queue : Positive; -- Capacity of the message queue -- -- A background task will dequeue messages from this queue -- and write it to the file at the given path by the logger. -- -- Messages that cannot be enqueued will be printed to the terminal. Task_Name : String := "File Logger"; package Orka.Loggers.Location is function Create_Logger (Path : String; Level : Severity := Debug) return Logger_Ptr with Pre => Path'Length > 0; -- Return a logger that logs messages to a writable location procedure Shutdown; -- Shutdown the background task that logs the messages -- -- The task will terminate after it has dequeued the remaining -- messages in the queue. Any system that tries to log new messages -- after the task has terminated will log these messages to the -- terminal. end Orka.Loggers.Location;
octonion/examples
Ada
592
adb
package body Synchronous_Concurrent is task body Printer is Num_Iter : Natural := 0; Line : Unbounded_String; begin loop select accept Put(Item : in String) do Line := To_Unbounded_String(Item); end Put; Put_Line(To_String(Line)); Num_Iter := Num_Iter + 1; or accept Get_Count(Count : out Natural) do Count := Num_Iter; end Get_Count; or terminate; end select; end loop; end Printer; end Synchronous_Concurrent;
charlie5/cBound
Ada
1,774
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_glx_create_pixmap_request_t is -- Item -- type Item is record major_opcode : aliased Interfaces.Unsigned_8; minor_opcode : aliased Interfaces.Unsigned_8; length : aliased Interfaces.Unsigned_16; screen : aliased Interfaces.Unsigned_32; fbconfig : aliased xcb.xcb_glx_fbconfig_t; pixmap : aliased xcb.xcb_pixmap_t; glx_pixmap : aliased xcb.xcb_glx_pixmap_t; num_attribs : aliased Interfaces.Unsigned_32; end record; -- Item_Array -- type Item_Array is array (Interfaces.C .size_t range <>) of aliased xcb.xcb_glx_create_pixmap_request_t .Item; -- Pointer -- package C_Pointers is new Interfaces.C.Pointers (Index => Interfaces.C.size_t, Element => xcb.xcb_glx_create_pixmap_request_t.Item, Element_Array => xcb.xcb_glx_create_pixmap_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_glx_create_pixmap_request_t .Pointer; -- Pointer_Pointer -- package C_Pointer_Pointers is new Interfaces.C.Pointers (Index => Interfaces.C.size_t, Element => xcb.xcb_glx_create_pixmap_request_t.Pointer, Element_Array => xcb.xcb_glx_create_pixmap_request_t.Pointer_Array, Default_Terminator => null); subtype Pointer_Pointer is C_Pointer_Pointers.Pointer; end xcb.xcb_glx_create_pixmap_request_t;
reznikmm/matreshka
Ada
4,419
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 Matreshka.DOM_Nodes; with XML.DOM.Attributes.Internals; package body ODF.DOM.Attributes.Draw.End_Line_Spacing_Horizontal.Internals is ------------ -- Create -- ------------ function Create (Node : Matreshka.ODF_Attributes.Draw.End_Line_Spacing_Horizontal.Draw_End_Line_Spacing_Horizontal_Access) return ODF.DOM.Attributes.Draw.End_Line_Spacing_Horizontal.ODF_Draw_End_Line_Spacing_Horizontal is begin return (XML.DOM.Attributes.Internals.Create (Matreshka.DOM_Nodes.Attribute_Access (Node)) with null record); end Create; ---------- -- Wrap -- ---------- function Wrap (Node : Matreshka.ODF_Attributes.Draw.End_Line_Spacing_Horizontal.Draw_End_Line_Spacing_Horizontal_Access) return ODF.DOM.Attributes.Draw.End_Line_Spacing_Horizontal.ODF_Draw_End_Line_Spacing_Horizontal is begin return (XML.DOM.Attributes.Internals.Wrap (Matreshka.DOM_Nodes.Attribute_Access (Node)) with null record); end Wrap; end ODF.DOM.Attributes.Draw.End_Line_Spacing_Horizontal.Internals;
burratoo/Acton
Ada
2,310
ads
------------------------------------------------------------------------------------------ -- -- -- OAK PROCESSOR SUPPORT PACKAGE -- -- ATMEL AT91SAM7S -- -- -- -- OAK.PROCESSOR_SUPPORT_PACKAGE.INTERRUPTS -- -- -- -- Copyright (C) 2014-2021, Patrick Bernardi -- -- -- ------------------------------------------------------------------------------------------ with System; use System; with Oak.Brokers; use Oak.Brokers; with Atmel.AT91SAM7S; package Oak.Processor_Support_Package.Interrupts with Preelaborate is subtype External_Interrupt_Id is Atmel.AT91SAM7S.Peripheral_Id; Default_Interrupt_Priority : constant Interrupt_Priority := Interrupt_Priority'Last; type Parameterless_Handler is access protected procedure; procedure External_Interrupt_Handler (Interrupt_Id : External_Interrupt_Id); procedure Initialise_Interrupts; procedure Complete_Interrupt_Initialisation; procedure Attach_Handler (Interrupt : External_Interrupt_Id; Handler : Parameterless_Handler; Priority : Interrupt_Priority); function Handler_Protected_Object (Interrupt : External_Interrupt_Id) return Protected_Id_With_No; function Current_Interrupt_Priority return Any_Priority; function Get_External_Interrupt_Id return External_Interrupt_Id; procedure Set_Hardware_Priority (P : Any_Priority); procedure Clear_Hardware_Priority; function Has_Outstanding_Interrupts (Above_Priority : Any_Priority) return Boolean; private AIC_Vector_Table : array (External_Interrupt_Id) of Parameterless_Handler := (others => null); end Oak.Processor_Support_Package.Interrupts;
ekoeppen/STM32_Generic_Ada_Drivers
Ada
25,952
ads
-- This spec has been automatically generated from STM32F0xx.svd pragma Restrictions (No_Elaboration_Code); pragma Ada_2012; pragma Style_Checks (Off); with System; package STM32_SVD.RTC is pragma Preelaborate; --------------- -- Registers -- --------------- subtype TR_SU_Field is STM32_SVD.UInt4; subtype TR_ST_Field is STM32_SVD.UInt3; subtype TR_MNU_Field is STM32_SVD.UInt4; subtype TR_MNT_Field is STM32_SVD.UInt3; subtype TR_HU_Field is STM32_SVD.UInt4; subtype TR_HT_Field is STM32_SVD.UInt2; subtype TR_PM_Field is STM32_SVD.Bit; -- time register type TR_Register is record -- Second units in BCD format SU : TR_SU_Field := 16#0#; -- Second tens in BCD format ST : TR_ST_Field := 16#0#; -- unspecified Reserved_7_7 : STM32_SVD.Bit := 16#0#; -- Minute units in BCD format MNU : TR_MNU_Field := 16#0#; -- Minute tens in BCD format MNT : TR_MNT_Field := 16#0#; -- unspecified Reserved_15_15 : STM32_SVD.Bit := 16#0#; -- Hour units in BCD format HU : TR_HU_Field := 16#0#; -- Hour tens in BCD format HT : TR_HT_Field := 16#0#; -- AM/PM notation PM : TR_PM_Field := 16#0#; -- unspecified Reserved_23_31 : STM32_SVD.UInt9 := 16#0#; end record with Volatile_Full_Access, Size => 32, Bit_Order => System.Low_Order_First; for TR_Register use record SU at 0 range 0 .. 3; ST at 0 range 4 .. 6; Reserved_7_7 at 0 range 7 .. 7; MNU at 0 range 8 .. 11; MNT at 0 range 12 .. 14; Reserved_15_15 at 0 range 15 .. 15; HU at 0 range 16 .. 19; HT at 0 range 20 .. 21; PM at 0 range 22 .. 22; Reserved_23_31 at 0 range 23 .. 31; end record; subtype DR_DU_Field is STM32_SVD.UInt4; subtype DR_DT_Field is STM32_SVD.UInt2; subtype DR_MU_Field is STM32_SVD.UInt4; subtype DR_MT_Field is STM32_SVD.Bit; subtype DR_WDU_Field is STM32_SVD.UInt3; subtype DR_YU_Field is STM32_SVD.UInt4; subtype DR_YT_Field is STM32_SVD.UInt4; -- date register type DR_Register is record -- Date units in BCD format DU : DR_DU_Field := 16#1#; -- Date tens in BCD format DT : DR_DT_Field := 16#0#; -- unspecified Reserved_6_7 : STM32_SVD.UInt2 := 16#0#; -- Month units in BCD format MU : DR_MU_Field := 16#1#; -- Month tens in BCD format MT : DR_MT_Field := 16#0#; -- Week day units WDU : DR_WDU_Field := 16#1#; -- Year units in BCD format YU : DR_YU_Field := 16#0#; -- Year tens in BCD format YT : DR_YT_Field := 16#0#; -- unspecified Reserved_24_31 : STM32_SVD.Byte := 16#0#; end record with Volatile_Full_Access, Size => 32, Bit_Order => System.Low_Order_First; for DR_Register use record DU at 0 range 0 .. 3; DT at 0 range 4 .. 5; Reserved_6_7 at 0 range 6 .. 7; MU at 0 range 8 .. 11; MT at 0 range 12 .. 12; WDU at 0 range 13 .. 15; YU at 0 range 16 .. 19; YT at 0 range 20 .. 23; Reserved_24_31 at 0 range 24 .. 31; end record; subtype CR_TSEDGE_Field is STM32_SVD.Bit; subtype CR_REFCKON_Field is STM32_SVD.Bit; subtype CR_BYPSHAD_Field is STM32_SVD.Bit; subtype CR_FMT_Field is STM32_SVD.Bit; subtype CR_ALRAE_Field is STM32_SVD.Bit; subtype CR_TSE_Field is STM32_SVD.Bit; subtype CR_ALRAIE_Field is STM32_SVD.Bit; subtype CR_TSIE_Field is STM32_SVD.Bit; subtype CR_ADD1H_Field is STM32_SVD.Bit; subtype CR_SUB1H_Field is STM32_SVD.Bit; subtype CR_BKP_Field is STM32_SVD.Bit; subtype CR_COSEL_Field is STM32_SVD.Bit; subtype CR_POL_Field is STM32_SVD.Bit; subtype CR_OSEL_Field is STM32_SVD.UInt2; subtype CR_COE_Field is STM32_SVD.Bit; -- control register type CR_Register is record -- unspecified Reserved_0_2 : STM32_SVD.UInt3 := 16#0#; -- Time-stamp event active edge TSEDGE : CR_TSEDGE_Field := 16#0#; -- RTC_REFIN reference clock detection enable (50 or 60 Hz) REFCKON : CR_REFCKON_Field := 16#0#; -- Bypass the shadow registers BYPSHAD : CR_BYPSHAD_Field := 16#0#; -- Hour format FMT : CR_FMT_Field := 16#0#; -- unspecified Reserved_7_7 : STM32_SVD.Bit := 16#0#; -- Alarm A enable ALRAE : CR_ALRAE_Field := 16#0#; -- unspecified Reserved_9_10 : STM32_SVD.UInt2 := 16#0#; -- timestamp enable TSE : CR_TSE_Field := 16#0#; -- Alarm A interrupt enable ALRAIE : CR_ALRAIE_Field := 16#0#; -- unspecified Reserved_13_14 : STM32_SVD.UInt2 := 16#0#; -- Time-stamp interrupt enable TSIE : CR_TSIE_Field := 16#0#; -- Write-only. Add 1 hour (summer time change) ADD1H : CR_ADD1H_Field := 16#0#; -- Write-only. Subtract 1 hour (winter time change) SUB1H : CR_SUB1H_Field := 16#0#; -- Backup BKP : CR_BKP_Field := 16#0#; -- Calibration output selection COSEL : CR_COSEL_Field := 16#0#; -- Output polarity POL : CR_POL_Field := 16#0#; -- Output selection OSEL : CR_OSEL_Field := 16#0#; -- Calibration output enable COE : CR_COE_Field := 16#0#; -- unspecified Reserved_24_31 : STM32_SVD.Byte := 16#0#; end record with Volatile_Full_Access, Size => 32, Bit_Order => System.Low_Order_First; for CR_Register use record Reserved_0_2 at 0 range 0 .. 2; TSEDGE at 0 range 3 .. 3; REFCKON at 0 range 4 .. 4; BYPSHAD at 0 range 5 .. 5; FMT at 0 range 6 .. 6; Reserved_7_7 at 0 range 7 .. 7; ALRAE at 0 range 8 .. 8; Reserved_9_10 at 0 range 9 .. 10; TSE at 0 range 11 .. 11; ALRAIE at 0 range 12 .. 12; Reserved_13_14 at 0 range 13 .. 14; TSIE at 0 range 15 .. 15; ADD1H at 0 range 16 .. 16; SUB1H at 0 range 17 .. 17; BKP at 0 range 18 .. 18; COSEL at 0 range 19 .. 19; POL at 0 range 20 .. 20; OSEL at 0 range 21 .. 22; COE at 0 range 23 .. 23; Reserved_24_31 at 0 range 24 .. 31; end record; subtype ISR_ALRAWF_Field is STM32_SVD.Bit; subtype ISR_SHPF_Field is STM32_SVD.Bit; subtype ISR_INITS_Field is STM32_SVD.Bit; subtype ISR_RSF_Field is STM32_SVD.Bit; subtype ISR_INITF_Field is STM32_SVD.Bit; subtype ISR_INIT_Field is STM32_SVD.Bit; subtype ISR_ALRAF_Field is STM32_SVD.Bit; subtype ISR_TSF_Field is STM32_SVD.Bit; subtype ISR_TSOVF_Field is STM32_SVD.Bit; subtype ISR_TAMP1F_Field is STM32_SVD.Bit; subtype ISR_TAMP2F_Field is STM32_SVD.Bit; subtype ISR_RECALPF_Field is STM32_SVD.Bit; -- initialization and status register type ISR_Register is record -- Read-only. Alarm A write flag ALRAWF : ISR_ALRAWF_Field := 16#1#; -- unspecified Reserved_1_2 : STM32_SVD.UInt2 := 16#3#; -- Shift operation pending SHPF : ISR_SHPF_Field := 16#0#; -- Read-only. Initialization status flag INITS : ISR_INITS_Field := 16#0#; -- Registers synchronization flag RSF : ISR_RSF_Field := 16#0#; -- Read-only. Initialization flag INITF : ISR_INITF_Field := 16#0#; -- Initialization mode INIT : ISR_INIT_Field := 16#0#; -- Alarm A flag ALRAF : ISR_ALRAF_Field := 16#0#; -- unspecified Reserved_9_10 : STM32_SVD.UInt2 := 16#0#; -- Time-stamp flag TSF : ISR_TSF_Field := 16#0#; -- Time-stamp overflow flag TSOVF : ISR_TSOVF_Field := 16#0#; -- RTC_TAMP1 detection flag TAMP1F : ISR_TAMP1F_Field := 16#0#; -- RTC_TAMP2 detection flag TAMP2F : ISR_TAMP2F_Field := 16#0#; -- unspecified Reserved_15_15 : STM32_SVD.Bit := 16#0#; -- Read-only. Recalibration pending Flag RECALPF : ISR_RECALPF_Field := 16#0#; -- unspecified Reserved_17_31 : STM32_SVD.UInt15 := 16#0#; end record with Volatile_Full_Access, Size => 32, Bit_Order => System.Low_Order_First; for ISR_Register use record ALRAWF at 0 range 0 .. 0; Reserved_1_2 at 0 range 1 .. 2; SHPF at 0 range 3 .. 3; INITS at 0 range 4 .. 4; RSF at 0 range 5 .. 5; INITF at 0 range 6 .. 6; INIT at 0 range 7 .. 7; ALRAF at 0 range 8 .. 8; Reserved_9_10 at 0 range 9 .. 10; TSF at 0 range 11 .. 11; TSOVF at 0 range 12 .. 12; TAMP1F at 0 range 13 .. 13; TAMP2F at 0 range 14 .. 14; Reserved_15_15 at 0 range 15 .. 15; RECALPF at 0 range 16 .. 16; Reserved_17_31 at 0 range 17 .. 31; end record; subtype PRER_PREDIV_S_Field is STM32_SVD.UInt15; subtype PRER_PREDIV_A_Field is STM32_SVD.UInt7; -- prescaler register type PRER_Register is record -- Synchronous prescaler factor PREDIV_S : PRER_PREDIV_S_Field := 16#FF#; -- unspecified Reserved_15_15 : STM32_SVD.Bit := 16#0#; -- Asynchronous prescaler factor PREDIV_A : PRER_PREDIV_A_Field := 16#7F#; -- unspecified Reserved_23_31 : STM32_SVD.UInt9 := 16#0#; end record with Volatile_Full_Access, Size => 32, Bit_Order => System.Low_Order_First; for PRER_Register use record PREDIV_S at 0 range 0 .. 14; Reserved_15_15 at 0 range 15 .. 15; PREDIV_A at 0 range 16 .. 22; Reserved_23_31 at 0 range 23 .. 31; end record; subtype ALRMAR_SU_Field is STM32_SVD.UInt4; subtype ALRMAR_ST_Field is STM32_SVD.UInt3; subtype ALRMAR_MSK1_Field is STM32_SVD.Bit; subtype ALRMAR_MNU_Field is STM32_SVD.UInt4; subtype ALRMAR_MNT_Field is STM32_SVD.UInt3; subtype ALRMAR_MSK2_Field is STM32_SVD.Bit; subtype ALRMAR_HU_Field is STM32_SVD.UInt4; subtype ALRMAR_HT_Field is STM32_SVD.UInt2; subtype ALRMAR_PM_Field is STM32_SVD.Bit; subtype ALRMAR_MSK3_Field is STM32_SVD.Bit; subtype ALRMAR_DU_Field is STM32_SVD.UInt4; subtype ALRMAR_DT_Field is STM32_SVD.UInt2; subtype ALRMAR_WDSEL_Field is STM32_SVD.Bit; subtype ALRMAR_MSK4_Field is STM32_SVD.Bit; -- alarm A register type ALRMAR_Register is record -- Second units in BCD format. SU : ALRMAR_SU_Field := 16#0#; -- Second tens in BCD format. ST : ALRMAR_ST_Field := 16#0#; -- Alarm A seconds mask MSK1 : ALRMAR_MSK1_Field := 16#0#; -- Minute units in BCD format. MNU : ALRMAR_MNU_Field := 16#0#; -- Minute tens in BCD format. MNT : ALRMAR_MNT_Field := 16#0#; -- Alarm A minutes mask MSK2 : ALRMAR_MSK2_Field := 16#0#; -- Hour units in BCD format. HU : ALRMAR_HU_Field := 16#0#; -- Hour tens in BCD format. HT : ALRMAR_HT_Field := 16#0#; -- AM/PM notation PM : ALRMAR_PM_Field := 16#0#; -- Alarm A hours mask MSK3 : ALRMAR_MSK3_Field := 16#0#; -- Date units or day in BCD format. DU : ALRMAR_DU_Field := 16#0#; -- Date tens in BCD format. DT : ALRMAR_DT_Field := 16#0#; -- Week day selection WDSEL : ALRMAR_WDSEL_Field := 16#0#; -- Alarm A date mask MSK4 : ALRMAR_MSK4_Field := 16#0#; end record with Volatile_Full_Access, Size => 32, Bit_Order => System.Low_Order_First; for ALRMAR_Register use record SU at 0 range 0 .. 3; ST at 0 range 4 .. 6; MSK1 at 0 range 7 .. 7; MNU at 0 range 8 .. 11; MNT at 0 range 12 .. 14; MSK2 at 0 range 15 .. 15; HU at 0 range 16 .. 19; HT at 0 range 20 .. 21; PM at 0 range 22 .. 22; MSK3 at 0 range 23 .. 23; DU at 0 range 24 .. 27; DT at 0 range 28 .. 29; WDSEL at 0 range 30 .. 30; MSK4 at 0 range 31 .. 31; end record; subtype WPR_KEY_Field is STM32_SVD.Byte; -- write protection register type WPR_Register is record -- Write-only. Write protection key KEY : WPR_KEY_Field := 16#0#; -- unspecified Reserved_8_31 : STM32_SVD.UInt24 := 16#0#; end record with Volatile_Full_Access, Size => 32, Bit_Order => System.Low_Order_First; for WPR_Register use record KEY at 0 range 0 .. 7; Reserved_8_31 at 0 range 8 .. 31; end record; subtype SSR_SS_Field is STM32_SVD.UInt16; -- sub second register type SSR_Register is record -- Read-only. Sub second value SS : SSR_SS_Field; -- unspecified Reserved_16_31 : STM32_SVD.UInt16; end record with Volatile_Full_Access, Size => 32, Bit_Order => System.Low_Order_First; for SSR_Register use record SS at 0 range 0 .. 15; Reserved_16_31 at 0 range 16 .. 31; end record; subtype SHIFTR_SUBFS_Field is STM32_SVD.UInt15; subtype SHIFTR_ADD1S_Field is STM32_SVD.Bit; -- shift control register type SHIFTR_Register is record -- Write-only. Subtract a fraction of a second SUBFS : SHIFTR_SUBFS_Field := 16#0#; -- unspecified Reserved_15_30 : STM32_SVD.UInt16 := 16#0#; -- Write-only. Reserved ADD1S : SHIFTR_ADD1S_Field := 16#0#; end record with Volatile_Full_Access, Size => 32, Bit_Order => System.Low_Order_First; for SHIFTR_Register use record SUBFS at 0 range 0 .. 14; Reserved_15_30 at 0 range 15 .. 30; ADD1S at 0 range 31 .. 31; end record; subtype TSTR_SU_Field is STM32_SVD.UInt4; subtype TSTR_ST_Field is STM32_SVD.UInt3; subtype TSTR_MNU_Field is STM32_SVD.UInt4; subtype TSTR_MNT_Field is STM32_SVD.UInt3; subtype TSTR_HU_Field is STM32_SVD.UInt4; subtype TSTR_HT_Field is STM32_SVD.UInt2; subtype TSTR_PM_Field is STM32_SVD.Bit; -- timestamp time register type TSTR_Register is record -- Read-only. Second units in BCD format. SU : TSTR_SU_Field; -- Read-only. Second tens in BCD format. ST : TSTR_ST_Field; -- unspecified Reserved_7_7 : STM32_SVD.Bit; -- Read-only. Minute units in BCD format. MNU : TSTR_MNU_Field; -- Read-only. Minute tens in BCD format. MNT : TSTR_MNT_Field; -- unspecified Reserved_15_15 : STM32_SVD.Bit; -- Read-only. Hour units in BCD format. HU : TSTR_HU_Field; -- Read-only. Hour tens in BCD format. HT : TSTR_HT_Field; -- Read-only. AM/PM notation PM : TSTR_PM_Field; -- unspecified Reserved_23_31 : STM32_SVD.UInt9; end record with Volatile_Full_Access, Size => 32, Bit_Order => System.Low_Order_First; for TSTR_Register use record SU at 0 range 0 .. 3; ST at 0 range 4 .. 6; Reserved_7_7 at 0 range 7 .. 7; MNU at 0 range 8 .. 11; MNT at 0 range 12 .. 14; Reserved_15_15 at 0 range 15 .. 15; HU at 0 range 16 .. 19; HT at 0 range 20 .. 21; PM at 0 range 22 .. 22; Reserved_23_31 at 0 range 23 .. 31; end record; subtype TSDR_DU_Field is STM32_SVD.UInt4; subtype TSDR_DT_Field is STM32_SVD.UInt2; subtype TSDR_MU_Field is STM32_SVD.UInt4; subtype TSDR_MT_Field is STM32_SVD.Bit; subtype TSDR_WDU_Field is STM32_SVD.UInt3; -- timestamp date register type TSDR_Register is record -- Read-only. Date units in BCD format DU : TSDR_DU_Field; -- Read-only. Date tens in BCD format DT : TSDR_DT_Field; -- unspecified Reserved_6_7 : STM32_SVD.UInt2; -- Read-only. Month units in BCD format MU : TSDR_MU_Field; -- Read-only. Month tens in BCD format MT : TSDR_MT_Field; -- Read-only. Week day units WDU : TSDR_WDU_Field; -- unspecified Reserved_16_31 : STM32_SVD.UInt16; end record with Volatile_Full_Access, Size => 32, Bit_Order => System.Low_Order_First; for TSDR_Register use record DU at 0 range 0 .. 3; DT at 0 range 4 .. 5; Reserved_6_7 at 0 range 6 .. 7; MU at 0 range 8 .. 11; MT at 0 range 12 .. 12; WDU at 0 range 13 .. 15; Reserved_16_31 at 0 range 16 .. 31; end record; subtype TSSSR_SS_Field is STM32_SVD.UInt16; -- time-stamp sub second register type TSSSR_Register is record -- Read-only. Sub second value SS : TSSSR_SS_Field; -- unspecified Reserved_16_31 : STM32_SVD.UInt16; end record with Volatile_Full_Access, Size => 32, Bit_Order => System.Low_Order_First; for TSSSR_Register use record SS at 0 range 0 .. 15; Reserved_16_31 at 0 range 16 .. 31; end record; subtype CALR_CALM_Field is STM32_SVD.UInt9; subtype CALR_CALW16_Field is STM32_SVD.Bit; subtype CALR_CALW8_Field is STM32_SVD.Bit; subtype CALR_CALP_Field is STM32_SVD.Bit; -- calibration register type CALR_Register is record -- Calibration minus CALM : CALR_CALM_Field := 16#0#; -- unspecified Reserved_9_12 : STM32_SVD.UInt4 := 16#0#; -- Reserved CALW16 : CALR_CALW16_Field := 16#0#; -- Use a 16-second calibration cycle period CALW8 : CALR_CALW8_Field := 16#0#; -- Use an 8-second calibration cycle period CALP : CALR_CALP_Field := 16#0#; -- unspecified Reserved_16_31 : STM32_SVD.UInt16 := 16#0#; end record with Volatile_Full_Access, Size => 32, Bit_Order => System.Low_Order_First; for CALR_Register use record CALM at 0 range 0 .. 8; Reserved_9_12 at 0 range 9 .. 12; CALW16 at 0 range 13 .. 13; CALW8 at 0 range 14 .. 14; CALP at 0 range 15 .. 15; Reserved_16_31 at 0 range 16 .. 31; end record; subtype TAFCR_TAMP1E_Field is STM32_SVD.Bit; subtype TAFCR_TAMP1TRG_Field is STM32_SVD.Bit; subtype TAFCR_TAMPIE_Field is STM32_SVD.Bit; subtype TAFCR_TAMP2E_Field is STM32_SVD.Bit; subtype TAFCR_TAMP2_TRG_Field is STM32_SVD.Bit; subtype TAFCR_TAMPTS_Field is STM32_SVD.Bit; subtype TAFCR_TAMPFREQ_Field is STM32_SVD.UInt3; subtype TAFCR_TAMPFLT_Field is STM32_SVD.UInt2; subtype TAFCR_TAMP_PRCH_Field is STM32_SVD.UInt2; subtype TAFCR_TAMP_PUDIS_Field is STM32_SVD.Bit; subtype TAFCR_PC13VALUE_Field is STM32_SVD.Bit; subtype TAFCR_PC13MODE_Field is STM32_SVD.Bit; subtype TAFCR_PC14VALUE_Field is STM32_SVD.Bit; subtype TAFCR_PC14MODE_Field is STM32_SVD.Bit; subtype TAFCR_PC15VALUE_Field is STM32_SVD.Bit; subtype TAFCR_PC15MODE_Field is STM32_SVD.Bit; -- tamper and alternate function configuration register type TAFCR_Register is record -- RTC_TAMP1 input detection enable TAMP1E : TAFCR_TAMP1E_Field := 16#0#; -- Active level for RTC_TAMP1 input TAMP1TRG : TAFCR_TAMP1TRG_Field := 16#0#; -- Tamper interrupt enable TAMPIE : TAFCR_TAMPIE_Field := 16#0#; -- RTC_TAMP2 input detection enable TAMP2E : TAFCR_TAMP2E_Field := 16#0#; -- Active level for RTC_TAMP2 input TAMP2_TRG : TAFCR_TAMP2_TRG_Field := 16#0#; -- unspecified Reserved_5_6 : STM32_SVD.UInt2 := 16#0#; -- Activate timestamp on tamper detection event TAMPTS : TAFCR_TAMPTS_Field := 16#0#; -- Tamper sampling frequency TAMPFREQ : TAFCR_TAMPFREQ_Field := 16#0#; -- RTC_TAMPx filter count TAMPFLT : TAFCR_TAMPFLT_Field := 16#0#; -- RTC_TAMPx precharge duration TAMP_PRCH : TAFCR_TAMP_PRCH_Field := 16#0#; -- RTC_TAMPx pull-up disable TAMP_PUDIS : TAFCR_TAMP_PUDIS_Field := 16#0#; -- unspecified Reserved_16_17 : STM32_SVD.UInt2 := 16#0#; -- RTC_ALARM output type/PC13 value PC13VALUE : TAFCR_PC13VALUE_Field := 16#0#; -- PC13 mode PC13MODE : TAFCR_PC13MODE_Field := 16#0#; -- PC14 value PC14VALUE : TAFCR_PC14VALUE_Field := 16#0#; -- PC14 mode PC14MODE : TAFCR_PC14MODE_Field := 16#0#; -- PC15 value PC15VALUE : TAFCR_PC15VALUE_Field := 16#0#; -- PC15 mode PC15MODE : TAFCR_PC15MODE_Field := 16#0#; -- unspecified Reserved_24_31 : STM32_SVD.Byte := 16#0#; end record with Volatile_Full_Access, Size => 32, Bit_Order => System.Low_Order_First; for TAFCR_Register use record TAMP1E at 0 range 0 .. 0; TAMP1TRG at 0 range 1 .. 1; TAMPIE at 0 range 2 .. 2; TAMP2E at 0 range 3 .. 3; TAMP2_TRG at 0 range 4 .. 4; Reserved_5_6 at 0 range 5 .. 6; TAMPTS at 0 range 7 .. 7; TAMPFREQ at 0 range 8 .. 10; TAMPFLT at 0 range 11 .. 12; TAMP_PRCH at 0 range 13 .. 14; TAMP_PUDIS at 0 range 15 .. 15; Reserved_16_17 at 0 range 16 .. 17; PC13VALUE at 0 range 18 .. 18; PC13MODE at 0 range 19 .. 19; PC14VALUE at 0 range 20 .. 20; PC14MODE at 0 range 21 .. 21; PC15VALUE at 0 range 22 .. 22; PC15MODE at 0 range 23 .. 23; Reserved_24_31 at 0 range 24 .. 31; end record; subtype ALRMASSR_SS_Field is STM32_SVD.UInt15; subtype ALRMASSR_MASKSS_Field is STM32_SVD.UInt4; -- alarm A sub second register type ALRMASSR_Register is record -- Sub seconds value SS : ALRMASSR_SS_Field := 16#0#; -- unspecified Reserved_15_23 : STM32_SVD.UInt9 := 16#0#; -- Mask the most-significant bits starting at this bit MASKSS : ALRMASSR_MASKSS_Field := 16#0#; -- unspecified Reserved_28_31 : STM32_SVD.UInt4 := 16#0#; end record with Volatile_Full_Access, Size => 32, Bit_Order => System.Low_Order_First; for ALRMASSR_Register use record SS at 0 range 0 .. 14; Reserved_15_23 at 0 range 15 .. 23; MASKSS at 0 range 24 .. 27; Reserved_28_31 at 0 range 28 .. 31; end record; ----------------- -- Peripherals -- ----------------- -- Real-time clock type RTC_Peripheral is record -- time register TR : aliased TR_Register; -- date register DR : aliased DR_Register; -- control register CR : aliased CR_Register; -- initialization and status register ISR : aliased ISR_Register; -- prescaler register PRER : aliased PRER_Register; -- alarm A register ALRMAR : aliased ALRMAR_Register; -- write protection register WPR : aliased WPR_Register; -- sub second register SSR : aliased SSR_Register; -- shift control register SHIFTR : aliased SHIFTR_Register; -- timestamp time register TSTR : aliased TSTR_Register; -- timestamp date register TSDR : aliased TSDR_Register; -- time-stamp sub second register TSSSR : aliased TSSSR_Register; -- calibration register CALR : aliased CALR_Register; -- tamper and alternate function configuration register TAFCR : aliased TAFCR_Register; -- alarm A sub second register ALRMASSR : aliased ALRMASSR_Register; -- backup register BKP0R : aliased STM32_SVD.UInt32; -- backup register BKP1R : aliased STM32_SVD.UInt32; -- backup register BKP2R : aliased STM32_SVD.UInt32; -- backup register BKP3R : aliased STM32_SVD.UInt32; -- backup register BKP4R : aliased STM32_SVD.UInt32; end record with Volatile; for RTC_Peripheral use record TR at 16#0# range 0 .. 31; DR at 16#4# range 0 .. 31; CR at 16#8# range 0 .. 31; ISR at 16#C# range 0 .. 31; PRER at 16#10# range 0 .. 31; ALRMAR at 16#1C# range 0 .. 31; WPR at 16#24# range 0 .. 31; SSR at 16#28# range 0 .. 31; SHIFTR at 16#2C# range 0 .. 31; TSTR at 16#30# range 0 .. 31; TSDR at 16#34# range 0 .. 31; TSSSR at 16#38# range 0 .. 31; CALR at 16#3C# range 0 .. 31; TAFCR at 16#40# range 0 .. 31; ALRMASSR at 16#44# range 0 .. 31; BKP0R at 16#50# range 0 .. 31; BKP1R at 16#54# range 0 .. 31; BKP2R at 16#58# range 0 .. 31; BKP3R at 16#5C# range 0 .. 31; BKP4R at 16#60# range 0 .. 31; end record; -- Real-time clock RTC_Periph : aliased RTC_Peripheral with Import, Address => System'To_Address (16#40002800#); end STM32_SVD.RTC;
AdaCore/libadalang
Ada
172
ads
package Pr is protected type A is entry Foo; private B : Integer; end A; --% node.p_next_part_for_decl() --% node.p_body_part_for_decl() end Pr;
reznikmm/matreshka
Ada
3,654
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.Form_Number_Elements is pragma Preelaborate; type ODF_Form_Number is limited interface and XML.DOM.Elements.DOM_Element; type ODF_Form_Number_Access is access all ODF_Form_Number'Class with Storage_Size => 0; end ODF.DOM.Form_Number_Elements;
zhmu/ananas
Ada
1,400
ads
------------------------------------------------------------------------------ -- -- -- GNAT LIBRARY COMPONENTS -- -- -- -- A D A . S T R I N G S . W I D E _ B O U N D E D . W I D E _ H A S H -- -- -- -- S p e c -- -- -- -- This specification is derived from the Ada Reference Manual for use with -- -- GNAT. In accordance with the copyright of that document, you can freely -- -- copy and modify this specification, provided that if you redistribute a -- -- modified version, any changes that you have made are clearly indicated. -- -- -- ------------------------------------------------------------------------------ with Ada.Containers; generic with package Bounded is new Ada.Strings.Wide_Bounded.Generic_Bounded_Length (<>); function Ada.Strings.Wide_Bounded.Wide_Hash (Key : Bounded.Bounded_Wide_String) return Containers.Hash_Type; pragma Preelaborate (Ada.Strings.Wide_Bounded.Wide_Hash);
reznikmm/matreshka
Ada
4,741
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.Table_Named_Range_Elements; package Matreshka.ODF_Table.Named_Range_Elements is type Table_Named_Range_Element_Node is new Matreshka.ODF_Table.Abstract_Table_Element_Node and ODF.DOM.Table_Named_Range_Elements.ODF_Table_Named_Range with null record; overriding function Create (Parameters : not null access Matreshka.DOM_Elements.Element_L2_Parameters) return Table_Named_Range_Element_Node; overriding function Get_Local_Name (Self : not null access constant Table_Named_Range_Element_Node) return League.Strings.Universal_String; overriding procedure Enter_Node (Self : not null access Table_Named_Range_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 Table_Named_Range_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 Table_Named_Range_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_Table.Named_Range_Elements;
stcarrez/mat
Ada
6,567
adb
----------------------------------------------------------------------- -- mat-consoles - Console interface -- Copyright (C) 2014, 2015, 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.Strings; with MAT.Formats; package body MAT.Consoles is -- ------------------------------ -- Print the title for the given field and setup the associated field size. -- ------------------------------ procedure Print_Title (Console : in out Console_Type; Field : in Field_Type; Title : in String; Length : in Positive) is begin Console.Sizes (Field) := Length; if Console.Field_Count >= 1 then Console.Cols (Field) := Console.Cols (Console.Fields (Console.Field_Count)) + Console.Sizes (Console.Fields (Console.Field_Count)); else Console.Cols (Field) := 1; end if; Console.Field_Count := Console.Field_Count + 1; Console.Fields (Console.Field_Count) := Field; Console_Type'Class (Console).Print_Title (Field, Title); end Print_Title; -- ------------------------------ -- Format the address and print it for the given field. -- ------------------------------ procedure Print_Field (Console : in out Console_Type; Field : in Field_Type; Addr : in MAT.Types.Target_Addr) is Value : constant String := MAT.Formats.Addr (Addr); begin Console_Type'Class (Console).Print_Field (Field, Value); end Print_Field; -- ------------------------------ -- Format the address range and print it for the given field. -- ------------------------------ procedure Print_Field (Console : in out Console_Type; Field : in Field_Type; From : in MAT.Types.Target_Addr; To : in MAT.Types.Target_Addr) is From_Value : constant String := MAT.Formats.Addr (From); To_Value : constant String := MAT.Formats.Addr (To); begin Console_Type'Class (Console).Print_Field (Field, From_Value & "-" & To_Value); end Print_Field; -- ------------------------------ -- Format the size and print it for the given field. -- ------------------------------ procedure Print_Size (Console : in out Console_Type; Field : in Field_Type; Size : in MAT.Types.Target_Size) is Value : constant String := MAT.Formats.Size (Size); begin Console_Type'Class (Console).Print_Field (Field, Value); end Print_Size; -- ------------------------------ -- Format the thread information and print it for the given field. -- ------------------------------ procedure Print_Thread (Console : in out Console_Type; Field : in Field_Type; Thread : in MAT.Types.Target_Thread_Ref) is Value : constant String := MAT.Types.Target_Thread_Ref'Image (Thread); begin Console_Type'Class (Console).Print_Field (Field, Value); end Print_Thread; -- ------------------------------ -- Format the time tick as a duration and print it for the given field. -- ------------------------------ procedure Print_Duration (Console : in out Console_Type; Field : in Field_Type; Duration : in MAT.Types.Target_Tick_Ref) is Value : constant String := MAT.Formats.Duration (Duration); begin Console_Type'Class (Console).Print_Field (Field, Value); end Print_Duration; -- ------------------------------ -- Format the integer and print it for the given field. -- ------------------------------ procedure Print_Field (Console : in out Console_Type; Field : in Field_Type; Value : in Integer; Justify : in Justify_Type := J_LEFT) is Val : constant String := Util.Strings.Image (Value); begin Console_Type'Class (Console).Print_Field (Field, Val, Justify); end Print_Field; -- ------------------------------ -- Format the integer and print it for the given field. -- ------------------------------ procedure Print_Field (Console : in out Console_Type; Field : in Field_Type; Value : in Ada.Strings.Unbounded.Unbounded_String; Justify : in Justify_Type := J_LEFT) is Item : String := Ada.Strings.Unbounded.To_String (Value); Size : constant Natural := Console.Sizes (Field); begin if Size <= Item'Length then Item (Item'Last - Size + 2 .. Item'Last - Size + 4) := "..."; Console_Type'Class (Console).Print_Field (Field, Item (Item'Last - Size + 2 .. Item'Last)); else Console_Type'Class (Console).Print_Field (Field, Item, Justify); end if; end Print_Field; -- ------------------------------ -- Get the field count that was setup through the Print_Title calls. -- ------------------------------ function Get_Field_Count (Console : in Console_Type) return Natural is begin return Console.Field_Count; end Get_Field_Count; -- ------------------------------ -- Reset the field count. -- ------------------------------ procedure Clear_Fields (Console : in out Console_Type) is begin Console.Field_Count := 0; end Clear_Fields; -- ------------------------------ -- Enable or disable the use of colors for the outputs. -- ------------------------------ procedure Set_Color (Console : in out Console_Type; Enable : in Boolean) is begin Console.Use_Colors := Enable; end Set_Color; end MAT.Consoles;
pdaxrom/Kino2
Ada
3,747
adb
------------------------------------------------------------------------------ -- -- -- GNAT ncurses Binding Samples -- -- -- -- Sample.Helpers -- -- -- -- B O D Y -- -- -- ------------------------------------------------------------------------------ -- Copyright (c) 1998 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: Juergen Pfeifer, 1996 -- Contact: http://www.familiepfeifer.de/Contact.aspx?Lang=en -- Version Control -- $Revision: 1.8 $ -- Binding Version 01.00 ------------------------------------------------------------------------------ with Terminal_Interface.Curses; use Terminal_Interface.Curses; with Sample.Explanation; use Sample.Explanation; -- This package contains some conveniant helper routines used throughout -- this example. -- package body Sample.Helpers is procedure Window_Title (Win : in Window; Title : in String) is Height : Line_Count; Width : Column_Count; Pos : Column_Position := 0; begin Get_Size (Win, Height, Width); if Title'Length < Width then Pos := (Width - Title'Length) / 2; end if; Add (Win, 0, Pos, Title); end Window_Title; procedure Not_Implemented is begin Explain ("NOTIMPL"); end Not_Implemented; end Sample.Helpers;
jhumphry/SPARK_SipHash
Ada
3,233
ads
-- HalfSipHash -- A 32-bit friendly version of SipHash, the algorithm described in -- "SipHash: a fast short-input PRF" -- by Jean-Philippe Aumasson and Daniel J. Bernstein -- Half Siphash was designed by Jean-Philippe Aumasson but is not yet documented -- in a paper. This implementation is based on the reference code. -- Copyright (c) 2016, James Humphry - see LICENSE file for details with Interfaces; with System.Storage_Elements; use type System.Storage_Elements.Storage_Offset; generic c_rounds, d_rounds : Positive; k0 : Interfaces.Unsigned_32 := 16#03020100#; k1 : Interfaces.Unsigned_32 := 16#07060504#; package HalfSipHash with SPARK_Mode, Abstract_State => (Initial_Hash_State), Initializes => (Initial_Hash_State) is subtype U32 is Interfaces.Unsigned_32; subtype HalfSipHash_Key is System.Storage_Elements.Storage_Array(1..8); procedure Set_Key (k0, k1 : U32) with Global => (Output => Initial_Hash_State); -- SetKey changes the key used by the package to generate hash values. It is -- particularly useful if you want to avoid dynamic elaboration. procedure Set_Key (k : HalfSipHash_Key) with Pre => (k'Length = 8), Global => (Output => Initial_Hash_State); -- SetKey changes the key used by the package to generate hash values. It is -- particularly useful if you want to avoid dynamic elaboration. function HalfSipHash (m : System.Storage_Elements.Storage_Array) return U32 with Pre => (if m'First <= 0 then (Long_Long_Integer (m'Last) < Long_Long_Integer'Last + Long_Long_Integer (m'First)) ), Global => (Input => Initial_Hash_State); -- This is the full implementation of HalfSipHash, intended to exactly -- match the reference code. The precondition looks odd, but it is -- because Storage_Array is defined with an unconstrained index across -- Storage_Offset, which is a signed value. This means that an array from -- Storage_Offset'First to Storage_Offset'Last would have too long a length -- for calculations to be done in a Storage_Offset variable. private use all type Interfaces.Unsigned_32; -- The state array of the SipHash function type HalfSipHash_State is array (Integer range 0..3) of U32; function Get_Initial_State return HalfSipHash_State with Inline, Global => (Input => Initial_Hash_State); subtype SArray is System.Storage_Elements.Storage_Array; subtype SArray_4 is System.Storage_Elements.Storage_Array(0..3); function SArray4_to_U32_LE (S : in SArray_4) return U32 with Inline; function SArray_Tail_to_U32_LE (S : in SArray) return U32 with Inline, Pre => (if S'First <= 0 then ( (Long_Long_Integer (S'Last) < Long_Long_Integer'Last + Long_Long_Integer (S'First)) and then S'Length in 1..3 ) else S'Length in 1..3 ); procedure Sip_Round (v : in out HalfSipHash_State) with Inline; function Sip_Finalization (v : in HalfSipHash_State) return U32 with Inline; end HalfSipHash;
reznikmm/matreshka
Ada
13,074
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. ------------------------------------------------------------------------------ package AMF.Internals.Tables.UMLDI_Metamodel.Properties is procedure Initialize; private procedure Initialize_1; procedure Initialize_2; procedure Initialize_3; procedure Initialize_4; procedure Initialize_5; procedure Initialize_6; procedure Initialize_7; procedure Initialize_8; procedure Initialize_9; procedure Initialize_10; procedure Initialize_11; procedure Initialize_12; procedure Initialize_13; procedure Initialize_14; procedure Initialize_15; procedure Initialize_16; procedure Initialize_17; procedure Initialize_18; procedure Initialize_19; procedure Initialize_20; procedure Initialize_21; procedure Initialize_22; procedure Initialize_23; procedure Initialize_24; procedure Initialize_25; procedure Initialize_26; procedure Initialize_27; procedure Initialize_28; procedure Initialize_29; procedure Initialize_30; procedure Initialize_31; procedure Initialize_32; procedure Initialize_33; procedure Initialize_34; procedure Initialize_35; procedure Initialize_36; procedure Initialize_37; procedure Initialize_38; procedure Initialize_39; procedure Initialize_40; procedure Initialize_41; procedure Initialize_42; procedure Initialize_43; procedure Initialize_44; procedure Initialize_45; procedure Initialize_46; procedure Initialize_47; procedure Initialize_48; procedure Initialize_49; procedure Initialize_50; procedure Initialize_51; procedure Initialize_52; procedure Initialize_53; procedure Initialize_54; procedure Initialize_55; procedure Initialize_56; procedure Initialize_57; procedure Initialize_58; procedure Initialize_59; procedure Initialize_60; procedure Initialize_61; procedure Initialize_62; procedure Initialize_63; procedure Initialize_64; procedure Initialize_65; procedure Initialize_66; procedure Initialize_67; procedure Initialize_68; procedure Initialize_69; procedure Initialize_70; procedure Initialize_71; procedure Initialize_72; procedure Initialize_73; procedure Initialize_74; procedure Initialize_75; procedure Initialize_76; procedure Initialize_77; procedure Initialize_78; procedure Initialize_79; procedure Initialize_80; procedure Initialize_81; procedure Initialize_82; procedure Initialize_83; procedure Initialize_84; procedure Initialize_85; procedure Initialize_86; procedure Initialize_87; procedure Initialize_88; procedure Initialize_89; procedure Initialize_90; procedure Initialize_91; procedure Initialize_92; procedure Initialize_93; procedure Initialize_94; procedure Initialize_95; procedure Initialize_96; procedure Initialize_97; procedure Initialize_98; procedure Initialize_99; procedure Initialize_100; procedure Initialize_101; procedure Initialize_102; procedure Initialize_103; procedure Initialize_104; procedure Initialize_105; procedure Initialize_106; procedure Initialize_107; procedure Initialize_108; procedure Initialize_109; procedure Initialize_110; procedure Initialize_111; procedure Initialize_112; procedure Initialize_113; procedure Initialize_114; procedure Initialize_115; procedure Initialize_116; procedure Initialize_117; procedure Initialize_118; procedure Initialize_119; procedure Initialize_120; procedure Initialize_121; procedure Initialize_122; procedure Initialize_123; procedure Initialize_124; procedure Initialize_125; procedure Initialize_126; procedure Initialize_127; procedure Initialize_128; procedure Initialize_129; procedure Initialize_130; procedure Initialize_131; procedure Initialize_132; procedure Initialize_133; procedure Initialize_134; procedure Initialize_135; procedure Initialize_136; procedure Initialize_137; procedure Initialize_138; procedure Initialize_139; procedure Initialize_140; procedure Initialize_141; procedure Initialize_142; procedure Initialize_143; procedure Initialize_144; procedure Initialize_145; procedure Initialize_146; procedure Initialize_147; procedure Initialize_148; procedure Initialize_149; procedure Initialize_150; procedure Initialize_151; procedure Initialize_152; procedure Initialize_153; procedure Initialize_154; procedure Initialize_155; procedure Initialize_156; procedure Initialize_157; procedure Initialize_158; procedure Initialize_159; procedure Initialize_160; procedure Initialize_161; procedure Initialize_162; procedure Initialize_163; procedure Initialize_164; procedure Initialize_165; procedure Initialize_166; procedure Initialize_167; procedure Initialize_168; procedure Initialize_169; procedure Initialize_170; procedure Initialize_171; procedure Initialize_172; procedure Initialize_173; procedure Initialize_174; procedure Initialize_175; procedure Initialize_176; procedure Initialize_177; procedure Initialize_178; procedure Initialize_179; procedure Initialize_180; procedure Initialize_181; procedure Initialize_182; procedure Initialize_183; procedure Initialize_184; procedure Initialize_185; procedure Initialize_186; procedure Initialize_187; procedure Initialize_188; procedure Initialize_189; procedure Initialize_190; procedure Initialize_191; procedure Initialize_192; procedure Initialize_193; procedure Initialize_194; procedure Initialize_195; procedure Initialize_196; procedure Initialize_197; procedure Initialize_198; procedure Initialize_199; procedure Initialize_200; procedure Initialize_201; procedure Initialize_202; procedure Initialize_203; procedure Initialize_204; procedure Initialize_205; procedure Initialize_206; procedure Initialize_207; procedure Initialize_208; procedure Initialize_209; procedure Initialize_210; procedure Initialize_211; procedure Initialize_212; procedure Initialize_213; procedure Initialize_214; procedure Initialize_215; procedure Initialize_216; procedure Initialize_217; procedure Initialize_218; procedure Initialize_219; procedure Initialize_220; procedure Initialize_221; procedure Initialize_222; procedure Initialize_223; procedure Initialize_224; procedure Initialize_225; procedure Initialize_226; procedure Initialize_227; procedure Initialize_228; procedure Initialize_229; procedure Initialize_230; procedure Initialize_231; procedure Initialize_232; procedure Initialize_233; procedure Initialize_234; procedure Initialize_235; procedure Initialize_236; procedure Initialize_237; procedure Initialize_238; procedure Initialize_239; procedure Initialize_240; procedure Initialize_241; procedure Initialize_242; procedure Initialize_243; procedure Initialize_244; procedure Initialize_245; procedure Initialize_246; procedure Initialize_247; procedure Initialize_248; procedure Initialize_249; procedure Initialize_250; procedure Initialize_251; procedure Initialize_252; procedure Initialize_253; procedure Initialize_254; procedure Initialize_255; procedure Initialize_256; procedure Initialize_257; procedure Initialize_258; procedure Initialize_259; procedure Initialize_260; procedure Initialize_261; procedure Initialize_262; procedure Initialize_263; procedure Initialize_264; procedure Initialize_265; procedure Initialize_266; procedure Initialize_267; procedure Initialize_268; procedure Initialize_269; procedure Initialize_270; procedure Initialize_271; procedure Initialize_272; procedure Initialize_273; procedure Initialize_274; procedure Initialize_275; procedure Initialize_276; procedure Initialize_277; procedure Initialize_278; procedure Initialize_279; procedure Initialize_280; procedure Initialize_281; procedure Initialize_282; procedure Initialize_283; procedure Initialize_284; procedure Initialize_285; procedure Initialize_286; procedure Initialize_287; procedure Initialize_288; procedure Initialize_289; procedure Initialize_290; procedure Initialize_291; procedure Initialize_292; procedure Initialize_293; procedure Initialize_294; procedure Initialize_295; procedure Initialize_296; procedure Initialize_297; procedure Initialize_298; procedure Initialize_299; procedure Initialize_300; procedure Initialize_301; procedure Initialize_302; procedure Initialize_303; procedure Initialize_304; procedure Initialize_305; procedure Initialize_306; procedure Initialize_307; procedure Initialize_308; procedure Initialize_309; procedure Initialize_310; procedure Initialize_311; procedure Initialize_312; procedure Initialize_313; procedure Initialize_314; procedure Initialize_315; procedure Initialize_316; procedure Initialize_317; procedure Initialize_318; procedure Initialize_319; end AMF.Internals.Tables.UMLDI_Metamodel.Properties;
stcarrez/dynamo
Ada
48,533
adb
------------------------------------------------------------------------------ -- -- -- GNAT COMPILER COMPONENTS -- -- -- -- R E P I N F O -- -- -- -- B o d y -- -- -- -- Copyright (C) 1999-2014, Free Software Foundation, Inc. -- -- -- -- GNAT is free software; you can redistribute it and/or modify it under -- -- terms of the GNU General Public License as published by the Free Soft- -- -- ware Foundation; either version 3, or (at your option) any later ver- -- -- sion. GNAT is distributed in the hope that it will be useful, but WITH- -- -- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY -- -- or FITNESS FOR A PARTICULAR PURPOSE. -- -- -- -- As a special exception under Section 7 of GPL version 3, you are granted -- -- additional permissions described in the GCC Runtime Library Exception, -- -- version 3.1, as published by the Free Software Foundation. -- -- -- -- You should have received a copy of the GNU General Public License and -- -- a copy of the GCC Runtime Library Exception along with this program; -- -- see the files COPYING3 and COPYING.RUNTIME respectively. If not, see -- -- <http://www.gnu.org/licenses/>. -- -- -- -- GNAT was originally developed by the GNAT team at New York University. -- -- Extensive contributions were provided by Ada Core Technologies Inc. -- -- -- ------------------------------------------------------------------------------ with Alloc; use Alloc; with Atree; use Atree; with Casing; use Casing; with Debug; use Debug; with Einfo; use Einfo; with Lib; use Lib; with Namet; use Namet; with Nlists; use Nlists; with Opt; use Opt; with Output; use Output; with Sem_Aux; use Sem_Aux; with Sinfo; use Sinfo; with Sinput; use Sinput; with Snames; use Snames; with Stand; use Stand; with Stringt; use Stringt; with Table; use Table; with Uname; use Uname; with Urealp; use Urealp; with Ada.Unchecked_Conversion; package body Repinfo is SSU : constant := 8; -- Value for Storage_Unit, we do not want to get this from TTypes, since -- this introduces problematic dependencies in ASIS, and in any case this -- value is assumed to be 8 for the implementation of the DDA. -- This is wrong for AAMP??? --------------------------------------- -- Representation of gcc Expressions -- --------------------------------------- -- This table is used only if Frontend_Layout_On_Target is False, so gigi -- lays out dynamic size/offset fields using encoded gcc expressions. -- A table internal to this unit is used to hold the values of back -- annotated expressions. This table is written out by -gnatt and read -- back in for ASIS processing. -- Node values are stored as Uint values using the negative of the node -- index in this table. Constants appear as non-negative Uint values. type Exp_Node is record Expr : TCode; Op1 : Node_Ref_Or_Val; Op2 : Node_Ref_Or_Val; Op3 : Node_Ref_Or_Val; end record; -- The following representation clause ensures that the above record -- has no holes. We do this so that when instances of this record are -- written by Tree_Gen, we do not write uninitialized values to the file. for Exp_Node use record Expr at 0 range 0 .. 31; Op1 at 4 range 0 .. 31; Op2 at 8 range 0 .. 31; Op3 at 12 range 0 .. 31; end record; for Exp_Node'Size use 16 * 8; -- This ensures that we did not leave out any fields package Rep_Table is new Table.Table ( Table_Component_Type => Exp_Node, Table_Index_Type => Nat, Table_Low_Bound => 1, Table_Initial => Alloc.Rep_Table_Initial, Table_Increment => Alloc.Rep_Table_Increment, Table_Name => "BE_Rep_Table"); -------------------------------------------------------------- -- Representation of Front-End Dynamic Size/Offset Entities -- -------------------------------------------------------------- package Dynamic_SO_Entity_Table is new Table.Table ( Table_Component_Type => Entity_Id, Table_Index_Type => Nat, Table_Low_Bound => 1, Table_Initial => Alloc.Rep_Table_Initial, Table_Increment => Alloc.Rep_Table_Increment, Table_Name => "FE_Rep_Table"); Unit_Casing : Casing_Type; -- Identifier casing for current unit. This is set by List_Rep_Info for -- each unit, before calling subprograms which may read it. Need_Blank_Line : Boolean; -- Set True if a blank line is needed before outputting any information for -- the current entity. Set True when a new entity is processed, and false -- when the blank line is output. ----------------------- -- Local Subprograms -- ----------------------- function Back_End_Layout return Boolean; -- Test for layout mode, True = back end, False = front end. This function -- is used rather than checking the configuration parameter because we do -- not want Repinfo to depend on Targparm (for ASIS) procedure Blank_Line; -- Called before outputting anything for an entity. Ensures that -- a blank line precedes the output for a particular entity. procedure List_Entities (Ent : Entity_Id; Bytes_Big_Endian : Boolean); -- This procedure lists the entities associated with the entity E, starting -- with the First_Entity and using the Next_Entity link. If a nested -- package is found, entities within the package are recursively processed. procedure List_Name (Ent : Entity_Id); -- List name of entity Ent in appropriate case. The name is listed with -- full qualification up to but not including the compilation unit name. procedure List_Array_Info (Ent : Entity_Id; Bytes_Big_Endian : Boolean); -- List representation info for array type Ent procedure List_Linker_Section (Ent : Entity_Id); -- List linker section for Ent (caller has checked that Ent is an entity -- for which the Linker_Section_Pragma field is defined). procedure List_Mechanisms (Ent : Entity_Id); -- List mechanism information for parameters of Ent, which is subprogram, -- subprogram type, or an entry or entry family. procedure List_Object_Info (Ent : Entity_Id); -- List representation info for object Ent procedure List_Record_Info (Ent : Entity_Id; Bytes_Big_Endian : Boolean); -- List representation info for record type Ent procedure List_Scalar_Storage_Order (Ent : Entity_Id; Bytes_Big_Endian : Boolean); -- List scalar storage order information for record or array type Ent. -- Also includes bit order information for record types, if necessary. procedure List_Type_Info (Ent : Entity_Id); -- List type info for type Ent function Rep_Not_Constant (Val : Node_Ref_Or_Val) return Boolean; -- Returns True if Val represents a variable value, and False if it -- represents a value that is fixed at compile time. procedure Spaces (N : Natural); -- Output given number of spaces procedure Write_Info_Line (S : String); -- Routine to write a line to Repinfo output file. This routine is passed -- as a special output procedure to Output.Set_Special_Output. Note that -- Write_Info_Line is called with an EOL character at the end of each line, -- as per the Output spec, but the internal call to the appropriate routine -- in Osint requires that the end of line sequence be stripped off. procedure Write_Mechanism (M : Mechanism_Type); -- Writes symbolic string for mechanism represented by M procedure Write_Val (Val : Node_Ref_Or_Val; Paren : Boolean := False); -- Given a representation value, write it out. No_Uint values or values -- dependent on discriminants are written as two question marks. If the -- flag Paren is set, then the output is surrounded in parentheses if it is -- other than a simple value. --------------------- -- Back_End_Layout -- --------------------- function Back_End_Layout return Boolean is begin -- We have back end layout if the back end has made any entries in the -- table of GCC expressions, otherwise we have front end layout. return Rep_Table.Last > 0; end Back_End_Layout; ---------------- -- Blank_Line -- ---------------- procedure Blank_Line is begin if Need_Blank_Line then Write_Eol; Need_Blank_Line := False; end if; end Blank_Line; ------------------------ -- Create_Discrim_Ref -- ------------------------ function Create_Discrim_Ref (Discr : Entity_Id) return Node_Ref is begin return Create_Node (Expr => Discrim_Val, Op1 => Discriminant_Number (Discr)); end Create_Discrim_Ref; --------------------------- -- Create_Dynamic_SO_Ref -- --------------------------- function Create_Dynamic_SO_Ref (E : Entity_Id) return Dynamic_SO_Ref is begin Dynamic_SO_Entity_Table.Append (E); return UI_From_Int (-Dynamic_SO_Entity_Table.Last); end Create_Dynamic_SO_Ref; ----------------- -- Create_Node -- ----------------- function Create_Node (Expr : TCode; Op1 : Node_Ref_Or_Val; Op2 : Node_Ref_Or_Val := No_Uint; Op3 : Node_Ref_Or_Val := No_Uint) return Node_Ref is begin Rep_Table.Append ( (Expr => Expr, Op1 => Op1, Op2 => Op2, Op3 => Op3)); return UI_From_Int (-Rep_Table.Last); end Create_Node; --------------------------- -- Get_Dynamic_SO_Entity -- --------------------------- function Get_Dynamic_SO_Entity (U : Dynamic_SO_Ref) return Entity_Id is begin return Dynamic_SO_Entity_Table.Table (-UI_To_Int (U)); end Get_Dynamic_SO_Entity; ----------------------- -- Is_Dynamic_SO_Ref -- ----------------------- function Is_Dynamic_SO_Ref (U : SO_Ref) return Boolean is begin return U < Uint_0; end Is_Dynamic_SO_Ref; ---------------------- -- Is_Static_SO_Ref -- ---------------------- function Is_Static_SO_Ref (U : SO_Ref) return Boolean is begin return U >= Uint_0; end Is_Static_SO_Ref; --------- -- lgx -- --------- procedure lgx (U : Node_Ref_Or_Val) is begin List_GCC_Expression (U); Write_Eol; end lgx; ---------------------- -- List_Array_Info -- ---------------------- procedure List_Array_Info (Ent : Entity_Id; Bytes_Big_Endian : Boolean) is begin List_Type_Info (Ent); Write_Str ("for "); List_Name (Ent); Write_Str ("'Component_Size use "); Write_Val (Component_Size (Ent)); Write_Line (";"); List_Scalar_Storage_Order (Ent, Bytes_Big_Endian); end List_Array_Info; ------------------- -- List_Entities -- ------------------- procedure List_Entities (Ent : Entity_Id; Bytes_Big_Endian : Boolean) is Body_E : Entity_Id; E : Entity_Id; function Find_Declaration (E : Entity_Id) return Node_Id; -- Utility to retrieve declaration node for entity in the -- case of package bodies and subprograms. ---------------------- -- Find_Declaration -- ---------------------- function Find_Declaration (E : Entity_Id) return Node_Id is Decl : Node_Id; begin Decl := Parent (E); while Present (Decl) and then Nkind (Decl) /= N_Package_Body and then Nkind (Decl) /= N_Subprogram_Declaration and then Nkind (Decl) /= N_Subprogram_Body loop Decl := Parent (Decl); end loop; return Decl; end Find_Declaration; -- Start of processing for List_Entities begin -- List entity if we have one, and it is not a renaming declaration. -- For renamings, we don't get proper information, and really it makes -- sense to restrict the output to the renamed entity. if Present (Ent) and then Nkind (Declaration_Node (Ent)) not in N_Renaming_Declaration then -- If entity is a subprogram and we are listing mechanisms, -- then we need to list mechanisms for this entity. if List_Representation_Info_Mechanisms and then (Is_Subprogram (Ent) or else Ekind (Ent) = E_Entry or else Ekind (Ent) = E_Entry_Family) then Need_Blank_Line := True; List_Mechanisms (Ent); end if; E := First_Entity (Ent); while Present (E) loop Need_Blank_Line := True; -- We list entities that come from source (excluding private or -- incomplete types or deferred constants, where we will list the -- info for the full view). If debug flag A is set, then all -- entities are listed if (Comes_From_Source (E) and then not Is_Incomplete_Or_Private_Type (E) and then not (Ekind (E) = E_Constant and then Present (Full_View (E)))) or else Debug_Flag_AA then if Is_Subprogram (E) then List_Linker_Section (E); if List_Representation_Info_Mechanisms then List_Mechanisms (E); end if; elsif Ekind_In (E, E_Entry, E_Entry_Family, E_Subprogram_Type) then if List_Representation_Info_Mechanisms then List_Mechanisms (E); end if; elsif Is_Record_Type (E) then if List_Representation_Info >= 1 then List_Record_Info (E, Bytes_Big_Endian); end if; List_Linker_Section (E); elsif Is_Array_Type (E) then if List_Representation_Info >= 1 then List_Array_Info (E, Bytes_Big_Endian); end if; List_Linker_Section (E); elsif Is_Type (E) then if List_Representation_Info >= 2 then List_Type_Info (E); List_Linker_Section (E); end if; elsif Ekind_In (E, E_Variable, E_Constant) then if List_Representation_Info >= 2 then List_Object_Info (E); List_Linker_Section (E); end if; elsif Ekind (E) = E_Loop_Parameter or else Is_Formal (E) then if List_Representation_Info >= 2 then List_Object_Info (E); end if; end if; -- Recurse into nested package, but not if they are package -- renamings (in particular renamings of the enclosing package, -- as for some Java bindings and for generic instances). if Ekind (E) = E_Package then if No (Renamed_Object (E)) then List_Entities (E, Bytes_Big_Endian); end if; -- Recurse into bodies elsif Ekind_In (E, E_Protected_Type, E_Task_Type, E_Subprogram_Body, E_Package_Body, E_Task_Body, E_Protected_Body) then List_Entities (E, Bytes_Big_Endian); -- Recurse into blocks elsif Ekind (E) = E_Block then List_Entities (E, Bytes_Big_Endian); end if; end if; E := Next_Entity (E); end loop; -- For a package body, the entities of the visible subprograms are -- declared in the corresponding spec. Iterate over its entities in -- order to handle properly the subprogram bodies. Skip bodies in -- subunits, which are listed independently. if Ekind (Ent) = E_Package_Body and then Present (Corresponding_Spec (Find_Declaration (Ent))) then E := First_Entity (Corresponding_Spec (Find_Declaration (Ent))); while Present (E) loop if Is_Subprogram (E) and then Nkind (Find_Declaration (E)) = N_Subprogram_Declaration then Body_E := Corresponding_Body (Find_Declaration (E)); if Present (Body_E) and then Nkind (Parent (Find_Declaration (Body_E))) /= N_Subunit then List_Entities (Body_E, Bytes_Big_Endian); end if; end if; Next_Entity (E); end loop; end if; end if; end List_Entities; ------------------------- -- List_GCC_Expression -- ------------------------- procedure List_GCC_Expression (U : Node_Ref_Or_Val) is procedure Print_Expr (Val : Node_Ref_Or_Val); -- Internal recursive procedure to print expression ---------------- -- Print_Expr -- ---------------- procedure Print_Expr (Val : Node_Ref_Or_Val) is begin if Val >= 0 then UI_Write (Val, Decimal); else declare Node : Exp_Node renames Rep_Table.Table (-UI_To_Int (Val)); procedure Binop (S : String); -- Output text for binary operator with S being operator name ----------- -- Binop -- ----------- procedure Binop (S : String) is begin Write_Char ('('); Print_Expr (Node.Op1); Write_Str (S); Print_Expr (Node.Op2); Write_Char (')'); end Binop; -- Start of processing for Print_Expr begin case Node.Expr is when Cond_Expr => Write_Str ("(if "); Print_Expr (Node.Op1); Write_Str (" then "); Print_Expr (Node.Op2); Write_Str (" else "); Print_Expr (Node.Op3); Write_Str (" end)"); when Plus_Expr => Binop (" + "); when Minus_Expr => Binop (" - "); when Mult_Expr => Binop (" * "); when Trunc_Div_Expr => Binop (" /t "); when Ceil_Div_Expr => Binop (" /c "); when Floor_Div_Expr => Binop (" /f "); when Trunc_Mod_Expr => Binop (" modt "); when Floor_Mod_Expr => Binop (" modf "); when Ceil_Mod_Expr => Binop (" modc "); when Exact_Div_Expr => Binop (" /e "); when Negate_Expr => Write_Char ('-'); Print_Expr (Node.Op1); when Min_Expr => Binop (" min "); when Max_Expr => Binop (" max "); when Abs_Expr => Write_Str ("abs "); Print_Expr (Node.Op1); when Truth_Andif_Expr => Binop (" and if "); when Truth_Orif_Expr => Binop (" or if "); when Truth_And_Expr => Binop (" and "); when Truth_Or_Expr => Binop (" or "); when Truth_Xor_Expr => Binop (" xor "); when Truth_Not_Expr => Write_Str ("not "); Print_Expr (Node.Op1); when Bit_And_Expr => Binop (" & "); when Lt_Expr => Binop (" < "); when Le_Expr => Binop (" <= "); when Gt_Expr => Binop (" > "); when Ge_Expr => Binop (" >= "); when Eq_Expr => Binop (" == "); when Ne_Expr => Binop (" != "); when Discrim_Val => Write_Char ('#'); UI_Write (Node.Op1); end case; end; end if; end Print_Expr; -- Start of processing for List_GCC_Expression begin if U = No_Uint then Write_Str ("??"); else Print_Expr (U); end if; end List_GCC_Expression; ------------------------- -- List_Linker_Section -- ------------------------- procedure List_Linker_Section (Ent : Entity_Id) is Arg : Node_Id; begin if Present (Linker_Section_Pragma (Ent)) then Write_Str ("pragma Linker_Section ("); List_Name (Ent); Write_Str (", """); Arg := Last (Pragma_Argument_Associations (Linker_Section_Pragma (Ent))); if Nkind (Arg) = N_Pragma_Argument_Association then Arg := Expression (Arg); end if; pragma Assert (Nkind (Arg) = N_String_Literal); String_To_Name_Buffer (Strval (Arg)); Write_Str (Name_Buffer (1 .. Name_Len)); Write_Str (""");"); Write_Eol; end if; end List_Linker_Section; --------------------- -- List_Mechanisms -- --------------------- procedure List_Mechanisms (Ent : Entity_Id) is Plen : Natural; Form : Entity_Id; begin Blank_Line; case Ekind (Ent) is when E_Function => Write_Str ("function "); when E_Operator => Write_Str ("operator "); when E_Procedure => Write_Str ("procedure "); when E_Subprogram_Type => Write_Str ("type "); when E_Entry | E_Entry_Family => Write_Str ("entry "); when others => raise Program_Error; end case; Get_Unqualified_Decoded_Name_String (Chars (Ent)); Write_Str (Name_Buffer (1 .. Name_Len)); Write_Str (" declared at "); Write_Location (Sloc (Ent)); Write_Eol; Write_Str (" convention : "); case Convention (Ent) is when Convention_Ada => Write_Line ("Ada"); when Convention_Ada_Pass_By_Copy => Write_Line ("Ada_Pass_By_Copy"); when Convention_Ada_Pass_By_Reference => Write_Line ("Ada_Pass_By_Reference"); when Convention_Intrinsic => Write_Line ("Intrinsic"); when Convention_Entry => Write_Line ("Entry"); when Convention_Protected => Write_Line ("Protected"); when Convention_Assembler => Write_Line ("Assembler"); when Convention_C => Write_Line ("C"); when Convention_CIL => Write_Line ("CIL"); when Convention_COBOL => Write_Line ("COBOL"); when Convention_CPP => Write_Line ("C++"); when Convention_Fortran => Write_Line ("Fortran"); when Convention_Java => Write_Line ("Java"); when Convention_Stdcall => Write_Line ("Stdcall"); when Convention_Stubbed => Write_Line ("Stubbed"); end case; -- Find max length of formal name Plen := 0; Form := First_Formal (Ent); while Present (Form) loop Get_Unqualified_Decoded_Name_String (Chars (Form)); if Name_Len > Plen then Plen := Name_Len; end if; Next_Formal (Form); end loop; -- Output formals and mechanisms Form := First_Formal (Ent); while Present (Form) loop Get_Unqualified_Decoded_Name_String (Chars (Form)); while Name_Len <= Plen loop Name_Len := Name_Len + 1; Name_Buffer (Name_Len) := ' '; end loop; Write_Str (" "); Write_Str (Name_Buffer (1 .. Plen + 1)); Write_Str (": passed by "); Write_Mechanism (Mechanism (Form)); Write_Eol; Next_Formal (Form); end loop; if Etype (Ent) /= Standard_Void_Type then Write_Str (" returns by "); Write_Mechanism (Mechanism (Ent)); Write_Eol; end if; end List_Mechanisms; --------------- -- List_Name -- --------------- procedure List_Name (Ent : Entity_Id) is begin if not Is_Compilation_Unit (Scope (Ent)) then List_Name (Scope (Ent)); Write_Char ('.'); end if; Get_Unqualified_Decoded_Name_String (Chars (Ent)); Set_Casing (Unit_Casing); Write_Str (Name_Buffer (1 .. Name_Len)); end List_Name; --------------------- -- List_Object_Info -- --------------------- procedure List_Object_Info (Ent : Entity_Id) is begin Blank_Line; Write_Str ("for "); List_Name (Ent); Write_Str ("'Size use "); Write_Val (Esize (Ent)); Write_Line (";"); Write_Str ("for "); List_Name (Ent); Write_Str ("'Alignment use "); Write_Val (Alignment (Ent)); Write_Line (";"); end List_Object_Info; ---------------------- -- List_Record_Info -- ---------------------- procedure List_Record_Info (Ent : Entity_Id; Bytes_Big_Endian : Boolean) is Comp : Entity_Id; Cfbit : Uint; Sunit : Uint; Max_Name_Length : Natural; Max_Suni_Length : Natural; begin Blank_Line; List_Type_Info (Ent); Write_Str ("for "); List_Name (Ent); Write_Line (" use record"); -- First loop finds out max line length and max starting position -- length, for the purpose of lining things up nicely. Max_Name_Length := 0; Max_Suni_Length := 0; Comp := First_Component_Or_Discriminant (Ent); while Present (Comp) loop -- Skip discriminant in unchecked union (since it is not there!) if Ekind (Comp) = E_Discriminant and then Is_Unchecked_Union (Ent) then null; -- All other cases else Get_Decoded_Name_String (Chars (Comp)); Max_Name_Length := Natural'Max (Max_Name_Length, Name_Len); Cfbit := Component_Bit_Offset (Comp); if Rep_Not_Constant (Cfbit) then UI_Image_Length := 2; else -- Complete annotation in case not done Set_Normalized_Position (Comp, Cfbit / SSU); Set_Normalized_First_Bit (Comp, Cfbit mod SSU); Sunit := Cfbit / SSU; UI_Image (Sunit); end if; -- If the record is not packed, then we know that all fields -- whose position is not specified have a starting normalized -- bit position of zero. if Unknown_Normalized_First_Bit (Comp) and then not Is_Packed (Ent) then Set_Normalized_First_Bit (Comp, Uint_0); end if; Max_Suni_Length := Natural'Max (Max_Suni_Length, UI_Image_Length); end if; Next_Component_Or_Discriminant (Comp); end loop; -- Second loop does actual output based on those values Comp := First_Component_Or_Discriminant (Ent); while Present (Comp) loop -- Skip discriminant in unchecked union (since it is not there!) if Ekind (Comp) = E_Discriminant and then Is_Unchecked_Union (Ent) then goto Continue; end if; -- All other cases declare Esiz : constant Uint := Esize (Comp); Bofs : constant Uint := Component_Bit_Offset (Comp); Npos : constant Uint := Normalized_Position (Comp); Fbit : constant Uint := Normalized_First_Bit (Comp); Lbit : Uint; begin Write_Str (" "); Get_Decoded_Name_String (Chars (Comp)); Set_Casing (Unit_Casing); Write_Str (Name_Buffer (1 .. Name_Len)); for J in 1 .. Max_Name_Length - Name_Len loop Write_Char (' '); end loop; Write_Str (" at "); if Known_Static_Normalized_Position (Comp) then UI_Image (Npos); Spaces (Max_Suni_Length - UI_Image_Length); Write_Str (UI_Image_Buffer (1 .. UI_Image_Length)); elsif Known_Component_Bit_Offset (Comp) and then List_Representation_Info = 3 then Spaces (Max_Suni_Length - 2); Write_Str ("bit offset"); Write_Val (Bofs, Paren => True); Write_Str (" size in bits = "); Write_Val (Esiz, Paren => True); Write_Eol; goto Continue; elsif Known_Normalized_Position (Comp) and then List_Representation_Info = 3 then Spaces (Max_Suni_Length - 2); Write_Val (Npos); else -- For the packed case, we don't know the bit positions if we -- don't know the starting position. if Is_Packed (Ent) then Write_Line ("?? range ? .. ??;"); goto Continue; -- Otherwise we can continue else Write_Str ("??"); end if; end if; Write_Str (" range "); UI_Write (Fbit); Write_Str (" .. "); -- Allowing Uint_0 here is an annoying special case. Really this -- should be a fine Esize value but currently it means unknown, -- except that we know after gigi has back annotated that a size -- of zero is real, since otherwise gigi back annotates using -- No_Uint as the value to indicate unknown). if (Esize (Comp) = Uint_0 or else Known_Static_Esize (Comp)) and then Known_Static_Normalized_First_Bit (Comp) then Lbit := Fbit + Esiz - 1; if Lbit < 10 then Write_Char (' '); end if; UI_Write (Lbit); -- The test for Esize (Comp) not Uint_0 here is an annoying -- special case. Officially a value of zero for Esize means -- unknown, but here we use the fact that we know that gigi -- annotates Esize with No_Uint, not Uint_0. Really everyone -- should use No_Uint??? elsif List_Representation_Info < 3 or else (Esize (Comp) /= Uint_0 and then Unknown_Esize (Comp)) then Write_Str ("??"); -- List_Representation >= 3 and Known_Esize (Comp) else Write_Val (Esiz, Paren => True); -- If in front end layout mode, then dynamic size is stored -- in storage units, so renormalize for output if not Back_End_Layout then Write_Str (" * "); Write_Int (SSU); end if; -- Add appropriate first bit offset if Fbit = 0 then Write_Str (" - 1"); elsif Fbit = 1 then null; else Write_Str (" + "); Write_Int (UI_To_Int (Fbit) - 1); end if; end if; Write_Line (";"); end; <<Continue>> Next_Component_Or_Discriminant (Comp); end loop; Write_Line ("end record;"); List_Scalar_Storage_Order (Ent, Bytes_Big_Endian); end List_Record_Info; ------------------- -- List_Rep_Info -- ------------------- procedure List_Rep_Info (Bytes_Big_Endian : Boolean) is Col : Nat; begin if List_Representation_Info /= 0 or else List_Representation_Info_Mechanisms then for U in Main_Unit .. Last_Unit loop if In_Extended_Main_Source_Unit (Cunit_Entity (U)) then Unit_Casing := Identifier_Casing (Source_Index (U)); -- Normal case, list to standard output if not List_Representation_Info_To_File then Write_Eol; Write_Str ("Representation information for unit "); Write_Unit_Name (Unit_Name (U)); Col := Column; Write_Eol; for J in 1 .. Col - 1 loop Write_Char ('-'); end loop; Write_Eol; List_Entities (Cunit_Entity (U), Bytes_Big_Endian); -- List representation information to file else Create_Repinfo_File_Access.all (Get_Name_String (File_Name (Source_Index (U)))); Set_Special_Output (Write_Info_Line'Access); List_Entities (Cunit_Entity (U), Bytes_Big_Endian); Set_Special_Output (null); Close_Repinfo_File_Access.all; end if; end if; end loop; end if; end List_Rep_Info; ------------------------------- -- List_Scalar_Storage_Order -- ------------------------------- procedure List_Scalar_Storage_Order (Ent : Entity_Id; Bytes_Big_Endian : Boolean) is procedure List_Attr (Attr_Name : String; Is_Reversed : Boolean); -- Show attribute definition clause for Attr_Name (an endianness -- attribute), depending on whether or not the endianness is reversed -- compared to native endianness. --------------- -- List_Attr -- --------------- procedure List_Attr (Attr_Name : String; Is_Reversed : Boolean) is begin Write_Str ("for "); List_Name (Ent); Write_Str ("'" & Attr_Name & " use System."); if Bytes_Big_Endian xor Is_Reversed then Write_Str ("High"); else Write_Str ("Low"); end if; Write_Line ("_Order_First;"); end List_Attr; List_SSO : constant Boolean := Has_Rep_Item (Ent, Name_Scalar_Storage_Order) or else SSO_Set_Low_By_Default (Ent) or else SSO_Set_High_By_Default (Ent); -- Scalar_Storage_Order is displayed if specified explicitly -- or set by Default_Scalar_Storage_Order. -- Start of processing for List_Scalar_Storage_Order begin -- For record types, list Bit_Order if not default, or if SSO is shown if Is_Record_Type (Ent) and then (List_SSO or else Reverse_Bit_Order (Ent)) then List_Attr ("Bit_Order", Reverse_Bit_Order (Ent)); end if; -- List SSO if required. If not, then storage is supposed to be in -- native order. if List_SSO then List_Attr ("Scalar_Storage_Order", Reverse_Storage_Order (Ent)); else pragma Assert (not Reverse_Storage_Order (Ent)); null; end if; end List_Scalar_Storage_Order; -------------------- -- List_Type_Info -- -------------------- procedure List_Type_Info (Ent : Entity_Id) is begin Blank_Line; -- Do not list size info for unconstrained arrays, not meaningful if Is_Array_Type (Ent) and then not Is_Constrained (Ent) then null; else -- If Esize and RM_Size are the same and known, list as Size. This -- is a common case, which we may as well list in simple form. if Esize (Ent) = RM_Size (Ent) then Write_Str ("for "); List_Name (Ent); Write_Str ("'Size use "); Write_Val (Esize (Ent)); Write_Line (";"); -- For now, temporary case, to be removed when gigi properly back -- annotates RM_Size, if RM_Size is not set, then list Esize as Size. -- This avoids odd Object_Size output till we fix things??? elsif Unknown_RM_Size (Ent) then Write_Str ("for "); List_Name (Ent); Write_Str ("'Size use "); Write_Val (Esize (Ent)); Write_Line (";"); -- Otherwise list size values separately if they are set else Write_Str ("for "); List_Name (Ent); Write_Str ("'Object_Size use "); Write_Val (Esize (Ent)); Write_Line (";"); -- Note on following check: The RM_Size of a discrete type can -- legitimately be set to zero, so a special check is needed. Write_Str ("for "); List_Name (Ent); Write_Str ("'Value_Size use "); Write_Val (RM_Size (Ent)); Write_Line (";"); end if; end if; Write_Str ("for "); List_Name (Ent); Write_Str ("'Alignment use "); Write_Val (Alignment (Ent)); Write_Line (";"); -- Special stuff for fixed-point if Is_Fixed_Point_Type (Ent) then -- Write small (always a static constant) Write_Str ("for "); List_Name (Ent); Write_Str ("'Small use "); UR_Write (Small_Value (Ent)); Write_Line (";"); -- Write range if static declare R : constant Node_Id := Scalar_Range (Ent); begin if Nkind (Low_Bound (R)) = N_Real_Literal and then Nkind (High_Bound (R)) = N_Real_Literal then Write_Str ("for "); List_Name (Ent); Write_Str ("'Range use "); UR_Write (Realval (Low_Bound (R))); Write_Str (" .. "); UR_Write (Realval (High_Bound (R))); Write_Line (";"); end if; end; end if; end List_Type_Info; ---------------------- -- Rep_Not_Constant -- ---------------------- function Rep_Not_Constant (Val : Node_Ref_Or_Val) return Boolean is begin if Val = No_Uint or else Val < 0 then return True; else return False; end if; end Rep_Not_Constant; --------------- -- Rep_Value -- --------------- function Rep_Value (Val : Node_Ref_Or_Val; D : Discrim_List) return Uint is function B (Val : Boolean) return Uint; -- Returns Uint_0 for False, Uint_1 for True function T (Val : Node_Ref_Or_Val) return Boolean; -- Returns True for 0, False for any non-zero (i.e. True) function V (Val : Node_Ref_Or_Val) return Uint; -- Internal recursive routine to evaluate tree function W (Val : Uint) return Word; -- Convert Val to Word, assuming Val is always in the Int range. This -- is a helper function for the evaluation of bitwise expressions like -- Bit_And_Expr, for which there is no direct support in uintp. Uint -- values out of the Int range are expected to be seen in such -- expressions only with overflowing byte sizes around, introducing -- inherent unreliabilities in computations anyway. ------- -- B -- ------- function B (Val : Boolean) return Uint is begin if Val then return Uint_1; else return Uint_0; end if; end B; ------- -- T -- ------- function T (Val : Node_Ref_Or_Val) return Boolean is begin if V (Val) = 0 then return False; else return True; end if; end T; ------- -- V -- ------- function V (Val : Node_Ref_Or_Val) return Uint is L, R, Q : Uint; begin if Val >= 0 then return Val; else declare Node : Exp_Node renames Rep_Table.Table (-UI_To_Int (Val)); begin case Node.Expr is when Cond_Expr => if T (Node.Op1) then return V (Node.Op2); else return V (Node.Op3); end if; when Plus_Expr => return V (Node.Op1) + V (Node.Op2); when Minus_Expr => return V (Node.Op1) - V (Node.Op2); when Mult_Expr => return V (Node.Op1) * V (Node.Op2); when Trunc_Div_Expr => return V (Node.Op1) / V (Node.Op2); when Ceil_Div_Expr => return UR_Ceiling (V (Node.Op1) / UR_From_Uint (V (Node.Op2))); when Floor_Div_Expr => return UR_Floor (V (Node.Op1) / UR_From_Uint (V (Node.Op2))); when Trunc_Mod_Expr => return V (Node.Op1) rem V (Node.Op2); when Floor_Mod_Expr => return V (Node.Op1) mod V (Node.Op2); when Ceil_Mod_Expr => L := V (Node.Op1); R := V (Node.Op2); Q := UR_Ceiling (L / UR_From_Uint (R)); return L - R * Q; when Exact_Div_Expr => return V (Node.Op1) / V (Node.Op2); when Negate_Expr => return -V (Node.Op1); when Min_Expr => return UI_Min (V (Node.Op1), V (Node.Op2)); when Max_Expr => return UI_Max (V (Node.Op1), V (Node.Op2)); when Abs_Expr => return UI_Abs (V (Node.Op1)); when Truth_Andif_Expr => return B (T (Node.Op1) and then T (Node.Op2)); when Truth_Orif_Expr => return B (T (Node.Op1) or else T (Node.Op2)); when Truth_And_Expr => return B (T (Node.Op1) and then T (Node.Op2)); when Truth_Or_Expr => return B (T (Node.Op1) or else T (Node.Op2)); when Truth_Xor_Expr => return B (T (Node.Op1) xor T (Node.Op2)); when Truth_Not_Expr => return B (not T (Node.Op1)); when Bit_And_Expr => L := V (Node.Op1); R := V (Node.Op2); return UI_From_Int (Int (W (L) and W (R))); when Lt_Expr => return B (V (Node.Op1) < V (Node.Op2)); when Le_Expr => return B (V (Node.Op1) <= V (Node.Op2)); when Gt_Expr => return B (V (Node.Op1) > V (Node.Op2)); when Ge_Expr => return B (V (Node.Op1) >= V (Node.Op2)); when Eq_Expr => return B (V (Node.Op1) = V (Node.Op2)); when Ne_Expr => return B (V (Node.Op1) /= V (Node.Op2)); when Discrim_Val => declare Sub : constant Int := UI_To_Int (Node.Op1); begin pragma Assert (Sub in D'Range); return D (Sub); end; end case; end; end if; end V; ------- -- W -- ------- -- We use an unchecked conversion to map Int values to their Word -- bitwise equivalent, which we could not achieve with a normal type -- conversion for negative Ints. We want bitwise equivalents because W -- is used as a helper for bit operators like Bit_And_Expr, and can be -- called for negative Ints in the context of aligning expressions like -- X+Align & -Align. function W (Val : Uint) return Word is function To_Word is new Ada.Unchecked_Conversion (Int, Word); begin return To_Word (UI_To_Int (Val)); end W; -- Start of processing for Rep_Value begin if Val = No_Uint then return No_Uint; else return V (Val); end if; end Rep_Value; ------------ -- Spaces -- ------------ procedure Spaces (N : Natural) is begin for J in 1 .. N loop Write_Char (' '); end loop; end Spaces; --------------- -- Tree_Read -- --------------- procedure Tree_Read is begin Rep_Table.Tree_Read; end Tree_Read; ---------------- -- Tree_Write -- ---------------- procedure Tree_Write is begin Rep_Table.Tree_Write; end Tree_Write; --------------------- -- Write_Info_Line -- --------------------- procedure Write_Info_Line (S : String) is begin Write_Repinfo_Line_Access.all (S (S'First .. S'Last - 1)); end Write_Info_Line; --------------------- -- Write_Mechanism -- --------------------- procedure Write_Mechanism (M : Mechanism_Type) is begin case M is when 0 => Write_Str ("default"); when -1 => Write_Str ("copy"); when -2 => Write_Str ("reference"); when others => raise Program_Error; end case; end Write_Mechanism; --------------- -- Write_Val -- --------------- procedure Write_Val (Val : Node_Ref_Or_Val; Paren : Boolean := False) is begin if Rep_Not_Constant (Val) then if List_Representation_Info < 3 or else Val = No_Uint then Write_Str ("??"); else if Back_End_Layout then Write_Char (' '); if Paren then Write_Char ('('); List_GCC_Expression (Val); Write_Char (')'); else List_GCC_Expression (Val); end if; Write_Char (' '); else if Paren then Write_Char ('('); Write_Name_Decoded (Chars (Get_Dynamic_SO_Entity (Val))); Write_Char (')'); else Write_Name_Decoded (Chars (Get_Dynamic_SO_Entity (Val))); end if; end if; end if; else UI_Write (Val); end if; end Write_Val; end Repinfo;
reznikmm/matreshka
Ada
3,654
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.Number_Text_Elements is pragma Preelaborate; type ODF_Number_Text is limited interface and XML.DOM.Elements.DOM_Element; type ODF_Number_Text_Access is access all ODF_Number_Text'Class with Storage_Size => 0; end ODF.DOM.Number_Text_Elements;
stcarrez/swagger-ada
Ada
1,402
ads
----------------------------------------------------------------------- -- openapi-credentials -- Rest client credentials -- Copyright (C) 2018, 2022 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.Http.Clients; -- == REST Credentials == -- The <tt>Swagger.Credentials</tt> package provides support to represent client -- credentials and add them when a REST operation is called. package OpenAPI.Credentials is type Credential_Type is limited interface; -- Set the credentials on the HTTP client request before doing the call. procedure Set_Credentials (Credential : in Credential_Type; Into : in out Util.Http.Clients.Client'Class) is abstract; end OpenAPI.Credentials;
stcarrez/ada-asf
Ada
2,713
adb
----------------------------------------------------------------------- -- asf-helpers-beans -- Helper packages to write ASF applications -- Copyright (C) 2012, 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 Util.Beans.Objects; with ASF.Contexts.Faces; package body ASF.Helpers.Beans is -- ------------------------------ -- Get a bean instance associated under the given name from the current faces context. -- A null value is returned if the bean does not exist or is not of the good type. -- ------------------------------ function Get_Bean (Name : in String) return Element_Access is use type ASF.Contexts.Faces.Faces_Context_Access; use type Util.Beans.Basic.Readonly_Bean_Access; Context : constant ASF.Contexts.Faces.Faces_Context_Access := ASF.Contexts.Faces.Current; begin if Context = null then return null; end if; declare Bean : constant Util.Beans.Basic.Readonly_Bean_Access := Context.Get_Bean (Name); begin if Bean = null or else not (Bean.all in Element_Type'Class) then return null; else return Element_Type'Class (Bean.all)'Access; end if; end; end Get_Bean; -- ------------------------------ -- Get a bean instance associated under the given name from the request. -- A null value is returned if the bean does not exist or is not of the good type. -- ------------------------------ function Get_Request_Bean (Request : in ASF.Requests.Request'Class; Name : in String) return Element_Access is Value : constant Util.Beans.Objects.Object := Request.Get_Attribute (Name); Bean : constant access Util.Beans.Basic.Readonly_Bean'Class := Util.Beans.Objects.To_Bean (Value); begin if Bean = null or else not (Bean.all in Element_Type'Class) then return null; else return Element_Type'Class (Bean.all)'Access; end if; end Get_Request_Bean; end ASF.Helpers.Beans;
stcarrez/ada-util
Ada
5,594
adb
----------------------------------------------------------------------- -- util-commands -- Support to make command line tools -- Copyright (C) 2017, 2018, 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 Ada.Command_Line; with Ada.Characters.Handling; with Util.Systems.IO; with Util.Systems.Os; package body Util.Commands is -- ------------------------------ -- Get the number of arguments available. -- ------------------------------ overriding function Get_Count (List : in Default_Argument_List) return Natural is Count : constant Natural := Ada.Command_Line.Argument_Count; begin if Count > List.Offset then return Count - List.Offset; else return 0; end if; end Get_Count; -- ------------------------------ -- Get the argument at the given position. -- ------------------------------ overriding function Get_Argument (List : in Default_Argument_List; Pos : in Positive) return String is begin return Ada.Command_Line.Argument (Pos + List.Offset); end Get_Argument; -- ------------------------------ -- Get the command name. -- ------------------------------ overriding function Get_Command_Name (List : in Default_Argument_List) return String is pragma Unreferenced (List); begin return Ada.Command_Line.Command_Name; end Get_Command_Name; -- ------------------------------ -- Set the argument list to the given string and split the arguments. -- ------------------------------ procedure Initialize (List : in out String_Argument_List; Line : in String) is First : Natural := Line'First; begin List.Length := Line'Length; List.Line (1 .. Line'Length) := Line; List.Count := 0; loop while First <= Line'Length and then Ada.Characters.Handling.Is_Space (List.Line (First)) loop First := First + 1; end loop; exit when First > Line'Length; List.Start_Pos (List.Count) := First; while First <= Line'Length and then not Ada.Characters.Handling.Is_Space (List.Line (First)) loop First := First + 1; end loop; List.End_Pos (List.Count) := First - 1; List.Count := List.Count + 1; end loop; if List.Count > 0 then List.Count := List.Count - 1; end if; end Initialize; -- ------------------------------ -- Get the number of arguments available. -- ------------------------------ overriding function Get_Count (List : in String_Argument_List) return Natural is begin return List.Count; end Get_Count; -- ------------------------------ -- Get the argument at the given position. -- ------------------------------ overriding function Get_Argument (List : in String_Argument_List; Pos : in Positive) return String is begin return List.Line (List.Start_Pos (Pos) .. List.End_Pos (Pos)); end Get_Argument; -- ------------------------------ -- Get the command name. -- ------------------------------ overriding function Get_Command_Name (List : in String_Argument_List) return String is begin return List.Line (List.Start_Pos (0) .. List.End_Pos (0)); end Get_Command_Name; -- ------------------------------ -- Get the number of arguments available. -- ------------------------------ overriding function Get_Count (List : in Dynamic_Argument_List) return Natural is begin return Natural (List.List.Length); end Get_Count; -- ------------------------------ -- Get the argument at the given position. -- ------------------------------ overriding function Get_Argument (List : in Dynamic_Argument_List; Pos : in Positive) return String is begin return List.List.Element (Pos); end Get_Argument; -- ------------------------------ -- Get the command name. -- ------------------------------ overriding function Get_Command_Name (List : in Dynamic_Argument_List) return String is begin return Ada.Strings.Unbounded.To_String (List.Name); end Get_Command_Name; procedure Put_Raw (Content : in String) is begin Util.Systems.IO.Put_Raw (Util.Systems.IO.STDOUT_FILENO, Content); end Put_Raw; procedure Put_Raw_Line (Content : in String) is begin Util.Systems.IO.Put_Raw (Util.Systems.IO.STDOUT_FILENO, Content & Util.Systems.Os.Line_Separator); end Put_Raw_Line; procedure New_Line_Raw (Count : in Positive) is begin for I in 1 .. Count loop Util.Systems.IO.Put_Raw (Util.Systems.IO.STDOUT_FILENO, Util.Systems.Os.Line_Separator); end loop; end New_Line_Raw; end Util.Commands;
zhmu/ananas
Ada
77
ads
generic package Generic_Inst6_G1.C is function Check return Integer; end;
reznikmm/matreshka
Ada
4,695
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.Draw_Polyline_Elements; package Matreshka.ODF_Draw.Polyline_Elements is type Draw_Polyline_Element_Node is new Matreshka.ODF_Draw.Abstract_Draw_Element_Node and ODF.DOM.Draw_Polyline_Elements.ODF_Draw_Polyline with null record; overriding function Create (Parameters : not null access Matreshka.DOM_Elements.Element_L2_Parameters) return Draw_Polyline_Element_Node; overriding function Get_Local_Name (Self : not null access constant Draw_Polyline_Element_Node) return League.Strings.Universal_String; overriding procedure Enter_Node (Self : not null access Draw_Polyline_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 Draw_Polyline_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 Draw_Polyline_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_Draw.Polyline_Elements;
reznikmm/matreshka
Ada
4,632
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.Font_Charset_Attributes is ------------ -- Create -- ------------ overriding function Create (Parameters : not null access Matreshka.DOM_Attributes.Attribute_L2_Parameters) return Style_Font_Charset_Attribute_Node is begin return Self : Style_Font_Charset_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_Font_Charset_Attribute_Node) return League.Strings.Universal_String is pragma Unreferenced (Self); begin return Matreshka.ODF_String_Constants.Font_Charset_Attribute; end Get_Local_Name; begin Matreshka.DOM_Documents.Register_Attribute (Matreshka.ODF_String_Constants.Style_URI, Matreshka.ODF_String_Constants.Font_Charset_Attribute, Style_Font_Charset_Attribute_Node'Tag); end Matreshka.ODF_Style.Font_Charset_Attributes;
reznikmm/matreshka
Ada
3,510
adb
------------------------------------------------------------------------------ -- -- -- Matreshka Project -- -- -- -- Web Framework -- -- -- -- Runtime Library Component -- -- -- ------------------------------------------------------------------------------ -- -- -- Copyright © 2017, 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$ ------------------------------------------------------------------------------ procedure Spikedog.Service.Driver is Service : aliased Spikedog.Service.Service; begin Services.Dispatch (Service'Unchecked_Access); end Spikedog.Service.Driver;
Schol-R-LEA/sarcos
Ada
102
ads
/home/schol-r-lea/Documents/Programming/Projects/OS-Experiments/sarcos/sarcos/ada/rts/src/s-atacco.ads
micahwelf/FLTK-Ada
Ada
10,423
adb
with Interfaces.C, System; use type Interfaces.C.int, System.Address; package body FLTK.Devices.Surfaces.Paged is function new_fl_paged_device return System.Address; pragma Import (C, new_fl_paged_device, "new_fl_paged_device"); pragma Inline (new_fl_paged_device); procedure free_fl_paged_device (D : in System.Address); pragma Import (C, free_fl_paged_device, "free_fl_paged_device"); pragma Inline (free_fl_paged_device); function fl_paged_device_start_job (D : in System.Address; C : in Interfaces.C.int) return Interfaces.C.int; pragma Import (C, fl_paged_device_start_job, "fl_paged_device_start_job"); pragma Inline (fl_paged_device_start_job); function fl_paged_device_start_job2 (D : in System.Address; C, F, T : in Interfaces.C.int) return Interfaces.C.int; pragma Import (C, fl_paged_device_start_job2, "fl_paged_device_start_job2"); pragma Inline (fl_paged_device_start_job2); procedure fl_paged_device_end_job (D : in System.Address); pragma Import (C, fl_paged_device_end_job, "fl_paged_device_end_job"); pragma Inline (fl_paged_device_end_job); function fl_paged_device_start_page (D : in System.Address) return Interfaces.C.int; pragma Import (C, fl_paged_device_start_page, "fl_paged_device_start_page"); pragma Inline (fl_paged_device_start_page); function fl_paged_device_end_page (D : in System.Address) return Interfaces.C.int; pragma Import (C, fl_paged_device_end_page, "fl_paged_device_end_page"); pragma Inline (fl_paged_device_end_page); procedure fl_paged_device_margins (D : in System.Address; L, T, R, B : out Interfaces.C.int); pragma Import (C, fl_paged_device_margins, "fl_paged_device_margins"); pragma Inline (fl_paged_device_margins); function fl_paged_device_printable_rect (D : in System.Address; W, H : out Interfaces.C.int) return Interfaces.C.int; pragma Import (C, fl_paged_device_printable_rect, "fl_paged_device_printable_rect"); pragma Inline (fl_paged_device_printable_rect); procedure fl_paged_device_get_origin (D : in System.Address; X, Y : out Interfaces.C.int); pragma Import (C, fl_paged_device_get_origin, "fl_paged_device_get_origin"); pragma Inline (fl_paged_device_get_origin); procedure fl_paged_device_set_origin (D : in System.Address; X, Y : in Interfaces.C.int); pragma Import (C, fl_paged_device_set_origin, "fl_paged_device_set_origin"); pragma Inline (fl_paged_device_set_origin); procedure fl_paged_device_rotate (D : in System.Address; R : in Interfaces.C.C_float); pragma Import (C, fl_paged_device_rotate, "fl_paged_device_rotate"); pragma Inline (fl_paged_device_rotate); procedure fl_paged_device_scale (D : in System.Address; X, Y : in Interfaces.C.C_float); pragma Import (C, fl_paged_device_scale, "fl_paged_device_scale"); pragma Inline (fl_paged_device_scale); procedure fl_paged_device_translate (D : in System.Address; X, Y : in Interfaces.C.int); pragma Import (C, fl_paged_device_translate, "fl_paged_device_translate"); pragma Inline (fl_paged_device_translate); procedure fl_paged_device_untranslate (D : in System.Address); pragma Import (C, fl_paged_device_untranslate, "fl_paged_device_untranslate"); pragma Inline (fl_paged_device_untranslate); procedure fl_paged_device_print_widget (D, I : in System.Address; DX, DY : in Interfaces.C.int); pragma Import (C, fl_paged_device_print_widget, "fl_paged_device_print_widget"); pragma Inline (fl_paged_device_print_widget); procedure fl_paged_device_print_window (D, I : in System.Address; DX, DY : in Interfaces.C.int); pragma Import (C, fl_paged_device_print_window, "fl_paged_device_print_window"); pragma Inline (fl_paged_device_print_window); procedure fl_paged_device_print_window_part (D, I : in System.Address; X, Y, W, H, DX, DY : in Interfaces.C.int); pragma Import (C, fl_paged_device_print_window_part, "fl_paged_device_print_window_part"); pragma Inline (fl_paged_device_print_window_part); procedure Finalize (This : in out Paged_Surface) is begin if This.Void_Ptr /= System.Null_Address and then This in Paged_Surface'Class then free_fl_paged_device (This.Void_Ptr); This.Void_Ptr := System.Null_Address; end if; Finalize (Surface_Device (This)); end Finalize; package body Forge is function Create return Paged_Surface is begin return This : Paged_Surface do This.Void_Ptr := new_fl_paged_device; end return; end Create; pragma Inline (Create); end Forge; procedure Start_Job (This : in out Paged_Surface; Count : in Natural) is begin if fl_paged_device_start_job (This.Void_Ptr, Interfaces.C.int (Count)) /= 0 then raise Page_Error; end if; end Start_Job; procedure Start_Job (This : in out Paged_Surface; Count : in Natural; From, To : in Positive) is begin if fl_paged_device_start_job2 (This.Void_Ptr, Interfaces.C.int (Count), Interfaces.C.int (From), Interfaces.C.int (To)) /= 0 then raise Page_Error; end if; end Start_Job; procedure End_Job (This : in out Paged_Surface) is begin fl_paged_device_end_job (This.Void_Ptr); end End_Job; procedure Start_Page (This : in out Paged_Surface) is begin if fl_paged_device_start_page (This.Void_Ptr) /= 0 then raise Page_Error; end if; end Start_Page; procedure End_Page (This : in out Paged_Surface) is begin if fl_paged_device_end_page (This.Void_Ptr) /= 0 then raise Page_Error; end if; end End_Page; procedure Get_Margins (This : in Paged_Surface; Left, Top, Right, Bottom : out Integer) is begin fl_paged_device_margins (This.Void_Ptr, Interfaces.C.int (Left), Interfaces.C.int (Top), Interfaces.C.int (Right), Interfaces.C.int (Bottom)); end Get_Margins; procedure Get_Printable_Rect (This : in Paged_Surface; W, H : out Integer) is begin if fl_paged_device_printable_rect (This.Void_Ptr, Interfaces.C.int (W), Interfaces.C.int (H)) /= 0 then raise Page_Error; end if; end Get_Printable_Rect; procedure Get_Origin (This : in Paged_Surface; X, Y : out Integer) is begin fl_paged_device_get_origin (This.Void_Ptr, Interfaces.C.int (X), Interfaces.C.int (Y)); end Get_Origin; procedure Set_Origin (This : in out Paged_Surface; X, Y : in Integer) is begin fl_paged_device_set_origin (This.Void_Ptr, Interfaces.C.int (X), Interfaces.C.int (Y)); end Set_Origin; procedure Rotate (This : in out Paged_Surface; Degrees : in Float) is begin fl_paged_device_rotate (This.Void_Ptr, Interfaces.C.C_float (Degrees)); end Rotate; procedure Scale (This : in out Paged_Surface; Factor : in Float) is begin fl_paged_device_scale (This.Void_Ptr, Interfaces.C.C_float (Factor), 0.0); end Scale; procedure Scale (This : in out Paged_Surface; Factor_X, Factor_Y : in Float) is begin fl_paged_device_scale (This.Void_Ptr, Interfaces.C.C_float (Factor_X), Interfaces.C.C_float (Factor_Y)); end Scale; procedure Translate (This : in out Paged_Surface; Delta_X, Delta_Y : in Integer) is begin fl_paged_device_translate (This.Void_Ptr, Interfaces.C.int (Delta_X), Interfaces.C.int (Delta_Y)); end Translate; procedure Untranslate (This : in out Paged_Surface) is begin fl_paged_device_untranslate (This.Void_Ptr); end Untranslate; procedure Print_Widget (This : in out Paged_Surface; Item : in FLTK.Widgets.Widget'Class; Offset_X, Offset_Y : in Integer := 0) is begin fl_paged_device_print_widget (This.Void_Ptr, Wrapper (Item).Void_Ptr, Interfaces.C.int (Offset_X), Interfaces.C.int (Offset_Y)); end Print_Widget; procedure Print_Window (This : in out Paged_Surface; Item : in FLTK.Widgets.Groups.Windows.Window'Class; Offset_X, Offset_Y : in Integer := 0) is begin fl_paged_device_print_window (This.Void_Ptr, Wrapper (Item).Void_Ptr, Interfaces.C.int (Offset_X), Interfaces.C.int (Offset_Y)); end Print_Window; procedure Print_Window_Part (This : in out Paged_Surface; Item : in FLTK.Widgets.Groups.Windows.Window'Class; X, Y, W, H : in Integer; Offset_X, Offset_Y : in Integer := 0) is begin fl_paged_device_print_window_part (This.Void_Ptr, Wrapper (Item).Void_Ptr, Interfaces.C.int (X), Interfaces.C.int (Y), Interfaces.C.int (W), Interfaces.C.int (H), Interfaces.C.int (Offset_X), Interfaces.C.int (Offset_Y)); end Print_Window_Part; end FLTK.Devices.Surfaces.Paged;
AdaCore/Ada_Drivers_Library
Ada
3,563
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. -- -- -- ------------------------------------------------------------------------------ -- This package acts as if it is a motor containing a quadrature encoder. As -- such, one can query the current wheel rotation direction, which is based -- on the internal encoder inputs. -- It is this package that contains and manages the timer that is in quad -- encoder mode, taking the two signals as inputs and providing the counts -- and direction information. In effect is is decoding the hardware signals -- produced by the encoder hardware, but they are not known as "decoders" in -- the industry. -- The set up and use of the timer in this "encoder mode" is the purpose of -- the demonstration. with STM32.GPIO; use STM32.GPIO; with STM32.Timers; use STM32.Timers; with STM32.Device; use STM32.Device; with HAL; use HAL; package Motor is pragma Elaborate_Body; function Encoder_Count return UInt32; type Direction is (Forward, Backward); function Current_Direction return Direction; private Encoder_Tach0 : constant GPIO_Point := PA8; Encoder_Tach1 : constant GPIO_Point := PE11; Encoder_Timer : Timer renames Timer_1; Encoder_AF : constant STM32.GPIO_Alternate_Function := GPIO_AF_TIM1_1; end Motor;
reznikmm/matreshka
Ada
4,695
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_Combobox_Elements; package Matreshka.ODF_Form.Combobox_Elements is type Form_Combobox_Element_Node is new Matreshka.ODF_Form.Abstract_Form_Element_Node and ODF.DOM.Form_Combobox_Elements.ODF_Form_Combobox with null record; overriding function Create (Parameters : not null access Matreshka.DOM_Elements.Element_L2_Parameters) return Form_Combobox_Element_Node; overriding function Get_Local_Name (Self : not null access constant Form_Combobox_Element_Node) return League.Strings.Universal_String; overriding procedure Enter_Node (Self : not null access Form_Combobox_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_Combobox_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_Combobox_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.Combobox_Elements;
burratoo/Acton
Ada
2,330
ads
------------------------------------------------------------------------------------------ -- -- -- OAK CORE SUPPORT PACKAGE -- -- ATMEL AVR -- -- -- -- OAK.CORE_SUPPORT_PACKAGE.CALL_STACK.OPS -- -- -- -- Copyright (C) 2012-2021, Patrick Bernardi -- -- -- ------------------------------------------------------------------------------------------ with Oak.Memory.Call_Stack; with System; with System.Storage_Elements; limited with Oak.Agent.Tasks; package Oak.Core_Support_Package.Call_Stack.Ops with Preelaborate is procedure Set_Task_Instruction_Pointer (Stack : in Oak.Memory.Call_Stack.Call_Stack_Handler; Instruction_Address : in System.Address) with Inline; procedure Set_Task_Body_Procedure (Stack : in Oak.Memory.Call_Stack.Call_Stack_Handler; Procedure_Address : in System.Address; Task_Value_Record : in System.Address); procedure Initialise_Call_Stack (Stack : in out Oak.Memory.Call_Stack.Call_Stack_Handler; Start_Instruction : in System.Address); procedure Initialise_Call_Stack (Stack : in out Oak.Memory.Call_Stack.Call_Stack_Handler; Start_Instruction : in System.Address; Task_Value_Record : in System.Address; Message_Location : out Oak.Agent.Tasks.Oak_Task_Message_Location); procedure Initialise_Call_Stack (Stack : in out Oak.Memory.Call_Stack.Call_Stack_Handler; Start_Instruction : in System.Address; Task_Value_Record : in System.Address; Stack_Address : in System.Address; Stack_Size : in System.Storage_Elements.Storage_Count; Message_Location : out Oak.Agent.Tasks.Oak_Task_Message_Location); end Oak.Core_Support_Package.Call_Stack.Ops;
zhmu/ananas
Ada
124
adb
-- { dg-do compile } -- { dg-options "-gnata" } package body Predicate12 is procedure Dummy is null; end Predicate12;
AdaCore/libadalang
Ada
107
adb
procedure Foo (I : Int) is Foo : exception; begin if I = 0 then raise Foo; end if; end Foo;
reznikmm/matreshka
Ada
4,153
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.Presentation_Display_Page_Number_Attributes; package Matreshka.ODF_Presentation.Display_Page_Number_Attributes is type Presentation_Display_Page_Number_Attribute_Node is new Matreshka.ODF_Presentation.Abstract_Presentation_Attribute_Node and ODF.DOM.Presentation_Display_Page_Number_Attributes.ODF_Presentation_Display_Page_Number_Attribute with null record; overriding function Create (Parameters : not null access Matreshka.DOM_Attributes.Attribute_L2_Parameters) return Presentation_Display_Page_Number_Attribute_Node; overriding function Get_Local_Name (Self : not null access constant Presentation_Display_Page_Number_Attribute_Node) return League.Strings.Universal_String; end Matreshka.ODF_Presentation.Display_Page_Number_Attributes;
ohenley/ada-util
Ada
3,578
adb
----------------------------------------------------------------------- -- util-streams-encoders -- Streams with encoding and decoding capabilities -- Copyright (C) 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 Util.Encoders.Base64; package body Util.Streams.Buffered.Encoders is -- ----------------------- -- Initialize the stream to write on the given stream. -- An internal buffer is allocated for writing the stream. -- ----------------------- procedure Initialize (Stream : in out Encoding_Stream; Output : in Output_Stream_Access; Size : in Natural; Format : in String) is begin Stream.Initialize (Output, Size); Stream.Transform := new Util.Encoders.Base64.Encoder; end Initialize; -- ----------------------- -- Close the sink. -- ----------------------- overriding procedure Close (Stream : in out Encoding_Stream) is begin Stream.Flush; Stream.Output.Close; end Close; -- ----------------------- -- Write the buffer array to the output stream. -- ----------------------- overriding procedure Write (Stream : in out Encoding_Stream; Buffer : in Ada.Streams.Stream_Element_Array) is First_Encoded : Ada.Streams.Stream_Element_Offset := Buffer'First; Last_Encoded : Ada.Streams.Stream_Element_Offset; Last_Pos : Ada.Streams.Stream_Element_Offset; begin while First_Encoded <= Buffer'Last loop Stream.Transform.Transform (Data => Buffer (First_Encoded .. Buffer'Last), Into => Stream.Buffer (Stream.Write_Pos .. Stream.Buffer'Last), Last => Last_Pos, Encoded => Last_Encoded); if Last_Encoded < Buffer'Last then Stream.Output.Write (Stream.Buffer (Stream.Buffer'First .. Last_Pos)); Stream.Write_Pos := Stream.Buffer'First; else Stream.Write_Pos := Last_Pos + 1; end if; First_Encoded := Last_Encoded + 1; end loop; end Write; -- ----------------------- -- Flush the buffer by writing on the output stream. -- Raises Data_Error if there is no output stream. -- ----------------------- overriding procedure Flush (Stream : in out Encoding_Stream) is Last_Pos : Ada.Streams.Stream_Element_Offset; begin Stream.Transform.Finish (Stream.Buffer (Stream.Write_Pos .. Stream.Buffer'Last), Last_Pos); Stream.Write_Pos := Last_Pos + 1; Output_Buffer_Stream (Stream).Flush; end Flush; -- ----------------------- -- Flush the stream and release the buffer. -- ----------------------- overriding procedure Finalize (Object : in out Encoding_Stream) is begin null; end Finalize; end Util.Streams.Buffered.Encoders;
AdaCore/training_material
Ada
176
adb
package body Converter is function Convert (Str : String) return Types.Integer_T is begin return Types.Integer_T'first; end Convert; end Converter;
reznikmm/matreshka
Ada
4,717
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.Text_Sheet_Name_Elements; package Matreshka.ODF_Text.Sheet_Name_Elements is type Text_Sheet_Name_Element_Node is new Matreshka.ODF_Text.Abstract_Text_Element_Node and ODF.DOM.Text_Sheet_Name_Elements.ODF_Text_Sheet_Name with null record; overriding function Create (Parameters : not null access Matreshka.DOM_Elements.Element_L2_Parameters) return Text_Sheet_Name_Element_Node; overriding function Get_Local_Name (Self : not null access constant Text_Sheet_Name_Element_Node) return League.Strings.Universal_String; overriding procedure Enter_Node (Self : not null access Text_Sheet_Name_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 Text_Sheet_Name_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 Text_Sheet_Name_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_Text.Sheet_Name_Elements;
reznikmm/matreshka
Ada
3,955
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$ ------------------------------------------------------------------------------ package body XML.SAX.Parse_Exceptions.Internals is ------------ -- Create -- ------------ function Create (Public_Id : League.Strings.Universal_String; System_Id : League.Strings.Universal_String; Line : Natural; Column : Natural; Message : League.Strings.Universal_String) return XML.SAX.Parse_Exceptions.SAX_Parse_Exception is begin return (Public_Id => Public_Id, System_Id => System_Id, Line => Line, Column => Column, Message => Message); end Create; end XML.SAX.Parse_Exceptions.Internals;
mfkiwl/ewok-kernel-security-OS
Ada
5,752
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.gpio; with ewok.exti; with ewok.exported.gpios; use ewok.exported.gpios; with ewok.sanitize; package body ewok.syscalls.cfg.gpio with spark_mode => off is procedure svc_gpio_set (caller_id : in ewok.tasks_shared.t_task_id; params : in out t_parameters; mode : in ewok.tasks_shared.t_task_mode) is ref : ewok.exported.gpios.t_gpio_ref with address => params(1)'address; val : unsigned_8 with address => params(2)'address; begin -- Task initialization is complete ? if not is_init_done (caller_id) then goto ret_denied; end if; -- Valid t_gpio_ref ? if not ref.pin'valid or not ref.port'valid then goto ret_inval; end if; -- Does that GPIO really belongs to the caller ? if not ewok.gpio.belong_to (caller_id, ref) then goto ret_denied; end if; -- Write the pin if val >= 1 then ewok.gpio.write_pin (ref, 1); else ewok.gpio.write_pin (ref, 0); end if; set_return_value (caller_id, mode, SYS_E_DONE); ewok.tasks.set_state (caller_id, mode, TASK_STATE_RUNNABLE); return; <<ret_inval>> set_return_value (caller_id, mode, SYS_E_INVAL); ewok.tasks.set_state (caller_id, mode, TASK_STATE_RUNNABLE); return; <<ret_denied>> set_return_value (caller_id, mode, SYS_E_DENIED); ewok.tasks.set_state (caller_id, mode, TASK_STATE_RUNNABLE); return; end svc_gpio_set; procedure svc_gpio_get (caller_id : in ewok.tasks_shared.t_task_id; params : in out t_parameters; mode : in ewok.tasks_shared.t_task_mode) is ref : ewok.exported.gpios.t_gpio_ref with address => params(1)'address; retval_address : constant system_address := params(2); begin -- Task initialization is complete ? if not is_init_done (caller_id) then goto ret_denied; end if; -- Valid t_gpio_ref ? if not ref.pin'valid or not ref.port'valid then goto ret_inval; end if; -- Does that GPIO really belongs to the caller ? if not ewok.gpio.belong_to (caller_id, ref) then goto ret_denied; end if; -- Does &val is in the caller address space ? if not ewok.sanitize.is_word_in_data_region (retval_address, caller_id, mode) then goto ret_denied; end if; declare retval : unsigned_8 with address => to_address (retval_address); begin -- Read the pin retval := unsigned_8 (ewok.gpio.read_pin (ref)); set_return_value (caller_id, mode, SYS_E_DONE); ewok.tasks.set_state (caller_id, mode, TASK_STATE_RUNNABLE); return; end; <<ret_inval>> set_return_value (caller_id, mode, SYS_E_INVAL); ewok.tasks.set_state (caller_id, mode, TASK_STATE_RUNNABLE); return; <<ret_denied>> set_return_value (caller_id, mode, SYS_E_DENIED); ewok.tasks.set_state (caller_id, mode, TASK_STATE_RUNNABLE); return; end svc_gpio_get; -- Unlock EXTI line associated to given GPIO, if the EXTI -- line has been locked by the kernel (exti lock parameter is -- set to 'true'. procedure svc_gpio_unlock_exti (caller_id : in ewok.tasks_shared.t_task_id; params : in out t_parameters; mode : in ewok.tasks_shared.t_task_mode) is ref : ewok.exported.gpios.t_gpio_ref with address => params(1)'address; cfg : ewok.exported.gpios.t_gpio_config_access; begin -- Task initialization is complete ? if not is_init_done (caller_id) then goto ret_denied; end if; -- Valid t_gpio_ref ? if not ref.pin'valid or not ref.port'valid then goto ret_inval; end if; -- Does that GPIO really belongs to the caller ? if not ewok.gpio.belong_to (caller_id, ref) then goto ret_denied; end if; cfg := ewok.gpio.get_config (ref); -- Does that GPIO has an EXTI line which is lockable ? if cfg.all.exti_trigger = GPIO_EXTI_TRIGGER_NONE or cfg.all.exti_lock = GPIO_EXTI_UNLOCKED then goto ret_inval; end if; ewok.exti.enable(ref); set_return_value (caller_id, mode, SYS_E_DONE); ewok.tasks.set_state (caller_id, mode, TASK_STATE_RUNNABLE); return; <<ret_inval>> set_return_value (caller_id, mode, SYS_E_INVAL); ewok.tasks.set_state (caller_id, mode, TASK_STATE_RUNNABLE); return; <<ret_denied>> set_return_value (caller_id, mode, SYS_E_DENIED); ewok.tasks.set_state (caller_id, mode, TASK_STATE_RUNNABLE); return; end svc_gpio_unlock_exti; end ewok.syscalls.cfg.gpio;
reznikmm/matreshka
Ada
4,436
ads
------------------------------------------------------------------------------ -- -- -- Matreshka Project -- -- -- -- Localization, Internationalization, Globalization for Ada -- -- -- -- Tools 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$ ------------------------------------------------------------------------------ -- This test detects several command line switches and computes following -- substitution variables: -- -- - PREFIX -- - BINDIR -- - LIBDIR ------------------------------------------------------------------------------ with Configure.Abstract_Tests; package Configure.Tests.Installation_Directories is type Installation_Directories_Test is new Configure.Abstract_Tests.Abstract_Test with private; overriding function Name (Self : Installation_Directories_Test) return String; -- Returns name of the test to be used in reports. overriding function Help (Self : Installation_Directories_Test) return Unbounded_String_Vector; -- Returns help information for test. overriding procedure Execute (Self : in out Installation_Directories_Test; Arguments : in out Unbounded_String_Vector); -- Executes test's actions. All used arguments must be removed from -- Arguments. private type Installation_Directories_Test is new Configure.Abstract_Tests.Abstract_Test with null record; end Configure.Tests.Installation_Directories;
godunko/adawebpack
Ada
19,434
ads
------------------------------------------------------------------------------ -- -- -- Matreshka Project -- -- -- -- Web Framework -- -- -- -- Web API Definition -- -- -- ------------------------------------------------------------------------------ -- -- -- Copyright © 2014-2021, 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: 5518 $ $Date: 2015-12-20 14:25:24 +0300 (Sun, 20 Dec 2015) $ ------------------------------------------------------------------------------ -- This package provides binding to interface Node. ------------------------------------------------------------------------------ with WASM.Objects; limited with Web.DOM.Documents; limited with Web.DOM.Elements; with Web.DOM.Event_Listeners; with Web.DOM.Event_Targets; limited with Web.HTML.Elements; with Web.Strings; package Web.DOM.Nodes is pragma Preelaborate; type Node is new WASM.Objects.Object_Reference and Web.DOM.Event_Targets.Event_Target with null record; type Node_Types is (ELEMENT_NODE, ATTRIBUTE_NODE, -- historical TEXT_NODE, CDATA_SECTION_NODE, -- historical ENTITY_REFERENCE_NODE, -- historical ENTITY_NODE, -- historical PROCESSING_INSTRUCTION_NODE, COMMENT_NODE, DOCUMENT_NODE, DOCUMENT_TYPE_NODE, DOCUMENT_FRAGMENT_NODE, NOTATION_NODE); -- historical for Node_Types'Size use Web.DOM_Unsigned_Short'Size; for Node_Types use (ELEMENT_NODE => 1, ATTRIBUTE_NODE => 2, TEXT_NODE => 3, CDATA_SECTION_NODE => 4, ENTITY_REFERENCE_NODE => 5, ENTITY_NODE => 6, PROCESSING_INSTRUCTION_NODE => 7, COMMENT_NODE => 8, DOCUMENT_NODE => 9, DOCUMENT_TYPE_NODE => 10, DOCUMENT_FRAGMENT_NODE => 11, NOTATION_NODE => 12); -- interface Node : EventTarget { -- readonly attribute DOMString nodeName; -- -- readonly attribute DOMString? baseURI; -- -- readonly attribute Node? parentNode; -- boolean hasChildNodes(); -- [SameObject] readonly attribute NodeList childNodes; -- readonly attribute Node? lastChild; -- readonly attribute Node? previousSibling; -- -- attribute DOMString? nodeValue; -- attribute DOMString? textContent; -- void normalize(); -- -- boolean isEqualNode(Node? node); -- -- const unsigned short DOCUMENT_POSITION_DISCONNECTED = 0x01; -- const unsigned short DOCUMENT_POSITION_PRECEDING = 0x02; -- const unsigned short DOCUMENT_POSITION_FOLLOWING = 0x04; -- const unsigned short DOCUMENT_POSITION_CONTAINS = 0x08; -- const unsigned short DOCUMENT_POSITION_CONTAINED_BY = 0x10; -- const unsigned short DOCUMENT_POSITION_IMPLEMENTATION_SPECIFIC = 0x20; -- unsigned short compareDocumentPosition(Node other); -- boolean contains(Node? other); -- -- DOMString? lookupPrefix(DOMString? namespace); -- DOMString? lookupNamespaceURI(DOMString? prefix); -- boolean isDefaultNamespace(DOMString? namespace); -- -- Node insertBefore(Node node, Node? child); -- Node replaceChild(Node node, Node child); -- }; --limited with WebAPI.DOM.Documents; --limited with WebAPI.DOM.Elements; --with WebAPI.DOM.Event_Targets; --limited with WebAPI.DOM.Node_Lists; -- --package WebAPI.DOM.Nodes is function Get_Node_Type (Self : Node'Class) return Web.DOM.Nodes.Node_Types; -- Returns the type of node. -- not overriding function Get_Node_Name -- (Self : not null access constant Node) return WebAPI.DOM_String is abstract -- with Import => True, -- Convention => JavaScript_Property_Getter, -- Link_Name => "nodeName"; -- -- Returns a string appropriate for the type of node, as follows: -- -- -- -- Element -- -- Its tagName attribute value. -- -- Text -- -- "#text". -- -- ProcessingInstruction -- -- Its target. -- -- Comment -- -- "#comment". -- -- Document -- -- "#document". -- -- DocumentType -- -- Its name. -- -- DocumentFragment -- -- "#document-fragment". -- -- not overriding function Get_Base_URI -- (Self : not null access constant Node) return WebAPI.DOM_String is abstract -- with Import => True, -- Convention => JavaScript_Property_Getter, -- Link_Name => "baseURI"; -- -- Returns the base URL. function Get_Owner_Document (Self : Node'Class) return Web.DOM.Documents.Document; -- Returns the node document. -- -- Returns null for documents. -- not overriding function Get_Parent_Node -- (Self : not null access constant Node) -- return WebAPI.DOM.Nodes.Node_Access is abstract -- with Import => True, -- Convention => JavaScript_Property_Getter, -- Link_Name => "parentNode"; -- -- Returns the parent. function Get_Parent_Element (Self : Node'Class) return Web.DOM.Elements.Element; -- Returns the parent element. -- not overriding function Has_Child_Nodes -- (Self : not null access constant Node) return Boolean is abstract -- with Import => True, -- Convention => JavaScript_Method, -- Link_Name => "hasChildNodes"; -- -- Returns whether node has children. -- -- not overriding function Get_Child_Nodes -- (Self : not null access constant Node) -- return WebAPI.DOM.Node_Lists.Node_List is abstract -- with Import => True, -- Convention => JavaScript_Property_Getter, -- Link_Name => "childNodes"; -- -- Returns the children. function Get_First_Child (Self : Node'Class) return Web.DOM.Nodes.Node; -- Returns the first child. -- not overriding function Get_Last_Child -- (Self : not null access constant Node) -- return WebAPI.DOM.Nodes.Node_Access is abstract -- with Import => True, -- Convention => JavaScript_Property_Getter, -- Link_Name => "lastChild"; -- -- Returns the last child. -- -- not overriding function Get_Previous_Sibling -- (Self : not null access constant Node) -- return WebAPI.DOM.Nodes.Node_Access is abstract -- with Import => True, -- Convention => JavaScript_Property_Getter, -- Link_Name => "previousSibling"; -- -- Returns the previous sibling. function Get_Next_Sibling (Self : Node'Class) return Web.DOM.Nodes.Node; -- Returns the next sibling. -- not overriding function Get_Node_Value -- (Self : not null access constant Node) return WebAPI.DOM_String is abstract -- with Import => True, -- Convention => JavaScript_Property_Getter, -- Link_Name => "nodeValue"; -- -- The nodeValue attribute must return the following, depending on the -- -- context object: -- -- -- -- Text -- -- Comment -- -- ProcessingInstruction -- -- -- -- The context object's data. -- -- -- -- Any other node -- -- -- -- Null. -- -- not overriding procedure Set_Node_Value -- (Self : not null access Node; -- To : WebAPI.DOM_String) is abstract -- with Import => True, -- Convention => JavaScript_Property_Setter, -- Link_Name => "nodeValue"; -- -- The nodeValue attribute must, on setting, if the new value is null, act -- -- as if it was the empty string instead, and then do as described below, -- -- depending on the context object: -- -- -- -- Text -- -- Comment -- -- ProcessingInstruction -- -- -- -- Replace data with node context object, offset 0, count length -- -- attribute value, and data new value. -- -- -- -- Any other node -- -- -- -- Do nothing. -- -- not overriding function Get_Text_Content -- (Self : not null access constant Node) return WebAPI.DOM_String is abstract -- with Import => True, -- Convention => JavaScript_Property_Getter, -- Link_Name => "textContent"; -- -- The textContent attribute must return the following, depending on the -- -- context object: -- -- -- -- DocumentFragment -- -- Element -- -- -- -- The concatenation of data of all the Text node descendants of the -- -- context object, in tree order. -- -- -- -- Text -- -- ProcessingInstruction -- -- Comment -- -- -- -- The context object's data. -- -- -- -- Any other node -- -- -- -- Null. -- -- not overriding procedure Set_Text_Content -- (Self : not null access Node; -- To : WebAPI.DOM_String) is abstract -- with Import => True, -- Convention => JavaScript_Property_Setter, -- Link_Name => "textContent"; -- -- The textContent attribute must, on setting, if the new value is null, -- -- act as if it was the empty string instead, and then do as described -- -- below, depending on the context object: -- -- -- -- DocumentFragment -- -- Element -- -- -- -- 1. Let node be null. -- -- -- -- 2. If new value is not the empty string, set node to a new Text node -- -- whose data is new value. -- -- -- -- 3. Replace all with node within the context object. -- -- -- -- Text -- -- ProcessingInstruction -- -- Comment -- -- -- -- Replace data with node context object, offset 0, count length -- -- attribute value, and data new value. -- -- -- -- Any other node -- -- -- -- Do nothing. -- -- not overriding procedure Normalize (Self : not null access Node) is abstract -- with Import => True, -- Convention => JavaScript_Method, -- Link_Name => "normalize"; -- -- Removes empty Text nodes and concatenates the data of remaining -- -- contiguous Text nodes into the first of their nodes. function Clone_Node (Self : Node'Class; Deep : Boolean := False) return Web.DOM.Nodes.Node; -- Returns a copy of node. If deep is true, the copy also includes the -- node's descendants. -- not overriding function Is_Equal_Node -- (Self : not null access constant Node; -- Other : access Node'Class) return Boolean is abstract -- with Import => True, -- Convention => JavaScript_Method, -- Link_Name => "isEqualNode"; -- -- Returns whether node and other have the same properties. -- -- -- XXX Not bindied yet: -- -- const unsigned short DOCUMENT_POSITION_DISCONNECTED = 0x01; -- -- const unsigned short DOCUMENT_POSITION_PRECEDING = 0x02; -- -- const unsigned short DOCUMENT_POSITION_FOLLOWING = 0x04; -- -- const unsigned short DOCUMENT_POSITION_CONTAINS = 0x08; -- -- const unsigned short DOCUMENT_POSITION_CONTAINED_BY = 0x10; -- -- const unsigned short DOCUMENT_POSITION_IMPLEMENTATION_SPECIFIC = 0x20; -- -- unsigned short compareDocumentPosition(Node other); -- -- not overriding function Contains -- (Self : not null access constant Node; -- Other : access Node'Class) return Boolean is abstract -- with Import => True, -- Convention => JavaScript_Method, -- Link_Name => "contains"; -- -- Returns true if other is an inclusive descendant of node, and false -- -- otherwise. -- -- not overriding function Lookup_Prefix -- (Self : not null access constant Node; -- Namespace_URI : WebAPI.DOM_String) return WebAPI.DOM_String is abstract -- with Import => True, -- Convention => JavaScript_Method, -- Link_Name => "lookupPrefix"; -- -- The lookupPrefix(namespace) method must run these steps: -- -- -- -- 1. If namespace is null or the empty string, return null. -- -- -- -- 2. Otherwise it depends on the context object: -- -- -- -- Element -- -- -- -- Return the result of locating a namespace prefix for the node -- -- using namespace. -- -- -- -- Document -- -- -- -- Return the result of locating a namespace prefix for its document -- -- element, if that is not null, and null otherwise. -- -- -- -- DocumentType -- -- DocumentFragment -- -- -- -- Return null. -- -- -- -- Any other node -- -- -- -- Return the result of locating a namespace prefix for its parent -- -- element, or if that is null, null. -- -- not overriding function Lookup_Namespace_URI -- (Self : not null access constant Node; -- Prefix : WebAPI.DOM_String) return WebAPI.DOM_String is abstract -- with Import => True, -- Convention => JavaScript_Method, -- Link_Name => "lookupNamespaceURI"; -- -- The lookupNamespaceURI(prefix) method must run these steps: -- -- -- -- 1. If prefix is the empty string, set it to null. -- -- -- -- 2. Return the result of running locate a namespace for the context -- -- object using prefix. -- -- not overriding function Is_Default_Namespace -- (Self : not null access constant Node; -- Namespace_URI : WebAPI.DOM_String) return Boolean is abstract -- with Import => True, -- Convention => JavaScript_Method, -- Link_Name => "isDefaultNamespace"; -- -- The isDefaultNamespace(namespace) method must run these steps: -- -- -- -- 1. If namespace is the empty string, set it to null. -- -- -- -- 2. Let defaultNamespace be the result of running locate a namespace for -- -- the context object using null. -- -- -- -- 3. Return true if defaultNamespace is the same as namespace, and false -- -- otherwise. -- -- not overriding function Insert_Before -- (Self : not null access Node; -- Node : not null access WebAPI.DOM.Nodes.Node'Class; -- Child : access WebAPI.DOM.Nodes.Node'Class) -- return WebAPI.DOM.Nodes.Node_Access is abstract -- with Import => True, -- Convention => JavaScript_Method, -- Link_Name => "insertBefore"; -- procedure Insert_Before -- (Self : not null access Node'Class; -- Node : not null access WebAPI.DOM.Nodes.Node'Class; -- Child : access WebAPI.DOM.Nodes.Node'Class) -- with Import => True, -- Convention => JavaScript_Method, -- Link_Name => "insertBefore"; -- -- The insertBefore(node, child) method must return the result of -- -- pre-inserting node into the context object before child. function Append_Child (Self : in out Node'Class; Node : Web.DOM.Nodes.Node'Class) return Web.DOM.Nodes.Node; -- The appendChild(node) method must return the result of appending node to -- the context object. procedure Append_Child (Self : in out Node'Class; Node : Web.DOM.Nodes.Node'Class); -- not overriding function Replace_Child -- (Self : not null access Node; -- Node : not null access WebAPI.DOM.Nodes.Node'Class; -- Child : not null access WebAPI.DOM.Nodes.Node'Class) -- return WebAPI.DOM.Nodes.Node_Access is abstract -- with Import => True, -- Convention => JavaScript_Method, -- Link_Name => "replaceChild"; -- procedure Replace_Child -- (Self : not null access Node'Class; -- Node : not null access WebAPI.DOM.Nodes.Node'Class; -- Child : not null access WebAPI.DOM.Nodes.Node'Class) -- with Import => True, -- Convention => JavaScript_Method, -- Link_Name => "replaceChild"; -- -- The replaceChild(node, child) method must return the result of replacing -- -- child with node within the context object. function Remove_Child (Self : in out Node'Class; Node : Web.DOM.Nodes.Node'Class) return Web.DOM.Nodes.Node; -- The removeChild(child) method must return the result of pre-removing -- child from the context object. procedure Remove_Child (Self : in out Node'Class; Node : Web.DOM.Nodes.Node'Class); overriding procedure Add_Event_Listener (Self : in out Node; Name : Web.Strings.Web_String; Callback : not null Web.DOM.Event_Listeners.Event_Listener_Access; Capture : Boolean := False); -- Additional subprograms for convenience function As_HTML_Element (Self : Node'Class) return Web.HTML.Elements.HTML_Element; end Web.DOM.Nodes;
charlesdaniels/libagar
Ada
3,700
ads
------------------------------------------------------------------------------ -- AGAR CORE LIBRARY -- -- A G A R . D S O -- -- S p e c -- ------------------------------------------------------------------------------ with Ada.Containers.Indefinite_Vectors; with Interfaces.C; with Interfaces.C.Strings; with Interfaces.C.Pointers; with System; -- -- Interface to dynamic linker facilities. -- package Agar.DSO is package C renames Interfaces.C; package CS renames Interfaces.C.Strings; type DSO is array (1 .. $SIZEOF_AG_DSO) of aliased Interfaces.Unsigned_8 with Convention => C; for DSO'Size use $SIZEOF_AG_DSO * System.Storage_Unit; type DSO_Access is access all DSO with Convention => C; subtype DSO_Not_Null_Access is not null DSO_Access; type Symbol_Access is access all System.Address with Convention => C; -- -- Load the named module into the process address space. If it already -- exists in memory, return an access to the existing object and increment -- its reference count. -- function Load (Name : in String) return DSO_Access; -- -- Decrement the reference count of the given loaded DSO, and unload the -- module from the process's address space if it reaches zero. -- function Unload (DSO : DSO_Not_Null_Access) return Boolean; -- -- Return a handle to an already loaded DSO by name. If no such module is -- loaded, return NULL. -- function Lookup (Name : in String) return DSO_Access; -- -- Acquire the mutex protecting the DSO handle. -- procedure Lock with Import, Convention => C, Link_Name => "ag_lock_dso"; procedure Unlock with Import, Convention => C, Link_Name => "ag_unlock_dso"; -- -- Scan the registered module directories for loadable shared libraries -- and return a list of String for all available modules. -- package DSO_List_Package is new Ada.Containers.Indefinite_Vectors (Index_Type => Positive, Element_Type => String); subtype DSO_List is DSO_List_Package.Vector; function Get_List return DSO_List; generic type Subprogram_Access_Type is private; function Symbol_Lookup (DSO : in DSO_Not_Null_Access; Symbol : in String) return Subprogram_Access_Type; private function AG_LoadDSO (Name : in CS.chars_ptr; Flags : C.unsigned) return DSO_Access with Import, Convention => C, Link_Name => "AG_LoadDSO"; function AG_UnloadDSO (DSO : in DSO_Not_Null_Access) return C.int with Import, Convention => C, Link_Name => "AG_UnloadDSO"; function AG_LookupDSO (Name : in CS.chars_ptr) return DSO_Access with Import, Convention => C, Link_Name => "AG_LookupDSO"; function AG_SymDSO (DSO : in DSO_Not_Null_Access; Symbol : in CS.chars_ptr; Value : in Symbol_Access) return C.int with Import, Convention => C, Link_Name => "AG_SymDSO"; type DSO_List_Entry is array (C.unsigned range <>) of aliased CS.chars_ptr with Convention => C; package DSO_List_To_Strings is new Interfaces.C.Pointers (Index => C.unsigned, Element => CS.chars_ptr, Element_Array => DSO_List_Entry, Default_Terminator => Null); function AG_GetDSOList (Count : access C.unsigned) return DSO_List_To_Strings.Pointer with Import, Convention => C, Link_Name => "AG_GetDSOList"; procedure AG_FreeDSOList (List : DSO_List_To_Strings.Pointer; Count : C.unsigned) with import, Convention => C, Link_Name => "AG_FreeDSOList"; end Agar.DSO;
AdaCore/Ada_Drivers_Library
Ada
10,141
ads
-- Copyright (c) 2013, Nordic Semiconductor ASA -- 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 Nordic Semiconductor ASA nor the names of its -- contributors may be used to endorse or promote products derived from -- this software without specific prior written permission. -- -- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" -- AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -- IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE -- DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE -- FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL -- DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR -- SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER -- CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, -- OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -- OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -- -- This spec has been automatically generated from nrf51.svd pragma Restrictions (No_Elaboration_Code); pragma Ada_2012; pragma Style_Checks (Off); with HAL; with System; package NRF_SVD.SPI is pragma Preelaborate; --------------- -- Registers -- --------------- -- Enable interrupt on READY event. type INTENSET_READY_Field is (-- Interrupt disabled. Disabled, -- Interrupt enabled. Enabled) with Size => 1; for INTENSET_READY_Field use (Disabled => 0, Enabled => 1); -- Enable interrupt on READY event. type INTENSET_READY_Field_1 is (-- Reset value for the field Intenset_Ready_Field_Reset, -- Enable interrupt on write. Set) with Size => 1; for INTENSET_READY_Field_1 use (Intenset_Ready_Field_Reset => 0, Set => 1); -- Interrupt enable set register. type INTENSET_Register is record -- unspecified Reserved_0_1 : HAL.UInt2 := 16#0#; -- Enable interrupt on READY event. READY : INTENSET_READY_Field_1 := Intenset_Ready_Field_Reset; -- unspecified Reserved_3_31 : HAL.UInt29 := 16#0#; end record with Volatile_Full_Access, Object_Size => 32, Bit_Order => System.Low_Order_First; for INTENSET_Register use record Reserved_0_1 at 0 range 0 .. 1; READY at 0 range 2 .. 2; Reserved_3_31 at 0 range 3 .. 31; end record; -- Disable interrupt on READY event. type INTENCLR_READY_Field is (-- Interrupt disabled. Disabled, -- Interrupt enabled. Enabled) with Size => 1; for INTENCLR_READY_Field use (Disabled => 0, Enabled => 1); -- Disable interrupt on READY event. type INTENCLR_READY_Field_1 is (-- Reset value for the field Intenclr_Ready_Field_Reset, -- Disable interrupt on write. Clear) with Size => 1; for INTENCLR_READY_Field_1 use (Intenclr_Ready_Field_Reset => 0, Clear => 1); -- Interrupt enable clear register. type INTENCLR_Register is record -- unspecified Reserved_0_1 : HAL.UInt2 := 16#0#; -- Disable interrupt on READY event. READY : INTENCLR_READY_Field_1 := Intenclr_Ready_Field_Reset; -- unspecified Reserved_3_31 : HAL.UInt29 := 16#0#; end record with Volatile_Full_Access, Object_Size => 32, Bit_Order => System.Low_Order_First; for INTENCLR_Register use record Reserved_0_1 at 0 range 0 .. 1; READY at 0 range 2 .. 2; Reserved_3_31 at 0 range 3 .. 31; end record; -- Enable or disable SPI. type ENABLE_ENABLE_Field is (-- Disabled SPI. Disabled, -- Enable SPI. Enabled) with Size => 3; for ENABLE_ENABLE_Field use (Disabled => 0, Enabled => 1); -- Enable SPI. type ENABLE_Register is record -- Enable or disable SPI. ENABLE : ENABLE_ENABLE_Field := NRF_SVD.SPI.Disabled; -- unspecified Reserved_3_31 : HAL.UInt29 := 16#0#; end record with Volatile_Full_Access, Object_Size => 32, Bit_Order => System.Low_Order_First; for ENABLE_Register use record ENABLE at 0 range 0 .. 2; Reserved_3_31 at 0 range 3 .. 31; end record; subtype RXD_RXD_Field is HAL.UInt8; -- RX data. type RXD_Register is record -- Read-only. *** Reading this field has side effects on other resources -- ***. RX data from last transfer. RXD : RXD_RXD_Field; -- unspecified Reserved_8_31 : HAL.UInt24; end record with Volatile_Full_Access, Object_Size => 32, Bit_Order => System.Low_Order_First; for RXD_Register use record RXD at 0 range 0 .. 7; Reserved_8_31 at 0 range 8 .. 31; end record; subtype TXD_TXD_Field is HAL.UInt8; -- TX data. type TXD_Register is record -- TX data for next transfer. TXD : TXD_TXD_Field := 16#0#; -- unspecified Reserved_8_31 : HAL.UInt24 := 16#0#; end record with Volatile_Full_Access, Object_Size => 32, Bit_Order => System.Low_Order_First; for TXD_Register use record TXD at 0 range 0 .. 7; Reserved_8_31 at 0 range 8 .. 31; end record; -- Bit order. type CONFIG_ORDER_Field is (-- Most significant bit transmitted out first. Msbfirst, -- Least significant bit transmitted out first. Lsbfirst) with Size => 1; for CONFIG_ORDER_Field use (Msbfirst => 0, Lsbfirst => 1); -- Serial clock (SCK) phase. type CONFIG_CPHA_Field is (-- Sample on leading edge of the clock. Shift serial data on trailing edge. Leading, -- Sample on trailing edge of the clock. Shift serial data on leading edge. Trailing) with Size => 1; for CONFIG_CPHA_Field use (Leading => 0, Trailing => 1); -- Serial clock (SCK) polarity. type CONFIG_CPOL_Field is (-- Active high. Activehigh, -- Active low. Activelow) with Size => 1; for CONFIG_CPOL_Field use (Activehigh => 0, Activelow => 1); -- Configuration register. type CONFIG_Register is record -- Bit order. ORDER : CONFIG_ORDER_Field := NRF_SVD.SPI.Msbfirst; -- Serial clock (SCK) phase. CPHA : CONFIG_CPHA_Field := NRF_SVD.SPI.Leading; -- Serial clock (SCK) polarity. CPOL : CONFIG_CPOL_Field := NRF_SVD.SPI.Activehigh; -- unspecified Reserved_3_31 : HAL.UInt29 := 16#0#; end record with Volatile_Full_Access, Object_Size => 32, Bit_Order => System.Low_Order_First; for CONFIG_Register use record ORDER at 0 range 0 .. 0; CPHA at 0 range 1 .. 1; CPOL at 0 range 2 .. 2; Reserved_3_31 at 0 range 3 .. 31; end record; -- Peripheral power control. type POWER_POWER_Field is (-- Module power disabled. Disabled, -- Module power enabled. Enabled) with Size => 1; for POWER_POWER_Field use (Disabled => 0, Enabled => 1); -- Peripheral power control. type POWER_Register is record -- Peripheral power control. POWER : POWER_POWER_Field := NRF_SVD.SPI.Disabled; -- unspecified Reserved_1_31 : HAL.UInt31 := 16#0#; end record with Volatile_Full_Access, Object_Size => 32, Bit_Order => System.Low_Order_First; for POWER_Register use record POWER at 0 range 0 .. 0; Reserved_1_31 at 0 range 1 .. 31; end record; ----------------- -- Peripherals -- ----------------- -- SPI master 0. type SPI_Peripheral is record -- TXD byte sent and RXD byte received. EVENTS_READY : aliased HAL.UInt32; -- Interrupt enable set register. INTENSET : aliased INTENSET_Register; -- Interrupt enable clear register. INTENCLR : aliased INTENCLR_Register; -- Enable SPI. ENABLE : aliased ENABLE_Register; -- Pin select for SCK. PSELSCK : aliased HAL.UInt32; -- Pin select for MOSI. PSELMOSI : aliased HAL.UInt32; -- Pin select for MISO. PSELMISO : aliased HAL.UInt32; -- RX data. RXD : aliased RXD_Register; -- TX data. TXD : aliased TXD_Register; -- SPI frequency FREQUENCY : aliased HAL.UInt32; -- Configuration register. CONFIG : aliased CONFIG_Register; -- Peripheral power control. POWER : aliased POWER_Register; end record with Volatile; for SPI_Peripheral use record EVENTS_READY at 16#108# range 0 .. 31; INTENSET at 16#304# range 0 .. 31; INTENCLR at 16#308# range 0 .. 31; ENABLE at 16#500# range 0 .. 31; PSELSCK at 16#508# range 0 .. 31; PSELMOSI at 16#50C# range 0 .. 31; PSELMISO at 16#510# range 0 .. 31; RXD at 16#518# range 0 .. 31; TXD at 16#51C# range 0 .. 31; FREQUENCY at 16#524# range 0 .. 31; CONFIG at 16#554# range 0 .. 31; POWER at 16#FFC# range 0 .. 31; end record; -- SPI master 0. SPI0_Periph : aliased SPI_Peripheral with Import, Address => SPI0_Base; -- SPI master 1. SPI1_Periph : aliased SPI_Peripheral with Import, Address => SPI1_Base; end NRF_SVD.SPI;
MinimSecure/unum-sdk
Ada
798
ads
-- Copyright 2014-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;
rtoal/enhanced-dining-philosophers
Ada
524
adb
------------------------------------------------------------------------------ -- protected_counters.adb -- -- Implementation of the protected counter. ------------------------------------------------------------------------------ package body Protected_Counters is protected body Counter is procedure Decrement_And_Test_If_Zero (Is_Zero: out Boolean) is begin Value := Value - 1; Is_Zero := Value = 0; end Decrement_And_Test_If_Zero; end Counter; end Protected_Counters;
stcarrez/ada-util
Ada
3,363
adb
----------------------------------------------------------------------- -- lzma_encrypt_b64 -- Compress, encrypt and encode in Base64 -- Copyright (C) 2019, 2021, 2022 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.Text_IO; with Ada.Command_Line; with Ada.Streams.Stream_IO; with Util.Streams.Files; with Util.Streams.AES; with Util.Streams.Lzma; with Util.Streams.Base64; with Util.Encoders.AES; with Util.Encoders.KDF.PBKDF2_HMAC_SHA256; procedure Lzma_Encrypt_B64 is use Util.Encoders.KDF; procedure Crypt_File (Source : in String; Destination : in String; Password : in String); procedure Crypt_File (Source : in String; Destination : in String; Password : in String) is In_Stream : aliased Util.Streams.Files.File_Stream; Out_Stream : aliased Util.Streams.Files.File_Stream; Base64 : aliased Util.Streams.Base64.Encoding_Stream; Cipher : aliased Util.Streams.AES.Encoding_Stream; Compressor : aliased Util.Streams.Lzma.Compress_Stream; Password_Key : constant Util.Encoders.Secret_Key := Util.Encoders.Create (Password); Salt : constant Util.Encoders.Secret_Key := Util.Encoders.Create ("fake-salt"); Key : Util.Encoders.Secret_Key (Length => Util.Encoders.AES.AES_256_Length); begin -- Generate a derived key from the password. PBKDF2_HMAC_SHA256 (Password => Password_Key, Salt => Salt, Counter => 20000, Result => Key); -- Setup file -> input and compress -> cipher -> base64 -> output file streams. In_Stream.Open (Ada.Streams.Stream_IO.In_File, Source); Out_Stream.Create (Mode => Ada.Streams.Stream_IO.Out_File, Name => Destination); Base64.Produces (Output => Out_Stream'Unchecked_Access, Size => 32768); Cipher.Produces (Output => Base64'Unchecked_Access, Size => 32768); Cipher.Set_Key (Secret => Key, Mode => Util.Encoders.AES.ECB); Compressor.Initialize (Output => Cipher'Unchecked_Access, Size => 4096); -- Copy input to output through the cipher. Util.Streams.Copy (From => In_Stream, Into => Compressor); end Crypt_File; begin if Ada.Command_Line.Argument_Count /= 3 then Ada.Text_IO.Put_Line ("Usage: lzma_encrypt_b64 source password destination"); return; end if; Crypt_File (Source => Ada.Command_Line.Argument (1), Destination => Ada.Command_Line.Argument (3), Password => Ada.Command_Line.Argument (2)); end Lzma_Encrypt_B64;
silky/synth
Ada
9,099
ads
-- This file is covered by the Internet Software Consortium (ISC) License -- Reference: ../License.txt -- GCC 6.0 only (skip Container_Checks until identified need arises) pragma Suppress (Tampering_Check); with Ada.Text_IO; with Ada.Calendar; with Ada.Containers.Hashed_Maps; with Ada.Containers.Ordered_Sets; with Ada.Containers.Vectors; with Ada.Characters.Latin_1; with Ada.Directories; with Ada.Exceptions; with JohnnyText; with Parameters; with Definitions; use Definitions; private with Replicant.Platform; package PortScan is package JT renames JohnnyText; package AC renames Ada.Containers; package CAL renames Ada.Calendar; package AD renames Ada.Directories; package EX renames Ada.Exceptions; package TIO renames Ada.Text_IO; package LAT renames Ada.Characters.Latin_1; package PM renames Parameters; type count_type is (total, success, failure, ignored, skipped); type dim_handlers is array (count_type) of TIO.File_Type; type port_id is private; port_match_failed : constant port_id; -- Scan the entire ports tree in order with a single, non-recursive pass -- Return True on success function scan_entire_ports_tree (portsdir : String) return Boolean; -- Starting with a single port, recurse to determine a limited but complete -- dependency tree. Repeated calls will augment already existing data. -- Return True on success function scan_single_port (catport : String; always_build : Boolean; fatal : out Boolean) return Boolean; -- This procedure causes the reverse dependencies to be calculated, and -- then the extended (recursive) reverse dependencies. The former is -- used progressively to determine when a port is free to build and the -- latter sets the build priority. procedure set_build_priority; -- Wipe out all scan data so new scan can be performed procedure reset_ports_tree; -- Returns the number of cores. The set_cores procedure must be run first. -- set_cores was private previously, but we need the information to set -- intelligent defaults for the configuration file. procedure set_cores; function cores_available return cpu_range; -- Return " (port deleted)" if the catport doesn't exist -- Return " (directory empty)" if the directory exists but has no contents -- Return " (Makefile missing)" when makefile is missing -- otherwise return blank string function obvious_problem (portsdir, catport : String) return String; private package REP renames Replicant; package PLAT renames Replicant.Platform; max_ports : constant := 32000; scan_slave : constant builders := 9; ss_base : constant String := "/SL09"; dir_ports : constant String := "/xports"; chroot : constant String := "/usr/sbin/chroot "; type port_id is range -1 .. max_ports - 1; subtype port_index is port_id range 0 .. port_id'Last; port_match_failed : constant port_id := port_id'First; -- skip "package" because every port has same dependency on ports-mgmt/pkg -- except for pkg itself. Skip "test" because these dependencies are -- not required to build packages. type dependency_type is (fetch, extract, patch, build, library, runtime); subtype LR_set is dependency_type range library .. runtime; bmake_execution : exception; pkgng_execution : exception; make_garbage : exception; nonexistent_port : exception; circular_logic : exception; seek_failure : exception; unknown_format : exception; package subqueue is new AC.Vectors (Element_Type => port_index, Index_Type => port_index); package string_crate is new AC.Vectors (Element_Type => JT.Text, Index_Type => port_index, "=" => JT.SU."="); type queue_record is record ap_index : port_index; reverse_score : port_index; end record; -- Functions for ranking_crate definitions function "<" (L, R : queue_record) return Boolean; package ranking_crate is new AC.Ordered_Sets (Element_Type => queue_record); -- Functions for portkey_crate and package_crate definitions function port_hash (key : JT.Text) return AC.Hash_Type; package portkey_crate is new AC.Hashed_Maps (Key_Type => JT.Text, Element_Type => port_index, Hash => port_hash, Equivalent_Keys => JT.equivalent); package package_crate is new AC.Hashed_Maps (Key_Type => JT.Text, Element_Type => Boolean, Hash => port_hash, Equivalent_Keys => JT.equivalent); -- Functions for block_crate definitions function block_hash (key : port_index) return AC.Hash_Type; function block_ekey (left, right : port_index) return Boolean; package block_crate is new AC.Hashed_Maps (Key_Type => port_index, Element_Type => port_index, Hash => block_hash, Equivalent_Keys => block_ekey); type port_record is record sequence_id : port_index := 0; key_cursor : portkey_crate.Cursor := portkey_crate.No_Element; jobs : builders := 1; ignore_reason : JT.Text := JT.blank; port_version : JT.Text := JT.blank; package_name : JT.Text := JT.blank; pkg_dep_query : JT.Text := JT.blank; ignored : Boolean := False; scanned : Boolean := False; rev_scanned : Boolean := False; unlist_failed : Boolean := False; work_locked : Boolean := False; scan_locked : Boolean := False; pkg_present : Boolean := False; remote_pkg : Boolean := False; never_remote : Boolean := False; deletion_due : Boolean := False; use_procfs : Boolean := False; use_linprocfs : Boolean := False; reverse_score : port_index := 0; min_librun : Natural := 0; librun : block_crate.Map; blocked_by : block_crate.Map; blocks : block_crate.Map; all_reverse : block_crate.Map; options : package_crate.Map; end record; type port_record_access is access all port_record; type dim_make_queue is array (scanners) of subqueue.Vector; type dim_progress is array (scanners) of port_index; type dim_all_ports is array (port_index) of aliased port_record; all_ports : dim_all_ports; ports_keys : portkey_crate.Map; portlist : portkey_crate.Map; make_queue : dim_make_queue; mq_progress : dim_progress := (others => 0); rank_queue : ranking_crate.Set; number_cores : cpu_range := cpu_range'First; lot_number : scanners := 1; lot_counter : port_index := 0; last_port : port_index := 0; prescanned : Boolean := False; procedure iterate_reverse_deps; procedure iterate_drill_down; procedure populate_set_depends (target : port_index; catport : String; line : JT.Text; dtype : dependency_type); procedure populate_set_options (target : port_index; line : JT.Text; on : Boolean); procedure populate_port_data (target : port_index); procedure populate_port_data_fpc (target : port_index); procedure populate_port_data_nps (target : port_index); procedure drill_down (next_target : port_index; original_target : port_index); -- subroutines for populate_port_data procedure prescan_ports_tree (portsdir : String); procedure grep_Makefile (portsdir, category : String); procedure walk_all_subdirectories (portsdir, category : String); procedure wipe_make_queue; procedure parallel_deep_scan (success : out Boolean; show_progress : Boolean); -- some helper routines function find_colon (Source : String) return Natural; function scrub_phase (Source : String) return JT.Text; function get_catport (PR : port_record) return String; function scan_progress return String; function get_max_lots return scanners; function get_pkg_name (origin : String) return String; function timestamp (hack : CAL.Time; www_format : Boolean := False) return String; function clean_up_pkgsrc_ignore_reason (dirty_string : String) return JT.Text; type dim_counters is array (count_type) of Natural; -- bulk run variables Flog : dim_handlers; start_time : CAL.Time; stop_time : CAL.Time; scan_start : CAL.Time; scan_stop : CAL.Time; bld_counter : dim_counters := (0, 0, 0, 0, 0); end PortScan;
reznikmm/matreshka
Ada
3,689
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.Svg_RadialGradient_Elements is pragma Preelaborate; type ODF_Svg_RadialGradient is limited interface and XML.DOM.Elements.DOM_Element; type ODF_Svg_RadialGradient_Access is access all ODF_Svg_RadialGradient'Class with Storage_Size => 0; end ODF.DOM.Svg_RadialGradient_Elements;
nerilex/ada-util
Ada
4,002
ads
----------------------------------------------------------------------- -- Util.Concurrent.Fifos -- Concurrent Fifo Queues -- Copyright (C) 2012 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; -- The <b>Util.Concurrent.Fifos</b> generic defines a queue of objects which -- can be shared by multiple threads. First, the queue size is configured -- by using the <b>Set_Size</b> procedure. Then, a thread can insert elements -- in the queue by using the <b>Enqueue</b> procedure. The thread will block -- if the queue is full. Another thread can use the <b>Dequeue</b> procedure -- to fetch the oldest element from the queue. The thread will block -- until an element is inserted if the queue is empty. generic type Element_Type is private; -- The default queue size. Default_Size : in Positive; -- After a dequeue, clear the element stored in the queue. Clear_On_Dequeue : in Boolean := False; package Util.Concurrent.Fifos is FOREVER : constant Duration := -1.0; -- Exception raised if the enqueue or dequeue timeout exceeded. Timeout : exception; -- Fifo of objects type Fifo is new Ada.Finalization.Limited_Controlled with private; -- Put the element in the queue. procedure Enqueue (Into : in out Fifo; Item : in Element_Type; Wait : in Duration := FOREVER); -- Get an element from the queue. -- Wait until one element gets available. procedure Dequeue (From : in out Fifo; Item : out Element_Type; Wait : in Duration := FOREVER); -- Get the number of elements in the queue. function Get_Count (From : in Fifo) return Natural; -- Set the queue size. procedure Set_Size (Into : in out Fifo; Capacity : in Positive); -- Initializes the queue. overriding procedure Initialize (Object : in out Fifo); -- Release the queue elements. overriding procedure Finalize (Object : in out Fifo); private -- To store the queue elements, we use an array which is allocated dynamically -- by the <b>Set_Size</b> protected operation. The generated code is smaller -- compared to the use of Ada vectors container. type Element_Array is array (Natural range <>) of Element_Type; type Element_Array_Access is access all Element_Array; Null_Element_Array : constant Element_Array_Access := null; -- Queue of objects. protected type Protected_Fifo is -- Put the element in the queue. -- If the queue is full, wait until some room is available. entry Enqueue (Item : in Element_Type); -- Get an element from the queue. -- Wait until one element gets available. entry Dequeue (Item : out Element_Type); -- Get the number of elements in the queue. function Get_Count return Natural; -- Set the queue size. procedure Set_Size (Capacity : in Natural); private First : Positive := 1; Last : Positive := 1; Count : Natural := 0; Elements : Element_Array_Access := Null_Element_Array; end Protected_Fifo; type Fifo is new Ada.Finalization.Limited_Controlled with record Buffer : Protected_Fifo; end record; end Util.Concurrent.Fifos;
stcarrez/ada-ado
Ada
1,177
ads
----------------------------------------------------------------------- -- ado-schemas-postgresql -- Postgresql Database Schemas -- Copyright (C) 2018 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 ADO.Connections; package ADO.Schemas.Postgresql is -- Load the database schema procedure Load_Schema (C : in ADO.Connections.Database_Connection'Class; Schema : out Schema_Definition; Database : in String); end ADO.Schemas.Postgresql;
zhmu/ananas
Ada
145
ads
package Debug7 is function Next (I : Integer) return Integer; function Renamed_Next (I : Integer) return Integer renames Next; end Debug7;
alvaromb/Compilemon
Ada
1,673
ads
-- Copyright (c) 1990 Regents of the University of California. -- All rights reserved. -- -- This software was developed by John Self of the Arcadia project -- at the University of California, Irvine. -- -- Redistribution and use in source and binary forms are permitted -- provided that the above copyright notice and this paragraph are -- duplicated in all such forms and that any documentation, -- advertising materials, and other materials related to such -- distribution and use acknowledge that the software was developed -- by the University of California, Irvine. The name of the -- University may not be used to endorse or promote products derived -- from this software without specific prior written permission. -- THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR -- IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED -- WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE. -- TITLE external_file_manager -- AUTHOR: John Self (UCI) -- DESCRIPTION opens external files for other functions -- NOTES This package opens external files, and thus may be system dependent -- because of limitations on file names. -- This version is for the VADS 5.5 Ada development system. -- $Header: /co/ua/self/arcadia/aflex/ada/src/RCS/file_managerS.a,v 1.4 90/01/12 15:20:00 self Exp Locker: self $ with text_io; use text_io; package external_file_manager is procedure GET_IO_FILE(F : in out FILE_TYPE); procedure GET_DFA_FILE(F : in out FILE_TYPE); procedure GET_SCANNER_FILE(F : in out FILE_TYPE); procedure GET_BACKTRACK_FILE(F : in out FILE_TYPE); procedure INITIALIZE_FILES; end external_file_manager;
LiberatorUSA/GUCEF
Ada
2,301
ads
with agar.gui.widget.box; with agar.gui.widget.button; package agar.gui.widget.toolbar is type type_t is (TOOLBAR_HORIZ, TOOLBAR_VERT); for type_t use (TOOLBAR_HORIZ => 0, TOOLBAR_VERT => 1); for type_t'size use c.unsigned'size; pragma convention (c, type_t); type flags_t is new c.unsigned; TOOLBAR_HOMOGENOUS : constant flags_t := 16#01#; TOOLBAR_STICKY : constant flags_t := 16#02#; TOOLBAR_MULTI_STICKY : constant flags_t := 16#04#; type toolbar_t is limited private; type toolbar_access_t is access all toolbar_t; pragma convention (c, toolbar_access_t); -- API function allocate (parent : widget_access_t; bar_type : type_t; num_rows : natural; flags : flags_t) return toolbar_access_t; pragma inline (allocate); procedure row (toolbar : toolbar_access_t; row_name : natural); pragma inline (row); procedure separator (toolbar : toolbar_access_t); pragma import (c, separator, "AG_ToolbarSeparator"); procedure bar_select (toolbar : toolbar_access_t; button : agar.gui.widget.button.button_access_t); pragma import (c, bar_select, "AG_ToolbarSelect"); procedure bar_deselect (toolbar : toolbar_access_t; button : agar.gui.widget.button.button_access_t); pragma import (c, bar_deselect, "AG_ToolbarDeselect"); procedure bar_select_only (toolbar : toolbar_access_t; button : agar.gui.widget.button.button_access_t); pragma import (c, bar_select_only, "AG_ToolbarSelectOnly"); procedure bar_select_all (toolbar : toolbar_access_t); pragma import (c, bar_select_all, "AG_ToolbarSelectAll"); procedure bar_deselect_all (toolbar : toolbar_access_t); pragma import (c, bar_deselect_all, "AG_ToolbarDeselectAll"); -- function widget (toolbar : toolbar_access_t) return widget_access_t; pragma inline (widget); private type rows_t is array (1 .. 8) of aliased agar.gui.widget.box.box_access_t; pragma convention (c, rows_t); type toolbar_t is record box : aliased agar.gui.widget.box.box_t; rows : rows_t; toolbar_type : type_t; num_rows : c.int; num_buttons : c.int; row_current : c.int; flags : flags_t; end record; pragma convention (c, toolbar_t); end agar.gui.widget.toolbar;
reznikmm/matreshka
Ada
4,011
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.Style_Ruby_Align_Attributes; package Matreshka.ODF_Style.Ruby_Align_Attributes is type Style_Ruby_Align_Attribute_Node is new Matreshka.ODF_Style.Abstract_Style_Attribute_Node and ODF.DOM.Style_Ruby_Align_Attributes.ODF_Style_Ruby_Align_Attribute with null record; overriding function Create (Parameters : not null access Matreshka.DOM_Attributes.Attribute_L2_Parameters) return Style_Ruby_Align_Attribute_Node; overriding function Get_Local_Name (Self : not null access constant Style_Ruby_Align_Attribute_Node) return League.Strings.Universal_String; end Matreshka.ODF_Style.Ruby_Align_Attributes;
reznikmm/matreshka
Ada
4,137
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_Handle_Radius_Range_Maximum_Attributes; package Matreshka.ODF_Draw.Handle_Radius_Range_Maximum_Attributes is type Draw_Handle_Radius_Range_Maximum_Attribute_Node is new Matreshka.ODF_Draw.Abstract_Draw_Attribute_Node and ODF.DOM.Draw_Handle_Radius_Range_Maximum_Attributes.ODF_Draw_Handle_Radius_Range_Maximum_Attribute with null record; overriding function Create (Parameters : not null access Matreshka.DOM_Attributes.Attribute_L2_Parameters) return Draw_Handle_Radius_Range_Maximum_Attribute_Node; overriding function Get_Local_Name (Self : not null access constant Draw_Handle_Radius_Range_Maximum_Attribute_Node) return League.Strings.Universal_String; end Matreshka.ODF_Draw.Handle_Radius_Range_Maximum_Attributes;
onox/orka
Ada
4,970
adb
-- SPDX-License-Identifier: Apache-2.0 -- -- Copyright (c) 2016 onox <[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 Orka.SIMD.AVX.Singles; with Orka.SIMD.F16C; package body Orka.Types is use SIMD.AVX.Singles; function Convert (Kind : Numeric_Type) return GL.Types.Numeric_Type is (case Kind is when UByte_Type => GL.Types.UByte_Type, when UShort_Type => GL.Types.UShort_Type, when UInt_Type => GL.Types.UInt_Type, when Byte_Type => GL.Types.Byte_Type, when Short_Type => GL.Types.Short_Type, when Int_Type => GL.Types.Int_Type, when Half_Type => GL.Types.Half_Type, when Single_Type => GL.Types.Single_Type, when Double_Type => GL.Types.Double_Type); function Convert (Kind : Index_Type) return GL.Types.Index_Type is (case Kind is when UShort_Type => GL.Types.UShort_Type, when UInt_Type => GL.Types.UInt_Type); ----------------------------------------------------------------------------- generic Size : Integer_32; type Source_Type is private; type Target_Type is private; type Source_Array_Type is array (Orka.Size range <>) of Source_Type; type Target_Array_Type is array (Orka.Size range <>) of Target_Type; with procedure Convert_Slice (Values : Source_Array_Type; Result : out Target_Array_Type); procedure Generic_Convert (Elements : Source_Array_Type; Result : out Target_Array_Type); procedure Generic_Convert (Elements : Source_Array_Type; Result : out Target_Array_Type) is Iterations : constant Orka.Size := Elements'Length / Size; Remainder : constant Orka.Size := Elements'Length rem Size; Offset : Orka.Size := Elements'First; begin -- Convert Size elements in each iteration for Index in 0 .. Iterations - 1 loop Offset := Elements'First + Index * Size; Convert_Slice (Elements (Offset .. Offset + Size - 1), Result (Offset .. Offset + Size - 1)); end loop; pragma Assert (Elements'Last - Remainder = Offset + Size - 1); -- Convert remaining elements Convert_Slice (Elements (Elements'Last - Remainder + 1 .. Elements'Last), Result (Elements'Last - Remainder + 1 .. Elements'Last)); end Generic_Convert; ----------------------------------------------------------------------------- procedure Convert_Slice (Values : Float_32_Array; Result : out Float_16_Array) is use SIMD.F16C; S : Float_32_Array (1 .. m256'Length); H : m128s; begin S (1 .. Values'Length) := Values; H := Convert_Nearest_Integer (m256 (S)); Result := Float_16_Array (H) (1 .. Values'Length); end Convert_Slice; procedure Convert_Slice (Values : Float_16_Array; Result : out Float_32_Array) is use SIMD.F16C; S : Float_16_Array (1 .. m256'Length); H : m256; begin S (1 .. Values'Length) := Values; H := Convert (m128s (S)); Result := Float_32_Array (H) (1 .. Values'Length); end Convert_Slice; procedure Convert_Single is new Generic_Convert (m256'Length, Float_32, Float_16, Float_32_Array, Float_16_Array, Convert_Slice); procedure Convert_Half is new Generic_Convert (m256'Length, Float_16, Float_32, Float_16_Array, Float_32_Array, Convert_Slice); procedure Convert (Elements : Float_32_Array; Result : out Float_16_Array) renames Convert_Single; procedure Convert (Elements : Float_16_Array; Result : out Float_32_Array) renames Convert_Half; ----------------------------------------------------------------------------- function Is_Power_Of_Two (Value : Positive) return Boolean is begin return (Unsigned_32 (Value) and Unsigned_32 (Value - 1)) = 0; end Is_Power_Of_Two; function Clamp (Value : in Source) return Target is A : constant Source := Source'Min (Source (Target'Last), Value); B : constant Source := Source'Max (Source (Target'First), A); begin return Target (B); end Clamp; function Normalize_Periodic (Value : in Source) return Target is Target_Min : constant Source := Source (Target'First); Target_Range : constant Source := Source (Target'Last - Target'First); begin return Target (Value - Target_Range * Source'Floor ((Value - Target_Min) / Target_Range)); end Normalize_Periodic; end Orka.Types;
charlie5/cBound
Ada
1,936
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_alloc_named_color_reply_t is -- Item -- type Item is record response_type : aliased Interfaces.Unsigned_8; pad0 : aliased Interfaces.Unsigned_8; sequence : aliased Interfaces.Unsigned_16; length : aliased Interfaces.Unsigned_32; pixel : aliased Interfaces.Unsigned_32; exact_red : aliased Interfaces.Unsigned_16; exact_green : aliased Interfaces.Unsigned_16; exact_blue : aliased Interfaces.Unsigned_16; visual_red : aliased Interfaces.Unsigned_16; visual_green : aliased Interfaces.Unsigned_16; visual_blue : aliased Interfaces.Unsigned_16; end record; -- Item_Array -- type Item_Array is array (Interfaces.C .size_t range <>) of aliased xcb.xcb_alloc_named_color_reply_t .Item; -- Pointer -- package C_Pointers is new Interfaces.C.Pointers (Index => Interfaces.C.size_t, Element => xcb.xcb_alloc_named_color_reply_t.Item, Element_Array => xcb.xcb_alloc_named_color_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_alloc_named_color_reply_t .Pointer; -- Pointer_Pointer -- package C_Pointer_Pointers is new Interfaces.C.Pointers (Index => Interfaces.C.size_t, Element => xcb.xcb_alloc_named_color_reply_t.Pointer, Element_Array => xcb.xcb_alloc_named_color_reply_t.Pointer_Array, Default_Terminator => null); subtype Pointer_Pointer is C_Pointer_Pointers.Pointer; end xcb.xcb_alloc_named_color_reply_t;
shintakezou/drake
Ada
1,273
adb
with Ada.Containers.Murmur_Hash_3; with Ada.Strings.Naked_Maps.Case_Folding; function Ada.Strings.Generic_Hash_Case_Insensitive (Key : String_Type) return Containers.Hash_Type is Mapping : constant not null Naked_Maps.Character_Mapping_Access := Strings.Naked_Maps.Case_Folding.Case_Folding_Map; State : Containers.Murmur_Hash_3.State := Containers.Murmur_Hash_3.Initialize (0); Count : Containers.Count_Type := 0; Result : Containers.Hash_Type; Last : Natural := Key'First - 1; begin while Last < Key'Last loop declare Code : Wide_Wide_Character; Is_Illegal_Sequence : Boolean; -- ignore begin -- get single unicode character Get ( Key (Last + 1 .. Key'Last), Last, Code, Is_Illegal_Sequence); Count := Count + 1; -- update Containers.Murmur_Hash_3.Update ( State, Containers.Hash_Type'( Wide_Wide_Character'Pos ( Strings.Naked_Maps.Value (Mapping.all, Code)))); end; end loop; Containers.Murmur_Hash_3.Update (State, Count); Containers.Murmur_Hash_3.Finalize (State, Result); return Result; end Ada.Strings.Generic_Hash_Case_Insensitive;
AdaCore/gpr
Ada
1,727
adb
-- -- Copyright (C) 2021-2023, AdaCore -- -- SPDX-License-Identifier: Apache-2.0 -- with Ada.Exceptions; with Ada.Text_IO; with GPR2.Context; with GPR2.Log; with GPR2.Path_Name; with GPR2.Project.Source.Set; with GPR2.Project.Tree; with Test; procedure Main is Tree : GPR2.Project.Tree.Object; Context : GPR2.Context.Object; Main_Found : Integer := 0; Test_Found : Integer := 0; use GPR2; procedure Print_Messages is begin if Tree.Has_Messages then for C in Tree.Log_Messages.Iterate (False, True, True, True, True) loop Ada.Text_IO.Put_Line (GPR2.Log.Element (C).Format); end loop; end if; end Print_Messages; begin Tree.Load_Autoconf (Filename => GPR2.Path_Name.Create_File (GPR2.Project.Ensure_Extension ("test.gpr"), GPR2.Path_Name.No_Resolution), Context => Context); for Prj of Tree loop for S of Prj.Sources loop if S.Path_Name.Simple_Name = "main.adb" then Main_Found := Main_Found + 1; elsif S.Path_Name.Simple_Name = "test.ads" then Test_Found := Test_Found + 1; elsif S.Path_Name.Simple_Name = "ignored.ads" then Ada.Text_IO.Put_Line ("unexpected " & String (S.Path_Name.Value) & " found"); end if; end loop; end loop; if Main_Found /= 1 then Ada.Text_IO.Put_Line ("main.adb found" & Main_Found'Img & " times"); end if; if Test_Found /= 1 then Ada.Text_IO.Put_Line ("test.ads found" & Test_Found'Img & " times"); end if; exception when E : others => Ada.Text_IO.Put_Line (Ada.Exceptions.Exception_Message (E)); Print_Messages; end Main;
persan/AdaYaml
Ada
2,054
ads
-- part of AdaYaml, (c) 2017 Felix Krause -- released under the terms of the MIT license, see the file "copying.txt" private with Text.Builder; private with Yaml.Events.Store; package Yaml.Transformator.Annotation.Concatenation is type Instance is limited new Transformator.Instance with private; overriding procedure Put (Object : in out Instance; E : Event); overriding function Has_Next (Object : Instance) return Boolean; overriding function Next (Object : in out Instance) return Event; function New_Concatenation (Pool : Text.Pool.Reference; Node_Context : Node_Context_Type; Processor_Context : Events.Context.Reference; Swallows_Previous : out Boolean) return not null Pointer; private type State_Type is not null access procedure (Object : in out Instance; E : Event); procedure Initial (Object : in out Instance; E : Event); procedure After_Annotation_Start (Object : in out Instance; E : Event); procedure After_Annotation_End (Object : in out Instance; E : Event); procedure After_List_Start (Object : in out Instance; E : Event); procedure In_Sequence (Object : in out Instance; E : Event); procedure After_Sequence (Object : in out Instance; E : Event); procedure After_String (Object : in out Instance; E : Event); procedure After_List_End (Object : in out Instance; E : Event); type Builder_Pointer is access Text.Builder.Reference; type Instance is limited new Transformator.Instance with record Node_Properties : Properties; Builder : Builder_Pointer; Context : Events.Context.Reference; Pool : Text.Pool.Reference; Depth : Natural := 0; State : State_Type := Initial'Access; Current_Exists : Boolean := False; Current : Event; Current_Aliased : Events.Store.Optional_Stream_Reference; end record; end Yaml.Transformator.Annotation.Concatenation;
reznikmm/matreshka
Ada
3,639
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.Db_Login_Elements is pragma Preelaborate; type ODF_Db_Login is limited interface and XML.DOM.Elements.DOM_Element; type ODF_Db_Login_Access is access all ODF_Db_Login'Class with Storage_Size => 0; end ODF.DOM.Db_Login_Elements;
optikos/oasis
Ada
1,827
ads
-- Copyright (c) 2019 Maxim Reznik <[email protected]> -- -- SPDX-License-Identifier: MIT -- License-Filename: LICENSE ------------------------------------------------------------- with League.Strings; with League.String_Vectors; package Meta.Classes is type Capacity_Kind is (Just_One, Zero_Or_One, Zero_Or_More, One_Or_More); type Property is record Name : League.Strings.Universal_String; Type_Name : League.Strings.Universal_String; Capacity : Capacity_Kind := Just_One; end record; type Property_Array is array (Positive range <>) of Property; type Class is tagged private; not overriding function Name (Self : Class) return League.Strings.Universal_String; not overriding function Is_Abstract (Self : Class) return Boolean; not overriding function Parents (Self : Class) return League.String_Vectors.Universal_String_Vector; not overriding function Properties (Self : Class) return Property_Array; not overriding procedure Initialize (Self : in out Class; Name : League.Strings.Universal_String; Is_Abstract : Boolean := False); not overriding procedure Add_Parent (Self : in out Class; Name : League.Strings.Universal_String); not overriding procedure Add_Property (Self : in out Class; Value : Property); generic with function Pass (Value : Property) return Boolean; function Generic_Filter (List : Property_Array) return Property_Array; private type Class is tagged record Name : League.Strings.Universal_String; Is_Abstract : Boolean; Parents : League.String_Vectors.Universal_String_Vector; Properties : Property_Array (1 .. 30); Last_Prop : Natural := 0; end record; end Meta.Classes;
zhmu/ananas
Ada
9,700
adb
------------------------------------------------------------------------------ -- -- -- GNAT RUN-TIME COMPONENTS -- -- -- -- G N A T . M B B S _ F L O A T _ R A N D O M -- -- -- -- B o d y -- -- -- -- 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. -- -- -- ------------------------------------------------------------------------------ with Ada.Calendar; package body GNAT.MBBS_Float_Random is ------------------------- -- Implementation Note -- ------------------------- -- The design of this spec is a bit awkward, as a result of Ada 95 not -- permitting in-out parameters for function formals (most naturally -- Generator values would be passed this way). In pure Ada 95, the only -- solution would be to add a self-referential component to the generator -- allowing access to the generator object from inside the function. This -- would work because the generator is limited, which prevents any copy. -- This is a bit heavy, so what we do is to use Unrestricted_Access to -- get a pointer to the state in the passed Generator. This works because -- Generator is a limited type and will thus always be passed by reference. package Calendar renames Ada.Calendar; type Pointer is access all State; ----------------------- -- Local Subprograms -- ----------------------- procedure Euclid (P, Q : Int; X, Y : out Int; GCD : out Int); function Euclid (P, Q : Int) return Int; function Square_Mod_N (X, N : Int) return Int; ------------ -- Euclid -- ------------ procedure Euclid (P, Q : Int; X, Y : out Int; GCD : out Int) is XT : Int := 1; YT : Int := 0; procedure Recur (P, Q : Int; -- a (i-1), a (i) X, Y : Int; -- x (i), y (i) XP, YP : in out Int; -- x (i-1), y (i-1) GCD : out Int); procedure Recur (P, Q : Int; X, Y : Int; XP, YP : in out Int; GCD : out Int) is Quo : Int := P / Q; -- q <-- |_ a (i-1) / a (i) _| XT : Int := X; -- x (i) YT : Int := Y; -- y (i) begin if P rem Q = 0 then -- while does not divide GCD := Q; XP := X; YP := Y; else Recur (Q, P - Q * Quo, XP - Quo * X, YP - Quo * Y, XT, YT, Quo); -- a (i) <== a (i) -- a (i+1) <-- a (i-1) - q*a (i) -- x (i+1) <-- x (i-1) - q*x (i) -- y (i+1) <-- y (i-1) - q*y (i) -- x (i) <== x (i) -- y (i) <== y (i) XP := XT; YP := YT; GCD := Quo; end if; end Recur; -- Start of processing for Euclid begin Recur (P, Q, 0, 1, XT, YT, GCD); X := XT; Y := YT; end Euclid; function Euclid (P, Q : Int) return Int is X, Y, GCD : Int; begin Euclid (P, Q, X, Y, GCD); return X; end Euclid; ----------- -- Image -- ----------- function Image (Of_State : State) return String is begin return Int'Image (Of_State.X1) & ',' & Int'Image (Of_State.X2) & ',' & Int'Image (Of_State.P) & ',' & Int'Image (Of_State.Q); end Image; ------------ -- Random -- ------------ function Random (Gen : Generator) return Uniformly_Distributed is Genp : constant Pointer := Gen.Gen_State'Unrestricted_Access; begin Genp.X1 := Square_Mod_N (Genp.X1, Genp.P); Genp.X2 := Square_Mod_N (Genp.X2, Genp.Q); return Float ((Flt (((Genp.X2 - Genp.X1) * Genp.X) mod Genp.Q) * Flt (Genp.P) + Flt (Genp.X1)) * Genp.Scl); end Random; ----------- -- Reset -- ----------- -- Version that works from given initiator value procedure Reset (Gen : Generator; Initiator : Integer) is Genp : constant Pointer := Gen.Gen_State'Unrestricted_Access; X1, X2 : Int; begin X1 := 2 + Int (Initiator) mod (K1 - 3); X2 := 2 + Int (Initiator) mod (K2 - 3); -- Eliminate effects of small initiators for J in 1 .. 5 loop X1 := Square_Mod_N (X1, K1); X2 := Square_Mod_N (X2, K2); end loop; Genp.all := (X1 => X1, X2 => X2, P => K1, Q => K2, X => 1, Scl => Scal); end Reset; -- Version that works from specific saved state procedure Reset (Gen : Generator; From_State : State) is Genp : constant Pointer := Gen.Gen_State'Unrestricted_Access; begin Genp.all := From_State; end Reset; -- Version that works from calendar procedure Reset (Gen : Generator) is Genp : constant Pointer := Gen.Gen_State'Unrestricted_Access; Now : constant Calendar.Time := Calendar.Clock; X1, X2 : Int; begin X1 := Int (Calendar.Year (Now)) * 12 * 31 + Int (Calendar.Month (Now)) * 31 + Int (Calendar.Day (Now)); X2 := Int (Calendar.Seconds (Now) * Duration (1000.0)); X1 := 2 + X1 mod (K1 - 3); X2 := 2 + X2 mod (K2 - 3); -- Eliminate visible effects of same day starts for J in 1 .. 5 loop X1 := Square_Mod_N (X1, K1); X2 := Square_Mod_N (X2, K2); end loop; Genp.all := (X1 => X1, X2 => X2, P => K1, Q => K2, X => 1, Scl => Scal); end Reset; ---------- -- Save -- ---------- procedure Save (Gen : Generator; To_State : out State) is begin To_State := Gen.Gen_State; end Save; ------------------ -- Square_Mod_N -- ------------------ function Square_Mod_N (X, N : Int) return Int is Temp : constant Flt := Flt (X) * Flt (X); Div : Int; begin Div := Int (Temp / Flt (N)); Div := Int (Temp - Flt (Div) * Flt (N)); if Div < 0 then return Div + N; else return Div; end if; end Square_Mod_N; ----------- -- Value -- ----------- function Value (Coded_State : String) return State is Last : constant Natural := Coded_State'Last; Start : Positive := Coded_State'First; Stop : Positive := Coded_State'First; Outs : State; begin while Stop <= Last and then Coded_State (Stop) /= ',' loop Stop := Stop + 1; end loop; if Stop > Last then raise Constraint_Error; end if; Outs.X1 := Int'Value (Coded_State (Start .. Stop - 1)); Start := Stop + 1; loop Stop := Stop + 1; exit when Stop > Last or else Coded_State (Stop) = ','; end loop; if Stop > Last then raise Constraint_Error; end if; Outs.X2 := Int'Value (Coded_State (Start .. Stop - 1)); Start := Stop + 1; loop Stop := Stop + 1; exit when Stop > Last or else Coded_State (Stop) = ','; end loop; if Stop > Last then raise Constraint_Error; end if; Outs.P := Int'Value (Coded_State (Start .. Stop - 1)); Outs.Q := Int'Value (Coded_State (Stop + 1 .. Last)); Outs.X := Euclid (Outs.P, Outs.Q); Outs.Scl := 1.0 / (Flt (Outs.P) * Flt (Outs.Q)); -- Now do *some* sanity checks if Outs.Q < 31 or else Outs.P < 31 or else Outs.X1 not in 2 .. Outs.P - 1 or else Outs.X2 not in 2 .. Outs.Q - 1 then raise Constraint_Error; end if; return Outs; end Value; end GNAT.MBBS_Float_Random;
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.Table_Database_Source_Table_Elements; package Matreshka.ODF_Table.Database_Source_Table_Elements is type Table_Database_Source_Table_Element_Node is new Matreshka.ODF_Table.Abstract_Table_Element_Node and ODF.DOM.Table_Database_Source_Table_Elements.ODF_Table_Database_Source_Table with null record; overriding function Create (Parameters : not null access Matreshka.DOM_Elements.Element_L2_Parameters) return Table_Database_Source_Table_Element_Node; overriding function Get_Local_Name (Self : not null access constant Table_Database_Source_Table_Element_Node) return League.Strings.Universal_String; overriding procedure Enter_Node (Self : not null access Table_Database_Source_Table_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 Table_Database_Source_Table_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 Table_Database_Source_Table_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_Table.Database_Source_Table_Elements;
sungyeon/drake
Ada
1,262
adb
with System.System_Allocators; with System.Unwind.Raising; with System.Unwind.Standard; package body System.Standard_Allocators is pragma Suppress (All_Checks); function Allocate ( Size : Storage_Elements.Storage_Count) return Address is Result : constant Address := System_Allocators.Allocate (Size); begin if Result = Null_Address then Raise_Heap_Exhausted; end if; return Result; end Allocate; procedure Free (Storage_Address : Address) is begin System_Allocators.Free (Storage_Address); end Free; function Reallocate ( Storage_Address : Address; Size : Storage_Elements.Storage_Count) return Address is Result : constant Address := System_Allocators.Reallocate (Storage_Address, Size); begin if Result = Null_Address then Raise_Heap_Exhausted; end if; return Result; end Reallocate; procedure Raise_Heap_Exhausted is Heap_Exhausted : constant String := "heap exhausted"; -- (s-memory.adb) begin Unwind.Raising.Raise_Exception_From_Here_With ( Unwind.Standard.Storage_Error'Access, Message => Heap_Exhausted); end Raise_Heap_Exhausted; end System.Standard_Allocators;
AdaCore/langkit
Ada
170
ads
package Libfoolang.Implementation.Extensions is function Literal_P_Evaluate (Node : Bare_Literal) return Big_Integer_Type; end Libfoolang.Implementation.Extensions;
reznikmm/matreshka
Ada
4,089
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.Text_Consecutive_Numbering_Attributes; package Matreshka.ODF_Text.Consecutive_Numbering_Attributes is type Text_Consecutive_Numbering_Attribute_Node is new Matreshka.ODF_Text.Abstract_Text_Attribute_Node and ODF.DOM.Text_Consecutive_Numbering_Attributes.ODF_Text_Consecutive_Numbering_Attribute with null record; overriding function Create (Parameters : not null access Matreshka.DOM_Attributes.Attribute_L2_Parameters) return Text_Consecutive_Numbering_Attribute_Node; overriding function Get_Local_Name (Self : not null access constant Text_Consecutive_Numbering_Attribute_Node) return League.Strings.Universal_String; end Matreshka.ODF_Text.Consecutive_Numbering_Attributes;
ohenley/ada-util
Ada
11,613
adb
----------------------------------------------------------------------- -- util-http-clients -- HTTP Clients -- Copyright (C) 2011, 2012, 2013, 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.Unchecked_Deallocation; with Util.Log.Loggers; package body Util.Http.Clients is Log : constant Util.Log.Loggers.Logger := Util.Log.Loggers.Create ("Util.Http.Clients"); procedure Initialize (Form : in out Form_Data; Size : in Positive) is begin Form.Buffer.Initialize (Output => null, Size => Size); Form.Initialize (Form.Buffer'Unchecked_Access); end Initialize; -- ------------------------------ -- Returns a boolean indicating whether the named response header has already -- been set. -- ------------------------------ overriding function Contains_Header (Reply : in Response; Name : in String) return Boolean is begin if Reply.Delegate = null then return False; else return Reply.Delegate.Contains_Header (Name); end if; end Contains_Header; -- ------------------------------ -- Returns the value of the specified response header as a String. If the response -- did not include a header of the specified name, this method returns null. -- If there are multiple headers with the same name, this method returns the -- first head in the request. The header name is case insensitive. You can use -- this method with any response header. -- ------------------------------ overriding function Get_Header (Reply : in Response; Name : in String) return String is begin if Reply.Delegate = null then return ""; else return Reply.Delegate.Get_Header (Name); end if; end Get_Header; -- ------------------------------ -- Sets a message header with the given name and value. If the header had already -- been set, the new value overwrites the previous one. The containsHeader -- method can be used to test for the presence of a header before setting its value. -- ------------------------------ overriding procedure Set_Header (Reply : in out Response; Name : in String; Value : in String) is begin Reply.Delegate.Set_Header (Name, Value); end Set_Header; -- ------------------------------ -- Adds a request header with the given name and value. -- This method allows request headers to have multiple values. -- ------------------------------ overriding procedure Add_Header (Reply : in out Response; Name : in String; Value : in String) is begin Reply.Delegate.Add_Header (Name, Value); end Add_Header; -- ------------------------------ -- Iterate over the response headers and executes the <b>Process</b> procedure. -- ------------------------------ overriding procedure Iterate_Headers (Reply : in Response; Process : not null access procedure (Name : in String; Value : in String)) is begin if Reply.Delegate /= null then Reply.Delegate.Iterate_Headers (Process); end if; end Iterate_Headers; -- ------------------------------ -- Get the response body as a string. -- ------------------------------ overriding function Get_Body (Reply : in Response) return String is begin if Reply.Delegate = null then return ""; else return Reply.Delegate.Get_Body; end if; end Get_Body; -- ------------------------------ -- Get the response status code. -- ------------------------------ function Get_Status (Reply : in Response) return Natural is begin return Reply.Delegate.Get_Status; end Get_Status; -- ------------------------------ -- Returns a boolean indicating whether the named response header has already -- been set. -- ------------------------------ overriding function Contains_Header (Request : in Client; Name : in String) return Boolean is begin if Request.Delegate = null then return False; else return Request.Delegate.Contains_Header (Name); end if; end Contains_Header; -- ------------------------------ -- Returns the value of the specified request header as a String. If the request -- did not include a header of the specified name, this method returns null. -- If there are multiple headers with the same name, this method returns the -- first head in the request. The header name is case insensitive. You can use -- this method with any response header. -- ------------------------------ overriding function Get_Header (Request : in Client; Name : in String) return String is begin if Request.Delegate = null then return ""; else return Request.Delegate.Get_Header (Name); end if; end Get_Header; -- ------------------------------ -- Sets a header with the given name and value. If the header had already -- been set, the new value overwrites the previous one. The containsHeader -- method can be used to test for the presence of a header before setting its value. -- ------------------------------ overriding procedure Set_Header (Request : in out Client; Name : in String; Value : in String) is begin Request.Delegate.Set_Header (Name, Value); end Set_Header; -- ------------------------------ -- Adds a header with the given name and value. -- This method allows headers to have multiple values. -- ------------------------------ overriding procedure Add_Header (Request : in out Client; Name : in String; Value : in String) is begin Request.Delegate.Add_Header (Name, Value); end Add_Header; -- ------------------------------ -- Iterate over the request headers and executes the <b>Process</b> procedure. -- ------------------------------ overriding procedure Iterate_Headers (Request : in Client; Process : not null access procedure (Name : in String; Value : in String)) is begin Request.Delegate.Iterate_Headers (Process); end Iterate_Headers; -- ------------------------------ -- Removes all headers with the given name. -- ------------------------------ procedure Remove_Header (Request : in out Client; Name : in String) is begin null; end Remove_Header; -- ------------------------------ -- Initialize the client -- ------------------------------ overriding procedure Initialize (Http : in out Client) is begin Http.Delegate := null; Http.Manager := Default_Http_Manager; if Http.Manager = null then Log.Error ("No HTTP manager was defined"); raise Program_Error with "No HTTP manager was defined."; end if; Http.Manager.Create (Http); end Initialize; overriding procedure Finalize (Http : in out Client) is procedure Free is new Ada.Unchecked_Deallocation (Http_Request'Class, Http_Request_Access); begin Free (Http.Delegate); end Finalize; -- ------------------------------ -- Execute an http GET request on the given URL. Additional request parameters, -- cookies and headers should have been set on the client object. -- ------------------------------ procedure Get (Request : in out Client; URL : in String; Reply : out Response'Class) is begin Request.Manager.Do_Get (Request, URL, Reply); end Get; -- ------------------------------ -- Execute an http POST request on the given URL. The post data is passed in <b>Data</b>. -- Additional request cookies and headers should have been set on the client object. -- ------------------------------ procedure Post (Request : in out Client; URL : in String; Data : in String; Reply : out Response'Class) is begin Request.Manager.Do_Post (Request, URL, Data, Reply); end Post; procedure Post (Request : in out Client; URL : in String; Data : in Form_Data'Class; Reply : out Response'Class) is begin Request.Manager.Do_Post (Request, URL, Util.Streams.Texts.To_String (Data.Buffer), Reply); end Post; -- ------------------------------ -- Execute an http PUT request on the given URL. The post data is passed in <b>Data</b>. -- Additional request cookies and headers should have been set on the client object. -- ------------------------------ procedure Put (Request : in out Client; URL : in String; Data : in String; Reply : out Response'Class) is begin Request.Manager.Do_Put (Request, URL, Data, Reply); end Put; -- ------------------------------ -- Execute a http DELETE request on the given URL. -- ------------------------------ procedure Delete (Request : in out Client; URL : in String; Reply : out Response'Class) is begin Request.Manager.Do_Delete (Request, URL, Reply); end Delete; -- ------------------------------ -- Set the timeout for the connection. -- ------------------------------ procedure Set_Timeout (Request : in out Client; Timeout : in Duration) is begin Request.Manager.Set_Timeout (Request, Timeout); end Set_Timeout; -- ------------------------------ -- Adds the specified cookie to the request. This method can be called multiple -- times to set more than one cookie. -- ------------------------------ procedure Add_Cookie (Http : in out Client; Cookie : in Util.Http.Cookies.Cookie) is begin null; end Add_Cookie; -- ------------------------------ -- Free the resource used by the response. -- ------------------------------ overriding procedure Finalize (Reply : in out Response) is procedure Free is new Ada.Unchecked_Deallocation (Http_Response'Class, Http_Response_Access); begin Free (Reply.Delegate); end Finalize; end Util.Http.Clients;
reznikmm/matreshka
Ada
6,538
adb
------------------------------------------------------------------------------ -- -- -- 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; with AMF.Internals.Helpers; with AMF.Internals.Tables.Utp_Attributes; with AMF.UML.Messages; with AMF.Visitors.Utp_Iterators; with AMF.Visitors.Utp_Visitors; package body AMF.Internals.Utp_Time_Out_Messages is ---------------------- -- Get_Base_Message -- ---------------------- overriding function Get_Base_Message (Self : not null access constant Utp_Time_Out_Message_Proxy) return AMF.UML.Messages.UML_Message_Access is begin return AMF.UML.Messages.UML_Message_Access (AMF.Internals.Helpers.To_Element (AMF.Internals.Tables.Utp_Attributes.Internal_Get_Base_Message (Self.Element))); end Get_Base_Message; ---------------------- -- Set_Base_Message -- ---------------------- overriding procedure Set_Base_Message (Self : not null access Utp_Time_Out_Message_Proxy; To : AMF.UML.Messages.UML_Message_Access) is begin AMF.Internals.Tables.Utp_Attributes.Internal_Set_Base_Message (Self.Element, AMF.Internals.Helpers.To_Element (AMF.Elements.Element_Access (To))); end Set_Base_Message; ------------------- -- Enter_Element -- ------------------- overriding procedure Enter_Element (Self : not null access constant Utp_Time_Out_Message_Proxy; Visitor : in out AMF.Visitors.Abstract_Visitor'Class; Control : in out AMF.Visitors.Traverse_Control) is begin if Visitor in AMF.Visitors.Utp_Visitors.Utp_Visitor'Class then AMF.Visitors.Utp_Visitors.Utp_Visitor'Class (Visitor).Enter_Time_Out_Message (AMF.Utp.Time_Out_Messages.Utp_Time_Out_Message_Access (Self), Control); end if; end Enter_Element; ------------------- -- Leave_Element -- ------------------- overriding procedure Leave_Element (Self : not null access constant Utp_Time_Out_Message_Proxy; Visitor : in out AMF.Visitors.Abstract_Visitor'Class; Control : in out AMF.Visitors.Traverse_Control) is begin if Visitor in AMF.Visitors.Utp_Visitors.Utp_Visitor'Class then AMF.Visitors.Utp_Visitors.Utp_Visitor'Class (Visitor).Leave_Time_Out_Message (AMF.Utp.Time_Out_Messages.Utp_Time_Out_Message_Access (Self), Control); end if; end Leave_Element; ------------------- -- Visit_Element -- ------------------- overriding procedure Visit_Element (Self : not null access constant Utp_Time_Out_Message_Proxy; Iterator : in out AMF.Visitors.Abstract_Iterator'Class; Visitor : in out AMF.Visitors.Abstract_Visitor'Class; Control : in out AMF.Visitors.Traverse_Control) is begin if Iterator in AMF.Visitors.Utp_Iterators.Utp_Iterator'Class then AMF.Visitors.Utp_Iterators.Utp_Iterator'Class (Iterator).Visit_Time_Out_Message (Visitor, AMF.Utp.Time_Out_Messages.Utp_Time_Out_Message_Access (Self), Control); end if; end Visit_Element; end AMF.Internals.Utp_Time_Out_Messages;
ytomino/gnat4drake
Ada
356
ads
pragma License (Unrestricted); with Ada.Text_IO; package GNAT.IO is procedure Put (Item : String) renames Ada.Text_IO.Put; procedure Put (Item : Integer); procedure Put_Line (Item : String) renames Ada.Text_IO.Put_Line; procedure New_Line (Spacing : Ada.Text_IO.Positive_Count := 1) renames Ada.Text_IO.New_Line; end GNAT.IO;
stcarrez/ada-awa
Ada
2,529
ads
----------------------------------------------------------------------- -- awa-events-queues-persistents -- Persistent event queues -- Copyright (C) 2012, 2020, 2022 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 EL.Beans; with EL.Contexts; with AWA.Events.Models; private package AWA.Events.Queues.Persistents is type Persistent_Queue (Name_Length : Natural) is limited new Queue with private; type Persistent_Queue_Access is access all Persistent_Queue'Class; -- Get the queue name. overriding function Get_Name (From : in Persistent_Queue) return String; -- Get the model queue reference object. -- Returns a null object if the queue is not persistent. overriding function Get_Queue (From : in Persistent_Queue) return Events.Models.Queue_Ref; -- Queue the event. The event is saved in the database with a relation to -- the user, the user session, the event queue and the event type. overriding procedure Enqueue (Into : in out Persistent_Queue; Event : in AWA.Events.Module_Event'Class); overriding procedure Dequeue (From : in out Persistent_Queue; Process : access procedure (Event : in Module_Event'Class)); -- Create the queue associated with the given name and configure it by using -- the configuration properties. function Create_Queue (Name : in String; Props : in EL.Beans.Param_Vectors.Vector; Context : in EL.Contexts.ELContext'Class) return Queue_Access; private type Persistent_Queue (Name_Length : Natural) is limited new Queue with record Queue : AWA.Events.Models.Queue_Ref; Server_Id : Natural := 0; Max_Batch : Positive := 1; Name : String (1 .. Name_Length); end record; end AWA.Events.Queues.Persistents;
charlie5/lace
Ada
1,839
ads
with lace.Event, lace.Observer; limited with lace.Event.Logger; package lace.Subject -- -- Provides an interface for an event subject. -- is pragma remote_Types; type Item is limited interface; type View is access all Item'Class; type Views is array (Positive range <>) of View; type fast_View is access all Item'Class with Asynchronous; type fast_Views is array (Positive range <>) of fast_View; ------------- -- Containers -- type Observer_views is array (Positive range <>) of Observer.view; ------------- -- Attributes -- function Name (Self : in Item) return Event.subject_Name is abstract; ------------ -- Observers -- procedure register (Self : access Item; the_Observer : in Observer.view; of_Kind : in Event.Kind) is abstract; procedure deregister (Self : in out Item; the_Observer : in Observer.view; of_Kind : in Event.Kind) is abstract; function Observers (Self : in Item; of_Kind : in Event.Kind) return Observer_views is abstract; function observer_Count (Self : in Item) return Natural is abstract; ------------- -- Operations -- procedure emit (Self : access Item; the_Event : in Event.item'Class := Event.null_Event) is abstract; -- -- Communication errors are ignored. function emit (Self : access Item; the_Event : in Event.item'Class := Event.null_Event) return Observer_views is abstract; -- -- Observers who cannot be communicated with are returned. ---------- -- Logging -- procedure Logger_is (Now : in Event.Logger.view); function Logger return Event.Logger.view; end lace.Subject;
procrastiraptor/euler
Ada
172
adb
with Ada.Integer_Text_IO; with Primes; procedure Euler7 is Ps: constant Primes.List := Primes.First(10_001); begin Ada.Integer_Text_IO.Put(Ps(Ps'Last)); end Euler7;
zhmu/ananas
Ada
3,764
ads
------------------------------------------------------------------------------ -- -- -- GNAT RUN-TIME COMPONENTS -- -- -- -- A D A . T E X T _ I O . D E C I M A L _ A U X -- -- -- -- S p e c -- -- -- -- Copyright (C) 1992-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 contains the implementation for Ada.Text_IO.Decimal_IO. The -- routines in this package are identical semantically to those in Decimal_IO, -- except that the default parameters have been removed because they are -- supplied explicitly by the calls from within these units, and there is an -- additional Scale parameter giving the value of Num'Scale. In addition the -- Get routines return the value rather than store it in an Out parameter. private generic type Int is range <>; with function Scan (Str : String; Ptr : not null access Integer; Max : Integer; Scale : Integer) return Int; with procedure Set_Image (V : Int; S : in out String; P : in out Natural; Scale : Integer; Fore : Natural; Aft : Natural; Exp : Natural); package Ada.Text_IO.Decimal_Aux is function Get (File : File_Type; Width : Field; Scale : Integer) return Int; procedure Put (File : File_Type; Item : Int; Fore : Field; Aft : Field; Exp : Field; Scale : Integer); function Gets (From : String; Last : out Positive; Scale : Integer) return Int; procedure Puts (To : out String; Item : Int; Aft : Field; Exp : Field; Scale : Integer); end Ada.Text_IO.Decimal_Aux;
RREE/ada-util
Ada
12,045
ads
----------------------------------------------------------------------- -- util-serialize-io-xml -- XML Serialization Driver -- Copyright (C) 2011, 2012, 2016, 2017, 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 Sax.Exceptions; with Sax.Locators; with Sax.Readers; with Sax.Attributes; with Unicode.CES; with Input_Sources; with Ada.Streams; with Ada.Strings.Unbounded; with Util.Streams.Buffered; with Util.Streams.Texts; package Util.Serialize.IO.XML is Parse_Error : exception; type Parser is new Serialize.IO.Parser with private; -- Parse the stream using the JSON parser. procedure Parse (Handler : in out Parser; Stream : in out Util.Streams.Buffered.Input_Buffer_Stream'Class; Sink : in out Reader'Class); -- Set the XHTML reader to ignore or not the white spaces. -- When set to True, the ignorable white spaces will not be kept. procedure Set_Ignore_White_Spaces (Reader : in out Parser; Value : in Boolean); -- Set the XHTML reader to ignore empty lines. procedure Set_Ignore_Empty_Lines (Reader : in out Parser; Value : in Boolean); -- Get the current location (file and line) to report an error message. function Get_Location (Handler : in Parser) return String; type Xhtml_Reader is new Sax.Readers.Reader with private; -- ------------------------------ -- XML Output Stream -- ------------------------------ -- The <b>Output_Stream</b> provides methods for creating an XML output stream. -- The stream object takes care of the XML escape rules. type Output_Stream is limited new Util.Serialize.IO.Output_Stream with private; -- Set the target output stream. procedure Initialize (Stream : in out Output_Stream; Output : in Util.Streams.Texts.Print_Stream_Access); -- Flush the buffer (if any) to the sink. overriding procedure Flush (Stream : in out Output_Stream); -- Close the sink. overriding procedure Close (Stream : in out Output_Stream); -- Write the buffer array to the output stream. overriding procedure Write (Stream : in out Output_Stream; Buffer : in Ada.Streams.Stream_Element_Array); -- Write a character on the response stream and escape that character as necessary. procedure Write_Escape (Stream : in out Output_Stream'Class; Char : in Wide_Wide_Character); -- Write the value as a XML string. Special characters are escaped using the XML -- escape rules. procedure Write_String (Stream : in out Output_Stream; Value : in String); -- Write the value as a XML string. Special characters are escaped using the XML -- escape rules. procedure Write_Wide_String (Stream : in out Output_Stream; Value : in Wide_Wide_String); -- Write the value as a XML string. Special characters are escaped using the XML -- escape rules. procedure Write_String (Stream : in out Output_Stream; Value : in Util.Beans.Objects.Object); -- Start a new XML object. procedure Start_Entity (Stream : in out Output_Stream; Name : in String); -- Terminates the current XML object. procedure End_Entity (Stream : in out Output_Stream; Name : in String); -- Write the attribute name/value pair. overriding procedure Write_Attribute (Stream : in out Output_Stream; Name : in String; Value : in String); overriding procedure Write_Wide_Attribute (Stream : in out Output_Stream; Name : in String; Value : in Wide_Wide_String); overriding procedure Write_Attribute (Stream : in out Output_Stream; Name : in String; Value : in Integer); overriding procedure Write_Attribute (Stream : in out Output_Stream; Name : in String; Value : in Boolean); -- Write a XML name/value attribute. procedure Write_Attribute (Stream : in out Output_Stream; Name : in String; Value : in Util.Beans.Objects.Object); -- Write the attribute with a null value. overriding procedure Write_Null_Attribute (Stream : in out Output_Stream; Name : in String); -- Write the entity value. overriding procedure Write_Entity (Stream : in out Output_Stream; Name : in String; Value : in String); overriding procedure Write_Wide_Entity (Stream : in out Output_Stream; Name : in String; Value : in Wide_Wide_String); overriding procedure Write_Entity (Stream : in out Output_Stream; Name : in String; Value : in Boolean); overriding procedure Write_Entity (Stream : in out Output_Stream; Name : in String; Value : in Integer); overriding procedure Write_Entity (Stream : in out Output_Stream; Name : in String; Value : in Ada.Calendar.Time); overriding procedure Write_Long_Entity (Stream : in out Output_Stream; Name : in String; Value : in Long_Long_Integer); overriding procedure Write_Enum_Entity (Stream : in out Output_Stream; Name : in String; Value : in String); -- Write a XML name/value entity (see Write_Attribute). overriding procedure Write_Entity (Stream : in out Output_Stream; Name : in String; Value : in Util.Beans.Objects.Object); -- Write an entity with a null value. overriding procedure Write_Null_Entity (Stream : in out Output_Stream; Name : in String); -- Starts a XML array. overriding procedure Start_Array (Stream : in out Output_Stream; Name : in String); -- Terminates a XML array. overriding procedure End_Array (Stream : in out Output_Stream; Name : in String); -- Return the location where the exception was raised. function Get_Location (Except : Sax.Exceptions.Sax_Parse_Exception'Class) return String; private overriding procedure Warning (Handler : in out Xhtml_Reader; Except : in Sax.Exceptions.Sax_Parse_Exception'Class); overriding procedure Error (Handler : in out Xhtml_Reader; Except : in Sax.Exceptions.Sax_Parse_Exception'Class); overriding procedure Fatal_Error (Handler : in out Xhtml_Reader; Except : in Sax.Exceptions.Sax_Parse_Exception'Class); overriding procedure Set_Document_Locator (Handler : in out Xhtml_Reader; Loc : in out Sax.Locators.Locator); overriding procedure Start_Document (Handler : in out Xhtml_Reader); overriding procedure End_Document (Handler : in out Xhtml_Reader); overriding procedure Start_Prefix_Mapping (Handler : in out Xhtml_Reader; Prefix : in Unicode.CES.Byte_Sequence; URI : in Unicode.CES.Byte_Sequence); overriding procedure End_Prefix_Mapping (Handler : in out Xhtml_Reader; Prefix : in Unicode.CES.Byte_Sequence); overriding procedure Start_Element (Handler : in out Xhtml_Reader; Namespace_URI : in Unicode.CES.Byte_Sequence := ""; Local_Name : in Unicode.CES.Byte_Sequence := ""; Qname : in Unicode.CES.Byte_Sequence := ""; Atts : in Sax.Attributes.Attributes'Class); overriding procedure End_Element (Handler : in out Xhtml_Reader; Namespace_URI : in Unicode.CES.Byte_Sequence := ""; Local_Name : in Unicode.CES.Byte_Sequence := ""; Qname : in Unicode.CES.Byte_Sequence := ""); overriding procedure Characters (Handler : in out Xhtml_Reader; Ch : in Unicode.CES.Byte_Sequence); overriding procedure Ignorable_Whitespace (Handler : in out Xhtml_Reader; Ch : in Unicode.CES.Byte_Sequence); overriding procedure Processing_Instruction (Handler : in out Xhtml_Reader; Target : in Unicode.CES.Byte_Sequence; Data : in Unicode.CES.Byte_Sequence); overriding procedure Skipped_Entity (Handler : in out Xhtml_Reader; Name : in Unicode.CES.Byte_Sequence); overriding procedure Start_Cdata (Handler : in out Xhtml_Reader); overriding procedure End_Cdata (Handler : in out Xhtml_Reader); overriding function Resolve_Entity (Handler : Xhtml_Reader; Public_Id : Unicode.CES.Byte_Sequence; System_Id : Unicode.CES.Byte_Sequence) return Input_Sources.Input_Source_Access; overriding procedure Start_DTD (Handler : in out Xhtml_Reader; Name : Unicode.CES.Byte_Sequence; Public_Id : Unicode.CES.Byte_Sequence := ""; System_Id : Unicode.CES.Byte_Sequence := ""); procedure Collect_Text (Handler : in out Xhtml_Reader; Content : Unicode.CES.Byte_Sequence); type Xhtml_Reader is new Sax.Readers.Reader with record Stack_Pos : Natural := 0; Handler : access Parser'Class; Text : Ada.Strings.Unbounded.Unbounded_String; -- Whether white spaces can be ignored. Ignore_White_Spaces : Boolean := True; -- Whether empty lines should be ignored (when white spaces are kept). Ignore_Empty_Lines : Boolean := True; Sink : access Reader'Class; end record; type Parser is new Util.Serialize.IO.Parser with record -- The SAX locator to find the current file and line number. Locator : Sax.Locators.Locator; Has_Pending_Char : Boolean := False; Pending_Char : Character; -- Whether white spaces can be ignored. Ignore_White_Spaces : Boolean := True; -- Whether empty lines should be ignored (when white spaces are kept). Ignore_Empty_Lines : Boolean := True; end record; type Output_Stream is limited new Util.Serialize.IO.Output_Stream with record Close_Start : Boolean := False; Stream : Util.Streams.Texts.Print_Stream_Access; end record; end Util.Serialize.IO.XML;
reznikmm/matreshka
Ada
51,604
adb
------------------------------------------------------------------------------ -- -- -- 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; with AMF.Internals.Element_Collections; with AMF.Internals.Helpers; with AMF.Internals.Tables.OCL_Attributes; with AMF.String_Collections; with AMF.UML.Classifier_Template_Parameters; with AMF.UML.Classifiers.Collections; with AMF.UML.Collaboration_Uses.Collections; with AMF.UML.Comments.Collections; with AMF.UML.Constraints.Collections; with AMF.UML.Dependencies.Collections; with AMF.UML.Element_Imports.Collections; with AMF.UML.Elements.Collections; with AMF.UML.Features.Collections; with AMF.UML.Generalization_Sets.Collections; with AMF.UML.Generalizations.Collections; with AMF.UML.Named_Elements.Collections; with AMF.UML.Namespaces.Collections; with AMF.UML.Operations.Collections; with AMF.UML.Package_Imports.Collections; with AMF.UML.Packageable_Elements.Collections; with AMF.UML.Packages.Collections; with AMF.UML.Parameterable_Elements.Collections; with AMF.UML.Properties.Collections; with AMF.UML.Redefinable_Elements.Collections; with AMF.UML.Redefinable_Template_Signatures; with AMF.UML.String_Expressions; with AMF.UML.Substitutions.Collections; with AMF.UML.Template_Bindings.Collections; with AMF.UML.Template_Parameters; with AMF.UML.Template_Signatures; with AMF.UML.Types; with AMF.UML.Use_Cases.Collections; with AMF.Visitors.OCL_Iterators; with AMF.Visitors.OCL_Visitors; with League.Strings.Internals; with Matreshka.Internals.Strings; package body AMF.Internals.OCL_Tuple_Types is ------------------------- -- Get_Owned_Attribute -- ------------------------- overriding function Get_Owned_Attribute (Self : not null access constant OCL_Tuple_Type_Proxy) return AMF.UML.Properties.Collections.Ordered_Set_Of_UML_Property is begin return AMF.UML.Properties.Collections.Wrap (AMF.Internals.Element_Collections.Wrap (AMF.Internals.Tables.OCL_Attributes.Internal_Get_Owned_Attribute (Self.Element))); end Get_Owned_Attribute; ------------------------- -- Get_Owned_Operation -- ------------------------- overriding function Get_Owned_Operation (Self : not null access constant OCL_Tuple_Type_Proxy) return AMF.UML.Operations.Collections.Ordered_Set_Of_UML_Operation is begin return AMF.UML.Operations.Collections.Wrap (AMF.Internals.Element_Collections.Wrap (AMF.Internals.Tables.OCL_Attributes.Internal_Get_Owned_Operation (Self.Element))); end Get_Owned_Operation; ------------------- -- Get_Attribute -- ------------------- overriding function Get_Attribute (Self : not null access constant OCL_Tuple_Type_Proxy) return AMF.UML.Properties.Collections.Set_Of_UML_Property is begin return AMF.UML.Properties.Collections.Wrap (AMF.Internals.Element_Collections.Wrap (AMF.Internals.Tables.OCL_Attributes.Internal_Get_Attribute (Self.Element))); end Get_Attribute; --------------------------- -- Get_Collaboration_Use -- --------------------------- overriding function Get_Collaboration_Use (Self : not null access constant OCL_Tuple_Type_Proxy) return AMF.UML.Collaboration_Uses.Collections.Set_Of_UML_Collaboration_Use is begin return AMF.UML.Collaboration_Uses.Collections.Wrap (AMF.Internals.Element_Collections.Wrap (AMF.Internals.Tables.OCL_Attributes.Internal_Get_Collaboration_Use (Self.Element))); end Get_Collaboration_Use; ----------------- -- Get_Feature -- ----------------- overriding function Get_Feature (Self : not null access constant OCL_Tuple_Type_Proxy) return AMF.UML.Features.Collections.Set_Of_UML_Feature is begin return AMF.UML.Features.Collections.Wrap (AMF.Internals.Element_Collections.Wrap (AMF.Internals.Tables.OCL_Attributes.Internal_Get_Feature (Self.Element))); end Get_Feature; ----------------- -- Get_General -- ----------------- overriding function Get_General (Self : not null access constant OCL_Tuple_Type_Proxy) return AMF.UML.Classifiers.Collections.Set_Of_UML_Classifier is begin return AMF.UML.Classifiers.Collections.Wrap (AMF.Internals.Element_Collections.Wrap (AMF.Internals.Tables.OCL_Attributes.Internal_Get_General (Self.Element))); end Get_General; ------------------------ -- Get_Generalization -- ------------------------ overriding function Get_Generalization (Self : not null access constant OCL_Tuple_Type_Proxy) return AMF.UML.Generalizations.Collections.Set_Of_UML_Generalization is begin return AMF.UML.Generalizations.Collections.Wrap (AMF.Internals.Element_Collections.Wrap (AMF.Internals.Tables.OCL_Attributes.Internal_Get_Generalization (Self.Element))); end Get_Generalization; -------------------------- -- Get_Inherited_Member -- -------------------------- overriding function Get_Inherited_Member (Self : not null access constant OCL_Tuple_Type_Proxy) return AMF.UML.Named_Elements.Collections.Set_Of_UML_Named_Element is begin return AMF.UML.Named_Elements.Collections.Wrap (AMF.Internals.Element_Collections.Wrap (AMF.Internals.Tables.OCL_Attributes.Internal_Get_Inherited_Member (Self.Element))); end Get_Inherited_Member; --------------------- -- Get_Is_Abstract -- --------------------- overriding function Get_Is_Abstract (Self : not null access constant OCL_Tuple_Type_Proxy) return Boolean is begin return AMF.Internals.Tables.OCL_Attributes.Internal_Get_Is_Abstract (Self.Element); end Get_Is_Abstract; --------------------- -- Set_Is_Abstract -- --------------------- overriding procedure Set_Is_Abstract (Self : not null access OCL_Tuple_Type_Proxy; To : Boolean) is begin AMF.Internals.Tables.OCL_Attributes.Internal_Set_Is_Abstract (Self.Element, To); end Set_Is_Abstract; --------------------------------- -- Get_Is_Final_Specialization -- --------------------------------- overriding function Get_Is_Final_Specialization (Self : not null access constant OCL_Tuple_Type_Proxy) return Boolean is begin return AMF.Internals.Tables.OCL_Attributes.Internal_Get_Is_Final_Specialization (Self.Element); end Get_Is_Final_Specialization; --------------------------------- -- Set_Is_Final_Specialization -- --------------------------------- overriding procedure Set_Is_Final_Specialization (Self : not null access OCL_Tuple_Type_Proxy; To : Boolean) is begin AMF.Internals.Tables.OCL_Attributes.Internal_Set_Is_Final_Specialization (Self.Element, To); end Set_Is_Final_Specialization; ---------------------------------- -- Get_Owned_Template_Signature -- ---------------------------------- overriding function Get_Owned_Template_Signature (Self : not null access constant OCL_Tuple_Type_Proxy) return AMF.UML.Redefinable_Template_Signatures.UML_Redefinable_Template_Signature_Access is begin return AMF.UML.Redefinable_Template_Signatures.UML_Redefinable_Template_Signature_Access (AMF.Internals.Helpers.To_Element (AMF.Internals.Tables.OCL_Attributes.Internal_Get_Owned_Template_Signature (Self.Element))); end Get_Owned_Template_Signature; ---------------------------------- -- Set_Owned_Template_Signature -- ---------------------------------- overriding procedure Set_Owned_Template_Signature (Self : not null access OCL_Tuple_Type_Proxy; To : AMF.UML.Redefinable_Template_Signatures.UML_Redefinable_Template_Signature_Access) is begin AMF.Internals.Tables.OCL_Attributes.Internal_Set_Owned_Template_Signature (Self.Element, AMF.Internals.Helpers.To_Element (AMF.Elements.Element_Access (To))); end Set_Owned_Template_Signature; ------------------------ -- Get_Owned_Use_Case -- ------------------------ overriding function Get_Owned_Use_Case (Self : not null access constant OCL_Tuple_Type_Proxy) return AMF.UML.Use_Cases.Collections.Set_Of_UML_Use_Case is begin return AMF.UML.Use_Cases.Collections.Wrap (AMF.Internals.Element_Collections.Wrap (AMF.Internals.Tables.OCL_Attributes.Internal_Get_Owned_Use_Case (Self.Element))); end Get_Owned_Use_Case; -------------------------- -- Get_Powertype_Extent -- -------------------------- overriding function Get_Powertype_Extent (Self : not null access constant OCL_Tuple_Type_Proxy) return AMF.UML.Generalization_Sets.Collections.Set_Of_UML_Generalization_Set is begin return AMF.UML.Generalization_Sets.Collections.Wrap (AMF.Internals.Element_Collections.Wrap (AMF.Internals.Tables.OCL_Attributes.Internal_Get_Powertype_Extent (Self.Element))); end Get_Powertype_Extent; ------------------------------ -- Get_Redefined_Classifier -- ------------------------------ overriding function Get_Redefined_Classifier (Self : not null access constant OCL_Tuple_Type_Proxy) return AMF.UML.Classifiers.Collections.Set_Of_UML_Classifier is begin return AMF.UML.Classifiers.Collections.Wrap (AMF.Internals.Element_Collections.Wrap (AMF.Internals.Tables.OCL_Attributes.Internal_Get_Redefined_Classifier (Self.Element))); end Get_Redefined_Classifier; ------------------------ -- Get_Representation -- ------------------------ overriding function Get_Representation (Self : not null access constant OCL_Tuple_Type_Proxy) return AMF.UML.Collaboration_Uses.UML_Collaboration_Use_Access is begin return AMF.UML.Collaboration_Uses.UML_Collaboration_Use_Access (AMF.Internals.Helpers.To_Element (AMF.Internals.Tables.OCL_Attributes.Internal_Get_Representation (Self.Element))); end Get_Representation; ------------------------ -- Set_Representation -- ------------------------ overriding procedure Set_Representation (Self : not null access OCL_Tuple_Type_Proxy; To : AMF.UML.Collaboration_Uses.UML_Collaboration_Use_Access) is begin AMF.Internals.Tables.OCL_Attributes.Internal_Set_Representation (Self.Element, AMF.Internals.Helpers.To_Element (AMF.Elements.Element_Access (To))); end Set_Representation; ---------------------- -- Get_Substitution -- ---------------------- overriding function Get_Substitution (Self : not null access constant OCL_Tuple_Type_Proxy) return AMF.UML.Substitutions.Collections.Set_Of_UML_Substitution is begin return AMF.UML.Substitutions.Collections.Wrap (AMF.Internals.Element_Collections.Wrap (AMF.Internals.Tables.OCL_Attributes.Internal_Get_Substitution (Self.Element))); end Get_Substitution; ---------------------------- -- Get_Template_Parameter -- ---------------------------- overriding function Get_Template_Parameter (Self : not null access constant OCL_Tuple_Type_Proxy) return AMF.UML.Classifier_Template_Parameters.UML_Classifier_Template_Parameter_Access is begin return AMF.UML.Classifier_Template_Parameters.UML_Classifier_Template_Parameter_Access (AMF.Internals.Helpers.To_Element (AMF.Internals.Tables.OCL_Attributes.Internal_Get_Template_Parameter (Self.Element))); end Get_Template_Parameter; ---------------------------- -- Set_Template_Parameter -- ---------------------------- overriding procedure Set_Template_Parameter (Self : not null access OCL_Tuple_Type_Proxy; To : AMF.UML.Classifier_Template_Parameters.UML_Classifier_Template_Parameter_Access) is begin AMF.Internals.Tables.OCL_Attributes.Internal_Set_Template_Parameter (Self.Element, AMF.Internals.Helpers.To_Element (AMF.Elements.Element_Access (To))); end Set_Template_Parameter; ------------------ -- Get_Use_Case -- ------------------ overriding function Get_Use_Case (Self : not null access constant OCL_Tuple_Type_Proxy) return AMF.UML.Use_Cases.Collections.Set_Of_UML_Use_Case is begin return AMF.UML.Use_Cases.Collections.Wrap (AMF.Internals.Element_Collections.Wrap (AMF.Internals.Tables.OCL_Attributes.Internal_Get_Use_Case (Self.Element))); end Get_Use_Case; ------------------------ -- Get_Element_Import -- ------------------------ overriding function Get_Element_Import (Self : not null access constant OCL_Tuple_Type_Proxy) return AMF.UML.Element_Imports.Collections.Set_Of_UML_Element_Import is begin return AMF.UML.Element_Imports.Collections.Wrap (AMF.Internals.Element_Collections.Wrap (AMF.Internals.Tables.OCL_Attributes.Internal_Get_Element_Import (Self.Element))); end Get_Element_Import; ------------------------- -- Get_Imported_Member -- ------------------------- overriding function Get_Imported_Member (Self : not null access constant OCL_Tuple_Type_Proxy) return AMF.UML.Packageable_Elements.Collections.Set_Of_UML_Packageable_Element is begin return AMF.UML.Packageable_Elements.Collections.Wrap (AMF.Internals.Element_Collections.Wrap (AMF.Internals.Tables.OCL_Attributes.Internal_Get_Imported_Member (Self.Element))); end Get_Imported_Member; ---------------- -- Get_Member -- ---------------- overriding function Get_Member (Self : not null access constant OCL_Tuple_Type_Proxy) return AMF.UML.Named_Elements.Collections.Set_Of_UML_Named_Element is begin return AMF.UML.Named_Elements.Collections.Wrap (AMF.Internals.Element_Collections.Wrap (AMF.Internals.Tables.OCL_Attributes.Internal_Get_Member (Self.Element))); end Get_Member; ---------------------- -- Get_Owned_Member -- ---------------------- overriding function Get_Owned_Member (Self : not null access constant OCL_Tuple_Type_Proxy) return AMF.UML.Named_Elements.Collections.Set_Of_UML_Named_Element is begin return AMF.UML.Named_Elements.Collections.Wrap (AMF.Internals.Element_Collections.Wrap (AMF.Internals.Tables.OCL_Attributes.Internal_Get_Owned_Member (Self.Element))); end Get_Owned_Member; -------------------- -- Get_Owned_Rule -- -------------------- overriding function Get_Owned_Rule (Self : not null access constant OCL_Tuple_Type_Proxy) return AMF.UML.Constraints.Collections.Set_Of_UML_Constraint is begin return AMF.UML.Constraints.Collections.Wrap (AMF.Internals.Element_Collections.Wrap (AMF.Internals.Tables.OCL_Attributes.Internal_Get_Owned_Rule (Self.Element))); end Get_Owned_Rule; ------------------------ -- Get_Package_Import -- ------------------------ overriding function Get_Package_Import (Self : not null access constant OCL_Tuple_Type_Proxy) return AMF.UML.Package_Imports.Collections.Set_Of_UML_Package_Import is begin return AMF.UML.Package_Imports.Collections.Wrap (AMF.Internals.Element_Collections.Wrap (AMF.Internals.Tables.OCL_Attributes.Internal_Get_Package_Import (Self.Element))); end Get_Package_Import; --------------------------- -- Get_Client_Dependency -- --------------------------- overriding function Get_Client_Dependency (Self : not null access constant OCL_Tuple_Type_Proxy) return AMF.UML.Dependencies.Collections.Set_Of_UML_Dependency is begin return AMF.UML.Dependencies.Collections.Wrap (AMF.Internals.Element_Collections.Wrap (AMF.Internals.Tables.OCL_Attributes.Internal_Get_Client_Dependency (Self.Element))); end Get_Client_Dependency; -------------- -- Get_Name -- -------------- overriding function Get_Name (Self : not null access constant OCL_Tuple_Type_Proxy) return AMF.Optional_String is begin declare use type Matreshka.Internals.Strings.Shared_String_Access; Aux : constant Matreshka.Internals.Strings.Shared_String_Access := AMF.Internals.Tables.OCL_Attributes.Internal_Get_Name (Self.Element); begin if Aux = null then return (Is_Empty => True); else return (False, League.Strings.Internals.Create (Aux)); end if; end; end Get_Name; -------------- -- Set_Name -- -------------- overriding procedure Set_Name (Self : not null access OCL_Tuple_Type_Proxy; To : AMF.Optional_String) is begin if To.Is_Empty then AMF.Internals.Tables.OCL_Attributes.Internal_Set_Name (Self.Element, null); else AMF.Internals.Tables.OCL_Attributes.Internal_Set_Name (Self.Element, League.Strings.Internals.Internal (To.Value)); end if; end Set_Name; ------------------------- -- Get_Name_Expression -- ------------------------- overriding function Get_Name_Expression (Self : not null access constant OCL_Tuple_Type_Proxy) return AMF.UML.String_Expressions.UML_String_Expression_Access is begin return AMF.UML.String_Expressions.UML_String_Expression_Access (AMF.Internals.Helpers.To_Element (AMF.Internals.Tables.OCL_Attributes.Internal_Get_Name_Expression (Self.Element))); end Get_Name_Expression; ------------------------- -- Set_Name_Expression -- ------------------------- overriding procedure Set_Name_Expression (Self : not null access OCL_Tuple_Type_Proxy; To : AMF.UML.String_Expressions.UML_String_Expression_Access) is begin AMF.Internals.Tables.OCL_Attributes.Internal_Set_Name_Expression (Self.Element, AMF.Internals.Helpers.To_Element (AMF.Elements.Element_Access (To))); end Set_Name_Expression; ------------------- -- Get_Namespace -- ------------------- overriding function Get_Namespace (Self : not null access constant OCL_Tuple_Type_Proxy) return AMF.UML.Namespaces.UML_Namespace_Access is begin return AMF.UML.Namespaces.UML_Namespace_Access (AMF.Internals.Helpers.To_Element (AMF.Internals.Tables.OCL_Attributes.Internal_Get_Namespace (Self.Element))); end Get_Namespace; ------------------------ -- Get_Qualified_Name -- ------------------------ overriding function Get_Qualified_Name (Self : not null access constant OCL_Tuple_Type_Proxy) return AMF.Optional_String is begin declare use type Matreshka.Internals.Strings.Shared_String_Access; Aux : constant Matreshka.Internals.Strings.Shared_String_Access := AMF.Internals.Tables.OCL_Attributes.Internal_Get_Qualified_Name (Self.Element); begin if Aux = null then return (Is_Empty => True); else return (False, League.Strings.Internals.Create (Aux)); end if; end; end Get_Qualified_Name; -------------------- -- Get_Visibility -- -------------------- overriding function Get_Visibility (Self : not null access constant OCL_Tuple_Type_Proxy) return AMF.UML.Optional_UML_Visibility_Kind is begin return AMF.Internals.Tables.OCL_Attributes.Internal_Get_Visibility (Self.Element); end Get_Visibility; -------------------- -- Set_Visibility -- -------------------- overriding procedure Set_Visibility (Self : not null access OCL_Tuple_Type_Proxy; To : AMF.UML.Optional_UML_Visibility_Kind) is begin AMF.Internals.Tables.OCL_Attributes.Internal_Set_Visibility (Self.Element, To); end Set_Visibility; ----------------------- -- Get_Owned_Comment -- ----------------------- overriding function Get_Owned_Comment (Self : not null access constant OCL_Tuple_Type_Proxy) return AMF.UML.Comments.Collections.Set_Of_UML_Comment is begin return AMF.UML.Comments.Collections.Wrap (AMF.Internals.Element_Collections.Wrap (AMF.Internals.Tables.OCL_Attributes.Internal_Get_Owned_Comment (Self.Element))); end Get_Owned_Comment; ----------------------- -- Get_Owned_Element -- ----------------------- overriding function Get_Owned_Element (Self : not null access constant OCL_Tuple_Type_Proxy) return AMF.UML.Elements.Collections.Set_Of_UML_Element is begin return AMF.UML.Elements.Collections.Wrap (AMF.Internals.Element_Collections.Wrap (AMF.Internals.Tables.OCL_Attributes.Internal_Get_Owned_Element (Self.Element))); end Get_Owned_Element; --------------- -- Get_Owner -- --------------- overriding function Get_Owner (Self : not null access constant OCL_Tuple_Type_Proxy) return AMF.UML.Elements.UML_Element_Access is begin return AMF.UML.Elements.UML_Element_Access (AMF.Internals.Helpers.To_Element (AMF.Internals.Tables.OCL_Attributes.Internal_Get_Owner (Self.Element))); end Get_Owner; ----------------- -- Get_Package -- ----------------- overriding function Get_Package (Self : not null access constant OCL_Tuple_Type_Proxy) return AMF.UML.Packages.UML_Package_Access is begin return AMF.UML.Packages.UML_Package_Access (AMF.Internals.Helpers.To_Element (AMF.Internals.Tables.OCL_Attributes.Internal_Get_Package (Self.Element))); end Get_Package; ----------------- -- Set_Package -- ----------------- overriding procedure Set_Package (Self : not null access OCL_Tuple_Type_Proxy; To : AMF.UML.Packages.UML_Package_Access) is begin AMF.Internals.Tables.OCL_Attributes.Internal_Set_Package (Self.Element, AMF.Internals.Helpers.To_Element (AMF.Elements.Element_Access (To))); end Set_Package; -------------------- -- Get_Visibility -- -------------------- overriding function Get_Visibility (Self : not null access constant OCL_Tuple_Type_Proxy) return AMF.UML.UML_Visibility_Kind is begin return AMF.Internals.Tables.OCL_Attributes.Internal_Get_Visibility (Self.Element).Value; end Get_Visibility; -------------------- -- Set_Visibility -- -------------------- overriding procedure Set_Visibility (Self : not null access OCL_Tuple_Type_Proxy; To : AMF.UML.UML_Visibility_Kind) is begin AMF.Internals.Tables.OCL_Attributes.Internal_Set_Visibility (Self.Element, (False, To)); end Set_Visibility; ----------------------------------- -- Get_Owning_Template_Parameter -- ----------------------------------- overriding function Get_Owning_Template_Parameter (Self : not null access constant OCL_Tuple_Type_Proxy) return AMF.UML.Template_Parameters.UML_Template_Parameter_Access is begin return AMF.UML.Template_Parameters.UML_Template_Parameter_Access (AMF.Internals.Helpers.To_Element (AMF.Internals.Tables.OCL_Attributes.Internal_Get_Owning_Template_Parameter (Self.Element))); end Get_Owning_Template_Parameter; ----------------------------------- -- Set_Owning_Template_Parameter -- ----------------------------------- overriding procedure Set_Owning_Template_Parameter (Self : not null access OCL_Tuple_Type_Proxy; To : AMF.UML.Template_Parameters.UML_Template_Parameter_Access) is begin AMF.Internals.Tables.OCL_Attributes.Internal_Set_Owning_Template_Parameter (Self.Element, AMF.Internals.Helpers.To_Element (AMF.Elements.Element_Access (To))); end Set_Owning_Template_Parameter; ---------------------------- -- Get_Template_Parameter -- ---------------------------- overriding function Get_Template_Parameter (Self : not null access constant OCL_Tuple_Type_Proxy) return AMF.UML.Template_Parameters.UML_Template_Parameter_Access is begin return AMF.UML.Template_Parameters.UML_Template_Parameter_Access (AMF.Internals.Helpers.To_Element (AMF.Internals.Tables.OCL_Attributes.Internal_Get_Template_Parameter (Self.Element))); end Get_Template_Parameter; ---------------------------- -- Set_Template_Parameter -- ---------------------------- overriding procedure Set_Template_Parameter (Self : not null access OCL_Tuple_Type_Proxy; To : AMF.UML.Template_Parameters.UML_Template_Parameter_Access) is begin AMF.Internals.Tables.OCL_Attributes.Internal_Set_Template_Parameter (Self.Element, AMF.Internals.Helpers.To_Element (AMF.Elements.Element_Access (To))); end Set_Template_Parameter; ---------------------------------- -- Get_Owned_Template_Signature -- ---------------------------------- overriding function Get_Owned_Template_Signature (Self : not null access constant OCL_Tuple_Type_Proxy) return AMF.UML.Template_Signatures.UML_Template_Signature_Access is begin return AMF.UML.Template_Signatures.UML_Template_Signature_Access (AMF.Internals.Helpers.To_Element (AMF.Internals.Tables.OCL_Attributes.Internal_Get_Owned_Template_Signature (Self.Element))); end Get_Owned_Template_Signature; ---------------------------------- -- Set_Owned_Template_Signature -- ---------------------------------- overriding procedure Set_Owned_Template_Signature (Self : not null access OCL_Tuple_Type_Proxy; To : AMF.UML.Template_Signatures.UML_Template_Signature_Access) is begin AMF.Internals.Tables.OCL_Attributes.Internal_Set_Owned_Template_Signature (Self.Element, AMF.Internals.Helpers.To_Element (AMF.Elements.Element_Access (To))); end Set_Owned_Template_Signature; -------------------------- -- Get_Template_Binding -- -------------------------- overriding function Get_Template_Binding (Self : not null access constant OCL_Tuple_Type_Proxy) return AMF.UML.Template_Bindings.Collections.Set_Of_UML_Template_Binding is begin return AMF.UML.Template_Bindings.Collections.Wrap (AMF.Internals.Element_Collections.Wrap (AMF.Internals.Tables.OCL_Attributes.Internal_Get_Template_Binding (Self.Element))); end Get_Template_Binding; ----------------- -- Get_Is_Leaf -- ----------------- overriding function Get_Is_Leaf (Self : not null access constant OCL_Tuple_Type_Proxy) return Boolean is begin return AMF.Internals.Tables.OCL_Attributes.Internal_Get_Is_Leaf (Self.Element); end Get_Is_Leaf; ----------------- -- Set_Is_Leaf -- ----------------- overriding procedure Set_Is_Leaf (Self : not null access OCL_Tuple_Type_Proxy; To : Boolean) is begin AMF.Internals.Tables.OCL_Attributes.Internal_Set_Is_Leaf (Self.Element, To); end Set_Is_Leaf; --------------------------- -- Get_Redefined_Element -- --------------------------- overriding function Get_Redefined_Element (Self : not null access constant OCL_Tuple_Type_Proxy) return AMF.UML.Redefinable_Elements.Collections.Set_Of_UML_Redefinable_Element is begin return AMF.UML.Redefinable_Elements.Collections.Wrap (AMF.Internals.Element_Collections.Wrap (AMF.Internals.Tables.OCL_Attributes.Internal_Get_Redefined_Element (Self.Element))); end Get_Redefined_Element; ------------------------------ -- Get_Redefinition_Context -- ------------------------------ overriding function Get_Redefinition_Context (Self : not null access constant OCL_Tuple_Type_Proxy) return AMF.UML.Classifiers.Collections.Set_Of_UML_Classifier is begin return AMF.UML.Classifiers.Collections.Wrap (AMF.Internals.Element_Collections.Wrap (AMF.Internals.Tables.OCL_Attributes.Internal_Get_Redefinition_Context (Self.Element))); end Get_Redefinition_Context; ------------- -- Inherit -- ------------- overriding function Inherit (Self : not null access constant OCL_Tuple_Type_Proxy; Inhs : AMF.UML.Named_Elements.Collections.Set_Of_UML_Named_Element) return AMF.UML.Named_Elements.Collections.Set_Of_UML_Named_Element is begin -- Generated stub: replace with real body! pragma Compile_Time_Warning (Standard.True, "Inherit unimplemented"); raise Program_Error with "Unimplemented procedure OCL_Tuple_Type_Proxy.Inherit"; return Inherit (Self, Inhs); end Inherit; ------------------ -- All_Features -- ------------------ overriding function All_Features (Self : not null access constant OCL_Tuple_Type_Proxy) return AMF.UML.Features.Collections.Set_Of_UML_Feature is begin -- Generated stub: replace with real body! pragma Compile_Time_Warning (Standard.True, "All_Features unimplemented"); raise Program_Error with "Unimplemented procedure OCL_Tuple_Type_Proxy.All_Features"; return All_Features (Self); end All_Features; ----------------- -- All_Parents -- ----------------- overriding function All_Parents (Self : not null access constant OCL_Tuple_Type_Proxy) return AMF.UML.Classifiers.Collections.Set_Of_UML_Classifier is begin -- Generated stub: replace with real body! pragma Compile_Time_Warning (Standard.True, "All_Parents unimplemented"); raise Program_Error with "Unimplemented procedure OCL_Tuple_Type_Proxy.All_Parents"; return All_Parents (Self); end All_Parents; ----------------- -- Conforms_To -- ----------------- overriding function Conforms_To (Self : not null access constant OCL_Tuple_Type_Proxy; Other : AMF.UML.Classifiers.UML_Classifier_Access) return Boolean is begin -- Generated stub: replace with real body! pragma Compile_Time_Warning (Standard.True, "Conforms_To unimplemented"); raise Program_Error with "Unimplemented procedure OCL_Tuple_Type_Proxy.Conforms_To"; return Conforms_To (Self, Other); end Conforms_To; ------------- -- General -- ------------- overriding function General (Self : not null access constant OCL_Tuple_Type_Proxy) return AMF.UML.Classifiers.Collections.Set_Of_UML_Classifier is begin -- Generated stub: replace with real body! pragma Compile_Time_Warning (Standard.True, "General unimplemented"); raise Program_Error with "Unimplemented procedure OCL_Tuple_Type_Proxy.General"; return General (Self); end General; ----------------------- -- Has_Visibility_Of -- ----------------------- overriding function Has_Visibility_Of (Self : not null access constant OCL_Tuple_Type_Proxy; N : AMF.UML.Named_Elements.UML_Named_Element_Access) return Boolean is begin -- Generated stub: replace with real body! pragma Compile_Time_Warning (Standard.True, "Has_Visibility_Of unimplemented"); raise Program_Error with "Unimplemented procedure OCL_Tuple_Type_Proxy.Has_Visibility_Of"; return Has_Visibility_Of (Self, N); end Has_Visibility_Of; ------------------------- -- Inheritable_Members -- ------------------------- overriding function Inheritable_Members (Self : not null access constant OCL_Tuple_Type_Proxy; C : AMF.UML.Classifiers.UML_Classifier_Access) return AMF.UML.Named_Elements.Collections.Set_Of_UML_Named_Element is begin -- Generated stub: replace with real body! pragma Compile_Time_Warning (Standard.True, "Inheritable_Members unimplemented"); raise Program_Error with "Unimplemented procedure OCL_Tuple_Type_Proxy.Inheritable_Members"; return Inheritable_Members (Self, C); end Inheritable_Members; ---------------------- -- Inherited_Member -- ---------------------- overriding function Inherited_Member (Self : not null access constant OCL_Tuple_Type_Proxy) return AMF.UML.Named_Elements.Collections.Set_Of_UML_Named_Element is begin -- Generated stub: replace with real body! pragma Compile_Time_Warning (Standard.True, "Inherited_Member unimplemented"); raise Program_Error with "Unimplemented procedure OCL_Tuple_Type_Proxy.Inherited_Member"; return Inherited_Member (Self); end Inherited_Member; ----------------- -- Is_Template -- ----------------- overriding function Is_Template (Self : not null access constant OCL_Tuple_Type_Proxy) return Boolean is begin -- Generated stub: replace with real body! pragma Compile_Time_Warning (Standard.True, "Is_Template unimplemented"); raise Program_Error with "Unimplemented procedure OCL_Tuple_Type_Proxy.Is_Template"; return Is_Template (Self); end Is_Template; ------------------------- -- May_Specialize_Type -- ------------------------- overriding function May_Specialize_Type (Self : not null access constant OCL_Tuple_Type_Proxy; C : AMF.UML.Classifiers.UML_Classifier_Access) return Boolean is begin -- Generated stub: replace with real body! pragma Compile_Time_Warning (Standard.True, "May_Specialize_Type unimplemented"); raise Program_Error with "Unimplemented procedure OCL_Tuple_Type_Proxy.May_Specialize_Type"; return May_Specialize_Type (Self, C); end May_Specialize_Type; ------------- -- Parents -- ------------- overriding function Parents (Self : not null access constant OCL_Tuple_Type_Proxy) return AMF.UML.Classifiers.Collections.Set_Of_UML_Classifier is begin -- Generated stub: replace with real body! pragma Compile_Time_Warning (Standard.True, "Parents unimplemented"); raise Program_Error with "Unimplemented procedure OCL_Tuple_Type_Proxy.Parents"; return Parents (Self); end Parents; ------------------------ -- Exclude_Collisions -- ------------------------ overriding function Exclude_Collisions (Self : not null access constant OCL_Tuple_Type_Proxy; Imps : AMF.UML.Packageable_Elements.Collections.Set_Of_UML_Packageable_Element) return AMF.UML.Packageable_Elements.Collections.Set_Of_UML_Packageable_Element is begin -- Generated stub: replace with real body! pragma Compile_Time_Warning (Standard.True, "Exclude_Collisions unimplemented"); raise Program_Error with "Unimplemented procedure OCL_Tuple_Type_Proxy.Exclude_Collisions"; return Exclude_Collisions (Self, Imps); end Exclude_Collisions; ------------------------- -- Get_Names_Of_Member -- ------------------------- overriding function Get_Names_Of_Member (Self : not null access constant OCL_Tuple_Type_Proxy; Element : AMF.UML.Named_Elements.UML_Named_Element_Access) return AMF.String_Collections.Set_Of_String is begin -- Generated stub: replace with real body! pragma Compile_Time_Warning (Standard.True, "Get_Names_Of_Member unimplemented"); raise Program_Error with "Unimplemented procedure OCL_Tuple_Type_Proxy.Get_Names_Of_Member"; return Get_Names_Of_Member (Self, Element); end Get_Names_Of_Member; -------------------- -- Import_Members -- -------------------- overriding function Import_Members (Self : not null access constant OCL_Tuple_Type_Proxy; Imps : AMF.UML.Packageable_Elements.Collections.Set_Of_UML_Packageable_Element) return AMF.UML.Packageable_Elements.Collections.Set_Of_UML_Packageable_Element is begin -- Generated stub: replace with real body! pragma Compile_Time_Warning (Standard.True, "Import_Members unimplemented"); raise Program_Error with "Unimplemented procedure OCL_Tuple_Type_Proxy.Import_Members"; return Import_Members (Self, Imps); end Import_Members; --------------------- -- Imported_Member -- --------------------- overriding function Imported_Member (Self : not null access constant OCL_Tuple_Type_Proxy) return AMF.UML.Packageable_Elements.Collections.Set_Of_UML_Packageable_Element is begin -- Generated stub: replace with real body! pragma Compile_Time_Warning (Standard.True, "Imported_Member unimplemented"); raise Program_Error with "Unimplemented procedure OCL_Tuple_Type_Proxy.Imported_Member"; return Imported_Member (Self); end Imported_Member; --------------------------------- -- Members_Are_Distinguishable -- --------------------------------- overriding function Members_Are_Distinguishable (Self : not null access constant OCL_Tuple_Type_Proxy) return Boolean is begin -- Generated stub: replace with real body! pragma Compile_Time_Warning (Standard.True, "Members_Are_Distinguishable unimplemented"); raise Program_Error with "Unimplemented procedure OCL_Tuple_Type_Proxy.Members_Are_Distinguishable"; return Members_Are_Distinguishable (Self); end Members_Are_Distinguishable; ------------------ -- Owned_Member -- ------------------ overriding function Owned_Member (Self : not null access constant OCL_Tuple_Type_Proxy) return AMF.UML.Named_Elements.Collections.Set_Of_UML_Named_Element is begin -- Generated stub: replace with real body! pragma Compile_Time_Warning (Standard.True, "Owned_Member unimplemented"); raise Program_Error with "Unimplemented procedure OCL_Tuple_Type_Proxy.Owned_Member"; return Owned_Member (Self); end Owned_Member; -------------------- -- All_Namespaces -- -------------------- overriding function All_Namespaces (Self : not null access constant OCL_Tuple_Type_Proxy) return AMF.UML.Namespaces.Collections.Ordered_Set_Of_UML_Namespace is begin -- Generated stub: replace with real body! pragma Compile_Time_Warning (Standard.True, "All_Namespaces unimplemented"); raise Program_Error with "Unimplemented procedure OCL_Tuple_Type_Proxy.All_Namespaces"; return All_Namespaces (Self); end All_Namespaces; ------------------------- -- All_Owning_Packages -- ------------------------- overriding function All_Owning_Packages (Self : not null access constant OCL_Tuple_Type_Proxy) return AMF.UML.Packages.Collections.Set_Of_UML_Package is begin -- Generated stub: replace with real body! pragma Compile_Time_Warning (Standard.True, "All_Owning_Packages unimplemented"); raise Program_Error with "Unimplemented procedure OCL_Tuple_Type_Proxy.All_Owning_Packages"; return All_Owning_Packages (Self); end All_Owning_Packages; ----------------------------- -- Is_Distinguishable_From -- ----------------------------- overriding function Is_Distinguishable_From (Self : not null access constant OCL_Tuple_Type_Proxy; N : AMF.UML.Named_Elements.UML_Named_Element_Access; Ns : AMF.UML.Namespaces.UML_Namespace_Access) return Boolean is begin -- Generated stub: replace with real body! pragma Compile_Time_Warning (Standard.True, "Is_Distinguishable_From unimplemented"); raise Program_Error with "Unimplemented procedure OCL_Tuple_Type_Proxy.Is_Distinguishable_From"; return Is_Distinguishable_From (Self, N, Ns); end Is_Distinguishable_From; --------------- -- Namespace -- --------------- overriding function Namespace (Self : not null access constant OCL_Tuple_Type_Proxy) return AMF.UML.Namespaces.UML_Namespace_Access is begin -- Generated stub: replace with real body! pragma Compile_Time_Warning (Standard.True, "Namespace unimplemented"); raise Program_Error with "Unimplemented procedure OCL_Tuple_Type_Proxy.Namespace"; return Namespace (Self); end Namespace; -------------------- -- Qualified_Name -- -------------------- overriding function Qualified_Name (Self : not null access constant OCL_Tuple_Type_Proxy) return League.Strings.Universal_String is begin -- Generated stub: replace with real body! pragma Compile_Time_Warning (Standard.True, "Qualified_Name unimplemented"); raise Program_Error with "Unimplemented procedure OCL_Tuple_Type_Proxy.Qualified_Name"; return Qualified_Name (Self); end Qualified_Name; --------------- -- Separator -- --------------- overriding function Separator (Self : not null access constant OCL_Tuple_Type_Proxy) return League.Strings.Universal_String is begin -- Generated stub: replace with real body! pragma Compile_Time_Warning (Standard.True, "Separator unimplemented"); raise Program_Error with "Unimplemented procedure OCL_Tuple_Type_Proxy.Separator"; return Separator (Self); end Separator; ------------------------ -- All_Owned_Elements -- ------------------------ overriding function All_Owned_Elements (Self : not null access constant OCL_Tuple_Type_Proxy) return AMF.UML.Elements.Collections.Set_Of_UML_Element is begin -- Generated stub: replace with real body! pragma Compile_Time_Warning (Standard.True, "All_Owned_Elements unimplemented"); raise Program_Error with "Unimplemented procedure OCL_Tuple_Type_Proxy.All_Owned_Elements"; return All_Owned_Elements (Self); end All_Owned_Elements; ------------------- -- Must_Be_Owned -- ------------------- overriding function Must_Be_Owned (Self : not null access constant OCL_Tuple_Type_Proxy) return Boolean is begin -- Generated stub: replace with real body! pragma Compile_Time_Warning (Standard.True, "Must_Be_Owned unimplemented"); raise Program_Error with "Unimplemented procedure OCL_Tuple_Type_Proxy.Must_Be_Owned"; return Must_Be_Owned (Self); end Must_Be_Owned; ----------------- -- Conforms_To -- ----------------- overriding function Conforms_To (Self : not null access constant OCL_Tuple_Type_Proxy; Other : AMF.UML.Types.UML_Type_Access) return Boolean is begin -- Generated stub: replace with real body! pragma Compile_Time_Warning (Standard.True, "Conforms_To unimplemented"); raise Program_Error with "Unimplemented procedure OCL_Tuple_Type_Proxy.Conforms_To"; return Conforms_To (Self, Other); end Conforms_To; ------------------------ -- Is_Compatible_With -- ------------------------ overriding function Is_Compatible_With (Self : not null access constant OCL_Tuple_Type_Proxy; P : AMF.UML.Parameterable_Elements.UML_Parameterable_Element_Access) return Boolean is begin -- Generated stub: replace with real body! pragma Compile_Time_Warning (Standard.True, "Is_Compatible_With unimplemented"); raise Program_Error with "Unimplemented procedure OCL_Tuple_Type_Proxy.Is_Compatible_With"; return Is_Compatible_With (Self, P); end Is_Compatible_With; --------------------------- -- Is_Template_Parameter -- --------------------------- overriding function Is_Template_Parameter (Self : not null access constant OCL_Tuple_Type_Proxy) return Boolean is begin -- Generated stub: replace with real body! pragma Compile_Time_Warning (Standard.True, "Is_Template_Parameter unimplemented"); raise Program_Error with "Unimplemented procedure OCL_Tuple_Type_Proxy.Is_Template_Parameter"; return Is_Template_Parameter (Self); end Is_Template_Parameter; ---------------------------- -- Parameterable_Elements -- ---------------------------- overriding function Parameterable_Elements (Self : not null access constant OCL_Tuple_Type_Proxy) return AMF.UML.Parameterable_Elements.Collections.Set_Of_UML_Parameterable_Element is begin -- Generated stub: replace with real body! pragma Compile_Time_Warning (Standard.True, "Parameterable_Elements unimplemented"); raise Program_Error with "Unimplemented procedure OCL_Tuple_Type_Proxy.Parameterable_Elements"; return Parameterable_Elements (Self); end Parameterable_Elements; ------------------------ -- Is_Consistent_With -- ------------------------ overriding function Is_Consistent_With (Self : not null access constant OCL_Tuple_Type_Proxy; Redefinee : AMF.UML.Redefinable_Elements.UML_Redefinable_Element_Access) return Boolean is begin -- Generated stub: replace with real body! pragma Compile_Time_Warning (Standard.True, "Is_Consistent_With unimplemented"); raise Program_Error with "Unimplemented procedure OCL_Tuple_Type_Proxy.Is_Consistent_With"; return Is_Consistent_With (Self, Redefinee); end Is_Consistent_With; ----------------------------------- -- Is_Redefinition_Context_Valid -- ----------------------------------- overriding function Is_Redefinition_Context_Valid (Self : not null access constant OCL_Tuple_Type_Proxy; Redefined : AMF.UML.Redefinable_Elements.UML_Redefinable_Element_Access) return Boolean is begin -- Generated stub: replace with real body! pragma Compile_Time_Warning (Standard.True, "Is_Redefinition_Context_Valid unimplemented"); raise Program_Error with "Unimplemented procedure OCL_Tuple_Type_Proxy.Is_Redefinition_Context_Valid"; return Is_Redefinition_Context_Valid (Self, Redefined); end Is_Redefinition_Context_Valid; ------------------- -- Enter_Element -- ------------------- overriding procedure Enter_Element (Self : not null access constant OCL_Tuple_Type_Proxy; Visitor : in out AMF.Visitors.Abstract_Visitor'Class; Control : in out AMF.Visitors.Traverse_Control) is begin if Visitor in AMF.Visitors.OCL_Visitors.OCL_Visitor'Class then AMF.Visitors.OCL_Visitors.OCL_Visitor'Class (Visitor).Enter_Tuple_Type (AMF.OCL.Tuple_Types.OCL_Tuple_Type_Access (Self), Control); end if; end Enter_Element; ------------------- -- Leave_Element -- ------------------- overriding procedure Leave_Element (Self : not null access constant OCL_Tuple_Type_Proxy; Visitor : in out AMF.Visitors.Abstract_Visitor'Class; Control : in out AMF.Visitors.Traverse_Control) is begin if Visitor in AMF.Visitors.OCL_Visitors.OCL_Visitor'Class then AMF.Visitors.OCL_Visitors.OCL_Visitor'Class (Visitor).Leave_Tuple_Type (AMF.OCL.Tuple_Types.OCL_Tuple_Type_Access (Self), Control); end if; end Leave_Element; ------------------- -- Visit_Element -- ------------------- overriding procedure Visit_Element (Self : not null access constant OCL_Tuple_Type_Proxy; Iterator : in out AMF.Visitors.Abstract_Iterator'Class; Visitor : in out AMF.Visitors.Abstract_Visitor'Class; Control : in out AMF.Visitors.Traverse_Control) is begin if Iterator in AMF.Visitors.OCL_Iterators.OCL_Iterator'Class then AMF.Visitors.OCL_Iterators.OCL_Iterator'Class (Iterator).Visit_Tuple_Type (Visitor, AMF.OCL.Tuple_Types.OCL_Tuple_Type_Access (Self), Control); end if; end Visit_Element; end AMF.Internals.OCL_Tuple_Types;
reznikmm/matreshka
Ada
4,045
adb
------------------------------------------------------------------------------ -- -- -- 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.Element_Collections; with AMF.Internals.Tables.CMOF_Attributes; package body AMF.Internals.CMOF_Features is use AMF.Internals.Tables.CMOF_Attributes; ------------------------------ -- Get_Featuring_Classifier -- ------------------------------ overriding function Get_Featuring_Classifier (Self : not null access constant CMOF_Feature_Proxy) return AMF.CMOF.Classifiers.Collections.Set_Of_CMOF_Classifier is begin return AMF.CMOF.Classifiers.Collections.Wrap (AMF.Internals.Element_Collections.Wrap (Internal_Get_Featuring_Classifier (Self.Element))); end Get_Featuring_Classifier; end AMF.Internals.CMOF_Features;
reznikmm/matreshka
Ada
6,169
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_Cell.Internals; with ODF.DOM.Iterators; with ODF.DOM.Visitors; package body Matreshka.ODF_Elements.Table.Table_Cell is ------------------- -- Enter_Element -- ------------------- overriding procedure Enter_Element (Self : not null access Table_Table_Cell_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_Cell (ODF.DOM.Elements.Table.Table_Cell.Internals.Create (Table_Table_Cell_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_Cell_Node) return League.Strings.Universal_String is begin return ODF.Constants.Table_Cell_Name; end Get_Local_Name; ------------------- -- Leave_Element -- ------------------- overriding procedure Leave_Element (Self : not null access Table_Table_Cell_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_Cell (ODF.DOM.Elements.Table.Table_Cell.Internals.Create (Table_Table_Cell_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_Cell_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_Cell (Visitor, ODF.DOM.Elements.Table.Table_Cell.Internals.Create (Table_Table_Cell_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_Cell;
stcarrez/ada-el
Ada
9,664
adb
----------------------------------------------------------------------- -- el-contexts-default -- Default contexts for evaluating an expression -- Copyright (C) 2009, 2010, 2011, 2012, 2018, 2021, 2022 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.Unchecked_Deallocation; with EL.Variables.Default; package body EL.Contexts.Default is use EL.Objects; procedure Free is new Ada.Unchecked_Deallocation (Object => EL.Variables.Variable_Mapper'Class, Name => EL.Variables.Variable_Mapper_Access); -- ------------------------------ -- Retrieves the ELResolver associated with this ELcontext. -- ------------------------------ overriding function Get_Resolver (Context : Default_Context) return ELResolver_Access is begin return Context.Resolver; end Get_Resolver; -- ------------------------------ -- Set the ELResolver associated with this ELcontext. -- ------------------------------ procedure Set_Resolver (Context : in out Default_Context; Resolver : in ELResolver_Access) is begin Context.Resolver := Resolver; end Set_Resolver; -- ------------------------------ -- Retrieves the Variable_Mapper associated with this ELContext. -- ------------------------------ overriding function Get_Variable_Mapper (Context : Default_Context) return access EL.Variables.Variable_Mapper'Class is begin return Context.Var_Mapper; end Get_Variable_Mapper; -- ------------------------------ -- Retrieves the Function_Mapper associated with this ELContext. -- The Function_Mapper is only used when parsing an expression. -- ------------------------------ overriding function Get_Function_Mapper (Context : Default_Context) return EL.Functions.Function_Mapper_Access is begin return Context.Function_Mapper; end Get_Function_Mapper; -- ------------------------------ -- Set the function mapper to be used when parsing an expression. -- ------------------------------ overriding procedure Set_Function_Mapper (Context : in out Default_Context; Mapper : access EL.Functions.Function_Mapper'Class) is begin if Mapper = null then Context.Function_Mapper := null; else Context.Function_Mapper := Mapper.all'Unchecked_Access; end if; end Set_Function_Mapper; -- ------------------------------ -- Set the Variable_Mapper associated with this ELContext. -- ------------------------------ overriding procedure Set_Variable_Mapper (Context : in out Default_Context; Mapper : access EL.Variables.Variable_Mapper'Class) is use EL.Variables; begin if Context.Var_Mapper_Created then Free (Context.Var_Mapper); end if; if Mapper = null then Context.Var_Mapper := null; else Context.Var_Mapper := Mapper.all'Unchecked_Access; end if; end Set_Variable_Mapper; procedure Set_Variable (Context : in out Default_Context; Name : in String; Value : access Util.Beans.Basic.Readonly_Bean'Class) is use EL.Variables; begin if Context.Var_Mapper = null then Context.Var_Mapper := new EL.Variables.Default.Default_Variable_Mapper; Context.Var_Mapper_Created := True; end if; Context.Var_Mapper.Bind (Name, EL.Objects.To_Object (Value, EL.Objects.STATIC)); end Set_Variable; -- Handle the exception during expression evaluation. overriding procedure Handle_Exception (Context : in Default_Context; Ex : in Ada.Exceptions.Exception_Occurrence) is begin null; end Handle_Exception; -- ------------------------------ -- Guarded Context -- ------------------------------ -- ------------------------------ -- Retrieves the ELResolver associated with this ELcontext. -- ------------------------------ overriding function Get_Resolver (Context : in Guarded_Context) return ELResolver_Access is begin return Context.Context.Get_Resolver; end Get_Resolver; -- ------------------------------ -- Retrieves the Variable_Mapper associated with this ELContext. -- ------------------------------ overriding function Get_Variable_Mapper (Context : in Guarded_Context) return access EL.Variables.Variable_Mapper'Class is begin return Context.Context.Get_Variable_Mapper; end Get_Variable_Mapper; -- ------------------------------ -- Retrieves the Function_Mapper associated with this ELContext. -- The Function_Mapper is only used when parsing an expression. -- ------------------------------ overriding function Get_Function_Mapper (Context : in Guarded_Context) return EL.Functions.Function_Mapper_Access is begin return Context.Context.Get_Function_Mapper; end Get_Function_Mapper; -- ------------------------------ -- Set the function mapper to be used when parsing an expression. -- ------------------------------ overriding procedure Set_Function_Mapper (Context : in out Guarded_Context; Mapper : access EL.Functions.Function_Mapper'Class) is begin Context.Context.Set_Function_Mapper (Mapper); end Set_Function_Mapper; -- ------------------------------ -- Set the Variable_Mapper associated with this ELContext. -- ------------------------------ overriding procedure Set_Variable_Mapper (Context : in out Guarded_Context; Mapper : access EL.Variables.Variable_Mapper'Class) is begin Context.Context.Set_Variable_Mapper (Mapper); end Set_Variable_Mapper; -- ------------------------------ -- Handle the exception during expression evaluation. -- ------------------------------ overriding procedure Handle_Exception (Context : in Guarded_Context; Ex : in Ada.Exceptions.Exception_Occurrence) is begin Context.Handler.all (Ex); end Handle_Exception; -- ------------------------------ -- Get the value associated with a base object and a given property. -- ------------------------------ overriding function Get_Value (Resolver : Default_ELResolver; Context : ELContext'Class; Base : access Util.Beans.Basic.Readonly_Bean'Class; Name : Unbounded_String) return Object is pragma Unreferenced (Context); Key : constant String := To_String (Name); begin if Base /= null then return Base.Get_Value (Key); end if; declare Pos : constant Objects.Maps.Cursor := Resolver.Map.Find (Key); begin if Objects.Maps.Has_Element (Pos) then return Objects.Maps.Element (Pos); end if; end; return Util.Beans.Objects.Null_Object; end Get_Value; -- ------------------------------ -- Set the value associated with a base object and a given property. -- ------------------------------ overriding procedure Set_Value (Resolver : in out Default_ELResolver; Context : in ELContext'Class; Base : access Util.Beans.Basic.Bean'Class; Name : in Unbounded_String; Value : in Object) is begin null; end Set_Value; -- ------------------------------ -- Register the value under the given name. -- ------------------------------ procedure Register (Resolver : in out Default_ELResolver; Name : in Unbounded_String; Value : in Util.Beans.Basic.Readonly_Bean_Access) is begin Resolver.Register (Name, To_Object (Value)); end Register; -- ------------------------------ -- Register the value under the given name. -- ------------------------------ procedure Register (Resolver : in out Default_ELResolver; Name : in Unbounded_String; Value : in EL.Objects.Object) is Key : constant String := To_String (Name); begin Objects.Maps.Include (Resolver.Map, Key, Value); end Register; overriding procedure Finalize (Obj : in out Default_Context) is begin if Obj.Var_Mapper_Created then Free (Obj.Var_Mapper); end if; end Finalize; end EL.Contexts.Default;
kimtg/euler-ada
Ada
1,752
adb
with Ada.Text_IO; procedure Euler17 is Word_Lengths : array(Natural range <>) of Natural := ( String'("")'Length, String'("one")'Length, String'("two")'Length, String'("three")'Length, String'("four")'Length, String'("five")'Length, String'("six")'Length, String'("seven")'Length, String'("eight")'Length, String'("nine")'Length, String'("ten")'Length, String'("eleven")'Length, String'("twelve")'Length, String'("thirteen")'Length, String'("fourteen")'Length, String'("fifteen")'Length, String'("sixteen")'Length, String'("seventeen")'Length, String'("eighteen")'Length, String'("nineteen")'Length); Word_Ty_Lengths : array(Natural range <>) of Natural := (String'("")'Length, String'("")'Length, String'("twenty")'Length, String'("thirty")'Length, String'("forty")'Length, String'("fifty")'Length, String'("sixty")'Length, String'("seventy")'Length, String'("eighty")'Length, String'("ninety")'Length); function Word_Length(N : Natural) return Natural is Sum : Natural; begin if N <= 19 then return Word_Lengths(N); elsif N <= 99 then return Word_Ty_Lengths(N / 10) + Word_Lengths(N mod 10); elsif N = 1000 then return String'("onethousand")'Length; else Sum := Word_Lengths(N / 100) + String'("hundred")'Length; if N mod 100 > 0 then Sum := Sum + String'("and")'Length + Word_Length(N mod 100); end if; return Sum; end if; end; Sum : Natural := 0; begin for X in 1 .. 1000 loop Sum := Sum + Word_Length(X); end loop; Ada.Text_IO.Put_Line(Integer'Image(Sum)); end;
usnistgov/rcslib
Ada
1,512
adb
with Unchecked_Conversion; with Ada; with Nml; use Nml; with Ada.Text_IO, Ada.Integer_Text_IO; with Interfaces.C; use Interfaces.C; with Ada.Finalization; use Ada.Finalization; package body Mynmlmsg is function Format(Param_1 : in long; param_2 : in NmlMsg_Access; Param_3 : in Cms_Access) return Interfaces.C.Int is ReturnValue : int :=0; begin Ada.Text_IO.Put("param_1="); Ada.Integer_Text_IO.Put(Integer(Param_1)); Ada.Text_IO.New_Line; if Param_2 /= null then Ada.Text_IO.Put("param_2.NmlType="); Ada.Integer_Text_IO.Put(Integer(Param_2.NmlType)); Ada.Text_IO.New_Line; if Param_1 = 1001 then UpdateMynmlmsg_Type(Param_3, NmlMsg_Access_To_Mynmlmsg_Type_Access(Param_2)); end if; end if; return ReturnValue; end Format; procedure UpdateMynmlmsg_Type(Cms : in NML.Cms_Access ; Msg : in Mynmlmsg_Type_Access ) is begin CmsUpdateInt(Cms,"AnotherInt",Msg.AnotherInt); CmsUpdateIntArray(Cms,"AnIntArray",Msg.AnIntArray,10); CmsUpdateInt(Cms,"AnIntDla_Lenght",Msg.AnIntDla_Length); CmsUpdateIntDla(Cms,"AnIntDla",Msg.AnIntDla,Msg.AnIntDla_Length,10); end UpdateMynmlmsg_Type; procedure Initialize(Object : in out Mynmlmsg_Type) is begin Object.NmlType := 1001; Object.Size := Mynmlmsg_Type'Size; end Initialize; end Mynmlmsg;
afrl-rq/OpenUxAS
Ada
9,416
adb
with Ada.Containers; use Ada.Containers; with AVTAS.LMCP.Types; use AVTAS.LMCP.Types; with UxAS.Comms.LMCP_Net_Client; use UxAS.Comms.LMCP_Net_Client; with LMCP_Messages; use LMCP_Messages; with Ada.Text_IO; use Ada.Text_IO; package body Waypoint_Plan_Manager with SPARK_Mode is ---------------------------------- -- Extract_Mission_Command_Info -- ---------------------------------- procedure Extract_MissionCommand_Maps (State : in out Waypoint_Plan_Manager_State; MC : MissionCommand); procedure Extract_MissionCommand_Maps (State : in out Waypoint_Plan_Manager_State; MC : MissionCommand) is WP : Waypoint; begin Clear (State.Id_To_Next_Id); Clear (State.Id_To_Waypoint); for I in WP_Sequences.First .. Last (MC.WaypointList) loop WP := Get (MC.WaypointList, I); if WP.Number > 0 and then WP.NextWaypoint >= 0 then if not Contains (State.Id_To_Next_Id, Pos64 (WP.Number)) then Insert (State.Id_To_Next_Id, Pos64 (WP.Number), Nat64 (WP.NextWaypoint)); end if; if not Contains (State.Id_To_Waypoint, Pos64 (WP.Number)) then Insert (State.Id_To_Waypoint, Pos64 (WP.Number), WP); end if; end if; pragma Loop_Invariant (Integer (Length (State.Id_To_Next_Id)) <= I - WP_Sequences.First + 1); pragma Loop_Invariant (Integer (Length (State.Id_To_Waypoint)) <= I - WP_Sequences.First + 1); end loop; end Extract_MissionCommand_Maps; --------------------------- -- Handle_MissionCommand -- --------------------------- procedure Handle_MissionCommand (State : in out Waypoint_Plan_Manager_State; MC : MissionCommand) is First_Id : Pos64 := MC.FirstWaypoint; Id_List : Pos64_Vector; Ids : Pos64_Nat64_Map; function Successor (M : Pos64_Nat64_Map; K : Pos64) return Nat64 renames Element; begin State.MC := MC; Extract_MissionCommand_Maps (State, MC); State.New_Command := True; State.Next_Segment_Id := First_Id; State.Next_First_Id := First_Id; Clear (State.Prefix); Clear (State.Cycle); Ids := State.Id_To_Next_Id; -- Look for First_Id. if Contains (Ids, First_Id) then if Successor (Ids, First_Id) = 0 or else not Contains (Ids, Pos64 (Successor (Ids, First_Id))) or else Successor (Ids, First_Id) = First_Id then -- First_Id has no successors. Return. Append (State.Prefix, First_Id); return; else -- First_Id has a successor. Continue. Append (Id_List, First_Id); Append (Id_List, Successor (Ids, First_Id)); Delete (Ids, First_Id); end if; else -- First_Id not found. Return with no segment. State.Next_Segment_Id := 0; State.Next_First_Id := 0; return; end if; pragma Assert (not Is_Empty (Id_List)); pragma Assert (Length (Id_List) = 2); -- Look for a predecessor to First_Id. -- We already checked that it does not point to itself. for Id of Ids loop if Successor (Ids, Id) = First_Element (Id_List) then if Last_Element (Id_List) = Id then -- First_Id cycles with its precedessor. Return. State.Next_Segment_Id := Id; Reverse_Elements (Id_List); State.Cycle := Id_List; return; else -- First_Id has a precessor. Continue. State.Next_Segment_Id := Id; Prepend (Id_List, Id); Delete (Ids, Id); exit; end if; end if; pragma Loop_Invariant (not Is_Empty (Id_List)); pragma Loop_Invariant (Length (Id_List) <= 3); pragma Loop_Invariant (Length (Ids) <= Max - 1); end loop; -- Search for successors until done. while Length (Ids) > 0 loop if Contains (Ids, Last_Element (Id_List)) then if Successor (Ids, Last_Element (Id_List)) = 0 or else not Contains (State.Id_To_Next_Id, Pos64 (Successor (Ids, Last_Element (Id_List)))) or else Successor (Ids, Last_Element (Id_List)) = Last_Element (Id_List) then -- Candidate successor is 0 , unknown , or points to itself. -- Return with a prefix only. State.Prefix := Id_List; return; elsif Contains (Id_List, Successor (Ids, Last_Element (Id_List))) then -- Found a cycle. Compute prefix & cycle. Return. declare Index : Pos64_Vectors.Extended_Index; Next_Id : Pos64 := Successor (Ids, Last_Element (Id_List)); begin Index := Find_Index (Id_List, Next_Id); for I in First_Index (Id_List) .. Index - 1 loop Append (State.Prefix, Element (Id_List, I)); pragma Loop_Invariant (Integer (Length (State.Prefix)) = I - First_Index (Id_List) + 1); end loop; for I in Index .. Last_Index (Id_List) loop Append (State.Cycle, Element (Id_List, I)); pragma Loop_Invariant (Integer (Length (State.Cycle)) = I - Index + 1); end loop; return; end; else -- Found a successor that's not a cycle. declare Id : Pos64 := Last_Element (Id_List); begin Append (Id_List, Successor (Ids, Id)); Delete (Ids, Id); end; end if; else -- Can't find a successor. Return a prefix. State.Prefix := Id_List; return; end if; pragma Loop_Invariant (not Is_Empty (Id_List)); pragma Loop_Invariant (Length (Id_List) <= Max - Length (Ids) + 1); end loop; -- No more successors. Return a prefix. State.Prefix := Id_List; end Handle_MissionCommand; --------------------- -- Produce_Segment -- --------------------- procedure Produce_Segment (State : in out Waypoint_Plan_Manager_State; Config : Waypoint_Plan_Manager_Configuration_Data; Mailbox : in out Waypoint_Plan_Manager_Mailbox) is Id : constant Pos64 := State.Next_Segment_Id; First_Id : constant Pos64 := State.Next_First_Id; Prefix : constant Pos64_Vector := State.Prefix; Cycle : constant Pos64_Vector := State.Cycle; Len : constant Positive := Positive (Config.NumberWaypointsToServe); Overlap : constant Positive := Positive (Config.NumberWaypointsOverlap); I : Natural := 1; C : Pos64_Vectors.Extended_Index; In_Prefix : Boolean; begin State.New_Command := False; State.Next_Segment_Id := 0; State.Next_First_Id := 0; Clear (State.Segment); C := Find_Index (Prefix, Id); In_Prefix := (if C /= Pos64_Vectors.No_Index then True else False); while C in First_Index (Prefix) .. Last_Index (Prefix) and then I <= Len loop pragma Loop_Invariant (Natural (Length (State.Segment)) < I); Append (State.Segment, Element (Prefix, C)); C := Iter_Next (Prefix, C); I := I + 1; end loop; C := (if In_Prefix then First_Index (Cycle) else Find_Index (Cycle, Id)); while C in First_Index (Cycle) .. Last_Index (Cycle) and then I <= Len loop pragma Loop_Invariant (Natural (Length (State.Segment)) < I); Append (State.Segment, Element (Cycle, C)); C := Iter_Next (Cycle, C); if not Iter_Has_Element (Cycle, C) then C := First_Index (Cycle); end if; I := I + 1; end loop; if Integer (Length (State.Segment)) > Overlap then State.Next_Segment_Id := Element (State.Segment, Last_Index (State.Segment) - Overlap + 1); State.Next_First_Id := Element (State.Segment, Last_Index (State.Segment) - Overlap + 2); end if; declare MC_Out : MissionCommand := State.MC; WP_List : WP_Seq; Id : Pos64; WP : Waypoint; begin MC_Out.FirstWaypoint := First_Id; for I in First_Index (State.Segment) .. Last_Index (State.Segment) loop Id := Element (State.Segment, I); if Contains (State.Id_To_Waypoint, Id) then WP := Element (State.Id_To_Waypoint, Id); if I = Last_Index (State.Segment) then WP.NextWaypoint := WP.Number; -- TODO: Extend SPARK messages to handle -- VehicleAction -> NavigationAction -> LoiterAction -- VehicleAction -> PayloadAction -> GimbalAngleAction end if; -- WP.TurnType := Config.TurnType; WP_List := Add (WP_List, WP); end if; pragma Loop_Invariant (Integer (Length (WP_List)) <= I - First_Index (State.Segment) + 1); end loop; MC_Out.WaypointList := WP_List; sendBroadcastMessage (Mailbox, MC_Out); end; end Produce_Segment; end Waypoint_Plan_Manager;
ekoeppen/STM32_Generic_Ada_Drivers
Ada
2,205
adb
with STM32_SVD; use STM32_SVD; with STM32_SVD.RCC; use STM32_SVD.RCC; with STM32_SVD.PWR; use STM32_SVD.PWR; with STM32_SVD.NVIC; with STM32_SVD.GPIO; use STM32_SVD.GPIO; with STM32GD.Startup; package body STM32GD.Board is procedure Enable_Peripherals is begin CLOCKS.Init; RCC_Periph.AHBENR.IOPAEN := 1; RCC_Periph.AHBENR.IOPBEN := 1; RCC_Periph.APB2ENR.USART1EN := 1; RCC_Periph.APB2ENR.SPI1EN := 1; RCC_Periph.APB2ENR.ADCEN := 1; RCC_Periph.APB1ENR.I2C1EN := 1; BUTTON.Init; LED.Init; LED2.Init; LED3.Init; TX.Init; RX.Init; RFM69_RESET.Init; SCL.Init; SDA.Init; CSN.Init; CSN.Set; SCLK.Init; MISO.Init; MOSI.Init; IRQ.Init; USART.Init; SPI.Init; I2C.Init; end Enable_Peripherals; procedure Disable_Peripherals is begin RCC_Periph.AHBENR.IOPAEN := 1; RCC_Periph.AHBENR.IOPBEN := 1; RCC_Periph.AHBENR.IOPCEN := 1; RCC_Periph.AHBENR.IOPDEN := 1; RCC_Periph.AHBENR.IOPFEN := 1; GPIOA_Periph.MODER.Val := 16#FFFF_FFFF#; GPIOB_Periph.MODER.Val := 16#FFFF_FFFF#; GPIOC_Periph.MODER.Val := 16#FFFF_FFFF#; GPIOD_Periph.MODER.Val := 16#FFFF_FFFF#; GPIOF_Periph.MODER.Val := 16#FFFF_FFFF#; MOSI.Set_Input; MOSI.Set_Pull_Down; MISO.Set_Input; MISO.Set_Pull_Down; SCLK.Set_Input; SCLK.Set_Pull_Up; CSN.Set_Input; CSN.Set_Pull_Up; RCC_Periph.AHBENR.IOPAEN := 0; RCC_Periph.AHBENR.IOPBEN := 0; RCC_Periph.AHBENR.IOPCEN := 0; RCC_Periph.AHBENR.IOPDEN := 0; RCC_Periph.AHBENR.IOPFEN := 0; RCC_Periph.APB2ENR.USART1EN := 0; RCC_Periph.APB2ENR.SPI1EN := 0; RCC_Periph.APB1ENR.I2C1EN := 0; RCC_Periph.AHBENR.DMAEN := 0; RCC_Periph.APB2ENR.ADCEN := 0; end Disable_Peripherals; procedure Init is begin CLOCKS.Init; RCC_Periph.APB1ENR.PWREN := 1; PWR_Periph.CR.DBP := 1; RCC_Periph.BDCR.BDRST := 2#0#; RCC_Periph.BDCR.RTCSEL := 2#10#; RCC_Periph.BDCR.RTCEN := 1; Enable_Peripherals; RTC.Init; end Init; end STM32GD.Board;
Componolit/libsparkcrypto
Ada
2,900
ads
------------------------------------------------------------------------------- -- This file is part of libsparkcrypto. -- -- Copyright (C) 2010, Alexander Senier -- Copyright (C) 2010, secunet Security Networks AG -- All rights reserved. -- -- Redistribution and use in source and binary forms, with or without -- modification, are permitted provided that the following conditions are met: -- -- * Redistributions of source code must retain the above copyright notice, -- this list of conditions and the following disclaimer. -- -- * Redistributions in binary form must reproduce the above copyright -- notice, this list of conditions and the following disclaimer in the -- documentation and/or other materials provided with the distribution. -- -- * Neither the name of the nor the names of its contributors may be used -- to endorse or promote products derived from this software without -- specific prior written permission. -- -- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" -- AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -- IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE -- ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS -- BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR -- CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF -- SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS -- INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN -- CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) -- ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -- POSSIBILITY OF SUCH DAMAGE. ------------------------------------------------------------------------------- with LSC.Internal.Types; ------------------------------------------------------------------------------- -- Byte order conversion for 32-bit words ------------------------------------------------------------------------------- package LSC.Internal.Byteorder32 is pragma Pure; -- Convert 32-bit word @Item@ from native byte order to big endian function Native_To_BE (Item : Types.Word32) return Types.Word32; pragma Inline (Native_To_BE); -- Convert 32-bit word @Item@ from native byte order to little endian function Native_To_LE (Item : Types.Word32) return Types.Word32; pragma Inline (Native_To_LE); -- Convert 32-bit word @Item@ from big endian to native byte order function BE_To_Native (Item : Types.Word32) return Types.Word32; pragma Inline (BE_To_Native); -- Convert 32-bit word @Item@ from little endian to native byte order function LE_To_Native (Item : Types.Word32) return Types.Word32; pragma Inline (LE_To_Native); end LSC.Internal.Byteorder32;
zhmu/ananas
Ada
177
ads
package Array40_Pkg is type Rec is record I : Integer; end record; type Arr is array (1 .. 4) of Rec; for Arr'Component_Size use 40; A : Arr; end Array40_Pkg;
seanvictory/mlh-localhost-adacore
Ada
2,071
adb
with Ada.Text_IO; use Ada.Text_IO; with Stack; use Stack; procedure Example is Done : Boolean := False; -------------------- -- Get_User_Input -- -------------------- function Get_User_Input return Character is begin loop declare User_Input : String := Get_Line; begin if User_Input'Length = 1 then return User_Input (User_Input'First); end if; Put_Line ("Invalid Input, please try again!"); Put ("input > "); end; end loop; end Get_User_Input; ----------- -- Debug -- ----------- procedure Debug is begin Put_Line ("**************************************"); Put_Line ("Size: " & Integer'Image(Stack.Size)); Put_Line ("Max Size: " & Integer'Image(Stack.Max_Size)); if not Stack.Empty then Put_Line ("Top: " & Stack.Top); Put ("Stack: ["); for I in Stack.Tab'First .. Stack.Size loop Put (Stack.Tab(I) & ", "); end loop; Put_Line ("]"); else Put_Line ("Top: Null"); Put_Line ("Stack: []"); end if; Put_Line ("**************************************"); end Debug; begin ---------- -- Main -- ---------- while not Done = True loop Put ("input > "); declare S : Character := Get_User_Input; begin if S = 'q' then Done := True; elsif S = 'd' then Debug; elsif S = 'p' then if not Stack.Empty then Stack.Pop (S); Put_Line ("Popped: " & S); else Put_Line ("Nothing to Pop, Stack is empty!"); end if; else if not Stack.Full then Stack.Push (S); Put_Line ("Pushed: " & S); else Put_Line ("Could not push '" & S & "', Stack is full!"); end if; end if; end; end loop; Put_Line ("Example ended."); end Example;
stcarrez/ada-asf
Ada
1,139
adb
----------------------------------------------------------------------- -- ASF -- Ada Server Faces -- Copyright (C) 2009, 2010, 2015 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; with ASF.Tests; with ASF.Testsuite; procedure ASF_Harness is procedure Harness is new Util.Tests.Harness (Suite => ASF.Testsuite.Suite, Finish => ASF.Tests.Finish); begin Harness ("asf-tests.xml"); end ASF_Harness;
persan/advent-of-code-2020
Ada
135
adb
with Ada.Text_IO; use Ada.Text_IO; procedure Adventofcode.Day_21.Main is begin Put_Line ("Day-21"); end Adventofcode.Day_21.Main;
pdaxrom/Kino2
Ada
3,514
ads
------------------------------------------------------------------------------ -- -- -- GNAT ncurses Binding -- -- -- -- Terminal_Interface.Curses.Forms.Field_Types.Numeric -- -- -- -- S P E C -- -- -- ------------------------------------------------------------------------------ -- Copyright (c) 1998 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: Juergen Pfeifer, 1996 -- Contact: http://www.familiepfeifer.de/Contact.aspx?Lang=en -- Version Control: -- $Revision: 1.10 $ -- Binding Version 01.00 ------------------------------------------------------------------------------ package Terminal_Interface.Curses.Forms.Field_Types.Numeric is pragma Preelaborate (Terminal_Interface.Curses.Forms.Field_Types.Numeric); type Numeric_Field is new Field_Type with record Precision : Natural; Lower_Limit : Float; Upper_Limit : Float; end record; procedure Set_Field_Type (Fld : in Field; Typ : in Numeric_Field); pragma Inline (Set_Field_Type); end Terminal_Interface.Curses.Forms.Field_Types.Numeric;
stcarrez/ada-awa
Ada
1,465
ads
----------------------------------------------------------------------- -- awa-wikis -- Wiki module -- Copyright (C) 2011, 2018 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. ----------------------------------------------------------------------- -- = Wikis Module = -- The `Wikis` module provides a complete wiki system which allows users to create -- their own wiki environment with their wiki pages. -- -- @include awa-wikis-modules.ads -- -- @include awa-wikis-beans.ads -- -- == Queries == -- @include-query wiki-page.xml -- @include-query wiki-pages.xml -- @include-query wiki-history.xml -- @include-query wiki-list.xml -- @include-query wiki-images.xml -- @include-query wiki-images-info.xml -- @include-query wiki-stat.xml -- -- == Data model == -- [images/awa_wikis_model.png] -- package AWA.Wikis is pragma Preelaborate; end AWA.Wikis;
charlie5/cBound
Ada
1,340
ads
-- This file is generated by SWIG. Please do not modify by hand. -- with Interfaces.C; with Interfaces.C; with Interfaces.C.Pointers; package xcb.xcb_query_colors_cookie_t is -- Item -- type Item is record sequence : aliased Interfaces.C.unsigned; end record; -- Item_Array -- type Item_Array is array (Interfaces.C.size_t range <>) of aliased xcb.xcb_query_colors_cookie_t .Item; -- Pointer -- package C_Pointers is new Interfaces.C.Pointers (Index => Interfaces.C.size_t, Element => xcb.xcb_query_colors_cookie_t.Item, Element_Array => xcb.xcb_query_colors_cookie_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_colors_cookie_t .Pointer; -- Pointer_Pointer -- package C_Pointer_Pointers is new Interfaces.C.Pointers (Index => Interfaces.C.size_t, Element => xcb.xcb_query_colors_cookie_t.Pointer, Element_Array => xcb.xcb_query_colors_cookie_t.Pointer_Array, Default_Terminator => null); subtype Pointer_Pointer is C_Pointer_Pointers.Pointer; end xcb.xcb_query_colors_cookie_t;
reznikmm/matreshka
Ada
14,073
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_Packageable_Elements; with AMF.UML.Classifiers.Collections; with AMF.UML.Dependencies.Collections; with AMF.UML.Deployments.Collections; with AMF.UML.Enumeration_Literals; with AMF.UML.Enumerations; with AMF.UML.Named_Elements; with AMF.UML.Namespaces; with AMF.UML.Packageable_Elements.Collections; with AMF.UML.Packages.Collections; with AMF.UML.Parameterable_Elements; with AMF.UML.Slots.Collections; with AMF.UML.String_Expressions; with AMF.UML.Template_Parameters; with AMF.UML.Value_Specifications; with AMF.Visitors; package AMF.Internals.UML_Enumeration_Literals is type UML_Enumeration_Literal_Proxy is limited new AMF.Internals.UML_Packageable_Elements.UML_Packageable_Element_Proxy and AMF.UML.Enumeration_Literals.UML_Enumeration_Literal with null record; overriding function Get_Classifier (Self : not null access constant UML_Enumeration_Literal_Proxy) return AMF.UML.Enumerations.UML_Enumeration_Access; -- Getter of EnumerationLiteral::classifier. -- -- The classifier of this EnumerationLiteral derived to be equal to its -- enumeration. overriding function Get_Enumeration (Self : not null access constant UML_Enumeration_Literal_Proxy) return AMF.UML.Enumerations.UML_Enumeration_Access; -- Getter of EnumerationLiteral::enumeration. -- -- The Enumeration that this EnumerationLiteral is a member of. overriding procedure Set_Enumeration (Self : not null access UML_Enumeration_Literal_Proxy; To : AMF.UML.Enumerations.UML_Enumeration_Access); -- Setter of EnumerationLiteral::enumeration. -- -- The Enumeration that this EnumerationLiteral is a member of. overriding function Get_Classifier (Self : not null access constant UML_Enumeration_Literal_Proxy) return AMF.UML.Classifiers.Collections.Set_Of_UML_Classifier; -- Getter of InstanceSpecification::classifier. -- -- The classifier or classifiers of the represented instance. If multiple -- classifiers are specified, the instance is classified by all of them. overriding function Get_Slot (Self : not null access constant UML_Enumeration_Literal_Proxy) return AMF.UML.Slots.Collections.Set_Of_UML_Slot; -- Getter of InstanceSpecification::slot. -- -- A slot giving the value or values of a structural feature of the -- instance. An instance specification can have one slot per structural -- feature of its classifiers, including inherited features. It is not -- necessary to model a slot for each structural feature, in which case -- the instance specification is a partial description. overriding function Get_Specification (Self : not null access constant UML_Enumeration_Literal_Proxy) return AMF.UML.Value_Specifications.UML_Value_Specification_Access; -- Getter of InstanceSpecification::specification. -- -- A specification of how to compute, derive, or construct the instance. overriding procedure Set_Specification (Self : not null access UML_Enumeration_Literal_Proxy; To : AMF.UML.Value_Specifications.UML_Value_Specification_Access); -- Setter of InstanceSpecification::specification. -- -- A specification of how to compute, derive, or construct the instance. overriding function Get_Deployed_Element (Self : not null access constant UML_Enumeration_Literal_Proxy) return AMF.UML.Packageable_Elements.Collections.Set_Of_UML_Packageable_Element; -- Getter of DeploymentTarget::deployedElement. -- -- The set of elements that are manifested in an Artifact that is involved -- in Deployment to a DeploymentTarget. overriding function Get_Deployment (Self : not null access constant UML_Enumeration_Literal_Proxy) return AMF.UML.Deployments.Collections.Set_Of_UML_Deployment; -- Getter of DeploymentTarget::deployment. -- -- The set of Deployments for a DeploymentTarget. overriding function Get_Client_Dependency (Self : not null access constant UML_Enumeration_Literal_Proxy) return AMF.UML.Dependencies.Collections.Set_Of_UML_Dependency; -- Getter of NamedElement::clientDependency. -- -- Indicates the dependencies that reference the client. overriding function Get_Name_Expression (Self : not null access constant UML_Enumeration_Literal_Proxy) return AMF.UML.String_Expressions.UML_String_Expression_Access; -- Getter of NamedElement::nameExpression. -- -- The string expression used to define the name of this named element. overriding procedure Set_Name_Expression (Self : not null access UML_Enumeration_Literal_Proxy; To : AMF.UML.String_Expressions.UML_String_Expression_Access); -- Setter of NamedElement::nameExpression. -- -- The string expression used to define the name of this named element. overriding function Get_Namespace (Self : not null access constant UML_Enumeration_Literal_Proxy) return AMF.UML.Namespaces.UML_Namespace_Access; -- Getter of NamedElement::namespace. -- -- Specifies the namespace that owns the NamedElement. overriding function Get_Qualified_Name (Self : not null access constant UML_Enumeration_Literal_Proxy) return AMF.Optional_String; -- Getter of NamedElement::qualifiedName. -- -- A name which allows the NamedElement to be identified within a -- hierarchy of nested Namespaces. It is constructed from the names of the -- containing namespaces starting at the root of the hierarchy and ending -- with the name of the NamedElement itself. overriding function Get_Owning_Template_Parameter (Self : not null access constant UML_Enumeration_Literal_Proxy) return AMF.UML.Template_Parameters.UML_Template_Parameter_Access; -- Getter of ParameterableElement::owningTemplateParameter. -- -- The formal template parameter that owns this element. overriding procedure Set_Owning_Template_Parameter (Self : not null access UML_Enumeration_Literal_Proxy; To : AMF.UML.Template_Parameters.UML_Template_Parameter_Access); -- Setter of ParameterableElement::owningTemplateParameter. -- -- The formal template parameter that owns this element. overriding function Get_Template_Parameter (Self : not null access constant UML_Enumeration_Literal_Proxy) return AMF.UML.Template_Parameters.UML_Template_Parameter_Access; -- Getter of ParameterableElement::templateParameter. -- -- The template parameter that exposes this element as a formal parameter. overriding procedure Set_Template_Parameter (Self : not null access UML_Enumeration_Literal_Proxy; To : AMF.UML.Template_Parameters.UML_Template_Parameter_Access); -- Setter of ParameterableElement::templateParameter. -- -- The template parameter that exposes this element as a formal parameter. overriding function Classifier (Self : not null access constant UML_Enumeration_Literal_Proxy) return AMF.UML.Enumerations.UML_Enumeration_Access; -- Operation EnumerationLiteral::classifier. -- -- Missing derivation for EnumerationLiteral::/classifier : Enumeration overriding function Deployed_Element (Self : not null access constant UML_Enumeration_Literal_Proxy) return AMF.UML.Packageable_Elements.Collections.Set_Of_UML_Packageable_Element; -- Operation DeploymentTarget::deployedElement. -- -- Missing derivation for DeploymentTarget::/deployedElement : -- PackageableElement overriding function All_Owning_Packages (Self : not null access constant UML_Enumeration_Literal_Proxy) return AMF.UML.Packages.Collections.Set_Of_UML_Package; -- Operation NamedElement::allOwningPackages. -- -- The query allOwningPackages() returns all the directly or indirectly -- owning packages. overriding function Is_Distinguishable_From (Self : not null access constant UML_Enumeration_Literal_Proxy; N : AMF.UML.Named_Elements.UML_Named_Element_Access; Ns : AMF.UML.Namespaces.UML_Namespace_Access) return Boolean; -- Operation NamedElement::isDistinguishableFrom. -- -- The query isDistinguishableFrom() determines whether two NamedElements -- may logically co-exist within a Namespace. By default, two named -- elements are distinguishable if (a) they have unrelated types or (b) -- they have related types but different names. overriding function Namespace (Self : not null access constant UML_Enumeration_Literal_Proxy) return AMF.UML.Namespaces.UML_Namespace_Access; -- Operation NamedElement::namespace. -- -- Missing derivation for NamedElement::/namespace : Namespace overriding function Is_Compatible_With (Self : not null access constant UML_Enumeration_Literal_Proxy; P : AMF.UML.Parameterable_Elements.UML_Parameterable_Element_Access) return Boolean; -- Operation ParameterableElement::isCompatibleWith. -- -- The query isCompatibleWith() determines if this parameterable element -- is compatible with the specified parameterable element. By default -- parameterable element P is compatible with parameterable element Q if -- the kind of P is the same or a subtype as the kind of Q. Subclasses -- should override this operation to specify different compatibility -- constraints. overriding function Is_Template_Parameter (Self : not null access constant UML_Enumeration_Literal_Proxy) return Boolean; -- Operation ParameterableElement::isTemplateParameter. -- -- The query isTemplateParameter() determines if this parameterable -- element is exposed as a formal template parameter. overriding procedure Enter_Element (Self : not null access constant UML_Enumeration_Literal_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_Enumeration_Literal_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_Enumeration_Literal_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_Enumeration_Literals;
AdaCore/Ada_Drivers_Library
Ada
2,974
ads
------------------------------------------------------------------------------ -- -- -- Copyright (C) 2015-2022, 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 STM32.Device; use STM32.Device; with Serial_IO; use Serial_IO; with Serial_IO.Streaming; package Peripherals_Streaming is -- the USART selection is arbitrary but the AF number and the pins must -- be those required by that USART Peripheral : aliased Serial_IO.Peripheral_Descriptor := (Transceiver => USART_1'Access, Transceiver_AF => GPIO_AF_USART1_7, Tx_Pin => PB6, Rx_Pin => PB7); COM : aliased Streaming.Serial_Port (Peripheral'Access); end Peripherals_Streaming;
stcarrez/ada-wiki
Ada
5,040
adb
----------------------------------------------------------------------- -- convert -- Convert a wiki format into another -- Copyright (C) 2022 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.Text_IO; with Ada.Wide_Wide_Text_IO; with Ada.IO_Exceptions; with Ada.Strings.Unbounded; with Ada.Strings.UTF_Encoding.Wide_Wide_Strings; with GNAT.Command_Line; with Util.Files; with Util.Strings.Transforms; with Wiki.Strings; with Wiki.Filters.Html; with Wiki.Filters.TOC; with Wiki.Streams.Builders; with Wiki.Render.Wiki; with Wiki.Documents; with Wiki.Parsers; procedure Convert is use GNAT.Command_Line; use Ada.Strings.Unbounded; use Ada.Strings.UTF_Encoding; procedure Usage; procedure Parse (Content : in String); procedure Print (Item : in Wiki.Strings.WString); function To_Syntax (Name : in String) return Wiki.Wiki_Syntax; Html_Filter : aliased Wiki.Filters.Html.Html_Filter_Type; TOC : aliased Wiki.Filters.TOC.TOC_Filter; Count : Natural := 0; Src_Syntax : Wiki.Wiki_Syntax := Wiki.SYNTAX_MARKDOWN; Dst_Syntax : Wiki.Wiki_Syntax := Wiki.SYNTAX_MARKDOWN; procedure Usage is begin Ada.Text_IO.Put_Line ("Convert a wiki file from one format to another"); Ada.Text_IO.Put_Line ("Usage: convert [-s format] [-d format] file..."); Ada.Text_IO.Put_Line (" -s format Define the source file format"); Ada.Text_IO.Put_Line (" -d format Define the destination file format"); end Usage; procedure Print (Item : in Wiki.Strings.WString) is begin Ada.Wide_Wide_Text_IO.Put (Item); end Print; procedure Parse (Content : in String) is Doc : Wiki.Documents.Document; Engine : Wiki.Parsers.Parser; Stream : aliased Wiki.Streams.Builders.Output_Builder_Stream; Renderer : aliased Wiki.Render.Wiki.Wiki_Renderer; begin Engine.Add_Filter (TOC'Unchecked_Access); Engine.Add_Filter (Html_Filter'Unchecked_Access); Engine.Set_Syntax (Src_Syntax); Engine.Parse (Wide_Wide_Strings.Decode (Content), Doc); Renderer.Set_Output_Stream (Stream'Unchecked_Access, Dst_Syntax); Renderer.Render (Doc); Stream.Iterate (Print'Access); Ada.Wide_Wide_Text_IO.New_Line; end Parse; function To_Syntax (Name : in String) return Wiki.Wiki_Syntax is begin if Name = "markdown" then return Wiki.SYNTAX_MARKDOWN; end if; if Name = "dotclear" then return Wiki.SYNTAX_DOTCLEAR; end if; if Name = "creole" then return Wiki.SYNTAX_CREOLE; end if; if Name = "textile" then return Wiki.SYNTAX_TEXTILE; end if; if Name = "mediawiki" then return Wiki.SYNTAX_MEDIA_WIKI; end if; if Name = "html" then return Wiki.SYNTAX_HTML; end if; return Wiki.SYNTAX_MARKDOWN; end To_Syntax; begin loop case Getopt ("s: d:") is when 's' => declare Value : constant String := Util.Strings.Transforms.To_Lower_Case (Parameter); begin Src_Syntax := To_Syntax (Value); exception when Constraint_Error => Ada.Text_IO.Put_Line ("Invalid source format " & Value); end; when 'd' => declare Value : constant String := Util.Strings.Transforms.To_Lower_Case (Parameter); begin Dst_Syntax := To_Syntax (Value); exception when Constraint_Error => Ada.Text_IO.Put_Line ("Invalid source format " & Value); end; when others => exit; end case; end loop; loop declare Name : constant String := GNAT.Command_Line.Get_Argument; Data : Unbounded_String; begin if Name = "" then if Count = 0 then Usage; end if; return; end if; Count := Count + 1; Util.Files.Read_File (Name, Data); Parse (To_String (Data)); exception when Ada.IO_Exceptions.Name_Error => Ada.Text_IO.Put_Line ("Cannot read file '" & Name & "'"); end; end loop; exception when Invalid_Switch => Ada.Text_IO.Put_Line ("Invalid option."); Usage; end Convert;
zhmu/ananas
Ada
368
adb
-- { dg-do run } procedure kill_value is type Struct; type Pstruct is access all Struct; type Struct is record Next : Pstruct; end record; Vap : Pstruct := new Struct; begin for J in 1 .. 10 loop if Vap /= null then while Vap /= null loop Vap := Vap.Next; end loop; end if; end loop; end;
Rodeo-McCabe/orka
Ada
1,918
adb
-- SPDX-License-Identifier: Apache-2.0 -- -- Copyright (c) 2013 Felix Krause <[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; with Ada.Task_Identification; with Glfw.API; with Glfw.Enums; package body Glfw is use Ada.Task_Identification; procedure Init is pragma Assert (Current_Task = Environment_Task); use type Interfaces.C.int; begin -- Is True by default for compatibility with earlier versions of GLFW API.Init_Hint (Enums.Joystick_Hat_Buttons, False); if API.Init = 0 then raise Initialization_Exception; end if; end Init; procedure Shutdown is pragma Assert (Current_Task = Environment_Task); begin API.Glfw_Terminate; end Shutdown; procedure Version (Major, Minor, Rev : out Natural) is Raw_Major, Raw_Minor, Raw_Rev : C.int; begin API.Get_Version (Raw_Major, Raw_Minor, Raw_Rev); Major := Natural (Raw_Major); Minor := Natural (Raw_Minor); Rev := Natural (Raw_Rev); end Version; function Version_String return String is begin return Interfaces.C.Strings.Value (API.Get_Version_String); end Version_String; function Extension_Supported (Name : String) return Boolean is begin return Boolean (API.Extension_Supported (Interfaces.C.To_C (Name))); end Extension_Supported; end Glfw;
AdaCore/libadalang
Ada
16,467
adb
with Langkit_Support.Text; package body Highlighter is package Chars renames Langkit_Support.Text.Chars; use type LALCO.Token_Reference; use type LALCO.Ada_Node_Kind_Type; use Libadalang.Common; Basic_Highlights : constant array (LALCO.Token_Kind) of Highlight_Type := (Ada_Termination => Text, Ada_Lexing_Failure => Text, Ada_Identifier => Identifier, Ada_All .. Ada_Return | Ada_Elsif | Ada_Reverse | Ada_End .. Ada_Select | Ada_Exception | Ada_Separate | Ada_Exit | Ada_Others | Ada_For | Ada_Out | Ada_Function | Ada_At | Ada_Generic .. Ada_Body | Ada_Then .. Ada_In | Ada_Is .. Ada_Declare | Ada_Delay | Ada_When | Ada_Loop | Ada_While | Ada_Renames | Ada_Do => Keyword, Ada_Subtype | Ada_Record => Keyword_Type, Ada_Access | Ada_Array | Ada_Constant | Ada_Delta | Ada_Digits | Ada_Limited | Ada_Of | Ada_Private | Ada_Range => Keyword_Special, Ada_Par_Close .. Ada_Dot => Punctuation_Special, Ada_Diamond => Keyword, Ada_Abs | Ada_And | Ada_Mod | Ada_Not | Ada_Or | Ada_Rem | Ada_Xor | Ada_Lte .. Ada_Divide => Operator, Ada_Tick => Punctuation, Ada_Pipe | Ada_Assign => Punctuation_Special, Ada_Label_Start .. Ada_Label_End => Label_Name, Ada_String => String_Literal, Ada_Target => Operator, Ada_Char => Character_Literal, Ada_With => Keyword, Ada_Decimal => Integer_Literal, Ada_Integer => Integer_Literal, Ada_Comment => Comment, Ada_Whitespace => Text, Ada_Prep_Line => Preprocessor_Directive); -- For each token kind, associate a default highlighting type procedure Highlight_Name (Name : LAL.Name'Class; HL : Highlight_Type; Highlights : in out Highlights_Holder); -- Assign the HL highlighting type to the main identifiers in Name procedure Highlight_Block_Name (Name : LAL.Name'Class; Highlights : in out Highlights_Holder); -- Assign the Block_Name highlighting type to the main identifiers in Name procedure Highlight_Attribute_Ref (Id : LAL.Identifier'Class; Highlights : in out Highlights_Holder); -- Assign the Attribute_Name highlighting type to the "'Name" tokens in Id procedure Highlight_Type_Expr (Expr : LAL.Type_Expr'Class; Highlights : in out Highlights_Holder); -- Assign the Type_Name highlighting type to the main type name in Expr --------- -- Get -- --------- function Get (Highlights : Highlights_Holder; Token : LALCO.Token_Data_Type) return Highlight_Type is Index : constant Token_Index := LALCO.Index (Token); begin return (if LALCO.Is_Trivia (Token) then Highlights.Trivia_Highlights (Index) else Highlights.Token_Highlights (Index)); end Get; --------- -- Set -- --------- procedure Set (Highlights : in out Highlights_Holder; Token : LALCO.Token_Data_Type; HL : Highlight_Type) is Index : constant Token_Index := LALCO.Index (Token); begin if LALCO.Is_Trivia (Token) then Highlights.Trivia_Highlights (Index) := HL; else Highlights.Token_Highlights (Index) := HL; end if; end Set; --------------- -- Set_Range -- --------------- procedure Set_Range (Highlights : in out Highlights_Holder; First, Last : LALCO.Token_Reference; HL : Highlight_Type) is Cur : LALCO.Token_Reference := First; begin while Cur /= LALCO.No_Token loop Set (Highlights, LALCO.Data (Cur), HL); exit when Cur = Last; Cur := LALCO.Next (Cur, Exclude_Trivia => True); end loop; end Set_Range; -------------------- -- Highlight_Name -- -------------------- procedure Highlight_Name (Name : LAL.Name'Class; HL : Highlight_Type; Highlights : in out Highlights_Holder) is begin if Name.Is_Null then return; end if; case Name.Kind is when LALCO.Ada_Identifier | LALCO.Ada_String_Literal => -- Highlight the only token that this node has declare Tok : constant LALCO.Token_Reference := Name.As_Single_Tok_Node.Token_Start; begin Set (Highlights, LALCO.Data (Tok), HL); end; when LALCO.Ada_Dotted_Name => -- Highlight both the prefix, the suffix and the dot token declare Dotted_Name : constant LAL.Dotted_Name := Name.As_Dotted_Name; Dot_Token : constant LALCO.Token_Reference := LALCO.Next (Dotted_Name.F_Prefix.Token_End, Exclude_Trivia => True); begin Highlight_Name (Dotted_Name.F_Prefix, HL, Highlights); Set (Highlights, LALCO.Data (Dot_Token), HL); Highlight_Name (Dotted_Name.F_Suffix, HL, Highlights); end; when LALCO.Ada_Call_Expr => -- Just highlight the name of the called entity Highlight_Name (Name.As_Call_Expr.F_Name, HL, Highlights); when LALCO.Ada_Defining_Name => -- Highlight inner name Highlight_Name (Name.As_Defining_Name.F_Name, HL, Highlights); when others => return; end case; end Highlight_Name; -------------------------- -- Highlight_Block_Name -- -------------------------- procedure Highlight_Block_Name (Name : LAL.Name'Class; Highlights : in out Highlights_Holder) is begin if Name.Is_Null then return; end if; Highlight_Name (Name, Block_Name, Highlights); end Highlight_Block_Name; ----------------------------- -- Highlight_Attribute_Ref -- ----------------------------- procedure Highlight_Attribute_Ref (Id : LAL.Identifier'Class; Highlights : in out Highlights_Holder) is begin if Id.Is_Null then return; end if; -- Set style for both the attribute name and the leading 'tick' token Set (Highlights, LALCO.Data (LALCO.Previous (Id.Token_Start, Exclude_Trivia => True)), Attribute_Name); Set (Highlights, LALCO.Data (Id.Token_Start), Attribute_Name); end Highlight_Attribute_Ref; ------------------------- -- Highlight_Type_Expr -- ------------------------- procedure Highlight_Type_Expr (Expr : LAL.Type_Expr'Class; Highlights : in out Highlights_Holder) is begin if Expr.Is_Null then return; end if; case LAL.Kind (Expr) is when LALCO.Ada_Anonymous_Type => null; when LALCO.Ada_Subtype_Indication => Highlight_Name (Expr.As_Subtype_Indication.F_Name, Type_Name, Highlights); when others => -- There should be no other kind for a Type_Expr node raise Program_Error; end case; end Highlight_Type_Expr; --------------- -- Highlight -- --------------- procedure Highlight (Unit : LAL.Analysis_Unit; Highlights : in out Highlights_Holder) is function Syntax_Highlight (Node : LAL.Ada_Node'Class) return LALCO.Visit_Status; -- Function to be called on all AST nodes in Unit. This is the -- *syntax* highlighting algorithm entry point. ---------------------- -- Syntax_Highlight -- ---------------------- function Syntax_Highlight (Node : LAL.Ada_Node'Class) return LALCO.Visit_Status is begin case Node.Kind is ----------------- -- Block names -- ----------------- -- For constructs that define a scope with a name, highlight this -- name as a Block_Name. For instance: the name of a package, of a -- subprogram, of a type declaration, ... when LALCO.Ada_Base_Package_Decl => declare Pkg_Decl : constant LAL.Base_Package_Decl := Node.As_Base_Package_Decl; begin Highlight_Block_Name (Pkg_Decl.F_Package_Name, Highlights); end; when LALCO.Ada_Package_Body => declare Pkg_Body : constant LAL.Package_Body := Node.As_Package_Body; begin Highlight_Block_Name (Pkg_Body.F_Package_Name, Highlights); end; when LALCO.Ada_Package_Renaming_Decl => Highlight_Block_Name (Node.As_Package_Renaming_Decl.F_Name, Highlights); when LALCO.Ada_Generic_Package_Instantiation => Highlight_Block_Name (Node.As_Generic_Package_Instantiation.F_Name, Highlights); when LALCO.Ada_Generic_Subp_Instantiation => Highlight_Block_Name (Node.As_Generic_Subp_Instantiation.F_Subp_Name, Highlights); when LALCO.Ada_End_Name => Highlight_Block_Name (Node.As_End_Name.F_Name, Highlights); when LALCO.Ada_Subp_Spec => declare Subp_Spec : constant LAL.Subp_Spec := Node.As_Subp_Spec; Params : constant LAL.Param_Spec_Array := Subp_Spec.P_Params; begin Highlight_Block_Name (Subp_Spec.F_Subp_Name, Highlights); Highlight_Type_Expr (Subp_Spec.F_Subp_Returns, Highlights); for Param of Params loop Highlight_Type_Expr (Param.F_Type_Expr, Highlights); end loop; end; when LALCO.Ada_Type_Decl => Set (Highlights, LALCO.Data (Node.Token_Start), Keyword_Type); Highlight_Block_Name (Node.As_Type_Decl.F_Name, Highlights); when LALCO.Ada_Subtype_Decl => Highlight_Block_Name (Node.As_Subtype_Decl.F_Name, Highlights); when LALCO.Ada_Named_Stmt_Decl => Highlight_Block_Name (Node.As_Named_Stmt_Decl.F_Name, Highlights); -- TODO??? Still lots of nodes to handle! Protected types, tasks, -- etc. ---------------- -- Type names -- ---------------- -- When it's "useful" (for readers), highlight type names as -- Type_Name. when LALCO.Ada_Type_Access_Def => Highlight_Name (Node.As_Type_Access_Def.F_Subtype_Indication.P_Type_Name, Type_Name, Highlights); when LALCO.Ada_Object_Decl => Highlight_Type_Expr (Node.As_Object_Decl.F_Type_Expr, Highlights); when LALCO.Ada_Use_Type_Clause => declare Types : constant LAL.Name_List := Node.As_Use_Type_Clause.F_Types; begin for I in 1 .. Types.Children_Count loop Highlight_Name (Types.Child (I).As_Name, Type_Name, Highlights); end loop; end; when LALCO.Ada_Discriminant_Spec => Highlight_Type_Expr (Node.As_Discriminant_Spec.F_Type_Expr, Highlights); when LALCO.Ada_Component_Def => Highlight_Type_Expr (Node.As_Component_Def.F_Type_Expr, Highlights); ---------- -- Misc -- ---------- when LALCO.Ada_Attribute_Ref => Highlight_Attribute_Ref (Node.As_Attribute_Ref.F_Attribute, Highlights); when LALCO.Ada_Label_Decl => Highlight_Name (Node.As_Label_Decl.F_Name, Label_Name, Highlights); when LALCO.Ada_Record_Def => Set (Highlights, LALCO.Data (LALCO.Previous (Node.Token_End, Exclude_Trivia => True)), Keyword_Type); when LALCO.Ada_Null_Record_Def => Set_Range (Highlights, Node.Token_Start, Node.Token_End, Keyword_Type); when LALCO.Ada_Aspect_Spec => Set (Highlights, LALCO.Data (Node.Token_Start), Keyword_Special); when LALCO.Ada_Quantified_Expr => Set (Highlights, LALCO.Data (LALCO.Next (Node.Token_Start, Exclude_Trivia => True)), Operator); when LALCO.Ada_Op => if Node.Kind /= LALCO.Ada_Op_Double_Dot then Set_Range (Highlights, Node.Token_Start, Node.Token_End, Operator); end if; when others => null; end case; return LALCO.Into; end Syntax_Highlight; Token : LALCO.Token_Reference := LAL.First_Token (Unit); -- Start of processing for Highlight begin -- Lexical pass: first, assign a "default" highlighting to all tokens -- just based on their kind. Also build the list of subhighlights. while Token /= LALCO.No_Token loop declare TD : constant LALCO.Token_Data_Type := LALCO.Data (Token); HL : constant Highlight_Type := Basic_Highlights (LALCO.Kind (TD)); begin Set (Highlights, TD, HL); -- Some keywords don't have a token kind, because they're reserved -- words in LAL. Highlight those too. if LAL.Is_Keyword (Token, Libadalang.Common.Ada_2012) then Set (Highlights, TD, Keyword); end if; end; Token := LALCO.Next (Token); end loop; -- Syntactic pass: update highlighting for tokens depending on how they -- are used in the syntax tree (subprogram names, type names, etc). LAL.Traverse (LAL.Root (Unit), Syntax_Highlight'Access); end Highlight; ---------------- -- Put_Tokens -- ---------------- procedure Put_Tokens (Unit : LAL.Analysis_Unit; Highlights : Highlights_Holder) is Token : LALCO.Token_Reference := LAL.First_Token (Unit); begin while Token /= LALCO.No_Token loop declare TD : constant LALCO.Token_Data_Type := LALCO.Data (Token); HL : constant Highlight_Type := Get (Highlights, TD); begin if LALCO.Kind (TD) = Ada_Whitespace then -- If this is a whitespace token, transmit its code layout -- change to the HTML document as appropriate. for C of Langkit_Support.Text.Text_Type'(LALCO.Text (Token)) loop case C is when ' ' | Chars.HT | Chars.FF | Chars.CR => declare ASCII_C : constant Character := Character'Val (Langkit_Support.Text.Character_Type'Pos (C)); begin Add_Whitespace (ASCII_C); end; when Chars.LF => New_Line; when others => -- Whitespace tokens are not supposed to contain any -- other character. raise Program_Error; end case; end loop; else Put_Token (Token, TD, HL); end if; end; Token := LALCO.Next (Token); end loop; end Put_Tokens; end Highlighter;
reznikmm/matreshka
Ada
3,405
ads
------------------------------------------------------------------------------ -- -- -- 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$ ------------------------------------------------------------------------------ package ODF.DOM.Attributes.SVG is end ODF.DOM.Attributes.SVG;
onox/orka
Ada
7,620
ads
-- SPDX-License-Identifier: Apache-2.0 -- -- Copyright (c) 2017 onox <[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 GL.Low_Level.Enums; with GL.Objects.Programs.Uniforms; with GL.Objects.Textures; with GL.Pixels.Extensions; with Orka.Rendering.Textures; with Orka.Types; package Orka.Rendering.Programs.Uniforms is pragma Preelaborate; package LE renames GL.Low_Level.Enums; package PE renames GL.Pixels.Extensions; use type LE.Texture_Kind; use type LE.Resource_Type; use type PE.Format_Type; ----------------------------------------------------------------------------- function Texture_Kind (Sampler : LE.Resource_Type) return LE.Texture_Kind; function Image_Kind (Image : LE.Resource_Type) return LE.Texture_Kind; function Sampler_Format_Type (Sampler : LE.Resource_Type) return PE.Format_Type; function Image_Format_Type (Image : LE.Resource_Type) return PE.Format_Type; ----------------------------------------------------------------------------- type Uniform (Kind : LE.Resource_Type) is tagged private; procedure Set_Matrix (Object : Uniform; Value : Types.Singles.Matrix4) with Pre => Object.Kind = LE.Single_Matrix4; procedure Set_Matrix (Object : Uniform; Value : Types.Doubles.Matrix4) with Pre => Object.Kind = LE.Double_Matrix4; procedure Set_Vector (Object : Uniform; Value : Types.Singles.Vector4) with Pre => Object.Kind = LE.Single_Vec4; procedure Set_Vector (Object : Uniform; Value : Types.Doubles.Vector4) with Pre => Object.Kind = LE.Double_Vec4; ----------------------------------------------------------------------------- procedure Set_Vector (Object : Uniform; Data : Integer_32_Array) with Pre => (case Object.Kind is when LE.Int_Vec2 => Data'Length = 2, when LE.Int_Vec3 => Data'Length = 3, when LE.Int_Vec4 => Data'Length = 4, when others => raise Constraint_Error); procedure Set_Vector (Object : Uniform; Data : Unsigned_32_Array) with Pre => (case Object.Kind is when LE.UInt_Vec2 => Data'Length = 2, when LE.UInt_Vec3 => Data'Length = 3, when LE.UInt_Vec4 => Data'Length = 4, when others => raise Constraint_Error); procedure Set_Vector (Object : Uniform; Data : Float_32_Array) with Pre => (case Object.Kind is when LE.Single_Vec2 => Data'Length = 2, when LE.Single_Vec3 => Data'Length = 3, when LE.Single_Vec4 => Data'Length = 4, when others => raise Constraint_Error); procedure Set_Vector (Object : Uniform; Data : Float_64_Array) with Pre => (case Object.Kind is when LE.Double_Vec2 => Data'Length = 2, when LE.Double_Vec3 => Data'Length = 3, when LE.Double_Vec4 => Data'Length = 4, when others => raise Constraint_Error); ----------------------------------------------------------------------------- procedure Set_Single (Object : Uniform; Value : Float_32) with Pre => Object.Kind = LE.Single_Type; procedure Set_Double (Object : Uniform; Value : Float_64) with Pre => Object.Kind = LE.Double_Type; procedure Set_Int (Object : Uniform; Value : Integer_32) with Pre => Object.Kind = LE.Int_Type; procedure Set_UInt (Object : Uniform; Value : Unsigned_32) with Pre => Object.Kind = LE.UInt_Type; procedure Set_Integer (Object : Uniform; Value : Integer) with Pre => Object.Kind = LE.Int_Type; procedure Set_Boolean (Object : Uniform; Value : Boolean) with Pre => Object.Kind = LE.Bool_Type; ----------------------------------------------------------------------------- type Uniform_Sampler (Kind : LE.Resource_Type) is tagged private; procedure Verify_Compatibility (Object : Uniform_Sampler; Texture : GL.Objects.Textures.Texture) is null with Pre'Class => (Texture.Kind = Texture_Kind (Object.Kind) or else raise Constraint_Error with "Cannot bind " & Rendering.Textures.Image (Texture) & " to " & Texture_Kind (Object.Kind)'Image & " sampler") and then -- If the texture is a depth texture, the sampler can be a normal or shadow sampler -- (The bound Sampler object must have comparison mode enabled iff the sampler in the -- shader is a shadow sampler) (Texture.Compressed or else (if PE.Texture_Format_Type (Texture.Internal_Format) = PE.Depth_Type then Sampler_Format_Type (Object.Kind) in PE.Depth_Type | PE.Float_Or_Normalized_Type else Sampler_Format_Type (Object.Kind) = PE.Texture_Format_Type (Texture.Internal_Format)) or else raise Constraint_Error with "Cannot bind " & Rendering.Textures.Image (Texture) & " to " & Object.Kind'Image & " sampler"); ----------------------------------------------------------------------------- type Uniform_Image (Kind : LE.Resource_Type) is tagged private; procedure Verify_Compatibility (Object : Uniform_Image; Texture : GL.Objects.Textures.Texture) is null with Pre'Class => (Texture.Kind = Image_Kind (Object.Kind) or else raise Constraint_Error with "Cannot bind " & Rendering.Textures.Image (Texture) & " to " & Image_Kind (Object.Kind)'Image & " image sampler") and then -- If the texture is a depth texture, the sampler can be a normal or shadow sampler -- (The bound Sampler object must have comparison mode enabled iff the sampler in the -- shader is a shadow sampler) (Texture.Compressed or else Sampler_Format_Type (Object.Kind) = PE.Image_Format_Type (Texture.Internal_Format) or else raise Constraint_Error with "Cannot bind " & Rendering.Textures.Image (Texture) & " to " & Object.Kind'Image & " image sampler"); ----------------------------------------------------------------------------- function Create_Uniform_Sampler (Object : Program; Name : String) return Uniform_Sampler; function Create_Uniform_Image (Object : Program; Name : String) return Uniform_Image; function Create_Uniform_Variable (Object : Program; Name : String) return Uniform; Uniform_Inactive_Error : exception renames GL.Objects.Programs.Uniform_Inactive_Error; Uniform_Type_Error : exception; private type Uniform (Kind : LE.Resource_Type) is tagged record GL_Uniform : GL.Objects.Programs.Uniforms.Uniform; end record; type Uniform_Sampler (Kind : LE.Resource_Type) is tagged record GL_Uniform : GL.Objects.Programs.Uniforms.Uniform; end record; type Uniform_Image (Kind : LE.Resource_Type) is tagged record GL_Uniform : GL.Objects.Programs.Uniforms.Uniform; end record; end Orka.Rendering.Programs.Uniforms;
reznikmm/matreshka
Ada
3,657
adb
------------------------------------------------------------------------------ -- -- -- 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$ ------------------------------------------------------------------------------ package body AMF.DC.Point_Collections.Internals is --------------- -- To_Holder -- --------------- function To_Holder (Item : AMF.DC.Sequence_OF_DC_Point) return League.Holders.Holder is begin return League.Holders.Empty_Holder; end To_Holder; end AMF.DC.Point_Collections.Internals;
reznikmm/matreshka
Ada
6,860
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_Text.Sender_Fax_Elements is ------------ -- Create -- ------------ overriding function Create (Parameters : not null access Matreshka.DOM_Elements.Element_L2_Parameters) return Text_Sender_Fax_Element_Node is begin return Self : Text_Sender_Fax_Element_Node do Matreshka.ODF_Text.Constructors.Initialize (Self'Unchecked_Access, Parameters.Document, Matreshka.ODF_String_Constants.Text_Prefix); end return; end Create; ---------------- -- Enter_Node -- ---------------- overriding procedure Enter_Node (Self : not null access Text_Sender_Fax_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_Text_Sender_Fax (ODF.DOM.Text_Sender_Fax_Elements.ODF_Text_Sender_Fax_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 Text_Sender_Fax_Element_Node) return League.Strings.Universal_String is pragma Unreferenced (Self); begin return Matreshka.ODF_String_Constants.Sender_Fax_Element; end Get_Local_Name; ---------------- -- Leave_Node -- ---------------- overriding procedure Leave_Node (Self : not null access Text_Sender_Fax_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_Text_Sender_Fax (ODF.DOM.Text_Sender_Fax_Elements.ODF_Text_Sender_Fax_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 Text_Sender_Fax_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_Text_Sender_Fax (Visitor, ODF.DOM.Text_Sender_Fax_Elements.ODF_Text_Sender_Fax_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.Text_URI, Matreshka.ODF_String_Constants.Sender_Fax_Element, Text_Sender_Fax_Element_Node'Tag); end Matreshka.ODF_Text.Sender_Fax_Elements;
nineties-retro/lissajous
Ada
2,462
adb
with Ada.Numerics; use Ada.Numerics; with Ada.Numerics.Generic_Elementary_Functions; with Ada.Text_IO; package body Lissajous is Output_Line_Length: constant := 72; package Real_Functions is new Ada.Numerics.Generic_Elementary_Functions(Real); function Sign(X:Real) return Integer is begin if X < 0.0 then return -1; elsif X > 0.0 then return 1; else return 0; end if; end Sign; function Foo(X:Real) return Real is begin if Abs(X) < 0.1 then return X + X**3/6.0 + 0.075*X**5 + x**7/22.4; else return 2.0*Foo(X/(Real_Functions.Sqrt(1.0+X)+Real_Functions.Sqrt(1.0-X))); end if; end Foo; procedure Run (Relative_X_Frequency: Positive; Relative_Y_Frequency: Positive; Y_Phase: Real) is X_Frequency: constant Real := Real(Relative_X_Frequency) * 2.0 * Pi; Y_Frequency: constant Real := Real(Relative_Y_Frequency) * 2.0 * Pi; Y: array (0..2*Relative_X_Frequency) of Integer; Line: String(1..79); begin for X1 in -Output_Line_Length/4 .. Output_Line_Length/4 loop declare T1: constant Real := Foo(Real(X1)/Real(Output_Line_Length/4)); T2: constant Real := Pi-T1; begin for I in 0 .. Relative_X_Frequency-1 loop declare T3: constant Real := (T1+2.0*Real(I)*Pi)/X_Frequency; T4: constant Real := (T2+2.0*Real(I)*Pi)/X_Frequency; Y1: constant Real := 30.0*Real_Functions.Sin(Y_Frequency*T3+Y_Phase*Pi); Y2: constant Real := 30.0*Real_Functions.Sin(Y_Frequency*T4+Y_Phase*Pi); begin Y(2*I) := Sign(Y1)*Integer(Real'Unbiased_Rounding(Abs(Y1)+0.5)); Y(2*I+1) := Sign(Y2)*Integer(Real'Unbiased_Rounding(Abs(Y2)+0.5)); end; end loop; end; for J in 1 .. 2*Relative_X_Frequency-1 loop declare T: Integer := Y(J); I: Integer := J-1; begin if T < Y(I) then loop Y(I+1) := Y(I); I := I - 1; exit when I < 0; end loop; end if; Y(I+1) := T; end; end loop; Line := (Line'Range => ' '); for I in 0 .. 2*Relative_X_Frequency-1 loop if I = 0 or else Y(I) /= Y(I-1) then Line(Output_Line_Length/2+Y(i)) := '*'; end if; end loop; Ada.Text_IO.Put_Line(Line); end loop; end Run; end Lissajous;