repo_name
stringlengths
9
74
language
stringclasses
1 value
length_bytes
int64
11
9.34M
extension
stringclasses
2 values
content
stringlengths
11
9.34M
AdaCore/Ada_Drivers_Library
Ada
92,706
ads
-- Copyright (c) 2010 - 2018, 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: -- -- 1. Redistributions of source code must retain the above copyright notice, this -- list of conditions and the following disclaimer. -- -- 2. Redistributions in binary form, except as embedded into a Nordic -- Semiconductor ASA integrated circuit in a product or a software update for -- such product, 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 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. -- -- 4. This software, with or without modification, must only be used with a -- Nordic Semiconductor ASA integrated circuit. -- -- 5. Any software provided in binary form under this license must not be reverse -- engineered, decompiled, modified and/or disassembled. -- -- THIS SOFTWARE IS PROVIDED BY NORDIC SEMICONDUCTOR ASA "AS IS" AND ANY EXPRESS -- OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES -- OF MERCHANTABILITY, NONINFRINGEMENT, AND FITNESS FOR A PARTICULAR PURPOSE ARE -- DISCLAIMED. IN NO EVENT SHALL NORDIC SEMICONDUCTOR ASA 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 nrf52.svd pragma Restrictions (No_Elaboration_Code); pragma Ada_2012; pragma Style_Checks (Off); with HAL; with System; package NRF_SVD.MWU is pragma Preelaborate; --------------- -- Registers -- --------------- --------------------------------------- -- EVENTS_REGION cluster's Registers -- --------------------------------------- -- Unspecified type EVENTS_REGION_Cluster is record -- Description cluster[0]: Write access to region 0 detected WA : aliased HAL.UInt32; -- Description cluster[0]: Read access to region 0 detected RA : aliased HAL.UInt32; end record with Size => 64; for EVENTS_REGION_Cluster use record WA at 16#0# range 0 .. 31; RA at 16#4# range 0 .. 31; end record; -- Unspecified type EVENTS_REGION_Clusters is array (0 .. 3) of EVENTS_REGION_Cluster; ---------------------------------------- -- EVENTS_PREGION cluster's Registers -- ---------------------------------------- -- Unspecified type EVENTS_PREGION_Cluster is record -- Description cluster[0]: Write access to peripheral region 0 detected WA : aliased HAL.UInt32; -- Description cluster[0]: Read access to peripheral region 0 detected RA : aliased HAL.UInt32; end record with Size => 64; for EVENTS_PREGION_Cluster use record WA at 16#0# range 0 .. 31; RA at 16#4# range 0 .. 31; end record; -- Unspecified type EVENTS_PREGION_Clusters is array (0 .. 1) of EVENTS_PREGION_Cluster; -- Enable or disable interrupt for REGION[0].WA event type INTEN_REGION0WA_Field is (-- Disable Disabled, -- Enable Enabled) with Size => 1; for INTEN_REGION0WA_Field use (Disabled => 0, Enabled => 1); -- Enable or disable interrupt for REGION[0].RA event type INTEN_REGION0RA_Field is (-- Disable Disabled, -- Enable Enabled) with Size => 1; for INTEN_REGION0RA_Field use (Disabled => 0, Enabled => 1); -- Enable or disable interrupt for REGION[1].WA event type INTEN_REGION1WA_Field is (-- Disable Disabled, -- Enable Enabled) with Size => 1; for INTEN_REGION1WA_Field use (Disabled => 0, Enabled => 1); -- Enable or disable interrupt for REGION[1].RA event type INTEN_REGION1RA_Field is (-- Disable Disabled, -- Enable Enabled) with Size => 1; for INTEN_REGION1RA_Field use (Disabled => 0, Enabled => 1); -- Enable or disable interrupt for REGION[2].WA event type INTEN_REGION2WA_Field is (-- Disable Disabled, -- Enable Enabled) with Size => 1; for INTEN_REGION2WA_Field use (Disabled => 0, Enabled => 1); -- Enable or disable interrupt for REGION[2].RA event type INTEN_REGION2RA_Field is (-- Disable Disabled, -- Enable Enabled) with Size => 1; for INTEN_REGION2RA_Field use (Disabled => 0, Enabled => 1); -- Enable or disable interrupt for REGION[3].WA event type INTEN_REGION3WA_Field is (-- Disable Disabled, -- Enable Enabled) with Size => 1; for INTEN_REGION3WA_Field use (Disabled => 0, Enabled => 1); -- Enable or disable interrupt for REGION[3].RA event type INTEN_REGION3RA_Field is (-- Disable Disabled, -- Enable Enabled) with Size => 1; for INTEN_REGION3RA_Field use (Disabled => 0, Enabled => 1); -- Enable or disable interrupt for PREGION[0].WA event type INTEN_PREGION0WA_Field is (-- Disable Disabled, -- Enable Enabled) with Size => 1; for INTEN_PREGION0WA_Field use (Disabled => 0, Enabled => 1); -- Enable or disable interrupt for PREGION[0].RA event type INTEN_PREGION0RA_Field is (-- Disable Disabled, -- Enable Enabled) with Size => 1; for INTEN_PREGION0RA_Field use (Disabled => 0, Enabled => 1); -- Enable or disable interrupt for PREGION[1].WA event type INTEN_PREGION1WA_Field is (-- Disable Disabled, -- Enable Enabled) with Size => 1; for INTEN_PREGION1WA_Field use (Disabled => 0, Enabled => 1); -- Enable or disable interrupt for PREGION[1].RA event type INTEN_PREGION1RA_Field is (-- Disable Disabled, -- Enable Enabled) with Size => 1; for INTEN_PREGION1RA_Field use (Disabled => 0, Enabled => 1); -- Enable or disable interrupt type INTEN_Register is record -- Enable or disable interrupt for REGION[0].WA event REGION0WA : INTEN_REGION0WA_Field := NRF_SVD.MWU.Disabled; -- Enable or disable interrupt for REGION[0].RA event REGION0RA : INTEN_REGION0RA_Field := NRF_SVD.MWU.Disabled; -- Enable or disable interrupt for REGION[1].WA event REGION1WA : INTEN_REGION1WA_Field := NRF_SVD.MWU.Disabled; -- Enable or disable interrupt for REGION[1].RA event REGION1RA : INTEN_REGION1RA_Field := NRF_SVD.MWU.Disabled; -- Enable or disable interrupt for REGION[2].WA event REGION2WA : INTEN_REGION2WA_Field := NRF_SVD.MWU.Disabled; -- Enable or disable interrupt for REGION[2].RA event REGION2RA : INTEN_REGION2RA_Field := NRF_SVD.MWU.Disabled; -- Enable or disable interrupt for REGION[3].WA event REGION3WA : INTEN_REGION3WA_Field := NRF_SVD.MWU.Disabled; -- Enable or disable interrupt for REGION[3].RA event REGION3RA : INTEN_REGION3RA_Field := NRF_SVD.MWU.Disabled; -- unspecified Reserved_8_23 : HAL.UInt16 := 16#0#; -- Enable or disable interrupt for PREGION[0].WA event PREGION0WA : INTEN_PREGION0WA_Field := NRF_SVD.MWU.Disabled; -- Enable or disable interrupt for PREGION[0].RA event PREGION0RA : INTEN_PREGION0RA_Field := NRF_SVD.MWU.Disabled; -- Enable or disable interrupt for PREGION[1].WA event PREGION1WA : INTEN_PREGION1WA_Field := NRF_SVD.MWU.Disabled; -- Enable or disable interrupt for PREGION[1].RA event PREGION1RA : INTEN_PREGION1RA_Field := NRF_SVD.MWU.Disabled; -- unspecified Reserved_28_31 : HAL.UInt4 := 16#0#; end record with Volatile_Full_Access, Object_Size => 32, Bit_Order => System.Low_Order_First; for INTEN_Register use record REGION0WA at 0 range 0 .. 0; REGION0RA at 0 range 1 .. 1; REGION1WA at 0 range 2 .. 2; REGION1RA at 0 range 3 .. 3; REGION2WA at 0 range 4 .. 4; REGION2RA at 0 range 5 .. 5; REGION3WA at 0 range 6 .. 6; REGION3RA at 0 range 7 .. 7; Reserved_8_23 at 0 range 8 .. 23; PREGION0WA at 0 range 24 .. 24; PREGION0RA at 0 range 25 .. 25; PREGION1WA at 0 range 26 .. 26; PREGION1RA at 0 range 27 .. 27; Reserved_28_31 at 0 range 28 .. 31; end record; -- Write '1' to Enable interrupt for REGION[0].WA event type INTENSET_REGION0WA_Field is (-- Read: Disabled Disabled, -- Read: Enabled Enabled) with Size => 1; for INTENSET_REGION0WA_Field use (Disabled => 0, Enabled => 1); -- Write '1' to Enable interrupt for REGION[0].WA event type INTENSET_REGION0WA_Field_1 is (-- Reset value for the field Intenset_Region0Wa_Field_Reset, -- Enable Set) with Size => 1; for INTENSET_REGION0WA_Field_1 use (Intenset_Region0Wa_Field_Reset => 0, Set => 1); -- Write '1' to Enable interrupt for REGION[0].RA event type INTENSET_REGION0RA_Field is (-- Read: Disabled Disabled, -- Read: Enabled Enabled) with Size => 1; for INTENSET_REGION0RA_Field use (Disabled => 0, Enabled => 1); -- Write '1' to Enable interrupt for REGION[0].RA event type INTENSET_REGION0RA_Field_1 is (-- Reset value for the field Intenset_Region0Ra_Field_Reset, -- Enable Set) with Size => 1; for INTENSET_REGION0RA_Field_1 use (Intenset_Region0Ra_Field_Reset => 0, Set => 1); -- Write '1' to Enable interrupt for REGION[1].WA event type INTENSET_REGION1WA_Field is (-- Read: Disabled Disabled, -- Read: Enabled Enabled) with Size => 1; for INTENSET_REGION1WA_Field use (Disabled => 0, Enabled => 1); -- Write '1' to Enable interrupt for REGION[1].WA event type INTENSET_REGION1WA_Field_1 is (-- Reset value for the field Intenset_Region1Wa_Field_Reset, -- Enable Set) with Size => 1; for INTENSET_REGION1WA_Field_1 use (Intenset_Region1Wa_Field_Reset => 0, Set => 1); -- Write '1' to Enable interrupt for REGION[1].RA event type INTENSET_REGION1RA_Field is (-- Read: Disabled Disabled, -- Read: Enabled Enabled) with Size => 1; for INTENSET_REGION1RA_Field use (Disabled => 0, Enabled => 1); -- Write '1' to Enable interrupt for REGION[1].RA event type INTENSET_REGION1RA_Field_1 is (-- Reset value for the field Intenset_Region1Ra_Field_Reset, -- Enable Set) with Size => 1; for INTENSET_REGION1RA_Field_1 use (Intenset_Region1Ra_Field_Reset => 0, Set => 1); -- Write '1' to Enable interrupt for REGION[2].WA event type INTENSET_REGION2WA_Field is (-- Read: Disabled Disabled, -- Read: Enabled Enabled) with Size => 1; for INTENSET_REGION2WA_Field use (Disabled => 0, Enabled => 1); -- Write '1' to Enable interrupt for REGION[2].WA event type INTENSET_REGION2WA_Field_1 is (-- Reset value for the field Intenset_Region2Wa_Field_Reset, -- Enable Set) with Size => 1; for INTENSET_REGION2WA_Field_1 use (Intenset_Region2Wa_Field_Reset => 0, Set => 1); -- Write '1' to Enable interrupt for REGION[2].RA event type INTENSET_REGION2RA_Field is (-- Read: Disabled Disabled, -- Read: Enabled Enabled) with Size => 1; for INTENSET_REGION2RA_Field use (Disabled => 0, Enabled => 1); -- Write '1' to Enable interrupt for REGION[2].RA event type INTENSET_REGION2RA_Field_1 is (-- Reset value for the field Intenset_Region2Ra_Field_Reset, -- Enable Set) with Size => 1; for INTENSET_REGION2RA_Field_1 use (Intenset_Region2Ra_Field_Reset => 0, Set => 1); -- Write '1' to Enable interrupt for REGION[3].WA event type INTENSET_REGION3WA_Field is (-- Read: Disabled Disabled, -- Read: Enabled Enabled) with Size => 1; for INTENSET_REGION3WA_Field use (Disabled => 0, Enabled => 1); -- Write '1' to Enable interrupt for REGION[3].WA event type INTENSET_REGION3WA_Field_1 is (-- Reset value for the field Intenset_Region3Wa_Field_Reset, -- Enable Set) with Size => 1; for INTENSET_REGION3WA_Field_1 use (Intenset_Region3Wa_Field_Reset => 0, Set => 1); -- Write '1' to Enable interrupt for REGION[3].RA event type INTENSET_REGION3RA_Field is (-- Read: Disabled Disabled, -- Read: Enabled Enabled) with Size => 1; for INTENSET_REGION3RA_Field use (Disabled => 0, Enabled => 1); -- Write '1' to Enable interrupt for REGION[3].RA event type INTENSET_REGION3RA_Field_1 is (-- Reset value for the field Intenset_Region3Ra_Field_Reset, -- Enable Set) with Size => 1; for INTENSET_REGION3RA_Field_1 use (Intenset_Region3Ra_Field_Reset => 0, Set => 1); -- Write '1' to Enable interrupt for PREGION[0].WA event type INTENSET_PREGION0WA_Field is (-- Read: Disabled Disabled, -- Read: Enabled Enabled) with Size => 1; for INTENSET_PREGION0WA_Field use (Disabled => 0, Enabled => 1); -- Write '1' to Enable interrupt for PREGION[0].WA event type INTENSET_PREGION0WA_Field_1 is (-- Reset value for the field Intenset_Pregion0Wa_Field_Reset, -- Enable Set) with Size => 1; for INTENSET_PREGION0WA_Field_1 use (Intenset_Pregion0Wa_Field_Reset => 0, Set => 1); -- Write '1' to Enable interrupt for PREGION[0].RA event type INTENSET_PREGION0RA_Field is (-- Read: Disabled Disabled, -- Read: Enabled Enabled) with Size => 1; for INTENSET_PREGION0RA_Field use (Disabled => 0, Enabled => 1); -- Write '1' to Enable interrupt for PREGION[0].RA event type INTENSET_PREGION0RA_Field_1 is (-- Reset value for the field Intenset_Pregion0Ra_Field_Reset, -- Enable Set) with Size => 1; for INTENSET_PREGION0RA_Field_1 use (Intenset_Pregion0Ra_Field_Reset => 0, Set => 1); -- Write '1' to Enable interrupt for PREGION[1].WA event type INTENSET_PREGION1WA_Field is (-- Read: Disabled Disabled, -- Read: Enabled Enabled) with Size => 1; for INTENSET_PREGION1WA_Field use (Disabled => 0, Enabled => 1); -- Write '1' to Enable interrupt for PREGION[1].WA event type INTENSET_PREGION1WA_Field_1 is (-- Reset value for the field Intenset_Pregion1Wa_Field_Reset, -- Enable Set) with Size => 1; for INTENSET_PREGION1WA_Field_1 use (Intenset_Pregion1Wa_Field_Reset => 0, Set => 1); -- Write '1' to Enable interrupt for PREGION[1].RA event type INTENSET_PREGION1RA_Field is (-- Read: Disabled Disabled, -- Read: Enabled Enabled) with Size => 1; for INTENSET_PREGION1RA_Field use (Disabled => 0, Enabled => 1); -- Write '1' to Enable interrupt for PREGION[1].RA event type INTENSET_PREGION1RA_Field_1 is (-- Reset value for the field Intenset_Pregion1Ra_Field_Reset, -- Enable Set) with Size => 1; for INTENSET_PREGION1RA_Field_1 use (Intenset_Pregion1Ra_Field_Reset => 0, Set => 1); -- Enable interrupt type INTENSET_Register is record -- Write '1' to Enable interrupt for REGION[0].WA event REGION0WA : INTENSET_REGION0WA_Field_1 := Intenset_Region0Wa_Field_Reset; -- Write '1' to Enable interrupt for REGION[0].RA event REGION0RA : INTENSET_REGION0RA_Field_1 := Intenset_Region0Ra_Field_Reset; -- Write '1' to Enable interrupt for REGION[1].WA event REGION1WA : INTENSET_REGION1WA_Field_1 := Intenset_Region1Wa_Field_Reset; -- Write '1' to Enable interrupt for REGION[1].RA event REGION1RA : INTENSET_REGION1RA_Field_1 := Intenset_Region1Ra_Field_Reset; -- Write '1' to Enable interrupt for REGION[2].WA event REGION2WA : INTENSET_REGION2WA_Field_1 := Intenset_Region2Wa_Field_Reset; -- Write '1' to Enable interrupt for REGION[2].RA event REGION2RA : INTENSET_REGION2RA_Field_1 := Intenset_Region2Ra_Field_Reset; -- Write '1' to Enable interrupt for REGION[3].WA event REGION3WA : INTENSET_REGION3WA_Field_1 := Intenset_Region3Wa_Field_Reset; -- Write '1' to Enable interrupt for REGION[3].RA event REGION3RA : INTENSET_REGION3RA_Field_1 := Intenset_Region3Ra_Field_Reset; -- unspecified Reserved_8_23 : HAL.UInt16 := 16#0#; -- Write '1' to Enable interrupt for PREGION[0].WA event PREGION0WA : INTENSET_PREGION0WA_Field_1 := Intenset_Pregion0Wa_Field_Reset; -- Write '1' to Enable interrupt for PREGION[0].RA event PREGION0RA : INTENSET_PREGION0RA_Field_1 := Intenset_Pregion0Ra_Field_Reset; -- Write '1' to Enable interrupt for PREGION[1].WA event PREGION1WA : INTENSET_PREGION1WA_Field_1 := Intenset_Pregion1Wa_Field_Reset; -- Write '1' to Enable interrupt for PREGION[1].RA event PREGION1RA : INTENSET_PREGION1RA_Field_1 := Intenset_Pregion1Ra_Field_Reset; -- unspecified Reserved_28_31 : HAL.UInt4 := 16#0#; end record with Volatile_Full_Access, Object_Size => 32, Bit_Order => System.Low_Order_First; for INTENSET_Register use record REGION0WA at 0 range 0 .. 0; REGION0RA at 0 range 1 .. 1; REGION1WA at 0 range 2 .. 2; REGION1RA at 0 range 3 .. 3; REGION2WA at 0 range 4 .. 4; REGION2RA at 0 range 5 .. 5; REGION3WA at 0 range 6 .. 6; REGION3RA at 0 range 7 .. 7; Reserved_8_23 at 0 range 8 .. 23; PREGION0WA at 0 range 24 .. 24; PREGION0RA at 0 range 25 .. 25; PREGION1WA at 0 range 26 .. 26; PREGION1RA at 0 range 27 .. 27; Reserved_28_31 at 0 range 28 .. 31; end record; -- Write '1' to Disable interrupt for REGION[0].WA event type INTENCLR_REGION0WA_Field is (-- Read: Disabled Disabled, -- Read: Enabled Enabled) with Size => 1; for INTENCLR_REGION0WA_Field use (Disabled => 0, Enabled => 1); -- Write '1' to Disable interrupt for REGION[0].WA event type INTENCLR_REGION0WA_Field_1 is (-- Reset value for the field Intenclr_Region0Wa_Field_Reset, -- Disable Clear) with Size => 1; for INTENCLR_REGION0WA_Field_1 use (Intenclr_Region0Wa_Field_Reset => 0, Clear => 1); -- Write '1' to Disable interrupt for REGION[0].RA event type INTENCLR_REGION0RA_Field is (-- Read: Disabled Disabled, -- Read: Enabled Enabled) with Size => 1; for INTENCLR_REGION0RA_Field use (Disabled => 0, Enabled => 1); -- Write '1' to Disable interrupt for REGION[0].RA event type INTENCLR_REGION0RA_Field_1 is (-- Reset value for the field Intenclr_Region0Ra_Field_Reset, -- Disable Clear) with Size => 1; for INTENCLR_REGION0RA_Field_1 use (Intenclr_Region0Ra_Field_Reset => 0, Clear => 1); -- Write '1' to Disable interrupt for REGION[1].WA event type INTENCLR_REGION1WA_Field is (-- Read: Disabled Disabled, -- Read: Enabled Enabled) with Size => 1; for INTENCLR_REGION1WA_Field use (Disabled => 0, Enabled => 1); -- Write '1' to Disable interrupt for REGION[1].WA event type INTENCLR_REGION1WA_Field_1 is (-- Reset value for the field Intenclr_Region1Wa_Field_Reset, -- Disable Clear) with Size => 1; for INTENCLR_REGION1WA_Field_1 use (Intenclr_Region1Wa_Field_Reset => 0, Clear => 1); -- Write '1' to Disable interrupt for REGION[1].RA event type INTENCLR_REGION1RA_Field is (-- Read: Disabled Disabled, -- Read: Enabled Enabled) with Size => 1; for INTENCLR_REGION1RA_Field use (Disabled => 0, Enabled => 1); -- Write '1' to Disable interrupt for REGION[1].RA event type INTENCLR_REGION1RA_Field_1 is (-- Reset value for the field Intenclr_Region1Ra_Field_Reset, -- Disable Clear) with Size => 1; for INTENCLR_REGION1RA_Field_1 use (Intenclr_Region1Ra_Field_Reset => 0, Clear => 1); -- Write '1' to Disable interrupt for REGION[2].WA event type INTENCLR_REGION2WA_Field is (-- Read: Disabled Disabled, -- Read: Enabled Enabled) with Size => 1; for INTENCLR_REGION2WA_Field use (Disabled => 0, Enabled => 1); -- Write '1' to Disable interrupt for REGION[2].WA event type INTENCLR_REGION2WA_Field_1 is (-- Reset value for the field Intenclr_Region2Wa_Field_Reset, -- Disable Clear) with Size => 1; for INTENCLR_REGION2WA_Field_1 use (Intenclr_Region2Wa_Field_Reset => 0, Clear => 1); -- Write '1' to Disable interrupt for REGION[2].RA event type INTENCLR_REGION2RA_Field is (-- Read: Disabled Disabled, -- Read: Enabled Enabled) with Size => 1; for INTENCLR_REGION2RA_Field use (Disabled => 0, Enabled => 1); -- Write '1' to Disable interrupt for REGION[2].RA event type INTENCLR_REGION2RA_Field_1 is (-- Reset value for the field Intenclr_Region2Ra_Field_Reset, -- Disable Clear) with Size => 1; for INTENCLR_REGION2RA_Field_1 use (Intenclr_Region2Ra_Field_Reset => 0, Clear => 1); -- Write '1' to Disable interrupt for REGION[3].WA event type INTENCLR_REGION3WA_Field is (-- Read: Disabled Disabled, -- Read: Enabled Enabled) with Size => 1; for INTENCLR_REGION3WA_Field use (Disabled => 0, Enabled => 1); -- Write '1' to Disable interrupt for REGION[3].WA event type INTENCLR_REGION3WA_Field_1 is (-- Reset value for the field Intenclr_Region3Wa_Field_Reset, -- Disable Clear) with Size => 1; for INTENCLR_REGION3WA_Field_1 use (Intenclr_Region3Wa_Field_Reset => 0, Clear => 1); -- Write '1' to Disable interrupt for REGION[3].RA event type INTENCLR_REGION3RA_Field is (-- Read: Disabled Disabled, -- Read: Enabled Enabled) with Size => 1; for INTENCLR_REGION3RA_Field use (Disabled => 0, Enabled => 1); -- Write '1' to Disable interrupt for REGION[3].RA event type INTENCLR_REGION3RA_Field_1 is (-- Reset value for the field Intenclr_Region3Ra_Field_Reset, -- Disable Clear) with Size => 1; for INTENCLR_REGION3RA_Field_1 use (Intenclr_Region3Ra_Field_Reset => 0, Clear => 1); -- Write '1' to Disable interrupt for PREGION[0].WA event type INTENCLR_PREGION0WA_Field is (-- Read: Disabled Disabled, -- Read: Enabled Enabled) with Size => 1; for INTENCLR_PREGION0WA_Field use (Disabled => 0, Enabled => 1); -- Write '1' to Disable interrupt for PREGION[0].WA event type INTENCLR_PREGION0WA_Field_1 is (-- Reset value for the field Intenclr_Pregion0Wa_Field_Reset, -- Disable Clear) with Size => 1; for INTENCLR_PREGION0WA_Field_1 use (Intenclr_Pregion0Wa_Field_Reset => 0, Clear => 1); -- Write '1' to Disable interrupt for PREGION[0].RA event type INTENCLR_PREGION0RA_Field is (-- Read: Disabled Disabled, -- Read: Enabled Enabled) with Size => 1; for INTENCLR_PREGION0RA_Field use (Disabled => 0, Enabled => 1); -- Write '1' to Disable interrupt for PREGION[0].RA event type INTENCLR_PREGION0RA_Field_1 is (-- Reset value for the field Intenclr_Pregion0Ra_Field_Reset, -- Disable Clear) with Size => 1; for INTENCLR_PREGION0RA_Field_1 use (Intenclr_Pregion0Ra_Field_Reset => 0, Clear => 1); -- Write '1' to Disable interrupt for PREGION[1].WA event type INTENCLR_PREGION1WA_Field is (-- Read: Disabled Disabled, -- Read: Enabled Enabled) with Size => 1; for INTENCLR_PREGION1WA_Field use (Disabled => 0, Enabled => 1); -- Write '1' to Disable interrupt for PREGION[1].WA event type INTENCLR_PREGION1WA_Field_1 is (-- Reset value for the field Intenclr_Pregion1Wa_Field_Reset, -- Disable Clear) with Size => 1; for INTENCLR_PREGION1WA_Field_1 use (Intenclr_Pregion1Wa_Field_Reset => 0, Clear => 1); -- Write '1' to Disable interrupt for PREGION[1].RA event type INTENCLR_PREGION1RA_Field is (-- Read: Disabled Disabled, -- Read: Enabled Enabled) with Size => 1; for INTENCLR_PREGION1RA_Field use (Disabled => 0, Enabled => 1); -- Write '1' to Disable interrupt for PREGION[1].RA event type INTENCLR_PREGION1RA_Field_1 is (-- Reset value for the field Intenclr_Pregion1Ra_Field_Reset, -- Disable Clear) with Size => 1; for INTENCLR_PREGION1RA_Field_1 use (Intenclr_Pregion1Ra_Field_Reset => 0, Clear => 1); -- Disable interrupt type INTENCLR_Register is record -- Write '1' to Disable interrupt for REGION[0].WA event REGION0WA : INTENCLR_REGION0WA_Field_1 := Intenclr_Region0Wa_Field_Reset; -- Write '1' to Disable interrupt for REGION[0].RA event REGION0RA : INTENCLR_REGION0RA_Field_1 := Intenclr_Region0Ra_Field_Reset; -- Write '1' to Disable interrupt for REGION[1].WA event REGION1WA : INTENCLR_REGION1WA_Field_1 := Intenclr_Region1Wa_Field_Reset; -- Write '1' to Disable interrupt for REGION[1].RA event REGION1RA : INTENCLR_REGION1RA_Field_1 := Intenclr_Region1Ra_Field_Reset; -- Write '1' to Disable interrupt for REGION[2].WA event REGION2WA : INTENCLR_REGION2WA_Field_1 := Intenclr_Region2Wa_Field_Reset; -- Write '1' to Disable interrupt for REGION[2].RA event REGION2RA : INTENCLR_REGION2RA_Field_1 := Intenclr_Region2Ra_Field_Reset; -- Write '1' to Disable interrupt for REGION[3].WA event REGION3WA : INTENCLR_REGION3WA_Field_1 := Intenclr_Region3Wa_Field_Reset; -- Write '1' to Disable interrupt for REGION[3].RA event REGION3RA : INTENCLR_REGION3RA_Field_1 := Intenclr_Region3Ra_Field_Reset; -- unspecified Reserved_8_23 : HAL.UInt16 := 16#0#; -- Write '1' to Disable interrupt for PREGION[0].WA event PREGION0WA : INTENCLR_PREGION0WA_Field_1 := Intenclr_Pregion0Wa_Field_Reset; -- Write '1' to Disable interrupt for PREGION[0].RA event PREGION0RA : INTENCLR_PREGION0RA_Field_1 := Intenclr_Pregion0Ra_Field_Reset; -- Write '1' to Disable interrupt for PREGION[1].WA event PREGION1WA : INTENCLR_PREGION1WA_Field_1 := Intenclr_Pregion1Wa_Field_Reset; -- Write '1' to Disable interrupt for PREGION[1].RA event PREGION1RA : INTENCLR_PREGION1RA_Field_1 := Intenclr_Pregion1Ra_Field_Reset; -- unspecified Reserved_28_31 : HAL.UInt4 := 16#0#; end record with Volatile_Full_Access, Object_Size => 32, Bit_Order => System.Low_Order_First; for INTENCLR_Register use record REGION0WA at 0 range 0 .. 0; REGION0RA at 0 range 1 .. 1; REGION1WA at 0 range 2 .. 2; REGION1RA at 0 range 3 .. 3; REGION2WA at 0 range 4 .. 4; REGION2RA at 0 range 5 .. 5; REGION3WA at 0 range 6 .. 6; REGION3RA at 0 range 7 .. 7; Reserved_8_23 at 0 range 8 .. 23; PREGION0WA at 0 range 24 .. 24; PREGION0RA at 0 range 25 .. 25; PREGION1WA at 0 range 26 .. 26; PREGION1RA at 0 range 27 .. 27; Reserved_28_31 at 0 range 28 .. 31; end record; -- Enable or disable non-maskable interrupt for REGION[0].WA event type NMIEN_REGION0WA_Field is (-- Disable Disabled, -- Enable Enabled) with Size => 1; for NMIEN_REGION0WA_Field use (Disabled => 0, Enabled => 1); -- Enable or disable non-maskable interrupt for REGION[0].RA event type NMIEN_REGION0RA_Field is (-- Disable Disabled, -- Enable Enabled) with Size => 1; for NMIEN_REGION0RA_Field use (Disabled => 0, Enabled => 1); -- Enable or disable non-maskable interrupt for REGION[1].WA event type NMIEN_REGION1WA_Field is (-- Disable Disabled, -- Enable Enabled) with Size => 1; for NMIEN_REGION1WA_Field use (Disabled => 0, Enabled => 1); -- Enable or disable non-maskable interrupt for REGION[1].RA event type NMIEN_REGION1RA_Field is (-- Disable Disabled, -- Enable Enabled) with Size => 1; for NMIEN_REGION1RA_Field use (Disabled => 0, Enabled => 1); -- Enable or disable non-maskable interrupt for REGION[2].WA event type NMIEN_REGION2WA_Field is (-- Disable Disabled, -- Enable Enabled) with Size => 1; for NMIEN_REGION2WA_Field use (Disabled => 0, Enabled => 1); -- Enable or disable non-maskable interrupt for REGION[2].RA event type NMIEN_REGION2RA_Field is (-- Disable Disabled, -- Enable Enabled) with Size => 1; for NMIEN_REGION2RA_Field use (Disabled => 0, Enabled => 1); -- Enable or disable non-maskable interrupt for REGION[3].WA event type NMIEN_REGION3WA_Field is (-- Disable Disabled, -- Enable Enabled) with Size => 1; for NMIEN_REGION3WA_Field use (Disabled => 0, Enabled => 1); -- Enable or disable non-maskable interrupt for REGION[3].RA event type NMIEN_REGION3RA_Field is (-- Disable Disabled, -- Enable Enabled) with Size => 1; for NMIEN_REGION3RA_Field use (Disabled => 0, Enabled => 1); -- Enable or disable non-maskable interrupt for PREGION[0].WA event type NMIEN_PREGION0WA_Field is (-- Disable Disabled, -- Enable Enabled) with Size => 1; for NMIEN_PREGION0WA_Field use (Disabled => 0, Enabled => 1); -- Enable or disable non-maskable interrupt for PREGION[0].RA event type NMIEN_PREGION0RA_Field is (-- Disable Disabled, -- Enable Enabled) with Size => 1; for NMIEN_PREGION0RA_Field use (Disabled => 0, Enabled => 1); -- Enable or disable non-maskable interrupt for PREGION[1].WA event type NMIEN_PREGION1WA_Field is (-- Disable Disabled, -- Enable Enabled) with Size => 1; for NMIEN_PREGION1WA_Field use (Disabled => 0, Enabled => 1); -- Enable or disable non-maskable interrupt for PREGION[1].RA event type NMIEN_PREGION1RA_Field is (-- Disable Disabled, -- Enable Enabled) with Size => 1; for NMIEN_PREGION1RA_Field use (Disabled => 0, Enabled => 1); -- Enable or disable non-maskable interrupt type NMIEN_Register is record -- Enable or disable non-maskable interrupt for REGION[0].WA event REGION0WA : NMIEN_REGION0WA_Field := NRF_SVD.MWU.Disabled; -- Enable or disable non-maskable interrupt for REGION[0].RA event REGION0RA : NMIEN_REGION0RA_Field := NRF_SVD.MWU.Disabled; -- Enable or disable non-maskable interrupt for REGION[1].WA event REGION1WA : NMIEN_REGION1WA_Field := NRF_SVD.MWU.Disabled; -- Enable or disable non-maskable interrupt for REGION[1].RA event REGION1RA : NMIEN_REGION1RA_Field := NRF_SVD.MWU.Disabled; -- Enable or disable non-maskable interrupt for REGION[2].WA event REGION2WA : NMIEN_REGION2WA_Field := NRF_SVD.MWU.Disabled; -- Enable or disable non-maskable interrupt for REGION[2].RA event REGION2RA : NMIEN_REGION2RA_Field := NRF_SVD.MWU.Disabled; -- Enable or disable non-maskable interrupt for REGION[3].WA event REGION3WA : NMIEN_REGION3WA_Field := NRF_SVD.MWU.Disabled; -- Enable or disable non-maskable interrupt for REGION[3].RA event REGION3RA : NMIEN_REGION3RA_Field := NRF_SVD.MWU.Disabled; -- unspecified Reserved_8_23 : HAL.UInt16 := 16#0#; -- Enable or disable non-maskable interrupt for PREGION[0].WA event PREGION0WA : NMIEN_PREGION0WA_Field := NRF_SVD.MWU.Disabled; -- Enable or disable non-maskable interrupt for PREGION[0].RA event PREGION0RA : NMIEN_PREGION0RA_Field := NRF_SVD.MWU.Disabled; -- Enable or disable non-maskable interrupt for PREGION[1].WA event PREGION1WA : NMIEN_PREGION1WA_Field := NRF_SVD.MWU.Disabled; -- Enable or disable non-maskable interrupt for PREGION[1].RA event PREGION1RA : NMIEN_PREGION1RA_Field := NRF_SVD.MWU.Disabled; -- unspecified Reserved_28_31 : HAL.UInt4 := 16#0#; end record with Volatile_Full_Access, Object_Size => 32, Bit_Order => System.Low_Order_First; for NMIEN_Register use record REGION0WA at 0 range 0 .. 0; REGION0RA at 0 range 1 .. 1; REGION1WA at 0 range 2 .. 2; REGION1RA at 0 range 3 .. 3; REGION2WA at 0 range 4 .. 4; REGION2RA at 0 range 5 .. 5; REGION3WA at 0 range 6 .. 6; REGION3RA at 0 range 7 .. 7; Reserved_8_23 at 0 range 8 .. 23; PREGION0WA at 0 range 24 .. 24; PREGION0RA at 0 range 25 .. 25; PREGION1WA at 0 range 26 .. 26; PREGION1RA at 0 range 27 .. 27; Reserved_28_31 at 0 range 28 .. 31; end record; -- Write '1' to Enable non-maskable interrupt for REGION[0].WA event type NMIENSET_REGION0WA_Field is (-- Read: Disabled Disabled, -- Read: Enabled Enabled) with Size => 1; for NMIENSET_REGION0WA_Field use (Disabled => 0, Enabled => 1); -- Write '1' to Enable non-maskable interrupt for REGION[0].WA event type NMIENSET_REGION0WA_Field_1 is (-- Reset value for the field Nmienset_Region0Wa_Field_Reset, -- Enable Set) with Size => 1; for NMIENSET_REGION0WA_Field_1 use (Nmienset_Region0Wa_Field_Reset => 0, Set => 1); -- Write '1' to Enable non-maskable interrupt for REGION[0].RA event type NMIENSET_REGION0RA_Field is (-- Read: Disabled Disabled, -- Read: Enabled Enabled) with Size => 1; for NMIENSET_REGION0RA_Field use (Disabled => 0, Enabled => 1); -- Write '1' to Enable non-maskable interrupt for REGION[0].RA event type NMIENSET_REGION0RA_Field_1 is (-- Reset value for the field Nmienset_Region0Ra_Field_Reset, -- Enable Set) with Size => 1; for NMIENSET_REGION0RA_Field_1 use (Nmienset_Region0Ra_Field_Reset => 0, Set => 1); -- Write '1' to Enable non-maskable interrupt for REGION[1].WA event type NMIENSET_REGION1WA_Field is (-- Read: Disabled Disabled, -- Read: Enabled Enabled) with Size => 1; for NMIENSET_REGION1WA_Field use (Disabled => 0, Enabled => 1); -- Write '1' to Enable non-maskable interrupt for REGION[1].WA event type NMIENSET_REGION1WA_Field_1 is (-- Reset value for the field Nmienset_Region1Wa_Field_Reset, -- Enable Set) with Size => 1; for NMIENSET_REGION1WA_Field_1 use (Nmienset_Region1Wa_Field_Reset => 0, Set => 1); -- Write '1' to Enable non-maskable interrupt for REGION[1].RA event type NMIENSET_REGION1RA_Field is (-- Read: Disabled Disabled, -- Read: Enabled Enabled) with Size => 1; for NMIENSET_REGION1RA_Field use (Disabled => 0, Enabled => 1); -- Write '1' to Enable non-maskable interrupt for REGION[1].RA event type NMIENSET_REGION1RA_Field_1 is (-- Reset value for the field Nmienset_Region1Ra_Field_Reset, -- Enable Set) with Size => 1; for NMIENSET_REGION1RA_Field_1 use (Nmienset_Region1Ra_Field_Reset => 0, Set => 1); -- Write '1' to Enable non-maskable interrupt for REGION[2].WA event type NMIENSET_REGION2WA_Field is (-- Read: Disabled Disabled, -- Read: Enabled Enabled) with Size => 1; for NMIENSET_REGION2WA_Field use (Disabled => 0, Enabled => 1); -- Write '1' to Enable non-maskable interrupt for REGION[2].WA event type NMIENSET_REGION2WA_Field_1 is (-- Reset value for the field Nmienset_Region2Wa_Field_Reset, -- Enable Set) with Size => 1; for NMIENSET_REGION2WA_Field_1 use (Nmienset_Region2Wa_Field_Reset => 0, Set => 1); -- Write '1' to Enable non-maskable interrupt for REGION[2].RA event type NMIENSET_REGION2RA_Field is (-- Read: Disabled Disabled, -- Read: Enabled Enabled) with Size => 1; for NMIENSET_REGION2RA_Field use (Disabled => 0, Enabled => 1); -- Write '1' to Enable non-maskable interrupt for REGION[2].RA event type NMIENSET_REGION2RA_Field_1 is (-- Reset value for the field Nmienset_Region2Ra_Field_Reset, -- Enable Set) with Size => 1; for NMIENSET_REGION2RA_Field_1 use (Nmienset_Region2Ra_Field_Reset => 0, Set => 1); -- Write '1' to Enable non-maskable interrupt for REGION[3].WA event type NMIENSET_REGION3WA_Field is (-- Read: Disabled Disabled, -- Read: Enabled Enabled) with Size => 1; for NMIENSET_REGION3WA_Field use (Disabled => 0, Enabled => 1); -- Write '1' to Enable non-maskable interrupt for REGION[3].WA event type NMIENSET_REGION3WA_Field_1 is (-- Reset value for the field Nmienset_Region3Wa_Field_Reset, -- Enable Set) with Size => 1; for NMIENSET_REGION3WA_Field_1 use (Nmienset_Region3Wa_Field_Reset => 0, Set => 1); -- Write '1' to Enable non-maskable interrupt for REGION[3].RA event type NMIENSET_REGION3RA_Field is (-- Read: Disabled Disabled, -- Read: Enabled Enabled) with Size => 1; for NMIENSET_REGION3RA_Field use (Disabled => 0, Enabled => 1); -- Write '1' to Enable non-maskable interrupt for REGION[3].RA event type NMIENSET_REGION3RA_Field_1 is (-- Reset value for the field Nmienset_Region3Ra_Field_Reset, -- Enable Set) with Size => 1; for NMIENSET_REGION3RA_Field_1 use (Nmienset_Region3Ra_Field_Reset => 0, Set => 1); -- Write '1' to Enable non-maskable interrupt for PREGION[0].WA event type NMIENSET_PREGION0WA_Field is (-- Read: Disabled Disabled, -- Read: Enabled Enabled) with Size => 1; for NMIENSET_PREGION0WA_Field use (Disabled => 0, Enabled => 1); -- Write '1' to Enable non-maskable interrupt for PREGION[0].WA event type NMIENSET_PREGION0WA_Field_1 is (-- Reset value for the field Nmienset_Pregion0Wa_Field_Reset, -- Enable Set) with Size => 1; for NMIENSET_PREGION0WA_Field_1 use (Nmienset_Pregion0Wa_Field_Reset => 0, Set => 1); -- Write '1' to Enable non-maskable interrupt for PREGION[0].RA event type NMIENSET_PREGION0RA_Field is (-- Read: Disabled Disabled, -- Read: Enabled Enabled) with Size => 1; for NMIENSET_PREGION0RA_Field use (Disabled => 0, Enabled => 1); -- Write '1' to Enable non-maskable interrupt for PREGION[0].RA event type NMIENSET_PREGION0RA_Field_1 is (-- Reset value for the field Nmienset_Pregion0Ra_Field_Reset, -- Enable Set) with Size => 1; for NMIENSET_PREGION0RA_Field_1 use (Nmienset_Pregion0Ra_Field_Reset => 0, Set => 1); -- Write '1' to Enable non-maskable interrupt for PREGION[1].WA event type NMIENSET_PREGION1WA_Field is (-- Read: Disabled Disabled, -- Read: Enabled Enabled) with Size => 1; for NMIENSET_PREGION1WA_Field use (Disabled => 0, Enabled => 1); -- Write '1' to Enable non-maskable interrupt for PREGION[1].WA event type NMIENSET_PREGION1WA_Field_1 is (-- Reset value for the field Nmienset_Pregion1Wa_Field_Reset, -- Enable Set) with Size => 1; for NMIENSET_PREGION1WA_Field_1 use (Nmienset_Pregion1Wa_Field_Reset => 0, Set => 1); -- Write '1' to Enable non-maskable interrupt for PREGION[1].RA event type NMIENSET_PREGION1RA_Field is (-- Read: Disabled Disabled, -- Read: Enabled Enabled) with Size => 1; for NMIENSET_PREGION1RA_Field use (Disabled => 0, Enabled => 1); -- Write '1' to Enable non-maskable interrupt for PREGION[1].RA event type NMIENSET_PREGION1RA_Field_1 is (-- Reset value for the field Nmienset_Pregion1Ra_Field_Reset, -- Enable Set) with Size => 1; for NMIENSET_PREGION1RA_Field_1 use (Nmienset_Pregion1Ra_Field_Reset => 0, Set => 1); -- Enable non-maskable interrupt type NMIENSET_Register is record -- Write '1' to Enable non-maskable interrupt for REGION[0].WA event REGION0WA : NMIENSET_REGION0WA_Field_1 := Nmienset_Region0Wa_Field_Reset; -- Write '1' to Enable non-maskable interrupt for REGION[0].RA event REGION0RA : NMIENSET_REGION0RA_Field_1 := Nmienset_Region0Ra_Field_Reset; -- Write '1' to Enable non-maskable interrupt for REGION[1].WA event REGION1WA : NMIENSET_REGION1WA_Field_1 := Nmienset_Region1Wa_Field_Reset; -- Write '1' to Enable non-maskable interrupt for REGION[1].RA event REGION1RA : NMIENSET_REGION1RA_Field_1 := Nmienset_Region1Ra_Field_Reset; -- Write '1' to Enable non-maskable interrupt for REGION[2].WA event REGION2WA : NMIENSET_REGION2WA_Field_1 := Nmienset_Region2Wa_Field_Reset; -- Write '1' to Enable non-maskable interrupt for REGION[2].RA event REGION2RA : NMIENSET_REGION2RA_Field_1 := Nmienset_Region2Ra_Field_Reset; -- Write '1' to Enable non-maskable interrupt for REGION[3].WA event REGION3WA : NMIENSET_REGION3WA_Field_1 := Nmienset_Region3Wa_Field_Reset; -- Write '1' to Enable non-maskable interrupt for REGION[3].RA event REGION3RA : NMIENSET_REGION3RA_Field_1 := Nmienset_Region3Ra_Field_Reset; -- unspecified Reserved_8_23 : HAL.UInt16 := 16#0#; -- Write '1' to Enable non-maskable interrupt for PREGION[0].WA event PREGION0WA : NMIENSET_PREGION0WA_Field_1 := Nmienset_Pregion0Wa_Field_Reset; -- Write '1' to Enable non-maskable interrupt for PREGION[0].RA event PREGION0RA : NMIENSET_PREGION0RA_Field_1 := Nmienset_Pregion0Ra_Field_Reset; -- Write '1' to Enable non-maskable interrupt for PREGION[1].WA event PREGION1WA : NMIENSET_PREGION1WA_Field_1 := Nmienset_Pregion1Wa_Field_Reset; -- Write '1' to Enable non-maskable interrupt for PREGION[1].RA event PREGION1RA : NMIENSET_PREGION1RA_Field_1 := Nmienset_Pregion1Ra_Field_Reset; -- unspecified Reserved_28_31 : HAL.UInt4 := 16#0#; end record with Volatile_Full_Access, Object_Size => 32, Bit_Order => System.Low_Order_First; for NMIENSET_Register use record REGION0WA at 0 range 0 .. 0; REGION0RA at 0 range 1 .. 1; REGION1WA at 0 range 2 .. 2; REGION1RA at 0 range 3 .. 3; REGION2WA at 0 range 4 .. 4; REGION2RA at 0 range 5 .. 5; REGION3WA at 0 range 6 .. 6; REGION3RA at 0 range 7 .. 7; Reserved_8_23 at 0 range 8 .. 23; PREGION0WA at 0 range 24 .. 24; PREGION0RA at 0 range 25 .. 25; PREGION1WA at 0 range 26 .. 26; PREGION1RA at 0 range 27 .. 27; Reserved_28_31 at 0 range 28 .. 31; end record; -- Write '1' to Disable non-maskable interrupt for REGION[0].WA event type NMIENCLR_REGION0WA_Field is (-- Read: Disabled Disabled, -- Read: Enabled Enabled) with Size => 1; for NMIENCLR_REGION0WA_Field use (Disabled => 0, Enabled => 1); -- Write '1' to Disable non-maskable interrupt for REGION[0].WA event type NMIENCLR_REGION0WA_Field_1 is (-- Reset value for the field Nmienclr_Region0Wa_Field_Reset, -- Disable Clear) with Size => 1; for NMIENCLR_REGION0WA_Field_1 use (Nmienclr_Region0Wa_Field_Reset => 0, Clear => 1); -- Write '1' to Disable non-maskable interrupt for REGION[0].RA event type NMIENCLR_REGION0RA_Field is (-- Read: Disabled Disabled, -- Read: Enabled Enabled) with Size => 1; for NMIENCLR_REGION0RA_Field use (Disabled => 0, Enabled => 1); -- Write '1' to Disable non-maskable interrupt for REGION[0].RA event type NMIENCLR_REGION0RA_Field_1 is (-- Reset value for the field Nmienclr_Region0Ra_Field_Reset, -- Disable Clear) with Size => 1; for NMIENCLR_REGION0RA_Field_1 use (Nmienclr_Region0Ra_Field_Reset => 0, Clear => 1); -- Write '1' to Disable non-maskable interrupt for REGION[1].WA event type NMIENCLR_REGION1WA_Field is (-- Read: Disabled Disabled, -- Read: Enabled Enabled) with Size => 1; for NMIENCLR_REGION1WA_Field use (Disabled => 0, Enabled => 1); -- Write '1' to Disable non-maskable interrupt for REGION[1].WA event type NMIENCLR_REGION1WA_Field_1 is (-- Reset value for the field Nmienclr_Region1Wa_Field_Reset, -- Disable Clear) with Size => 1; for NMIENCLR_REGION1WA_Field_1 use (Nmienclr_Region1Wa_Field_Reset => 0, Clear => 1); -- Write '1' to Disable non-maskable interrupt for REGION[1].RA event type NMIENCLR_REGION1RA_Field is (-- Read: Disabled Disabled, -- Read: Enabled Enabled) with Size => 1; for NMIENCLR_REGION1RA_Field use (Disabled => 0, Enabled => 1); -- Write '1' to Disable non-maskable interrupt for REGION[1].RA event type NMIENCLR_REGION1RA_Field_1 is (-- Reset value for the field Nmienclr_Region1Ra_Field_Reset, -- Disable Clear) with Size => 1; for NMIENCLR_REGION1RA_Field_1 use (Nmienclr_Region1Ra_Field_Reset => 0, Clear => 1); -- Write '1' to Disable non-maskable interrupt for REGION[2].WA event type NMIENCLR_REGION2WA_Field is (-- Read: Disabled Disabled, -- Read: Enabled Enabled) with Size => 1; for NMIENCLR_REGION2WA_Field use (Disabled => 0, Enabled => 1); -- Write '1' to Disable non-maskable interrupt for REGION[2].WA event type NMIENCLR_REGION2WA_Field_1 is (-- Reset value for the field Nmienclr_Region2Wa_Field_Reset, -- Disable Clear) with Size => 1; for NMIENCLR_REGION2WA_Field_1 use (Nmienclr_Region2Wa_Field_Reset => 0, Clear => 1); -- Write '1' to Disable non-maskable interrupt for REGION[2].RA event type NMIENCLR_REGION2RA_Field is (-- Read: Disabled Disabled, -- Read: Enabled Enabled) with Size => 1; for NMIENCLR_REGION2RA_Field use (Disabled => 0, Enabled => 1); -- Write '1' to Disable non-maskable interrupt for REGION[2].RA event type NMIENCLR_REGION2RA_Field_1 is (-- Reset value for the field Nmienclr_Region2Ra_Field_Reset, -- Disable Clear) with Size => 1; for NMIENCLR_REGION2RA_Field_1 use (Nmienclr_Region2Ra_Field_Reset => 0, Clear => 1); -- Write '1' to Disable non-maskable interrupt for REGION[3].WA event type NMIENCLR_REGION3WA_Field is (-- Read: Disabled Disabled, -- Read: Enabled Enabled) with Size => 1; for NMIENCLR_REGION3WA_Field use (Disabled => 0, Enabled => 1); -- Write '1' to Disable non-maskable interrupt for REGION[3].WA event type NMIENCLR_REGION3WA_Field_1 is (-- Reset value for the field Nmienclr_Region3Wa_Field_Reset, -- Disable Clear) with Size => 1; for NMIENCLR_REGION3WA_Field_1 use (Nmienclr_Region3Wa_Field_Reset => 0, Clear => 1); -- Write '1' to Disable non-maskable interrupt for REGION[3].RA event type NMIENCLR_REGION3RA_Field is (-- Read: Disabled Disabled, -- Read: Enabled Enabled) with Size => 1; for NMIENCLR_REGION3RA_Field use (Disabled => 0, Enabled => 1); -- Write '1' to Disable non-maskable interrupt for REGION[3].RA event type NMIENCLR_REGION3RA_Field_1 is (-- Reset value for the field Nmienclr_Region3Ra_Field_Reset, -- Disable Clear) with Size => 1; for NMIENCLR_REGION3RA_Field_1 use (Nmienclr_Region3Ra_Field_Reset => 0, Clear => 1); -- Write '1' to Disable non-maskable interrupt for PREGION[0].WA event type NMIENCLR_PREGION0WA_Field is (-- Read: Disabled Disabled, -- Read: Enabled Enabled) with Size => 1; for NMIENCLR_PREGION0WA_Field use (Disabled => 0, Enabled => 1); -- Write '1' to Disable non-maskable interrupt for PREGION[0].WA event type NMIENCLR_PREGION0WA_Field_1 is (-- Reset value for the field Nmienclr_Pregion0Wa_Field_Reset, -- Disable Clear) with Size => 1; for NMIENCLR_PREGION0WA_Field_1 use (Nmienclr_Pregion0Wa_Field_Reset => 0, Clear => 1); -- Write '1' to Disable non-maskable interrupt for PREGION[0].RA event type NMIENCLR_PREGION0RA_Field is (-- Read: Disabled Disabled, -- Read: Enabled Enabled) with Size => 1; for NMIENCLR_PREGION0RA_Field use (Disabled => 0, Enabled => 1); -- Write '1' to Disable non-maskable interrupt for PREGION[0].RA event type NMIENCLR_PREGION0RA_Field_1 is (-- Reset value for the field Nmienclr_Pregion0Ra_Field_Reset, -- Disable Clear) with Size => 1; for NMIENCLR_PREGION0RA_Field_1 use (Nmienclr_Pregion0Ra_Field_Reset => 0, Clear => 1); -- Write '1' to Disable non-maskable interrupt for PREGION[1].WA event type NMIENCLR_PREGION1WA_Field is (-- Read: Disabled Disabled, -- Read: Enabled Enabled) with Size => 1; for NMIENCLR_PREGION1WA_Field use (Disabled => 0, Enabled => 1); -- Write '1' to Disable non-maskable interrupt for PREGION[1].WA event type NMIENCLR_PREGION1WA_Field_1 is (-- Reset value for the field Nmienclr_Pregion1Wa_Field_Reset, -- Disable Clear) with Size => 1; for NMIENCLR_PREGION1WA_Field_1 use (Nmienclr_Pregion1Wa_Field_Reset => 0, Clear => 1); -- Write '1' to Disable non-maskable interrupt for PREGION[1].RA event type NMIENCLR_PREGION1RA_Field is (-- Read: Disabled Disabled, -- Read: Enabled Enabled) with Size => 1; for NMIENCLR_PREGION1RA_Field use (Disabled => 0, Enabled => 1); -- Write '1' to Disable non-maskable interrupt for PREGION[1].RA event type NMIENCLR_PREGION1RA_Field_1 is (-- Reset value for the field Nmienclr_Pregion1Ra_Field_Reset, -- Disable Clear) with Size => 1; for NMIENCLR_PREGION1RA_Field_1 use (Nmienclr_Pregion1Ra_Field_Reset => 0, Clear => 1); -- Disable non-maskable interrupt type NMIENCLR_Register is record -- Write '1' to Disable non-maskable interrupt for REGION[0].WA event REGION0WA : NMIENCLR_REGION0WA_Field_1 := Nmienclr_Region0Wa_Field_Reset; -- Write '1' to Disable non-maskable interrupt for REGION[0].RA event REGION0RA : NMIENCLR_REGION0RA_Field_1 := Nmienclr_Region0Ra_Field_Reset; -- Write '1' to Disable non-maskable interrupt for REGION[1].WA event REGION1WA : NMIENCLR_REGION1WA_Field_1 := Nmienclr_Region1Wa_Field_Reset; -- Write '1' to Disable non-maskable interrupt for REGION[1].RA event REGION1RA : NMIENCLR_REGION1RA_Field_1 := Nmienclr_Region1Ra_Field_Reset; -- Write '1' to Disable non-maskable interrupt for REGION[2].WA event REGION2WA : NMIENCLR_REGION2WA_Field_1 := Nmienclr_Region2Wa_Field_Reset; -- Write '1' to Disable non-maskable interrupt for REGION[2].RA event REGION2RA : NMIENCLR_REGION2RA_Field_1 := Nmienclr_Region2Ra_Field_Reset; -- Write '1' to Disable non-maskable interrupt for REGION[3].WA event REGION3WA : NMIENCLR_REGION3WA_Field_1 := Nmienclr_Region3Wa_Field_Reset; -- Write '1' to Disable non-maskable interrupt for REGION[3].RA event REGION3RA : NMIENCLR_REGION3RA_Field_1 := Nmienclr_Region3Ra_Field_Reset; -- unspecified Reserved_8_23 : HAL.UInt16 := 16#0#; -- Write '1' to Disable non-maskable interrupt for PREGION[0].WA event PREGION0WA : NMIENCLR_PREGION0WA_Field_1 := Nmienclr_Pregion0Wa_Field_Reset; -- Write '1' to Disable non-maskable interrupt for PREGION[0].RA event PREGION0RA : NMIENCLR_PREGION0RA_Field_1 := Nmienclr_Pregion0Ra_Field_Reset; -- Write '1' to Disable non-maskable interrupt for PREGION[1].WA event PREGION1WA : NMIENCLR_PREGION1WA_Field_1 := Nmienclr_Pregion1Wa_Field_Reset; -- Write '1' to Disable non-maskable interrupt for PREGION[1].RA event PREGION1RA : NMIENCLR_PREGION1RA_Field_1 := Nmienclr_Pregion1Ra_Field_Reset; -- unspecified Reserved_28_31 : HAL.UInt4 := 16#0#; end record with Volatile_Full_Access, Object_Size => 32, Bit_Order => System.Low_Order_First; for NMIENCLR_Register use record REGION0WA at 0 range 0 .. 0; REGION0RA at 0 range 1 .. 1; REGION1WA at 0 range 2 .. 2; REGION1RA at 0 range 3 .. 3; REGION2WA at 0 range 4 .. 4; REGION2RA at 0 range 5 .. 5; REGION3WA at 0 range 6 .. 6; REGION3RA at 0 range 7 .. 7; Reserved_8_23 at 0 range 8 .. 23; PREGION0WA at 0 range 24 .. 24; PREGION0RA at 0 range 25 .. 25; PREGION1WA at 0 range 26 .. 26; PREGION1RA at 0 range 27 .. 27; Reserved_28_31 at 0 range 28 .. 31; end record; ----------------------------------- -- PERREGION cluster's Registers -- ----------------------------------- -- Subregion 0 in region 0 (write '1' to clear) type SUBSTATWA_SR0_Field is (-- No write access occurred in this subregion Noaccess, -- Write access(es) occurred in this subregion Access_k) with Size => 1; for SUBSTATWA_SR0_Field use (Noaccess => 0, Access_k => 1); -- SUBSTATWA_PERREGION_SR array type SUBSTATWA_PERREGION_SR_Field_Array is array (0 .. 31) of SUBSTATWA_SR0_Field with Component_Size => 1, Size => 32; -- Description cluster[0]: Source of event/interrupt in region 0, write -- access detected while corresponding subregion was enabled for watching type SUBSTATWA_PERREGION_Register (As_Array : Boolean := False) is record case As_Array is when False => -- SR as a value Val : HAL.UInt32; when True => -- SR as an array Arr : SUBSTATWA_PERREGION_SR_Field_Array; end case; end record with Unchecked_Union, Size => 32, Volatile_Full_Access, Object_Size => 32, Bit_Order => System.Low_Order_First; for SUBSTATWA_PERREGION_Register use record Val at 0 range 0 .. 31; Arr at 0 range 0 .. 31; end record; -- Subregion 0 in region 0 (write '1' to clear) type SUBSTATRA_SR0_Field is (-- No read access occurred in this subregion Noaccess, -- Read access(es) occurred in this subregion Access_k) with Size => 1; for SUBSTATRA_SR0_Field use (Noaccess => 0, Access_k => 1); -- SUBSTATRA_PERREGION_SR array type SUBSTATRA_PERREGION_SR_Field_Array is array (0 .. 31) of SUBSTATRA_SR0_Field with Component_Size => 1, Size => 32; -- Description cluster[0]: Source of event/interrupt in region 0, read -- access detected while corresponding subregion was enabled for watching type SUBSTATRA_PERREGION_Register (As_Array : Boolean := False) is record case As_Array is when False => -- SR as a value Val : HAL.UInt32; when True => -- SR as an array Arr : SUBSTATRA_PERREGION_SR_Field_Array; end case; end record with Unchecked_Union, Size => 32, Volatile_Full_Access, Object_Size => 32, Bit_Order => System.Low_Order_First; for SUBSTATRA_PERREGION_Register use record Val at 0 range 0 .. 31; Arr at 0 range 0 .. 31; end record; -- Unspecified type PERREGION_Cluster is record -- Description cluster[0]: Source of event/interrupt in region 0, write -- access detected while corresponding subregion was enabled for -- watching SUBSTATWA : aliased SUBSTATWA_PERREGION_Register; -- Description cluster[0]: Source of event/interrupt in region 0, read -- access detected while corresponding subregion was enabled for -- watching SUBSTATRA : aliased SUBSTATRA_PERREGION_Register; end record with Size => 64; for PERREGION_Cluster use record SUBSTATWA at 16#0# range 0 .. 31; SUBSTATRA at 16#4# range 0 .. 31; end record; -- Unspecified type PERREGION_Clusters is array (0 .. 1) of PERREGION_Cluster; -- Enable/disable write access watch in region[0] type REGIONEN_RGN0WA_Field is (-- Disable write access watch in this region Disable, -- Enable write access watch in this region Enable) with Size => 1; for REGIONEN_RGN0WA_Field use (Disable => 0, Enable => 1); -- Enable/disable read access watch in region[0] type REGIONEN_RGN0RA_Field is (-- Disable read access watch in this region Disable, -- Enable read access watch in this region Enable) with Size => 1; for REGIONEN_RGN0RA_Field use (Disable => 0, Enable => 1); -- Enable/disable write access watch in region[1] type REGIONEN_RGN1WA_Field is (-- Disable write access watch in this region Disable, -- Enable write access watch in this region Enable) with Size => 1; for REGIONEN_RGN1WA_Field use (Disable => 0, Enable => 1); -- Enable/disable read access watch in region[1] type REGIONEN_RGN1RA_Field is (-- Disable read access watch in this region Disable, -- Enable read access watch in this region Enable) with Size => 1; for REGIONEN_RGN1RA_Field use (Disable => 0, Enable => 1); -- Enable/disable write access watch in region[2] type REGIONEN_RGN2WA_Field is (-- Disable write access watch in this region Disable, -- Enable write access watch in this region Enable) with Size => 1; for REGIONEN_RGN2WA_Field use (Disable => 0, Enable => 1); -- Enable/disable read access watch in region[2] type REGIONEN_RGN2RA_Field is (-- Disable read access watch in this region Disable, -- Enable read access watch in this region Enable) with Size => 1; for REGIONEN_RGN2RA_Field use (Disable => 0, Enable => 1); -- Enable/disable write access watch in region[3] type REGIONEN_RGN3WA_Field is (-- Disable write access watch in this region Disable, -- Enable write access watch in this region Enable) with Size => 1; for REGIONEN_RGN3WA_Field use (Disable => 0, Enable => 1); -- Enable/disable read access watch in region[3] type REGIONEN_RGN3RA_Field is (-- Disable read access watch in this region Disable, -- Enable read access watch in this region Enable) with Size => 1; for REGIONEN_RGN3RA_Field use (Disable => 0, Enable => 1); -- Enable/disable write access watch in PREGION[0] type REGIONEN_PRGN0WA_Field is (-- Disable write access watch in this PREGION Disable, -- Enable write access watch in this PREGION Enable) with Size => 1; for REGIONEN_PRGN0WA_Field use (Disable => 0, Enable => 1); -- Enable/disable read access watch in PREGION[0] type REGIONEN_PRGN0RA_Field is (-- Disable read access watch in this PREGION Disable, -- Enable read access watch in this PREGION Enable) with Size => 1; for REGIONEN_PRGN0RA_Field use (Disable => 0, Enable => 1); -- Enable/disable write access watch in PREGION[1] type REGIONEN_PRGN1WA_Field is (-- Disable write access watch in this PREGION Disable, -- Enable write access watch in this PREGION Enable) with Size => 1; for REGIONEN_PRGN1WA_Field use (Disable => 0, Enable => 1); -- Enable/disable read access watch in PREGION[1] type REGIONEN_PRGN1RA_Field is (-- Disable read access watch in this PREGION Disable, -- Enable read access watch in this PREGION Enable) with Size => 1; for REGIONEN_PRGN1RA_Field use (Disable => 0, Enable => 1); -- Enable/disable regions watch type REGIONEN_Register is record -- Enable/disable write access watch in region[0] RGN0WA : REGIONEN_RGN0WA_Field := NRF_SVD.MWU.Disable; -- Enable/disable read access watch in region[0] RGN0RA : REGIONEN_RGN0RA_Field := NRF_SVD.MWU.Disable; -- Enable/disable write access watch in region[1] RGN1WA : REGIONEN_RGN1WA_Field := NRF_SVD.MWU.Disable; -- Enable/disable read access watch in region[1] RGN1RA : REGIONEN_RGN1RA_Field := NRF_SVD.MWU.Disable; -- Enable/disable write access watch in region[2] RGN2WA : REGIONEN_RGN2WA_Field := NRF_SVD.MWU.Disable; -- Enable/disable read access watch in region[2] RGN2RA : REGIONEN_RGN2RA_Field := NRF_SVD.MWU.Disable; -- Enable/disable write access watch in region[3] RGN3WA : REGIONEN_RGN3WA_Field := NRF_SVD.MWU.Disable; -- Enable/disable read access watch in region[3] RGN3RA : REGIONEN_RGN3RA_Field := NRF_SVD.MWU.Disable; -- unspecified Reserved_8_23 : HAL.UInt16 := 16#0#; -- Enable/disable write access watch in PREGION[0] PRGN0WA : REGIONEN_PRGN0WA_Field := NRF_SVD.MWU.Disable; -- Enable/disable read access watch in PREGION[0] PRGN0RA : REGIONEN_PRGN0RA_Field := NRF_SVD.MWU.Disable; -- Enable/disable write access watch in PREGION[1] PRGN1WA : REGIONEN_PRGN1WA_Field := NRF_SVD.MWU.Disable; -- Enable/disable read access watch in PREGION[1] PRGN1RA : REGIONEN_PRGN1RA_Field := NRF_SVD.MWU.Disable; -- unspecified Reserved_28_31 : HAL.UInt4 := 16#0#; end record with Volatile_Full_Access, Object_Size => 32, Bit_Order => System.Low_Order_First; for REGIONEN_Register use record RGN0WA at 0 range 0 .. 0; RGN0RA at 0 range 1 .. 1; RGN1WA at 0 range 2 .. 2; RGN1RA at 0 range 3 .. 3; RGN2WA at 0 range 4 .. 4; RGN2RA at 0 range 5 .. 5; RGN3WA at 0 range 6 .. 6; RGN3RA at 0 range 7 .. 7; Reserved_8_23 at 0 range 8 .. 23; PRGN0WA at 0 range 24 .. 24; PRGN0RA at 0 range 25 .. 25; PRGN1WA at 0 range 26 .. 26; PRGN1RA at 0 range 27 .. 27; Reserved_28_31 at 0 range 28 .. 31; end record; -- Enable write access watch in region[0] type REGIONENSET_RGN0WA_Field is (-- Write access watch in this region is disabled Disabled, -- Write access watch in this region is enabled Enabled) with Size => 1; for REGIONENSET_RGN0WA_Field use (Disabled => 0, Enabled => 1); -- Enable write access watch in region[0] type REGIONENSET_RGN0WA_Field_1 is (-- Reset value for the field Regionenset_Rgn0Wa_Field_Reset, -- Enable write access watch in this region Set) with Size => 1; for REGIONENSET_RGN0WA_Field_1 use (Regionenset_Rgn0Wa_Field_Reset => 0, Set => 1); -- Enable read access watch in region[0] type REGIONENSET_RGN0RA_Field is (-- Read access watch in this region is disabled Disabled, -- Read access watch in this region is enabled Enabled) with Size => 1; for REGIONENSET_RGN0RA_Field use (Disabled => 0, Enabled => 1); -- Enable read access watch in region[0] type REGIONENSET_RGN0RA_Field_1 is (-- Reset value for the field Regionenset_Rgn0Ra_Field_Reset, -- Enable read access watch in this region Set) with Size => 1; for REGIONENSET_RGN0RA_Field_1 use (Regionenset_Rgn0Ra_Field_Reset => 0, Set => 1); -- Enable write access watch in region[1] type REGIONENSET_RGN1WA_Field is (-- Write access watch in this region is disabled Disabled, -- Write access watch in this region is enabled Enabled) with Size => 1; for REGIONENSET_RGN1WA_Field use (Disabled => 0, Enabled => 1); -- Enable write access watch in region[1] type REGIONENSET_RGN1WA_Field_1 is (-- Reset value for the field Regionenset_Rgn1Wa_Field_Reset, -- Enable write access watch in this region Set) with Size => 1; for REGIONENSET_RGN1WA_Field_1 use (Regionenset_Rgn1Wa_Field_Reset => 0, Set => 1); -- Enable read access watch in region[1] type REGIONENSET_RGN1RA_Field is (-- Read access watch in this region is disabled Disabled, -- Read access watch in this region is enabled Enabled) with Size => 1; for REGIONENSET_RGN1RA_Field use (Disabled => 0, Enabled => 1); -- Enable read access watch in region[1] type REGIONENSET_RGN1RA_Field_1 is (-- Reset value for the field Regionenset_Rgn1Ra_Field_Reset, -- Enable read access watch in this region Set) with Size => 1; for REGIONENSET_RGN1RA_Field_1 use (Regionenset_Rgn1Ra_Field_Reset => 0, Set => 1); -- Enable write access watch in region[2] type REGIONENSET_RGN2WA_Field is (-- Write access watch in this region is disabled Disabled, -- Write access watch in this region is enabled Enabled) with Size => 1; for REGIONENSET_RGN2WA_Field use (Disabled => 0, Enabled => 1); -- Enable write access watch in region[2] type REGIONENSET_RGN2WA_Field_1 is (-- Reset value for the field Regionenset_Rgn2Wa_Field_Reset, -- Enable write access watch in this region Set) with Size => 1; for REGIONENSET_RGN2WA_Field_1 use (Regionenset_Rgn2Wa_Field_Reset => 0, Set => 1); -- Enable read access watch in region[2] type REGIONENSET_RGN2RA_Field is (-- Read access watch in this region is disabled Disabled, -- Read access watch in this region is enabled Enabled) with Size => 1; for REGIONENSET_RGN2RA_Field use (Disabled => 0, Enabled => 1); -- Enable read access watch in region[2] type REGIONENSET_RGN2RA_Field_1 is (-- Reset value for the field Regionenset_Rgn2Ra_Field_Reset, -- Enable read access watch in this region Set) with Size => 1; for REGIONENSET_RGN2RA_Field_1 use (Regionenset_Rgn2Ra_Field_Reset => 0, Set => 1); -- Enable write access watch in region[3] type REGIONENSET_RGN3WA_Field is (-- Write access watch in this region is disabled Disabled, -- Write access watch in this region is enabled Enabled) with Size => 1; for REGIONENSET_RGN3WA_Field use (Disabled => 0, Enabled => 1); -- Enable write access watch in region[3] type REGIONENSET_RGN3WA_Field_1 is (-- Reset value for the field Regionenset_Rgn3Wa_Field_Reset, -- Enable write access watch in this region Set) with Size => 1; for REGIONENSET_RGN3WA_Field_1 use (Regionenset_Rgn3Wa_Field_Reset => 0, Set => 1); -- Enable read access watch in region[3] type REGIONENSET_RGN3RA_Field is (-- Read access watch in this region is disabled Disabled, -- Read access watch in this region is enabled Enabled) with Size => 1; for REGIONENSET_RGN3RA_Field use (Disabled => 0, Enabled => 1); -- Enable read access watch in region[3] type REGIONENSET_RGN3RA_Field_1 is (-- Reset value for the field Regionenset_Rgn3Ra_Field_Reset, -- Enable read access watch in this region Set) with Size => 1; for REGIONENSET_RGN3RA_Field_1 use (Regionenset_Rgn3Ra_Field_Reset => 0, Set => 1); -- Enable write access watch in PREGION[0] type REGIONENSET_PRGN0WA_Field is (-- Write access watch in this PREGION is disabled Disabled, -- Write access watch in this PREGION is enabled Enabled) with Size => 1; for REGIONENSET_PRGN0WA_Field use (Disabled => 0, Enabled => 1); -- Enable write access watch in PREGION[0] type REGIONENSET_PRGN0WA_Field_1 is (-- Reset value for the field Regionenset_Prgn0Wa_Field_Reset, -- Enable write access watch in this PREGION Set) with Size => 1; for REGIONENSET_PRGN0WA_Field_1 use (Regionenset_Prgn0Wa_Field_Reset => 0, Set => 1); -- Enable read access watch in PREGION[0] type REGIONENSET_PRGN0RA_Field is (-- Read access watch in this PREGION is disabled Disabled, -- Read access watch in this PREGION is enabled Enabled) with Size => 1; for REGIONENSET_PRGN0RA_Field use (Disabled => 0, Enabled => 1); -- Enable read access watch in PREGION[0] type REGIONENSET_PRGN0RA_Field_1 is (-- Reset value for the field Regionenset_Prgn0Ra_Field_Reset, -- Enable read access watch in this PREGION Set) with Size => 1; for REGIONENSET_PRGN0RA_Field_1 use (Regionenset_Prgn0Ra_Field_Reset => 0, Set => 1); -- Enable write access watch in PREGION[1] type REGIONENSET_PRGN1WA_Field is (-- Write access watch in this PREGION is disabled Disabled, -- Write access watch in this PREGION is enabled Enabled) with Size => 1; for REGIONENSET_PRGN1WA_Field use (Disabled => 0, Enabled => 1); -- Enable write access watch in PREGION[1] type REGIONENSET_PRGN1WA_Field_1 is (-- Reset value for the field Regionenset_Prgn1Wa_Field_Reset, -- Enable write access watch in this PREGION Set) with Size => 1; for REGIONENSET_PRGN1WA_Field_1 use (Regionenset_Prgn1Wa_Field_Reset => 0, Set => 1); -- Enable read access watch in PREGION[1] type REGIONENSET_PRGN1RA_Field is (-- Read access watch in this PREGION is disabled Disabled, -- Read access watch in this PREGION is enabled Enabled) with Size => 1; for REGIONENSET_PRGN1RA_Field use (Disabled => 0, Enabled => 1); -- Enable read access watch in PREGION[1] type REGIONENSET_PRGN1RA_Field_1 is (-- Reset value for the field Regionenset_Prgn1Ra_Field_Reset, -- Enable read access watch in this PREGION Set) with Size => 1; for REGIONENSET_PRGN1RA_Field_1 use (Regionenset_Prgn1Ra_Field_Reset => 0, Set => 1); -- Enable regions watch type REGIONENSET_Register is record -- Enable write access watch in region[0] RGN0WA : REGIONENSET_RGN0WA_Field_1 := Regionenset_Rgn0Wa_Field_Reset; -- Enable read access watch in region[0] RGN0RA : REGIONENSET_RGN0RA_Field_1 := Regionenset_Rgn0Ra_Field_Reset; -- Enable write access watch in region[1] RGN1WA : REGIONENSET_RGN1WA_Field_1 := Regionenset_Rgn1Wa_Field_Reset; -- Enable read access watch in region[1] RGN1RA : REGIONENSET_RGN1RA_Field_1 := Regionenset_Rgn1Ra_Field_Reset; -- Enable write access watch in region[2] RGN2WA : REGIONENSET_RGN2WA_Field_1 := Regionenset_Rgn2Wa_Field_Reset; -- Enable read access watch in region[2] RGN2RA : REGIONENSET_RGN2RA_Field_1 := Regionenset_Rgn2Ra_Field_Reset; -- Enable write access watch in region[3] RGN3WA : REGIONENSET_RGN3WA_Field_1 := Regionenset_Rgn3Wa_Field_Reset; -- Enable read access watch in region[3] RGN3RA : REGIONENSET_RGN3RA_Field_1 := Regionenset_Rgn3Ra_Field_Reset; -- unspecified Reserved_8_23 : HAL.UInt16 := 16#0#; -- Enable write access watch in PREGION[0] PRGN0WA : REGIONENSET_PRGN0WA_Field_1 := Regionenset_Prgn0Wa_Field_Reset; -- Enable read access watch in PREGION[0] PRGN0RA : REGIONENSET_PRGN0RA_Field_1 := Regionenset_Prgn0Ra_Field_Reset; -- Enable write access watch in PREGION[1] PRGN1WA : REGIONENSET_PRGN1WA_Field_1 := Regionenset_Prgn1Wa_Field_Reset; -- Enable read access watch in PREGION[1] PRGN1RA : REGIONENSET_PRGN1RA_Field_1 := Regionenset_Prgn1Ra_Field_Reset; -- unspecified Reserved_28_31 : HAL.UInt4 := 16#0#; end record with Volatile_Full_Access, Object_Size => 32, Bit_Order => System.Low_Order_First; for REGIONENSET_Register use record RGN0WA at 0 range 0 .. 0; RGN0RA at 0 range 1 .. 1; RGN1WA at 0 range 2 .. 2; RGN1RA at 0 range 3 .. 3; RGN2WA at 0 range 4 .. 4; RGN2RA at 0 range 5 .. 5; RGN3WA at 0 range 6 .. 6; RGN3RA at 0 range 7 .. 7; Reserved_8_23 at 0 range 8 .. 23; PRGN0WA at 0 range 24 .. 24; PRGN0RA at 0 range 25 .. 25; PRGN1WA at 0 range 26 .. 26; PRGN1RA at 0 range 27 .. 27; Reserved_28_31 at 0 range 28 .. 31; end record; -- Disable write access watch in region[0] type REGIONENCLR_RGN0WA_Field is (-- Write access watch in this region is disabled Disabled, -- Write access watch in this region is enabled Enabled) with Size => 1; for REGIONENCLR_RGN0WA_Field use (Disabled => 0, Enabled => 1); -- Disable write access watch in region[0] type REGIONENCLR_RGN0WA_Field_1 is (-- Reset value for the field Regionenclr_Rgn0Wa_Field_Reset, -- Disable write access watch in this region Clear) with Size => 1; for REGIONENCLR_RGN0WA_Field_1 use (Regionenclr_Rgn0Wa_Field_Reset => 0, Clear => 1); -- Disable read access watch in region[0] type REGIONENCLR_RGN0RA_Field is (-- Read access watch in this region is disabled Disabled, -- Read access watch in this region is enabled Enabled) with Size => 1; for REGIONENCLR_RGN0RA_Field use (Disabled => 0, Enabled => 1); -- Disable read access watch in region[0] type REGIONENCLR_RGN0RA_Field_1 is (-- Reset value for the field Regionenclr_Rgn0Ra_Field_Reset, -- Disable read access watch in this region Clear) with Size => 1; for REGIONENCLR_RGN0RA_Field_1 use (Regionenclr_Rgn0Ra_Field_Reset => 0, Clear => 1); -- Disable write access watch in region[1] type REGIONENCLR_RGN1WA_Field is (-- Write access watch in this region is disabled Disabled, -- Write access watch in this region is enabled Enabled) with Size => 1; for REGIONENCLR_RGN1WA_Field use (Disabled => 0, Enabled => 1); -- Disable write access watch in region[1] type REGIONENCLR_RGN1WA_Field_1 is (-- Reset value for the field Regionenclr_Rgn1Wa_Field_Reset, -- Disable write access watch in this region Clear) with Size => 1; for REGIONENCLR_RGN1WA_Field_1 use (Regionenclr_Rgn1Wa_Field_Reset => 0, Clear => 1); -- Disable read access watch in region[1] type REGIONENCLR_RGN1RA_Field is (-- Read access watch in this region is disabled Disabled, -- Read access watch in this region is enabled Enabled) with Size => 1; for REGIONENCLR_RGN1RA_Field use (Disabled => 0, Enabled => 1); -- Disable read access watch in region[1] type REGIONENCLR_RGN1RA_Field_1 is (-- Reset value for the field Regionenclr_Rgn1Ra_Field_Reset, -- Disable read access watch in this region Clear) with Size => 1; for REGIONENCLR_RGN1RA_Field_1 use (Regionenclr_Rgn1Ra_Field_Reset => 0, Clear => 1); -- Disable write access watch in region[2] type REGIONENCLR_RGN2WA_Field is (-- Write access watch in this region is disabled Disabled, -- Write access watch in this region is enabled Enabled) with Size => 1; for REGIONENCLR_RGN2WA_Field use (Disabled => 0, Enabled => 1); -- Disable write access watch in region[2] type REGIONENCLR_RGN2WA_Field_1 is (-- Reset value for the field Regionenclr_Rgn2Wa_Field_Reset, -- Disable write access watch in this region Clear) with Size => 1; for REGIONENCLR_RGN2WA_Field_1 use (Regionenclr_Rgn2Wa_Field_Reset => 0, Clear => 1); -- Disable read access watch in region[2] type REGIONENCLR_RGN2RA_Field is (-- Read access watch in this region is disabled Disabled, -- Read access watch in this region is enabled Enabled) with Size => 1; for REGIONENCLR_RGN2RA_Field use (Disabled => 0, Enabled => 1); -- Disable read access watch in region[2] type REGIONENCLR_RGN2RA_Field_1 is (-- Reset value for the field Regionenclr_Rgn2Ra_Field_Reset, -- Disable read access watch in this region Clear) with Size => 1; for REGIONENCLR_RGN2RA_Field_1 use (Regionenclr_Rgn2Ra_Field_Reset => 0, Clear => 1); -- Disable write access watch in region[3] type REGIONENCLR_RGN3WA_Field is (-- Write access watch in this region is disabled Disabled, -- Write access watch in this region is enabled Enabled) with Size => 1; for REGIONENCLR_RGN3WA_Field use (Disabled => 0, Enabled => 1); -- Disable write access watch in region[3] type REGIONENCLR_RGN3WA_Field_1 is (-- Reset value for the field Regionenclr_Rgn3Wa_Field_Reset, -- Disable write access watch in this region Clear) with Size => 1; for REGIONENCLR_RGN3WA_Field_1 use (Regionenclr_Rgn3Wa_Field_Reset => 0, Clear => 1); -- Disable read access watch in region[3] type REGIONENCLR_RGN3RA_Field is (-- Read access watch in this region is disabled Disabled, -- Read access watch in this region is enabled Enabled) with Size => 1; for REGIONENCLR_RGN3RA_Field use (Disabled => 0, Enabled => 1); -- Disable read access watch in region[3] type REGIONENCLR_RGN3RA_Field_1 is (-- Reset value for the field Regionenclr_Rgn3Ra_Field_Reset, -- Disable read access watch in this region Clear) with Size => 1; for REGIONENCLR_RGN3RA_Field_1 use (Regionenclr_Rgn3Ra_Field_Reset => 0, Clear => 1); -- Disable write access watch in PREGION[0] type REGIONENCLR_PRGN0WA_Field is (-- Write access watch in this PREGION is disabled Disabled, -- Write access watch in this PREGION is enabled Enabled) with Size => 1; for REGIONENCLR_PRGN0WA_Field use (Disabled => 0, Enabled => 1); -- Disable write access watch in PREGION[0] type REGIONENCLR_PRGN0WA_Field_1 is (-- Reset value for the field Regionenclr_Prgn0Wa_Field_Reset, -- Disable write access watch in this PREGION Clear) with Size => 1; for REGIONENCLR_PRGN0WA_Field_1 use (Regionenclr_Prgn0Wa_Field_Reset => 0, Clear => 1); -- Disable read access watch in PREGION[0] type REGIONENCLR_PRGN0RA_Field is (-- Read access watch in this PREGION is disabled Disabled, -- Read access watch in this PREGION is enabled Enabled) with Size => 1; for REGIONENCLR_PRGN0RA_Field use (Disabled => 0, Enabled => 1); -- Disable read access watch in PREGION[0] type REGIONENCLR_PRGN0RA_Field_1 is (-- Reset value for the field Regionenclr_Prgn0Ra_Field_Reset, -- Disable read access watch in this PREGION Clear) with Size => 1; for REGIONENCLR_PRGN0RA_Field_1 use (Regionenclr_Prgn0Ra_Field_Reset => 0, Clear => 1); -- Disable write access watch in PREGION[1] type REGIONENCLR_PRGN1WA_Field is (-- Write access watch in this PREGION is disabled Disabled, -- Write access watch in this PREGION is enabled Enabled) with Size => 1; for REGIONENCLR_PRGN1WA_Field use (Disabled => 0, Enabled => 1); -- Disable write access watch in PREGION[1] type REGIONENCLR_PRGN1WA_Field_1 is (-- Reset value for the field Regionenclr_Prgn1Wa_Field_Reset, -- Disable write access watch in this PREGION Clear) with Size => 1; for REGIONENCLR_PRGN1WA_Field_1 use (Regionenclr_Prgn1Wa_Field_Reset => 0, Clear => 1); -- Disable read access watch in PREGION[1] type REGIONENCLR_PRGN1RA_Field is (-- Read access watch in this PREGION is disabled Disabled, -- Read access watch in this PREGION is enabled Enabled) with Size => 1; for REGIONENCLR_PRGN1RA_Field use (Disabled => 0, Enabled => 1); -- Disable read access watch in PREGION[1] type REGIONENCLR_PRGN1RA_Field_1 is (-- Reset value for the field Regionenclr_Prgn1Ra_Field_Reset, -- Disable read access watch in this PREGION Clear) with Size => 1; for REGIONENCLR_PRGN1RA_Field_1 use (Regionenclr_Prgn1Ra_Field_Reset => 0, Clear => 1); -- Disable regions watch type REGIONENCLR_Register is record -- Disable write access watch in region[0] RGN0WA : REGIONENCLR_RGN0WA_Field_1 := Regionenclr_Rgn0Wa_Field_Reset; -- Disable read access watch in region[0] RGN0RA : REGIONENCLR_RGN0RA_Field_1 := Regionenclr_Rgn0Ra_Field_Reset; -- Disable write access watch in region[1] RGN1WA : REGIONENCLR_RGN1WA_Field_1 := Regionenclr_Rgn1Wa_Field_Reset; -- Disable read access watch in region[1] RGN1RA : REGIONENCLR_RGN1RA_Field_1 := Regionenclr_Rgn1Ra_Field_Reset; -- Disable write access watch in region[2] RGN2WA : REGIONENCLR_RGN2WA_Field_1 := Regionenclr_Rgn2Wa_Field_Reset; -- Disable read access watch in region[2] RGN2RA : REGIONENCLR_RGN2RA_Field_1 := Regionenclr_Rgn2Ra_Field_Reset; -- Disable write access watch in region[3] RGN3WA : REGIONENCLR_RGN3WA_Field_1 := Regionenclr_Rgn3Wa_Field_Reset; -- Disable read access watch in region[3] RGN3RA : REGIONENCLR_RGN3RA_Field_1 := Regionenclr_Rgn3Ra_Field_Reset; -- unspecified Reserved_8_23 : HAL.UInt16 := 16#0#; -- Disable write access watch in PREGION[0] PRGN0WA : REGIONENCLR_PRGN0WA_Field_1 := Regionenclr_Prgn0Wa_Field_Reset; -- Disable read access watch in PREGION[0] PRGN0RA : REGIONENCLR_PRGN0RA_Field_1 := Regionenclr_Prgn0Ra_Field_Reset; -- Disable write access watch in PREGION[1] PRGN1WA : REGIONENCLR_PRGN1WA_Field_1 := Regionenclr_Prgn1Wa_Field_Reset; -- Disable read access watch in PREGION[1] PRGN1RA : REGIONENCLR_PRGN1RA_Field_1 := Regionenclr_Prgn1Ra_Field_Reset; -- unspecified Reserved_28_31 : HAL.UInt4 := 16#0#; end record with Volatile_Full_Access, Object_Size => 32, Bit_Order => System.Low_Order_First; for REGIONENCLR_Register use record RGN0WA at 0 range 0 .. 0; RGN0RA at 0 range 1 .. 1; RGN1WA at 0 range 2 .. 2; RGN1RA at 0 range 3 .. 3; RGN2WA at 0 range 4 .. 4; RGN2RA at 0 range 5 .. 5; RGN3WA at 0 range 6 .. 6; RGN3RA at 0 range 7 .. 7; Reserved_8_23 at 0 range 8 .. 23; PRGN0WA at 0 range 24 .. 24; PRGN0RA at 0 range 25 .. 25; PRGN1WA at 0 range 26 .. 26; PRGN1RA at 0 range 27 .. 27; Reserved_28_31 at 0 range 28 .. 31; end record; -------------------------------- -- REGION cluster's Registers -- -------------------------------- -- Unspecified type REGION_Cluster is record -- Description cluster[0]: Start address for region 0 START : aliased HAL.UInt32; -- Description cluster[0]: End address of region 0 END_k : aliased HAL.UInt32; end record with Size => 64; for REGION_Cluster use record START at 16#0# range 0 .. 31; END_k at 16#4# range 0 .. 31; end record; -- Unspecified type REGION_Clusters is array (0 .. 3) of REGION_Cluster; --------------------------------- -- PREGION cluster's Registers -- --------------------------------- -- Include or exclude subregion 0 in region type SUBS_SR0_Field is (-- Exclude Exclude, -- Include Include) with Size => 1; for SUBS_SR0_Field use (Exclude => 0, Include => 1); -- SUBS_PREGION_SR array type SUBS_PREGION_SR_Field_Array is array (0 .. 31) of SUBS_SR0_Field with Component_Size => 1, Size => 32; -- Description cluster[0]: Subregions of region 0 type SUBS_PREGION_Register (As_Array : Boolean := False) is record case As_Array is when False => -- SR as a value Val : HAL.UInt32; when True => -- SR as an array Arr : SUBS_PREGION_SR_Field_Array; end case; end record with Unchecked_Union, Size => 32, Volatile_Full_Access, Object_Size => 32, Bit_Order => System.Low_Order_First; for SUBS_PREGION_Register use record Val at 0 range 0 .. 31; Arr at 0 range 0 .. 31; end record; -- Unspecified type PREGION_Cluster is record -- Description cluster[0]: Reserved for future use START : aliased HAL.UInt32; -- Description cluster[0]: Reserved for future use END_k : aliased HAL.UInt32; -- Description cluster[0]: Subregions of region 0 SUBS : aliased SUBS_PREGION_Register; end record with Size => 96; for PREGION_Cluster use record START at 16#0# range 0 .. 31; END_k at 16#4# range 0 .. 31; SUBS at 16#8# range 0 .. 31; end record; -- Unspecified type PREGION_Clusters is array (0 .. 1) of PREGION_Cluster; ----------------- -- Peripherals -- ----------------- -- Memory Watch Unit type MWU_Peripheral is record -- Unspecified EVENTS_REGION : aliased EVENTS_REGION_Clusters; -- Unspecified EVENTS_PREGION : aliased EVENTS_PREGION_Clusters; -- Enable or disable interrupt INTEN : aliased INTEN_Register; -- Enable interrupt INTENSET : aliased INTENSET_Register; -- Disable interrupt INTENCLR : aliased INTENCLR_Register; -- Enable or disable non-maskable interrupt NMIEN : aliased NMIEN_Register; -- Enable non-maskable interrupt NMIENSET : aliased NMIENSET_Register; -- Disable non-maskable interrupt NMIENCLR : aliased NMIENCLR_Register; -- Unspecified PERREGION : aliased PERREGION_Clusters; -- Enable/disable regions watch REGIONEN : aliased REGIONEN_Register; -- Enable regions watch REGIONENSET : aliased REGIONENSET_Register; -- Disable regions watch REGIONENCLR : aliased REGIONENCLR_Register; -- Unspecified REGION : aliased REGION_Clusters; -- Unspecified PREGION : aliased PREGION_Clusters; end record with Volatile; for MWU_Peripheral use record EVENTS_REGION at 16#100# range 0 .. 255; EVENTS_PREGION at 16#160# range 0 .. 127; INTEN at 16#300# range 0 .. 31; INTENSET at 16#304# range 0 .. 31; INTENCLR at 16#308# range 0 .. 31; NMIEN at 16#320# range 0 .. 31; NMIENSET at 16#324# range 0 .. 31; NMIENCLR at 16#328# range 0 .. 31; PERREGION at 16#400# range 0 .. 127; REGIONEN at 16#510# range 0 .. 31; REGIONENSET at 16#514# range 0 .. 31; REGIONENCLR at 16#518# range 0 .. 31; REGION at 16#600# range 0 .. 255; PREGION at 16#6C0# range 0 .. 191; end record; -- Memory Watch Unit MWU_Periph : aliased MWU_Peripheral with Import, Address => MWU_Base; end NRF_SVD.MWU;
charlie5/lace
Ada
762
adb
package body lace.Observer.deferred is package body Forge is function to_Observer (Name : in Event.observer_Name) return Item is begin return Self : constant Item := (Deferred.item with name => to_unbounded_String (Name)) do null; end return; end to_Observer; function new_Observer (Name : in Event.observer_Name) return View is Self : constant View := new Item' (to_Observer (Name)); begin return Self; end new_Observer; end Forge; overriding function Name (Self : in Item) return Event.observer_Name is begin return to_String (Self.Name); end Name; end lace.Observer.deferred;
redparavoz/ada-wiki
Ada
4,077
ads
----------------------------------------------------------------------- -- wiki-streams-text_io -- Text_IO input output streams -- Copyright (C) 2016 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.Wide_Wide_Text_IO; with Ada.Finalization; -- === Text_IO Input and Output streams === -- The <tt>Wiki.Streams.Text_IO</tt> package defines the <tt>File_Input_Stream</tt> and -- the <tt>File_Output_Stream</tt/ types which use the <tt>Ada.Wide_Wide_Text_IO</tt> package -- to read or write the output streams. -- -- By default the <tt>File_Input_Stream</tt> is configured to read the standard input. -- The <tt>Open</tt> procedure can be used to read from a file knowing its name. -- -- The <tt>File_Output_Stream</tt> is configured to write on the standard output. -- The <tt>Open</tt> and <tt>Create</tt> procedure can be used to write on a file. -- package Wiki.Streams.Text_IO is type File_Input_Stream is limited new Ada.Finalization.Limited_Controlled and Wiki.Streams.Input_Stream with private; type File_Input_Stream_Access is access all File_Input_Stream'Class; -- Open the file and prepare to read the input stream. procedure Open (Stream : in out File_Input_Stream; Path : in String; Form : in String := ""); -- Read one character from the input stream and return False to the <tt>Eof</tt> indicator. -- When there is no character to read, return True in the <tt>Eof</tt> indicator. overriding procedure Read (Input : in out File_Input_Stream; Char : out Wiki.Strings.WChar; Eof : out Boolean); -- Close the file. procedure Close (Stream : in out File_Input_Stream); -- Close the stream. overriding procedure Finalize (Stream : in out File_Input_Stream); type File_Output_Stream is limited new Ada.Finalization.Limited_Controlled and Wiki.Streams.Output_Stream with private; type File_Output_Stream_Access is access all File_Output_Stream'Class; -- Open the file and prepare to write the output stream. procedure Open (Stream : in out File_Output_Stream; Path : in String; Form : in String := ""); -- Create the file and prepare to write the output stream. procedure Create (Stream : in out File_Output_Stream; Path : in String; Form : in String := ""); -- Close the file. procedure Close (Stream : in out File_Output_Stream); -- Write the string to the output stream. overriding procedure Write (Stream : in out File_Output_Stream; Content : in Wiki.Strings.WString); -- Write a single character to the output stream. overriding procedure Write (Stream : in out File_Output_Stream; Char : in Wiki.Strings.WChar); -- Close the stream. overriding procedure Finalize (Stream : in out File_Output_Stream); private type File_Input_Stream is limited new Ada.Finalization.Limited_Controlled and Wiki.Streams.Input_Stream with record File : Ada.Wide_Wide_Text_IO.File_Type; end record; type File_Output_Stream is limited new Ada.Finalization.Limited_Controlled and Wiki.Streams.Output_Stream with record File : Ada.Wide_Wide_Text_IO.File_Type; Stdout : Boolean := True; end record; end Wiki.Streams.Text_IO;
reznikmm/matreshka
Ada
4,744
adb
------------------------------------------------------------------------------ -- -- -- Matreshka Project -- -- -- -- Open Document Toolkit -- -- -- -- Runtime Library Component -- -- -- ------------------------------------------------------------------------------ -- -- -- Copyright © 2014, Vadim Godunko <[email protected]> -- -- All rights reserved. -- -- -- -- Redistribution and use in source and binary forms, with or without -- -- modification, are permitted provided that the following conditions -- -- are met: -- -- -- -- * Redistributions of source code must retain the above copyright -- -- notice, this list of conditions and the following disclaimer. -- -- -- -- * Redistributions in binary form must reproduce the above copyright -- -- notice, this list of conditions and the following disclaimer in the -- -- documentation and/or other materials provided with the distribution. -- -- -- -- * Neither the name of the Vadim Godunko, IE nor the names of its -- -- contributors may be used to endorse or promote products derived from -- -- this software without specific prior written permission. -- -- -- -- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -- -- "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -- -- LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -- -- A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -- -- HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -- -- SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED -- -- TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -- -- PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -- -- LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -- -- NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -- -- SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -- -- -- ------------------------------------------------------------------------------ -- $Revision$ $Date$ ------------------------------------------------------------------------------ with Matreshka.DOM_Documents; with Matreshka.ODF_String_Constants; with ODF.DOM.Iterators; with ODF.DOM.Visitors; package body Matreshka.ODF_Table.Number_Matrix_Rows_Spanned_Attributes is ------------ -- Create -- ------------ overriding function Create (Parameters : not null access Matreshka.DOM_Attributes.Attribute_L2_Parameters) return Table_Number_Matrix_Rows_Spanned_Attribute_Node is begin return Self : Table_Number_Matrix_Rows_Spanned_Attribute_Node do Matreshka.ODF_Table.Constructors.Initialize (Self'Unchecked_Access, Parameters.Document, Matreshka.ODF_String_Constants.Table_Prefix); end return; end Create; -------------------- -- Get_Local_Name -- -------------------- overriding function Get_Local_Name (Self : not null access constant Table_Number_Matrix_Rows_Spanned_Attribute_Node) return League.Strings.Universal_String is pragma Unreferenced (Self); begin return Matreshka.ODF_String_Constants.Number_Matrix_Rows_Spanned_Attribute; end Get_Local_Name; begin Matreshka.DOM_Documents.Register_Attribute (Matreshka.ODF_String_Constants.Table_URI, Matreshka.ODF_String_Constants.Number_Matrix_Rows_Spanned_Attribute, Table_Number_Matrix_Rows_Spanned_Attribute_Node'Tag); end Matreshka.ODF_Table.Number_Matrix_Rows_Spanned_Attributes;
HackInvent/Ada_Drivers_Library
Ada
4,404
ads
-- This spec has been automatically generated from STM32H7x3.svd pragma Restrictions (No_Elaboration_Code); pragma Ada_2012; pragma Style_Checks (Off); with System; package STM32_SVD.RNG is pragma Preelaborate; --------------- -- Registers -- --------------- -- RNG control register type RNG_CR_Register is record -- unspecified Reserved_0_1 : STM32_SVD.UInt2 := 16#0#; -- Random number generator enable RNGEN : Boolean := False; -- Interrupt enable IE : Boolean := False; -- unspecified Reserved_4_4 : STM32_SVD.Bit := 16#0#; -- Clock error detection Note: The clock error detection can be used -- only when ck_rc48 or ck_pll1_q (ck_pll1_q = 48MHz) source is selected -- otherwise, CED bit must be equal to 1. The clock error detection -- cannot be enabled nor disabled on the fly when RNG peripheral is -- enabled, to enable or disable CED the RNG must be disabled. CED : Boolean := False; -- unspecified Reserved_6_31 : STM32_SVD.UInt26 := 16#0#; end record with Volatile_Full_Access, Object_Size => 32, Bit_Order => System.Low_Order_First; for RNG_CR_Register use record Reserved_0_1 at 0 range 0 .. 1; RNGEN at 0 range 2 .. 2; IE at 0 range 3 .. 3; Reserved_4_4 at 0 range 4 .. 4; CED at 0 range 5 .. 5; Reserved_6_31 at 0 range 6 .. 31; end record; -- RNG status register type RNG_SR_Register is record -- Read-only. Data ready Note: If IE=1 in RNG_CR, an interrupt is -- generated when DRDY=1. It can rise when the peripheral is disabled. -- When the output buffer becomes empty (after reading RNG_DR), this bit -- returns to 0 until a new random value is generated. DRDY : Boolean := False; -- Read-only. Clock error current status Note: This bit is meaningless -- if CED (Clock error detection) bit in RNG_CR is equal to 1. CECS : Boolean := False; -- Read-only. Seed error current status ** More than 64 consecutive bits -- at the same value (0 or 1) ** More than 32 consecutive alternances of -- 0 and 1 (0101010101...01) SECS : Boolean := False; -- unspecified Reserved_3_4 : STM32_SVD.UInt2 := 16#0#; -- Clock error interrupt status This bit is set at the same time as -- CECS. It is cleared by writing it to 0. An interrupt is pending if IE -- = 1 in the RNG_CR register. Note: This bit is meaningless if CED -- (Clock error detection) bit in RNG_CR is equal to 1. CEIS : Boolean := False; -- Seed error interrupt status This bit is set at the same time as SECS. -- It is cleared by writing it to 0. ** More than 64 consecutive bits at -- the same value (0 or 1) ** More than 32 consecutive alternances of 0 -- and 1 (0101010101...01) An interrupt is pending if IE = 1 in the -- RNG_CR register. SEIS : Boolean := False; -- unspecified Reserved_7_31 : STM32_SVD.UInt25 := 16#0#; end record with Volatile_Full_Access, Object_Size => 32, Bit_Order => System.Low_Order_First; for RNG_SR_Register use record DRDY at 0 range 0 .. 0; CECS at 0 range 1 .. 1; SECS at 0 range 2 .. 2; Reserved_3_4 at 0 range 3 .. 4; CEIS at 0 range 5 .. 5; SEIS at 0 range 6 .. 6; Reserved_7_31 at 0 range 7 .. 31; end record; ----------------- -- Peripherals -- ----------------- -- RNG type RNG_Peripheral is record -- RNG control register RNG_CR : aliased RNG_CR_Register; -- RNG status register RNG_SR : aliased RNG_SR_Register; -- The RNG_DR register is a read-only register that delivers a 32-bit -- random value when read. The content of this register is valid when -- DRDY= 1, even if RNGEN=0. RNG_DR : aliased STM32_SVD.UInt32; end record with Volatile; for RNG_Peripheral use record RNG_CR at 16#0# range 0 .. 31; RNG_SR at 16#4# range 0 .. 31; RNG_DR at 16#8# range 0 .. 31; end record; -- RNG RNG_Periph : aliased RNG_Peripheral with Import, Address => RNG_Base; end STM32_SVD.RNG;
onox/orka
Ada
1,648
ads
-- SPDX-License-Identifier: Apache-2.0 -- -- Copyright (c) 2021 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.SSE.Singles; package Orka.SIMD.SSE2.Integers.Random with SPARK_Mode => On is pragma Pure; use Orka.SIMD.SSE.Singles; type State is limited private; pragma Preelaborable_Initialization (State); procedure Next (S : in out State; Value : out m128i) with Inline_Always, Global => null, Depends => ((S, Value) => S); -- Use and modify the given state to generate multiple -- random unsigned integers procedure Next (S : in out State; Value : out m128) with Inline_Always, Global => null, Depends => ((S, Value) => S); -- Use and modify the given state to generate multiple random -- floating-point numbers in the interval [0, 1). procedure Reset (S : out State; Seed : Duration) with Global => null, Depends => (S => Seed), Pre => Seed /= 0.0; private type State is array (Integer_32 range 0 .. 3) of m128i; end Orka.SIMD.SSE2.Integers.Random;
charlie5/cBound
Ada
782
ads
-- This file is generated by SWIG. Please do *not* modify by hand. -- with gmp_c.a_a_gmp_randstate_struct; with Interfaces.C; package gmp_c.gmp_randstate_t is -- Item -- type Item is array (Interfaces.C .size_t range 0 .. 0) of aliased gmp_c.a_a_gmp_randstate_struct.Item; -- Items -- type Items is array (Interfaces.C.size_t range <>) of aliased gmp_c.gmp_randstate_t.Item; -- Pointer -- type Pointer is access all gmp_c.gmp_randstate_t.Item; -- Pointers -- type Pointers is array (Interfaces.C.size_t range <>) of aliased gmp_c.gmp_randstate_t.Pointer; -- Pointer_Pointer -- type Pointer_Pointer is access all gmp_c.gmp_randstate_t.Pointer; end gmp_c.gmp_randstate_t;
Intelligente-sanntidssystemer/Ada-prosjekt
Ada
1,982
adb
with NRF52_DK.Time; with HAL; use HAL; with NRF52_DK.IOs; package body sensor_behind is --Declaration of the PinIDs and type of the variables TrigPin : NRF52_DK.IOs.Pin_Id := 12; EchoPin : NRF52_DK.IOs.Pin_Id := 11; CurrentTime : NRF52_DK.Time.Time_Ms; Duration_Result : Duration; Pulse : Boolean; function HCSR04_Behind_Distance return Float is begin CurrentTime := NRF52_DK.Time.Clock; --Making sure the TrigPin is clear so we set it on false for 2 microseconds. NRF52_DK.IOs.Set(TrigPin, False); NRF52_DK.Time.Delay_Ms(Uint64(CurrentTime / 1000) + UInt64 (2 / 1000)); CurrentTime := NRF52_DK.Time.Clock; --To generate the ultra sound wave we have to set the TrigPin on high/true state for 10 microseconds. NRF52_DK.IOs.Set(TrigPin, True); NRF52_DK.Time.Delay_Ms (Uint64(CurrentTime / 1000) +UInt64 (10 / 1000)); NRF52_DK.IOs.Set(TrigPin, False); --We need to make sure there isn't any interrupts between these parts Pulse := NRF52_DK.IOs.Set(EchoPin); --Returns duration when EchoPin is HIGH. if NRF52_DK.IOs.Set(EchoPin) = True then CurrentTime := NRF52_DK.Time.Clock; --Supposed to return make the result into a duration but due to --NRF52_DK packages not having a function for that and Ada.Real_time not working, we couldn't make the code function properly. Duration_Result := Ada.Real_Time.To_Duration(NRF52_DK.Time.Clock - CurrentTime); return (Float(Duration_Result) / 58.0) * 1000000.0; --In order to get the distance we will divide the Duration_Result with 58 --and then multiply it with 1000000 which turns the microseconds into seconds. end if; return -1.0; end HCSR04_Behind_Distance; --Source: https://github.com/gamegine/HCSR04-ultrasonic-sensor-lib/blob/master/src/HCSR04.cpp end sensor_behind;
AdaCore/gpr
Ada
5,245
adb
with Test_GPR; with Test_Assert; with GPR2.Project.Tree; with GPR2.Containers; use GPR2.Containers; with GPR2.Source_Reference.Value; with GNAT.IO; with System.OS_Constants; function Test return Integer is package TGPR renames Test_GPR; package A renames Test_Assert; package IO renames GNAT.IO; Tree : GPR2.Project.Tree.Object; Comp_Switches : Name_List; Languages : Name_List; File_List : Name_List; begin TGPR.Load_With_No_Errors (Tree, "./gpr/root.gpr", Config_Filename => "./gpr/config.gpr", Load_Source_List => True); -- Basic attribute retrieval IO.Put_Line ("Check object dir value defined explicitely"); TGPR.Assert_Attribute (Tree.Root_Project, "object_dir", Value => "myobj"); IO.Put_Line ("Check that exec_dir default to object_dir value"); TGPR.Assert_Attribute (Tree.Root_Project, "exec_dir", Value => "myobj"); IO.Put_Line ("Check that library_name is inherited"); TGPR.Assert_Attribute (Tree.Root_Project, "library_name", Value => "mylib"); IO.Put_Line ("Check default value for Library_Kind"); TGPR.Assert_Attribute (Tree.Root_Project, "library_kind", Value => "static"); IO.Put_Line ("Check that archive_suffix is not inherited and that default is used"); TGPR.Assert_Attribute (Tree.Root_Project, "archive_suffix", Value => ".a"); IO.Put_Line ("Check package inheritance mechanism"); TGPR.Assert_Attribute (Tree.Root_Project, "install_name", Pkg => "install", Value => "myname"); IO.Put_Line (" Mode value should not be inherited from extended as " & "packages are inherited as a whole"); TGPR.Assert_Attribute_Not_Defined (Tree.Root_Project, "mode", Pkg => "install"); IO.Put_Line ("Check languages (inherited and concatenated from extended)"); Languages.Append("C"); Languages.Append("Ada"); TGPR.Assert_Attribute (Tree.Root_Project, Name => "Languages", Value => Languages); IO.Put_Line ("Check multi value assignment"); -- full associative array in pkg Comp_Switches.Clear; Comp_Switches.Append ("ada_switch"); TGPR.Assert_Attribute (Tree.Root_Project, Name => "Switches", Pkg => "Linker", Index => "ada", Value => Comp_Switches); Comp_Switches.Clear; Comp_Switches.Append ("c_switch"); TGPR.Assert_Attribute (Tree.Root_Project, Name => "Switches", Pkg => "Linker", Index => "c", Value => Comp_Switches); -- full associative array at top level TGPR.Assert_Attribute (Tree.Root_Project, Name => "Runtime", Index => "c", Value => "foo"); TGPR.Assert_Attribute (Tree.Root_Project, Name => "Runtime", Index => "ada", Value => "bar"); -- full associative array concatenation from config TGPR.Assert_Attribute (Tree.Root_Project, Name => "Runtime", Index => "c++", Value => "baz"); IO.Put_Line ("test default value for config attributes"); TGPR.Assert_Attribute (Tree.Root_Project, Name => "Target", Value => "all2"); IO.Put_Line ("test pattern matching"); Comp_Switches.Clear; -- Ada switch from config Comp_Switches.Append ("-config-ada"); -- File-specific switch from project Comp_Switches.Append ("-Ospecial"); TGPR.Assert_Attribute (Tree.Root_Project, Name => "Switches", Pkg => "Compiler", Index => "myadaunit.ads", Value => Comp_Switches); IO.Put_Line ("test pattern matching vs. language index"); Comp_Switches.Clear; Comp_Switches.Append ("-g"); TGPR.Assert_Attribute (Tree.Root_Project, Name => "Switches", Pkg => "Compiler", Index => "c", Value => Comp_Switches); IO.Put_Line ("test config concatenation"); Comp_Switches.Clear; Comp_Switches.Append ("-config-ada"); Comp_Switches.Append ("-test-switch"); TGPR.Assert_Attribute (Tree.Root_Project, Name => "Switches", Pkg => "Compiler", Index => "ada", Value => Comp_Switches); IO.Put_Line ("test invalid attributes"); TGPR.Assert_Attribute_Error (Tree.Root_Project, Name => "Inexistent_Attribute"); TGPR.Assert_Attribute_Error (Tree.Root_Project, Name => "Inexistent_Attribute", Pkg => "Compiler"); TGPR.Assert_Attribute_Error (Tree.Root_Project, Name => "Inexistent_Attribute", Pkg => "Inexistent_Package"); IO.Put_Line ("test attribute alias names"); TGPR.Assert_Attribute (Tree.Root_Project, Name => "Spec", Pkg => "Naming", Index => "myadaunit", Value => "myadaunit.ads"); TGPR.Assert_Attribute (Tree.Root_Project, Name => "Specification", Pkg => "Naming", Index => "myadaunit", Value => "myadaunit.ads"); File_List.Append("file.adb"); File_List.Append("file.ads"); TGPR.Assert_Attribute (Tree.Root_Project, Name => "Locally_Removed_Files", Value => File_List); TGPR.Assert_Attribute (Tree.Root_Project, Name => "Excluded_Source_Files", Value => File_List); return A.Report; end Test;
usnistgov/rcslib
Ada
1,058
adb
with Nml; use Nml; with Mynmlmsg; use Mynmlmsg; with Ada.Text_IO; with Ada.Integer_Text_IO; with Unchecked_Conversion; with Interfaces.C; procedure Nmltest is Connection1 : NmlConnection_Access; Connection2 : NmlConnection_Access; Read_Msg : Mynmlmsg_Type_Access; Msg : Mynmlmsg_Type_Access; Ok : Integer := 0; Msg_Type : Integer; begin Msg := new Mynmlmsg_Type; Msg.AnotherInt := 67; Connection1 := Nml.CreateConnection(Mynmlmsg.Format'Access,"b1","proc","nmlcfgsvr::::options=neutral=1"); Connection2 := Nml.CreateConnection(Mynmlmsg.Format'Access,"b1","proc","nmlcfgsvr::::options=neutral=1"); Ok := Nml.Write(Connection1,NmlMsg_Access(Msg)); Msg_Type := Nml.Read(Connection2); if Msg_Type = 1001 then Read_Msg := Mynmlmsg.NmlMsg_Access_To_Mynmlmsg_Type_Access(Nml.Get_Address(Connection2)); Ada.Text_IO.Put("Read_Msg.AnotherInt="); Ada.Integer_Text_IO.Put(Integer(Read_Msg.AnotherInt)); Ada.Text_IO.New_Line; end if; Nml.Free(Connection2); Nml.Free(Connection1); end Nmltest;
mimo/Tracker
Ada
903
adb
package body surface.elements is procedure quad (X,Y, Width, Height : Integer ; Border : Boolean := False) is use raylib; begin raylib.shapes.draw_rectangle ( posX => int(X), posY => int(Y), width => int(Width), height => int(Height), c => raylib.LIGHTGRAY); if Border then raylib.shapes.draw_rectangle_lines_ex ( rec => (float(X), float(Y), float(Width), float(Height)), line_thick => 2, c => GOLD); end if; end quad; procedure print (X,Y : Integer; Text : String; Size : Integer := 16) is begin raylib.text.draw_ex ( raylib.text.get_font_default, text, (Float(X), Float(Y)), Float(Size), 1.0, raylib.BLACK); end print; end surface.elements;
Fabien-Chouteau/pygamer-bsp
Ada
783
ads
with System; with HAL; with HAL.Bitmap; package PyGamer.Screen is Width : constant := 160; Height : constant := 128; procedure Set_Address (X_Start, X_End, Y_Start, Y_End : HAL.UInt16); procedure Start_Pixel_TX; procedure End_Pixel_TX; procedure Push_Pixels (Addr : System.Address; Len : Natural); -- Addr: pointer to a read-only buffer of Len pixels (16-bit RGB565) procedure Push_Pixels_Swap (Addr : System.Address; Len : Natural); -- Addr: pointer to a read-write buffer of Len pixels (16-bit RGB565) procedure Scroll (Val : HAL.UInt8); -- DMA -- procedure Start_DMA (Addr : System.Address; Len : Natural); -- Addr: pointer to a read-only buffer of Len pixels (16-bit RGB565) procedure Wait_End_Of_DMA; end PyGamer.Screen;
ekoeppen/STM32_Generic_Ada_Drivers
Ada
2,143
ads
with STM32_SVD.GPIO; use STM32_SVD.GPIO; with STM32_SVD.USART; use STM32_SVD.USART; with STM32_SVD.SPI; with STM32_SVD.I2C; with STM32GD.GPIO; with STM32GD.USART; with STM32GD.SPI; with STM32GD.I2C; with STM32GD.RTC; with STM32GD.Clock; with STM32GD.Clock.Tree; with Drivers.Text_IO; package STM32GD.Board is package CLOCKS is new STM32GD.Clock.Tree (LSI_Enabled => True); package SCLK is new STM32GD.GPIO (Pin => 5, Port => GPIOA_Periph, Alternate => True); package MISO is new STM32GD.GPIO (Pin => 6, Port => GPIOA_Periph, Alternate => True); package MOSI is new STM32GD.GPIO (Pin => 7, Port => GPIOA_Periph, Alternate => True); package CSN is new STM32GD.GPIO (Pin => 6, Port => GPIOB_Periph, Output => True); package BUTTON is new STM32GD.GPIO (Pin => 13, Port => GPIOC_Periph); package LED is new STM32GD.GPIO (Pin => 5, Port => GPIOA_Periph, Output => True); package LED2 is new STM32GD.GPIO (Pin => 8, Port => GPIOC_Periph, Output => True); package LED3 is new STM32GD.GPIO (Pin => 6, Port => GPIOC_Periph, Output => True); package TX is new STM32GD.GPIO (Pin => 2, Port => GPIOA_Periph, Pull_Up => True, Alternate => True, Alternate_Function => 1); package RX is new STM32GD.GPIO (Pin => 3, Port => GPIOA_Periph, Pull_Up => True, Alternate => True, Alternate_Function => 1); package USART is new STM32GD.USART ( USART => USART2_Periph, Speed => 115200, Clock_Tree => CLOCKS, Clock => STM32GD.Clock.PCLK1); package RTC is new STM32GD.RTC (Clock_Tree => STM32GD.Board.Clocks, Clock => STM32GD.Clock.LSI); package SPI is new STM32GD.SPI (SPI => STM32_SVD.SPI.SPI1_Periph); package I2C is new STM32GD.I2C (I2C => STM32_SVD.I2C.I2C1_Periph); package Text_IO is new Drivers.Text_IO (USART => STM32GD.Board.USART); procedure Init; end STM32GD.Board;
burratoo/Acton
Ada
1,010
ads
------------------------------------------------------------------------------------------ -- -- -- OAKLAND COMPONENTS -- -- -- -- OAKLAND.INTERRUPTS -- -- -- -- Copyright (C) 2011-2021, Patrick Bernardi -- -- -- ------------------------------------------------------------------------------------------ with Oak.Interrupts; use Oak.Interrupts; package Oakland.Interrupts with Preelaborate is procedure Attach_Handlers (Handlers : in Interrupt_Handler_Array); end Oakland.Interrupts;
HeisenbugLtd/open_weather_map_api
Ada
3,969
ads
-------------------------------------------------------------------------------- -- Copyright (C) 2020 by Heisenbug Ltd. ([email protected]) -- -- This work is free. You can redistribute it and/or modify it under the -- terms of the Do What The Fuck You Want To Public License, Version 2, -- as published by Sam Hocevar. See the LICENSE file for more details. -------------------------------------------------------------------------------- pragma License (Unrestricted); limited with Ada.Real_Time; private with GNATCOLL.Memory; package Standard_Application is type T is abstract tagged limited private; ----------------------------------------------------------------------------- -- Initialize ----------------------------------------------------------------------------- procedure Initialize (Self : in out T; Cycle_Time : in Ada.Real_Time.Time_Span; Application_Directory : in String; Log_Name : in String); --% Initializes the application. -- --% @param Self --% Instance of the application to initialize. -- --% @param Cycle_Time --% The interval at which the Worker subprogram shall be called. -- --% @param Application_Directory --% Application specific directory containing configuration data and such. -- --% @param Log_Name --% Base name of the application log file. ----------------------------------------------------------------------------- -- Shutdown ----------------------------------------------------------------------------- procedure Shutdown (Self : in out T); --% Shuts down the application. -- --% @param Self --% Instance of the application to shut down. ----------------------------------------------------------------------------- -- Epoch ----------------------------------------------------------------------------- function Epoch (Self : in T) return Ada.Real_Time.Time; --% Returns the epoch (i.e. startup time) of the application. Used to --% generate relative time stamps. -- --% @param Self --% Instance of the application. -- --% @return --% The start time of the application. ----------------------------------------------------------------------------- -- Run ----------------------------------------------------------------------------- procedure Run (Self : in out T); --% Starts the application main loop. -- --% @param Self --% Instance of the application to start. ----------------------------------------------------------------------------- -- Work ----------------------------------------------------------------------------- procedure Work (Self : in out T) is abstract; --% The work to be done on each iteration of the main loop. -- --% @param Self --% Instance of the application. private type T is abstract tagged limited record Start_Time : Ada.Real_Time.Time; --% @field Start_Time --% Time the application has been initialized. Interval : Ada.Real_Time.Time_Span; --% @field Interval --% The interval at which the Work subprogram shall be called from --% within the Run subprogram. Previous_Memory : GNATCOLL.Memory.Watermark_Info; --% @field Previous_Memory --% Holds the last value of the application's memory consumption as --% reported by the operating system. end record; ----------------------------------------------------------------------------- -- Report_Memory_Usage ----------------------------------------------------------------------------- procedure Report_Memory_Usage (Self : in out T); --% Prints memory usage to the log file. -- --% @param Self --% Instance of the application to report memory usage for. end Standard_Application;
reznikmm/matreshka
Ada
3,749
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.Config_Config_Item_Map_Indexed_Elements is pragma Preelaborate; type ODF_Config_Config_Item_Map_Indexed is limited interface and XML.DOM.Elements.DOM_Element; type ODF_Config_Config_Item_Map_Indexed_Access is access all ODF_Config_Config_Item_Map_Indexed'Class with Storage_Size => 0; end ODF.DOM.Config_Config_Item_Map_Indexed_Elements;
mirror/ncurses
Ada
4,430
adb
------------------------------------------------------------------------------ -- -- -- GNAT ncurses Binding -- -- -- -- Terminal_Interface.Curses.Forms.Field_Types.Enumeration.Ada -- -- -- -- B O D Y -- -- -- ------------------------------------------------------------------------------ -- Copyright 2020 Thomas E. Dickey -- -- Copyright 1999-2004,2011 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 -- Version Control: -- $Revision: 1.12 $ -- $Date: 2020/02/02 23:34:34 $ -- Binding Version 01.00 ------------------------------------------------------------------------------ with Ada.Characters.Handling; use Ada.Characters.Handling; package body Terminal_Interface.Curses.Forms.Field_Types.Enumeration.Ada is function Create (Set : Type_Set := Mixed_Case; Case_Sensitive : Boolean := False; Must_Be_Unique : Boolean := False) return Enumeration_Field is I : Enumeration_Info (T'Pos (T'Last) - T'Pos (T'First) + 1); J : Positive := 1; begin I.Case_Sensitive := Case_Sensitive; I.Match_Must_Be_Unique := Must_Be_Unique; for E in T'Range loop I.Names (J) := new String'(T'Image (E)); -- The Image attribute defaults to upper case, so we have to handle -- only the other ones... if Set /= Upper_Case then I.Names (J).all := To_Lower (I.Names (J).all); if Set = Mixed_Case then I.Names (J).all (I.Names (J).all'First) := To_Upper (I.Names (J).all (I.Names (J).all'First)); end if; end if; J := J + 1; end loop; return Create (I, True); end Create; function Value (Fld : Field; Buf : Buffer_Number := Buffer_Number'First) return T is begin return T'Value (Get_Buffer (Fld, Buf)); end Value; end Terminal_Interface.Curses.Forms.Field_Types.Enumeration.Ada;
reznikmm/matreshka
Ada
4,924
ads
------------------------------------------------------------------------------ -- -- -- Matreshka Project -- -- -- -- Ada Modeling Framework -- -- -- -- Runtime Library Component -- -- -- ------------------------------------------------------------------------------ -- -- -- Copyright © 2011-2012, Vadim Godunko <[email protected]> -- -- All rights reserved. -- -- -- -- Redistribution and use in source and binary forms, with or without -- -- modification, are permitted provided that the following conditions -- -- are met: -- -- -- -- * Redistributions of source code must retain the above copyright -- -- notice, this list of conditions and the following disclaimer. -- -- -- -- * Redistributions in binary form must reproduce the above copyright -- -- notice, this list of conditions and the following disclaimer in the -- -- documentation and/or other materials provided with the distribution. -- -- -- -- * Neither the name of the Vadim Godunko, IE nor the names of its -- -- contributors may be used to endorse or promote products derived from -- -- this software without specific prior written permission. -- -- -- -- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -- -- "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -- -- LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -- -- A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -- -- HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -- -- SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED -- -- TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -- -- PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -- -- LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -- -- NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -- -- SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -- -- -- ------------------------------------------------------------------------------ -- $Revision$ $Date$ ------------------------------------------------------------------------------ -- This file is generated, don't edit it. ------------------------------------------------------------------------------ -- A connectable element template parameter exposes a connectable element as -- a formal parameter for a template. ------------------------------------------------------------------------------ limited with AMF.UML.Connectable_Elements; with AMF.UML.Template_Parameters; package AMF.UML.Connectable_Element_Template_Parameters is pragma Preelaborate; type UML_Connectable_Element_Template_Parameter is limited interface and AMF.UML.Template_Parameters.UML_Template_Parameter; type UML_Connectable_Element_Template_Parameter_Access is access all UML_Connectable_Element_Template_Parameter'Class; for UML_Connectable_Element_Template_Parameter_Access'Storage_Size use 0; not overriding function Get_Parametered_Element (Self : not null access constant UML_Connectable_Element_Template_Parameter) return AMF.UML.Connectable_Elements.UML_Connectable_Element_Access is abstract; -- Getter of ConnectableElementTemplateParameter::parameteredElement. -- -- The ConnectableElement for this template parameter. not overriding procedure Set_Parametered_Element (Self : not null access UML_Connectable_Element_Template_Parameter; To : AMF.UML.Connectable_Elements.UML_Connectable_Element_Access) is abstract; -- Setter of ConnectableElementTemplateParameter::parameteredElement. -- -- The ConnectableElement for this template parameter. end AMF.UML.Connectable_Element_Template_Parameters;
reznikmm/matreshka
Ada
4,001
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_Use_Tables_Attributes; package Matreshka.ODF_Text.Use_Tables_Attributes is type Text_Use_Tables_Attribute_Node is new Matreshka.ODF_Text.Abstract_Text_Attribute_Node and ODF.DOM.Text_Use_Tables_Attributes.ODF_Text_Use_Tables_Attribute with null record; overriding function Create (Parameters : not null access Matreshka.DOM_Attributes.Attribute_L2_Parameters) return Text_Use_Tables_Attribute_Node; overriding function Get_Local_Name (Self : not null access constant Text_Use_Tables_Attribute_Node) return League.Strings.Universal_String; end Matreshka.ODF_Text.Use_Tables_Attributes;
JeremyGrosser/clock3
Ada
1,418
adb
package body Circular_Queue is function First (This : Queue) return Element_Type is (This.Elements (This.Head)); function Last (This : Queue) return Element_Type is (This.Elements (This.Tail)); function Available (This : Queue) return Natural is (Size - This.Used); function Empty (This : Queue) return Boolean is (This.Used = 0); procedure Add (This : in out Queue; Item : Element_Type) is Extra : access Element_Type; begin if This.Used = Size then Extra := Consume (This); end if; if This.Tail = Index_Type'Last then This.Tail := Index_Type'First; else This.Tail := This.Tail + 1; end if; This.Elements (This.Tail) := Item; This.Used := This.Used + 1; end Add; function Consume (This : in out Queue) return access Element_Type is Item : access Element_Type := This.Elements (This.Head)'Access; begin if This.Head >= Index_Type'Last then This.Head := Index_Type'First; else This.Head := This.Head + 1; end if; This.Used := This.Used - 1; return Item; end Consume; procedure Clear (This : in out Queue) is begin This.Head := Index_Type'First + 1; This.Tail := Index_Type'First; This.Used := 0; end Clear; end Circular_Queue;
laurentzh/CHIP-8
Ada
644
adb
with STM32.Board; use STM32.Board; with HAL.Touch_Panel; use HAL.Touch_Panel; package body Inputs is procedure Update_Pressed_Keys(Keys : in out Keys_List) is State : constant TP_State := Touch_Panel.Get_All_Touch_Points; begin for I in State'First .. State'Last loop if State(I).X >= Position_X'First then Keys(Get_Key(State(I).X, Position_Y'Last - State(I).Y)) := True; end if; end loop; end Update_Pressed_Keys; function Get_Key(X : Position_X; Y : Position_Y) return Integer is begin return Layout((X - Position_X'First) / 40, Y / 40); end Get_Key; end Inputs;
reznikmm/matreshka
Ada
5,926
adb
------------------------------------------------------------------------------ -- -- -- Matreshka Project -- -- -- -- XML Processor -- -- -- -- Runtime Library Component -- -- -- ------------------------------------------------------------------------------ -- -- -- Copyright © 2013, Vadim Godunko <[email protected]> -- -- All rights reserved. -- -- -- -- Redistribution and use in source and binary forms, with or without -- -- modification, are permitted provided that the following conditions -- -- are met: -- -- -- -- * Redistributions of source code must retain the above copyright -- -- notice, this list of conditions and the following disclaimer. -- -- -- -- * Redistributions in binary form must reproduce the above copyright -- -- notice, this list of conditions and the following disclaimer in the -- -- documentation and/or other materials provided with the distribution. -- -- -- -- * Neither the name of the Vadim Godunko, IE nor the names of its -- -- contributors may be used to endorse or promote products derived from -- -- this software without specific prior written permission. -- -- -- -- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -- -- "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -- -- LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -- -- A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -- -- HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -- -- SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED -- -- TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -- -- PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -- -- LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -- -- NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -- -- SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -- -- -- ------------------------------------------------------------------------------ -- $Revision$ $Date$ ------------------------------------------------------------------------------ with Ada.Unchecked_Deallocation; package body XML.DOM.Nodes is ------------------ -- Append_Child -- ------------------ procedure Append_Child (Self : not null access DOM_Node'Class; Node : not null DOM_Node_Access) is begin Reference (Node); if Self.Last_Child = null then Self.First_Child := Node; Self.Last_Child := Node; Node.Parent_Node := DOM_Node_Access (Self); Node.Next_Sibling := null; Node.Previous_Sibling := null; else Node.Parent_Node := DOM_Node_Access (Self); Node.Next_Sibling := null; Node.Previous_Sibling := Self.Last_Child; Self.Last_Child.Next_Sibling := Node; Self.Last_Child := Node; end if; end Append_Child; ----------------- -- Dereference -- ----------------- procedure Dereference (Node : in out DOM_Node_Access) is procedure Free is new Ada.Unchecked_Deallocation (DOM_Node'Class, DOM_Node_Access); Child : DOM_Node_Access := Node.First_Child; Next : DOM_Node_Access; begin if Matreshka.Atomics.Counters.Decrement (Node.Counter) then while Child /= null loop -- Remember next sibling node, because current child node can be -- deallocated during dereferencing. Next := Child.Next_Sibling; -- Disconnect child node. Child.Parent_Node := null; Child.Next_Sibling := null; if Next /= null then Next.Previous_Sibling := null; end if; -- Dereference child node. Dereference (Child); Child := Next; end loop; Free (Node); else Node := null; end if; end Dereference; --------------------- -- Get_First_Child -- --------------------- function Get_First_Child (Self : not null access constant DOM_Node'Class) return DOM_Node_Access is begin return Self.First_Child; end Get_First_Child; ---------------------- -- Get_Next_Sibling -- ---------------------- function Get_Next_Sibling (Self : not null access constant DOM_Node'Class) return DOM_Node_Access is begin return Self.Next_Sibling; end Get_Next_Sibling; --------------- -- Reference -- --------------- procedure Reference (Node : not null DOM_Node_Access) is begin Matreshka.Atomics.Counters.Increment (Node.Counter); end Reference; end XML.DOM.Nodes;
Rodeo-McCabe/orka
Ada
2,371
ads
-- 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. package Orka.SIMD.AVX.Doubles.Math is pragma Pure; function Min (Left, Right : m256d) return m256d with Import, Convention => Intrinsic, External_Name => "__builtin_ia32_minpd256"; -- Compare each 64-bit double in Left and Right and take the minimum values. -- -- Result (I) := Double'Min (Left (I), Right (I)) for I in 1 ..4 function Max (Left, Right : m256d) return m256d with Import, Convention => Intrinsic, External_Name => "__builtin_ia32_maxpd256"; -- Compare each 64-bit double in Left and Right and take the maximum values. -- -- Result (I) := Double'Max (Left (I), Right (I)) for I in 1 ..4 function Sqrt (Elements : m256d) return m256d with Import, Convention => Intrinsic, External_Name => "__builtin_ia32_sqrtpd256"; -- Return the square root (Sqrt(X)) of each element function Round (Elements : m256d; Rounding : Unsigned_32) return m256d with Import, Convention => Intrinsic, External_Name => "__builtin_ia32_roundpd256"; function Round_Nearest_Integer (Elements : m256d) return m256d is (Round (Elements, 0)) with Inline; -- Round each element to the nearest integer function Floor (Elements : m256d) return m256d is (Round (Elements, 1)) with Inline; -- Round each element down to an integer value function Ceil (Elements : m256d) return m256d is (Round (Elements, 2)) with Inline; -- Round each element up to an integer value function Round_Truncate (Elements : m256d) return m256d is (Round (Elements, 3)) with Inline; -- Round each element to zero function Cross_Product (Left, Right : m256d) return m256d with Inline; end Orka.SIMD.AVX.Doubles.Math;
stcarrez/ada-css
Ada
4,668
ads
----------------------------------------------------------------------- -- css-analysis-rules-types -- Rules for CSS pre-defined value types -- Copyright (C) 2017, 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. ----------------------------------------------------------------------- private with Ada.Strings.Unbounded; package CSS.Analysis.Rules.Types is -- Register all the builtin types. procedure Register (Repository : in out Repository_Type); private type Builtin_Rule_Type is new Rule_Type with record Name : Ada.Strings.Unbounded.Unbounded_String; end record; type Builtin_Rule_Type_Access is access all Builtin_Rule_Type'Class; -- Print the rule definition to the print stream. overriding procedure Print (Rule : in Builtin_Rule_Type; Stream : in out CSS.Printer.File_Type'Class); type Integer_Rule_Type is new Builtin_Rule_Type with null record; -- Check if the value represents an integer without unit. overriding function Match (Rule : in Integer_Rule_Type; Value : in CSS.Core.Values.Value_Type) return Boolean; type Number_Rule_Type is new Builtin_Rule_Type with null record; -- Check if the value represents a number or integer without unit. overriding function Match (Rule : in Number_Rule_Type; Value : in CSS.Core.Values.Value_Type) return Boolean; type Percentage_Rule_Type is new Builtin_Rule_Type with null record; -- Check if the value represents a percentage. overriding function Match (Rule : in Percentage_Rule_Type; Value : in CSS.Core.Values.Value_Type) return Boolean; type Length_Rule_Type is new Builtin_Rule_Type with null record; -- Check if the value represents a length. overriding function Match (Rule : in Length_Rule_Type; Value : in CSS.Core.Values.Value_Type) return Boolean; type Time_Rule_Type is new Builtin_Rule_Type with null record; -- Check if the value represents a time. overriding function Match (Rule : in Time_Rule_Type; Value : in CSS.Core.Values.Value_Type) return Boolean; type Resolution_Rule_Type is new Builtin_Rule_Type with null record; -- Check if the value represents a resolution. overriding function Match (Rule : in Resolution_Rule_Type; Value : in CSS.Core.Values.Value_Type) return Boolean; type Angle_Rule_Type is new Builtin_Rule_Type with null record; -- Check if the value represents an angle. overriding function Match (Rule : in Angle_Rule_Type; Value : in CSS.Core.Values.Value_Type) return Boolean; type String_Rule_Type is new Builtin_Rule_Type with null record; -- Check if the value represents a string. overriding function Match (Rule : in String_Rule_Type; Value : in CSS.Core.Values.Value_Type) return Boolean; type Identifier_Rule_Type is new Builtin_Rule_Type with null record; -- Check if the value represents a custom identifier. overriding function Match (Rule : in Identifier_Rule_Type; Value : in CSS.Core.Values.Value_Type) return Boolean; type URL_Rule_Type is new Builtin_Rule_Type with null record; -- Check if the value represents a string. overriding function Match (Rule : in URL_Rule_Type; Value : in CSS.Core.Values.Value_Type) return Boolean; type Color_Rule_Type is new Builtin_Rule_Type with null record; -- Check if the value represents an hexadecimal color. overriding function Match (Rule : in Color_Rule_Type; Value : in CSS.Core.Values.Value_Type) return Boolean; -- Register the builtin type in the repository. procedure Register_Builtin (Repository : in out Repository_Type; Name : in String; Rule : in Builtin_Rule_Type_Access; Kind : in CSS.Core.Values.Value_Kind); end CSS.Analysis.Rules.Types;
sungyeon/drake
Ada
877
adb
with Ada.Containers.Murmur_Hash_3; function Ada.Strings.Generic_Hash (Key : String_Type) return Containers.Hash_Type is State : Containers.Murmur_Hash_3.State := Containers.Murmur_Hash_3.Initialize (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); -- update Containers.Murmur_Hash_3.Update ( State, Containers.Hash_Type'(Wide_Wide_Character'Pos (Code))); end; end loop; Containers.Murmur_Hash_3.Finalize (State, Result); return Result; end Ada.Strings.Generic_Hash;
AdaCore/Ada_Drivers_Library
Ada
4,098
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 STMicroelectronics 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 file is based on: -- -- -- -- @file lis3dsh.c -- -- @author MCD Application Team -- -- @version V1.1.0 -- -- @date 19-June-2014 -- -- @brief This file provides a set of functions needed to manage the -- -- LIS3DSH MEMS Accelerometer. -- -- -- -- COPYRIGHT(c) 2014 STMicroelectronics -- ------------------------------------------------------------------------------ -- This package provides a SPI-based I/O implementation for the LIS3DSH -- accelerometer. with HAL.SPI; use HAL.SPI; with HAL.GPIO; use HAL.GPIO; package LIS3DSH.SPI is type Three_Axis_Accelerometer_SPI (Port : not null Any_SPI_Port; Chip_Select : not null Any_GPIO_Point) is new Three_Axis_Accelerometer with private; overriding procedure IO_Write (This : in out Three_Axis_Accelerometer_SPI; Value : UInt8; WriteAddr : Register_Address); overriding procedure IO_Read (This : Three_Axis_Accelerometer_SPI; Value : out UInt8; ReadAddr : Register_Address); private type Three_Axis_Accelerometer_SPI (Port : not null Any_SPI_Port; Chip_Select : not null Any_GPIO_Point) is new Three_Axis_Accelerometer with null record; end LIS3DSH.SPI;
stcarrez/ada-awa
Ada
64,575
adb
----------------------------------------------------------------------- -- AWA.Countries.Models -- AWA.Countries.Models ----------------------------------------------------------------------- -- File generated by Dynamo DO NOT MODIFY -- Template used: templates/model/package-body.xhtml -- Ada Generator: https://github.com/stcarrez/dynamo Version 1.4.0 ----------------------------------------------------------------------- -- Copyright (C) 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. ----------------------------------------------------------------------- pragma Warnings (Off); with Ada.Unchecked_Deallocation; pragma Warnings (On); package body AWA.Countries.Models is pragma Style_Checks ("-mrIu"); pragma Warnings (Off, "formal parameter * is not referenced"); pragma Warnings (Off, "use clause for type *"); pragma Warnings (Off, "use clause for private type *"); use type ADO.Objects.Object_Record_Access; use type ADO.Objects.Object_Ref; function Country_Key (Id : in ADO.Identifier) return ADO.Objects.Object_Key is Result : ADO.Objects.Object_Key (Of_Type => ADO.Objects.KEY_INTEGER, Of_Class => COUNTRY_DEF'Access); begin ADO.Objects.Set_Value (Result, Id); return Result; end Country_Key; function Country_Key (Id : in String) return ADO.Objects.Object_Key is Result : ADO.Objects.Object_Key (Of_Type => ADO.Objects.KEY_INTEGER, Of_Class => COUNTRY_DEF'Access); begin ADO.Objects.Set_Value (Result, Id); return Result; end Country_Key; function "=" (Left, Right : Country_Ref'Class) return Boolean is begin return ADO.Objects.Object_Ref'Class (Left) = ADO.Objects.Object_Ref'Class (Right); end "="; procedure Set_Field (Object : in out Country_Ref'Class; Impl : out Country_Access) is Result : ADO.Objects.Object_Record_Access; begin Object.Prepare_Modify (Result); Impl := Country_Impl (Result.all)'Access; end Set_Field; -- Internal method to allocate the Object_Record instance overriding procedure Allocate (Object : in out Country_Ref) is Impl : Country_Access; begin Impl := new Country_Impl; Impl.Geonameid := 0; ADO.Objects.Set_Object (Object, Impl.all'Access); end Allocate; -- ---------------------------------------- -- Data object: Country -- ---------------------------------------- procedure Set_Id (Object : in out Country_Ref; Value : in ADO.Identifier) is Impl : Country_Access; begin Set_Field (Object, Impl); ADO.Objects.Set_Field_Key_Value (Impl.all, 1, Value); end Set_Id; function Get_Id (Object : in Country_Ref) return ADO.Identifier is Impl : constant Country_Access := Country_Impl (Object.Get_Object.all)'Access; begin return Impl.Get_Key_Value; end Get_Id; procedure Set_Name (Object : in out Country_Ref; Value : in String) is Impl : Country_Access; begin Set_Field (Object, Impl); ADO.Objects.Set_Field_String (Impl.all, 2, Impl.Name, Value); end Set_Name; procedure Set_Name (Object : in out Country_Ref; Value : in Ada.Strings.Unbounded.Unbounded_String) is Impl : Country_Access; begin Set_Field (Object, Impl); ADO.Objects.Set_Field_Unbounded_String (Impl.all, 2, Impl.Name, Value); end Set_Name; function Get_Name (Object : in Country_Ref) return String is begin return Ada.Strings.Unbounded.To_String (Object.Get_Name); end Get_Name; function Get_Name (Object : in Country_Ref) return Ada.Strings.Unbounded.Unbounded_String is Impl : constant Country_Access := Country_Impl (Object.Get_Load_Object.all)'Access; begin return Impl.Name; end Get_Name; procedure Set_Continent (Object : in out Country_Ref; Value : in String) is Impl : Country_Access; begin Set_Field (Object, Impl); ADO.Objects.Set_Field_String (Impl.all, 3, Impl.Continent, Value); end Set_Continent; procedure Set_Continent (Object : in out Country_Ref; Value : in Ada.Strings.Unbounded.Unbounded_String) is Impl : Country_Access; begin Set_Field (Object, Impl); ADO.Objects.Set_Field_Unbounded_String (Impl.all, 3, Impl.Continent, Value); end Set_Continent; function Get_Continent (Object : in Country_Ref) return String is begin return Ada.Strings.Unbounded.To_String (Object.Get_Continent); end Get_Continent; function Get_Continent (Object : in Country_Ref) return Ada.Strings.Unbounded.Unbounded_String is Impl : constant Country_Access := Country_Impl (Object.Get_Load_Object.all)'Access; begin return Impl.Continent; end Get_Continent; procedure Set_Currency (Object : in out Country_Ref; Value : in String) is Impl : Country_Access; begin Set_Field (Object, Impl); ADO.Objects.Set_Field_String (Impl.all, 4, Impl.Currency, Value); end Set_Currency; procedure Set_Currency (Object : in out Country_Ref; Value : in Ada.Strings.Unbounded.Unbounded_String) is Impl : Country_Access; begin Set_Field (Object, Impl); ADO.Objects.Set_Field_Unbounded_String (Impl.all, 4, Impl.Currency, Value); end Set_Currency; function Get_Currency (Object : in Country_Ref) return String is begin return Ada.Strings.Unbounded.To_String (Object.Get_Currency); end Get_Currency; function Get_Currency (Object : in Country_Ref) return Ada.Strings.Unbounded.Unbounded_String is Impl : constant Country_Access := Country_Impl (Object.Get_Load_Object.all)'Access; begin return Impl.Currency; end Get_Currency; procedure Set_Iso_Code (Object : in out Country_Ref; Value : in String) is Impl : Country_Access; begin Set_Field (Object, Impl); ADO.Objects.Set_Field_String (Impl.all, 5, Impl.Iso_Code, Value); end Set_Iso_Code; procedure Set_Iso_Code (Object : in out Country_Ref; Value : in Ada.Strings.Unbounded.Unbounded_String) is Impl : Country_Access; begin Set_Field (Object, Impl); ADO.Objects.Set_Field_Unbounded_String (Impl.all, 5, Impl.Iso_Code, Value); end Set_Iso_Code; function Get_Iso_Code (Object : in Country_Ref) return String is begin return Ada.Strings.Unbounded.To_String (Object.Get_Iso_Code); end Get_Iso_Code; function Get_Iso_Code (Object : in Country_Ref) return Ada.Strings.Unbounded.Unbounded_String is Impl : constant Country_Access := Country_Impl (Object.Get_Load_Object.all)'Access; begin return Impl.Iso_Code; end Get_Iso_Code; procedure Set_Geonameid (Object : in out Country_Ref; Value : in Integer) is Impl : Country_Access; begin Set_Field (Object, Impl); ADO.Objects.Set_Field_Integer (Impl.all, 6, Impl.Geonameid, Value); end Set_Geonameid; function Get_Geonameid (Object : in Country_Ref) return Integer is Impl : constant Country_Access := Country_Impl (Object.Get_Load_Object.all)'Access; begin return Impl.Geonameid; end Get_Geonameid; procedure Set_Languages (Object : in out Country_Ref; Value : in String) is Impl : Country_Access; begin Set_Field (Object, Impl); ADO.Objects.Set_Field_String (Impl.all, 7, Impl.Languages, Value); end Set_Languages; procedure Set_Languages (Object : in out Country_Ref; Value : in Ada.Strings.Unbounded.Unbounded_String) is Impl : Country_Access; begin Set_Field (Object, Impl); ADO.Objects.Set_Field_Unbounded_String (Impl.all, 7, Impl.Languages, Value); end Set_Languages; function Get_Languages (Object : in Country_Ref) return String is begin return Ada.Strings.Unbounded.To_String (Object.Get_Languages); end Get_Languages; function Get_Languages (Object : in Country_Ref) return Ada.Strings.Unbounded.Unbounded_String is Impl : constant Country_Access := Country_Impl (Object.Get_Load_Object.all)'Access; begin return Impl.Languages; end Get_Languages; procedure Set_Tld (Object : in out Country_Ref; Value : in String) is Impl : Country_Access; begin Set_Field (Object, Impl); ADO.Objects.Set_Field_String (Impl.all, 8, Impl.Tld, Value); end Set_Tld; procedure Set_Tld (Object : in out Country_Ref; Value : in Ada.Strings.Unbounded.Unbounded_String) is Impl : Country_Access; begin Set_Field (Object, Impl); ADO.Objects.Set_Field_Unbounded_String (Impl.all, 8, Impl.Tld, Value); end Set_Tld; function Get_Tld (Object : in Country_Ref) return String is begin return Ada.Strings.Unbounded.To_String (Object.Get_Tld); end Get_Tld; function Get_Tld (Object : in Country_Ref) return Ada.Strings.Unbounded.Unbounded_String is Impl : constant Country_Access := Country_Impl (Object.Get_Load_Object.all)'Access; begin return Impl.Tld; end Get_Tld; procedure Set_Currency_Code (Object : in out Country_Ref; Value : in String) is Impl : Country_Access; begin Set_Field (Object, Impl); ADO.Objects.Set_Field_String (Impl.all, 9, Impl.Currency_Code, Value); end Set_Currency_Code; procedure Set_Currency_Code (Object : in out Country_Ref; Value : in Ada.Strings.Unbounded.Unbounded_String) is Impl : Country_Access; begin Set_Field (Object, Impl); ADO.Objects.Set_Field_Unbounded_String (Impl.all, 9, Impl.Currency_Code, Value); end Set_Currency_Code; function Get_Currency_Code (Object : in Country_Ref) return String is begin return Ada.Strings.Unbounded.To_String (Object.Get_Currency_Code); end Get_Currency_Code; function Get_Currency_Code (Object : in Country_Ref) return Ada.Strings.Unbounded.Unbounded_String is Impl : constant Country_Access := Country_Impl (Object.Get_Load_Object.all)'Access; begin return Impl.Currency_Code; end Get_Currency_Code; -- Copy of the object. procedure Copy (Object : in Country_Ref; Into : in out Country_Ref) is Result : Country_Ref; begin if not Object.Is_Null then declare Impl : constant Country_Access := Country_Impl (Object.Get_Load_Object.all)'Access; Copy : constant Country_Access := new Country_Impl; begin ADO.Objects.Set_Object (Result, Copy.all'Access); Copy.Copy (Impl.all); Copy.Name := Impl.Name; Copy.Continent := Impl.Continent; Copy.Currency := Impl.Currency; Copy.Iso_Code := Impl.Iso_Code; Copy.Geonameid := Impl.Geonameid; Copy.Languages := Impl.Languages; Copy.Tld := Impl.Tld; Copy.Currency_Code := Impl.Currency_Code; end; end if; Into := Result; end Copy; overriding procedure Find (Object : in out Country_Ref; Session : in out ADO.Sessions.Session'Class; Query : in ADO.SQL.Query'Class; Found : out Boolean) is Impl : constant Country_Access := new Country_Impl; begin Impl.Find (Session, Query, Found); if Found then ADO.Objects.Set_Object (Object, Impl.all'Access); else ADO.Objects.Set_Object (Object, null); Destroy (Impl); end if; end Find; procedure Load (Object : in out Country_Ref; Session : in out ADO.Sessions.Session'Class; Id : in ADO.Identifier) is Impl : constant Country_Access := new Country_Impl; Found : Boolean; Query : ADO.SQL.Query; begin Query.Bind_Param (Position => 1, Value => Id); Query.Set_Filter ("id = ?"); Impl.Find (Session, Query, Found); if not Found then Destroy (Impl); raise ADO.Objects.NOT_FOUND; end if; ADO.Objects.Set_Object (Object, Impl.all'Access); end Load; procedure Load (Object : in out Country_Ref; Session : in out ADO.Sessions.Session'Class; Id : in ADO.Identifier; Found : out Boolean) is Impl : constant Country_Access := new Country_Impl; Query : ADO.SQL.Query; begin Query.Bind_Param (Position => 1, Value => Id); Query.Set_Filter ("id = ?"); Impl.Find (Session, Query, Found); if not Found then Destroy (Impl); else ADO.Objects.Set_Object (Object, Impl.all'Access); end if; end Load; overriding procedure Save (Object : in out Country_Ref; Session : in out ADO.Sessions.Master_Session'Class) is Impl : ADO.Objects.Object_Record_Access := Object.Get_Object; begin if Impl = null then Impl := new Country_Impl; ADO.Objects.Set_Object (Object, Impl); end if; if not ADO.Objects.Is_Created (Impl.all) then Impl.Create (Session); else Impl.Save (Session); end if; end Save; overriding procedure Delete (Object : in out Country_Ref; Session : in out ADO.Sessions.Master_Session'Class) is Impl : constant ADO.Objects.Object_Record_Access := Object.Get_Object; begin if Impl /= null then Impl.Delete (Session); end if; end Delete; -- -------------------- -- Free the object -- -------------------- overriding procedure Destroy (Object : access Country_Impl) is type Country_Impl_Ptr is access all Country_Impl; procedure Unchecked_Free is new Ada.Unchecked_Deallocation (Country_Impl, Country_Impl_Ptr); pragma Warnings (Off, "*redundant conversion*"); Ptr : Country_Impl_Ptr := Country_Impl (Object.all)'Access; pragma Warnings (On, "*redundant conversion*"); begin Unchecked_Free (Ptr); end Destroy; overriding procedure Find (Object : in out Country_Impl; Session : in out ADO.Sessions.Session'Class; Query : in ADO.SQL.Query'Class; Found : out Boolean) is Stmt : ADO.Statements.Query_Statement := Session.Create_Statement (Query, COUNTRY_DEF'Access); begin Stmt.Execute; if Stmt.Has_Elements then Object.Load (Stmt, Session); Stmt.Next; Found := not Stmt.Has_Elements; else Found := False; end if; end Find; overriding procedure Load (Object : in out Country_Impl; Session : in out ADO.Sessions.Session'Class) is Found : Boolean; Query : ADO.SQL.Query; Id : constant ADO.Identifier := Object.Get_Key_Value; begin Query.Bind_Param (Position => 1, Value => Id); Query.Set_Filter ("id = ?"); Object.Find (Session, Query, Found); if not Found then raise ADO.Objects.NOT_FOUND; end if; end Load; overriding procedure Save (Object : in out Country_Impl; Session : in out ADO.Sessions.Master_Session'Class) is Stmt : ADO.Statements.Update_Statement := Session.Create_Statement (COUNTRY_DEF'Access); begin if Object.Is_Modified (1) then Stmt.Save_Field (Name => COL_0_1_NAME, -- id Value => Object.Get_Key); Object.Clear_Modified (1); end if; if Object.Is_Modified (2) then Stmt.Save_Field (Name => COL_1_1_NAME, -- name Value => Object.Name); Object.Clear_Modified (2); end if; if Object.Is_Modified (3) then Stmt.Save_Field (Name => COL_2_1_NAME, -- continent Value => Object.Continent); Object.Clear_Modified (3); end if; if Object.Is_Modified (4) then Stmt.Save_Field (Name => COL_3_1_NAME, -- currency Value => Object.Currency); Object.Clear_Modified (4); end if; if Object.Is_Modified (5) then Stmt.Save_Field (Name => COL_4_1_NAME, -- iso_code Value => Object.Iso_Code); Object.Clear_Modified (5); end if; if Object.Is_Modified (6) then Stmt.Save_Field (Name => COL_5_1_NAME, -- geonameid Value => Object.Geonameid); Object.Clear_Modified (6); end if; if Object.Is_Modified (7) then Stmt.Save_Field (Name => COL_6_1_NAME, -- languages Value => Object.Languages); Object.Clear_Modified (7); end if; if Object.Is_Modified (8) then Stmt.Save_Field (Name => COL_7_1_NAME, -- tld Value => Object.Tld); Object.Clear_Modified (8); end if; if Object.Is_Modified (9) then Stmt.Save_Field (Name => COL_8_1_NAME, -- currency_code Value => Object.Currency_Code); Object.Clear_Modified (9); end if; if Stmt.Has_Save_Fields then Stmt.Set_Filter (Filter => "id = ?"); Stmt.Add_Param (Value => Object.Get_Key); declare Result : Integer; begin Stmt.Execute (Result); if Result /= 1 then if Result /= 0 then raise ADO.Objects.UPDATE_ERROR; end if; end if; end; end if; end Save; overriding procedure Create (Object : in out Country_Impl; Session : in out ADO.Sessions.Master_Session'Class) is Query : ADO.Statements.Insert_Statement := Session.Create_Statement (COUNTRY_DEF'Access); Result : Integer; begin Session.Allocate (Id => Object); Query.Save_Field (Name => COL_0_1_NAME, -- id Value => Object.Get_Key); Query.Save_Field (Name => COL_1_1_NAME, -- name Value => Object.Name); Query.Save_Field (Name => COL_2_1_NAME, -- continent Value => Object.Continent); Query.Save_Field (Name => COL_3_1_NAME, -- currency Value => Object.Currency); Query.Save_Field (Name => COL_4_1_NAME, -- iso_code Value => Object.Iso_Code); Query.Save_Field (Name => COL_5_1_NAME, -- geonameid Value => Object.Geonameid); Query.Save_Field (Name => COL_6_1_NAME, -- languages Value => Object.Languages); Query.Save_Field (Name => COL_7_1_NAME, -- tld Value => Object.Tld); Query.Save_Field (Name => COL_8_1_NAME, -- currency_code Value => Object.Currency_Code); Query.Execute (Result); if Result /= 1 then raise ADO.Objects.INSERT_ERROR; end if; ADO.Objects.Set_Created (Object); end Create; overriding procedure Delete (Object : in out Country_Impl; Session : in out ADO.Sessions.Master_Session'Class) is Stmt : ADO.Statements.Delete_Statement := Session.Create_Statement (COUNTRY_DEF'Access); begin Stmt.Set_Filter (Filter => "id = ?"); Stmt.Add_Param (Value => Object.Get_Key); Stmt.Execute; end Delete; -- ------------------------------ -- Get the bean attribute identified by the name. -- ------------------------------ overriding function Get_Value (From : in Country_Ref; Name : in String) return Util.Beans.Objects.Object is Obj : ADO.Objects.Object_Record_Access; Impl : access Country_Impl; begin if From.Is_Null then return Util.Beans.Objects.Null_Object; end if; Obj := From.Get_Load_Object; Impl := Country_Impl (Obj.all)'Access; if Name = "id" then return ADO.Objects.To_Object (Impl.Get_Key); elsif Name = "name" then return Util.Beans.Objects.To_Object (Impl.Name); elsif Name = "continent" then return Util.Beans.Objects.To_Object (Impl.Continent); elsif Name = "currency" then return Util.Beans.Objects.To_Object (Impl.Currency); elsif Name = "iso_code" then return Util.Beans.Objects.To_Object (Impl.Iso_Code); elsif Name = "geonameid" then return Util.Beans.Objects.To_Object (Long_Long_Integer (Impl.Geonameid)); elsif Name = "languages" then return Util.Beans.Objects.To_Object (Impl.Languages); elsif Name = "tld" then return Util.Beans.Objects.To_Object (Impl.Tld); elsif Name = "currency_code" then return Util.Beans.Objects.To_Object (Impl.Currency_Code); end if; return Util.Beans.Objects.Null_Object; end Get_Value; -- ------------------------------ -- Load the object from current iterator position -- ------------------------------ procedure Load (Object : in out Country_Impl; Stmt : in out ADO.Statements.Query_Statement'Class; Session : in out ADO.Sessions.Session'Class) is pragma Unreferenced (Session); begin Object.Set_Key_Value (Stmt.Get_Identifier (0)); Object.Name := Stmt.Get_Unbounded_String (1); Object.Continent := Stmt.Get_Unbounded_String (2); Object.Currency := Stmt.Get_Unbounded_String (3); Object.Iso_Code := Stmt.Get_Unbounded_String (4); Object.Geonameid := Stmt.Get_Integer (5); Object.Languages := Stmt.Get_Unbounded_String (6); Object.Tld := Stmt.Get_Unbounded_String (7); Object.Currency_Code := Stmt.Get_Unbounded_String (8); ADO.Objects.Set_Created (Object); end Load; function City_Key (Id : in ADO.Identifier) return ADO.Objects.Object_Key is Result : ADO.Objects.Object_Key (Of_Type => ADO.Objects.KEY_INTEGER, Of_Class => CITY_DEF'Access); begin ADO.Objects.Set_Value (Result, Id); return Result; end City_Key; function City_Key (Id : in String) return ADO.Objects.Object_Key is Result : ADO.Objects.Object_Key (Of_Type => ADO.Objects.KEY_INTEGER, Of_Class => CITY_DEF'Access); begin ADO.Objects.Set_Value (Result, Id); return Result; end City_Key; function "=" (Left, Right : City_Ref'Class) return Boolean is begin return ADO.Objects.Object_Ref'Class (Left) = ADO.Objects.Object_Ref'Class (Right); end "="; procedure Set_Field (Object : in out City_Ref'Class; Impl : out City_Access) is Result : ADO.Objects.Object_Record_Access; begin Object.Prepare_Modify (Result); Impl := City_Impl (Result.all)'Access; end Set_Field; -- Internal method to allocate the Object_Record instance overriding procedure Allocate (Object : in out City_Ref) is Impl : City_Access; begin Impl := new City_Impl; Impl.Zip_Code := 0; Impl.Latitude := 0; Impl.Longitude := 0; ADO.Objects.Set_Object (Object, Impl.all'Access); end Allocate; -- ---------------------------------------- -- Data object: City -- ---------------------------------------- procedure Set_Id (Object : in out City_Ref; Value : in ADO.Identifier) is Impl : City_Access; begin Set_Field (Object, Impl); ADO.Objects.Set_Field_Key_Value (Impl.all, 1, Value); end Set_Id; function Get_Id (Object : in City_Ref) return ADO.Identifier is Impl : constant City_Access := City_Impl (Object.Get_Object.all)'Access; begin return Impl.Get_Key_Value; end Get_Id; procedure Set_Name (Object : in out City_Ref; Value : in String) is Impl : City_Access; begin Set_Field (Object, Impl); ADO.Objects.Set_Field_String (Impl.all, 2, Impl.Name, Value); end Set_Name; procedure Set_Name (Object : in out City_Ref; Value : in Ada.Strings.Unbounded.Unbounded_String) is Impl : City_Access; begin Set_Field (Object, Impl); ADO.Objects.Set_Field_Unbounded_String (Impl.all, 2, Impl.Name, Value); end Set_Name; function Get_Name (Object : in City_Ref) return String is begin return Ada.Strings.Unbounded.To_String (Object.Get_Name); end Get_Name; function Get_Name (Object : in City_Ref) return Ada.Strings.Unbounded.Unbounded_String is Impl : constant City_Access := City_Impl (Object.Get_Load_Object.all)'Access; begin return Impl.Name; end Get_Name; procedure Set_Zip_Code (Object : in out City_Ref; Value : in Integer) is Impl : City_Access; begin Set_Field (Object, Impl); ADO.Objects.Set_Field_Integer (Impl.all, 3, Impl.Zip_Code, Value); end Set_Zip_Code; function Get_Zip_Code (Object : in City_Ref) return Integer is Impl : constant City_Access := City_Impl (Object.Get_Load_Object.all)'Access; begin return Impl.Zip_Code; end Get_Zip_Code; procedure Set_Latitude (Object : in out City_Ref; Value : in Integer) is Impl : City_Access; begin Set_Field (Object, Impl); ADO.Objects.Set_Field_Integer (Impl.all, 4, Impl.Latitude, Value); end Set_Latitude; function Get_Latitude (Object : in City_Ref) return Integer is Impl : constant City_Access := City_Impl (Object.Get_Load_Object.all)'Access; begin return Impl.Latitude; end Get_Latitude; procedure Set_Longitude (Object : in out City_Ref; Value : in Integer) is Impl : City_Access; begin Set_Field (Object, Impl); ADO.Objects.Set_Field_Integer (Impl.all, 5, Impl.Longitude, Value); end Set_Longitude; function Get_Longitude (Object : in City_Ref) return Integer is Impl : constant City_Access := City_Impl (Object.Get_Load_Object.all)'Access; begin return Impl.Longitude; end Get_Longitude; procedure Set_Region (Object : in out City_Ref; Value : in Region_Ref'Class) is Impl : City_Access; begin Set_Field (Object, Impl); ADO.Objects.Set_Field_Object (Impl.all, 6, Impl.Region, Value); end Set_Region; function Get_Region (Object : in City_Ref) return Region_Ref'Class is Impl : constant City_Access := City_Impl (Object.Get_Load_Object.all)'Access; begin return Impl.Region; end Get_Region; procedure Set_Country (Object : in out City_Ref; Value : in Country_Ref'Class) is Impl : City_Access; begin Set_Field (Object, Impl); ADO.Objects.Set_Field_Object (Impl.all, 7, Impl.Country, Value); end Set_Country; function Get_Country (Object : in City_Ref) return Country_Ref'Class is Impl : constant City_Access := City_Impl (Object.Get_Load_Object.all)'Access; begin return Impl.Country; end Get_Country; -- Copy of the object. procedure Copy (Object : in City_Ref; Into : in out City_Ref) is Result : City_Ref; begin if not Object.Is_Null then declare Impl : constant City_Access := City_Impl (Object.Get_Load_Object.all)'Access; Copy : constant City_Access := new City_Impl; begin ADO.Objects.Set_Object (Result, Copy.all'Access); Copy.Copy (Impl.all); Copy.Name := Impl.Name; Copy.Zip_Code := Impl.Zip_Code; Copy.Latitude := Impl.Latitude; Copy.Longitude := Impl.Longitude; Copy.Region := Impl.Region; Copy.Country := Impl.Country; end; end if; Into := Result; end Copy; overriding procedure Find (Object : in out City_Ref; Session : in out ADO.Sessions.Session'Class; Query : in ADO.SQL.Query'Class; Found : out Boolean) is Impl : constant City_Access := new City_Impl; begin Impl.Find (Session, Query, Found); if Found then ADO.Objects.Set_Object (Object, Impl.all'Access); else ADO.Objects.Set_Object (Object, null); Destroy (Impl); end if; end Find; procedure Load (Object : in out City_Ref; Session : in out ADO.Sessions.Session'Class; Id : in ADO.Identifier) is Impl : constant City_Access := new City_Impl; Found : Boolean; Query : ADO.SQL.Query; begin Query.Bind_Param (Position => 1, Value => Id); Query.Set_Filter ("id = ?"); Impl.Find (Session, Query, Found); if not Found then Destroy (Impl); raise ADO.Objects.NOT_FOUND; end if; ADO.Objects.Set_Object (Object, Impl.all'Access); end Load; procedure Load (Object : in out City_Ref; Session : in out ADO.Sessions.Session'Class; Id : in ADO.Identifier; Found : out Boolean) is Impl : constant City_Access := new City_Impl; Query : ADO.SQL.Query; begin Query.Bind_Param (Position => 1, Value => Id); Query.Set_Filter ("id = ?"); Impl.Find (Session, Query, Found); if not Found then Destroy (Impl); else ADO.Objects.Set_Object (Object, Impl.all'Access); end if; end Load; overriding procedure Save (Object : in out City_Ref; Session : in out ADO.Sessions.Master_Session'Class) is Impl : ADO.Objects.Object_Record_Access := Object.Get_Object; begin if Impl = null then Impl := new City_Impl; ADO.Objects.Set_Object (Object, Impl); end if; if not ADO.Objects.Is_Created (Impl.all) then Impl.Create (Session); else Impl.Save (Session); end if; end Save; overriding procedure Delete (Object : in out City_Ref; Session : in out ADO.Sessions.Master_Session'Class) is Impl : constant ADO.Objects.Object_Record_Access := Object.Get_Object; begin if Impl /= null then Impl.Delete (Session); end if; end Delete; -- -------------------- -- Free the object -- -------------------- overriding procedure Destroy (Object : access City_Impl) is type City_Impl_Ptr is access all City_Impl; procedure Unchecked_Free is new Ada.Unchecked_Deallocation (City_Impl, City_Impl_Ptr); pragma Warnings (Off, "*redundant conversion*"); Ptr : City_Impl_Ptr := City_Impl (Object.all)'Access; pragma Warnings (On, "*redundant conversion*"); begin Unchecked_Free (Ptr); end Destroy; overriding procedure Find (Object : in out City_Impl; Session : in out ADO.Sessions.Session'Class; Query : in ADO.SQL.Query'Class; Found : out Boolean) is Stmt : ADO.Statements.Query_Statement := Session.Create_Statement (Query, CITY_DEF'Access); begin Stmt.Execute; if Stmt.Has_Elements then Object.Load (Stmt, Session); Stmt.Next; Found := not Stmt.Has_Elements; else Found := False; end if; end Find; overriding procedure Load (Object : in out City_Impl; Session : in out ADO.Sessions.Session'Class) is Found : Boolean; Query : ADO.SQL.Query; Id : constant ADO.Identifier := Object.Get_Key_Value; begin Query.Bind_Param (Position => 1, Value => Id); Query.Set_Filter ("id = ?"); Object.Find (Session, Query, Found); if not Found then raise ADO.Objects.NOT_FOUND; end if; end Load; overriding procedure Save (Object : in out City_Impl; Session : in out ADO.Sessions.Master_Session'Class) is Stmt : ADO.Statements.Update_Statement := Session.Create_Statement (CITY_DEF'Access); begin if Object.Is_Modified (1) then Stmt.Save_Field (Name => COL_0_2_NAME, -- id Value => Object.Get_Key); Object.Clear_Modified (1); end if; if Object.Is_Modified (2) then Stmt.Save_Field (Name => COL_1_2_NAME, -- name Value => Object.Name); Object.Clear_Modified (2); end if; if Object.Is_Modified (3) then Stmt.Save_Field (Name => COL_2_2_NAME, -- zip_code Value => Object.Zip_Code); Object.Clear_Modified (3); end if; if Object.Is_Modified (4) then Stmt.Save_Field (Name => COL_3_2_NAME, -- latitude Value => Object.Latitude); Object.Clear_Modified (4); end if; if Object.Is_Modified (5) then Stmt.Save_Field (Name => COL_4_2_NAME, -- longitude Value => Object.Longitude); Object.Clear_Modified (5); end if; if Object.Is_Modified (6) then Stmt.Save_Field (Name => COL_5_2_NAME, -- region_id Value => Object.Region); Object.Clear_Modified (6); end if; if Object.Is_Modified (7) then Stmt.Save_Field (Name => COL_6_2_NAME, -- country_id Value => Object.Country); Object.Clear_Modified (7); end if; if Stmt.Has_Save_Fields then Stmt.Set_Filter (Filter => "id = ?"); Stmt.Add_Param (Value => Object.Get_Key); declare Result : Integer; begin Stmt.Execute (Result); if Result /= 1 then if Result /= 0 then raise ADO.Objects.UPDATE_ERROR; end if; end if; end; end if; end Save; overriding procedure Create (Object : in out City_Impl; Session : in out ADO.Sessions.Master_Session'Class) is Query : ADO.Statements.Insert_Statement := Session.Create_Statement (CITY_DEF'Access); Result : Integer; begin Session.Allocate (Id => Object); Query.Save_Field (Name => COL_0_2_NAME, -- id Value => Object.Get_Key); Query.Save_Field (Name => COL_1_2_NAME, -- name Value => Object.Name); Query.Save_Field (Name => COL_2_2_NAME, -- zip_code Value => Object.Zip_Code); Query.Save_Field (Name => COL_3_2_NAME, -- latitude Value => Object.Latitude); Query.Save_Field (Name => COL_4_2_NAME, -- longitude Value => Object.Longitude); Query.Save_Field (Name => COL_5_2_NAME, -- region_id Value => Object.Region); Query.Save_Field (Name => COL_6_2_NAME, -- country_id Value => Object.Country); Query.Execute (Result); if Result /= 1 then raise ADO.Objects.INSERT_ERROR; end if; ADO.Objects.Set_Created (Object); end Create; overriding procedure Delete (Object : in out City_Impl; Session : in out ADO.Sessions.Master_Session'Class) is Stmt : ADO.Statements.Delete_Statement := Session.Create_Statement (CITY_DEF'Access); begin Stmt.Set_Filter (Filter => "id = ?"); Stmt.Add_Param (Value => Object.Get_Key); Stmt.Execute; end Delete; -- ------------------------------ -- Get the bean attribute identified by the name. -- ------------------------------ overriding function Get_Value (From : in City_Ref; Name : in String) return Util.Beans.Objects.Object is Obj : ADO.Objects.Object_Record_Access; Impl : access City_Impl; begin if From.Is_Null then return Util.Beans.Objects.Null_Object; end if; Obj := From.Get_Load_Object; Impl := City_Impl (Obj.all)'Access; if Name = "id" then return ADO.Objects.To_Object (Impl.Get_Key); elsif Name = "name" then return Util.Beans.Objects.To_Object (Impl.Name); elsif Name = "zip_code" then return Util.Beans.Objects.To_Object (Long_Long_Integer (Impl.Zip_Code)); elsif Name = "latitude" then return Util.Beans.Objects.To_Object (Long_Long_Integer (Impl.Latitude)); elsif Name = "longitude" then return Util.Beans.Objects.To_Object (Long_Long_Integer (Impl.Longitude)); end if; return Util.Beans.Objects.Null_Object; end Get_Value; -- ------------------------------ -- Load the object from current iterator position -- ------------------------------ procedure Load (Object : in out City_Impl; Stmt : in out ADO.Statements.Query_Statement'Class; Session : in out ADO.Sessions.Session'Class) is begin Object.Set_Key_Value (Stmt.Get_Identifier (0)); Object.Name := Stmt.Get_Unbounded_String (1); Object.Zip_Code := Stmt.Get_Integer (2); Object.Latitude := Stmt.Get_Integer (3); Object.Longitude := Stmt.Get_Integer (4); if not Stmt.Is_Null (5) then Object.Region.Set_Key_Value (Stmt.Get_Identifier (5), Session); end if; if not Stmt.Is_Null (6) then Object.Country.Set_Key_Value (Stmt.Get_Identifier (6), Session); end if; ADO.Objects.Set_Created (Object); end Load; function Country_Neighbor_Key (Id : in ADO.Identifier) return ADO.Objects.Object_Key is Result : ADO.Objects.Object_Key (Of_Type => ADO.Objects.KEY_INTEGER, Of_Class => COUNTRY_NEIGHBOR_DEF'Access); begin ADO.Objects.Set_Value (Result, Id); return Result; end Country_Neighbor_Key; function Country_Neighbor_Key (Id : in String) return ADO.Objects.Object_Key is Result : ADO.Objects.Object_Key (Of_Type => ADO.Objects.KEY_INTEGER, Of_Class => COUNTRY_NEIGHBOR_DEF'Access); begin ADO.Objects.Set_Value (Result, Id); return Result; end Country_Neighbor_Key; function "=" (Left, Right : Country_Neighbor_Ref'Class) return Boolean is begin return ADO.Objects.Object_Ref'Class (Left) = ADO.Objects.Object_Ref'Class (Right); end "="; procedure Set_Field (Object : in out Country_Neighbor_Ref'Class; Impl : out Country_Neighbor_Access) is Result : ADO.Objects.Object_Record_Access; begin Object.Prepare_Modify (Result); Impl := Country_Neighbor_Impl (Result.all)'Access; end Set_Field; -- Internal method to allocate the Object_Record instance overriding procedure Allocate (Object : in out Country_Neighbor_Ref) is Impl : Country_Neighbor_Access; begin Impl := new Country_Neighbor_Impl; ADO.Objects.Set_Object (Object, Impl.all'Access); end Allocate; -- ---------------------------------------- -- Data object: Country_Neighbor -- ---------------------------------------- procedure Set_Id (Object : in out Country_Neighbor_Ref; Value : in ADO.Identifier) is Impl : Country_Neighbor_Access; begin Set_Field (Object, Impl); ADO.Objects.Set_Field_Key_Value (Impl.all, 1, Value); end Set_Id; function Get_Id (Object : in Country_Neighbor_Ref) return ADO.Identifier is Impl : constant Country_Neighbor_Access := Country_Neighbor_Impl (Object.Get_Object.all)'Access; begin return Impl.Get_Key_Value; end Get_Id; procedure Set_Neighbor_Of (Object : in out Country_Neighbor_Ref; Value : in Country_Ref'Class) is Impl : Country_Neighbor_Access; begin Set_Field (Object, Impl); ADO.Objects.Set_Field_Object (Impl.all, 2, Impl.Neighbor_Of, Value); end Set_Neighbor_Of; function Get_Neighbor_Of (Object : in Country_Neighbor_Ref) return Country_Ref'Class is Impl : constant Country_Neighbor_Access := Country_Neighbor_Impl (Object.Get_Load_Object.all)'Access; begin return Impl.Neighbor_Of; end Get_Neighbor_Of; procedure Set_Neighbor (Object : in out Country_Neighbor_Ref; Value : in Country_Ref'Class) is Impl : Country_Neighbor_Access; begin Set_Field (Object, Impl); ADO.Objects.Set_Field_Object (Impl.all, 3, Impl.Neighbor, Value); end Set_Neighbor; function Get_Neighbor (Object : in Country_Neighbor_Ref) return Country_Ref'Class is Impl : constant Country_Neighbor_Access := Country_Neighbor_Impl (Object.Get_Load_Object.all)'Access; begin return Impl.Neighbor; end Get_Neighbor; -- Copy of the object. procedure Copy (Object : in Country_Neighbor_Ref; Into : in out Country_Neighbor_Ref) is Result : Country_Neighbor_Ref; begin if not Object.Is_Null then declare Impl : constant Country_Neighbor_Access := Country_Neighbor_Impl (Object.Get_Load_Object.all)'Access; Copy : constant Country_Neighbor_Access := new Country_Neighbor_Impl; begin ADO.Objects.Set_Object (Result, Copy.all'Access); Copy.Copy (Impl.all); Copy.Neighbor_Of := Impl.Neighbor_Of; Copy.Neighbor := Impl.Neighbor; end; end if; Into := Result; end Copy; overriding procedure Find (Object : in out Country_Neighbor_Ref; Session : in out ADO.Sessions.Session'Class; Query : in ADO.SQL.Query'Class; Found : out Boolean) is Impl : constant Country_Neighbor_Access := new Country_Neighbor_Impl; begin Impl.Find (Session, Query, Found); if Found then ADO.Objects.Set_Object (Object, Impl.all'Access); else ADO.Objects.Set_Object (Object, null); Destroy (Impl); end if; end Find; procedure Load (Object : in out Country_Neighbor_Ref; Session : in out ADO.Sessions.Session'Class; Id : in ADO.Identifier) is Impl : constant Country_Neighbor_Access := new Country_Neighbor_Impl; Found : Boolean; Query : ADO.SQL.Query; begin Query.Bind_Param (Position => 1, Value => Id); Query.Set_Filter ("id = ?"); Impl.Find (Session, Query, Found); if not Found then Destroy (Impl); raise ADO.Objects.NOT_FOUND; end if; ADO.Objects.Set_Object (Object, Impl.all'Access); end Load; procedure Load (Object : in out Country_Neighbor_Ref; Session : in out ADO.Sessions.Session'Class; Id : in ADO.Identifier; Found : out Boolean) is Impl : constant Country_Neighbor_Access := new Country_Neighbor_Impl; Query : ADO.SQL.Query; begin Query.Bind_Param (Position => 1, Value => Id); Query.Set_Filter ("id = ?"); Impl.Find (Session, Query, Found); if not Found then Destroy (Impl); else ADO.Objects.Set_Object (Object, Impl.all'Access); end if; end Load; overriding procedure Save (Object : in out Country_Neighbor_Ref; Session : in out ADO.Sessions.Master_Session'Class) is Impl : ADO.Objects.Object_Record_Access := Object.Get_Object; begin if Impl = null then Impl := new Country_Neighbor_Impl; ADO.Objects.Set_Object (Object, Impl); end if; if not ADO.Objects.Is_Created (Impl.all) then Impl.Create (Session); else Impl.Save (Session); end if; end Save; overriding procedure Delete (Object : in out Country_Neighbor_Ref; Session : in out ADO.Sessions.Master_Session'Class) is Impl : constant ADO.Objects.Object_Record_Access := Object.Get_Object; begin if Impl /= null then Impl.Delete (Session); end if; end Delete; -- -------------------- -- Free the object -- -------------------- overriding procedure Destroy (Object : access Country_Neighbor_Impl) is type Country_Neighbor_Impl_Ptr is access all Country_Neighbor_Impl; procedure Unchecked_Free is new Ada.Unchecked_Deallocation (Country_Neighbor_Impl, Country_Neighbor_Impl_Ptr); pragma Warnings (Off, "*redundant conversion*"); Ptr : Country_Neighbor_Impl_Ptr := Country_Neighbor_Impl (Object.all)'Access; pragma Warnings (On, "*redundant conversion*"); begin Unchecked_Free (Ptr); end Destroy; overriding procedure Find (Object : in out Country_Neighbor_Impl; Session : in out ADO.Sessions.Session'Class; Query : in ADO.SQL.Query'Class; Found : out Boolean) is Stmt : ADO.Statements.Query_Statement := Session.Create_Statement (Query, COUNTRY_NEIGHBOR_DEF'Access); begin Stmt.Execute; if Stmt.Has_Elements then Object.Load (Stmt, Session); Stmt.Next; Found := not Stmt.Has_Elements; else Found := False; end if; end Find; overriding procedure Load (Object : in out Country_Neighbor_Impl; Session : in out ADO.Sessions.Session'Class) is Found : Boolean; Query : ADO.SQL.Query; Id : constant ADO.Identifier := Object.Get_Key_Value; begin Query.Bind_Param (Position => 1, Value => Id); Query.Set_Filter ("id = ?"); Object.Find (Session, Query, Found); if not Found then raise ADO.Objects.NOT_FOUND; end if; end Load; overriding procedure Save (Object : in out Country_Neighbor_Impl; Session : in out ADO.Sessions.Master_Session'Class) is Stmt : ADO.Statements.Update_Statement := Session.Create_Statement (COUNTRY_NEIGHBOR_DEF'Access); begin if Object.Is_Modified (1) then Stmt.Save_Field (Name => COL_0_3_NAME, -- id Value => Object.Get_Key); Object.Clear_Modified (1); end if; if Object.Is_Modified (2) then Stmt.Save_Field (Name => COL_1_3_NAME, -- neighbor_of_id Value => Object.Neighbor_Of); Object.Clear_Modified (2); end if; if Object.Is_Modified (3) then Stmt.Save_Field (Name => COL_2_3_NAME, -- neighbor_id Value => Object.Neighbor); Object.Clear_Modified (3); end if; if Stmt.Has_Save_Fields then Stmt.Set_Filter (Filter => "id = ?"); Stmt.Add_Param (Value => Object.Get_Key); declare Result : Integer; begin Stmt.Execute (Result); if Result /= 1 then if Result /= 0 then raise ADO.Objects.UPDATE_ERROR; end if; end if; end; end if; end Save; overriding procedure Create (Object : in out Country_Neighbor_Impl; Session : in out ADO.Sessions.Master_Session'Class) is Query : ADO.Statements.Insert_Statement := Session.Create_Statement (COUNTRY_NEIGHBOR_DEF'Access); Result : Integer; begin Session.Allocate (Id => Object); Query.Save_Field (Name => COL_0_3_NAME, -- id Value => Object.Get_Key); Query.Save_Field (Name => COL_1_3_NAME, -- neighbor_of_id Value => Object.Neighbor_Of); Query.Save_Field (Name => COL_2_3_NAME, -- neighbor_id Value => Object.Neighbor); Query.Execute (Result); if Result /= 1 then raise ADO.Objects.INSERT_ERROR; end if; ADO.Objects.Set_Created (Object); end Create; overriding procedure Delete (Object : in out Country_Neighbor_Impl; Session : in out ADO.Sessions.Master_Session'Class) is Stmt : ADO.Statements.Delete_Statement := Session.Create_Statement (COUNTRY_NEIGHBOR_DEF'Access); begin Stmt.Set_Filter (Filter => "id = ?"); Stmt.Add_Param (Value => Object.Get_Key); Stmt.Execute; end Delete; -- ------------------------------ -- Get the bean attribute identified by the name. -- ------------------------------ overriding function Get_Value (From : in Country_Neighbor_Ref; Name : in String) return Util.Beans.Objects.Object is Obj : ADO.Objects.Object_Record_Access; Impl : access Country_Neighbor_Impl; begin if From.Is_Null then return Util.Beans.Objects.Null_Object; end if; Obj := From.Get_Load_Object; Impl := Country_Neighbor_Impl (Obj.all)'Access; if Name = "id" then return ADO.Objects.To_Object (Impl.Get_Key); end if; return Util.Beans.Objects.Null_Object; end Get_Value; -- ------------------------------ -- Load the object from current iterator position -- ------------------------------ procedure Load (Object : in out Country_Neighbor_Impl; Stmt : in out ADO.Statements.Query_Statement'Class; Session : in out ADO.Sessions.Session'Class) is begin Object.Set_Key_Value (Stmt.Get_Identifier (0)); if not Stmt.Is_Null (1) then Object.Neighbor_Of.Set_Key_Value (Stmt.Get_Identifier (1), Session); end if; if not Stmt.Is_Null (2) then Object.Neighbor.Set_Key_Value (Stmt.Get_Identifier (2), Session); end if; ADO.Objects.Set_Created (Object); end Load; function Region_Key (Id : in ADO.Identifier) return ADO.Objects.Object_Key is Result : ADO.Objects.Object_Key (Of_Type => ADO.Objects.KEY_INTEGER, Of_Class => REGION_DEF'Access); begin ADO.Objects.Set_Value (Result, Id); return Result; end Region_Key; function Region_Key (Id : in String) return ADO.Objects.Object_Key is Result : ADO.Objects.Object_Key (Of_Type => ADO.Objects.KEY_INTEGER, Of_Class => REGION_DEF'Access); begin ADO.Objects.Set_Value (Result, Id); return Result; end Region_Key; function "=" (Left, Right : Region_Ref'Class) return Boolean is begin return ADO.Objects.Object_Ref'Class (Left) = ADO.Objects.Object_Ref'Class (Right); end "="; procedure Set_Field (Object : in out Region_Ref'Class; Impl : out Region_Access) is Result : ADO.Objects.Object_Record_Access; begin Object.Prepare_Modify (Result); Impl := Region_Impl (Result.all)'Access; end Set_Field; -- Internal method to allocate the Object_Record instance overriding procedure Allocate (Object : in out Region_Ref) is Impl : Region_Access; begin Impl := new Region_Impl; Impl.Geonameid := 0; ADO.Objects.Set_Object (Object, Impl.all'Access); end Allocate; -- ---------------------------------------- -- Data object: Region -- ---------------------------------------- procedure Set_Id (Object : in out Region_Ref; Value : in ADO.Identifier) is Impl : Region_Access; begin Set_Field (Object, Impl); ADO.Objects.Set_Field_Key_Value (Impl.all, 1, Value); end Set_Id; function Get_Id (Object : in Region_Ref) return ADO.Identifier is Impl : constant Region_Access := Region_Impl (Object.Get_Object.all)'Access; begin return Impl.Get_Key_Value; end Get_Id; procedure Set_Name (Object : in out Region_Ref; Value : in String) is Impl : Region_Access; begin Set_Field (Object, Impl); ADO.Objects.Set_Field_String (Impl.all, 2, Impl.Name, Value); end Set_Name; procedure Set_Name (Object : in out Region_Ref; Value : in Ada.Strings.Unbounded.Unbounded_String) is Impl : Region_Access; begin Set_Field (Object, Impl); ADO.Objects.Set_Field_Unbounded_String (Impl.all, 2, Impl.Name, Value); end Set_Name; function Get_Name (Object : in Region_Ref) return String is begin return Ada.Strings.Unbounded.To_String (Object.Get_Name); end Get_Name; function Get_Name (Object : in Region_Ref) return Ada.Strings.Unbounded.Unbounded_String is Impl : constant Region_Access := Region_Impl (Object.Get_Load_Object.all)'Access; begin return Impl.Name; end Get_Name; procedure Set_Geonameid (Object : in out Region_Ref; Value : in Integer) is Impl : Region_Access; begin Set_Field (Object, Impl); ADO.Objects.Set_Field_Integer (Impl.all, 3, Impl.Geonameid, Value); end Set_Geonameid; function Get_Geonameid (Object : in Region_Ref) return Integer is Impl : constant Region_Access := Region_Impl (Object.Get_Load_Object.all)'Access; begin return Impl.Geonameid; end Get_Geonameid; procedure Set_Country (Object : in out Region_Ref; Value : in Country_Ref'Class) is Impl : Region_Access; begin Set_Field (Object, Impl); ADO.Objects.Set_Field_Object (Impl.all, 4, Impl.Country, Value); end Set_Country; function Get_Country (Object : in Region_Ref) return Country_Ref'Class is Impl : constant Region_Access := Region_Impl (Object.Get_Load_Object.all)'Access; begin return Impl.Country; end Get_Country; -- Copy of the object. procedure Copy (Object : in Region_Ref; Into : in out Region_Ref) is Result : Region_Ref; begin if not Object.Is_Null then declare Impl : constant Region_Access := Region_Impl (Object.Get_Load_Object.all)'Access; Copy : constant Region_Access := new Region_Impl; begin ADO.Objects.Set_Object (Result, Copy.all'Access); Copy.Copy (Impl.all); Copy.Name := Impl.Name; Copy.Geonameid := Impl.Geonameid; Copy.Country := Impl.Country; end; end if; Into := Result; end Copy; overriding procedure Find (Object : in out Region_Ref; Session : in out ADO.Sessions.Session'Class; Query : in ADO.SQL.Query'Class; Found : out Boolean) is Impl : constant Region_Access := new Region_Impl; begin Impl.Find (Session, Query, Found); if Found then ADO.Objects.Set_Object (Object, Impl.all'Access); else ADO.Objects.Set_Object (Object, null); Destroy (Impl); end if; end Find; procedure Load (Object : in out Region_Ref; Session : in out ADO.Sessions.Session'Class; Id : in ADO.Identifier) is Impl : constant Region_Access := new Region_Impl; Found : Boolean; Query : ADO.SQL.Query; begin Query.Bind_Param (Position => 1, Value => Id); Query.Set_Filter ("id = ?"); Impl.Find (Session, Query, Found); if not Found then Destroy (Impl); raise ADO.Objects.NOT_FOUND; end if; ADO.Objects.Set_Object (Object, Impl.all'Access); end Load; procedure Load (Object : in out Region_Ref; Session : in out ADO.Sessions.Session'Class; Id : in ADO.Identifier; Found : out Boolean) is Impl : constant Region_Access := new Region_Impl; Query : ADO.SQL.Query; begin Query.Bind_Param (Position => 1, Value => Id); Query.Set_Filter ("id = ?"); Impl.Find (Session, Query, Found); if not Found then Destroy (Impl); else ADO.Objects.Set_Object (Object, Impl.all'Access); end if; end Load; overriding procedure Save (Object : in out Region_Ref; Session : in out ADO.Sessions.Master_Session'Class) is Impl : ADO.Objects.Object_Record_Access := Object.Get_Object; begin if Impl = null then Impl := new Region_Impl; ADO.Objects.Set_Object (Object, Impl); end if; if not ADO.Objects.Is_Created (Impl.all) then Impl.Create (Session); else Impl.Save (Session); end if; end Save; overriding procedure Delete (Object : in out Region_Ref; Session : in out ADO.Sessions.Master_Session'Class) is Impl : constant ADO.Objects.Object_Record_Access := Object.Get_Object; begin if Impl /= null then Impl.Delete (Session); end if; end Delete; -- -------------------- -- Free the object -- -------------------- overriding procedure Destroy (Object : access Region_Impl) is type Region_Impl_Ptr is access all Region_Impl; procedure Unchecked_Free is new Ada.Unchecked_Deallocation (Region_Impl, Region_Impl_Ptr); pragma Warnings (Off, "*redundant conversion*"); Ptr : Region_Impl_Ptr := Region_Impl (Object.all)'Access; pragma Warnings (On, "*redundant conversion*"); begin Unchecked_Free (Ptr); end Destroy; overriding procedure Find (Object : in out Region_Impl; Session : in out ADO.Sessions.Session'Class; Query : in ADO.SQL.Query'Class; Found : out Boolean) is Stmt : ADO.Statements.Query_Statement := Session.Create_Statement (Query, REGION_DEF'Access); begin Stmt.Execute; if Stmt.Has_Elements then Object.Load (Stmt, Session); Stmt.Next; Found := not Stmt.Has_Elements; else Found := False; end if; end Find; overriding procedure Load (Object : in out Region_Impl; Session : in out ADO.Sessions.Session'Class) is Found : Boolean; Query : ADO.SQL.Query; Id : constant ADO.Identifier := Object.Get_Key_Value; begin Query.Bind_Param (Position => 1, Value => Id); Query.Set_Filter ("id = ?"); Object.Find (Session, Query, Found); if not Found then raise ADO.Objects.NOT_FOUND; end if; end Load; overriding procedure Save (Object : in out Region_Impl; Session : in out ADO.Sessions.Master_Session'Class) is Stmt : ADO.Statements.Update_Statement := Session.Create_Statement (REGION_DEF'Access); begin if Object.Is_Modified (1) then Stmt.Save_Field (Name => COL_0_4_NAME, -- id Value => Object.Get_Key); Object.Clear_Modified (1); end if; if Object.Is_Modified (2) then Stmt.Save_Field (Name => COL_1_4_NAME, -- name Value => Object.Name); Object.Clear_Modified (2); end if; if Object.Is_Modified (3) then Stmt.Save_Field (Name => COL_2_4_NAME, -- geonameid Value => Object.Geonameid); Object.Clear_Modified (3); end if; if Object.Is_Modified (4) then Stmt.Save_Field (Name => COL_3_4_NAME, -- country_id Value => Object.Country); Object.Clear_Modified (4); end if; if Stmt.Has_Save_Fields then Stmt.Set_Filter (Filter => "id = ?"); Stmt.Add_Param (Value => Object.Get_Key); declare Result : Integer; begin Stmt.Execute (Result); if Result /= 1 then if Result /= 0 then raise ADO.Objects.UPDATE_ERROR; end if; end if; end; end if; end Save; overriding procedure Create (Object : in out Region_Impl; Session : in out ADO.Sessions.Master_Session'Class) is Query : ADO.Statements.Insert_Statement := Session.Create_Statement (REGION_DEF'Access); Result : Integer; begin Session.Allocate (Id => Object); Query.Save_Field (Name => COL_0_4_NAME, -- id Value => Object.Get_Key); Query.Save_Field (Name => COL_1_4_NAME, -- name Value => Object.Name); Query.Save_Field (Name => COL_2_4_NAME, -- geonameid Value => Object.Geonameid); Query.Save_Field (Name => COL_3_4_NAME, -- country_id Value => Object.Country); Query.Execute (Result); if Result /= 1 then raise ADO.Objects.INSERT_ERROR; end if; ADO.Objects.Set_Created (Object); end Create; overriding procedure Delete (Object : in out Region_Impl; Session : in out ADO.Sessions.Master_Session'Class) is Stmt : ADO.Statements.Delete_Statement := Session.Create_Statement (REGION_DEF'Access); begin Stmt.Set_Filter (Filter => "id = ?"); Stmt.Add_Param (Value => Object.Get_Key); Stmt.Execute; end Delete; -- ------------------------------ -- Get the bean attribute identified by the name. -- ------------------------------ overriding function Get_Value (From : in Region_Ref; Name : in String) return Util.Beans.Objects.Object is Obj : ADO.Objects.Object_Record_Access; Impl : access Region_Impl; begin if From.Is_Null then return Util.Beans.Objects.Null_Object; end if; Obj := From.Get_Load_Object; Impl := Region_Impl (Obj.all)'Access; if Name = "id" then return ADO.Objects.To_Object (Impl.Get_Key); elsif Name = "name" then return Util.Beans.Objects.To_Object (Impl.Name); elsif Name = "geonameid" then return Util.Beans.Objects.To_Object (Long_Long_Integer (Impl.Geonameid)); end if; return Util.Beans.Objects.Null_Object; end Get_Value; -- ------------------------------ -- Load the object from current iterator position -- ------------------------------ procedure Load (Object : in out Region_Impl; Stmt : in out ADO.Statements.Query_Statement'Class; Session : in out ADO.Sessions.Session'Class) is begin Object.Set_Key_Value (Stmt.Get_Identifier (0)); Object.Name := Stmt.Get_Unbounded_String (1); Object.Geonameid := Stmt.Get_Integer (2); if not Stmt.Is_Null (3) then Object.Country.Set_Key_Value (Stmt.Get_Identifier (3), Session); end if; ADO.Objects.Set_Created (Object); end Load; end AWA.Countries.Models;
tum-ei-rcs/StratoX
Ada
5,043
ads
------------------------------------------------------------------------------ -- -- -- SPARK LIBRARY COMPONENTS -- -- -- -- S P A R K . -- -- F L O A T I N G _ P O I N T _ A R I T H M E T I C _ L E M M A S -- -- -- -- S p e c -- -- -- -- Copyright (C) 2017, AdaCore -- -- -- -- SPARK 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. SPARK 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/>. -- -- -- ------------------------------------------------------------------------------ generic type Fl is digits <>; Fl_Last_Sqrt : Fl; package SPARK.Floating_Point_Arithmetic_Lemmas with SPARK_Mode, Pure, Ghost is pragma Warnings (Off, "postcondition does not check the outcome of calling"); procedure Lemma_Add_Is_Monotonic (Val1 : Fl; Val2 : Fl; Val3 : Fl) with Global => null, Pre => (Val1 in Fl'First / 2.0 .. Fl'Last / 2.0) and then (Val2 in Fl'First / 2.0 .. Fl'Last / 2.0) and then (Val3 in Fl'First / 2.0 .. Fl'Last / 2.0) and then Val1 <= Val2, Post => Val1 + Val3 <= Val2 + Val3; procedure Lemma_Sub_Is_Monotonic (Val1 : Fl; Val2 : Fl; Val3 : Fl) with Global => null, Pre => (Val1 in Fl'First / 2.0 .. Fl'Last / 2.0) and then (Val2 in Fl'First / 2.0 .. Fl'Last / 2.0) and then (Val3 in Fl'First / 2.0 .. Fl'Last / 2.0) and then Val1 <= Val2, Post => Val1 - Val3 <= Val2 - Val3; procedure Lemma_Mul_Is_Monotonic (Val1 : Fl; Val2 : Fl; Val3 : Fl) with Global => null, Pre => (Val1 in -Fl_Last_Sqrt .. Fl_Last_Sqrt) and then (Val2 in -Fl_Last_Sqrt .. Fl_Last_Sqrt) and then (Val3 in 0.0 .. Fl_Last_Sqrt) and then Val1 <= Val2, Post => Val1 * Val3 <= Val2 * Val3; -- MANUAL PROOF procedure Lemma_Mul_Is_Antimonotonic (Val1 : Fl; Val2 : Fl; Val3 : Fl) with Global => null, Pre => (Val1 in -Fl_Last_Sqrt .. Fl_Last_Sqrt) and then (Val2 in -Fl_Last_Sqrt .. Fl_Last_Sqrt) and then (Val3 in -Fl_Last_Sqrt .. 0.0) and then Val1 <= Val2, Post => Val2 * Val3 <= Val1 * Val3; -- MANUAL PROOF procedure Lemma_Mul_Is_Contracting (Val1 : Fl; Val2 : Fl) with Global => null, Pre => (Val1 in -1.0 .. 1.0), Post => abs(Val1 * Val2) <= abs(Val2); -- Martin Becker, not proven procedure Lemma_Div_Is_Monotonic (Val1 : Fl; Val2 : Fl; Val3 : Fl) with Global => null, Pre => (Val1 in -Fl_Last_Sqrt .. Fl_Last_Sqrt) and then (Val2 in -Fl_Last_Sqrt .. Fl_Last_Sqrt) and then (Val3 in 1.0 / Fl_Last_Sqrt .. Fl'Last) and then Val1 <= Val2, Post => Val1 / Val3 <= Val2 / Val3; -- MANUAL PROOF procedure Lemma_Div_Is_Antimonotonic (Val1 : Fl; Val2 : Fl; Val3 : Fl) with Global => null, Pre => (Val1 in -Fl_Last_Sqrt .. Fl_Last_Sqrt) and then (Val2 in -Fl_Last_Sqrt .. Fl_Last_Sqrt) and then (Val3 in Fl'First .. -1.0 / Fl_Last_Sqrt) and then Val1 <= Val2, Post => Val2 / Val3 <= Val1 / Val3; -- MANUAL PROOF end SPARK.Floating_Point_Arithmetic_Lemmas;
stcarrez/ada-util
Ada
2,503
adb
----------------------------------------------------------------------- -- csv_reader -- Read CSV file -- Copyright (C) 2011, 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.Text_IO; with Ada.Command_Line; with Util.Serialize.IO.CSV; with Util.Serialize.Mappers; -- This example shows how to read a CSV file. Unlike <b>csv_city</b>, the CSV cells -- are collected directly by overriding the <b>Set_Cell</b> parser procedure. procedure CSV_Reader is use Ada.Text_IO; use Util.Serialize.IO.CSV; Prev_Row : Row_Type; type CSV_Parser is new Util.Serialize.IO.CSV.Parser with null record; overriding procedure Set_Cell (Parser : in out CSV_Parser; Value : in String; Row : in Util.Serialize.IO.CSV.Row_Type; Column : in Util.Serialize.IO.CSV.Column_Type); overriding procedure Set_Cell (Parser : in out CSV_Parser; Value : in String; Row : in Util.Serialize.IO.CSV.Row_Type; Column : in Util.Serialize.IO.CSV.Column_Type) is pragma Unreferenced (Parser, Column); begin if Prev_Row /= Row then Ada.Text_IO.New_Line; Prev_Row := Row; else Put (" "); end if; Ada.Text_IO.Put (Value); end Set_Cell; Parser : CSV_Parser; Count : constant Natural := Ada.Command_Line.Argument_Count; begin if Count = 0 then Ada.Text_IO.Put_Line ("Usage: csv_reader file..."); return; end if; for I in 1 .. Count loop declare File : constant String := Ada.Command_Line.Argument (I); Mapper : Util.Serialize.Mappers.Processing; begin Prev_Row := Row_Type'Last; Parser.Parse (File, Mapper); end; end loop; end CSV_Reader;
AdaCore/libadalang
Ada
245
adb
-- Ensure that the internal package "root_types_" does not appear in the list -- of completion returned by ``p_complete``. procedure Test is begin R; --% [x.decl for x in node.f_call.p_complete if x.decl.is_a(lal.PackageDecl)] end Test;
AaronC98/PlaneSystem
Ada
3,359
ads
------------------------------------------------------------------------------ -- Ada Web Server -- -- -- -- Copyright (C) 2004-2014, AdaCore -- -- -- -- This library is free software; you can redistribute it and/or modify -- -- it under terms of the GNU General Public License as published by the -- -- Free Software Foundation; either version 3, or (at your option) any -- -- later version. This library is distributed in the hope that it will be -- -- useful, but WITHOUT ANY WARRANTY; without even the implied warranty of -- -- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. -- -- -- -- -- -- -- -- -- -- -- -- You should have received a copy of the GNU General Public License and -- -- a copy of the GCC Runtime Library Exception along with this program; -- -- see the files COPYING3 and COPYING.RUNTIME respectively. If not, see -- -- <http://www.gnu.org/licenses/>. -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- ------------------------------------------------------------------------------ with Input_Sources; with Unicode.CES; package AWS.Client.XML.Input_Sources is Invalid_Encoding : exception renames Unicode.CES.Invalid_Encoding; package Sources renames Standard.Input_Sources; type HTTP_Input is new Sources.Input_Source with private; -- A special implementation of a reader, that reads from an HTTP stream procedure Create (Connection : HTTP_Connection; Input : out HTTP_Input); -- Returns the HTTP_Input stream from a client connection overriding procedure Next_Char (From : in out HTTP_Input; C : out Unicode.Unicode_Char); -- Returns the next character in the file overriding function Eof (From : HTTP_Input) return Boolean; -- True if From is past the last character in the file private type HTTP_Input is new Sources.Input_Source with record Self : not null access HTTP_Input := HTTP_Input'Unchecked_Access; HTTP : HTTP_Connection_Access; Buffer : Stream_Element_Array (1 .. 4_096); First : Stream_Element_Offset; Last : Stream_Element_Offset; end record; end AWS.Client.XML.Input_Sources;
zhmu/ananas
Ada
238
ads
-- { dg-do compile } -- { dg-options "-O2" } with Ada.Strings.Unbounded; use Ada.Strings.Unbounded; with Interfaces; use Interfaces; package Opt2 is type Arr is array (Unsigned_32 range <>) of Unbounded_String; end Opt2;
reznikmm/matreshka
Ada
4,387
ads
------------------------------------------------------------------------------ -- -- -- Matreshka Project -- -- -- -- Web Framework -- -- -- -- Web API Definition -- -- -- ------------------------------------------------------------------------------ -- -- -- Copyright © 2016, 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 WebAPI.HTML.Locations is pragma Preelaborate; type Location is limited interface; type Location_Access is access all Location'Class with Storage_Size => 0; not overriding procedure Assign (Self : not null access Location; URL : WebAPI.DOM_String) is abstract with Import => True, Convention => JavaScript_Method, Link_Name => "assign"; -- Navigates to the given page. not overriding procedure Replace (Self : not null access Location; URL : WebAPI.DOM_String) is abstract with Import => True, Convention => JavaScript_Method, Link_Name => "replace"; -- Removes the current page from the session history and navigates to -- the given page. not overriding procedure Reload (Self : not null access Location) is abstract with Import => True, Convention => JavaScript_Method, Link_Name => "reload"; -- Reloads the current page. end WebAPI.HTML.Locations;
rveenker/sdlada
Ada
8,485
ads
-------------------------------------------------------------------------------------------------------------------- -- Copyright (c) 2013-2020, Luke A. Guest -- -- This software is provided 'as-is', without any express or implied -- warranty. In no event will the authors be held liable for any damages -- arising from the use of this software. -- -- Permission is granted to anyone to use this software for any purpose, -- including commercial applications, and to alter it and redistribute it -- freely, subject to the following restrictions: -- -- 1. The origin of this software must not be misrepresented; you must not -- claim that you wrote the original software. If you use this software -- in a product, an acknowledgment in the product documentation would be -- appreciated but is not required. -- -- 2. Altered source versions must be plainly marked as such, and must not be -- misrepresented as being the original software. -- -- 3. This notice may not be removed or altered from any source -- distribution. -------------------------------------------------------------------------------------------------------------------- -- SDL.RWops -- -- Read/Write operations, i.e. file related machinery. -------------------------------------------------------------------------------------------------------------------- with Ada.Strings.UTF_Encoding; with Interfaces.C; with System; package SDL.RWops is package C renames Interfaces.C; package UTF_Strings renames Ada.Strings.UTF_Encoding; RWops_Error : exception; subtype Uint8 is Interfaces.Unsigned_8; subtype Uint16 is Interfaces.Unsigned_16; subtype Uint32 is Interfaces.Unsigned_32; subtype Uint64 is Interfaces.Unsigned_64; type RWops is limited private; type File_Mode is (Read, Create_To_Write, Append, Read_Write, Create_To_Read_Write, Append_And_Read, Read_Binary, Create_To_Write_Binary, Append_Binary, Read_Write_Binary, Create_To_Read_Write_Binary, Append_And_Read_Binary); type Whence_Type is private; RW_Seek_Set : constant Whence_Type; -- Seek from the beginning of data. RW_Seek_Cur : constant Whence_Type; -- Seek relative to current read point. RW_Seek_End : constant Whence_Type; -- Seek relative to the end of data. type Offsets is new Interfaces.Integer_64; Null_Offset : constant Offsets := 0; Error_Offset : constant Offsets := -1; subtype Sizes is Offsets; Error_Or_EOF : constant Sizes := 0; function Base_Path return UTF_Strings.UTF_String; function Preferences_Path (Organisation : in UTF_Strings.UTF_String; Application : in UTF_Strings.UTF_String) return UTF_Strings.UTF_String; function Seek (Context : in RWops; Offset : in Offsets; Whence : in Whence_Type) return Offsets; function Size (Context : in RWops) return Offsets; function Tell (Context : in RWops) return Offsets; function From_File (File_Name : in UTF_Strings.UTF_String; Mode : in File_Mode) return RWops; procedure From_File (File_Name : in UTF_Strings.UTF_String; Mode : in File_Mode; Ops : out RWops); function From_Mem (Mem : in System.Address; Size : in Sizes) return RWops; procedure From_Mem (Mem : in System.Address; Size : in Sizes; Ops : out RWops); procedure Close (Ops : in RWops); function Read_U_8 (src : in RWops) return Uint8 with Import => True, Convention => C, External_Name => "SDL_ReadU8"; function Read_LE_16 (Src : in RWops) return Uint16 with Import => True, Convention => C, External_Name => "SDL_ReadLE16"; function Read_BE_16 (Src : in RWops) return Uint16 with Import => True, Convention => C, External_Name => "SDL_ReadBE16"; function Read_LE_32 (Src : in RWops) return Uint32 with Import => True, Convention => C, External_Name => "SDL_ReadLE32"; function Read_BE_32 (Src : in RWops) return Uint32 with Import => True, Convention => C, External_Name => "SDL_ReadBE32"; function Read_LE_64 (Src : in RWops) return Uint64 with Import => True, Convention => C, External_Name => "SDL_ReadLE64"; function Read_BE_64 (Src : in RWops) return Uint64 with Import => True, Convention => C, External_Name => "SDL_ReadBE64"; procedure Write_U_8 (Destination : in RWops; Value : in Uint8); procedure Write_LE_16 (Destination : in RWops; Value : in Uint16); procedure Write_BE_16 (Destination : in RWops; Value : in Uint16); procedure Write_LE_32 (Destination : in RWops; Value : in Uint32); procedure Write_BE_32 (Destination : in RWops; Value : in Uint32); procedure Write_LE_64 (Destination : in RWops; Value : in Uint64); procedure Write_BE_64 (Destination : in RWops; Value : in Uint64); function Is_Null (Source : in RWops) return Boolean with Inline_Always => True; private type Whence_Type is new C.int; RW_Seek_Set : constant Whence_Type := 0; RW_Seek_Cur : constant Whence_Type := 1; RW_Seek_End : constant Whence_Type := 2; -- The SDL_RWops struct contains a union which is only used internally by SDL. -- -- The manual states that when a new RWops implementation is written, the Unknown struct within the union can be -- used to store data, this consists of two pointers. This is all that is allowed. -- -- TODO: Make it generic passing in two access types of convention C. -- Definition of SDL_RWops struct in Ada. -- Note that it is platform dependant and may need altering. type WindowsIO_Data is record Append : SDL_Bool; H : System.Address; Buffer_data : System.Address; Buffer_Size : Offsets; Buffer_Left : Offsets; end record with Convention => C; type StdIO_Data is record Autoclose : SDL_Bool; fp : System.Address; end record with Convention => C; type User_Datums is record Data_1 : System.Address; Data_2 : System.Address; end record with Convention => C; type Hidden_Data is record WindowsIO : WindowsIO_Data; StdIO : StdIO_Data; Mem_Base : System.Address; Mem_Here : System.Address; Mem_Stop : System.Address; User_Data : User_Datums; end record with Convention => C; type Stream_Types is new C.unsigned; Unknown_Stream : constant Stream_Types := 0; type RWops_Pointer; type SDL_RWops is record Size : access function (Context : in RWops_Pointer) return Offsets; Seek : access function (Context : in RWops_Pointer; Offset : in Offsets; Whence : in Whence_Type) return Offsets; -- The functions Read and Write do not work (parameter passing of values fails) -- Use the wrapped functions instead Read : access function (Context : in RWops_Pointer; Ptr : in System.Address; Size : in Sizes; Max_Num : in C.unsigned_long) return C.unsigned_long; Write : access function (Context : in RWops_Pointer; Ptr : in System.Address; Size : in Sizes; Num : in C.unsigned_long) return C.unsigned_long; Close : access function (Context : in RWops_Pointer) return C.int; Stream_Type : Stream_Types; -- When creating a RWops, this should always be set to Unknown_Stream. Hidden : Hidden_Data; end record with Convention => C_Pass_By_Copy; type RWops_Pointer is access all SDL_RWops with Convention => C; type RWops is new RWops_Pointer; end SDL.RWops;
micahwelf/FLTK-Ada
Ada
855
ads
package FLTK.Widgets.Valuators.Sliders.Fill is type Fill_Slider is new Slider with private; type Fill_Slider_Reference (Data : not null access Fill_Slider'Class) is limited null record with Implicit_Dereference => Data; package Forge is function Create (X, Y, W, H : in Integer; Text : in String) return Fill_Slider; end Forge; procedure Draw (This : in out Fill_Slider); function Handle (This : in out Fill_Slider; Event : in Event_Kind) return Event_Outcome; private type Fill_Slider is new Slider with null record; overriding procedure Finalize (This : in out Fill_Slider); pragma Inline (Draw); pragma Inline (Handle); end FLTK.Widgets.Valuators.Sliders.Fill;
flyx/OpenGLAda
Ada
24,762
ads
-- part of OpenGLAda, (c) 2017 Felix Krause -- released under the terms of the MIT license, see the file "COPYING" with System; with Interfaces.C.Extensions; with Interfaces.C.Strings; with GL.Low_Level; with GL.Types; package GL.CGL is pragma Preelaborate; use GL.Types; -- CGL types and constants subtype CGLContextObject is System.Address; subtype CGLPixelFormatObject is System.Address; subtype CGLRendererInfoObject is System.Address; subtype CGLPBufferObject is System.Address; subtype CGLShareGroup is System.Address; type CGLPixelFormatAttribute is (Terminator, kCGLPFAAllRenderers, kCGLPFATripleBuffer, kCGLPFADoubleBuffer, kCGLPFAStereo, kCGLPFAAuxBuffers, kCGLPFAColorSize, kCGLPFAAlphaSize, kCGLPFADepthSize, kCGLPFAStencilSize, kCGLPFAAccumSize, kCGLPFAMinimumPolicy, kCGLPFAMaximumPolicy, kCGLPFAOffScreen, kCGLPFAFullScreen, kCGLPFASampleBuffers, kCGLPFASamples, kCGLPFAAuxDepthStencil, kCGLPFAColorFloat, kCGLPFAMultisample, kCGLPFASupersample, kCGLPFASampleAlpha, kCGLPFARendererID, kCGLPFASingleRenderer, kCGLPFANoRecovery, kCGLPFAAccelerated, kCGLPFAClosestPolicy, kCGLPFARobust, kCGLPFABackingStore, kCGLPFAMPSafe, kCGLPFAWindow, kCGLPFAMultiScreen, kCGLPFACompliant, kCGLPFADisplayMask, kCGLPFAPBuffer, kCGLPFARemotePBuffer, kCGLPFAAllowOfflineRenderers, kCGLPFAAcceleratedCompute, kCGLPFAOpenGLProfile, kCGLPFAVirtualScreenCount); type CGLRendererProperty is (kCGLRPOffScreen, kCGLRPFullScreen, kCGLRPRendererID, kCGLRPAccelerated, kCGLRPRobust, kCGLRPBackingStore, kCGLRPMPSafe, kCGLRPWindow, kCGLRPMultiScreen, kCGLRPCompliant, kCGLRPDisplayMask, kCGLRPBufferModes, kCGLRPColorModes, kCGLRPAccumModes, kCGLRPDepthModes, kCGLRPStencilModes, kCGLRPMaxAuxBuffers, kCGLRPMaxSampleBuffers, kCGLRPMaxSamples, kCGLRPSampleModes, kCGLRPSampleAlpha, kCGLRPVideoMemory, kCGLRPTextureMemory, kCGLRPGPUVertProcCapable, kCGLRPGPUFragProcCapable, kCGLRPRendererCount, kCGLRPOnline, kCGLRPAcceleratedCompute, kCGLRPVideoMemoryMegabytes, kCGLRPTextureMemoryMegabytes); type CGLContextEnable is (kCGLCESwapRectangle, kCGLCESwapLimit, kCGLCERasterization, kCGLCEStateValidation, kCGLCESurfaceBackingSize, kCGLCEDisplayListOptimization, kCGLCEMPEngine, kCGLCECrashOnRemovedFunctions); type CGLContextParameter is (kCGLCPSwapRectangle, kCGLCPSwapInterval, kCGLCPDispatchTableSize, kCGLCPClientStorage, kCGLCPSurfaceTexture, kCGLCPSurfaceOrder, kCGLCPSurfaceOpacity, kCGLCPSurfaceBackingSize, kCGLCPSurfaceSurfaceVolatile, kCGLCPReclaimResources, kCGLCPCurrentRendererID, kCGLCPGPUVertexProcessing, kCGLCPGPUFragmentProcessing, kCGLCPHasDrawable, kCGLCPMPSwapsInFlight); type CGLGlobalOption is (kCGLGOFormatCacheSize, kCGLGOClearFormatCache, kCGLGORetainRenderers, kCGLGOResetLibrary, kCGLGOUseErrorHandler, kCGLGOUseBuildCache); type CGLOpenGLProfile is (kCGLOGLPVersion_Legacy, kCGLOGLPVersion_3_2_Core); type CGLError is (kCGLNoError, kCGLBadAttribute, kCGLBadProperty, kCGLBadPixelFormat, kCGLBadRendererInfo, kCGLBadContext, kCGLBadDrawable, kCGLBadDisplay, kCGLBadState, kCGLBadValue, kCGLBadMatch, kCGLBadEnumeration, kCGLBadOffScreen, kCGLBadFullScreen, kCGLBadWindow, kCGLBadAddress, kCGLBadCodeModule, kCGLBadAlloc, kCGLBadConnection); kCGLMonoscopicBit : constant := 16#00000001#; kCGLStereoscopicBit : constant := 16#00000002#; kCGLSingleBufferBit : constant := 16#00000004#; kCGLDoubleBufferBit : constant := 16#00000008#; kCGLTripleBufferBit : constant := 16#00000010#; kCGL0Bit : constant := 16#00000001#; kCGL1Bit : constant := 16#00000002#; kCGL2Bit : constant := 16#00000004#; kCGL3Bit : constant := 16#00000008#; kCGL4Bit : constant := 16#00000010#; kCGL5Bit : constant := 16#00000020#; kCGL6Bit : constant := 16#00000040#; kCGL8Bit : constant := 16#00000080#; kCGL10Bit : constant := 16#00000100#; kCGL12Bit : constant := 16#00000200#; kCGL16Bit : constant := 16#00000400#; kCGL24Bit : constant := 16#00000800#; kCGL32Bit : constant := 16#00001000#; kCGL48Bit : constant := 16#00002000#; kCGL64Bit : constant := 16#00004000#; kCGL96Bit : constant := 16#00008000#; kCGL128Bit : constant := 16#00010000#; kCGLRGB444Bit : constant := 16#00000040#; kCGLARGB4444Bit : constant := 16#00000080#; kCGLRGB444A8Bit : constant := 16#00000100#; kCGLRGB555Bit : constant := 16#00000200#; kCGLARGB1555Bit : constant := 16#00000400#; kCGLRGB555A8Bit : constant := 16#00000800#; kCGLRGB565Bit : constant := 16#00001000#; kCGLRGB565A8Bit : constant := 16#00002000#; kCGLRGB888Bit : constant := 16#00004000#; kCGLARGB8888Bit : constant := 16#00008000#; kCGLRGB888A8Bit : constant := 16#00010000#; kCGLRGB101010Bit : constant := 16#00020000#; kCGLARGB2101010Bit : constant := 16#00040000#; kCGLRGB101010_A8Bit : constant := 16#00080000#; kCGLRGB121212Bit : constant := 16#00100000#; kCGLARGB12121212Bit : constant := 16#00200000#; kCGLRGB161616Bit : constant := 16#00400000#; kCGLRGBA16161616Bit : constant := 16#00800000#; kCGLRGBFloat64Bit : constant := 16#01000000#; kCGLRGBAFloat64Bit : constant := 16#02000000#; kCGLRGBFloat128Bit : constant := 16#04000000#; kCGLRGBAFloat128Bit : constant := 16#08000000#; kCGLRGBFloat256Bit : constant := 16#10000000#; kCGLRGBAFloat256Bit : constant := 16#20000000#; kCGLSupersampleBit : constant := 16#00000001#; kCGLMultisampleBit : constant := 16#00000002#; type CGLPixelFormatAttribute_Array is array (Positive range <>) of aliased CGLPixelFormatAttribute; -- Pixel format functions function CGLChoosePixelFormat (attribs : access CGLPixelFormatAttribute; pix : access CGLPixelFormatObject; npix : access Int) return CGLError; function CGLDestroyPixelFormat (pix : CGLPixelFormatObject) return CGLError; function CGLDescribePixelFormat (pix : CGLPixelFormatObject; pix_num : Int; attrib : CGLPixelFormatAttribute; value : access Int) return CGLError; procedure CGLReleasePixelFormat (pix : in CGLPixelFormatObject); function CGLRetainPixelFormat (pix : CGLPixelFormatObject) return CGLPixelFormatObject; function CGLGetPixelFormatRetainCount (pix : CGLPixelFormatObject) return UInt; function CGLQueryRendererInfo (display_mask : UInt; rend : access CGLRendererInfoObject; nrend : access Int) return CGLError; function CGLDestroyRendererInfo (rend : CGLRendererInfoObject) return CGLError; function CGLDescribeRenderer (rend : CGLRendererInfoObject; rend_num : Int; prop : CGLRendererProperty; value : access Int) return CGLError; function CGLCreateContext (pix : CGLPixelFormatObject; share : CGLContextObject; ctx : access CGLContextObject) return CGLError; function CGLDestroyContext (ctx : CGLContextObject) return CGLError; function CGLCopyContext (src, dst : CGLContextObject; mask : Low_Level.Bitfield) return CGLError; function CGLRetainContext (ctx : CGLContextObject) return CGLContextObject; procedure CGLReleaseContext (ctx : in CGLContextObject); function CGLGetContextRetainCount (ctx : CGLContextObject) return UInt; function CGLGetPixelFormat (ctx : CGLContextObject) return CGLPixelFormatObject; function CGLCreatePBuffer (width, height : Size; target, internalFormat : Low_Level.Enum; max_level : Int; pbuffer : access CGLPBufferObject) return CGLError; function CGLDestroyPBuffer (pbuffer : CGLPBufferObject) return CGLError; function CGLDescribePBuffer (obj : CGLPBufferObject; width, height : access Size; target, internalFormat : access Low_Level.Enum; mipmap : access Int) return CGLError; function CGLTexImagePBuffer (ctx : CGLContextObject; pbuffer : CGLPBufferObject; source : Low_Level.Enum) return CGLError; function CGLRetainPBuffer (pbuffer : CGLPBufferObject) return CGLPBufferObject; procedure CGLReleasePBuffer (pbuffer : in CGLPBufferObject); function CGLGetPBufferRetainCount (pbuffer : CGLPBufferObject) return UInt; function CGLSetOffScreen (ctx : CGLContextObject; width, height : Size; rowbytes : Int; baseaddr : Interfaces.C.Extensions.void_ptr) return CGLError; function CGLGetOffScreen (ctx : CGLContextObject; width, height : access Size; rowbytes : access Int; baseaddr : access Interfaces.C.Extensions.void_ptr) return CGLError; function CGLSetFullScreen (ctx : CGLContextObject) return CGLError; function CGLSetFullScreenOnDisplay (ctx : CGLContextObject; display_mask : UInt) return CGLError; function CGLSetPBuffer (ctx : CGLContextObject; pbuffer : CGLPBufferObject; face : Low_Level.Enum; level, screen : Int) return CGLError; function CGLGetPBuffer (ctx : CGLContextObject; pbuffer : access CGLPBufferObject; face : access Low_Level.Enum; level, screen : access Int) return CGLError; function CGLClearDrawable (ctx : CGLContextObject) return CGLError; function CGLFlushDrawable (ctx : CGLContextObject) return CGLError; function CGLEnable (ctx : CGLContextObject; pname : CGLContextEnable) return CGLError; function CGLDisable (ctx : CGLContextObject; pname : CGLContextEnable) return CGLError; function CGLIsEnabled (ctx : CGLContextObject; pname : CGLContextEnable; enable : access Int) return CGLError; function CGLSetParameter (ctx : CGLContextObject; pname : CGLContextParameter; params : access constant Int) return CGLError; function CGLGetParameter (ctx : CGLContextObject; pname : CGLContextParameter; params : access Int) return CGLError; function CGLSetVirtualScreen (ctx : CGLContextObject; screen : Int) return CGLError; function CGLGetVirtualScreen (ctx : CGLContextObject; screen : access Int) return CGLError; function CGLUpdateContext (ctx : CGLContextObject) return CGLError; function CGLSetGlobalOption (pname : CGLGlobalOption; params : access constant Int) return CGLError; function CGLGetGlobalOption (pname : CGLGlobalOption; params : access Int) return CGLError; function CGLSetOption (pname : CGLGlobalOption; param : Int) return CGLError; function CGLGetOption (pname : CGLGlobalOption; param : access Int) return CGLError; function CGLLockContext (ctx : CGLContextObject) return CGLError; function CGLUnlockContext (ctx : CGLContextObject) return CGLError; procedure CGLGetVersion (majorvers, minorvers : out Int); function CGLErrorString (error : CGLError) return Interfaces.C.Strings.chars_ptr; function CGLSetCurrentContext (ctx : CGLContextObject) return CGLError; function CGLGetCurrentContext return CGLContextObject; function CGLGetShareGroup (ctx : CGLContextObject) return CGLShareGroup; private C_Enum_Size : constant := 32; for CGLPixelFormatAttribute use (Terminator => 0, kCGLPFAAllRenderers => 1, kCGLPFATripleBuffer => 3, kCGLPFADoubleBuffer => 5, kCGLPFAStereo => 6, kCGLPFAAuxBuffers => 7, kCGLPFAColorSize => 8, kCGLPFAAlphaSize => 11, kCGLPFADepthSize => 12, kCGLPFAStencilSize => 13, kCGLPFAAccumSize => 14, kCGLPFAMinimumPolicy => 51, kCGLPFAMaximumPolicy => 52, kCGLPFAOffScreen => 53, kCGLPFAFullScreen => 54, kCGLPFASampleBuffers => 55, kCGLPFASamples => 56, kCGLPFAAuxDepthStencil => 57, kCGLPFAColorFloat => 58, kCGLPFAMultisample => 59, kCGLPFASupersample => 60, kCGLPFASampleAlpha => 61, kCGLPFARendererID => 70, kCGLPFASingleRenderer => 71, kCGLPFANoRecovery => 72, kCGLPFAAccelerated => 73, kCGLPFAClosestPolicy => 74, kCGLPFARobust => 75, kCGLPFABackingStore => 76, kCGLPFAMPSafe => 78, kCGLPFAWindow => 80, kCGLPFAMultiScreen => 81, kCGLPFACompliant => 83, kCGLPFADisplayMask => 84, kCGLPFAPBuffer => 90, kCGLPFARemotePBuffer => 91, kCGLPFAAllowOfflineRenderers => 96, kCGLPFAAcceleratedCompute => 97, kCGLPFAOpenGLProfile => 99, kCGLPFAVirtualScreenCount => 128 ); for CGLPixelFormatAttribute'Size use C_Enum_Size; pragma Convention (C, CGLPixelFormatAttribute); for CGLRendererProperty use (kCGLRPOffScreen => 53, kCGLRPFullScreen => 54, kCGLRPRendererID => 70, kCGLRPAccelerated => 73, kCGLRPRobust => 75, kCGLRPBackingStore => 76, kCGLRPMPSafe => 78, kCGLRPWindow => 80, kCGLRPMultiScreen => 81, kCGLRPCompliant => 83, kCGLRPDisplayMask => 84, kCGLRPBufferModes => 100, kCGLRPColorModes => 103, kCGLRPAccumModes => 104, kCGLRPDepthModes => 105, kCGLRPStencilModes => 106, kCGLRPMaxAuxBuffers => 107, kCGLRPMaxSampleBuffers => 108, kCGLRPMaxSamples => 109, kCGLRPSampleModes => 110, kCGLRPSampleAlpha => 111, kCGLRPVideoMemory => 120, kCGLRPTextureMemory => 121, kCGLRPGPUVertProcCapable => 122, kCGLRPGPUFragProcCapable => 123, kCGLRPRendererCount => 128, kCGLRPOnline => 129, kCGLRPAcceleratedCompute => 130, kCGLRPVideoMemoryMegabytes => 131, kCGLRPTextureMemoryMegabytes => 132 ); for CGLRendererProperty'Size use C_Enum_Size; pragma Convention (C, CGLRendererProperty); for CGLContextEnable use (kCGLCESwapRectangle => 201, kCGLCESwapLimit => 203, kCGLCERasterization => 221, kCGLCEStateValidation => 301, kCGLCESurfaceBackingSize => 305, kCGLCEDisplayListOptimization => 307, kCGLCEMPEngine => 313, kCGLCECrashOnRemovedFunctions => 316 ); for CGLContextEnable'Size use C_Enum_Size; pragma Convention (C, CGLContextEnable); for CGLContextParameter use (kCGLCPSwapRectangle => 200, kCGLCPSwapInterval => 222, kCGLCPDispatchTableSize => 224, kCGLCPClientStorage => 226, kCGLCPSurfaceTexture => 228, kCGLCPSurfaceOrder => 235, kCGLCPSurfaceOpacity => 236, kCGLCPSurfaceBackingSize => 304, kCGLCPSurfaceSurfaceVolatile => 306, kCGLCPReclaimResources => 308, kCGLCPCurrentRendererID => 309, kCGLCPGPUVertexProcessing => 310, kCGLCPGPUFragmentProcessing => 311, kCGLCPHasDrawable => 314, kCGLCPMPSwapsInFlight => 315 ); for CGLContextParameter'Size use C_Enum_Size; pragma Convention (C, CGLContextParameter); for CGLGlobalOption use (kCGLGOFormatCacheSize => 501, kCGLGOClearFormatCache => 502, kCGLGORetainRenderers => 503, kCGLGOResetLibrary => 504, kCGLGOUseErrorHandler => 505, kCGLGOUseBuildCache => 506 ); for CGLGlobalOption'Size use C_Enum_Size; pragma Convention (C, CGLGlobalOption); for CGLOpenGLProfile use (kCGLOGLPVersion_Legacy => 16#1000#, kCGLOGLPVersion_3_2_Core => 16#3200# ); for CGLOpenGLProfile'Size use C_Enum_Size; pragma Convention (C, CGLOpenGLProfile); for CGLError use (kCGLNoError => 0, kCGLBadAttribute => 10000, kCGLBadProperty => 10001, kCGLBadPixelFormat => 10002, kCGLBadRendererInfo => 10003, kCGLBadContext => 10004, kCGLBadDrawable => 10005, kCGLBadDisplay => 10006, kCGLBadState => 10007, kCGLBadValue => 10008, kCGLBadMatch => 10009, kCGLBadEnumeration => 10010, kCGLBadOffScreen => 10011, kCGLBadFullScreen => 10012, kCGLBadWindow => 10013, kCGLBadAddress => 10014, kCGLBadCodeModule => 10015, kCGLBadAlloc => 10016, kCGLBadConnection => 10017 ); for CGLError'Size use C_Enum_Size; pragma Convention (C, CGLError); pragma Import (C, CGLChoosePixelFormat, "CGLChoosePixelFormat"); pragma Import (C, CGLDestroyPixelFormat, "CGLDestroyPixelFormat"); pragma Import (C, CGLDescribePixelFormat, "CGLDescribePixelFormat"); pragma Import (C, CGLReleasePixelFormat, "CGLReleasePixelFormat"); pragma Import (C, CGLRetainPixelFormat, "CGLRetainPixelFormat"); pragma Import (C, CGLGetPixelFormatRetainCount, "CGLGetPixelFormatRetainCount"); pragma Import (C, CGLQueryRendererInfo, "CGLQueryRendererInfo"); pragma Import (C, CGLDestroyRendererInfo, "CGLDestroyRendererInfo"); pragma Import (C, CGLDescribeRenderer, "CGLDescribeRenderer"); pragma Import (C, CGLCreateContext, "CGLCreateContext"); pragma Import (C, CGLDestroyContext, "CGLDestroyContext"); pragma Import (C, CGLCopyContext, "CGLCopyContext"); pragma Import (C, CGLRetainContext, "CGLRetainContext"); pragma Import (C, CGLReleaseContext, "CGLReleaseContext"); pragma Import (C, CGLGetContextRetainCount, "CGLGetContextRetainCount"); pragma Import (C, CGLGetPixelFormat, "CGLGetPixelFormat"); pragma Import (C, CGLCreatePBuffer, "CGLCreatePBuffer"); pragma Import (C, CGLDestroyPBuffer, "CGLDestroyPBuffer"); pragma Import (C, CGLDescribePBuffer, "CGLDescribePBuffer"); pragma Import (C, CGLTexImagePBuffer, "CGLTexImagePBuffer"); pragma Import (C, CGLRetainPBuffer, "CGLRetainPBuffer"); pragma Import (C, CGLReleasePBuffer, "CGLReleasePBuffer"); pragma Import (C, CGLGetPBufferRetainCount, "CGLGetPBufferRetainCount"); pragma Import (C, CGLSetOffScreen, "CGLSetOffScreen"); pragma Import (C, CGLGetOffScreen, "CGLGetOffScreen"); pragma Import (C, CGLSetFullScreen, "CGLSetFullScreen"); pragma Import (C, CGLSetFullScreenOnDisplay, "CGLSetFullScreenOnDisplay"); pragma Import (C, CGLSetPBuffer, "CGLSetPBuffer"); pragma Import (C, CGLGetPBuffer, "CGLGetPBuffer"); pragma Import (C, CGLClearDrawable, "CGLClearDrawable"); pragma Import (C, CGLFlushDrawable, "CGLFlushDrawable"); pragma Import (C, CGLEnable, "CGLEnable"); pragma Import (C, CGLDisable, "CGLDisable"); pragma Import (C, CGLIsEnabled, "CGLIsEnabled"); pragma Import (C, CGLSetParameter, "CGLSetParameter"); pragma Import (C, CGLGetParameter, "CGLGetParameter"); pragma Import (C, CGLSetVirtualScreen, "CGLSetVirtualScreen"); pragma Import (C, CGLGetVirtualScreen, "CGLGetVirtualScreen"); pragma Import (C, CGLUpdateContext, "CGLUpdateContext"); pragma Import (C, CGLSetGlobalOption, "CGLSetGlobalOption"); pragma Import (C, CGLGetGlobalOption, "CGLGetGlobalOption"); pragma Import (C, CGLSetOption, "CGLSetOption"); pragma Import (C, CGLGetOption, "CGLGetOption"); pragma Import (C, CGLLockContext, "CGLLockContext"); pragma Import (C, CGLUnlockContext, "CGLUnlockContext"); pragma Import (C, CGLGetVersion, "CGLGetVersion"); pragma Import (C, CGLErrorString, "CGLErrorString"); pragma Import (C, CGLSetCurrentContext, "CGLSetCurrentContext"); pragma Import (C, CGLGetCurrentContext, "CGLGetCurrentContext"); pragma Import (C, CGLGetShareGroup, "CGLGetShareGroup"); end GL.CGL;
godunko/adawebui
Ada
4,963
adb
------------------------------------------------------------------------------ -- -- -- Matreshka Project -- -- -- -- Web Framework -- -- -- -- Runtime Library Component -- -- -- ------------------------------------------------------------------------------ -- -- -- Copyright © 2017-2020, 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: 5717 $ $Date: 2017-01-24 16:36:23 +0300 (Tue, 24 Jan 2017) $ ------------------------------------------------------------------------------ package body Web.Core.Connectables.Slots_0.Slots_1.Generic_Slots is --------------------- -- Create_Slot_End -- --------------------- overriding function Create_Slot_End (Self : Slot) return not null Slot_End_Access is begin -- return -- new Slot_End' -- (Next => null, -- Previous => null, -- Object => Self.Object.all'Unchecked_Access); -- XXX A2JS: invalid code generated return Result : not null Slot_End_Access := new Slot_End (Self.Object.all'Unchecked_Access) do Result.Next := null; Result.Previous := null; end return; end Create_Slot_End; ------------ -- Invoke -- ------------ overriding procedure Invoke (Self : in out Slot_End; Parameter_1 : Parameter_1_Type) is begin Subprogram (Self.Object.all, Parameter_1); end Invoke; ----------- -- Owner -- ----------- overriding function Owner (Self : Slot_End) return not null Core.Connectables.Object_Access is begin return Core.Connectables.Connectable_Object'Class (Self.Object.all)'Unchecked_Access; end Owner; ------------- -- To_Slot -- ------------- function To_Slot (Self : in out Abstract_Object'Class) return Slots_1.Slot'Class is begin -- return Slot'(Object => Self'Unchecked_Access); -- XXX A2JS: invalid code generated return Result : Slot (Self'Unchecked_Access); end To_Slot; end Web.Core.Connectables.Slots_0.Slots_1.Generic_Slots;
persan/AdaYaml
Ada
12,293
ads
-- part of AdaYaml, (c) 2017 Felix Krause -- released under the terms of the MIT license, see the file "copying.txt" with Yaml.Source; with Text.Pool; private with Ada.Finalization; private with Yaml.Lexer; private with Yaml.Stacks; private with Yaml.Text_Set; package Yaml.Parser is -- this package implements a parser that generates an event stream from a -- YAML characters stream source. type Instance is limited new Refcount_Base with private; type Instance_Access is access all Instance; subtype Class is Instance'Class; type Reference is tagged private; type Accessor (Data : not null access Instance) is limited null record with Implicit_Dereference => Data; function Value (Object : Reference) return Accessor; type Warning_Handler is limited interface; procedure Wrong_Yaml_Version (Handler : in out Warning_Handler; Version : String) is abstract; procedure Unknown_Directive (Handler : in out Warning_Handler; Name, Params : String) is abstract; function New_Parser return Reference; -- instructs the parser to parse the input provided by the given Source. -- the parser takes ownership of the Source and will take care of -- deallocating it. procedure Set_Input (P : in out Instance; Input : Source.Pointer); -- instructs the parser to parse the input provided as String. procedure Set_Input (P : in out Instance; Input : String); -- register a handler whose subroutines are called when the corresponding -- warning condition is met. May be set to null in which case no handler -- is called (default behavior). procedure Set_Warning_Handler (P : in out Instance; Handler : access Warning_Handler'Class); -- retrieve the position where the lexer last tried to start reading a -- token. this function can be used when a Lexer_Error occurred. function Current_Lexer_Token_Start (P : Instance) return Mark; -- retrieve the position of the recently read character. this is useful -- when a Lexer_Error occurred. function Current_Input_Character (P : Instance) return Mark; -- retrieve the start position of the recently processed lexer token. -- useful when a Parser_Error occurred. function Recent_Lexer_Token_Start (P : Instance) return Mark; -- retrieve the end position of the recently processed lexer token. -- useful when a Parser_Error occurred. function Recent_Lexer_Token_End (P : Instance) return Mark; function Next (P : in out Instance) return Event; function Pool (P : Instance) return Text.Pool.Reference; private overriding procedure Finalize (P : in out Instance); type Reference is new Ada.Finalization.Controlled with record Data : not null access Instance; end record; overriding procedure Adjust (Object : in out Reference); overriding procedure Finalize (Object : in out Reference); type State_Type is access function (P : in out Class; E : out Event) return Boolean; subtype Indentation_Type is Integer range -2 .. Integer'Last; type Parsing_Level is record State : State_Type; Indentation : Indentation_Type; end record; package Level_Stacks is new Yaml.Stacks (Parsing_Level); package Tag_Handle_Sets is new Yaml.Text_Set (Text.Reference); type Instance is limited new Refcount_Base with record Pool : Text.Pool.Reference; L : Lexer.Instance; Levels : Level_Stacks.Stack; Current : Lexer.Token; Cached : Event; Tag_Handles : Tag_Handle_Sets.Reference; Header_Props, Inline_Props : Properties; Header_Start, Inline_Start : Mark; Block_Indentation : Indentation_Type; Handler : access Warning_Handler'Class; end record; type Instance_Pointer is access Instance; ----------------------------------------------------------------------------- -- parser states ----------------------------------------------------------------------------- -- starts the event stream by emitting a Stream_Start event function At_Stream_Start (P : in out Class; E : out Event) return Boolean; -- final landing state. this just emits Stream_End events forever without -- reading anything. function At_Stream_End (P : in out Class; E : out Event) return Boolean; -- state that expects a YAML document to start. reads directives. function Before_Doc (P : in out Class; E : out Event) return Boolean; -- there may only be node properties and block scalar starts behind a '---' function After_Directives_End (P : in out Class; E : out Event) return Boolean; -- state used when a document is started without explicit '---'. an explicit -- '---' is required for scalar documents. function Before_Implicit_Root (P : in out Class; E : out Event) return Boolean; -- used when node properties occur at root levels. those *must* belong to -- a scalar which is an implicit map key and starts an implicit block map. function Require_Implicit_Map_Start (P : in out Class; E : out Event) return Boolean; -- used for parsing properties of a node. function Before_Node_Properties (P : in out Class; E : out Event) return Boolean; -- state at the beginning of a block line. whether current implementation -- requires leaving block collections. function At_Block_Indentation (P : in out Class; E : out Event) return Boolean; function At_Block_Indentation_Props (P : in out Class; E : out Event) return Boolean; -- state inside a block line where a new node may start in compact notation, -- e.g. after a `-`, `?` or `:` after an explicit key. function After_Compact_Parent (P : in out Class; E : out Event) return Boolean; -- this either starts compact nodes or advances to the next line function After_Compact_Parent_Props (P : in out Class; E : out Event) return Boolean; -- similar to After_Compact_Parent, but disallows compact notation. This -- is used after a `:` of an implicit key. function After_Block_Parent (P : in out Class; E : out Event) return Boolean; -- this either starts compact nodes or advances to the next line function After_Block_Parent_Props (P : in out Class; E : out Event) return Boolean; -- used when there are node properties at the beginning of a line. in that -- case, the corresponding node must start at the same line. function Require_Inline_Block_Item (P : in out Class; E : out Event) return Boolean; -- in this state, the document's root node has been closed and the only -- valid lexer tokens are '...', '---' or the end of the stream. function Before_Doc_End (P : in out Class; E : out Event) return Boolean; -- this state expects the next block sequence entry starting with a `- `. function In_Block_Seq (P : in out Class; E : out Event) return Boolean; -- this state is used to emit the scalar which is the first implicit key of -- a block mapping. it is necessary because the previous state has emitted -- the mapping start event and cached the key scalar. function After_Implicit_Map_Start (P : in out Class; E : out Event) return Boolean; -- this state expects a `?` or an implicit mapping key function Before_Block_Map_Key (P : in out Class; E : out Event) return Boolean; -- this state is used when Before_Block_Mapping_Key encounters node -- properties. after those, an implicit scalar mapping key must follow. function At_Block_Map_Key_Props (P : in out Class; E : out Event) return Boolean; -- expects a `:` as mapping value indicator after an implicit key function After_Implicit_Key (P : in out Class; E : out Event) return Boolean; -- expects a `:` as mapping value indicator after an explicit key function Before_Block_Map_Value (P : in out Class; E : out Event) return Boolean; -- expects a newline after any node in a block context -- (not used after implicit block mapping keys) function Before_Block_Indentation (P : in out Class; E : out Event) return Boolean; -- expects any item valid in flow mode function Before_Flow_Item (P : in out Class; E : out Event) return Boolean; -- expects any item valid in flow mode after having read node properties. function Before_Flow_Item_Props (P : in out Class; E : out Event) return Boolean; -- expects either a `:` as mapping value indicator or `,` or `}` which both -- make the mapping value an implicit empty scalar. function After_Flow_Map_Key (P : in out Class; E : out Event) return Boolean; -- expects either a `,` or a `}`. function After_Flow_Map_Value (P : in out Class; E : out Event) return Boolean; -- expects either a `,` or a `]`. function After_Flow_Seq_Item (P : in out Class; E : out Event) return Boolean; -- expects either another key-value pair or `}` in which case the recently -- read comma is treated as trailing comma that does not start a new -- key-value pair. function After_Flow_Map_Sep (P : in out Class; E : out Event) return Boolean; -- expects either another node as part of the sequence or `]` in which case -- the recently read comma is treated as trailing comma that does not start -- a new sequence entry. function After_Flow_Seq_Sep (P : in out Class; E : out Event) return Boolean; -- the existence of node properties after a sequence separator (`,`) makes -- the comma non-trailing and forces the generation of another entry node, -- even if it is an implicit empty scalar. function After_Flow_Seq_Sep_Props (P : in out Class; E : out Event) return Boolean; -- used for emitting an empty scalar in the case that a pair with empty key -- is encountered. function At_Empty_Pair_Key (P : in out Class; E : out Event) return Boolean; -- expects the value of an implicit key-value pair inside a flow sequence. function Before_Pair_Value (P : in out Class; E : out Event) return Boolean; -- used for emitting the cached scalar key of in implicit key-value pair -- in a flow sequence. function After_Implicit_Pair_Start (P : in out Class; E : out Event) return Boolean; -- used for emitting the mapping end event after an implicit key-value pair -- in a flow sequence. function After_Pair_Value (P : in out Class; E : out Event) return Boolean; -- expects either another part of the parameter list or `)` in which case -- the recently read comma is treated as trailing comma that does not start -- a new parameter. function After_Param_Sep (P : in out Class; E : out Event) return Boolean; -- the existence of node properties after a sequence separator (`,`) makes -- the comma non-trailing and forces the generation of another param node, -- even if it is an implicit empty scalar. function After_Param_Sep_Props (P : in out Class; E : out Event) return Boolean; -- expects either a `,` or a `)` function After_Param (P : in out Class; E : out Event) return Boolean; -- end an annotation function After_Annotation (P : in out Class; E : out Event) return Boolean; end Yaml.Parser;
BrickBot/Bound-T-H8-300
Ada
5,333
ads
-- Analyser (decl) -- -- Master analysis algorithms, driving the analysis of control-flow, -- loop structure, data-flow and WCET. -- -- A component of the Bound-T Worst-Case Execution Time Tool. -- ------------------------------------------------------------------------------- -- Copyright (c) 1999 .. 2015 Tidorum Ltd -- All rights reserved. -- -- Redistribution and use in source and binary forms, with or without -- modification, are permitted provided that the following conditions are met: -- -- 1. Redistributions of source code must retain the above copyright notice, this -- list of conditions and the following disclaimer. -- 2. Redistributions in binary form must reproduce the above copyright notice, -- this list of conditions and the following disclaimer in the documentation -- and/or other materials provided with the distribution. -- -- This software is provided by the copyright holders and contributors "as is" and -- any express or implied warranties, including, but not limited to, the implied -- warranties of merchantability and fitness for a particular purpose are -- disclaimed. In no event shall the copyright owner or contributors be liable for -- any direct, indirect, incidental, special, exemplary, or consequential damages -- (including, but not limited to, procurement of substitute goods or services; -- loss of use, data, or profits; or business interruption) however caused and -- on any theory of liability, whether in contract, strict liability, or tort -- (including negligence or otherwise) arising in any way out of the use of this -- software, even if advised of the possibility of such damage. -- -- Other modules (files) of this software composition should contain their -- own copyright statements, which may have different copyright and usage -- conditions. The above conditions apply to this file. ------------------------------------------------------------------------------- -- -- $Revision: 1.8 $ -- $Date: 2015/10/24 19:36:46 $ -- -- $Log: analyser.ads,v $ -- Revision 1.8 2015/10/24 19:36:46 niklas -- Moved to free licence. -- -- Revision 1.7 2007-06-06 19:49:28 niklas -- Analyse traps Bounds.Recursion and calls Draw_Recursion_Graph. -- -- Revision 1.6 2004/05/01 11:17:50 niklas -- First Tidorum version. -- Renamed the procedure Estimate_WCET to Analyse, to give equal support -- to time and space analysis. Extended the implementation to obey options -- on analysis type. -- Added toleration of irreducible graphs and eternal loops. -- Changed handling of time assertions so that Trace_Flow creates and -- stores the asserted bounds and Trace_Flow_And_Calls stops tracing -- the (stub) subprogram (does not place it in the Traced set). -- Changed Trace_Flow to dump the flow-graph on exception only if the -- options Opt.Show_Flow_Steps and/or Opt.Show_Flow_Nodes are set. -- Added support for the new options Cease_Unless_Bounded, Tabulate_Time -- and Show_Space. -- -- Revision 1.5 2003/03/11 08:32:04 holsti -- Using execution-bounds types from Programs.Execution. -- -- Revision 1.4 2000/07/25 01:38:03 holsti -- Trace_Flow_And_Calls_And_Bound_Loops revised; uses Bounds. -- -- Revision 1.3 2000/07/13 11:26:33 saarinen -- Added creation of Call_Graph. -- -- Revision 1.2 2000/04/27 10:46:58 holsti -- First implementation. -- with Assertions; with Programs; with Programs.Execution; package Analyser is -- PROVIDED OPERATIONS: procedure Analyse ( Program : in out Programs.Program_T; Asserts : in out Assertions.Assertion_Set_T; Bounds_Set : out Programs.Execution.Bounds_Set_T); -- -- Analyses the given program, under the given assertions and -- options (not an explicit parameter), giving a set of execution -- bounds. -- -- Using : -- a target program, with a set of root-calls to be analysed, -- a set of assertions provided by the user, -- analysis options (as defined by the Options package and -- stored here and there). -- Giving: -- control-flow information (flow graphs, loops, call graphs), -- execution time bounds (if requested), -- memory usage bounds (if requested), -- diagnostic messages re the use made of the assertions, -- set of execution bounds for the root subprograms and their -- callees. -- -- The results include the flow-graphs of all subprograms (roots -- and their direct and indirect callees), with loop-structures -- identified, and a call graph. -- -- The quantitative analysis results are stored in the set of -- execution bounds. When the bounding of a subprogram needs -- actual parameter values or other calling context, the execution -- bounds for the caller contain (references to) the call-path- -- dependent execution bounds for the call. -- -- The mapping of the assertions to the program structures is -- also stored in the set of execution bounds. TBA. -- -- The assertion set is updated only to mark the way the -- assertions were used in the analysis, including whether -- the mapping of an assertion to the target program was -- ambiguous or void (impossible). -- -- If recursion is found in the call-graph of the roots, this is -- reported in error messages and the Bounds_Set will be incomplete. end Analyser;
wooky/aoc
Ada
725
ads
with Ada.Containers; use Ada.Containers; with AOC; use AOC; package AOC.Coordinates is pragma Preelaborate; type Coordinate is tagged record Row, Column : Integer := 0; end record; type Direct_Neighbors_Array is array(1 .. 4) of Coordinate; function Hash (C : Coordinate) return Hash_Type; procedure Translate (C : in out Coordinate ; Delta_Row, Delta_Column : Integer); function Translate (C : Coordinate ; Delta_Row, Delta_Column : Integer) return Coordinate; function Direct_Neighbors (C : Coordinate) return Direct_Neighbors_Array; function Distance (From, To : Coordinate) return Natural; function Find (Where : Rectangle ; What : Character) return Coordinate; private end AOC.Coordinates;
LiberatorUSA/GUCEF
Ada
10,271
adb
package body agar.gui.widget.button is package cbinds is function allocate (parent : widget_access_t; flags : flags_t := 0; label : cs.chars_ptr) return button_access_t; pragma import (c, allocate, "AG_ButtonNewS"); function allocate_function (parent : widget_access_t; flags : flags_t := 0; label : cs.chars_ptr; callback : agar.core.event.callback_t) return button_access_t; pragma import (c, allocate_function, "AG_ButtonNewFn"); function allocate_integer (parent : widget_access_t; flags : flags_t := 0; label : cs.chars_ptr; ptr : access c.int) return button_access_t; pragma import (c, allocate_integer, "agar_gui_widget_new_int"); function allocate_uint8 (parent : widget_access_t; flags : flags_t := 0; label : cs.chars_ptr; ptr : access agar.core.types.uint8_t) return button_access_t; pragma import (c, allocate_uint8, "agar_gui_widget_new_uint8"); function allocate_uint16 (parent : widget_access_t; flags : flags_t := 0; label : cs.chars_ptr; ptr : access agar.core.types.uint16_t) return button_access_t; pragma import (c, allocate_uint16, "agar_gui_widget_new_uint16"); function allocate_uint32 (parent : widget_access_t; flags : flags_t := 0; label : cs.chars_ptr; ptr : access agar.core.types.uint32_t) return button_access_t; pragma import (c, allocate_uint32, "agar_gui_widget_new_uint32"); function allocate_flag (parent : widget_access_t; flags : flags_t := 0; label : cs.chars_ptr; ptr : access c.int; mask : c.unsigned) return button_access_t; pragma import (c, allocate_flag, "AG_ButtonNewFlag"); function allocate_flag8 (parent : widget_access_t; flags : flags_t := 0; label : cs.chars_ptr; ptr : access agar.core.types.uint8_t; mask : agar.core.types.uint8_t) return button_access_t; pragma import (c, allocate_flag8, "AG_ButtonNewFlag8"); function allocate_flag16 (parent : widget_access_t; flags : flags_t := 0; label : cs.chars_ptr; ptr : access agar.core.types.uint16_t; mask : agar.core.types.uint16_t) return button_access_t; pragma import (c, allocate_flag16, "AG_ButtonNewFlag16"); function allocate_flag32 (parent : widget_access_t; flags : flags_t := 0; label : cs.chars_ptr; ptr : access agar.core.types.uint32_t; mask : agar.core.types.uint32_t) return button_access_t; pragma import (c, allocate_flag32, "AG_ButtonNewFlag32"); procedure set_padding (button : button_access_t; left_pad : c.int; right_pad : c.int; top_pad : c.int; bottom_pad : c.int); pragma import (c, set_padding, "AG_ButtonSetPadding"); procedure set_focusable (button : button_access_t; flag : c.int); pragma import (c, set_focusable, "AG_ButtonSetFocusable"); procedure set_sticky (button : button_access_t; flag : c.int); pragma import (c, set_sticky, "AG_ButtonSetSticky"); procedure set_repeat_mode (button : button_access_t; flag : c.int); pragma import (c, set_repeat_mode, "AG_ButtonSetRepeatMode"); procedure invert_state (button : button_access_t; flag : c.int); pragma import (c, invert_state, "AG_ButtonInvertState"); procedure text (button : button_access_t; text : cs.chars_ptr); pragma import (c, text, "AG_ButtonTextS"); end cbinds; -- function allocate (parent : widget_access_t; flags : flags_t := 0; label : string) return button_access_t is c_label : aliased c.char_array := c.to_c (label); begin return cbinds.allocate (parent => parent, flags => flags, label => cs.to_chars_ptr (c_label'unchecked_access)); end allocate; function allocate_function (parent : widget_access_t; flags : flags_t := 0; label : string; callback : agar.core.event.callback_t) return button_access_t is c_label : aliased c.char_array := c.to_c (label); begin return cbinds.allocate_function (parent => parent, callback => callback, flags => flags, label => cs.to_chars_ptr (c_label'unchecked_access)); end allocate_function; function allocate_integer (parent : widget_access_t; flags : flags_t := 0; label : string; ptr : access integer) return button_access_t is c_label : aliased c.char_array := c.to_c (label); c_int : aliased c.int; c_button : button_access_t; begin c_button := cbinds.allocate_integer (parent => parent, flags => flags, label => cs.to_chars_ptr (c_label'unchecked_access), ptr => c_int'unchecked_access); if c_button /= null then ptr.all := integer (c_int); end if; return c_button; end allocate_integer; function allocate_uint8 (parent : widget_access_t; flags : flags_t := 0; label : string; ptr : access agar.core.types.uint8_t) return button_access_t is c_label : aliased c.char_array := c.to_c (label); begin return cbinds.allocate_uint8 (parent => parent, flags => flags, label => cs.to_chars_ptr (c_label'unchecked_access), ptr => ptr); end allocate_uint8; function allocate_uint16 (parent : widget_access_t; flags : flags_t := 0; label : string; ptr : access agar.core.types.uint16_t) return button_access_t is c_label : aliased c.char_array := c.to_c (label); begin return cbinds.allocate_uint16 (parent => parent, flags => flags, label => cs.to_chars_ptr (c_label'unchecked_access), ptr => ptr); end allocate_uint16; function allocate_uint32 (parent : widget_access_t; flags : flags_t := 0; label : string; ptr : access agar.core.types.uint32_t) return button_access_t is c_label : aliased c.char_array := c.to_c (label); begin return cbinds.allocate_uint32 (parent => parent, flags => flags, label => cs.to_chars_ptr (c_label'unchecked_access), ptr => ptr); end allocate_uint32; function allocate_flag (parent : widget_access_t; flags : flags_t := 0; label : string; ptr : access integer; mask : integer) return button_access_t is c_label : aliased c.char_array := c.to_c (label); c_int : aliased c.int; c_button : aliased button_access_t; begin c_button := cbinds.allocate_flag (parent => parent, flags => flags, label => cs.to_chars_ptr (c_label'unchecked_access), ptr => c_int'unchecked_access, mask => c.unsigned (mask)); if c_button /= null then ptr.all := integer (c_int); end if; return c_button; end allocate_flag; function allocate_flag8 (parent : widget_access_t; flags : flags_t := 0; label : string; ptr : access agar.core.types.uint8_t; mask : agar.core.types.uint8_t) return button_access_t is c_label : aliased c.char_array := c.to_c (label); begin return cbinds.allocate_flag8 (parent => parent, flags => flags, label => cs.to_chars_ptr (c_label'unchecked_access), ptr => ptr, mask => mask); end allocate_flag8; function allocate_flag16 (parent : widget_access_t; flags : flags_t := 0; label : string; ptr : access agar.core.types.uint16_t; mask : agar.core.types.uint16_t) return button_access_t is c_label : aliased c.char_array := c.to_c (label); begin return cbinds.allocate_flag16 (parent => parent, flags => flags, label => cs.to_chars_ptr (c_label'unchecked_access), ptr => ptr, mask => mask); end allocate_flag16; function allocate_flag32 (parent : widget_access_t; flags : flags_t := 0; label : string; ptr : access agar.core.types.uint32_t; mask : agar.core.types.uint32_t) return button_access_t is c_label : aliased c.char_array := c.to_c (label); begin return cbinds.allocate_flag32 (parent => parent, flags => flags, label => cs.to_chars_ptr (c_label'unchecked_access), ptr => ptr, mask => mask); end allocate_flag32; procedure set_padding (button : button_access_t; left_pad : natural; right_pad : natural; top_pad : natural; bottom_pad : natural) is begin cbinds.set_padding (button => button, left_pad => c.int (left_pad), right_pad => c.int (right_pad), top_pad => c.int (top_pad), bottom_pad => c.int (bottom_pad)); end set_padding; procedure set_focusable (button : button_access_t; flag : boolean) is begin if flag then cbinds.set_focusable (button, 1); else cbinds.set_focusable (button, 0); end if; end set_focusable; procedure set_sticky (button : button_access_t; flag : boolean) is begin if flag then cbinds.set_sticky (button, 1); else cbinds.set_sticky (button, 0); end if; end set_sticky; procedure invert_state (button : button_access_t; flag : boolean) is begin if flag then cbinds.invert_state (button, 1); else cbinds.invert_state (button, 0); end if; end invert_state; procedure set_repeat_mode (button : button_access_t; flag : boolean) is begin if flag then cbinds.set_repeat_mode (button, 1); else cbinds.set_repeat_mode (button, 0); end if; end set_repeat_mode; procedure text (button : button_access_t; text : string) is ca_text : aliased c.char_array := c.to_c (text); begin cbinds.text (button => button, text => cs.to_chars_ptr (ca_text'unchecked_access)); end text; function widget (button : button_access_t) return widget_access_t is begin return button.widget'access; end widget; end agar.gui.widget.button;
AdaCore/Ada_Drivers_Library
Ada
3,754
adb
------------------------------------------------------------------------------ -- -- -- Copyright (C) 2015, 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_SVD.RCC; use STM32_SVD.RCC; with STM32_SVD.IWDG; use STM32_SVD.IWDG; package body STM32.IWDG is -- commands to the watchdog hardware Reload_Counter : constant UInt16 := 16#AAAA#; Enable_Access : constant UInt16 := 16#5555#; Start : constant UInt16 := 16#CCCC#; ------------------------- -- Initialize_Watchdog -- ------------------------- procedure Initialize_Watchdog (Prescaler : Prescalers; Count : Countdown_Value) is begin -- Check if we're resuming from a watchdog reset if RCC_Periph.CSR.WDGRSTF then -- Clear the reset flag RCC_Periph.CSR.RMVF := True; end if; IWDG_Periph.KR.KEY := Enable_Access; IWDG_Periph.PR.PR := Prescalers'Enum_Rep (Prescaler); IWDG_Periph.RLR.RL := Count; end Initialize_Watchdog; -------------------- -- Start_Watchdog -- -------------------- procedure Start_Watchdog is begin IWDG_Periph.KR.KEY := Reload_Counter; IWDG_Periph.KR.KEY := Start; end Start_Watchdog; -------------------- -- Reset_Watchdog -- -------------------- procedure Reset_Watchdog is begin while IWDG_Periph.SR.RVU loop null; -- TODO: use a timeout instead of infinitely looping end loop; IWDG_Periph.KR.KEY := Reload_Counter; end Reset_Watchdog; end STM32.IWDG;
reznikmm/matreshka
Ada
4,567
adb
------------------------------------------------------------------------------ -- -- -- Matreshka Project -- -- -- -- Open Document Toolkit -- -- -- -- Runtime Library Component -- -- -- ------------------------------------------------------------------------------ -- -- -- Copyright © 2014, Vadim Godunko <[email protected]> -- -- All rights reserved. -- -- -- -- Redistribution and use in source and binary forms, with or without -- -- modification, are permitted provided that the following conditions -- -- are met: -- -- -- -- * Redistributions of source code must retain the above copyright -- -- notice, this list of conditions and the following disclaimer. -- -- -- -- * Redistributions in binary form must reproduce the above copyright -- -- notice, this list of conditions and the following disclaimer in the -- -- documentation and/or other materials provided with the distribution. -- -- -- -- * Neither the name of the Vadim Godunko, IE nor the names of its -- -- contributors may be used to endorse or promote products derived from -- -- this software without specific prior written permission. -- -- -- -- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -- -- "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -- -- LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -- -- A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -- -- HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -- -- SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED -- -- TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -- -- PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -- -- LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -- -- NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -- -- SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -- -- -- ------------------------------------------------------------------------------ -- $Revision$ $Date$ ------------------------------------------------------------------------------ with Matreshka.DOM_Documents; with Matreshka.ODF_String_Constants; with ODF.DOM.Iterators; with ODF.DOM.Visitors; package body Matreshka.ODF_Form.State_Attributes is ------------ -- Create -- ------------ overriding function Create (Parameters : not null access Matreshka.DOM_Attributes.Attribute_L2_Parameters) return Form_State_Attribute_Node is begin return Self : Form_State_Attribute_Node do Matreshka.ODF_Form.Constructors.Initialize (Self'Unchecked_Access, Parameters.Document, Matreshka.ODF_String_Constants.Form_Prefix); end return; end Create; -------------------- -- Get_Local_Name -- -------------------- overriding function Get_Local_Name (Self : not null access constant Form_State_Attribute_Node) return League.Strings.Universal_String is pragma Unreferenced (Self); begin return Matreshka.ODF_String_Constants.State_Attribute; end Get_Local_Name; begin Matreshka.DOM_Documents.Register_Attribute (Matreshka.ODF_String_Constants.Form_URI, Matreshka.ODF_String_Constants.State_Attribute, Form_State_Attribute_Node'Tag); end Matreshka.ODF_Form.State_Attributes;
byllgrim/iictl
Ada
113
ads
package Srv_Quit is procedure Detect_Quits (Irc_Dir : in String); -- TODO rename Handle_Quits? end Srv_Quit;
stcarrez/mat
Ada
3,650
ads
----------------------------------------------------------------------- -- Memory - Memory slot -- Copyright (C) 2014, 2015, 2019, 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.Containers.Ordered_Maps; with Ada.Strings.Unbounded; with ELF; with MAT.Types; with MAT.Frames; with MAT.Events; package MAT.Memory is type Allocation is record Size : MAT.Types.Target_Size; Frame : Frames.Frame_Type; Time : MAT.Types.Target_Tick_Ref; Thread : MAT.Types.Target_Thread_Ref; Event : MAT.Events.Event_Id_Type; end record; -- Statistics about memory allocation. type Memory_Info is record Total_Size : MAT.Types.Target_Size := 0; Alloc_Count : Natural := 0; Min_Slot_Size : MAT.Types.Target_Size := 0; Max_Slot_Size : MAT.Types.Target_Size := 0; Min_Addr : MAT.Types.Target_Addr := 0; Max_Addr : MAT.Types.Target_Addr := 0; end record; -- Description of a memory region. type Region_Info is record Start_Addr : MAT.Types.Target_Addr := 0; End_Addr : MAT.Types.Target_Addr := 0; Offset : MAT.Types.Target_Addr := 0; Size : MAT.Types.Target_Size := 0; Flags : ELF.Elf32_Word := 0; Path : Ada.Strings.Unbounded.Unbounded_String; end record; use type MAT.Types.Target_Addr; package Allocation_Maps is new Ada.Containers.Ordered_Maps (Key_Type => MAT.Types.Target_Addr, Element_Type => Allocation); subtype Allocation_Map is Allocation_Maps.Map; subtype Allocation_Cursor is Allocation_Maps.Cursor; -- Define a map of <tt>Memory_Info</tt> keyed by the thread Id. -- Such map allows to give the list of threads and a summary of their allocation. use type MAT.Types.Target_Thread_Ref; package Memory_Info_Maps is new Ada.Containers.Ordered_Maps (Key_Type => MAT.Types.Target_Thread_Ref, Element_Type => Memory_Info); subtype Memory_Info_Map is Memory_Info_Maps.Map; subtype Memory_Info_Cursor is Memory_Info_Maps.Cursor; type Frame_Info is record Thread : MAT.Types.Target_Thread_Ref; Memory : Memory_Info; end record; -- Define a map of <tt>Frame_Info</tt> keyed by the backtrace function address -- that performed the memory allocation directly or indirectly. package Frame_Info_Maps is new Ada.Containers.Ordered_Maps (Key_Type => MAT.Types.Target_Addr, Element_Type => Frame_Info); subtype Frame_Info_Map is Frame_Info_Maps.Map; subtype Frame_Info_Cursor is Frame_Info_Maps.Cursor; package Region_Info_Maps is new Ada.Containers.Ordered_Maps (Key_Type => MAT.Types.Target_Addr, Element_Type => Region_Info); subtype Region_Info_Map is Region_Info_Maps.Map; subtype Region_Info_Cursor is Region_Info_Maps.Cursor; end MAT.Memory;
reznikmm/matreshka
Ada
7,812
ads
------------------------------------------------------------------------------ -- -- -- Matreshka Project -- -- -- -- Web Framework -- -- -- -- Runtime Library Component -- -- -- ------------------------------------------------------------------------------ -- -- -- Copyright © 2014-2015, Vadim Godunko <[email protected]> -- -- All rights reserved. -- -- -- -- Redistribution and use in source and binary forms, with or without -- -- modification, are permitted provided that the following conditions -- -- are met: -- -- -- -- * Redistributions of source code must retain the above copyright -- -- notice, this list of conditions and the following disclaimer. -- -- -- -- * Redistributions in binary form must reproduce the above copyright -- -- notice, this list of conditions and the following disclaimer in the -- -- documentation and/or other materials provided with the distribution. -- -- -- -- * Neither the name of the Vadim Godunko, IE nor the names of its -- -- contributors may be used to endorse or promote products derived from -- -- this software without specific prior written permission. -- -- -- -- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -- -- "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -- -- LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -- -- A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -- -- HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -- -- SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED -- -- TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -- -- PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -- -- LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -- -- NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -- -- SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -- -- -- ------------------------------------------------------------------------------ -- $Revision$ $Date$ ------------------------------------------------------------------------------ with Ada.Containers.Hashed_Maps; with League.String_Vectors; with League.Strings.Hash; with Matreshka.Servlet_HTTP_Requests; with Matreshka.Servlet_Registrations; package Matreshka.Servlet_Dispatchers is type Abstract_Dispatcher is limited interface; type Dispatcher_Access is access all Abstract_Dispatcher'Class; not overriding procedure Dispatch (Self : not null access constant Abstract_Dispatcher; Request : in out Matreshka.Servlet_HTTP_Requests.Abstract_HTTP_Servlet_Request'Class; Path : League.String_Vectors.Universal_String_Vector; Index : Positive; Servlet : in out Matreshka.Servlet_Registrations.Servlet_Registration_Access) is abstract; -- Dispatches request. Path is full path and Index is segment of path that -- must be dispatched by the current dispatcher. Servlet parameter is set -- to servlet registration to process request. Request parameter is -- modified by setting of indices of context/servlet/path segments. type Context_Dispatcher is limited new Abstract_Dispatcher with private; procedure Add_Mapping (Self : not null access Context_Dispatcher'Class; Servlet : not null Matreshka.Servlet_Registrations.Servlet_Registration_Access; URL_Pattern : League.Strings.Universal_String; Success : out Boolean); -- Adds mapping by parsing given URL_Pattern. Sets Success to True when -- mapping is added successfully. Sets Success to False when mapping is -- exists. private package Dispatcher_Maps is new Ada.Containers.Hashed_Maps (League.Strings.Universal_String, Dispatcher_Access, League.Strings.Hash, League.Strings."="); ------------------------ -- Segment_Dispatcher -- ------------------------ -- Segment dispatcher dispatches request to one of children segments of -- path. type Segment_Dispatcher is limited new Abstract_Dispatcher with record Children : Dispatcher_Maps.Map; end record; overriding procedure Dispatch (Self : not null access constant Segment_Dispatcher; Request : in out Matreshka.Servlet_HTTP_Requests.Abstract_HTTP_Servlet_Request'Class; Path : League.String_Vectors.Universal_String_Vector; Index : Positive; Servlet : in out Matreshka.Servlet_Registrations.Servlet_Registration_Access); ------------------------ -- Servlet_Dispatcher -- ------------------------ -- Servlet dispatcher dispatches request to servlet checking for exact and -- longest path-prefix mappings. type Servlet_Dispatcher is new Segment_Dispatcher with record Exact_Servlet : Matreshka.Servlet_Registrations.Servlet_Registration_Access; Mapping_Servlet : Matreshka.Servlet_Registrations.Servlet_Registration_Access; end record; overriding procedure Dispatch (Self : not null access constant Servlet_Dispatcher; Request : in out Matreshka.Servlet_HTTP_Requests.Abstract_HTTP_Servlet_Request'Class; Path : League.String_Vectors.Universal_String_Vector; Index : Positive; Servlet : in out Matreshka.Servlet_Registrations.Servlet_Registration_Access); ------------------------ -- Context_Dispatcher -- ------------------------ package Extension_Maps is new Ada.Containers.Hashed_Maps (League.Strings.Universal_String, Matreshka.Servlet_Registrations.Servlet_Registration_Access, League.Strings.Hash, League.Strings."=", Matreshka.Servlet_Registrations."="); type Context_Dispatcher is limited new Segment_Dispatcher with record Root_Servlet : Matreshka.Servlet_Registrations.Servlet_Registration_Access; Default_Servlet : Matreshka.Servlet_Registrations.Servlet_Registration_Access; Extension_Servlets : Extension_Maps.Map; end record; overriding procedure Dispatch (Self : not null access constant Context_Dispatcher; Request : in out Matreshka.Servlet_HTTP_Requests.Abstract_HTTP_Servlet_Request'Class; Path : League.String_Vectors.Universal_String_Vector; Index : Positive; Servlet : in out Matreshka.Servlet_Registrations.Servlet_Registration_Access); end Matreshka.Servlet_Dispatchers;
sungyeon/drake
Ada
18,566
ads
pragma License (Unrestricted); with Ada.Strings.Bounded_Strings.Functions.Maps; with Ada.Strings.Maps; package Ada.Strings.Bounded is pragma Preelaborate; generic Max : Positive; -- Maximum length of a Bounded_String package Generic_Bounded_Length is -- for renaming package Bounded_Strings is new Strings.Bounded_Strings.Generic_Bounded_Length (Max); package Functions is new Strings.Bounded_Strings.Functions.Generic_Bounded_Length ( Bounded_Strings); package Maps is new Strings.Bounded_Strings.Functions.Maps.Generic_Bounded_Length ( Bounded_Strings); -- Max_Length : constant Positive := Max; Max_Length : Positive renames Bounded_Strings.Max_Length; -- type Bounded_String is private; subtype Bounded_String is Bounded_Strings.Bounded_String; -- modified -- Null_Bounded_String : constant Bounded_String; function Null_Bounded_String return Bounded_String renames Bounded_Strings.Null_Bounded_String; -- subtype Length_Range is Natural range 0 .. Max_Length; subtype Length_Range is Bounded_Strings.Length_Range; function Length (Source : Bounded_String) return Length_Range renames Bounded_Strings.Length; -- Conversion, Concatenation, and Selection functions function To_Bounded_String (Source : String; Drop : Truncation := Error) return Bounded_String renames Bounded_Strings.To_Bounded_String; function To_String (Source : Bounded_String) return String renames Bounded_Strings.To_String; procedure Set_Bounded_String ( Target : out Bounded_String; Source : String; Drop : Truncation := Error) renames Bounded_Strings.Set_Bounded_String; function Append ( Left, Right : Bounded_String; Drop : Truncation := Error) return Bounded_String renames Bounded_Strings.Append; function Append ( Left : Bounded_String; Right : String; Drop : Truncation := Error) return Bounded_String renames Bounded_Strings.Append; function Append ( Left : String; Right : Bounded_String; Drop : Truncation := Error) return Bounded_String renames Bounded_Strings.Append; function Append ( Left : Bounded_String; Right : Character; Drop : Truncation := Error) return Bounded_String renames Bounded_Strings.Append_Element; function Append ( Left : Character; Right : Bounded_String; Drop : Truncation := Error) return Bounded_String renames Bounded_Strings.Append_Element; procedure Append ( Source : in out Bounded_String; New_Item : Bounded_String; Drop : Truncation := Error) renames Bounded_Strings.Append; procedure Append ( Source : in out Bounded_String; New_Item : String; Drop : Truncation := Error) renames Bounded_Strings.Append; procedure Append ( Source : in out Bounded_String; New_Item : Character; Drop : Truncation := Error) renames Bounded_Strings.Append_Element; function "&" (Left, Right : Bounded_String) return Bounded_String renames Bounded_Strings."&"; function "&" (Left : Bounded_String; Right : String) return Bounded_String renames Bounded_Strings."&"; function "&" (Left : String; Right : Bounded_String) return Bounded_String renames Bounded_Strings."&"; function "&" (Left : Bounded_String; Right : Character) return Bounded_String renames Bounded_Strings."&"; function "&" (Left : Character; Right : Bounded_String) return Bounded_String renames Bounded_Strings."&"; function Element ( Source : Bounded_String; Index : Positive) return Character renames Bounded_Strings.Element; procedure Replace_Element ( Source : in out Bounded_String; Index : Positive; By : Character) renames Bounded_Strings.Replace_Element; function Slice ( Source : Bounded_String; Low : Positive; High : Natural) return String renames Bounded_Strings.Slice; function Bounded_Slice ( Source : Bounded_String; Low : Positive; High : Natural) return Bounded_String renames Bounded_Strings.Bounded_Slice; procedure Bounded_Slice ( Source : Bounded_String; Target : out Bounded_String; Low : Positive; High : Natural) renames Bounded_Strings.Bounded_Slice; function "=" (Left, Right : Bounded_String) return Boolean renames Bounded_Strings."="; -- In CXA4028, "=" is conflicted with itself by "use" and "use type", -- but CXA5011 requires that "=" should be primitive. function "=" (Left : Bounded_String; Right : String) return Boolean renames Bounded_Strings."="; function "=" (Left : String; Right : Bounded_String) return Boolean renames Bounded_Strings."="; function "<" (Left, Right : Bounded_String) return Boolean renames Bounded_Strings."<"; function "<" (Left : Bounded_String; Right : String) return Boolean renames Bounded_Strings."<"; function "<" (Left : String; Right : Bounded_String) return Boolean renames Bounded_Strings."<"; function "<=" (Left, Right : Bounded_String) return Boolean renames Bounded_Strings."<="; function "<=" (Left : Bounded_String; Right : String) return Boolean renames Bounded_Strings."<="; function "<=" (Left : String; Right : Bounded_String) return Boolean renames Bounded_Strings."<="; function ">" (Left, Right : Bounded_String) return Boolean renames Bounded_Strings.">"; function ">" (Left : Bounded_String; Right : String) return Boolean renames Bounded_Strings.">"; function ">" (Left : String; Right : Bounded_String) return Boolean renames Bounded_Strings.">"; function ">=" (Left, Right : Bounded_String) return Boolean renames Bounded_Strings.">="; function ">=" (Left : Bounded_String; Right : String) return Boolean renames Bounded_Strings.">="; function ">=" (Left : String; Right : Bounded_String) return Boolean renames Bounded_Strings.">="; -- Search subprograms -- modified -- function Index ( -- Source : Bounded_String; -- Pattern : String; -- From : Positive; -- Going : Direction := Forward; -- Mapping : Maps.Character_Mapping := Maps.Identity) -- return Natural; function Index ( Source : Bounded_String; Pattern : String; From : Positive; Going : Direction := Forward) return Natural renames Functions.Index; function Index ( Source : Bounded_String; Pattern : String; From : Positive; Going : Direction := Forward; Mapping : Strings.Maps.Character_Mapping) return Natural renames Maps.Index; -- modified -- function Index ( -- Source : Bounded_String; -- Pattern : String; -- From : Positive; -- Going : Direction := Forward; -- Mapping : Maps.Character_Mapping_Function) -- return Natural; function Index ( Source : Bounded_String; Pattern : String; From : Positive; Going : Direction := Forward; Mapping : not null access function (From : Character) return Character) return Natural renames Maps.Index_Element; function Index ( Source : Bounded_String; Pattern : String; From : Positive; Going : Direction := Forward; Mapping : not null access function (From : Wide_Wide_Character) return Wide_Wide_Character) return Natural renames Maps.Index; -- modified -- function Index ( -- Source : Bounded_String; -- Pattern : String; -- Going : Direction := Forward; -- Mapping : Maps.Character_Mapping := Maps.Identity) -- return Natural; function Index ( Source : Bounded_String; Pattern : String; Going : Direction := Forward) return Natural renames Functions.Index; function Index ( Source : Bounded_String; Pattern : String; Going : Direction := Forward; Mapping : Strings.Maps.Character_Mapping) return Natural renames Maps.Index; -- modified -- function Index ( -- Source : Bounded_String; -- Pattern : String; -- Going : Direction := Forward; -- Mapping : Maps.Character_Mapping_Function) -- return Natural; function Index ( Source : Bounded_String; Pattern : String; Going : Direction := Forward; Mapping : not null access function (From : Character) return Character) return Natural renames Maps.Index_Element; function Index ( Source : Bounded_String; Pattern : String; Going : Direction := Forward; Mapping : not null access function (From : Wide_Wide_Character) return Wide_Wide_Character) return Natural renames Maps.Index; function Index ( Source : Bounded_String; Set : Strings.Maps.Character_Set; From : Positive; Test : Membership := Inside; Going : Direction := Forward) return Natural renames Maps.Index; function Index ( Source : Bounded_String; Set : Strings.Maps.Character_Set; Test : Membership := Inside; Going : Direction := Forward) return Natural renames Maps.Index; function Index_Non_Blank ( Source : Bounded_String; From : Positive; Going : Direction := Forward) return Natural renames Functions.Index_Non_Blank; function Index_Non_Blank ( Source : Bounded_String; Going : Direction := Forward) return Natural renames Functions.Index_Non_Blank; -- modified -- function Count ( -- Source : Bounded_String; -- Pattern : String; -- Mapping : Maps.Character_Mapping := Maps.Identity) -- return Natural; function Count ( Source : Bounded_String; Pattern : String) return Natural renames Functions.Count; function Count ( Source : Bounded_String; Pattern : String; Mapping : Strings.Maps.Character_Mapping) return Natural renames Maps.Count; -- modified -- function Count ( -- Source : Bounded_String; -- Pattern : String; -- Mapping : Maps.Character_Mapping_Function) -- return Natural; function Count ( Source : Bounded_String; Pattern : String; Mapping : not null access function (From : Character) return Character) return Natural renames Maps.Count_Element; function Count ( Source : Bounded_String; Pattern : String; Mapping : not null access function (From : Wide_Wide_Character) return Wide_Wide_Character) return Natural renames Maps.Count; function Count ( Source : Bounded_String; Set : Strings.Maps.Character_Set) return Natural renames Maps.Count; procedure Find_Token ( Source : Bounded_String; Set : Strings.Maps.Character_Set; From : Positive; Test : Membership; First : out Positive; Last : out Natural) renames Maps.Find_Token; procedure Find_Token ( Source : Bounded_String; Set : Strings.Maps.Character_Set; Test : Membership; First : out Positive; Last : out Natural) renames Maps.Find_Token; -- String translation subprograms -- modified function Translate ( Source : Bounded_String; Mapping : Strings.Maps.Character_Mapping; Drop : Truncation := Error) -- additional return Bounded_String renames Maps.Translate; -- modified procedure Translate ( Source : in out Bounded_String; Mapping : Strings.Maps.Character_Mapping; Drop : Truncation := Error) -- additional renames Maps.Translate; -- modified -- function Translate ( -- Source : Bounded_String; -- Mapping : Maps.Character_Mapping_Function) -- return Bounded_String; function Translate ( Source : Bounded_String; Mapping : not null access function (From : Character) return Character) return Bounded_String renames Maps.Translate_Element; function Translate ( Source : Bounded_String; Mapping : not null access function (From : Wide_Wide_Character) return Wide_Wide_Character; Drop : Truncation := Error) return Bounded_String renames Maps.Translate; -- modified -- procedure Translate ( -- Source : in out Bounded_String; -- Mapping : Maps.Character_Mapping_Function); procedure Translate ( Source : in out Bounded_String; Mapping : not null access function (From : Character) return Character) renames Maps.Translate_Element; procedure Translate ( Source : in out Bounded_String; Mapping : not null access function (From : Wide_Wide_Character) return Wide_Wide_Character; Drop : Truncation := Error) renames Maps.Translate; -- String transformation subprograms function Replace_Slice ( Source : Bounded_String; Low : Positive; High : Natural; By : String; Drop : Truncation := Error) return Bounded_String renames Functions.Replace_Slice; procedure Replace_Slice ( Source : in out Bounded_String; Low : Positive; High : Natural; By : String; Drop : Truncation := Error) renames Functions.Replace_Slice; function Insert ( Source : Bounded_String; Before : Positive; New_Item : String; Drop : Truncation := Error) return Bounded_String renames Functions.Insert; procedure Insert ( Source : in out Bounded_String; Before : Positive; New_Item : String; Drop : Truncation := Error) renames Functions.Insert; function Overwrite ( Source : Bounded_String; Position : Positive; New_Item : String; Drop : Truncation := Error) return Bounded_String renames Functions.Overwrite; procedure Overwrite ( Source : in out Bounded_String; Position : Positive; New_Item : String; Drop : Truncation := Error) renames Functions.Overwrite; function Delete ( Source : Bounded_String; From : Positive; Through : Natural) return Bounded_String renames Functions.Delete; procedure Delete ( Source : in out Bounded_String; From : Positive; Through : Natural) renames Functions.Delete; -- String selector subprograms -- modified function Trim ( Source : Bounded_String; Side : Trim_End; Blank : Character := Space) -- additional return Bounded_String renames Functions.Trim; procedure Trim ( Source : in out Bounded_String; Side : Trim_End; Blank : Character := Space) -- additional renames Functions.Trim; function Trim ( Source : Bounded_String; Left : Strings.Maps.Character_Set; Right : Strings.Maps.Character_Set) return Bounded_String renames Maps.Trim; procedure Trim ( Source : in out Bounded_String; Left : Strings.Maps.Character_Set; Right : Strings.Maps.Character_Set) renames Maps.Trim; function Head ( Source : Bounded_String; Count : Natural; Pad : Character := Space; Drop : Truncation := Error) return Bounded_String renames Functions.Head; procedure Head ( Source : in out Bounded_String; Count : Natural; Pad : Character := Space; Drop : Truncation := Error) renames Functions.Head; function Tail ( Source : Bounded_String; Count : Natural; Pad : Character := Space; Drop : Truncation := Error) return Bounded_String renames Functions.Tail; procedure Tail ( Source : in out Bounded_String; Count : Natural; Pad : Character := Space; Drop : Truncation := Error) renames Functions.Tail; -- String constructor subprograms function "*" (Left : Natural; Right : Character) return Bounded_String renames Bounded_Strings."*"; function "*" (Left : Natural; Right : String) return Bounded_String renames Bounded_Strings."*"; function "*" (Left : Natural; Right : Bounded_String) return Bounded_String renames Bounded_Strings."*"; function Replicate ( Count : Natural; Item : Character; Drop : Truncation := Error) return Bounded_String renames Bounded_Strings.Replicate_Element; function Replicate ( Count : Natural; Item : String; Drop : Truncation := Error) return Bounded_String renames Bounded_Strings.Replicate; function Replicate ( Count : Natural; Item : Bounded_String; Drop : Truncation := Error) return Bounded_String renames Bounded_Strings.Replicate; end Generic_Bounded_Length; end Ada.Strings.Bounded;
godunko/cga
Ada
817
ads
-- -- Copyright (C) 2023, Vadim Godunko <[email protected]> -- -- SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -- -- Containers of Point_2D objects. with CGK.Internals.Generic_Sequences; package CGK.Primitives.Points_2D.Containers is pragma Preelaborate; type Point_2D_Array_Offset is new Integer; subtype Point_2D_Array_Count is Point_2D_Array_Offset range 0 .. Point_2D_Array_Offset'Last; subtype Point_2D_Array_Index is Point_2D_Array_Offset range 1 .. Point_2D_Array_Offset'Last; type Point_2D_Array is array (Point_2D_Array_Index range <>) of Point_2D; package Point_2D_Sequences is new CGK.Internals.Generic_Sequences (Point_2D_Array_Index, Point_2D); subtype Point_2D_Sequence is Point_2D_Sequences.Sequence; end CGK.Primitives.Points_2D.Containers;
AdaCore/langkit
Ada
7,017
adb
-- -- Copyright (C) 2014-2022, AdaCore -- SPDX-License-Identifier: Apache-2.0 -- with GNATCOLL.Strings; use GNATCOLL.Strings; package body Langkit_Support.Adalog.Solver_Interface is ---------------------------------- -- Stateless functors wrappers -- ---------------------------------- -- Those types are wrappers used to provide the helper constructors that -- allow users of the solver to pass function converters/predicates rather -- than functor objects, that are more cumbersome to define. type Predicate_Fn is access function (V : Value_Type) return Boolean; type Converter_Fn is access function (V : Value_Type) return Value_Type; type N_Predicate_Fn is access function (Vs : Value_Array) return Boolean; type Combiner_Fn is access function (Vs : Value_Array) return Value_Type; type Predicate_Fn_Wrapper is new Predicate_Type with record Callback : Predicate_Fn; Name : XString; end record; overriding function Call (Self : Predicate_Fn_Wrapper; Val : Value_Type) return Boolean is (Self.Callback (Val)); overriding function Image (Self : Predicate_Fn_Wrapper) return String is (Self.Name.To_String); type N_Predicate_Fn_Wrapper is new N_Predicate_Type with record Callback : N_Predicate_Fn; Name : XString; end record; overriding function Call (Self : N_Predicate_Fn_Wrapper; Vs : Value_Array) return Boolean is (Self.Callback (Vs)); overriding function Image (Self : N_Predicate_Fn_Wrapper) return String is (Self.Name.To_String); type Converter_Wrapper is new Converter_Type with record Callback : Converter_Fn; Name : XString; end record; overriding function Convert (Self : Converter_Wrapper; Val : Value_Type) return Value_Type is (Self.Callback (Val)); overriding function Image (Self : Converter_Wrapper) return String is (Self.Name.To_String); type Combiner_Wrapper is new Combiner_Type with record Callback : Combiner_Fn; Name : XString; end record; overriding function Combine (Self : Combiner_Wrapper; Vs : Value_Array) return Value_Type is (Self.Callback (Vs)); overriding function Image (Self : Combiner_Wrapper) return String is (Self.Name.To_String); ------------------ -- Call_Wrapper -- ------------------ function Call_Wrapper (Self : in out Predicate_Type'Class; Val : Value_Type) return Boolean is begin if not Self.Cache_Set or else Self.Cache_Key /= Val then Self.Cache_Value := Self.Call (Val); Self.Cache_Set := True; Self.Cache_Key := Val; end if; return Self.Cache_Value; end Call_Wrapper; ------------------ -- Call_Wrapper -- ------------------ function Call_Wrapper (Self : in out N_Predicate_Type'Class; Vals : Logic_Vars.Value_Array) return Boolean is begin if not Self.Cache_Set or else Self.Cache_Key /= Vals then Self.Cache_Value := Self.Call (Vals); Self.Cache_Set := True; Self.Cache_Key := Vals; end if; return Self.Cache_Value; end Call_Wrapper; --------------------- -- Convert_Wrapper -- --------------------- function Convert_Wrapper (Self : in out Converter_Type; From : Value_Type) return Value_Type is begin if not Self.Cache_Set or else Self.Cache_Key /= From then Self.Cache_Value := Converter_Type'Class (Self).Convert (From); Self.Cache_Set := True; Self.Cache_Key := From; end if; return Self.Cache_Value; end Convert_Wrapper; --------------------- -- Combine_Wrapper -- --------------------- function Combine_Wrapper (Self : in out Combiner_Type'Class; Vals : Logic_Vars.Value_Array) return Value_Type is begin if not Self.Cache_Set or else Self.Cache_Key /= Vals then Self.Cache_Value := Self.Combine (Vals); Self.Cache_Set := True; Self.Cache_Key := Vals; end if; return Self.Cache_Value; end Combine_Wrapper; --------------- -- Converter -- --------------- function Converter (Pred : access function (V : Value_Type) return Value_Type; Pred_Name : String := "Converter") return Converter_Type'Class is begin return Converter_Wrapper'(Cache_Set => False, Cache_Key => <>, Cache_Value => <>, Ref_Count => 1, Callback => Pred'Unrestricted_Access.all, Name => To_XString (Pred_Name)); end Converter; -------------------------- -- Stub implementations -- -------------------------- type No_Converter_Type is new Converter_Type with null record; overriding function Convert (Dummy : No_Converter_Type; Dummy_From : Value_Type) return Value_Type is (raise Program_Error); function No_Converter return Converter_Type'Class is (No_Converter_Type'(Cache_Set => False, Ref_Count => 1, others => <>)); --------------------- -- Is_No_Converter -- --------------------- function Is_No_Converter (Self : Converter_Type'Class) return Boolean is begin return Self in No_Converter_Type'Class; end Is_No_Converter; --------------- -- Predicate -- --------------- function Predicate (Pred : access function (V : Value_Type) return Boolean; Pred_Name : String := "Predicate") return Predicate_Type'Class is begin return Predicate_Fn_Wrapper' (Cache_Set => False, Cache_Key => <>, Cache_Value => <>, Ref_Count => 1, Callback => Pred'Unrestricted_Access.all, Name => To_XString (Pred_Name)); end Predicate; ----------------- -- N_Predicate -- ----------------- function N_Predicate (Pred : access function (V : Value_Array) return Boolean; Arity : Positive; Pred_Name : String := "N_Predicate") return N_Predicate_Type'Class is begin return N_Predicate_Fn_Wrapper' (N => Arity, Cache_Set => False, Cache_Key => <>, Cache_Value => <>, Ref_Count => 1, Callback => Pred'Unrestricted_Access.all, Name => To_XString (Pred_Name)); end N_Predicate; -------------- -- Combiner -- -------------- function Combiner (Comb : access function (V : Value_Array) return Value_Type; Arity : Positive; Comb_Name : String := "Combiner") return Combiner_Type'Class is begin return Combiner_Wrapper' (N => Arity, Cache_Set => False, Cache_Key => <>, Cache_Value => <>, Ref_Count => 1, Callback => Comb'Unrestricted_Access.all, Name => To_XString (Comb_Name)); end Combiner; end Langkit_Support.Adalog.Solver_Interface;
AdaCore/training_material
Ada
637
adb
with Protected_Objects; use Protected_Objects; package body Tasks is task body T1 is begin accept Start do Object.Set ("T1 Start", 0); end Start; loop accept Receive_Message do Object.Set ("T1 Receive", Object.Get ("T1 Receive") + 1); end Receive_Message; end loop; end T1; task body T2 is begin accept Start do Object.Set ("T2 Start", 0); end Start; loop accept Receive_Message do Object.Set ("T2 Receive", Object.Get ("T2 Receive") + 1); end Receive_Message; end loop; end T2; end Tasks;
charlie5/aIDE
Ada
1,159
ads
with AdaM.Any, Ada.Containers.Vectors, Ada.Streams; private with AdaM.library_Unit; package AdaM.Partition is type Item is new Any.item with private; -- View -- type View is access all Item'Class; procedure View_write (Stream : not null access Ada.Streams.Root_Stream_Type'Class; Self : in View); procedure View_read (Stream : not null access Ada.Streams.Root_Stream_Type'Class; Self : out View); for View'write use View_write; for View'read use View_read; -- Vector -- package Vectors is new ada.Containers.Vectors (Positive, View); subtype Vector is Vectors.Vector; -- Forge -- function new_Subprogram return Partition.view; procedure free (Self : in out Partition.view); procedure destruct (Self : in out Partition.item); -- Attributes -- overriding function Id (Self : access Item) return AdaM.Id; private type Item is new Any.item with record library_Units : library_Unit.Vector; end record; end AdaM.Partition;
reznikmm/matreshka
Ada
5,376
adb
------------------------------------------------------------------------------ -- -- -- Matreshka Project -- -- -- -- Localization, Internationalization, Globalization for Ada -- -- -- -- Runtime Library Component -- -- -- ------------------------------------------------------------------------------ -- -- -- Copyright © 2009-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$ ------------------------------------------------------------------------------ -- This is GCC specific version. ------------------------------------------------------------------------------ pragma Ada_2012; package body Matreshka.Atomics.Counters is procedure Sync_Add_And_Fetch_32 (Ptr : not null access Counter_Type; Value : Counter_Type); pragma Import (Intrinsic, Sync_Add_And_Fetch_32, "__sync_add_and_fetch_4"); function Sync_Sub_And_Fetch_32 (Ptr : not null access Counter_Type; Value : Counter_Type) return Counter_Type; procedure Sync_Sub_And_Fetch_32 (Ptr : not null access Counter_Type; Value : Counter_Type); pragma Import (Intrinsic, Sync_Sub_And_Fetch_32, "__sync_sub_and_fetch_4"); procedure Sync_Synchronize; pragma Import (Intrinsic, Sync_Synchronize, "__sync_synchronize"); --------------- -- Decrement -- --------------- function Decrement (Self : in out Counter) return Boolean is begin return Sync_Sub_And_Fetch_32 (Self.Value'Access, 1) = 0; end Decrement; --------------- -- Decrement -- --------------- procedure Decrement (Self : in out Counter) is begin Sync_Sub_And_Fetch_32 (Self.Value'Access, 1); end Decrement; --------------- -- Increment -- --------------- procedure Increment (Self : in out Counter) is begin Sync_Add_And_Fetch_32 (Self.Value'Access, 1); end Increment; ------------ -- Is_One -- ------------ function Is_One (Self : in out Counter) return Boolean is begin Sync_Synchronize; return Self.Value = 1; end Is_One; ------------- -- Is_Zero -- ------------- function Is_Zero (Self : in out Counter) return Boolean is begin Sync_Synchronize; return Self.Value = 0; end Is_Zero; --------- -- One -- --------- function One return Counter is begin return Counter'(Value => 1); end One; ---------- -- Zero -- ---------- function Zero return Counter is begin return Counter'(Value => 0); end Zero; end Matreshka.Atomics.Counters;
reznikmm/matreshka
Ada
4,303
ads
------------------------------------------------------------------------------ -- -- -- Matreshka Project -- -- -- -- Ada Modeling Framework -- -- -- -- Runtime Library Component -- -- -- ------------------------------------------------------------------------------ -- -- -- Copyright © 2011, Vadim Godunko <[email protected]> -- -- All rights reserved. -- -- -- -- Redistribution and use in source and binary forms, with or without -- -- modification, are permitted provided that the following conditions -- -- are met: -- -- -- -- * Redistributions of source code must retain the above copyright -- -- notice, this list of conditions and the following disclaimer. -- -- -- -- * Redistributions in binary form must reproduce the above copyright -- -- notice, this list of conditions and the following disclaimer in the -- -- documentation and/or other materials provided with the distribution. -- -- -- -- * Neither the name of the Vadim Godunko, IE nor the names of its -- -- contributors may be used to endorse or promote products derived from -- -- this software without specific prior written permission. -- -- -- -- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -- -- "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -- -- LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -- -- A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -- -- HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -- -- SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED -- -- TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -- -- PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -- -- LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -- -- NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -- -- SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -- -- -- ------------------------------------------------------------------------------ -- $Revision$ $Date$ ------------------------------------------------------------------------------ with AMF.CMOF.Typed_Elements; with AMF.CMOF.Types; with AMF.Internals.CMOF_Elements; generic type Element_Proxy is abstract new AMF.Internals.CMOF_Elements.CMOF_Element_Proxy with private; package AMF.Internals.CMOF_Typed_Elements is type CMOF_Typed_Element_Proxy is abstract limited new Element_Proxy and AMF.CMOF.Typed_Elements.CMOF_Typed_Element with null record; overriding function Get_Type (Self : not null access constant CMOF_Typed_Element_Proxy) return AMF.CMOF.Types.CMOF_Type_Access; -- Getter of TypedElement::type. -- -- This information is derived from the return result for this Operation. overriding procedure Set_Type (Self : not null access CMOF_Typed_Element_Proxy; To : AMF.CMOF.Types.CMOF_Type_Access); -- Setter of TypedElement::type. -- -- This information is derived from the return result for this Operation. end AMF.Internals.CMOF_Typed_Elements;
AdaDoom3/wayland_ada_binding
Ada
11,635
ads
-- The code in this package originates from the work of Dmitry A. Kazakov, -- the Simple Components library. The changes can be summarized: -- -- - Conversion from Ada95 to SPARK (Ada2012) -- - The subprograms have been grouped differently. -- -- The code is shared under the following license: -- -- This library is free software; you can redistribute it and/or -- -- modify it under the terms of the GNU General Public License as -- -- published by the Free Software Foundation; either version 2 of -- -- the License, or (at your option) any later version. This library -- -- is distributed in the hope that it will be useful, but WITHOUT -- -- ANY WARRANTY; without even the implied warranty of -- -- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -- -- General Public License for more details. You should have -- -- received a copy of the GNU General Public License along with -- -- this library; if not, write to the Free Software Foundation, -- -- Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. -- -- -- -- As a special exception, if other files instantiate generics from -- -- this unit, or you link this unit with other files to produce an -- -- executable, this unit does not by itself cause the resulting -- -- executable to be covered by the GNU General Public License. This -- -- exception does not however invalidate any other reasons why the -- -- executable file might be covered by the GNU Public License. -- -- -- -- The original copyright notice: -- -- -- -- -- package Strings_Edit.UTF8 Copyright (c) Dmitry A. Kazakov -- -- Interface Luebeck -- -- Spring, 2005 -- -- -- -- Last revision : 21:03 21 Apr 2009 -- -- -- -- This library is free software; you can redistribute it and/or -- -- modify it under the terms of the GNU General Public License as -- -- published by the Free Software Foundation; either version 2 of -- -- the License, or (at your option) any later version. This library -- -- is distributed in the hope that it will be useful, but WITHOUT -- -- ANY WARRANTY; without even the implied warranty of -- -- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -- -- General Public License for more details. You should have -- -- received a copy of the GNU General Public License along with -- -- this library; if not, write to the Free Software Foundation, -- -- Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. -- -- -- -- As a special exception, if other files instantiate generics from -- -- this unit, or you link this unit with other files to produce an -- -- executable, this unit does not by itself cause the resulting -- -- executable to be covered by the GNU General Public License. This -- -- exception does not however invalidate any other reasons why the -- -- executable file might be covered by the GNU Public License. -- -- with Ada.Containers; with Aida.UTF8_Code_Point; use type Ada.Containers.Count_Type; package Aida.UTF8 is pragma SPARK_Mode; use all type Aida.UTF8_Code_Point.T; function Is_Valid_UTF8_Code_Point (Source : Standard.String; Pointer : Int32_T) return Boolean is ((Source'First <= Pointer and Pointer <= Source'Last) and then (if (Standard.Character'Pos (Source (Pointer)) in 0..16#7F#) then Pointer < Int32_T'Last else (Pointer < Source'Last and then (if Standard.Character'Pos (Source (Pointer)) in 16#C2#..16#DF# and Standard.Character'Pos (Source (Pointer + 1)) in 16#80#..16#BF# then Pointer < Int32_T'Last - 1 else (Pointer < Source'Last - 1 and then (if (Standard.Character'Pos (Source (Pointer)) = 16#E0# and Standard.Character'Pos (Source (Pointer + 1)) in 16#A0#..16#BF# and Standard.Character'Pos (Source (Pointer + 2)) in 16#80#..16#BF#) then Pointer < Int32_T'Last - 2 elsif (Standard.Character'Pos (Source (Pointer)) in 16#E1#..16#EF# and Standard.Character'Pos (Source (Pointer + 1)) in 16#80#..16#BF# and Standard.Character'Pos (Source (Pointer + 2)) in 16#80#..16#BF#) then Pointer < Int32_T'Last - 2 else (Pointer < Source'Last - 2 and then (if (Standard.Character'Pos (Source (Pointer)) = 16#F0# and Standard.Character'Pos (Source (Pointer + 1)) in 16#90#..16#BF# and Standard.Character'Pos (Source (Pointer + 2)) in 16#80#..16#BF# and Standard.Character'Pos (Source (Pointer + 3)) in 16#80#..16#BF#) then Pointer < Int32_T'Last - 3 elsif (Standard.Character'Pos (Source (Pointer)) in 16#F1#..16#F3# and Standard.Character'Pos (Source (Pointer + 1)) in 16#80#..16#BF# and Standard.Character'Pos (Source (Pointer + 2)) in 16#80#..16#BF# and Standard.Character'Pos (Source (Pointer + 3)) in 16#80#..16#BF#) then Pointer < Int32_T'Last - 3 elsif (Standard.Character'Pos (Source (Pointer)) = 16#F4# and Standard.Character'Pos (Source (Pointer + 1)) in 16#80#..16#8F# and Standard.Character'Pos (Source (Pointer + 2)) in 16#80#..16#BF# and Standard.Character'Pos (Source (Pointer + 3)) in 16#80#..16#BF#) then Pointer < Int32_T'Last - 3 else False)))))))); -- -- Get -- Get one UTF-8 code point -- -- Source - The source string -- Pointer - The string position to start at -- Value - The result -- -- This procedure decodes one UTF-8 code point from the string Source. -- It starts at Source (Pointer). After successful completion Pointer is -- advanced to the first character following the input. The result is -- returned through the parameter Value. -- procedure Get (Source : Standard.String; Pointer : in out Int32_T; Value : out Aida.UTF8_Code_Point.T) with Global => null, Pre => Is_Valid_UTF8_Code_Point (Source, Pointer), Post => Pointer <= Pointer'Old + 4 and (if (Standard.Character'Pos (Source (Pointer'Old)) in 0..16#7F#) then Standard.Character'Pos (Source (Pointer'Old)) = Value and Pointer = Pointer'Old + 1 elsif (Pointer'Old < Source'Last and then (Standard.Character'Pos (Source (Pointer'Old)) in 16#C2#..16#DF# and Standard.Character'Pos (Source (Pointer'Old + 1)) in 16#80#..16#BF#)) then Pointer = Pointer'Old + 2 elsif (Pointer'Old < Source'Last - 1 and then ((Standard.Character'Pos (Source (Pointer'Old)) = 16#E0# and Standard.Character'Pos (Source (Pointer'Old + 1)) in 16#A0#..16#BF# and Standard.Character'Pos (Source (Pointer'Old + 2)) in 16#80#..16#BF#) or (Standard.Character'Pos (Source (Pointer'Old)) in 16#E1#..16#EF# and Standard.Character'Pos (Source (Pointer'Old + 1)) in 16#80#..16#BF# and Standard.Character'Pos (Source (Pointer'Old + 2)) in 16#80#..16#BF#))) then Pointer = Pointer'Old + 3 elsif (Pointer < Source'Last - 2 and then ((Standard.Character'Pos (Source (Pointer'Old)) = 16#F0# and Standard.Character'Pos (Source (Pointer'Old + 1)) in 16#90#..16#BF# and Standard.Character'Pos (Source (Pointer'Old + 2)) in 16#80#..16#BF# and Standard.Character'Pos (Source (Pointer'Old + 3)) in 16#80#..16#BF#) or (Standard.Character'Pos (Source (Pointer'Old)) in 16#F1#..16#F3# and Standard.Character'Pos (Source (Pointer'Old + 1)) in 16#80#..16#BF# and Standard.Character'Pos (Source (Pointer'Old + 2)) in 16#80#..16#BF# and Standard.Character'Pos (Source (Pointer'Old + 3)) in 16#80#..16#BF#) or (Standard.Character'Pos (Source (Pointer'Old)) = 16#F4# and Standard.Character'Pos (Source (Pointer'Old + 1)) in 16#80#..16#8F# and Standard.Character'Pos (Source (Pointer'Old + 2)) in 16#80#..16#BF# and Standard.Character'Pos (Source (Pointer'Old + 3)) in 16#80#..16#BF#))) then Pointer = Pointer'Old + 4 ); --function Is_Valid_UTF8 (Source : String) return Boolean; -- -- Length -- The length of an UTF-8 string -- -- Source - The string containing UTF-8 encoded code points -- -- Returns : -- -- The number of UTF-8 encoded code points in Source -- function Length (Source : Standard.String) return Nat32_T with Global => null, Post => Length'Result <= Source'Length or ((for all I in Source'Range => (Aida.Character.Is_One_Byte_UTF8 (Source (I)))) and then (Length'Result = Source'Length)); -- -- Put -- Put one UTF-8 code point -- -- Destination - The target string -- Pointer - The position where to place the character -- Value - The code point to put -- -- This procedure puts one UTF-8 code point into the string Source -- starting from the position Source (Pointer). Pointer is then advanced -- to the first character following the output. -- procedure Put (Destination : in out Standard.String; Pointer : in out Int32_T; Value : Aida.UTF8_Code_Point.T) with Global => null, Pre => (Pointer in Destination'Range and Destination'Last < Int32_T'Last) and then (if Value <= 16#7F# then Pointer < Int32_T'Last elsif Value <= 16#7FF# then Pointer < Int32_T'Last - 1 and Pointer + 1 in Destination'Range elsif Value <= 16#FFFF# then (Pointer < Int32_T'Last - 2 and then (Pointer + 1 in Destination'Range and Pointer + 2 in Destination'Range)) else Pointer < Int32_T'Last - 3 and then (Pointer + 1 in Destination'Range and Pointer + 2 in Destination'Range and Pointer + 3 in Destination'Range)), Post => Pointer /= Pointer'Old and (Pointer in Destination'Range or Pointer = Destination'Last + 1); function To_Lowercase (Value : Standard.String) return Standard.String with Global => null; function To_Uppercase (Value : Standard.String) return Standard.String with Global => null; end Aida.UTF8;
MinimSecure/unum-sdk
Ada
848
ads
-- Copyright 2016-2019 Free Software Foundation, Inc. -- -- This program is free software; you can redistribute it and/or modify -- it under the terms of the GNU General Public License as published by -- the Free Software Foundation; either version 3 of the License, or -- (at your option) any later version. -- -- This program is distributed in the hope that it will be useful, -- but WITHOUT ANY WARRANTY; without even the implied warranty of -- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -- GNU General Public License for more details. -- -- You should have received a copy of the GNU General Public License -- along with this program. If not, see <http://www.gnu.org/licenses/>. with System; package Pck is function Ident (I : Integer) return Integer; procedure Do_Nothing (A : System.Address); end Pck;
twdroeger/ada-awa
Ada
108,858
adb
----------------------------------------------------------------------- -- AWA.Wikis.Models -- AWA.Wikis.Models ----------------------------------------------------------------------- -- File generated by ada-gen DO NOT MODIFY -- Template used: templates/model/package-body.xhtml -- Ada Generator: https://ada-gen.googlecode.com/svn/trunk Revision 1095 ----------------------------------------------------------------------- -- Copyright (C) 2019 Stephane Carrez -- Written by Stephane Carrez ([email protected]) -- -- Licensed under the Apache License, Version 2.0 (the "License"); -- you may not use this file except in compliance with the License. -- You may obtain a copy of the License at -- -- http://www.apache.org/licenses/LICENSE-2.0 -- -- Unless required by applicable law or agreed to in writing, software -- distributed under the License is distributed on an "AS IS" BASIS, -- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -- See the License for the specific language governing permissions and -- limitations under the License. ----------------------------------------------------------------------- with Ada.Unchecked_Deallocation; with Util.Beans.Objects.Time; with ASF.Events.Faces.Actions; package body AWA.Wikis.Models is use type ADO.Objects.Object_Record_Access; use type ADO.Objects.Object_Ref; pragma Warnings (Off, "formal parameter * is not referenced"); function Wiki_Content_Key (Id : in ADO.Identifier) return ADO.Objects.Object_Key is Result : ADO.Objects.Object_Key (Of_Type => ADO.Objects.KEY_INTEGER, Of_Class => WIKI_CONTENT_DEF'Access); begin ADO.Objects.Set_Value (Result, Id); return Result; end Wiki_Content_Key; function Wiki_Content_Key (Id : in String) return ADO.Objects.Object_Key is Result : ADO.Objects.Object_Key (Of_Type => ADO.Objects.KEY_INTEGER, Of_Class => WIKI_CONTENT_DEF'Access); begin ADO.Objects.Set_Value (Result, Id); return Result; end Wiki_Content_Key; function "=" (Left, Right : Wiki_Content_Ref'Class) return Boolean is begin return ADO.Objects.Object_Ref'Class (Left) = ADO.Objects.Object_Ref'Class (Right); end "="; procedure Set_Field (Object : in out Wiki_Content_Ref'Class; Impl : out Wiki_Content_Access) is Result : ADO.Objects.Object_Record_Access; begin Object.Prepare_Modify (Result); Impl := Wiki_Content_Impl (Result.all)'Access; end Set_Field; -- Internal method to allocate the Object_Record instance procedure Allocate (Object : in out Wiki_Content_Ref) is Impl : Wiki_Content_Access; begin Impl := new Wiki_Content_Impl; Impl.Create_Date := ADO.DEFAULT_TIME; Impl.Format := AWA.Wikis.Models.Format_Type'First; Impl.Version := 0; Impl.Page_Version := 0; Impl.Page_Id := ADO.NO_IDENTIFIER; ADO.Objects.Set_Object (Object, Impl.all'Access); end Allocate; -- ---------------------------------------- -- Data object: Wiki_Content -- ---------------------------------------- procedure Set_Id (Object : in out Wiki_Content_Ref; Value : in ADO.Identifier) is Impl : Wiki_Content_Access; begin Set_Field (Object, Impl); ADO.Objects.Set_Field_Key_Value (Impl.all, 1, Value); end Set_Id; function Get_Id (Object : in Wiki_Content_Ref) return ADO.Identifier is Impl : constant Wiki_Content_Access := Wiki_Content_Impl (Object.Get_Object.all)'Access; begin return Impl.Get_Key_Value; end Get_Id; procedure Set_Create_Date (Object : in out Wiki_Content_Ref; Value : in Ada.Calendar.Time) is Impl : Wiki_Content_Access; begin Set_Field (Object, Impl); ADO.Objects.Set_Field_Time (Impl.all, 2, Impl.Create_Date, Value); end Set_Create_Date; function Get_Create_Date (Object : in Wiki_Content_Ref) return Ada.Calendar.Time is Impl : constant Wiki_Content_Access := Wiki_Content_Impl (Object.Get_Load_Object.all)'Access; begin return Impl.Create_Date; end Get_Create_Date; procedure Set_Content (Object : in out Wiki_Content_Ref; Value : in String) is Impl : Wiki_Content_Access; begin Set_Field (Object, Impl); ADO.Objects.Set_Field_String (Impl.all, 3, Impl.Content, Value); end Set_Content; procedure Set_Content (Object : in out Wiki_Content_Ref; Value : in Ada.Strings.Unbounded.Unbounded_String) is Impl : Wiki_Content_Access; begin Set_Field (Object, Impl); ADO.Objects.Set_Field_Unbounded_String (Impl.all, 3, Impl.Content, Value); end Set_Content; function Get_Content (Object : in Wiki_Content_Ref) return String is begin return Ada.Strings.Unbounded.To_String (Object.Get_Content); end Get_Content; function Get_Content (Object : in Wiki_Content_Ref) return Ada.Strings.Unbounded.Unbounded_String is Impl : constant Wiki_Content_Access := Wiki_Content_Impl (Object.Get_Load_Object.all)'Access; begin return Impl.Content; end Get_Content; procedure Set_Format (Object : in out Wiki_Content_Ref; Value : in AWA.Wikis.Models.Format_Type) is procedure Set_Field_Enum is new ADO.Objects.Set_Field_Operation (Format_Type); Impl : Wiki_Content_Access; begin Set_Field (Object, Impl); Set_Field_Enum (Impl.all, 4, Impl.Format, Value); end Set_Format; function Get_Format (Object : in Wiki_Content_Ref) return AWA.Wikis.Models.Format_Type is Impl : constant Wiki_Content_Access := Wiki_Content_Impl (Object.Get_Load_Object.all)'Access; begin return Impl.Format; end Get_Format; procedure Set_Save_Comment (Object : in out Wiki_Content_Ref; Value : in String) is Impl : Wiki_Content_Access; begin Set_Field (Object, Impl); ADO.Objects.Set_Field_String (Impl.all, 5, Impl.Save_Comment, Value); end Set_Save_Comment; procedure Set_Save_Comment (Object : in out Wiki_Content_Ref; Value : in Ada.Strings.Unbounded.Unbounded_String) is Impl : Wiki_Content_Access; begin Set_Field (Object, Impl); ADO.Objects.Set_Field_Unbounded_String (Impl.all, 5, Impl.Save_Comment, Value); end Set_Save_Comment; function Get_Save_Comment (Object : in Wiki_Content_Ref) return String is begin return Ada.Strings.Unbounded.To_String (Object.Get_Save_Comment); end Get_Save_Comment; function Get_Save_Comment (Object : in Wiki_Content_Ref) return Ada.Strings.Unbounded.Unbounded_String is Impl : constant Wiki_Content_Access := Wiki_Content_Impl (Object.Get_Load_Object.all)'Access; begin return Impl.Save_Comment; end Get_Save_Comment; function Get_Version (Object : in Wiki_Content_Ref) return Integer is Impl : constant Wiki_Content_Access := Wiki_Content_Impl (Object.Get_Load_Object.all)'Access; begin return Impl.Version; end Get_Version; procedure Set_Page_Version (Object : in out Wiki_Content_Ref; Value : in Integer) is Impl : Wiki_Content_Access; begin Set_Field (Object, Impl); ADO.Objects.Set_Field_Integer (Impl.all, 7, Impl.Page_Version, Value); end Set_Page_Version; function Get_Page_Version (Object : in Wiki_Content_Ref) return Integer is Impl : constant Wiki_Content_Access := Wiki_Content_Impl (Object.Get_Load_Object.all)'Access; begin return Impl.Page_Version; end Get_Page_Version; procedure Set_Page_Id (Object : in out Wiki_Content_Ref; Value : in ADO.Identifier) is Impl : Wiki_Content_Access; begin Set_Field (Object, Impl); ADO.Objects.Set_Field_Identifier (Impl.all, 8, Impl.Page_Id, Value); end Set_Page_Id; function Get_Page_Id (Object : in Wiki_Content_Ref) return ADO.Identifier is Impl : constant Wiki_Content_Access := Wiki_Content_Impl (Object.Get_Load_Object.all)'Access; begin return Impl.Page_Id; end Get_Page_Id; procedure Set_Author (Object : in out Wiki_Content_Ref; Value : in AWA.Users.Models.User_Ref'Class) is Impl : Wiki_Content_Access; begin Set_Field (Object, Impl); ADO.Objects.Set_Field_Object (Impl.all, 9, Impl.Author, Value); end Set_Author; function Get_Author (Object : in Wiki_Content_Ref) return AWA.Users.Models.User_Ref'Class is Impl : constant Wiki_Content_Access := Wiki_Content_Impl (Object.Get_Load_Object.all)'Access; begin return Impl.Author; end Get_Author; -- Copy of the object. procedure Copy (Object : in Wiki_Content_Ref; Into : in out Wiki_Content_Ref) is Result : Wiki_Content_Ref; begin if not Object.Is_Null then declare Impl : constant Wiki_Content_Access := Wiki_Content_Impl (Object.Get_Load_Object.all)'Access; Copy : constant Wiki_Content_Access := new Wiki_Content_Impl; begin ADO.Objects.Set_Object (Result, Copy.all'Access); Copy.Copy (Impl.all); Copy.Create_Date := Impl.Create_Date; Copy.Content := Impl.Content; Copy.Format := Impl.Format; Copy.Save_Comment := Impl.Save_Comment; Copy.Version := Impl.Version; Copy.Page_Version := Impl.Page_Version; Copy.Page_Id := Impl.Page_Id; Copy.Author := Impl.Author; end; end if; Into := Result; end Copy; procedure Find (Object : in out Wiki_Content_Ref; Session : in out ADO.Sessions.Session'Class; Query : in ADO.SQL.Query'Class; Found : out Boolean) is Impl : constant Wiki_Content_Access := new Wiki_Content_Impl; begin Impl.Find (Session, Query, Found); if Found then ADO.Objects.Set_Object (Object, Impl.all'Access); else ADO.Objects.Set_Object (Object, null); Destroy (Impl); end if; end Find; procedure Load (Object : in out Wiki_Content_Ref; Session : in out ADO.Sessions.Session'Class; Id : in ADO.Identifier) is Impl : constant Wiki_Content_Access := new Wiki_Content_Impl; Found : Boolean; Query : ADO.SQL.Query; begin Query.Bind_Param (Position => 1, Value => Id); Query.Set_Filter ("id = ?"); Impl.Find (Session, Query, Found); if not Found then Destroy (Impl); raise ADO.Objects.NOT_FOUND; end if; ADO.Objects.Set_Object (Object, Impl.all'Access); end Load; procedure Load (Object : in out Wiki_Content_Ref; Session : in out ADO.Sessions.Session'Class; Id : in ADO.Identifier; Found : out Boolean) is Impl : constant Wiki_Content_Access := new Wiki_Content_Impl; Query : ADO.SQL.Query; begin Query.Bind_Param (Position => 1, Value => Id); Query.Set_Filter ("id = ?"); Impl.Find (Session, Query, Found); if not Found then Destroy (Impl); else ADO.Objects.Set_Object (Object, Impl.all'Access); end if; end Load; procedure Save (Object : in out Wiki_Content_Ref; Session : in out ADO.Sessions.Master_Session'Class) is Impl : ADO.Objects.Object_Record_Access := Object.Get_Object; begin if Impl = null then Impl := new Wiki_Content_Impl; ADO.Objects.Set_Object (Object, Impl); end if; if not ADO.Objects.Is_Created (Impl.all) then Impl.Create (Session); else Impl.Save (Session); end if; end Save; procedure Delete (Object : in out Wiki_Content_Ref; Session : in out ADO.Sessions.Master_Session'Class) is Impl : constant ADO.Objects.Object_Record_Access := Object.Get_Object; begin if Impl /= null then Impl.Delete (Session); end if; end Delete; -- -------------------- -- Free the object -- -------------------- procedure Destroy (Object : access Wiki_Content_Impl) is type Wiki_Content_Impl_Ptr is access all Wiki_Content_Impl; procedure Unchecked_Free is new Ada.Unchecked_Deallocation (Wiki_Content_Impl, Wiki_Content_Impl_Ptr); pragma Warnings (Off, "*redundant conversion*"); Ptr : Wiki_Content_Impl_Ptr := Wiki_Content_Impl (Object.all)'Access; pragma Warnings (On, "*redundant conversion*"); begin Unchecked_Free (Ptr); end Destroy; procedure Find (Object : in out Wiki_Content_Impl; Session : in out ADO.Sessions.Session'Class; Query : in ADO.SQL.Query'Class; Found : out Boolean) is Stmt : ADO.Statements.Query_Statement := Session.Create_Statement (Query, WIKI_CONTENT_DEF'Access); begin Stmt.Execute; if Stmt.Has_Elements then Object.Load (Stmt, Session); Stmt.Next; Found := not Stmt.Has_Elements; else Found := False; end if; end Find; overriding procedure Load (Object : in out Wiki_Content_Impl; Session : in out ADO.Sessions.Session'Class) is Found : Boolean; Query : ADO.SQL.Query; Id : constant ADO.Identifier := Object.Get_Key_Value; begin Query.Bind_Param (Position => 1, Value => Id); Query.Set_Filter ("id = ?"); Object.Find (Session, Query, Found); if not Found then raise ADO.Objects.NOT_FOUND; end if; end Load; procedure Save (Object : in out Wiki_Content_Impl; Session : in out ADO.Sessions.Master_Session'Class) is Stmt : ADO.Statements.Update_Statement := Session.Create_Statement (WIKI_CONTENT_DEF'Access); begin if Object.Is_Modified (1) then Stmt.Save_Field (Name => COL_0_1_NAME, -- id Value => Object.Get_Key); Object.Clear_Modified (1); end if; if Object.Is_Modified (7) then Stmt.Save_Field (Name => COL_6_1_NAME, -- page_version Value => Object.Page_Version); Object.Clear_Modified (7); end if; if Object.Is_Modified (8) then Stmt.Save_Field (Name => COL_7_1_NAME, -- page_id Value => Object.Page_Id); Object.Clear_Modified (8); end if; if Object.Is_Modified (9) then Stmt.Save_Field (Name => COL_8_1_NAME, -- author_id Value => Object.Author); Object.Clear_Modified (9); end if; if Stmt.Has_Save_Fields then Object.Version := Object.Version + 1; Stmt.Save_Field (Name => "version", Value => Object.Version); Stmt.Set_Filter (Filter => "id = ? and version = ?"); Stmt.Add_Param (Value => Object.Get_Key); Stmt.Add_Param (Value => Object.Version - 1); declare Result : Integer; begin Stmt.Execute (Result); if Result /= 1 then if Result /= 0 then raise ADO.Objects.UPDATE_ERROR; else raise ADO.Objects.LAZY_LOCK; end if; end if; end; end if; end Save; procedure Create (Object : in out Wiki_Content_Impl; Session : in out ADO.Sessions.Master_Session'Class) is Query : ADO.Statements.Insert_Statement := Session.Create_Statement (WIKI_CONTENT_DEF'Access); Result : Integer; begin Object.Version := 1; Session.Allocate (Id => Object); Query.Save_Field (Name => COL_0_1_NAME, -- id Value => Object.Get_Key); Query.Save_Field (Name => COL_1_1_NAME, -- create_date Value => Object.Create_Date); Query.Save_Field (Name => COL_2_1_NAME, -- content Value => Object.Content); Query.Save_Field (Name => COL_3_1_NAME, -- format Value => Integer (Format_Type'Pos (Object.Format))); Query.Save_Field (Name => COL_4_1_NAME, -- save_comment Value => Object.Save_Comment); Query.Save_Field (Name => COL_5_1_NAME, -- version Value => Object.Version); Query.Save_Field (Name => COL_6_1_NAME, -- page_version Value => Object.Page_Version); Query.Save_Field (Name => COL_7_1_NAME, -- page_id Value => Object.Page_Id); Query.Save_Field (Name => COL_8_1_NAME, -- author_id Value => Object.Author); Query.Execute (Result); if Result /= 1 then raise ADO.Objects.INSERT_ERROR; end if; ADO.Objects.Set_Created (Object); end Create; procedure Delete (Object : in out Wiki_Content_Impl; Session : in out ADO.Sessions.Master_Session'Class) is Stmt : ADO.Statements.Delete_Statement := Session.Create_Statement (WIKI_CONTENT_DEF'Access); begin Stmt.Set_Filter (Filter => "id = ?"); Stmt.Add_Param (Value => Object.Get_Key); Stmt.Execute; end Delete; -- ------------------------------ -- Get the bean attribute identified by the name. -- ------------------------------ overriding function Get_Value (From : in Wiki_Content_Ref; Name : in String) return Util.Beans.Objects.Object is Obj : ADO.Objects.Object_Record_Access; Impl : access Wiki_Content_Impl; begin if From.Is_Null then return Util.Beans.Objects.Null_Object; end if; Obj := From.Get_Load_Object; Impl := Wiki_Content_Impl (Obj.all)'Access; if Name = "id" then return ADO.Objects.To_Object (Impl.Get_Key); elsif Name = "create_date" then return Util.Beans.Objects.Time.To_Object (Impl.Create_Date); elsif Name = "content" then return Util.Beans.Objects.To_Object (Impl.Content); elsif Name = "format" then return AWA.Wikis.Models.Format_Type_Objects.To_Object (Impl.Format); elsif Name = "save_comment" then return Util.Beans.Objects.To_Object (Impl.Save_Comment); elsif Name = "page_version" then return Util.Beans.Objects.To_Object (Long_Long_Integer (Impl.Page_Version)); elsif Name = "page_id" then return Util.Beans.Objects.To_Object (Long_Long_Integer (Impl.Page_Id)); end if; return Util.Beans.Objects.Null_Object; end Get_Value; -- ------------------------------ -- Load the object from current iterator position -- ------------------------------ procedure Load (Object : in out Wiki_Content_Impl; Stmt : in out ADO.Statements.Query_Statement'Class; Session : in out ADO.Sessions.Session'Class) is begin Object.Set_Key_Value (Stmt.Get_Identifier (0)); Object.Create_Date := Stmt.Get_Time (1); Object.Content := Stmt.Get_Unbounded_String (2); Object.Format := Format_Type'Val (Stmt.Get_Integer (3)); Object.Save_Comment := Stmt.Get_Unbounded_String (4); Object.Page_Version := Stmt.Get_Integer (6); Object.Page_Id := Stmt.Get_Identifier (7); if not Stmt.Is_Null (8) then Object.Author.Set_Key_Value (Stmt.Get_Identifier (8), Session); end if; Object.Version := Stmt.Get_Integer (5); ADO.Objects.Set_Created (Object); end Load; function Wiki_Space_Key (Id : in ADO.Identifier) return ADO.Objects.Object_Key is Result : ADO.Objects.Object_Key (Of_Type => ADO.Objects.KEY_INTEGER, Of_Class => WIKI_SPACE_DEF'Access); begin ADO.Objects.Set_Value (Result, Id); return Result; end Wiki_Space_Key; function Wiki_Space_Key (Id : in String) return ADO.Objects.Object_Key is Result : ADO.Objects.Object_Key (Of_Type => ADO.Objects.KEY_INTEGER, Of_Class => WIKI_SPACE_DEF'Access); begin ADO.Objects.Set_Value (Result, Id); return Result; end Wiki_Space_Key; function "=" (Left, Right : Wiki_Space_Ref'Class) return Boolean is begin return ADO.Objects.Object_Ref'Class (Left) = ADO.Objects.Object_Ref'Class (Right); end "="; procedure Set_Field (Object : in out Wiki_Space_Ref'Class; Impl : out Wiki_Space_Access) is Result : ADO.Objects.Object_Record_Access; begin Object.Prepare_Modify (Result); Impl := Wiki_Space_Impl (Result.all)'Access; end Set_Field; -- Internal method to allocate the Object_Record instance procedure Allocate (Object : in out Wiki_Space_Ref) is Impl : Wiki_Space_Access; begin Impl := new Wiki_Space_Impl; Impl.Is_Public := False; Impl.Version := 0; Impl.Create_Date := ADO.DEFAULT_TIME; Impl.Format := AWA.Wikis.Models.Format_Type'First; ADO.Objects.Set_Object (Object, Impl.all'Access); end Allocate; -- ---------------------------------------- -- Data object: Wiki_Space -- ---------------------------------------- procedure Set_Id (Object : in out Wiki_Space_Ref; Value : in ADO.Identifier) is Impl : Wiki_Space_Access; begin Set_Field (Object, Impl); ADO.Objects.Set_Field_Key_Value (Impl.all, 1, Value); end Set_Id; function Get_Id (Object : in Wiki_Space_Ref) return ADO.Identifier is Impl : constant Wiki_Space_Access := Wiki_Space_Impl (Object.Get_Object.all)'Access; begin return Impl.Get_Key_Value; end Get_Id; procedure Set_Name (Object : in out Wiki_Space_Ref; Value : in String) is Impl : Wiki_Space_Access; begin Set_Field (Object, Impl); ADO.Audits.Set_Field_String (Impl.all, 2, Impl.Name, Value); end Set_Name; procedure Set_Name (Object : in out Wiki_Space_Ref; Value : in Ada.Strings.Unbounded.Unbounded_String) is Impl : Wiki_Space_Access; begin Set_Field (Object, Impl); ADO.Audits.Set_Field_Unbounded_String (Impl.all, 2, Impl.Name, Value); end Set_Name; function Get_Name (Object : in Wiki_Space_Ref) return String is begin return Ada.Strings.Unbounded.To_String (Object.Get_Name); end Get_Name; function Get_Name (Object : in Wiki_Space_Ref) return Ada.Strings.Unbounded.Unbounded_String is Impl : constant Wiki_Space_Access := Wiki_Space_Impl (Object.Get_Load_Object.all)'Access; begin return Impl.Name; end Get_Name; procedure Set_Is_Public (Object : in out Wiki_Space_Ref; Value : in Boolean) is Impl : Wiki_Space_Access; begin Set_Field (Object, Impl); ADO.Audits.Set_Field_Boolean (Impl.all, 3, Impl.Is_Public, Value); end Set_Is_Public; function Get_Is_Public (Object : in Wiki_Space_Ref) return Boolean is Impl : constant Wiki_Space_Access := Wiki_Space_Impl (Object.Get_Load_Object.all)'Access; begin return Impl.Is_Public; end Get_Is_Public; function Get_Version (Object : in Wiki_Space_Ref) return Integer is Impl : constant Wiki_Space_Access := Wiki_Space_Impl (Object.Get_Load_Object.all)'Access; begin return Impl.Version; end Get_Version; procedure Set_Create_Date (Object : in out Wiki_Space_Ref; Value : in Ada.Calendar.Time) is Impl : Wiki_Space_Access; begin Set_Field (Object, Impl); ADO.Objects.Set_Field_Time (Impl.all, 5, Impl.Create_Date, Value); end Set_Create_Date; function Get_Create_Date (Object : in Wiki_Space_Ref) return Ada.Calendar.Time is Impl : constant Wiki_Space_Access := Wiki_Space_Impl (Object.Get_Load_Object.all)'Access; begin return Impl.Create_Date; end Get_Create_Date; procedure Set_Left_Side (Object : in out Wiki_Space_Ref; Value : in String) is Impl : Wiki_Space_Access; begin Set_Field (Object, Impl); ADO.Objects.Set_Field_String (Impl.all, 6, Impl.Left_Side, Value); end Set_Left_Side; procedure Set_Left_Side (Object : in out Wiki_Space_Ref; Value : in Ada.Strings.Unbounded.Unbounded_String) is Impl : Wiki_Space_Access; begin Set_Field (Object, Impl); ADO.Objects.Set_Field_Unbounded_String (Impl.all, 6, Impl.Left_Side, Value); end Set_Left_Side; function Get_Left_Side (Object : in Wiki_Space_Ref) return String is begin return Ada.Strings.Unbounded.To_String (Object.Get_Left_Side); end Get_Left_Side; function Get_Left_Side (Object : in Wiki_Space_Ref) return Ada.Strings.Unbounded.Unbounded_String is Impl : constant Wiki_Space_Access := Wiki_Space_Impl (Object.Get_Load_Object.all)'Access; begin return Impl.Left_Side; end Get_Left_Side; procedure Set_Right_Side (Object : in out Wiki_Space_Ref; Value : in String) is Impl : Wiki_Space_Access; begin Set_Field (Object, Impl); ADO.Objects.Set_Field_String (Impl.all, 7, Impl.Right_Side, Value); end Set_Right_Side; procedure Set_Right_Side (Object : in out Wiki_Space_Ref; Value : in Ada.Strings.Unbounded.Unbounded_String) is Impl : Wiki_Space_Access; begin Set_Field (Object, Impl); ADO.Objects.Set_Field_Unbounded_String (Impl.all, 7, Impl.Right_Side, Value); end Set_Right_Side; function Get_Right_Side (Object : in Wiki_Space_Ref) return String is begin return Ada.Strings.Unbounded.To_String (Object.Get_Right_Side); end Get_Right_Side; function Get_Right_Side (Object : in Wiki_Space_Ref) return Ada.Strings.Unbounded.Unbounded_String is Impl : constant Wiki_Space_Access := Wiki_Space_Impl (Object.Get_Load_Object.all)'Access; begin return Impl.Right_Side; end Get_Right_Side; procedure Set_Format (Object : in out Wiki_Space_Ref; Value : in AWA.Wikis.Models.Format_Type) is procedure Set_Field_Enum is new ADO.Audits.Set_Field_Operation (Format_Type, Format_Type_Objects.To_Object); Impl : Wiki_Space_Access; begin Set_Field (Object, Impl); Set_Field_Enum (Impl.all, 8, Impl.Format, Value); end Set_Format; function Get_Format (Object : in Wiki_Space_Ref) return AWA.Wikis.Models.Format_Type is Impl : constant Wiki_Space_Access := Wiki_Space_Impl (Object.Get_Load_Object.all)'Access; begin return Impl.Format; end Get_Format; procedure Set_Workspace (Object : in out Wiki_Space_Ref; Value : in AWA.Workspaces.Models.Workspace_Ref'Class) is Impl : Wiki_Space_Access; begin Set_Field (Object, Impl); ADO.Objects.Set_Field_Object (Impl.all, 9, Impl.Workspace, Value); end Set_Workspace; function Get_Workspace (Object : in Wiki_Space_Ref) return AWA.Workspaces.Models.Workspace_Ref'Class is Impl : constant Wiki_Space_Access := Wiki_Space_Impl (Object.Get_Load_Object.all)'Access; begin return Impl.Workspace; end Get_Workspace; -- Copy of the object. procedure Copy (Object : in Wiki_Space_Ref; Into : in out Wiki_Space_Ref) is Result : Wiki_Space_Ref; begin if not Object.Is_Null then declare Impl : constant Wiki_Space_Access := Wiki_Space_Impl (Object.Get_Load_Object.all)'Access; Copy : constant Wiki_Space_Access := new Wiki_Space_Impl; begin ADO.Objects.Set_Object (Result, Copy.all'Access); Copy.Copy (Impl.all); Copy.Name := Impl.Name; Copy.Is_Public := Impl.Is_Public; Copy.Version := Impl.Version; Copy.Create_Date := Impl.Create_Date; Copy.Left_Side := Impl.Left_Side; Copy.Right_Side := Impl.Right_Side; Copy.Format := Impl.Format; Copy.Workspace := Impl.Workspace; end; end if; Into := Result; end Copy; procedure Find (Object : in out Wiki_Space_Ref; Session : in out ADO.Sessions.Session'Class; Query : in ADO.SQL.Query'Class; Found : out Boolean) is Impl : constant Wiki_Space_Access := new Wiki_Space_Impl; begin Impl.Find (Session, Query, Found); if Found then ADO.Objects.Set_Object (Object, Impl.all'Access); else ADO.Objects.Set_Object (Object, null); Destroy (Impl); end if; end Find; procedure Load (Object : in out Wiki_Space_Ref; Session : in out ADO.Sessions.Session'Class; Id : in ADO.Identifier) is Impl : constant Wiki_Space_Access := new Wiki_Space_Impl; Found : Boolean; Query : ADO.SQL.Query; begin Query.Bind_Param (Position => 1, Value => Id); Query.Set_Filter ("id = ?"); Impl.Find (Session, Query, Found); if not Found then Destroy (Impl); raise ADO.Objects.NOT_FOUND; end if; ADO.Objects.Set_Object (Object, Impl.all'Access); end Load; procedure Load (Object : in out Wiki_Space_Ref; Session : in out ADO.Sessions.Session'Class; Id : in ADO.Identifier; Found : out Boolean) is Impl : constant Wiki_Space_Access := new Wiki_Space_Impl; Query : ADO.SQL.Query; begin Query.Bind_Param (Position => 1, Value => Id); Query.Set_Filter ("id = ?"); Impl.Find (Session, Query, Found); if not Found then Destroy (Impl); else ADO.Objects.Set_Object (Object, Impl.all'Access); end if; end Load; procedure Save (Object : in out Wiki_Space_Ref; Session : in out ADO.Sessions.Master_Session'Class) is Impl : ADO.Objects.Object_Record_Access := Object.Get_Object; begin if Impl = null then Impl := new Wiki_Space_Impl; ADO.Objects.Set_Object (Object, Impl); end if; if not ADO.Objects.Is_Created (Impl.all) then Impl.Create (Session); else Impl.Save (Session); end if; end Save; procedure Delete (Object : in out Wiki_Space_Ref; Session : in out ADO.Sessions.Master_Session'Class) is Impl : constant ADO.Objects.Object_Record_Access := Object.Get_Object; begin if Impl /= null then Impl.Delete (Session); end if; end Delete; -- -------------------- -- Free the object -- -------------------- procedure Destroy (Object : access Wiki_Space_Impl) is type Wiki_Space_Impl_Ptr is access all Wiki_Space_Impl; procedure Unchecked_Free is new Ada.Unchecked_Deallocation (Wiki_Space_Impl, Wiki_Space_Impl_Ptr); pragma Warnings (Off, "*redundant conversion*"); Ptr : Wiki_Space_Impl_Ptr := Wiki_Space_Impl (Object.all)'Access; pragma Warnings (On, "*redundant conversion*"); begin Unchecked_Free (Ptr); end Destroy; procedure Find (Object : in out Wiki_Space_Impl; Session : in out ADO.Sessions.Session'Class; Query : in ADO.SQL.Query'Class; Found : out Boolean) is Stmt : ADO.Statements.Query_Statement := Session.Create_Statement (Query, WIKI_SPACE_DEF'Access); begin Stmt.Execute; if Stmt.Has_Elements then Object.Load (Stmt, Session); Stmt.Next; Found := not Stmt.Has_Elements; else Found := False; end if; end Find; overriding procedure Load (Object : in out Wiki_Space_Impl; Session : in out ADO.Sessions.Session'Class) is Found : Boolean; Query : ADO.SQL.Query; Id : constant ADO.Identifier := Object.Get_Key_Value; begin Query.Bind_Param (Position => 1, Value => Id); Query.Set_Filter ("id = ?"); Object.Find (Session, Query, Found); if not Found then raise ADO.Objects.NOT_FOUND; end if; end Load; procedure Save (Object : in out Wiki_Space_Impl; Session : in out ADO.Sessions.Master_Session'Class) is Stmt : ADO.Statements.Update_Statement := Session.Create_Statement (WIKI_SPACE_DEF'Access); begin if Object.Is_Modified (1) then Stmt.Save_Field (Name => COL_0_2_NAME, -- id Value => Object.Get_Key); Object.Clear_Modified (1); end if; if Object.Is_Modified (2) then Stmt.Save_Field (Name => COL_1_2_NAME, -- name Value => Object.Name); Object.Clear_Modified (2); end if; if Object.Is_Modified (3) then Stmt.Save_Field (Name => COL_2_2_NAME, -- is_public Value => Object.Is_Public); Object.Clear_Modified (3); end if; if Object.Is_Modified (5) then Stmt.Save_Field (Name => COL_4_2_NAME, -- create_date Value => Object.Create_Date); Object.Clear_Modified (5); end if; if Object.Is_Modified (6) then Stmt.Save_Field (Name => COL_5_2_NAME, -- left_side Value => Object.Left_Side); Object.Clear_Modified (6); end if; if Object.Is_Modified (7) then Stmt.Save_Field (Name => COL_6_2_NAME, -- right_side Value => Object.Right_Side); Object.Clear_Modified (7); end if; if Object.Is_Modified (8) then Stmt.Save_Field (Name => COL_7_2_NAME, -- format Value => Integer (Format_Type'Pos (Object.Format))); Object.Clear_Modified (8); end if; if Object.Is_Modified (9) then Stmt.Save_Field (Name => COL_8_2_NAME, -- workspace_id Value => Object.Workspace); Object.Clear_Modified (9); end if; if Stmt.Has_Save_Fields then Object.Version := Object.Version + 1; Stmt.Save_Field (Name => "version", Value => Object.Version); Stmt.Set_Filter (Filter => "id = ? and version = ?"); Stmt.Add_Param (Value => Object.Get_Key); Stmt.Add_Param (Value => Object.Version - 1); declare Result : Integer; begin Stmt.Execute (Result); if Result /= 1 then if Result /= 0 then raise ADO.Objects.UPDATE_ERROR; else raise ADO.Objects.LAZY_LOCK; end if; end if; ADO.Audits.Save (Object, Session); end; end if; end Save; procedure Create (Object : in out Wiki_Space_Impl; Session : in out ADO.Sessions.Master_Session'Class) is Query : ADO.Statements.Insert_Statement := Session.Create_Statement (WIKI_SPACE_DEF'Access); Result : Integer; begin Object.Version := 1; Session.Allocate (Id => Object); Query.Save_Field (Name => COL_0_2_NAME, -- id Value => Object.Get_Key); Query.Save_Field (Name => COL_1_2_NAME, -- name Value => Object.Name); Query.Save_Field (Name => COL_2_2_NAME, -- is_public Value => Object.Is_Public); Query.Save_Field (Name => COL_3_2_NAME, -- version Value => Object.Version); Query.Save_Field (Name => COL_4_2_NAME, -- create_date Value => Object.Create_Date); Query.Save_Field (Name => COL_5_2_NAME, -- left_side Value => Object.Left_Side); Query.Save_Field (Name => COL_6_2_NAME, -- right_side Value => Object.Right_Side); Query.Save_Field (Name => COL_7_2_NAME, -- format Value => Integer (Format_Type'Pos (Object.Format))); Query.Save_Field (Name => COL_8_2_NAME, -- workspace_id Value => Object.Workspace); Query.Execute (Result); if Result /= 1 then raise ADO.Objects.INSERT_ERROR; end if; ADO.Objects.Set_Created (Object); ADO.Audits.Save (Object, Session); end Create; procedure Delete (Object : in out Wiki_Space_Impl; Session : in out ADO.Sessions.Master_Session'Class) is Stmt : ADO.Statements.Delete_Statement := Session.Create_Statement (WIKI_SPACE_DEF'Access); begin Stmt.Set_Filter (Filter => "id = ?"); Stmt.Add_Param (Value => Object.Get_Key); Stmt.Execute; end Delete; -- ------------------------------ -- Get the bean attribute identified by the name. -- ------------------------------ overriding function Get_Value (From : in Wiki_Space_Ref; Name : in String) return Util.Beans.Objects.Object is Obj : ADO.Objects.Object_Record_Access; Impl : access Wiki_Space_Impl; begin if From.Is_Null then return Util.Beans.Objects.Null_Object; end if; Obj := From.Get_Load_Object; Impl := Wiki_Space_Impl (Obj.all)'Access; if Name = "id" then return ADO.Objects.To_Object (Impl.Get_Key); elsif Name = "name" then return Util.Beans.Objects.To_Object (Impl.Name); elsif Name = "is_public" then return Util.Beans.Objects.To_Object (Impl.Is_Public); elsif Name = "create_date" then return Util.Beans.Objects.Time.To_Object (Impl.Create_Date); elsif Name = "left_side" then return Util.Beans.Objects.To_Object (Impl.Left_Side); elsif Name = "right_side" then return Util.Beans.Objects.To_Object (Impl.Right_Side); elsif Name = "format" then return AWA.Wikis.Models.Format_Type_Objects.To_Object (Impl.Format); end if; return Util.Beans.Objects.Null_Object; end Get_Value; -- ------------------------------ -- Load the object from current iterator position -- ------------------------------ procedure Load (Object : in out Wiki_Space_Impl; Stmt : in out ADO.Statements.Query_Statement'Class; Session : in out ADO.Sessions.Session'Class) is begin Object.Set_Key_Value (Stmt.Get_Identifier (0)); Object.Name := Stmt.Get_Unbounded_String (1); Object.Is_Public := Stmt.Get_Boolean (2); Object.Create_Date := Stmt.Get_Time (4); Object.Left_Side := Stmt.Get_Unbounded_String (5); Object.Right_Side := Stmt.Get_Unbounded_String (6); Object.Format := Format_Type'Val (Stmt.Get_Integer (7)); if not Stmt.Is_Null (8) then Object.Workspace.Set_Key_Value (Stmt.Get_Identifier (8), Session); end if; Object.Version := Stmt.Get_Integer (3); ADO.Objects.Set_Created (Object); end Load; function Wiki_Page_Key (Id : in ADO.Identifier) return ADO.Objects.Object_Key is Result : ADO.Objects.Object_Key (Of_Type => ADO.Objects.KEY_INTEGER, Of_Class => WIKI_PAGE_DEF'Access); begin ADO.Objects.Set_Value (Result, Id); return Result; end Wiki_Page_Key; function Wiki_Page_Key (Id : in String) return ADO.Objects.Object_Key is Result : ADO.Objects.Object_Key (Of_Type => ADO.Objects.KEY_INTEGER, Of_Class => WIKI_PAGE_DEF'Access); begin ADO.Objects.Set_Value (Result, Id); return Result; end Wiki_Page_Key; function "=" (Left, Right : Wiki_Page_Ref'Class) return Boolean is begin return ADO.Objects.Object_Ref'Class (Left) = ADO.Objects.Object_Ref'Class (Right); end "="; procedure Set_Field (Object : in out Wiki_Page_Ref'Class; Impl : out Wiki_Page_Access) is Result : ADO.Objects.Object_Record_Access; begin Object.Prepare_Modify (Result); Impl := Wiki_Page_Impl (Result.all)'Access; end Set_Field; -- Internal method to allocate the Object_Record instance procedure Allocate (Object : in out Wiki_Page_Ref) is Impl : Wiki_Page_Access; begin Impl := new Wiki_Page_Impl; Impl.Last_Version := 0; Impl.Is_Public := False; Impl.Version := 0; Impl.Read_Count := 0; ADO.Objects.Set_Object (Object, Impl.all'Access); end Allocate; -- ---------------------------------------- -- Data object: Wiki_Page -- ---------------------------------------- procedure Set_Id (Object : in out Wiki_Page_Ref; Value : in ADO.Identifier) is Impl : Wiki_Page_Access; begin Set_Field (Object, Impl); ADO.Objects.Set_Field_Key_Value (Impl.all, 1, Value); end Set_Id; function Get_Id (Object : in Wiki_Page_Ref) return ADO.Identifier is Impl : constant Wiki_Page_Access := Wiki_Page_Impl (Object.Get_Object.all)'Access; begin return Impl.Get_Key_Value; end Get_Id; procedure Set_Name (Object : in out Wiki_Page_Ref; Value : in String) is Impl : Wiki_Page_Access; begin Set_Field (Object, Impl); ADO.Audits.Set_Field_String (Impl.all, 2, Impl.Name, Value); end Set_Name; procedure Set_Name (Object : in out Wiki_Page_Ref; Value : in Ada.Strings.Unbounded.Unbounded_String) is Impl : Wiki_Page_Access; begin Set_Field (Object, Impl); ADO.Audits.Set_Field_Unbounded_String (Impl.all, 2, Impl.Name, Value); end Set_Name; function Get_Name (Object : in Wiki_Page_Ref) return String is begin return Ada.Strings.Unbounded.To_String (Object.Get_Name); end Get_Name; function Get_Name (Object : in Wiki_Page_Ref) return Ada.Strings.Unbounded.Unbounded_String is Impl : constant Wiki_Page_Access := Wiki_Page_Impl (Object.Get_Load_Object.all)'Access; begin return Impl.Name; end Get_Name; procedure Set_Last_Version (Object : in out Wiki_Page_Ref; Value : in Integer) is Impl : Wiki_Page_Access; begin Set_Field (Object, Impl); ADO.Audits.Set_Field_Integer (Impl.all, 3, Impl.Last_Version, Value); end Set_Last_Version; function Get_Last_Version (Object : in Wiki_Page_Ref) return Integer is Impl : constant Wiki_Page_Access := Wiki_Page_Impl (Object.Get_Load_Object.all)'Access; begin return Impl.Last_Version; end Get_Last_Version; procedure Set_Is_Public (Object : in out Wiki_Page_Ref; Value : in Boolean) is Impl : Wiki_Page_Access; begin Set_Field (Object, Impl); ADO.Audits.Set_Field_Boolean (Impl.all, 4, Impl.Is_Public, Value); end Set_Is_Public; function Get_Is_Public (Object : in Wiki_Page_Ref) return Boolean is Impl : constant Wiki_Page_Access := Wiki_Page_Impl (Object.Get_Load_Object.all)'Access; begin return Impl.Is_Public; end Get_Is_Public; procedure Set_Title (Object : in out Wiki_Page_Ref; Value : in String) is Impl : Wiki_Page_Access; begin Set_Field (Object, Impl); ADO.Audits.Set_Field_String (Impl.all, 5, Impl.Title, Value); end Set_Title; procedure Set_Title (Object : in out Wiki_Page_Ref; Value : in Ada.Strings.Unbounded.Unbounded_String) is Impl : Wiki_Page_Access; begin Set_Field (Object, Impl); ADO.Audits.Set_Field_Unbounded_String (Impl.all, 5, Impl.Title, Value); end Set_Title; function Get_Title (Object : in Wiki_Page_Ref) return String is begin return Ada.Strings.Unbounded.To_String (Object.Get_Title); end Get_Title; function Get_Title (Object : in Wiki_Page_Ref) return Ada.Strings.Unbounded.Unbounded_String is Impl : constant Wiki_Page_Access := Wiki_Page_Impl (Object.Get_Load_Object.all)'Access; begin return Impl.Title; end Get_Title; function Get_Version (Object : in Wiki_Page_Ref) return Integer is Impl : constant Wiki_Page_Access := Wiki_Page_Impl (Object.Get_Load_Object.all)'Access; begin return Impl.Version; end Get_Version; procedure Set_Read_Count (Object : in out Wiki_Page_Ref; Value : in Integer) is Impl : Wiki_Page_Access; begin Set_Field (Object, Impl); ADO.Objects.Set_Field_Integer (Impl.all, 7, Impl.Read_Count, Value); end Set_Read_Count; function Get_Read_Count (Object : in Wiki_Page_Ref) return Integer is Impl : constant Wiki_Page_Access := Wiki_Page_Impl (Object.Get_Load_Object.all)'Access; begin return Impl.Read_Count; end Get_Read_Count; procedure Set_Preview (Object : in out Wiki_Page_Ref; Value : in AWA.Images.Models.Image_Ref'Class) is Impl : Wiki_Page_Access; begin Set_Field (Object, Impl); ADO.Objects.Set_Field_Object (Impl.all, 8, Impl.Preview, Value); end Set_Preview; function Get_Preview (Object : in Wiki_Page_Ref) return AWA.Images.Models.Image_Ref'Class is Impl : constant Wiki_Page_Access := Wiki_Page_Impl (Object.Get_Load_Object.all)'Access; begin return Impl.Preview; end Get_Preview; procedure Set_Wiki (Object : in out Wiki_Page_Ref; Value : in AWA.Wikis.Models.Wiki_Space_Ref'Class) is Impl : Wiki_Page_Access; begin Set_Field (Object, Impl); ADO.Objects.Set_Field_Object (Impl.all, 9, Impl.Wiki, Value); end Set_Wiki; function Get_Wiki (Object : in Wiki_Page_Ref) return AWA.Wikis.Models.Wiki_Space_Ref'Class is Impl : constant Wiki_Page_Access := Wiki_Page_Impl (Object.Get_Load_Object.all)'Access; begin return Impl.Wiki; end Get_Wiki; procedure Set_Content (Object : in out Wiki_Page_Ref; Value : in AWA.Wikis.Models.Wiki_Content_Ref'Class) is Impl : Wiki_Page_Access; begin Set_Field (Object, Impl); ADO.Objects.Set_Field_Object (Impl.all, 10, Impl.Content, Value); end Set_Content; function Get_Content (Object : in Wiki_Page_Ref) return AWA.Wikis.Models.Wiki_Content_Ref'Class is Impl : constant Wiki_Page_Access := Wiki_Page_Impl (Object.Get_Load_Object.all)'Access; begin return Impl.Content; end Get_Content; -- Copy of the object. procedure Copy (Object : in Wiki_Page_Ref; Into : in out Wiki_Page_Ref) is Result : Wiki_Page_Ref; begin if not Object.Is_Null then declare Impl : constant Wiki_Page_Access := Wiki_Page_Impl (Object.Get_Load_Object.all)'Access; Copy : constant Wiki_Page_Access := new Wiki_Page_Impl; begin ADO.Objects.Set_Object (Result, Copy.all'Access); Copy.Copy (Impl.all); Copy.Name := Impl.Name; Copy.Last_Version := Impl.Last_Version; Copy.Is_Public := Impl.Is_Public; Copy.Title := Impl.Title; Copy.Version := Impl.Version; Copy.Read_Count := Impl.Read_Count; Copy.Preview := Impl.Preview; Copy.Wiki := Impl.Wiki; Copy.Content := Impl.Content; end; end if; Into := Result; end Copy; procedure Find (Object : in out Wiki_Page_Ref; Session : in out ADO.Sessions.Session'Class; Query : in ADO.SQL.Query'Class; Found : out Boolean) is Impl : constant Wiki_Page_Access := new Wiki_Page_Impl; begin Impl.Find (Session, Query, Found); if Found then ADO.Objects.Set_Object (Object, Impl.all'Access); else ADO.Objects.Set_Object (Object, null); Destroy (Impl); end if; end Find; procedure Load (Object : in out Wiki_Page_Ref; Session : in out ADO.Sessions.Session'Class; Id : in ADO.Identifier) is Impl : constant Wiki_Page_Access := new Wiki_Page_Impl; Found : Boolean; Query : ADO.SQL.Query; begin Query.Bind_Param (Position => 1, Value => Id); Query.Set_Filter ("id = ?"); Impl.Find (Session, Query, Found); if not Found then Destroy (Impl); raise ADO.Objects.NOT_FOUND; end if; ADO.Objects.Set_Object (Object, Impl.all'Access); end Load; procedure Load (Object : in out Wiki_Page_Ref; Session : in out ADO.Sessions.Session'Class; Id : in ADO.Identifier; Found : out Boolean) is Impl : constant Wiki_Page_Access := new Wiki_Page_Impl; Query : ADO.SQL.Query; begin Query.Bind_Param (Position => 1, Value => Id); Query.Set_Filter ("id = ?"); Impl.Find (Session, Query, Found); if not Found then Destroy (Impl); else ADO.Objects.Set_Object (Object, Impl.all'Access); end if; end Load; procedure Save (Object : in out Wiki_Page_Ref; Session : in out ADO.Sessions.Master_Session'Class) is Impl : ADO.Objects.Object_Record_Access := Object.Get_Object; begin if Impl = null then Impl := new Wiki_Page_Impl; ADO.Objects.Set_Object (Object, Impl); end if; if not ADO.Objects.Is_Created (Impl.all) then Impl.Create (Session); else Impl.Save (Session); end if; end Save; procedure Delete (Object : in out Wiki_Page_Ref; Session : in out ADO.Sessions.Master_Session'Class) is Impl : constant ADO.Objects.Object_Record_Access := Object.Get_Object; begin if Impl /= null then Impl.Delete (Session); end if; end Delete; -- -------------------- -- Free the object -- -------------------- procedure Destroy (Object : access Wiki_Page_Impl) is type Wiki_Page_Impl_Ptr is access all Wiki_Page_Impl; procedure Unchecked_Free is new Ada.Unchecked_Deallocation (Wiki_Page_Impl, Wiki_Page_Impl_Ptr); pragma Warnings (Off, "*redundant conversion*"); Ptr : Wiki_Page_Impl_Ptr := Wiki_Page_Impl (Object.all)'Access; pragma Warnings (On, "*redundant conversion*"); begin Unchecked_Free (Ptr); end Destroy; procedure Find (Object : in out Wiki_Page_Impl; Session : in out ADO.Sessions.Session'Class; Query : in ADO.SQL.Query'Class; Found : out Boolean) is Stmt : ADO.Statements.Query_Statement := Session.Create_Statement (Query, WIKI_PAGE_DEF'Access); begin Stmt.Execute; if Stmt.Has_Elements then Object.Load (Stmt, Session); Stmt.Next; Found := not Stmt.Has_Elements; else Found := False; end if; end Find; overriding procedure Load (Object : in out Wiki_Page_Impl; Session : in out ADO.Sessions.Session'Class) is Found : Boolean; Query : ADO.SQL.Query; Id : constant ADO.Identifier := Object.Get_Key_Value; begin Query.Bind_Param (Position => 1, Value => Id); Query.Set_Filter ("id = ?"); Object.Find (Session, Query, Found); if not Found then raise ADO.Objects.NOT_FOUND; end if; end Load; procedure Save (Object : in out Wiki_Page_Impl; Session : in out ADO.Sessions.Master_Session'Class) is Stmt : ADO.Statements.Update_Statement := Session.Create_Statement (WIKI_PAGE_DEF'Access); begin if Object.Is_Modified (1) then Stmt.Save_Field (Name => COL_0_3_NAME, -- id Value => Object.Get_Key); Object.Clear_Modified (1); end if; if Object.Is_Modified (2) then Stmt.Save_Field (Name => COL_1_3_NAME, -- name Value => Object.Name); Object.Clear_Modified (2); end if; if Object.Is_Modified (3) then Stmt.Save_Field (Name => COL_2_3_NAME, -- last_version Value => Object.Last_Version); Object.Clear_Modified (3); end if; if Object.Is_Modified (4) then Stmt.Save_Field (Name => COL_3_3_NAME, -- is_public Value => Object.Is_Public); Object.Clear_Modified (4); end if; if Object.Is_Modified (5) then Stmt.Save_Field (Name => COL_4_3_NAME, -- title Value => Object.Title); Object.Clear_Modified (5); end if; if Object.Is_Modified (7) then Stmt.Save_Field (Name => COL_6_3_NAME, -- read_count Value => Object.Read_Count); Object.Clear_Modified (7); end if; if Object.Is_Modified (8) then Stmt.Save_Field (Name => COL_7_3_NAME, -- preview_id Value => Object.Preview); Object.Clear_Modified (8); end if; if Object.Is_Modified (9) then Stmt.Save_Field (Name => COL_8_3_NAME, -- wiki_id Value => Object.Wiki); Object.Clear_Modified (9); end if; if Object.Is_Modified (10) then Stmt.Save_Field (Name => COL_9_3_NAME, -- content_id Value => Object.Content); Object.Clear_Modified (10); end if; if Stmt.Has_Save_Fields then Object.Version := Object.Version + 1; Stmt.Save_Field (Name => "version", Value => Object.Version); Stmt.Set_Filter (Filter => "id = ? and version = ?"); Stmt.Add_Param (Value => Object.Get_Key); Stmt.Add_Param (Value => Object.Version - 1); declare Result : Integer; begin Stmt.Execute (Result); if Result /= 1 then if Result /= 0 then raise ADO.Objects.UPDATE_ERROR; else raise ADO.Objects.LAZY_LOCK; end if; end if; ADO.Audits.Save (Object, Session); end; end if; end Save; procedure Create (Object : in out Wiki_Page_Impl; Session : in out ADO.Sessions.Master_Session'Class) is Query : ADO.Statements.Insert_Statement := Session.Create_Statement (WIKI_PAGE_DEF'Access); Result : Integer; begin Object.Version := 1; Session.Allocate (Id => Object); Query.Save_Field (Name => COL_0_3_NAME, -- id Value => Object.Get_Key); Query.Save_Field (Name => COL_1_3_NAME, -- name Value => Object.Name); Query.Save_Field (Name => COL_2_3_NAME, -- last_version Value => Object.Last_Version); Query.Save_Field (Name => COL_3_3_NAME, -- is_public Value => Object.Is_Public); Query.Save_Field (Name => COL_4_3_NAME, -- title Value => Object.Title); Query.Save_Field (Name => COL_5_3_NAME, -- version Value => Object.Version); Query.Save_Field (Name => COL_6_3_NAME, -- read_count Value => Object.Read_Count); Query.Save_Field (Name => COL_7_3_NAME, -- preview_id Value => Object.Preview); Query.Save_Field (Name => COL_8_3_NAME, -- wiki_id Value => Object.Wiki); Query.Save_Field (Name => COL_9_3_NAME, -- content_id Value => Object.Content); Query.Execute (Result); if Result /= 1 then raise ADO.Objects.INSERT_ERROR; end if; ADO.Objects.Set_Created (Object); ADO.Audits.Save (Object, Session); end Create; procedure Delete (Object : in out Wiki_Page_Impl; Session : in out ADO.Sessions.Master_Session'Class) is Stmt : ADO.Statements.Delete_Statement := Session.Create_Statement (WIKI_PAGE_DEF'Access); begin Stmt.Set_Filter (Filter => "id = ?"); Stmt.Add_Param (Value => Object.Get_Key); Stmt.Execute; end Delete; -- ------------------------------ -- Get the bean attribute identified by the name. -- ------------------------------ overriding function Get_Value (From : in Wiki_Page_Ref; Name : in String) return Util.Beans.Objects.Object is Obj : ADO.Objects.Object_Record_Access; Impl : access Wiki_Page_Impl; begin if From.Is_Null then return Util.Beans.Objects.Null_Object; end if; Obj := From.Get_Load_Object; Impl := Wiki_Page_Impl (Obj.all)'Access; if Name = "id" then return ADO.Objects.To_Object (Impl.Get_Key); elsif Name = "name" then return Util.Beans.Objects.To_Object (Impl.Name); elsif Name = "last_version" then return Util.Beans.Objects.To_Object (Long_Long_Integer (Impl.Last_Version)); elsif Name = "is_public" then return Util.Beans.Objects.To_Object (Impl.Is_Public); elsif Name = "title" then return Util.Beans.Objects.To_Object (Impl.Title); elsif Name = "read_count" then return Util.Beans.Objects.To_Object (Long_Long_Integer (Impl.Read_Count)); end if; return Util.Beans.Objects.Null_Object; end Get_Value; -- ------------------------------ -- Load the object from current iterator position -- ------------------------------ procedure Load (Object : in out Wiki_Page_Impl; Stmt : in out ADO.Statements.Query_Statement'Class; Session : in out ADO.Sessions.Session'Class) is begin Object.Set_Key_Value (Stmt.Get_Identifier (0)); Object.Name := Stmt.Get_Unbounded_String (1); Object.Last_Version := Stmt.Get_Integer (2); Object.Is_Public := Stmt.Get_Boolean (3); Object.Title := Stmt.Get_Unbounded_String (4); Object.Read_Count := Stmt.Get_Integer (6); if not Stmt.Is_Null (7) then Object.Preview.Set_Key_Value (Stmt.Get_Identifier (7), Session); end if; if not Stmt.Is_Null (8) then Object.Wiki.Set_Key_Value (Stmt.Get_Identifier (8), Session); end if; if not Stmt.Is_Null (9) then Object.Content.Set_Key_Value (Stmt.Get_Identifier (9), Session); end if; Object.Version := Stmt.Get_Integer (5); ADO.Objects.Set_Created (Object); end Load; procedure Op_Load (Bean : in out Wiki_Image_Bean; Outcome : in out Ada.Strings.Unbounded.Unbounded_String); procedure Op_Load (Bean : in out Wiki_Image_Bean; Outcome : in out Ada.Strings.Unbounded.Unbounded_String) is begin Wiki_Image_Bean'Class (Bean).Load (Outcome); end Op_Load; package Binding_Wiki_Image_Bean_1 is new ASF.Events.Faces.Actions.Action_Method.Bind (Bean => Wiki_Image_Bean, Method => Op_Load, Name => "load"); Binding_Wiki_Image_Bean_Array : aliased constant Util.Beans.Methods.Method_Binding_Array := (1 => Binding_Wiki_Image_Bean_1.Proxy'Access ); -- ------------------------------ -- This bean provides some methods that can be used in a Method_Expression. -- ------------------------------ overriding function Get_Method_Bindings (From : in Wiki_Image_Bean) return Util.Beans.Methods.Method_Binding_Array_Access is pragma Unreferenced (From); begin return Binding_Wiki_Image_Bean_Array'Access; end Get_Method_Bindings; -- ------------------------------ -- Get the bean attribute identified by the name. -- ------------------------------ overriding function Get_Value (From : in Wiki_Image_Bean; Name : in String) return Util.Beans.Objects.Object is begin if Name = "folder_id" then return Util.Beans.Objects.To_Object (Long_Long_Integer (From.Folder_Id)); elsif Name = "id" then return Util.Beans.Objects.To_Object (Long_Long_Integer (From.Id)); elsif Name = "create_date" then if From.Create_Date.Is_Null then return Util.Beans.Objects.Null_Object; else return Util.Beans.Objects.Time.To_Object (From.Create_Date.Value); end if; elsif Name = "uri" then if From.Uri.Is_Null then return Util.Beans.Objects.Null_Object; else return Util.Beans.Objects.To_Object (From.Uri.Value); end if; elsif Name = "storage" then return AWA.Storages.Models.Storage_Type_Objects.To_Object (From.Storage); elsif Name = "mime_type" then if From.Mime_Type.Is_Null then return Util.Beans.Objects.Null_Object; else return Util.Beans.Objects.To_Object (From.Mime_Type.Value); end if; elsif Name = "file_size" then if From.File_Size.Is_Null then return Util.Beans.Objects.Null_Object; else return Util.Beans.Objects.To_Object (Long_Long_Integer (From.File_Size.Value)); end if; elsif Name = "width" then if From.Width.Is_Null then return Util.Beans.Objects.Null_Object; else return Util.Beans.Objects.To_Object (Long_Long_Integer (From.Width.Value)); end if; elsif Name = "height" then if From.Height.Is_Null then return Util.Beans.Objects.Null_Object; else return Util.Beans.Objects.To_Object (Long_Long_Integer (From.Height.Value)); end if; end if; return Util.Beans.Objects.Null_Object; end Get_Value; -- ------------------------------ -- Set the value identified by the name -- ------------------------------ overriding procedure Set_Value (Item : in out Wiki_Image_Bean; Name : in String; Value : in Util.Beans.Objects.Object) is begin if Name = "folder_id" then Item.Folder_Id := ADO.Identifier (Util.Beans.Objects.To_Long_Long_Integer (Value)); elsif Name = "id" then Item.Id := ADO.Identifier (Util.Beans.Objects.To_Long_Long_Integer (Value)); elsif Name = "create_date" then Item.Create_Date.Is_Null := Util.Beans.Objects.Is_Null (Value); if not Item.Create_Date.Is_Null then Item.Create_Date.Value := Util.Beans.Objects.Time.To_Time (Value); end if; elsif Name = "uri" then Item.Uri.Is_Null := Util.Beans.Objects.Is_Null (Value); if not Item.Uri.Is_Null then Item.Uri.Value := Util.Beans.Objects.To_Unbounded_String (Value); end if; elsif Name = "storage" then Item.Storage := AWA.Storages.Models.Storage_Type_Objects.To_Value (Value); elsif Name = "mime_type" then Item.Mime_Type.Is_Null := Util.Beans.Objects.Is_Null (Value); if not Item.Mime_Type.Is_Null then Item.Mime_Type.Value := Util.Beans.Objects.To_Unbounded_String (Value); end if; elsif Name = "file_size" then Item.File_Size.Is_Null := Util.Beans.Objects.Is_Null (Value); if not Item.File_Size.Is_Null then Item.File_Size.Value := Util.Beans.Objects.To_Integer (Value); end if; elsif Name = "width" then Item.Width.Is_Null := Util.Beans.Objects.Is_Null (Value); if not Item.Width.Is_Null then Item.Width.Value := Util.Beans.Objects.To_Integer (Value); end if; elsif Name = "height" then Item.Height.Is_Null := Util.Beans.Objects.Is_Null (Value); if not Item.Height.Is_Null then Item.Height.Value := Util.Beans.Objects.To_Integer (Value); end if; end if; end Set_Value; -- -------------------- -- Read in the object the data from the query result and prepare to read the next row. -- If there is no row, raise the ADO.NOT_FOUND exception. -- -------------------- procedure Read (Into : in out Wiki_Image_Bean; Stmt : in out ADO.Statements.Query_Statement'Class) is begin if not Stmt.Has_Elements then raise ADO.Objects.NOT_FOUND; end if; Into.Folder_Id := Stmt.Get_Identifier (0); Into.Id := Stmt.Get_Identifier (1); Into.Create_Date := Stmt.Get_Nullable_Time (2); Into.Uri := Stmt.Get_Nullable_String (3); Into.Storage := AWA.Storages.Models.Storage_Type'Val (Stmt.Get_Integer (4)); Into.Mime_Type := Stmt.Get_Nullable_String (5); Into.File_Size := Stmt.Get_Nullable_Integer (6); Into.Width := Stmt.Get_Nullable_Integer (7); Into.Height := Stmt.Get_Nullable_Integer (8); Stmt.Next; end Read; -- -------------------- -- Run the query controlled by <b>Context</b> and load the result in <b>Object</b>. -- -------------------- procedure Load (Object : in out Wiki_Image_Bean'Class; Session : in out ADO.Sessions.Session'Class; Context : in out ADO.Queries.Context'Class) is Stmt : ADO.Statements.Query_Statement := Session.Create_Statement (Context); begin Stmt.Execute; Read (Object, Stmt); if Stmt.Has_Elements then raise ADO.Objects.NOT_FOUND; end if; end Load; -- ------------------------------ -- Get the bean attribute identified by the name. -- ------------------------------ overriding function Get_Value (From : in Wiki_Image_Info; Name : in String) return Util.Beans.Objects.Object is begin if Name = "folder_id" then return Util.Beans.Objects.To_Object (Long_Long_Integer (From.Folder_Id)); elsif Name = "id" then return Util.Beans.Objects.To_Object (Long_Long_Integer (From.Id)); elsif Name = "create_date" then if From.Create_Date.Is_Null then return Util.Beans.Objects.Null_Object; else return Util.Beans.Objects.Time.To_Object (From.Create_Date.Value); end if; elsif Name = "uri" then if From.Uri.Is_Null then return Util.Beans.Objects.Null_Object; else return Util.Beans.Objects.To_Object (From.Uri.Value); end if; elsif Name = "storage" then return AWA.Storages.Models.Storage_Type_Objects.To_Object (From.Storage); elsif Name = "mime_type" then if From.Mime_Type.Is_Null then return Util.Beans.Objects.Null_Object; else return Util.Beans.Objects.To_Object (From.Mime_Type.Value); end if; elsif Name = "file_size" then if From.File_Size.Is_Null then return Util.Beans.Objects.Null_Object; else return Util.Beans.Objects.To_Object (Long_Long_Integer (From.File_Size.Value)); end if; elsif Name = "width" then if From.Width.Is_Null then return Util.Beans.Objects.Null_Object; else return Util.Beans.Objects.To_Object (Long_Long_Integer (From.Width.Value)); end if; elsif Name = "height" then if From.Height.Is_Null then return Util.Beans.Objects.Null_Object; else return Util.Beans.Objects.To_Object (Long_Long_Integer (From.Height.Value)); end if; end if; return Util.Beans.Objects.Null_Object; end Get_Value; -- ------------------------------ -- Set the value identified by the name -- ------------------------------ overriding procedure Set_Value (Item : in out Wiki_Image_Info; Name : in String; Value : in Util.Beans.Objects.Object) is begin if Name = "folder_id" then Item.Folder_Id := ADO.Identifier (Util.Beans.Objects.To_Long_Long_Integer (Value)); elsif Name = "id" then Item.Id := ADO.Identifier (Util.Beans.Objects.To_Long_Long_Integer (Value)); elsif Name = "create_date" then Item.Create_Date.Is_Null := Util.Beans.Objects.Is_Null (Value); if not Item.Create_Date.Is_Null then Item.Create_Date.Value := Util.Beans.Objects.Time.To_Time (Value); end if; elsif Name = "uri" then Item.Uri.Is_Null := Util.Beans.Objects.Is_Null (Value); if not Item.Uri.Is_Null then Item.Uri.Value := Util.Beans.Objects.To_Unbounded_String (Value); end if; elsif Name = "storage" then Item.Storage := AWA.Storages.Models.Storage_Type_Objects.To_Value (Value); elsif Name = "mime_type" then Item.Mime_Type.Is_Null := Util.Beans.Objects.Is_Null (Value); if not Item.Mime_Type.Is_Null then Item.Mime_Type.Value := Util.Beans.Objects.To_Unbounded_String (Value); end if; elsif Name = "file_size" then Item.File_Size.Is_Null := Util.Beans.Objects.Is_Null (Value); if not Item.File_Size.Is_Null then Item.File_Size.Value := Util.Beans.Objects.To_Integer (Value); end if; elsif Name = "width" then Item.Width.Is_Null := Util.Beans.Objects.Is_Null (Value); if not Item.Width.Is_Null then Item.Width.Value := Util.Beans.Objects.To_Integer (Value); end if; elsif Name = "height" then Item.Height.Is_Null := Util.Beans.Objects.Is_Null (Value); if not Item.Height.Is_Null then Item.Height.Value := Util.Beans.Objects.To_Integer (Value); end if; end if; end Set_Value; -- -------------------- -- Run the query controlled by <b>Context</b> and append the list in <b>Object</b>. -- -------------------- procedure List (Object : in out Wiki_Image_Info_List_Bean'Class; Session : in out ADO.Sessions.Session'Class; Context : in out ADO.Queries.Context'Class) is begin List (Object.List, Session, Context); end List; -- -------------------- -- The information about an image used in a wiki page. -- -------------------- procedure List (Object : in out Wiki_Image_Info_Vector; Session : in out ADO.Sessions.Session'Class; Context : in out ADO.Queries.Context'Class) is procedure Read (Into : in out Wiki_Image_Info); Stmt : ADO.Statements.Query_Statement := Session.Create_Statement (Context); Pos : Positive := 1; procedure Read (Into : in out Wiki_Image_Info) is begin Into.Folder_Id := Stmt.Get_Identifier (0); Into.Id := Stmt.Get_Identifier (1); Into.Create_Date := Stmt.Get_Nullable_Time (2); Into.Uri := Stmt.Get_Nullable_String (3); Into.Storage := AWA.Storages.Models.Storage_Type'Val (Stmt.Get_Integer (4)); Into.Mime_Type := Stmt.Get_Nullable_String (5); Into.File_Size := Stmt.Get_Nullable_Integer (6); Into.Width := Stmt.Get_Nullable_Integer (7); Into.Height := Stmt.Get_Nullable_Integer (8); end Read; begin Stmt.Execute; Wiki_Image_Info_Vectors.Clear (Object); while Stmt.Has_Elements loop Object.Insert_Space (Before => Pos); Object.Update_Element (Index => Pos, Process => Read'Access); Pos := Pos + 1; Stmt.Next; end loop; end List; -- ------------------------------ -- Get the bean attribute identified by the name. -- ------------------------------ overriding function Get_Value (From : in Wiki_Info; Name : in String) return Util.Beans.Objects.Object is begin if Name = "id" then return Util.Beans.Objects.To_Object (Long_Long_Integer (From.Id)); elsif Name = "name" then return Util.Beans.Objects.To_Object (From.Name); elsif Name = "is_public" then return Util.Beans.Objects.To_Object (From.Is_Public); elsif Name = "create_date" then return Util.Beans.Objects.Time.To_Object (From.Create_Date); elsif Name = "page_count" then return Util.Beans.Objects.To_Object (Long_Long_Integer (From.Page_Count)); end if; return Util.Beans.Objects.Null_Object; end Get_Value; -- ------------------------------ -- Set the value identified by the name -- ------------------------------ overriding procedure Set_Value (Item : in out Wiki_Info; Name : in String; Value : in Util.Beans.Objects.Object) is begin if Name = "id" then Item.Id := ADO.Identifier (Util.Beans.Objects.To_Long_Long_Integer (Value)); elsif Name = "name" then Item.Name := Util.Beans.Objects.To_Unbounded_String (Value); elsif Name = "is_public" then Item.Is_Public := Util.Beans.Objects.To_Boolean (Value); elsif Name = "create_date" then Item.Create_Date := Util.Beans.Objects.Time.To_Time (Value); elsif Name = "page_count" then Item.Page_Count := Util.Beans.Objects.To_Integer (Value); end if; end Set_Value; -- -------------------- -- Run the query controlled by <b>Context</b> and append the list in <b>Object</b>. -- -------------------- procedure List (Object : in out Wiki_Info_List_Bean'Class; Session : in out ADO.Sessions.Session'Class; Context : in out ADO.Queries.Context'Class) is begin List (Object.List, Session, Context); end List; -- -------------------- -- The list of wikis. -- -------------------- procedure List (Object : in out Wiki_Info_Vector; Session : in out ADO.Sessions.Session'Class; Context : in out ADO.Queries.Context'Class) is procedure Read (Into : in out Wiki_Info); Stmt : ADO.Statements.Query_Statement := Session.Create_Statement (Context); Pos : Positive := 1; procedure Read (Into : in out Wiki_Info) is begin Into.Id := Stmt.Get_Identifier (0); Into.Name := Stmt.Get_Unbounded_String (1); Into.Is_Public := Stmt.Get_Boolean (2); Into.Create_Date := Stmt.Get_Time (3); Into.Page_Count := Stmt.Get_Integer (4); end Read; begin Stmt.Execute; Wiki_Info_Vectors.Clear (Object); while Stmt.Has_Elements loop Object.Insert_Space (Before => Pos); Object.Update_Element (Index => Pos, Process => Read'Access); Pos := Pos + 1; Stmt.Next; end loop; end List; -- ------------------------------ -- Get the bean attribute identified by the name. -- ------------------------------ overriding function Get_Value (From : in Wiki_Page_Info; Name : in String) return Util.Beans.Objects.Object is begin if Name = "id" then return Util.Beans.Objects.To_Object (Long_Long_Integer (From.Id)); elsif Name = "name" then return Util.Beans.Objects.To_Object (From.Name); elsif Name = "title" then return Util.Beans.Objects.To_Object (From.Title); elsif Name = "is_public" then return Util.Beans.Objects.To_Object (From.Is_Public); elsif Name = "last_version" then return Util.Beans.Objects.To_Object (Long_Long_Integer (From.Last_Version)); elsif Name = "read_count" then return Util.Beans.Objects.To_Object (Long_Long_Integer (From.Read_Count)); elsif Name = "create_date" then return Util.Beans.Objects.Time.To_Object (From.Create_Date); elsif Name = "author" then return Util.Beans.Objects.To_Object (From.Author); end if; return Util.Beans.Objects.Null_Object; end Get_Value; -- ------------------------------ -- Set the value identified by the name -- ------------------------------ overriding procedure Set_Value (Item : in out Wiki_Page_Info; Name : in String; Value : in Util.Beans.Objects.Object) is begin if Name = "id" then Item.Id := ADO.Identifier (Util.Beans.Objects.To_Long_Long_Integer (Value)); elsif Name = "name" then Item.Name := Util.Beans.Objects.To_Unbounded_String (Value); elsif Name = "title" then Item.Title := Util.Beans.Objects.To_Unbounded_String (Value); elsif Name = "is_public" then Item.Is_Public := Util.Beans.Objects.To_Boolean (Value); elsif Name = "last_version" then Item.Last_Version := Util.Beans.Objects.To_Integer (Value); elsif Name = "read_count" then Item.Read_Count := Util.Beans.Objects.To_Integer (Value); elsif Name = "create_date" then Item.Create_Date := Util.Beans.Objects.Time.To_Time (Value); elsif Name = "author" then Item.Author := Util.Beans.Objects.To_Unbounded_String (Value); end if; end Set_Value; -- -------------------- -- Run the query controlled by <b>Context</b> and append the list in <b>Object</b>. -- -------------------- procedure List (Object : in out Wiki_Page_Info_List_Bean'Class; Session : in out ADO.Sessions.Session'Class; Context : in out ADO.Queries.Context'Class) is begin List (Object.List, Session, Context); end List; -- -------------------- -- The information about a wiki page. -- -------------------- procedure List (Object : in out Wiki_Page_Info_Vector; Session : in out ADO.Sessions.Session'Class; Context : in out ADO.Queries.Context'Class) is procedure Read (Into : in out Wiki_Page_Info); Stmt : ADO.Statements.Query_Statement := Session.Create_Statement (Context); Pos : Positive := 1; procedure Read (Into : in out Wiki_Page_Info) is begin Into.Id := Stmt.Get_Identifier (0); Into.Name := Stmt.Get_Unbounded_String (1); Into.Title := Stmt.Get_Unbounded_String (2); Into.Is_Public := Stmt.Get_Boolean (3); Into.Last_Version := Stmt.Get_Integer (4); Into.Read_Count := Stmt.Get_Integer (5); Into.Create_Date := Stmt.Get_Time (6); Into.Author := Stmt.Get_Unbounded_String (7); end Read; begin Stmt.Execute; Wiki_Page_Info_Vectors.Clear (Object); while Stmt.Has_Elements loop Object.Insert_Space (Before => Pos); Object.Update_Element (Index => Pos, Process => Read'Access); Pos := Pos + 1; Stmt.Next; end loop; end List; -- ------------------------------ -- Get the bean attribute identified by the name. -- ------------------------------ overriding function Get_Value (From : in Wiki_Version_Info; Name : in String) return Util.Beans.Objects.Object is begin if Name = "id" then return Util.Beans.Objects.To_Object (Long_Long_Integer (From.Id)); elsif Name = "comment" then return Util.Beans.Objects.To_Object (From.Comment); elsif Name = "create_date" then return Util.Beans.Objects.Time.To_Object (From.Create_Date); elsif Name = "page_version" then return Util.Beans.Objects.To_Object (Long_Long_Integer (From.Page_Version)); elsif Name = "author" then return Util.Beans.Objects.To_Object (From.Author); end if; return Util.Beans.Objects.Null_Object; end Get_Value; -- ------------------------------ -- Set the value identified by the name -- ------------------------------ overriding procedure Set_Value (Item : in out Wiki_Version_Info; Name : in String; Value : in Util.Beans.Objects.Object) is begin if Name = "id" then Item.Id := ADO.Identifier (Util.Beans.Objects.To_Long_Long_Integer (Value)); elsif Name = "comment" then Item.Comment := Util.Beans.Objects.To_Unbounded_String (Value); elsif Name = "create_date" then Item.Create_Date := Util.Beans.Objects.Time.To_Time (Value); elsif Name = "page_version" then Item.Page_Version := Util.Beans.Objects.To_Integer (Value); elsif Name = "author" then Item.Author := Util.Beans.Objects.To_Unbounded_String (Value); end if; end Set_Value; -- -------------------- -- Run the query controlled by <b>Context</b> and append the list in <b>Object</b>. -- -------------------- procedure List (Object : in out Wiki_Version_Info_List_Bean'Class; Session : in out ADO.Sessions.Session'Class; Context : in out ADO.Queries.Context'Class) is begin List (Object.List, Session, Context); end List; -- -------------------- -- The information about a wiki page version. -- -------------------- procedure List (Object : in out Wiki_Version_Info_Vector; Session : in out ADO.Sessions.Session'Class; Context : in out ADO.Queries.Context'Class) is procedure Read (Into : in out Wiki_Version_Info); Stmt : ADO.Statements.Query_Statement := Session.Create_Statement (Context); Pos : Positive := 1; procedure Read (Into : in out Wiki_Version_Info) is begin Into.Id := Stmt.Get_Identifier (0); Into.Comment := Stmt.Get_Unbounded_String (1); Into.Create_Date := Stmt.Get_Time (2); Into.Page_Version := Stmt.Get_Integer (3); Into.Author := Stmt.Get_Unbounded_String (4); end Read; begin Stmt.Execute; Wiki_Version_Info_Vectors.Clear (Object); while Stmt.Has_Elements loop Object.Insert_Space (Before => Pos); Object.Update_Element (Index => Pos, Process => Read'Access); Pos := Pos + 1; Stmt.Next; end loop; end List; procedure Op_Load (Bean : in out Wiki_View_Info; Outcome : in out Ada.Strings.Unbounded.Unbounded_String); procedure Op_Load (Bean : in out Wiki_View_Info; Outcome : in out Ada.Strings.Unbounded.Unbounded_String) is begin Wiki_View_Info'Class (Bean).Load (Outcome); end Op_Load; package Binding_Wiki_View_Info_1 is new ASF.Events.Faces.Actions.Action_Method.Bind (Bean => Wiki_View_Info, Method => Op_Load, Name => "load"); Binding_Wiki_View_Info_Array : aliased constant Util.Beans.Methods.Method_Binding_Array := (1 => Binding_Wiki_View_Info_1.Proxy'Access ); -- ------------------------------ -- This bean provides some methods that can be used in a Method_Expression. -- ------------------------------ overriding function Get_Method_Bindings (From : in Wiki_View_Info) return Util.Beans.Methods.Method_Binding_Array_Access is pragma Unreferenced (From); begin return Binding_Wiki_View_Info_Array'Access; end Get_Method_Bindings; -- ------------------------------ -- Get the bean attribute identified by the name. -- ------------------------------ overriding function Get_Value (From : in Wiki_View_Info; Name : in String) return Util.Beans.Objects.Object is begin if Name = "id" then return Util.Beans.Objects.To_Object (Long_Long_Integer (From.Id)); elsif Name = "name" then if From.Name.Is_Null then return Util.Beans.Objects.Null_Object; else return Util.Beans.Objects.To_Object (From.Name.Value); end if; elsif Name = "title" then if From.Title.Is_Null then return Util.Beans.Objects.Null_Object; else return Util.Beans.Objects.To_Object (From.Title.Value); end if; elsif Name = "is_public" then if From.Is_Public.Is_Null then return Util.Beans.Objects.Null_Object; else return Util.Beans.Objects.To_Object (From.Is_Public.Value); end if; elsif Name = "version" then if From.Version.Is_Null then return Util.Beans.Objects.Null_Object; else return Util.Beans.Objects.To_Object (Long_Long_Integer (From.Version.Value)); end if; elsif Name = "read_count" then if From.Read_Count.Is_Null then return Util.Beans.Objects.Null_Object; else return Util.Beans.Objects.To_Object (Long_Long_Integer (From.Read_Count.Value)); end if; elsif Name = "date" then if From.Date.Is_Null then return Util.Beans.Objects.Null_Object; else return Util.Beans.Objects.Time.To_Object (From.Date.Value); end if; elsif Name = "format" then if From.Format.Is_Null then return Util.Beans.Objects.Null_Object; else return Format_Type_Objects.To_Object (From.Format.Value); end if; elsif Name = "content" then if From.Content.Is_Null then return Util.Beans.Objects.Null_Object; else return Util.Beans.Objects.To_Object (From.Content.Value); end if; elsif Name = "save_comment" then if From.Save_Comment.Is_Null then return Util.Beans.Objects.Null_Object; else return Util.Beans.Objects.To_Object (From.Save_Comment.Value); end if; elsif Name = "left_side" then return Util.Beans.Objects.To_Object (From.Left_Side); elsif Name = "right_side" then return Util.Beans.Objects.To_Object (From.Right_Side); elsif Name = "side_format" then return AWA.Wikis.Models.Format_Type_Objects.To_Object (From.Side_Format); elsif Name = "author" then if From.Author.Is_Null then return Util.Beans.Objects.Null_Object; else return Util.Beans.Objects.To_Object (From.Author.Value); end if; elsif Name = "acl_id" then return Util.Beans.Objects.To_Object (Long_Long_Integer (From.Acl_Id)); end if; return Util.Beans.Objects.Null_Object; end Get_Value; -- ------------------------------ -- Set the value identified by the name -- ------------------------------ overriding procedure Set_Value (Item : in out Wiki_View_Info; Name : in String; Value : in Util.Beans.Objects.Object) is begin if Name = "id" then Item.Id := ADO.Identifier (Util.Beans.Objects.To_Long_Long_Integer (Value)); elsif Name = "name" then Item.Name.Is_Null := Util.Beans.Objects.Is_Null (Value); if not Item.Name.Is_Null then Item.Name.Value := Util.Beans.Objects.To_Unbounded_String (Value); end if; elsif Name = "title" then Item.Title.Is_Null := Util.Beans.Objects.Is_Null (Value); if not Item.Title.Is_Null then Item.Title.Value := Util.Beans.Objects.To_Unbounded_String (Value); end if; elsif Name = "is_public" then Item.Is_Public.Is_Null := Util.Beans.Objects.Is_Null (Value); if not Item.Is_Public.Is_Null then Item.Is_Public.Value := Util.Beans.Objects.To_Boolean (Value); end if; elsif Name = "version" then Item.Version.Is_Null := Util.Beans.Objects.Is_Null (Value); if not Item.Version.Is_Null then Item.Version.Value := Util.Beans.Objects.To_Integer (Value); end if; elsif Name = "read_count" then Item.Read_Count.Is_Null := Util.Beans.Objects.Is_Null (Value); if not Item.Read_Count.Is_Null then Item.Read_Count.Value := Util.Beans.Objects.To_Integer (Value); end if; elsif Name = "date" then Item.Date.Is_Null := Util.Beans.Objects.Is_Null (Value); if not Item.Date.Is_Null then Item.Date.Value := Util.Beans.Objects.Time.To_Time (Value); end if; elsif Name = "format" then Item.Format.Is_Null := Util.Beans.Objects.Is_Null (Value); if not Item.Format.Is_Null then Item.Format.Value := Format_Type_Objects.To_Value (Value); end if; elsif Name = "content" then Item.Content.Is_Null := Util.Beans.Objects.Is_Null (Value); if not Item.Content.Is_Null then Item.Content.Value := Util.Beans.Objects.To_Unbounded_String (Value); end if; elsif Name = "save_comment" then Item.Save_Comment.Is_Null := Util.Beans.Objects.Is_Null (Value); if not Item.Save_Comment.Is_Null then Item.Save_Comment.Value := Util.Beans.Objects.To_Unbounded_String (Value); end if; elsif Name = "left_side" then Item.Left_Side := Util.Beans.Objects.To_Unbounded_String (Value); elsif Name = "right_side" then Item.Right_Side := Util.Beans.Objects.To_Unbounded_String (Value); elsif Name = "side_format" then Item.Side_Format := AWA.Wikis.Models.Format_Type_Objects.To_Value (Value); elsif Name = "author" then Item.Author.Is_Null := Util.Beans.Objects.Is_Null (Value); if not Item.Author.Is_Null then Item.Author.Value := Util.Beans.Objects.To_Unbounded_String (Value); end if; elsif Name = "acl_id" then Item.Acl_Id := ADO.Identifier (Util.Beans.Objects.To_Long_Long_Integer (Value)); end if; end Set_Value; -- -------------------- -- Read in the object the data from the query result and prepare to read the next row. -- If there is no row, raise the ADO.NOT_FOUND exception. -- -------------------- procedure Read (Into : in out Wiki_View_Info; Stmt : in out ADO.Statements.Query_Statement'Class) is begin if not Stmt.Has_Elements then raise ADO.Objects.NOT_FOUND; end if; Into.Id := Stmt.Get_Identifier (0); Into.Name := Stmt.Get_Nullable_String (1); Into.Title := Stmt.Get_Nullable_String (2); Into.Is_Public := Stmt.Get_Nullable_Boolean (3); Into.Version := Stmt.Get_Nullable_Integer (4); Into.Read_Count := Stmt.Get_Nullable_Integer (5); Into.Date := Stmt.Get_Nullable_Time (6); Into.Format.Is_Null := Stmt.Is_Null (7); if not Into.Format.Is_Null then Into.Format.Value := AWA.Wikis.Models.Format_Type'Val (Stmt.Get_Integer (7)); end if; Into.Content := Stmt.Get_Nullable_String (8); Into.Save_Comment := Stmt.Get_Nullable_String (9); Into.Left_Side := Stmt.Get_Unbounded_String (10); Into.Right_Side := Stmt.Get_Unbounded_String (11); Into.Side_Format := AWA.Wikis.Models.Format_Type'Val (Stmt.Get_Integer (12)); Into.Author := Stmt.Get_Nullable_String (13); Into.Acl_Id := Stmt.Get_Identifier (14); Stmt.Next; end Read; -- -------------------- -- Run the query controlled by <b>Context</b> and load the result in <b>Object</b>. -- -------------------- procedure Load (Object : in out Wiki_View_Info'Class; Session : in out ADO.Sessions.Session'Class; Context : in out ADO.Queries.Context'Class) is Stmt : ADO.Statements.Query_Statement := Session.Create_Statement (Context); begin Stmt.Execute; Read (Object, Stmt); if Stmt.Has_Elements then raise ADO.Objects.NOT_FOUND; end if; end Load; procedure Op_Save (Bean : in out Wiki_Space_Bean; Outcome : in out Ada.Strings.Unbounded.Unbounded_String); procedure Op_Save (Bean : in out Wiki_Space_Bean; Outcome : in out Ada.Strings.Unbounded.Unbounded_String) is begin Wiki_Space_Bean'Class (Bean).Save (Outcome); end Op_Save; package Binding_Wiki_Space_Bean_1 is new ASF.Events.Faces.Actions.Action_Method.Bind (Bean => Wiki_Space_Bean, Method => Op_Save, Name => "save"); procedure Op_Load (Bean : in out Wiki_Space_Bean; Outcome : in out Ada.Strings.Unbounded.Unbounded_String); procedure Op_Load (Bean : in out Wiki_Space_Bean; Outcome : in out Ada.Strings.Unbounded.Unbounded_String) is begin Wiki_Space_Bean'Class (Bean).Load (Outcome); end Op_Load; package Binding_Wiki_Space_Bean_2 is new ASF.Events.Faces.Actions.Action_Method.Bind (Bean => Wiki_Space_Bean, Method => Op_Load, Name => "load"); Binding_Wiki_Space_Bean_Array : aliased constant Util.Beans.Methods.Method_Binding_Array := (1 => Binding_Wiki_Space_Bean_1.Proxy'Access, 2 => Binding_Wiki_Space_Bean_2.Proxy'Access ); -- ------------------------------ -- This bean provides some methods that can be used in a Method_Expression. -- ------------------------------ overriding function Get_Method_Bindings (From : in Wiki_Space_Bean) return Util.Beans.Methods.Method_Binding_Array_Access is pragma Unreferenced (From); begin return Binding_Wiki_Space_Bean_Array'Access; end Get_Method_Bindings; -- ------------------------------ -- Set the value identified by the name -- ------------------------------ overriding procedure Set_Value (Item : in out Wiki_Space_Bean; Name : in String; Value : in Util.Beans.Objects.Object) is begin if Name = "name" then Item.Set_Name (Util.Beans.Objects.To_String (Value)); elsif Name = "is_public" then Item.Set_Is_Public (Util.Beans.Objects.To_Boolean (Value)); elsif Name = "create_date" then Item.Set_Create_Date (Util.Beans.Objects.Time.To_Time (Value)); elsif Name = "left_side" then Item.Set_Left_Side (Util.Beans.Objects.To_String (Value)); elsif Name = "right_side" then Item.Set_Right_Side (Util.Beans.Objects.To_String (Value)); elsif Name = "format" then Item.Set_Format (Format_Type_Objects.To_Value (Value)); end if; end Set_Value; procedure Op_Save (Bean : in out Wiki_Page_Bean; Outcome : in out Ada.Strings.Unbounded.Unbounded_String); procedure Op_Save (Bean : in out Wiki_Page_Bean; Outcome : in out Ada.Strings.Unbounded.Unbounded_String) is begin Wiki_Page_Bean'Class (Bean).Save (Outcome); end Op_Save; package Binding_Wiki_Page_Bean_1 is new ASF.Events.Faces.Actions.Action_Method.Bind (Bean => Wiki_Page_Bean, Method => Op_Save, Name => "save"); procedure Op_Delete (Bean : in out Wiki_Page_Bean; Outcome : in out Ada.Strings.Unbounded.Unbounded_String); procedure Op_Delete (Bean : in out Wiki_Page_Bean; Outcome : in out Ada.Strings.Unbounded.Unbounded_String) is begin Wiki_Page_Bean'Class (Bean).Delete (Outcome); end Op_Delete; package Binding_Wiki_Page_Bean_2 is new ASF.Events.Faces.Actions.Action_Method.Bind (Bean => Wiki_Page_Bean, Method => Op_Delete, Name => "delete"); procedure Op_Load (Bean : in out Wiki_Page_Bean; Outcome : in out Ada.Strings.Unbounded.Unbounded_String); procedure Op_Load (Bean : in out Wiki_Page_Bean; Outcome : in out Ada.Strings.Unbounded.Unbounded_String) is begin Wiki_Page_Bean'Class (Bean).Load (Outcome); end Op_Load; package Binding_Wiki_Page_Bean_3 is new ASF.Events.Faces.Actions.Action_Method.Bind (Bean => Wiki_Page_Bean, Method => Op_Load, Name => "load"); procedure Op_Setup (Bean : in out Wiki_Page_Bean; Outcome : in out Ada.Strings.Unbounded.Unbounded_String); procedure Op_Setup (Bean : in out Wiki_Page_Bean; Outcome : in out Ada.Strings.Unbounded.Unbounded_String) is begin Wiki_Page_Bean'Class (Bean).Setup (Outcome); end Op_Setup; package Binding_Wiki_Page_Bean_4 is new ASF.Events.Faces.Actions.Action_Method.Bind (Bean => Wiki_Page_Bean, Method => Op_Setup, Name => "setup"); Binding_Wiki_Page_Bean_Array : aliased constant Util.Beans.Methods.Method_Binding_Array := (1 => Binding_Wiki_Page_Bean_1.Proxy'Access, 2 => Binding_Wiki_Page_Bean_2.Proxy'Access, 3 => Binding_Wiki_Page_Bean_3.Proxy'Access, 4 => Binding_Wiki_Page_Bean_4.Proxy'Access ); -- ------------------------------ -- This bean provides some methods that can be used in a Method_Expression. -- ------------------------------ overriding function Get_Method_Bindings (From : in Wiki_Page_Bean) return Util.Beans.Methods.Method_Binding_Array_Access is pragma Unreferenced (From); begin return Binding_Wiki_Page_Bean_Array'Access; end Get_Method_Bindings; -- ------------------------------ -- Set the value identified by the name -- ------------------------------ overriding procedure Set_Value (Item : in out Wiki_Page_Bean; Name : in String; Value : in Util.Beans.Objects.Object) is begin if Name = "name" then Item.Set_Name (Util.Beans.Objects.To_String (Value)); elsif Name = "last_version" then Item.Set_Last_Version (Util.Beans.Objects.To_Integer (Value)); elsif Name = "is_public" then Item.Set_Is_Public (Util.Beans.Objects.To_Boolean (Value)); elsif Name = "title" then Item.Set_Title (Util.Beans.Objects.To_String (Value)); elsif Name = "read_count" then Item.Set_Read_Count (Util.Beans.Objects.To_Integer (Value)); end if; end Set_Value; procedure Op_Load (Bean : in out Wiki_Page_List_Bean; Outcome : in out Ada.Strings.Unbounded.Unbounded_String); procedure Op_Load (Bean : in out Wiki_Page_List_Bean; Outcome : in out Ada.Strings.Unbounded.Unbounded_String) is begin Wiki_Page_List_Bean'Class (Bean).Load (Outcome); end Op_Load; package Binding_Wiki_Page_List_Bean_1 is new ASF.Events.Faces.Actions.Action_Method.Bind (Bean => Wiki_Page_List_Bean, Method => Op_Load, Name => "load"); Binding_Wiki_Page_List_Bean_Array : aliased constant Util.Beans.Methods.Method_Binding_Array := (1 => Binding_Wiki_Page_List_Bean_1.Proxy'Access ); -- ------------------------------ -- This bean provides some methods that can be used in a Method_Expression. -- ------------------------------ overriding function Get_Method_Bindings (From : in Wiki_Page_List_Bean) return Util.Beans.Methods.Method_Binding_Array_Access is pragma Unreferenced (From); begin return Binding_Wiki_Page_List_Bean_Array'Access; end Get_Method_Bindings; -- ------------------------------ -- Get the bean attribute identified by the name. -- ------------------------------ overriding function Get_Value (From : in Wiki_Page_List_Bean; Name : in String) return Util.Beans.Objects.Object is begin if Name = "page" then return Util.Beans.Objects.To_Object (Long_Long_Integer (From.Page)); elsif Name = "count" then return Util.Beans.Objects.To_Object (Long_Long_Integer (From.Count)); elsif Name = "page_size" then return Util.Beans.Objects.To_Object (Long_Long_Integer (From.Page_Size)); elsif Name = "tag" then return Util.Beans.Objects.To_Object (From.Tag); elsif Name = "wiki_id" then return Util.Beans.Objects.To_Object (Long_Long_Integer (From.Wiki_Id)); elsif Name = "sort" then return Util.Beans.Objects.To_Object (From.Sort); end if; return Util.Beans.Objects.Null_Object; end Get_Value; -- ------------------------------ -- Set the value identified by the name -- ------------------------------ overriding procedure Set_Value (Item : in out Wiki_Page_List_Bean; Name : in String; Value : in Util.Beans.Objects.Object) is begin if Name = "page" then Item.Page := Util.Beans.Objects.To_Integer (Value); elsif Name = "count" then Item.Count := Util.Beans.Objects.To_Integer (Value); elsif Name = "page_size" then Item.Page_Size := Util.Beans.Objects.To_Integer (Value); elsif Name = "tag" then Item.Tag := Util.Beans.Objects.To_Unbounded_String (Value); elsif Name = "wiki_id" then Item.Wiki_Id := ADO.Identifier (Util.Beans.Objects.To_Long_Long_Integer (Value)); elsif Name = "sort" then Item.Sort := Util.Beans.Objects.To_Unbounded_String (Value); end if; end Set_Value; procedure Op_Load (Bean : in out Wiki_Version_List_Bean; Outcome : in out Ada.Strings.Unbounded.Unbounded_String); procedure Op_Load (Bean : in out Wiki_Version_List_Bean; Outcome : in out Ada.Strings.Unbounded.Unbounded_String) is begin Wiki_Version_List_Bean'Class (Bean).Load (Outcome); end Op_Load; package Binding_Wiki_Version_List_Bean_1 is new ASF.Events.Faces.Actions.Action_Method.Bind (Bean => Wiki_Version_List_Bean, Method => Op_Load, Name => "load"); Binding_Wiki_Version_List_Bean_Array : aliased constant Util.Beans.Methods.Method_Binding_Array := (1 => Binding_Wiki_Version_List_Bean_1.Proxy'Access ); -- ------------------------------ -- This bean provides some methods that can be used in a Method_Expression. -- ------------------------------ overriding function Get_Method_Bindings (From : in Wiki_Version_List_Bean) return Util.Beans.Methods.Method_Binding_Array_Access is pragma Unreferenced (From); begin return Binding_Wiki_Version_List_Bean_Array'Access; end Get_Method_Bindings; -- ------------------------------ -- Get the bean attribute identified by the name. -- ------------------------------ overriding function Get_Value (From : in Wiki_Version_List_Bean; Name : in String) return Util.Beans.Objects.Object is begin if Name = "page" then return Util.Beans.Objects.To_Object (Long_Long_Integer (From.Page)); elsif Name = "count" then return Util.Beans.Objects.To_Object (Long_Long_Integer (From.Count)); elsif Name = "page_size" then return Util.Beans.Objects.To_Object (Long_Long_Integer (From.Page_Size)); elsif Name = "wiki_id" then return Util.Beans.Objects.To_Object (Long_Long_Integer (From.Wiki_Id)); elsif Name = "page_id" then return Util.Beans.Objects.To_Object (Long_Long_Integer (From.Page_Id)); end if; return Util.Beans.Objects.Null_Object; end Get_Value; -- ------------------------------ -- Set the value identified by the name -- ------------------------------ overriding procedure Set_Value (Item : in out Wiki_Version_List_Bean; Name : in String; Value : in Util.Beans.Objects.Object) is begin if Name = "page" then Item.Page := Util.Beans.Objects.To_Integer (Value); elsif Name = "count" then Item.Count := Util.Beans.Objects.To_Integer (Value); elsif Name = "page_size" then Item.Page_Size := Util.Beans.Objects.To_Integer (Value); elsif Name = "wiki_id" then Item.Wiki_Id := ADO.Identifier (Util.Beans.Objects.To_Long_Long_Integer (Value)); elsif Name = "page_id" then Item.Page_Id := ADO.Identifier (Util.Beans.Objects.To_Long_Long_Integer (Value)); end if; end Set_Value; procedure Op_Load (Bean : in out Wiki_Page_Info_Bean; Outcome : in out Ada.Strings.Unbounded.Unbounded_String); procedure Op_Load (Bean : in out Wiki_Page_Info_Bean; Outcome : in out Ada.Strings.Unbounded.Unbounded_String) is begin Wiki_Page_Info_Bean'Class (Bean).Load (Outcome); end Op_Load; package Binding_Wiki_Page_Info_Bean_1 is new ASF.Events.Faces.Actions.Action_Method.Bind (Bean => Wiki_Page_Info_Bean, Method => Op_Load, Name => "load"); Binding_Wiki_Page_Info_Bean_Array : aliased constant Util.Beans.Methods.Method_Binding_Array := (1 => Binding_Wiki_Page_Info_Bean_1.Proxy'Access ); -- ------------------------------ -- This bean provides some methods that can be used in a Method_Expression. -- ------------------------------ overriding function Get_Method_Bindings (From : in Wiki_Page_Info_Bean) return Util.Beans.Methods.Method_Binding_Array_Access is pragma Unreferenced (From); begin return Binding_Wiki_Page_Info_Bean_Array'Access; end Get_Method_Bindings; -- ------------------------------ -- Get the bean attribute identified by the name. -- ------------------------------ overriding function Get_Value (From : in Wiki_Page_Info_Bean; Name : in String) return Util.Beans.Objects.Object is begin if Name = "wiki_id" then return Util.Beans.Objects.To_Object (Long_Long_Integer (From.Wiki_Id)); elsif Name = "page_id" then return Util.Beans.Objects.To_Object (Long_Long_Integer (From.Page_Id)); end if; return Util.Beans.Objects.Null_Object; end Get_Value; -- ------------------------------ -- Set the value identified by the name -- ------------------------------ overriding procedure Set_Value (Item : in out Wiki_Page_Info_Bean; Name : in String; Value : in Util.Beans.Objects.Object) is begin if Name = "wiki_id" then Item.Wiki_Id := ADO.Identifier (Util.Beans.Objects.To_Long_Long_Integer (Value)); elsif Name = "page_id" then Item.Page_Id := ADO.Identifier (Util.Beans.Objects.To_Long_Long_Integer (Value)); end if; end Set_Value; end AWA.Wikis.Models;
reznikmm/matreshka
Ada
3,663
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$ ------------------------------------------------------------------------------ with XML.DOM.Attributes; package ODF.DOM.Attributes.Style.Letter_Kerning is type ODF_Style_Letter_Kerning is new XML.DOM.Attributes.DOM_Attribute with private; private type ODF_Style_Letter_Kerning is new XML.DOM.Attributes.DOM_Attribute with null record; end ODF.DOM.Attributes.Style.Letter_Kerning;
damaki/SPARKNaCl
Ada
499
adb
separate (SPARKNaCl) procedure Sanitize_Boolean (R : out Boolean) is begin R := False; -- Boolean'Pos (0) -- It seems an inspection point is not possible on R here, since -- it is passed by copy in a register -- pragma Inspection_Point (R); -- See RM H3.2 (9) -- Add target-dependent code here to -- 1. flush and invalidate data cache, -- 2. wait until writes have committed (e.g. a memory-fence instruction) -- 3. whatever else is required. end Sanitize_Boolean;
AdaCore/gpr
Ada
1,102
adb
-- -- Copyright (C) 2021-2023, AdaCore -- -- SPDX-License-Identifier: Apache-2.0 -- with Ada.Text_IO; with GPR2.Context; with GPR2.Log; with GPR2.Path_Name; with GPR2.Project.Tree; procedure Main is Tree : GPR2.Project.Tree.Object; Context : GPR2.Context.Object; use GPR2; procedure Print_Messages is begin if Tree.Has_Messages then for C in Tree.Log_Messages.Iterate (False, True, True, False, True, True) loop Ada.Text_IO.Put_Line (GPR2.Log.Element (C).Format); end loop; end if; end Print_Messages; procedure Test (Project_Name : GPR2.Filename_Type) is begin Ada.Text_IO.Put_Line ("testing " & String (Project_Name)); Tree.Unload; Tree.Load_Autoconf (Filename => GPR2.Path_Name.Create_File (GPR2.Project.Ensure_Extension (Project_Name), GPR2.Path_Name.No_Resolution), Context => Context); exception when Project_Error => Print_Messages; end Test; begin Test ("sa_lib3.gpr"); Test ("sa_lib4.gpr"); end Main;
reznikmm/matreshka
Ada
4,299
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.Text.Number_Position.Internals is ------------ -- Create -- ------------ function Create (Node : Matreshka.ODF_Attributes.Text.Number_Position.Text_Number_Position_Access) return ODF.DOM.Attributes.Text.Number_Position.ODF_Text_Number_Position 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.Text.Number_Position.Text_Number_Position_Access) return ODF.DOM.Attributes.Text.Number_Position.ODF_Text_Number_Position is begin return (XML.DOM.Attributes.Internals.Wrap (Matreshka.DOM_Nodes.Attribute_Access (Node)) with null record); end Wrap; end ODF.DOM.Attributes.Text.Number_Position.Internals;
AdaCore/gpr
Ada
95
ads
package Ada_Lib is procedure Do_It_In_Ada; pragma Export (C, Do_It_In_Ada); end Ada_Lib;
charlie5/lace
Ada
2,318
ads
private with ada.Strings.unbounded, ada.Containers.vectors; package XML -- -- Provides simple XML reader/writer support. -- -- Heavily based on Chip Richards Ada XML packages. -- is --- Attribute type -- type Attribute_t is tagged private; type Attributes_t is array (Positive range <>) of aliased Attribute_t; type Attributes_view is access all Attributes_t; function Name (Self : in Attribute_t) return String; function Value (Self : in Attribute_t) return String; --- Element type -- type Element is tagged private; type Elements is array (Positive range <>) of access Element; -- Construction -- function to_XML (Filename : in String) return Element; -- -- Parses 'Filename' and returns the root node Element of the parsed XML tree. -- Attributes -- function Name (Self : in Element) return String; function Attributes (Self : in Element) return Attributes_t; function Data (Self : in Element) return String; function Attribute (Self : in Element; Named : in String) return access Attribute_t'Class; -- -- Returns null if the named attribute does not exist. -- Hierachy -- function Parent (Self : in Element) return access Element; function Children (Self : in Element) return Elements; function Child (Self : in Element; Named : in String) return access Element; -- -- Returns null if the named child does not exist. function Children (Self : in Element; Named : in String) return Elements; procedure add_Child (Self : in out Element; the_Child : access Element); private use ada.Strings.unbounded; type Attribute_t is tagged record Name : unbounded_String; Value : unbounded_String; end record; type Element_view is access all Element; package element_Vectors is new ada.containers.Vectors (Positive, Element_view); subtype element_Vector is element_vectors.Vector; type Element is tagged record Name : unbounded_String; Attributes : Attributes_view; Data : unbounded_String; Parent : Element_view; Children : element_Vector; end record; end XML;
AdaDoom3/wayland_ada_binding
Ada
6,957
ads
------------------------------------------------------------------------------ -- Copyright (C) 2015-2016, AdaCore -- -- -- -- This library is free software; you can redistribute it and/or modify it -- -- under terms of the GNU General Public License as published by the Free -- -- Software Foundation; either version 3, or (at your option) any later -- -- version. This library is distributed in the hope that it will be useful, -- -- but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHAN- -- -- TABILITY or FITNESS FOR A PARTICULAR PURPOSE. -- -- -- -- As a special exception under Section 7 of GPL version 3, you are granted -- -- additional permissions described in the GCC Runtime Library Exception, -- -- version 3.1, as published by the Free Software Foundation. -- -- -- -- You should have received a copy of the GNU General Public License and -- -- a copy of the GCC Runtime Library Exception along with this program; -- -- see the files COPYING3 and COPYING.RUNTIME respectively. If not, see -- -- <http://www.gnu.org/licenses/>. -- -- -- ------------------------------------------------------------------------------ -- This package provides signature packages that describe how to iterate over -- containers. -- Such cursors do not provide access to the elements that are in the -- container, this is done via a separate instance of property maps (see -- the package Conts.Properties for more information). Separating the two -- concepts keeps them simpler: -- We currently provide Forward, Bidirectional and Random_Access cursors -- If accessing and modifying the elements was built into the concept of -- cursors, we would need an extra version for all of these to mean -- Constant_Forward, Constant_Bidirectional and Constant_Random_Access, and -- perhaps even a concept of Write_Only cursor (for output streams for -- instance). pragma Ada_2012; package Conts.Cursors with SPARK_Mode is --------------------- -- Forward_Cursors -- --------------------- -- A package that describes how to use forward cursors. Each container -- for which this is applicable provides an instance of this package, -- and algorithms should take this package as a generic parameter. generic type Container_Type (<>) is limited private; type Cursor_Type is private; No_Element : Cursor_Type; with function First (Self : Container_Type) return Cursor_Type is <>; with function Has_Element (Self : Container_Type; Pos : Cursor_Type) return Boolean is <>; with function Next (Self : Container_Type; Pos : Cursor_Type) return Cursor_Type is <>; with function "=" (Left, Right : Cursor_Type) return Boolean is <>; package Forward_Cursors is subtype Container is Container_Type; subtype Cursor is Cursor_Type; end Forward_Cursors; --------------------------- -- Bidirectional_Cursors -- --------------------------- generic type Container_Type (<>) is limited private; type Cursor_Type is private; No_Element : Cursor_Type; with function First (Self : Container_Type) return Cursor_Type is <>; with function Has_Element (Self : Container_Type; Pos : Cursor_Type) return Boolean is <>; with function Next (Self : Container_Type; Pos : Cursor_Type) return Cursor_Type is <>; with function Previous (Self : Container_Type; Pos : Cursor_Type) return Cursor_Type is <>; package Bidirectional_Cursors is subtype Container is Container_Type; subtype Cursor is Cursor_Type; -- A bidirectional cursor is also a forward cursor package Forward is new Forward_Cursors (Container, Cursor, No_Element); end Bidirectional_Cursors; ---------------------------- -- Random_Access_Cursors -- ---------------------------- -- These are cursors that can access any element from a container, in no -- specific order. generic type Container_Type (<>) is limited private; type Index_Type is (<>); No_Element : Index_Type; with function First (Self : Container_Type) return Index_Type is <>; -- Index of the first element in the container (often Index_Type'First) -- ??? Can we remove this parameter and always use Index_Type'First with function Last (Self : Container_Type) return Index_Type is <>; -- Return the index of the last valid element in the container. -- We do not use a Has_Element function, since having an explicit range -- is more convenient for algorithms (for instance to select random -- elements in the container). with function Distance (Left, Right : Index_Type) return Integer is <>; -- Return the number of elements between the two positions. with function "+" (Left : Index_Type; N : Integer) return Index_Type is <>; -- Move Left forward or backward by a number of position. package Random_Access_Cursors is subtype Container is Container_Type; subtype Index is Index_Type; function Dist (Left, Right : Index_Type) return Integer renames Distance; function Add (Left : Index_Type; N : Integer) return Index_Type renames "+"; function First_Index (Self : Container_Type) return Index_Type renames First; function Last_Index (Self : Container_Type) return Index_Type renames Last; -- Make visible to users of the package -- ??? Why is this necessary in Ada. function "-" (Left : Index_Type; N : Integer) return Index_Type is (Left + (-N)) with Inline; function Next (Self : Container_Type; Idx : Index_Type) return Index_Type is (Idx + 1) with Inline; function Previous (Self : Container_Type; Idx : Index_Type) return Index_Type is (Idx - 1) with Inline; function Has_Element (Self : Container_Type; Idx : Index_Type) return Boolean is (Idx >= First (Self) and then Idx <= Last (Self)) with Inline; -- This might be made efficient if you pass a First function that -- returns a constant and if this contstant is Index_Type'First then -- the compiler can simply remove the test. -- A random cursor is also a bidirectional and forward cursor package Bidirectional is new Bidirectional_Cursors (Container, Index_Type, No_Element); package Forward renames Bidirectional.Forward; end Random_Access_Cursors; end Conts.Cursors;
charlie5/playAda
Ada
448
ads
with float_Math.Geometry .d2, float_Math.Geometry .d3, float_math.Algebra.linear.d3; package Gasp -- -- Provides a namespace and core declarations for the 'Gasp' game. -- is pragma Pure; package Math renames float_Math; package Geometry_2d renames Math.Geometry.d2; package Geometry_3d renames Math.Geometry.d3; package linear_Algebra_3d renames Math.Algebra.linear.d3; end Gasp;
davidkristola/vole
Ada
19,836
adb
with Ada.Exceptions; use Ada.Exceptions; with Ada.Text_IO; with kv.avm.Log; use kv.avm.Log; with kv.avm.Actors; with kv.avm.Messages; with kv.avm.Actor_Pool; with kv.avm.Executables; with kv.avm.Actor_References.Sets; package body kv.avm.Machines is use Interfaces; use kv.avm.Control; use kv.avm.Executables; use kv.avm.Executable_Lists; ----------------------------------------------------------------------------- procedure Initialize (Self : in out Machine_Type; Processor : in kv.avm.Processors.Processor_Access; Factory : in kv.avm.Executables.Factory_Access) is begin Self.Processor := Processor; Self.Factory := Factory; Self.Future := kv.avm.control.NO_FUTURE; Self.Router.Initialize(kv.avm.Control.Control_Interface(Self)'UNCHECKED_ACCESS); Self.Steps := 0; Self.Cursor := 0; Self.Reaped := 0; Self.Cycles := 0; for List in Self.Lists'RANGE loop Self.Lists(List).Initialize(List); end loop; end Initialize; ----------------------------------------------------------------------------- function Get_Router(Self : Machine_Type) return kv.avm.Routers.Router_Type is begin return Self.Router; end Get_Router; ----------------------------------------------------------------------------- function Check_For_Beginning_Of_Cycle(Self : Machine_Type) return Boolean is begin -- If the cursor has advanced down to zero (remember, it moves down) return Self.Cursor = 0; end Check_For_Beginning_Of_Cycle; ----------------------------------------------------------------------------- function Check_Message_Delivery_Policy(Self : Machine_Type) return Boolean is begin -- Always deliver messages at the beginning of the cycle return True; end Check_Message_Delivery_Policy; ----------------------------------------------------------------------------- function Check_Undeferral_Policy(Self : Machine_Type) return Boolean is begin -- If there are still no actor instances ready to run, undefer the deferred ones if Self.Router.Get_Queue_Size < 100 then return True; end if; return Self.Lists(Active).Get_Last = 0; end Check_Undeferral_Policy; ----------------------------------------------------------------------------- function Check_Garbage_Collection_Policy(Self : Machine_Type) return Boolean is begin -- Collect garbage if we have a buildup of idle actor instances return Natural(Self.Lists(Idle).Get_Last) > (Self.Old_Idle + Self.Garbage_Trigger); end Check_Garbage_Collection_Policy; ----------------------------------------------------------------------------- procedure Beginning_Of_Cycle (Self : in out Machine_Type) is begin Self.Cycles := Self.Cycles + 1; if self.Check_Message_Delivery_Policy then Self.Router.Deliver_Messages; end if; if Self.Check_Undeferral_Policy then Self.Undefer; end if; if self.Check_Garbage_Collection_Policy then Self.Garbage_Collection; end if; Self.Cursor := Self.Lists(Active).Get_Last; -- Restart the cursor exception when Error: others => Put_Error("EXCEPTION (in Beginning_Of_Cycle): " & Exception_Information(Error)); raise; end Beginning_Of_Cycle; ----------------------------------------------------------------------------- procedure Process_Current_Executable (Self : in out Machine_Type) is Working : kv.avm.Executables.Executable_Access; Status : kv.avm.Control.Status_Type; begin Working := Self.Lists(Active).Get(Self.Cursor); if Working.Is_Running then Working.Step(Self.Processor, Status); if Status /= Active then --Put_Line("Machine Instance Control: deactivating " & Working.Image & " because it returned status = " & Status_Type'IMAGE(Status)); --TODO: use the returned status to figure out what to do with the executable. Self.Lists(Status).Acquire_From(Self.Cursor, Self.Lists(Active)); end if; else Put_Line("Non-running instance is in the active list, moving " & Working.Image & " to the idle list"); Self.Lists(Idle).Acquire_From(Self.Cursor, Self.Lists(Active)); end if; Self.Cursor := Self.Cursor - 1; end Process_Current_Executable; ----------------------------------------------------------------------------- procedure Step (Self : in out Machine_Type) is begin Self.Steps := Self.Steps + 1; if Self.Check_For_Beginning_Of_Cycle then self.Beginning_Of_Cycle; end if; if Self.Cursor /= 0 then Self.Process_Current_Executable; end if; exception when Error: others => Put_Error("EXCEPTION (in Step): " & Exception_Information(Error)); raise; end Step; ----------------------------------------------------------------------------- function Current_Instance(Self : Machine_Type) return kv.avm.Executables.Executable_Access is begin if Self.Cursor = 0 then return Self.Lists(Active).Get(Self.Lists(Active).Get_Last); end if; return Self.Lists(Active).Get(Self.Cursor); end Current_Instance; ----------------------------------------------------------------------------- function Done(Self : Machine_Type) return Boolean is begin return Self.Lists(Active).Get_Last = 0; end Done; ----------------------------------------------------------------------------- function Get_Steps(Self : Machine_Type) return Natural is begin return Self.Steps; end Get_Steps; ----------------------------------------------------------------------------- function Get_Total(Self : Machine_Type) return Natural is Count : Natural := 0; begin for Status in Active .. Idle loop Count := Count + Natural(Self.Lists(Status).Get_Last); end loop; return Count; end Get_Total; ----------------------------------------------------------------------------- function Get_Active(Self : Machine_Type) return Natural is begin return Natural(Self.Lists(Active).Get_Last); end Get_Active; ----------------------------------------------------------------------------- function Get_Idle(Self : Machine_Type) return Natural is begin return Natural(Self.Lists(Idle).Get_Last); end Get_Idle; ----------------------------------------------------------------------------- function Get_Blocked(Self : Machine_Type) return Natural is begin return Natural(Self.Lists(Blocked).Get_Last); end Get_Blocked; ----------------------------------------------------------------------------- function Get_Deferred(Self : Machine_Type) return Natural is begin return Natural(Self.Lists(Deferred).Get_Last); end Get_Deferred; ----------------------------------------------------------------------------- function Get_Queue_Size(Self : Machine_Type) return Natural is begin return Self.Router.Get_Queue_Size; end Get_Queue_Size; ----------------------------------------------------------------------------- procedure Set_Queue_Limit(Self : in out Machine_Type; Queue_Limit : in Natural) is begin Self.Router.Set_Queue_Limit(Queue_Limit); end Set_Queue_Limit; ----------------------------------------------------------------------------- function Get_Cycles(Self : Machine_Type) return Natural is begin return Self.Cycles; end Get_Cycles; ----------------------------------------------------------------------------- function Get_Reaped(Self : Machine_Type) return Natural is begin return Self.Reaped; end Get_Reaped; ----------------------------------------------------------------------------- procedure Set_Capabilities(Self : in out Machine_Type; Capabilities : in kv.avm.Capabilities.Capabilities_Type) is begin Self.Capabilities := Capabilities; end Set_Capabilities; ----------------------------------------------------------------------------- procedure Set_Garbage_Trigger(Self : in out Machine_Type; Garbage_Trigger : in Natural) is begin Self.Garbage_Trigger := Garbage_Trigger; end Set_Garbage_Trigger; ----------------------------------------------------------------------------- procedure Deliver_Messages (Self : in out Machine_Type) is begin Self.Router.Deliver_Messages; end Deliver_Messages; ----------------------------------------------------------------------------- -- Internal method procedure Undefer (Self : in out Machine_Type) is Current : kv.avm.Executable_Lists.Cursor_Type; Working : kv.avm.Executables.Executable_Access; begin Current := Self.Lists(Deferred).Get_Last; while Current /= 0 loop Working := Self.Lists(Deferred).Get(Current); if Working.Is_Running then Self.Lists(Active).Acquire_From(Current, Self.Lists(Deferred)); end if; Current := Current - 1; end loop; exception when Error: others => Put_Error("EXCEPTION (in Undefer): " & Exception_Information(Error)); raise; end Undefer; ----------------------------------------------------------------------------- -- Internal method function Non_Idle(Self : Machine_Type) return kv.avm.Actor_References.Sets.Set is Current : kv.avm.Executable_Lists.Cursor_Type; Working : kv.avm.Executables.Executable_Access; Collection : kv.avm.Actor_References.Sets.Set := kv.avm.Actor_References.Sets.Empty_Set; begin for Status in Running_Status_Type loop Current := Self.Lists(Status).Get_Last; while Current /= 0 loop Working := Self.Lists(Status).Get(Current); Collection.Union(Working.Reachable); Current := Current - 1; end loop; end loop; return Collection; exception when Error: others => Put_Error("EXCEPTION (in Non_Idle): " & Exception_Information(Error)); raise; end Non_Idle; ----------------------------------------------------------------------------- -- Internal method function Expand_Reachable_Set (Self : Machine_Type; Starting : kv.avm.Actor_References.Sets.Set) return kv.avm.Actor_References.Sets.Set is use kv.avm.Actor_References.Sets; use kv.avm.Actor_References; Working : kv.avm.Executables.Executable_Access; Could_Run : Set; Added : Set; Expand : Set; Reach : Set; Check : Cursor; Reference : Actor_Reference_Type; begin Could_Run := Starting; Expand := Starting; loop -- Go through everything in Could_Run and see if all if its rachables are in the list. -- If not, add them and try it again. Added := Empty_Set; Check := Expand.First; while Check /= No_Element loop Reference := Element(Check); Working := kv.avm.Actor_Pool.Resolve(Reference); Reach := Working.Reachable; Added.Union(Reach - Could_Run); Next(Check); end loop; exit when Added = Empty_Set; --Ada.Text_IO.Put_Line("*** Garbage_Collection, adding some to Could_Run"); Could_Run.Union(Added); Expand := Added; end loop; return Could_Run; exception when Error: others => Put_Error("EXCEPTION (in Expand_Reachable_Set): " & Exception_Information(Error)); raise; end Expand_Reachable_Set; ----------------------------------------------------------------------------- -- Internal method procedure Delete_Unreachable_Executables (Self : in out Machine_Type; Reachable : in kv.avm.Actor_References.Sets.Set) is Current : kv.avm.Executable_Lists.Cursor_Type; Working : kv.avm.Executables.Executable_Access; Reference : kv.avm.Actor_References.Actor_Reference_Type; begin Current := Self.Lists(Idle).Get_Last; while Current /= 0 loop Reference := Self.Lists(Idle).Get_Handle(Current).Get_Reference; if not Reachable.Contains(Reference) then Working := Self.Lists(Idle).Get(Current); Put_Line("Deleting unreachable idle executable " & Working.Image); Self.Lists(Idle).Delete(Current); kv.avm.Actor_Pool.Delete(Reference); Self.Reaped := Self.Reaped + 1; end if; Current := Current - 1; end loop; exception when Error: others => Put_Error("EXCEPTION (in Delete_Unreachable_Executables): " & Exception_Information(Error)); raise; end Delete_Unreachable_Executables; ----------------------------------------------------------------------------- -- Internal method procedure Garbage_Collection (Self : in out Machine_Type) is use kv.avm.Actor_References.Sets; Reachable : Set; begin Put_Line("Running Garbage_Collection"); Reachable := Union(Self.Non_Idle, Self.Router.Reachable_From_Messages); --TODO: add all machine pending callbacks (not implemented yet) Reachable := Self.Expand_Reachable_Set(Reachable); Self.Delete_Unreachable_Executables(Reachable); Self.Old_Idle := Natural(Self.Lists(Idle).Get_Last); exception when Error: others => Put_Error("EXCEPTION (in Garbage_Collection): " & Exception_Information(Error)); raise; end Garbage_Collection; ----------------------------------------------------------------------------- -- Internal method procedure Activate_Instance (Self : in out Machine_Type; Instance : in kv.avm.Executables.Executable_Access) is Location : kv.avm.Executable_Lists.Cursor_Type; begin Location := Self.Lists(Deferred).Find(Instance); if Location /= 0 then Self.Lists(Active).Acquire_From(Location, Self.Lists(Deferred)); else Location := Self.Lists(Idle).Find(Instance); if Location /= 0 then Self.Lists(Active).Acquire_From(Location, Self.Lists(Idle)); else Location := Self.Lists(Blocked).Find(Instance); if Location /= 0 then Self.Lists(Active).Acquire_From(Location, Self.Lists(Blocked)); end if; end if; end if; exception when Error: others => Put_Error("EXCEPTION (in Activate_Instance): " & Exception_Information(Error)); raise; end Activate_Instance; ----------------------------------------------------------------------------- procedure New_Actor (Self : in out Machine_Type; Name : in String; Instance : out kv.avm.Actor_References.Actor_Reference_Type) is Actor_Pointer : kv.avm.Actors.Actor_Access; Instance_Pointer : kv.avm.Executables.Executable_Access; Empty_Data : kv.avm.Tuples.Tuple_Type; use kv.avm.Actors; begin --Put_Line("kv.avm.machine.New_Actor "&Name); Actor_Pointer := kv.avm.Actors.Get_Actor_By_Name(Name); if Actor_Pointer = null then Put_Line("ERROR: kv.avm.machine.New_Actor, Actor_Pointer is null because <"&Name&"> could not be found."); raise Machine_Error; end if; Self.Factory.New_Executable(Actor_Pointer, Self'UNCHECKED_ACCESS, Instance_Pointer, Instance); Put_Line("Machine Instance Control: adding " & Instance_Pointer.Image); Self.Lists(Active).Add(Instance_Pointer, Instance); exception when Error: others => Put_Error("EXCEPTION (in New_Actor): " & Exception_Information(Error)); raise; end New_Actor; ----------------------------------------------------------------------------- procedure Post_Message (Self : in out Machine_Type; Message : in kv.avm.Messages.Message_Type; Status : out kv.avm.Control.Status_Type) is begin Self.Router.Post_Message(Message, Status); end Post_Message; ----------------------------------------------------------------------------- procedure Post_Response (Self : in out Machine_Type; Reply_To : in kv.avm.Actor_References.Actor_Reference_Type; Answer : in kv.avm.Tuples.Tuple_Type; Future : in Interfaces.Unsigned_32) is begin Self.Router.Post_Response(Reply_To, Answer, Future); end Post_Response; ----------------------------------------------------------------------------- procedure Generate_Next_Future (Self : in out Machine_Type; Future : out Interfaces.Unsigned_32) is begin Self.Future := Self.Future + 1; Future := Self.Future; end Generate_Next_Future; ----------------------------------------------------------------------------- procedure Trap_To_The_Machine (Self : in out Machine_Type; Trap : in String; Data : in kv.avm.Registers.Register_Type; Answer : out kv.avm.Registers.Register_Type; Status : out kv.avm.Control.Status_Type) is begin Put_Line("Machine_Type.Trap_To_The_Machine called with name = '"&Trap&"'"); Self.Capabilities.Execute(Trap, Self, Data, Answer, Status); exception when Error: others => Put_Error("EXCEPTION (in Trap_To_The_Machine): " & Exception_Information(Error)); raise; end Trap_To_The_Machine; ----------------------------------------------------------------------------- procedure Activate_Instance (Self : in out Machine_Type; Instance : in kv.avm.Actor_References.Actor_Reference_Type) is Executable : kv.avm.Executables.Executable_Access; begin Executable := kv.avm.actor_pool.Resolve(Instance); Self.Activate_Instance(Executable); end Activate_Instance; ----------------------------------------------------------------------------- procedure Start_With (Self : in out Machine_Type; Actor : in String; Message : in String; Data : in kv.avm.Memories.Register_Array_Type) is Instance : kv.avm.Actor_References.Actor_Reference_Type; Content : aliased kv.avm.Tuples.Tuple_Type; Empty_Tuple : aliased kv.avm.Tuples.Tuple_Type; Status : kv.avm.Control.Status_Type; Constructor_Message : kv.avm.Messages.Message_Type; Go_Message : kv.avm.Messages.Message_Type; begin Self.New_Actor(Actor, Instance); Empty_Tuple.Initialize; Empty_Tuple.Fold_Empty; Constructor_Message.Initialize (Source => kv.avm.Actor_References.Null_Reference, Reply_To => kv.avm.Actor_References.Null_Reference, Destination => Instance, Message_Name => "CONSTRUCTOR", Data => Empty_Tuple, Future => kv.avm.Control.NO_FUTURE); Self.Post_Message (Message => Constructor_Message, Status => Status); Content.Initialize; Content.Fold(Data); Go_Message.Initialize (Source => kv.avm.Actor_References.Null_Reference, Reply_To => kv.avm.Actor_References.Null_Reference, Destination => Instance, Message_Name => Message, Data => Content, Future => kv.avm.Control.NO_FUTURE); Self.Post_Message (Message => Go_Message, Status => Status); exception when Error: others => Put_Error("EXCEPTION (in Start_With): " & Exception_Information(Error)); raise; end Start_With; end kv.avm.Machines;
landgraf/nanomsg-ada
Ada
11,738
adb
-- The MIT License (MIT) -- Copyright (c) 2015 Pavel Zhukov <[email protected]> -- Permission is hereby granted, free of charge, to any person obtaining a copy -- of this software and associated documentation files (the "Software"), to deal -- in the Software without restriction, including without limitation the rights -- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -- copies of the Software, and to permit persons to whom the Software is -- furnished to do so, subject to the following conditions: -- The above copyright notice and this permission notice shall be included in all -- copies or substantial portions of the Software. -- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -- SOFTWARE. with Ada.Unchecked_Conversion; with Ada.Unchecked_Deallocation; with Ada.Streams; with Interfaces.C.Strings; with Interfaces.C.Pointers; with Nanomsg.Errors; with Nanomsg.Sockopt; with System; with Syserrors; use type Syserrors.Errno; with Nanomsg.Socket_Pools; package body Nanomsg.Socket is package C renames Interfaces.C; use type C.Int; function Is_Null (Obj : in Socket_T) return Boolean is (Obj.Fd = -1); procedure Init (Obj : out Socket_T; Domain : in Nanomsg.Domains.Domain_T; Protocol : in Protocol_T ) is function C_Nn_Socket (Domain : in C.Int; Protocol : in C.Int) return C.Int with Import, Convention => C, External_Name => "nn_socket"; begin Obj.Fd := Integer (C_Nn_Socket (Nanomsg.Domains.To_C (Domain), C.Int (Protocol))); if Obj.Fd < 0 then raise Socket_Exception with "Init: " & Nanomsg.Errors.Errno_Text; end if; end Init; procedure Close (Obj : in out Socket_T) is function C_Nn_Close (Socket : in C.Int) return C.Int with Import, Convention => C, External_Name => "nn_close"; begin Obj.Delete_Endpoint; if C_Nn_Close (C.Int (Obj.Fd)) /= 0 then raise Socket_Exception with "Close: " & Nanomsg.Errors.Errno_Text; end if; Obj.Fd := -1; end Close; procedure Bind (Obj : in out Socket_T; Address : in String) is function C_Bind (Socket : in C.Int; Address : in C.Strings.Chars_Ptr) return C.Int with Import, Convention => C, External_Name => "nn_bind"; C_Address : C.Strings.Chars_Ptr := C.Strings.New_String (Address); begin Obj.Endpoint := Integer (C_Bind(C.Int (Obj.Fd), C_Address)); C.Strings.Free (C_Address); if Obj.Endpoint < 0 then raise Socket_Exception with "Bind: " & Nanomsg.Errors.Errno_Text; end if; -- FIXME -- Add endpoints container end Bind; procedure Connect (Obj : in out Socket_T; Address : in String) is function C_Connect (Socket : in C.Int; Address : in C.Strings.Chars_Ptr) return C.Int with Import, Convention => C, External_Name => "nn_connect"; C_Address : C.Strings.Chars_Ptr := C.Strings.New_String (Address); begin Obj.Endpoint := Integer (C_Connect(C.Int (Obj.Fd), C_Address)); C.Strings.Free (C_Address); if Obj.Endpoint < 0 then raise Socket_Exception with "Connect: " & Nanomsg.Errors.Errno_Text; end if; end Connect; function Get_Fd (Obj : in Socket_T) return Integer is (Obj.Fd); procedure Receive (Obj : in out Socket_T; Message : out Nanomsg.Messages.Message_T; Non_Blocking : in Boolean := False ) is Payload : System.Address; use type System.Address; Received : Integer; use type C.Size_T; Flags : C.Int := (if Non_Blocking then 2 else 0); Nn_Msg : constant C.Size_T := C.Size_T'Last; function Nn_Recv (Socket : C.Int; Buf_Access : out System.Address; Size : C.Size_T; Flags : C.Int ) return C.Int with Import, Convention => C, External_Name => "nn_recv"; function Free_Msg (Buf_Access :System.Address) return C.Int with Import, Convention => C, External_Name => "nn_freemsg"; begin Received := Integer (Nn_Recv (C.Int (Obj.Fd), Payload, Nn_Msg, Flags)); if Received < 0 then if Non_Blocking and then Nanomsg.Errors.Errno = Syserrors.Value (Syserrors.Eagain) then return; end if; raise Socket_Exception with "Receive: " & Nanomsg.Errors.Errno_Text; end if; Message.Set_Length (Received); declare Data : Ada.Streams.Stream_Element_Array (1 .. Ada.Streams.Stream_Element_Offset (Received)); for Data'Address use Payload; begin Message.Set_Payload (Data); end; if Free_Msg (Payload) < 0 then raise Socket_Exception with "Deallocation failed"; end if; end Receive; procedure Send (Obj : in Socket_T; Message : Nanomsg.Messages.Message_T) is Flags : C.Int := 0; function Nn_Send (Socket : C.Int; Buf_Access : Ada.Streams.Stream_Element_Array; Size : C.Size_T; Flags : C.Int ) return C.Int with Import, Convention => C, External_Name => "nn_send"; Sent : Integer; begin Sent := Integer (Nn_Send (C.Int (Obj.Fd), Message.Get_Payload.all, C.Size_T (Message.Get_Length), Flags)); if Sent < 0 then raise Socket_Exception with "Send: " & Nanomsg.Errors.Errno_Text; end if; if Sent /= Message.Get_Length then raise Socket_Exception with "Send/Receive count doesn't match"; end if; end Send; procedure Delete_Endpoint (Obj : in out Socket_T) is function Nn_Shutdown (Socket : C.Int; Endpoint : C.Int) return C.Int with Import, Convention => C, External_Name => "nn_shutdown"; begin if Obj.Endpoint > 0 then if Nn_Shutdown (C.Int (Obj.Fd), C.Int (Obj.Endpoint)) < 0 then raise Socket_Exception with "Shutdown Error" & Nanomsg.Errors.Errno_Text; end if; Obj.Endpoint := -1; end if; end Delete_Endpoint; function C_Setsockopt (Socket : C.Int; Level : C.Int; Option : C.Int; Value : System.Address; Size : C.Size_T) return C.Int with Import, Convention => C, External_Name => "nn_setsockopt"; procedure Set_Option (Obj : in out Socket_T; Level : in Nanomsg.Sockopt.Option_Level_T; Name : in Nanomsg.Sockopt.Option_Type_T; Value : in Natural) is use Nanomsg.Sockopt; Size : C.Size_T := C.Size_T (C.Int'Size); begin begin if C_Setsockopt (C.Int (Obj.Fd), C.Int (Level), C.Int (Name), Value'Address, Size) < 0 then raise Socket_Exception with "Setopt error"; end if; end; end Set_Option; procedure Set_Option (Obj : in out Socket_T; Level : in Nanomsg.Sockopt.Option_Level_T; Name : in Nanomsg.Sockopt.Option_Type_T; Value : in String) is C_Value : C.Strings.Char_Array_Access := new C.Char_Array'(C.To_C (Value)) with Convention => C; procedure Free is new Ada.Unchecked_Deallocation (Name => C.Strings.Char_Array_Access, Object => C.Char_Array); use type C.Size_T; Size : C.Size_T := C_Value'Length - 1; begin if C_Setsockopt (C.Int (Obj.Fd), C.Int (Level), C.Int (Name), C_Value.all'Address, Size) < 0 then raise Socket_Exception with "Setopt error" & Nanomsg.Errors.Errno_Text; end if; Free (C_Value); end Set_Option; function Get_Option (Obj : in Socket_T; Level : in Nanomsg.Sockopt.Option_Level_T; Name : in Nanomsg.Sockopt.Option_Type_T) return String is type String_Access_T is access all String; procedure Free is new Ada.Unchecked_Deallocation (Name => String_Access_T, Object => String); function Nn_Getsockopt (Socket : in C.Int; Level : in C.Int; Option_Name : in C.Int; Value : in out String_Access_T; Size : in System.Address) return C.Int with Import, Convention => C, External_Name => "nn_getsockopt"; use Nanomsg.Sockopt; Max_Size : constant := 63; Ptr : String_Access_T := new String(1..Max_Size); Size : C.Size_T := Max_Size; use type C.Size_T; begin if Nn_Getsockopt (Socket => C.Int (Obj.Fd), Level => C.Int (Level), Option_Name => C.Int (Name), Value => Ptr, Size => Size'Address) < 0 then raise Socket_Exception with "Getopt error" & Nanomsg.Errors.Errno_Text; end if; declare Retval : constant String := Ptr.all(1.. Integer (Size)); begin Free (Ptr); return Retval; end; end Get_Option; function Get_Option (Obj : in Socket_T; Level : in Nanomsg.Sockopt.Option_Level_T; Name : in Nanomsg.Sockopt.Option_Type_T) return Natural is Retval : Natural := 0; Size : C.Size_T := C.Int'Size; function Nn_Getsockopt (Socket : in C.Int; Level : in C.Int; Option_Name : in C.Int; Value : in out C.Int; Size : in System.Address) return C.Int with Import, Convention => C, External_Name => "nn_getsockopt"; begin if Nn_Getsockopt (Socket => C.Int (Obj.Fd), Level => C.Int (Level), Option_Name => C.Int (Name), Value => C.Int (Retval), Size => Size'Address) < 0 then raise Socket_Exception with "Getopt error" & Nanomsg.Errors.Errno_Text; end if; return Retval; end Get_Option; function Is_Ready (Obj : in Socket_T; To_Send : in Boolean := False; To_Receive : in Boolean := True) return Boolean is Pool : Nanomsg.Socket_Pools.Pool_T; begin Pool.Add_Socket (Obj); if To_Send and then To_Receive then return Pool.Ready_To_Send_Receive.Has_Socket (Obj); elsif To_Send then return Pool.Ready_To_Send.Has_Socket (Obj); elsif To_Receive then return Pool.Ready_To_Receive.Has_Socket (Obj); else raise Socket_Exception; end if; end Is_Ready; function "=" (Left, Right : in Socket_T) return Boolean is (Left.Fd = Right.Fd); function Receive (Obj : in out Socket_T; Message : out Nanomsg.Messages.Message_T; Non_Blocking : in Boolean := False) return Natural is begin Receive (Obj, Message, Non_Blocking); return Message.Get_Length; end Receive; end Nanomsg.Socket;
Fabien-Chouteau/Ada_Drivers_Library
Ada
3,534
ads
------------------------------------------------------------------------------ -- -- -- Copyright (C) 2015-2017, AdaCore -- -- -- -- Redistribution and use in source and binary forms, with or without -- -- modification, are permitted provided that the following conditions are -- -- met: -- -- 1. Redistributions of source code must retain the above copyright -- -- notice, this list of conditions and the following disclaimer. -- -- 2. Redistributions in binary form must reproduce the above copyright -- -- notice, this list of conditions and the following disclaimer in -- -- the documentation and/or other materials provided with the -- -- distribution. -- -- 3. Neither the name of the copyright holder nor the names of its -- -- contributors may be used to endorse or promote products derived -- -- from this software without specific prior written permission. -- -- -- -- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -- -- "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -- -- LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -- -- A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -- -- HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -- -- SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -- -- LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -- -- DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -- -- THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -- -- (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -- -- OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -- -- -- ------------------------------------------------------------------------------ with HAL; use HAL; with HAL.Framebuffer; use HAL.Framebuffer; with HAL.Bitmap; with Framebuffer_DSI; private with STM32.Device; private with STM32.DMA2D_Bitmap; private with STM32.DSI; private with STM32.GPIO; package Framebuffer_OTM8009A is LCD_Natural_Width : constant := Framebuffer_DSI.LCD_Natural_Width; LCD_Natural_Height : constant := Framebuffer_DSI.LCD_Natural_Height; type Frame_Buffer is limited new HAL.Framebuffer.Frame_Buffer_Display with private; procedure Initialize (Display : in out Frame_Buffer; Orientation : HAL.Framebuffer.Display_Orientation := Default; Mode : HAL.Framebuffer.Wait_Mode := Interrupt); private DSI_RESET : STM32.GPIO.GPIO_Point renames STM32.Device.PJ15; PLLSAIN : constant := 417; PLLSAIR : constant := 5; PLLSAI_DIVR : constant := 2; PLL_N_Div : constant := 100; PLL_IN_Div : constant STM32.DSI.DSI_PLL_IDF := STM32.DSI.PLL_IN_DIV5; PLL_OUT_Div : constant STM32.DSI.DSI_PLL_ODF := STM32.DSI.PLL_OUT_DIV1; type Frame_Buffer is limited new Framebuffer_DSI.Frame_Buffer with null record; end Framebuffer_OTM8009A;
guillaume-lin/tsc
Ada
30,772
ads
------------------------------------------------------------------------------ -- -- -- GNAT ncurses Binding -- -- -- -- Terminal_Interface.Curses.Form -- -- -- -- 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 -- Version Control: -- $Revision: 1.27 $ -- Binding Version 01.00 ------------------------------------------------------------------------------ -- form binding. -- This module is generated. Please don't change it manually! -- Run the generator instead. -- | with System; with Ada.Characters.Latin_1; package Terminal_Interface.Curses.Forms is pragma Preelaborate (Terminal_Interface.Curses.Forms); pragma Linker_Options ("-lform"); pragma Linker_Options ("-lncurses"); Space : Character renames Ada.Characters.Latin_1.Space; type Field is private; type Form is private; Null_Field : constant Field; Null_Form : constant Form; type Field_Justification is (None, Left, Center, Right); pragma Warnings (Off); type Field_Option_Set is record Visible : Boolean; Active : Boolean; Public : Boolean; Edit : Boolean; Wrap : Boolean; Blank : Boolean; Auto_Skip : Boolean; Null_Ok : Boolean; Pass_Ok : Boolean; Static : Boolean; end record; pragma Pack (Field_Option_Set); pragma Convention (C, Field_Option_Set); for Field_Option_Set use record Visible at 0 range 0 .. 0; Active at 0 range 1 .. 1; Public at 0 range 2 .. 2; Edit at 0 range 3 .. 3; Wrap at 0 range 4 .. 4; Blank at 0 range 5 .. 5; Auto_Skip at 0 range 6 .. 6; Null_Ok at 0 range 7 .. 7; Pass_Ok at 0 range 8 .. 8; Static at 0 range 9 .. 9; end record; for Field_Option_Set'Size use 32; -- Please note: this rep. clause is generated and may be -- different on your system.Dnl pragma Warnings (On); function Default_Field_Options return Field_Option_Set; -- The initial defaults for the field options. pragma Inline (Default_Field_Options); pragma Warnings (Off); type Form_Option_Set is record NL_Overload : Boolean; BS_Overload : Boolean; end record; pragma Pack (Form_Option_Set); pragma Convention (C, Form_Option_Set); for Form_Option_Set use record NL_Overload at 0 range 0 .. 0; BS_Overload at 0 range 1 .. 1; end record; for Form_Option_Set'Size use 32; -- Please note: this rep. clause is generated and may be -- different on your system.Dnl pragma Warnings (On); function Default_Form_Options return Form_Option_Set; -- The initial defaults for the form options. pragma Inline (Default_Form_Options); type Buffer_Number is new Natural; type Field_Array is array (Positive range <>) of aliased Field; pragma Convention (C, Field_Array); type Field_Array_Access is access Field_Array; procedure Free (FA : in out Field_Array_Access; Free_Fields : in Boolean := False); -- Release the memory for an allocated field array -- If Free_Fields is True, call Delete() for all the fields in -- the array. subtype Form_Request_Code is Key_Code range (Key_Max + 1) .. (Key_Max + 57); -- The prefix F_ stands for "Form Request" F_Next_Page : constant Form_Request_Code := Key_Max + 1; F_Previous_Page : constant Form_Request_Code := Key_Max + 2; F_First_Page : constant Form_Request_Code := Key_Max + 3; F_Last_Page : constant Form_Request_Code := Key_Max + 4; F_Next_Field : constant Form_Request_Code := Key_Max + 5; F_Previous_Field : constant Form_Request_Code := Key_Max + 6; F_First_Field : constant Form_Request_Code := Key_Max + 7; F_Last_Field : constant Form_Request_Code := Key_Max + 8; F_Sorted_Next_Field : constant Form_Request_Code := Key_Max + 9; F_Sorted_Previous_Field : constant Form_Request_Code := Key_Max + 10; F_Sorted_First_Field : constant Form_Request_Code := Key_Max + 11; F_Sorted_Last_Field : constant Form_Request_Code := Key_Max + 12; F_Left_Field : constant Form_Request_Code := Key_Max + 13; F_Right_Field : constant Form_Request_Code := Key_Max + 14; F_Up_Field : constant Form_Request_Code := Key_Max + 15; F_Down_Field : constant Form_Request_Code := Key_Max + 16; F_Next_Char : constant Form_Request_Code := Key_Max + 17; F_Previous_Char : constant Form_Request_Code := Key_Max + 18; F_Next_Line : constant Form_Request_Code := Key_Max + 19; F_Previous_Line : constant Form_Request_Code := Key_Max + 20; F_Next_Word : constant Form_Request_Code := Key_Max + 21; F_Previous_Word : constant Form_Request_Code := Key_Max + 22; F_Begin_Field : constant Form_Request_Code := Key_Max + 23; F_End_Field : constant Form_Request_Code := Key_Max + 24; F_Begin_Line : constant Form_Request_Code := Key_Max + 25; F_End_Line : constant Form_Request_Code := Key_Max + 26; F_Left_Char : constant Form_Request_Code := Key_Max + 27; F_Right_Char : constant Form_Request_Code := Key_Max + 28; F_Up_Char : constant Form_Request_Code := Key_Max + 29; F_Down_Char : constant Form_Request_Code := Key_Max + 30; F_New_Line : constant Form_Request_Code := Key_Max + 31; F_Insert_Char : constant Form_Request_Code := Key_Max + 32; F_Insert_Line : constant Form_Request_Code := Key_Max + 33; F_Delete_Char : constant Form_Request_Code := Key_Max + 34; F_Delete_Previous : constant Form_Request_Code := Key_Max + 35; F_Delete_Line : constant Form_Request_Code := Key_Max + 36; F_Delete_Word : constant Form_Request_Code := Key_Max + 37; F_Clear_EOL : constant Form_Request_Code := Key_Max + 38; F_Clear_EOF : constant Form_Request_Code := Key_Max + 39; F_Clear_Field : constant Form_Request_Code := Key_Max + 40; F_Overlay_Mode : constant Form_Request_Code := Key_Max + 41; F_Insert_Mode : constant Form_Request_Code := Key_Max + 42; -- Vertical Scrolling F_ScrollForward_Line : constant Form_Request_Code := Key_Max + 43; F_ScrollBackward_Line : constant Form_Request_Code := Key_Max + 44; F_ScrollForward_Page : constant Form_Request_Code := Key_Max + 45; F_ScrollBackward_Page : constant Form_Request_Code := Key_Max + 46; F_ScrollForward_HalfPage : constant Form_Request_Code := Key_Max + 47; F_ScrollBackward_HalfPage : constant Form_Request_Code := Key_Max + 48; -- Horizontal Scrolling F_HScrollForward_Char : constant Form_Request_Code := Key_Max + 49; F_HScrollBackward_Char : constant Form_Request_Code := Key_Max + 50; F_HScrollForward_Line : constant Form_Request_Code := Key_Max + 51; F_HScrollBackward_Line : constant Form_Request_Code := Key_Max + 52; F_HScrollForward_HalfLine : constant Form_Request_Code := Key_Max + 53; F_HScrollBackward_HalfLine : constant Form_Request_Code := Key_Max + 54; F_Validate_Field : constant Form_Request_Code := Key_Max + 55; F_Next_Choice : constant Form_Request_Code := Key_Max + 56; F_Previous_Choice : constant Form_Request_Code := Key_Max + 57; -- For those who like the old 'C' style request names REQ_NEXT_PAGE : Form_Request_Code renames F_Next_Page; REQ_PREV_PAGE : Form_Request_Code renames F_Previous_Page; REQ_FIRST_PAGE : Form_Request_Code renames F_First_Page; REQ_LAST_PAGE : Form_Request_Code renames F_Last_Page; REQ_NEXT_FIELD : Form_Request_Code renames F_Next_Field; REQ_PREV_FIELD : Form_Request_Code renames F_Previous_Field; REQ_FIRST_FIELD : Form_Request_Code renames F_First_Field; REQ_LAST_FIELD : Form_Request_Code renames F_Last_Field; REQ_SNEXT_FIELD : Form_Request_Code renames F_Sorted_Next_Field; REQ_SPREV_FIELD : Form_Request_Code renames F_Sorted_Previous_Field; REQ_SFIRST_FIELD : Form_Request_Code renames F_Sorted_First_Field; REQ_SLAST_FIELD : Form_Request_Code renames F_Sorted_Last_Field; REQ_LEFT_FIELD : Form_Request_Code renames F_Left_Field; REQ_RIGHT_FIELD : Form_Request_Code renames F_Right_Field; REQ_UP_FIELD : Form_Request_Code renames F_Up_Field; REQ_DOWN_FIELD : Form_Request_Code renames F_Down_Field; REQ_NEXT_CHAR : Form_Request_Code renames F_Next_Char; REQ_PREV_CHAR : Form_Request_Code renames F_Previous_Char; REQ_NEXT_LINE : Form_Request_Code renames F_Next_Line; REQ_PREV_LINE : Form_Request_Code renames F_Previous_Line; REQ_NEXT_WORD : Form_Request_Code renames F_Next_Word; REQ_PREV_WORD : Form_Request_Code renames F_Previous_Word; REQ_BEG_FIELD : Form_Request_Code renames F_Begin_Field; REQ_END_FIELD : Form_Request_Code renames F_End_Field; REQ_BEG_LINE : Form_Request_Code renames F_Begin_Line; REQ_END_LINE : Form_Request_Code renames F_End_Line; REQ_LEFT_CHAR : Form_Request_Code renames F_Left_Char; REQ_RIGHT_CHAR : Form_Request_Code renames F_Right_Char; REQ_UP_CHAR : Form_Request_Code renames F_Up_Char; REQ_DOWN_CHAR : Form_Request_Code renames F_Down_Char; REQ_NEW_LINE : Form_Request_Code renames F_New_Line; REQ_INS_CHAR : Form_Request_Code renames F_Insert_Char; REQ_INS_LINE : Form_Request_Code renames F_Insert_Line; REQ_DEL_CHAR : Form_Request_Code renames F_Delete_Char; REQ_DEL_PREV : Form_Request_Code renames F_Delete_Previous; REQ_DEL_LINE : Form_Request_Code renames F_Delete_Line; REQ_DEL_WORD : Form_Request_Code renames F_Delete_Word; REQ_CLR_EOL : Form_Request_Code renames F_Clear_EOL; REQ_CLR_EOF : Form_Request_Code renames F_Clear_EOF; REQ_CLR_FIELD : Form_Request_Code renames F_Clear_Field; REQ_OVL_MODE : Form_Request_Code renames F_Overlay_Mode; REQ_INS_MODE : Form_Request_Code renames F_Insert_Mode; REQ_SCR_FLINE : Form_Request_Code renames F_ScrollForward_Line; REQ_SCR_BLINE : Form_Request_Code renames F_ScrollBackward_Line; REQ_SCR_FPAGE : Form_Request_Code renames F_ScrollForward_Page; REQ_SCR_BPAGE : Form_Request_Code renames F_ScrollBackward_Page; REQ_SCR_FHPAGE : Form_Request_Code renames F_ScrollForward_HalfPage; REQ_SCR_BHPAGE : Form_Request_Code renames F_ScrollBackward_HalfPage; REQ_SCR_FCHAR : Form_Request_Code renames F_HScrollForward_Char; REQ_SCR_BCHAR : Form_Request_Code renames F_HScrollBackward_Char; REQ_SCR_HFLINE : Form_Request_Code renames F_HScrollForward_Line; REQ_SCR_HBLINE : Form_Request_Code renames F_HScrollBackward_Line; REQ_SCR_HFHALF : Form_Request_Code renames F_HScrollForward_HalfLine; REQ_SCR_HBHALF : Form_Request_Code renames F_HScrollBackward_HalfLine; REQ_VALIDATION : Form_Request_Code renames F_Validate_Field; REQ_NEXT_CHOICE : Form_Request_Code renames F_Next_Choice; REQ_PREV_CHOICE : Form_Request_Code renames F_Previous_Choice; procedure Request_Name (Key : in Form_Request_Code; Name : out String); function Request_Name (Key : Form_Request_Code) return String; -- Same as function pragma Inline (Request_Name); ------------------ -- Exceptions -- ------------------ Form_Exception : exception; -- |===================================================================== -- | Man page form_field_new.3x -- |===================================================================== -- | function Create (Height : Line_Count; Width : Column_Count; Top : Line_Position; Left : Column_Position; Off_Screen : Natural := 0; More_Buffers : Buffer_Number := Buffer_Number'First) return Field; -- AKA: new_field() -- An overloaded Create is defined later. Pragma Inline appears there. -- | function New_Field (Height : Line_Count; Width : Column_Count; Top : Line_Position; Left : Column_Position; Off_Screen : Natural := 0; More_Buffers : Buffer_Number := Buffer_Number'First) return Field renames Create; -- AKA: new_field() pragma Inline (New_Field); -- | procedure Delete (Fld : in out Field); -- AKA: free_field() -- Reset Fld to Null_Field -- An overloaded Delete is defined later. Pragma Inline appears there. -- | function Duplicate (Fld : Field; Top : Line_Position; Left : Column_Position) return Field; -- AKA: dup_field() pragma Inline (Duplicate); -- | function Link (Fld : Field; Top : Line_Position; Left : Column_Position) return Field; -- AKA: link_field() pragma Inline (Link); -- |===================================================================== -- | Man page form_field_just.3x -- |===================================================================== -- | procedure Set_Justification (Fld : in Field; Just : in Field_Justification := None); -- AKA: set_field_just() pragma Inline (Set_Justification); -- | function Get_Justification (Fld : Field) return Field_Justification; -- AKA: field_just() pragma Inline (Get_Justification); -- |===================================================================== -- | Man page form_field_buffer.3x -- |===================================================================== -- | procedure Set_Buffer (Fld : in Field; Buffer : in Buffer_Number := Buffer_Number'First; Str : in String); -- AKA: set_field_buffer() -- Not inlined -- | procedure Get_Buffer (Fld : in Field; Buffer : in Buffer_Number := Buffer_Number'First; Str : out String); -- AKA: field_buffer() function Get_Buffer (Fld : in Field; Buffer : in Buffer_Number := Buffer_Number'First) return String; -- AKA: field_buffer() -- Same but as function pragma Inline (Get_Buffer); -- | procedure Set_Status (Fld : in Field; Status : in Boolean := True); -- AKA: set_field_status() pragma Inline (Set_Status); -- | function Changed (Fld : Field) return Boolean; -- AKA: field_status() pragma Inline (Changed); -- | procedure Set_Maximum_Size (Fld : in Field; Max : in Natural := 0); -- AKA: set_field_max() pragma Inline (Set_Maximum_Size); -- |===================================================================== -- | Man page form_field_opts.3x -- |===================================================================== -- | procedure Set_Options (Fld : in Field; Options : in Field_Option_Set); -- AKA: set_field_opts() -- An overloaded version is defined later. Pragma Inline appears there -- | procedure Switch_Options (Fld : in Field; Options : in Field_Option_Set; On : Boolean := True); -- AKA: field_opts_on() -- AKA: field_opts_off() -- An overloaded version is defined later. Pragma Inline appears there -- | procedure Get_Options (Fld : in Field; Options : out Field_Option_Set); -- AKA: field_opts() -- | function Get_Options (Fld : Field := Null_Field) return Field_Option_Set; -- AKA: field_opts() -- An overloaded version is defined later. Pragma Inline appears there -- |===================================================================== -- | Man page form_field_attributes.3x -- |===================================================================== -- | procedure Set_Foreground (Fld : in Field; Fore : in Character_Attribute_Set := Normal_Video; Color : in Color_Pair := Color_Pair'First); -- AKA: set_field_fore() pragma Inline (Set_Foreground); -- | procedure Foreground (Fld : in Field; Fore : out Character_Attribute_Set); -- AKA: field_fore() -- | procedure Foreground (Fld : in Field; Fore : out Character_Attribute_Set; Color : out Color_Pair); -- AKA: field_fore() pragma Inline (Foreground); -- | procedure Set_Background (Fld : in Field; Back : in Character_Attribute_Set := Normal_Video; Color : in Color_Pair := Color_Pair'First); -- AKA: set_field_back() pragma Inline (Set_Background); -- | procedure Background (Fld : in Field; Back : out Character_Attribute_Set); -- AKA: field_back() -- | procedure Background (Fld : in Field; Back : out Character_Attribute_Set; Color : out Color_Pair); -- AKA: field_back() pragma Inline (Background); -- | procedure Set_Pad_Character (Fld : in Field; Pad : in Character := Space); -- AKA: set_field_pad() pragma Inline (Set_Pad_Character); -- | procedure Pad_Character (Fld : in Field; Pad : out Character); -- AKA: field_pad() pragma Inline (Pad_Character); -- |===================================================================== -- | Man page form_field_info.3x -- |===================================================================== -- | procedure Info (Fld : in Field; Lines : out Line_Count; Columns : out Column_Count; First_Row : out Line_Position; First_Column : out Column_Position; Off_Screen : out Natural; Additional_Buffers : out Buffer_Number); -- AKA: field_info() pragma Inline (Info); -- | procedure Dynamic_Info (Fld : in Field; Lines : out Line_Count; Columns : out Column_Count; Max : out Natural); -- AKA: dynamic_field_info() pragma Inline (Dynamic_Info); -- |===================================================================== -- | Man page form_win.3x -- |===================================================================== -- | procedure Set_Window (Frm : in Form; Win : in Window); -- AKA: set_form_win() pragma Inline (Set_Window); -- | function Get_Window (Frm : Form) return Window; -- AKA: form_win() pragma Inline (Get_Window); -- | procedure Set_Sub_Window (Frm : in Form; Win : in Window); -- AKA: set_form_sub() pragma Inline (Set_Sub_Window); -- | function Get_Sub_Window (Frm : Form) return Window; -- AKA: form_sub() pragma Inline (Get_Sub_Window); -- | procedure Scale (Frm : in Form; Lines : out Line_Count; Columns : out Column_Count); -- AKA: scale_form() pragma Inline (Scale); -- |===================================================================== -- | Man page form_hook.3x -- |===================================================================== type Form_Hook_Function is access procedure (Frm : in Form); pragma Convention (C, Form_Hook_Function); -- | procedure Set_Field_Init_Hook (Frm : in Form; Proc : in Form_Hook_Function); -- AKA: set_field_init() pragma Inline (Set_Field_Init_Hook); -- | procedure Set_Field_Term_Hook (Frm : in Form; Proc : in Form_Hook_Function); -- AKA: set_field_term() pragma Inline (Set_Field_Term_Hook); -- | procedure Set_Form_Init_Hook (Frm : in Form; Proc : in Form_Hook_Function); -- AKA: set_form_init() pragma Inline (Set_Form_Init_Hook); -- | procedure Set_Form_Term_Hook (Frm : in Form; Proc : in Form_Hook_Function); -- AKA: set_form_term() pragma Inline (Set_Form_Term_Hook); -- | function Get_Field_Init_Hook (Frm : Form) return Form_Hook_Function; -- AKA: field_init() pragma Import (C, Get_Field_Init_Hook, "field_init"); -- | function Get_Field_Term_Hook (Frm : Form) return Form_Hook_Function; -- AKA: field_term() pragma Import (C, Get_Field_Term_Hook, "field_term"); -- | function Get_Form_Init_Hook (Frm : Form) return Form_Hook_Function; -- AKA: form_init() pragma Import (C, Get_Form_Init_Hook, "form_init"); -- | function Get_Form_Term_Hook (Frm : Form) return Form_Hook_Function; -- AKA: form_term() pragma Import (C, Get_Form_Term_Hook, "form_term"); -- |===================================================================== -- | Man page form_field.3x -- |===================================================================== -- | procedure Redefine (Frm : in Form; Flds : in Field_Array_Access); -- AKA: set_form_fields() pragma Inline (Redefine); -- | procedure Set_Fields (Frm : in Form; Flds : in Field_Array_Access) renames Redefine; -- AKA: set_form_fields() pragma Inline (Set_Fields); -- | function Fields (Frm : Form; Index : Positive) return Field; -- AKA: form_fields() pragma Inline (Fields); -- | function Field_Count (Frm : Form) return Natural; -- AKA: field_count() pragma Inline (Field_Count); -- | procedure Move (Fld : in Field; Line : in Line_Position; Column : in Column_Position); -- AKA: move_field() pragma Inline (Move); -- |===================================================================== -- | Man page form_new.3x -- |===================================================================== -- | function Create (Fields : Field_Array_Access) return Form; -- AKA: new_form() pragma Inline (Create); -- | function New_Form (Fields : Field_Array_Access) return Form renames Create; -- AKA: new_form() pragma Inline (New_Form); -- | procedure Delete (Frm : in out Form); -- AKA: free_form() -- Reset Frm to Null_Form pragma Inline (Delete); -- |===================================================================== -- | Man page form_opts.3x -- |===================================================================== -- | procedure Set_Options (Frm : in Form; Options : in Form_Option_Set); -- AKA: set_form_opts() pragma Inline (Set_Options); -- | procedure Switch_Options (Frm : in Form; Options : in Form_Option_Set; On : Boolean := True); -- AKA: form_opts_on() -- AKA: form_opts_off() pragma Inline (Switch_Options); -- | procedure Get_Options (Frm : in Form; Options : out Form_Option_Set); -- AKA: form_opts() -- | function Get_Options (Frm : Form := Null_Form) return Form_Option_Set; -- AKA: form_opts() pragma Inline (Get_Options); -- |===================================================================== -- | Man page form_post.3x -- |===================================================================== -- | procedure Post (Frm : in Form; Post : in Boolean := True); -- AKA: post_form() -- AKA: unpost_form() pragma Inline (Post); -- |===================================================================== -- | Man page form_cursor.3x -- |===================================================================== -- | procedure Position_Cursor (Frm : Form); -- AKA: pos_form_cursor() pragma Inline (Position_Cursor); -- |===================================================================== -- | Man page form_data.3x -- |===================================================================== -- | function Data_Ahead (Frm : Form) return Boolean; -- AKA: data_ahead() pragma Inline (Data_Ahead); -- | function Data_Behind (Frm : Form) return Boolean; -- AKA: data_behind() pragma Inline (Data_Behind); -- |===================================================================== -- | Man page form_driver.3x -- |===================================================================== type Driver_Result is (Form_Ok, Request_Denied, Unknown_Request, Invalid_Field); -- | function Driver (Frm : Form; Key : Key_Code) return Driver_Result; -- AKA: form_driver() -- Driver not inlined -- |===================================================================== -- | Man page form_page.3x -- |===================================================================== type Page_Number is new Natural; -- | procedure Set_Current (Frm : in Form; Fld : in Field); -- AKA: set_current_field() pragma Inline (Set_Current); -- | function Current (Frm : in Form) return Field; -- AKA: current_field() pragma Inline (Current); -- | procedure Set_Page (Frm : in Form; Page : in Page_Number := Page_Number'First); -- AKA: set_form_page() pragma Inline (Set_Page); -- | function Page (Frm : Form) return Page_Number; -- AKA: form_page() pragma Inline (Page); -- | function Get_Index (Fld : Field) return Positive; -- AKA: field_index() -- Please note that in this binding we start the numbering of fields -- with 1. So this is number is one more than you get from the low -- level call. pragma Inline (Get_Index); -- |===================================================================== -- | Man page form_new_page.3x -- |===================================================================== -- | procedure Set_New_Page (Fld : in Field; New_Page : in Boolean := True); -- AKA: set_new_page() pragma Inline (Set_New_Page); -- | function Is_New_Page (Fld : Field) return Boolean; -- AKA: new_page() pragma Inline (Is_New_Page); -- |===================================================================== -- | Man page form_requestname.3x -- |===================================================================== -- Not Implemented: form_request_name, form_request_by_name ------------------------------------------------------------------------------ private type Field is new System.Storage_Elements.Integer_Address; type Form is new System.Storage_Elements.Integer_Address; Null_Field : constant Field := 0; Null_Form : constant Form := 0; end Terminal_Interface.Curses.Forms;
faelys/natools
Ada
5,078
adb
------------------------------------------------------------------------------ -- Copyright (c) 2013-2014, Natacha Porté -- -- -- -- Permission to use, copy, modify, and distribute this software for any -- -- purpose with or without fee is hereby granted, provided that the above -- -- copyright notice and this permission notice appear in all copies. -- -- -- -- THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES -- -- WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF -- -- MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR -- -- ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES -- -- WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN -- -- ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF -- -- OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. -- ------------------------------------------------------------------------------ with Ada.Unchecked_Deallocation; package body Natools.References is --------------------------------- -- Low-level memory management -- --------------------------------- overriding procedure Adjust (Object : in out Immutable_Reference) is begin if Object.Count /= null then Object.Count.Increment; end if; end Adjust; overriding procedure Finalize (Object : in out Immutable_Reference) is procedure Free is new Ada.Unchecked_Deallocation (Held_Data, Data_Access); procedure Free is new Ada.Unchecked_Deallocation (Counter, Counter_Access); Deallocate : Boolean; begin if Object.Count /= null then Object.Count.Decrement (Deallocate); if Deallocate then Free (Object.Count); Free (Object.Data); else Object.Count := null; Object.Data := null; end if; end if; end Finalize; ----------------------------------------- -- Object construction and destruction -- ----------------------------------------- function Create (Constructor : not null access function return Held_Data) return Immutable_Reference is begin return (Ada.Finalization.Controlled with Data => new Held_Data'(Constructor.all), Count => new Counter); end Create; procedure Replace (Ref : in out Immutable_Reference; Constructor : not null access function return Held_Data) is begin Finalize (Ref); Ref.Data := new Held_Data'(Constructor.all); Ref.Count := new Counter; end Replace; function Create (Data : in Data_Access) return Immutable_Reference is begin if Data = null then return Null_Immutable_Reference; else return (Ada.Finalization.Controlled with Data => Data, Count => new Counter); end if; end Create; procedure Replace (Ref : in out Immutable_Reference; Data : in Data_Access) is begin Finalize (Ref); if Data /= null then Ref.Data := Data; Ref.Count := new Counter; end if; end Replace; procedure Reset (Ref : in out Immutable_Reference) is begin Finalize (Ref); end Reset; function Is_Empty (Ref : Immutable_Reference) return Boolean is begin return Ref.Count = null; end Is_Empty; function Is_Last (Ref : Immutable_Reference) return Boolean is begin return Ref.Count.Get_Value = 1; end Is_Last; function "=" (Left, Right : Immutable_Reference) return Boolean is begin return Left.Data = Right.Data; end "="; ---------------------- -- Dereferenciation -- ---------------------- function Query (Ref : in Immutable_Reference) return Accessor is begin return Accessor'(Data => Ref.Data, Parent => Ref); end Query; function Update (Ref : in Reference) return Mutator is begin return Mutator'(Data => Ref.Data, Parent => Ref); end Update; procedure Query (Ref : in Immutable_Reference; Process : not null access procedure (Object : in Held_Data)) is begin Process.all (Ref.Data.all); end Query; procedure Update (Ref : in Reference; Process : not null access procedure (Object : in out Held_Data)) is begin Process.all (Ref.Data.all); end Update; ------------------------ -- Counter Management -- ------------------------ protected body Counter is procedure Increment is begin Value := Value + 1; end Increment; procedure Decrement (Zero : out Boolean) is begin Value := Value - 1; Zero := Value = 0; end Decrement; function Get_Value return Natural is begin return Value; end Get_Value; end Counter; end Natools.References;
pat-rogers/LmcpGen
Ada
366
ads
package -<full_series_name_dots>-.enumerations is -<list_all_enumeration_types>- type -<series_name>-Enum is ( -<list_all_message_enumeration_names>- ); for -<series_name>-Enum use ( -<list_all_message_enumeration_ids>- ); end -<full_series_name_dots>-.enumerations;
zhmu/ananas
Ada
55
ads
package Concat2 is procedure Browse; end Concat2;
reznikmm/matreshka
Ada
3,645
ads
------------------------------------------------------------------------------ -- -- -- Matreshka Project -- -- -- -- Ada Modeling Framework -- -- -- -- Runtime Library Component -- -- -- ------------------------------------------------------------------------------ -- -- -- Copyright © 2012, Vadim Godunko <[email protected]> -- -- All rights reserved. -- -- -- -- Redistribution and use in source and binary forms, with or without -- -- modification, are permitted provided that the following conditions -- -- are met: -- -- -- -- * Redistributions of source code must retain the above copyright -- -- notice, this list of conditions and the following disclaimer. -- -- -- -- * Redistributions in binary form must reproduce the above copyright -- -- notice, this list of conditions and the following disclaimer in the -- -- documentation and/or other materials provided with the distribution. -- -- -- -- * Neither the name of the Vadim Godunko, IE nor the names of its -- -- contributors may be used to endorse or promote products derived from -- -- this software without specific prior written permission. -- -- -- -- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -- -- "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -- -- LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -- -- A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -- -- HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -- -- SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED -- -- TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -- -- PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -- -- LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -- -- NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -- -- SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -- -- -- ------------------------------------------------------------------------------ -- $Revision$ $Date$ ------------------------------------------------------------------------------ -- This file is generated, don't edit it. ------------------------------------------------------------------------------ with League.Holders.Generic_Holders; package AMF.DG.Holders.Rotates is new League.Holders.Generic_Holders (AMF.DG.DG_Rotate); pragma Preelaborate (AMF.DG.Holders.Rotates);
faelys/natools
Ada
2,564
adb
------------------------------------------------------------------------------ -- Copyright (c) 2016, Natacha Porté -- -- -- -- Permission to use, copy, modify, and distribute this software for any -- -- purpose with or without fee is hereby granted, provided that the above -- -- copyright notice and this permission notice appear in all copies. -- -- -- -- THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES -- -- WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF -- -- MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR -- -- ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES -- -- WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN -- -- ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF -- -- OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. -- ------------------------------------------------------------------------------ with GNAT.Perfect_Hash_Generators; package body Natools.Smaz.Tools.GNAT is package Perfect_Hash_Generators renames Standard.GNAT.Perfect_Hash_Generators; procedure Build_Perfect_Hash (List : in String_Lists.List; Package_Name : in String) is Seed : Natural := 2; NK : constant Float := Float (String_Lists.Length (List)); NV : Natural := Natural (String_Lists.Length (List)) * 2 + 1; Retries_Before_Expand : constant := 2; begin for S of List loop Perfect_Hash_Generators.Insert (S); end loop; Expanding_Retries : loop Retires_Without_Expand : for I in 1 .. Retries_Before_Expand loop begin Perfect_Hash_Generators.Initialize (Seed, Float (NV) / NK); Perfect_Hash_Generators.Compute; exit Expanding_Retries; exception when Perfect_Hash_Generators.Too_Many_Tries => null; end; Seed := Seed * NV; end loop Retires_Without_Expand; NV := NV + 1; Seed := NV; end loop Expanding_Retries; Perfect_Hash_Generators.Produce (Package_Name); Perfect_Hash_Generators.Finalize; exception when others => Perfect_Hash_Generators.Finalize; raise; end Build_Perfect_Hash; end Natools.Smaz.Tools.GNAT;
zhmu/ananas
Ada
1,134
adb
-- { dg-do run } with System; procedure SSO5 is type Short_Int is mod 2**16; type Rec1 is record F1 : Short_Int; F2 : Short_Int; end record; for Rec1 use record F1 at 0 range 0 .. 15; F2 at 0 range 16 .. 31; end record; for Rec1'Bit_Order use System.High_Order_First; for Rec1'Scalar_Storage_Order use System.High_Order_First; type Rec2 is record R1 : Rec1; end record; for Rec2 use record R1 at 0 range 1 .. 32; end record; for Rec2'Bit_Order use System.High_Order_First; for Rec2'Scalar_Storage_Order use System.High_Order_First; type Rec3 is record Data : Rec1; end record; for Rec3 use record Data at 0 range 0 .. 31; end record; for Rec3'Bit_Order use System.High_Order_First; for Rec3'Scalar_Storage_Order use System.High_Order_First; procedure Copy (Message : in Rec3) is Local : Rec2; begin Local := (R1 => Message.Data); if Local.R1 /= Message.Data then raise Program_Error; end if; end; Message : Rec3; begin Message := (Data => (2, 3)); Copy(Message); end;
reznikmm/matreshka
Ada
4,766
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.Presentation_Notes_Elements; package Matreshka.ODF_Presentation.Notes_Elements is type Presentation_Notes_Element_Node is new Matreshka.ODF_Presentation.Abstract_Presentation_Element_Node and ODF.DOM.Presentation_Notes_Elements.ODF_Presentation_Notes with null record; overriding function Create (Parameters : not null access Matreshka.DOM_Elements.Element_L2_Parameters) return Presentation_Notes_Element_Node; overriding function Get_Local_Name (Self : not null access constant Presentation_Notes_Element_Node) return League.Strings.Universal_String; overriding procedure Enter_Node (Self : not null access Presentation_Notes_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 Presentation_Notes_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 Presentation_Notes_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_Presentation.Notes_Elements;
micahwelf/FLTK-Ada
Ada
20,864
adb
with Interfaces.C.Strings, System, FLTK.Images.RGB; use type Interfaces.C.int, Interfaces.C.unsigned, Interfaces.C.Strings.chars_ptr, System.Address; package body FLTK.Widgets.Groups.Windows is procedure window_set_draw_hook (W, D : in System.Address); pragma Import (C, window_set_draw_hook, "window_set_draw_hook"); pragma Inline (window_set_draw_hook); procedure window_set_handle_hook (W, H : in System.Address); pragma Import (C, window_set_handle_hook, "window_set_handle_hook"); pragma Inline (window_set_handle_hook); function new_fl_window (X, Y, W, H : in Interfaces.C.int; Text : in Interfaces.C.char_array) return System.Address; pragma Import (C, new_fl_window, "new_fl_window"); pragma Inline (new_fl_window); function new_fl_window2 (W, H : in Interfaces.C.int; Text : in Interfaces.C.char_array) return System.Address; pragma Import (C, new_fl_window2, "new_fl_window2"); pragma Inline (new_fl_window2); procedure free_fl_window (W : in System.Address); pragma Import (C, free_fl_window, "free_fl_window"); pragma Inline (free_fl_window); procedure fl_window_show (W : in System.Address); pragma Import (C, fl_window_show, "fl_window_show"); pragma Inline (fl_window_show); procedure fl_window_hide (W : in System.Address); pragma Import (C, fl_window_hide, "fl_window_hide"); pragma Inline (fl_window_hide); function fl_window_shown (W : in System.Address) return Interfaces.C.int; pragma Import (C, fl_window_shown, "fl_window_shown"); pragma Inline (fl_window_shown); procedure fl_window_wait_for_expose (W : in System.Address); pragma Import (C, fl_window_wait_for_expose, "fl_window_wait_for_expose"); pragma Inline (fl_window_wait_for_expose); procedure fl_window_iconize (W : in System.Address); pragma Import (C, fl_window_iconize, "fl_window_iconize"); pragma Inline (fl_window_iconize); procedure fl_window_make_current (W : in System.Address); pragma Import (C, fl_window_make_current, "fl_window_make_current"); pragma Inline (fl_window_make_current); procedure fl_window_free_position (W : in System.Address); pragma Import (C, fl_window_free_position, "fl_window_free_position"); pragma Inline (fl_window_free_position); function fl_window_fullscreen_active (W : in System.Address) return Interfaces.C.unsigned; pragma Import (C, fl_window_fullscreen_active, "fl_window_fullscreen_active"); pragma Inline (fl_window_fullscreen_active); procedure fl_window_fullscreen (W : in System.Address); pragma Import (C, fl_window_fullscreen, "fl_window_fullscreen"); pragma Inline (fl_window_fullscreen); procedure fl_window_fullscreen_off (W : in System.Address); pragma Import (C, fl_window_fullscreen_off, "fl_window_fullscreen_off"); pragma Inline (fl_window_fullscreen_off); procedure fl_window_fullscreen_off2 (N : in System.Address; X, Y, W, H : in Interfaces.C.int); pragma Import (C, fl_window_fullscreen_off2, "fl_window_fullscreen_off2"); pragma Inline (fl_window_fullscreen_off2); procedure fl_window_fullscreen_screens (W : in System.Address; T, B, L, R : in Interfaces.C.int); pragma Import (C, fl_window_fullscreen_screens, "fl_window_fullscreen_screens"); pragma Inline (fl_window_fullscreen_screens); procedure fl_window_set_icon (W, P : in System.Address); pragma Import (C, fl_window_set_icon, "fl_window_set_icon"); pragma Inline (fl_window_set_icon); procedure fl_window_default_icon (P : in System.Address); pragma Import (C, fl_window_default_icon, "fl_window_default_icon"); pragma Inline (fl_window_default_icon); function fl_window_get_iconlabel (W : in System.Address) return Interfaces.C.Strings.chars_ptr; pragma Import (C, fl_window_get_iconlabel, "fl_window_get_iconlabel"); pragma Inline (fl_window_get_iconlabel); procedure fl_window_set_iconlabel (W : in System.Address; S : in Interfaces.C.char_array); pragma Import (C, fl_window_set_iconlabel, "fl_window_set_iconlabel"); pragma Inline (fl_window_set_iconlabel); procedure fl_window_set_cursor (W : in System.Address; C : in Interfaces.C.int); pragma Import (C, fl_window_set_cursor, "fl_window_set_cursor"); pragma Inline (fl_window_set_cursor); procedure fl_window_set_cursor2 (W, P : in System.Address; X, Y : in Interfaces.C.int); pragma Import (C, fl_window_set_cursor2, "fl_window_set_cursor2"); pragma Inline (fl_window_set_cursor2); procedure fl_window_set_default_cursor (W : in System.Address; C : in Interfaces.C.int); pragma Import (C, fl_window_set_default_cursor, "fl_window_set_default_cursor"); pragma Inline (fl_window_set_default_cursor); function fl_window_get_border (W : in System.Address) return Interfaces.C.unsigned; pragma Import (C, fl_window_get_border, "fl_window_get_border"); pragma Inline (fl_window_get_border); procedure fl_window_set_border (W : in System.Address; S : in Interfaces.C.int); pragma Import (C, fl_window_set_border, "fl_window_set_border"); pragma Inline (fl_window_set_border); function fl_window_get_override (W : in System.Address) return Interfaces.C.unsigned; pragma Import (C, fl_window_get_override, "fl_window_get_override"); pragma Inline (fl_window_get_override); procedure fl_window_set_override (W : in System.Address); pragma Import (C, fl_window_set_override, "fl_window_set_override"); pragma Inline (fl_window_set_override); function fl_window_modal (W : in System.Address) return Interfaces.C.unsigned; pragma Import (C, fl_window_modal, "fl_window_modal"); pragma Inline (fl_window_modal); function fl_window_non_modal (W : in System.Address) return Interfaces.C.unsigned; pragma Import (C, fl_window_non_modal, "fl_window_non_modal"); pragma Inline (fl_window_non_modal); procedure fl_window_clear_modal_states (W : in System.Address); pragma Import (C, fl_window_clear_modal_states, "fl_window_clear_modal_states"); pragma Inline (fl_window_clear_modal_states); procedure fl_window_set_modal (W : in System.Address); pragma Import (C, fl_window_set_modal, "fl_window_set_modal"); pragma Inline (fl_window_set_modal); procedure fl_window_set_non_modal (W : in System.Address); pragma Import (C, fl_window_set_non_modal, "fl_window_set_non_modal"); pragma Inline (fl_window_set_non_modal); function fl_window_get_label (W : in System.Address) return Interfaces.C.Strings.chars_ptr; pragma Import (C, fl_window_get_label, "fl_window_get_label"); pragma Inline (fl_window_get_label); procedure fl_window_set_label (W : in System.Address; T : in Interfaces.C.char_array); pragma Import (C, fl_window_set_label, "fl_window_set_label"); pragma Inline (fl_window_set_label); procedure fl_window_hotspot (W : in System.Address; X, Y, S : in Interfaces.C.int); pragma Import (C, fl_window_hotspot, "fl_window_hotspot"); pragma Inline (fl_window_hotspot); procedure fl_window_hotspot2 (W, I : in System.Address; S : in Interfaces.C.int); pragma Import (C, fl_window_hotspot2, "fl_window_hotspot2"); pragma Inline (fl_window_hotspot2); procedure fl_window_size_range (W : in System.Address; LW, LH, HW, HH, DW, DH, A : in Interfaces.C.int); pragma Import (C, fl_window_size_range, "fl_window_size_range"); pragma Inline (fl_window_size_range); procedure fl_window_shape (W, P : in System.Address); pragma Import (C, fl_window_shape, "fl_window_shape"); pragma Inline (fl_window_shape); function fl_window_get_x_root (W : in System.Address) return Interfaces.C.int; pragma Import (C, fl_window_get_x_root, "fl_window_get_x_root"); pragma Inline (fl_window_get_x_root); function fl_window_get_y_root (W : in System.Address) return Interfaces.C.int; pragma Import (C, fl_window_get_y_root, "fl_window_get_y_root"); pragma Inline (fl_window_get_y_root); function fl_window_get_decorated_w (W : in System.Address) return Interfaces.C.int; pragma Import (C, fl_window_get_decorated_w, "fl_window_get_decorated_w"); pragma Inline (fl_window_get_decorated_w); function fl_window_get_decorated_h (W : in System.Address) return Interfaces.C.int; pragma Import (C, fl_window_get_decorated_h, "fl_window_get_decorated_h"); pragma Inline (fl_window_get_decorated_h); procedure fl_window_draw (W : in System.Address); pragma Import (C, fl_window_draw, "fl_window_draw"); pragma Inline (fl_window_draw); function fl_window_handle (W : in System.Address; E : in Interfaces.C.int) return Interfaces.C.int; pragma Import (C, fl_window_handle, "fl_window_handle"); pragma Inline (fl_window_handle); procedure Finalize (This : in out Window) is begin if This.Void_Ptr /= System.Null_Address and then This in Window'Class then This.Clear; free_fl_window (This.Void_Ptr); This.Void_Ptr := System.Null_Address; end if; Finalize (Group (This)); end Finalize; package body Forge is function Create (X, Y, W, H : in Integer; Text : in String) return Window is begin return This : Window do This.Void_Ptr := new_fl_window (Interfaces.C.int (X), Interfaces.C.int (Y), Interfaces.C.int (W), Interfaces.C.int (H), Interfaces.C.To_C (Text)); fl_group_end (This.Void_Ptr); fl_widget_set_user_data (This.Void_Ptr, Widget_Convert.To_Address (This'Unchecked_Access)); window_set_draw_hook (This.Void_Ptr, Draw_Hook'Address); window_set_handle_hook (This.Void_Ptr, Handle_Hook'Address); end return; end Create; function Create (W, H : in Integer; Text : in String) return Window is begin return This : Window do This.Void_Ptr := new_fl_window2 (Interfaces.C.int (W), Interfaces.C.int (H), Interfaces.C.To_C (Text)); fl_group_end (This.Void_Ptr); fl_widget_set_user_data (This.Void_Ptr, Widget_Convert.To_Address (This'Unchecked_Access)); window_set_draw_hook (This.Void_Ptr, Draw_Hook'Address); window_set_handle_hook (This.Void_Ptr, Handle_Hook'Address); end return; end Create; end Forge; procedure Show (This : in out Window) is begin fl_window_show (This.Void_Ptr); end Show; procedure Hide (This : in out Window) is begin fl_window_hide (This.Void_Ptr); end Hide; function Is_Shown (This : in Window) return Boolean is begin return fl_window_shown (This.Void_Ptr) /= 0; end Is_Shown; procedure Wait_For_Expose (This : in out Window) is begin fl_window_wait_for_expose (This.Void_Ptr); end Wait_For_Expose; procedure Iconify (This : in out Window) is begin fl_window_iconize (This.Void_Ptr); end Iconify; procedure Make_Current (This : in out Window) is begin fl_window_make_current (This.Void_Ptr); Last_Current := This'Unchecked_Access; end Make_Current; function Last_Made_Current return access Window'Class is begin return Last_Current; end Last_Made_Current; procedure Free_Position (This : in out Window) is begin fl_window_free_position (This.Void_Ptr); end Free_Position; function Is_Fullscreen (This : in Window) return Boolean is begin return fl_window_fullscreen_active (This.Void_Ptr) /= 0; end Is_Fullscreen; procedure Fullscreen_On (This : in out Window) is begin fl_window_fullscreen (This.Void_Ptr); end Fullscreen_On; procedure Fullscreen_Off (This : in out Window) is begin fl_window_fullscreen_off (This.Void_Ptr); end Fullscreen_Off; procedure Fullscreen_Off (This : in out Window; X, Y, W, H : in Integer) is begin fl_window_fullscreen_off2 (This.Void_Ptr, Interfaces.C.int (X), Interfaces.C.int (Y), Interfaces.C.int (W), Interfaces.C.int (H)); end Fullscreen_Off; procedure Fullscreen_Screens (This : in out Window; Top, Bottom, Left, Right : in Natural) is begin fl_window_fullscreen_screens (This.Void_Ptr, Interfaces.C.int (Top), Interfaces.C.int (Bottom), Interfaces.C.int (Left), Interfaces.C.int (Right)); end Fullscreen_Screens; procedure Set_Icon (This : in out Window; Pic : in out FLTK.Images.RGB.RGB_Image'Class) is begin fl_window_set_icon (This.Void_Ptr, Wrapper (Pic).Void_Ptr); end Set_Icon; procedure Set_Default_Icon (Pic : in out FLTK.Images.RGB.RGB_Image'Class) is begin fl_window_default_icon (Wrapper (Pic).Void_Ptr); end Set_Default_Icon; function Get_Icon_Label (This : in Window) return String is Ptr : Interfaces.C.Strings.chars_ptr := fl_window_get_iconlabel (This.Void_Ptr); begin if Ptr = Interfaces.C.Strings.Null_Ptr then return ""; else -- pointer to internal buffer only, so no Free required return Interfaces.C.Strings.Value (Ptr); end if; end Get_Icon_Label; procedure Set_Icon_Label (This : in out Window; To : in String) is begin fl_window_set_iconlabel (This.Void_Ptr, Interfaces.C.To_C (To)); end Set_Icon_Label; procedure Set_Cursor (This : in out Window; To : in Cursor) is begin fl_window_set_cursor (This.Void_Ptr, Cursor_Values (To)); end Set_Cursor; procedure Set_Cursor (This : in out Window; Pic : in out FLTK.Images.RGB.RGB_Image'Class; Hot_X, Hot_Y : in Integer) is begin fl_window_set_cursor2 (This.Void_Ptr, Wrapper (Pic).Void_Ptr, Interfaces.C.int (Hot_X), Interfaces.C.int (Hot_Y)); end Set_Cursor; procedure Set_Default_Cursor (This : in out Window; To : in Cursor) is begin fl_window_set_default_cursor (This.Void_Ptr, Cursor_Values (To)); end Set_Default_Cursor; function Get_Border_State (This : in Window) return Border_State is begin return Border_State'Val (fl_window_get_border (This.Void_Ptr)); end Get_Border_State; procedure Set_Border_State (This : in out Window; To : in Border_State) is begin fl_window_set_border (This.Void_Ptr, Border_State'Pos (To)); end Set_Border_State; function Is_Override (This : in Window) return Boolean is begin return fl_window_get_override (This.Void_Ptr) /= 0; end Is_Override; procedure Set_Override (This : in out Window) is begin fl_window_set_override (This.Void_Ptr); end Set_Override; function Get_Modal_State (This : in Window) return Modal_State is begin if fl_window_modal (This.Void_Ptr) /= 0 then return Modal; elsif fl_window_non_modal (This.Void_Ptr) /= 0 then return Non_Modal; else return Normal; end if; end Get_Modal_State; procedure Set_Modal_State (This : in out Window; To : in Modal_State) is begin case To is when Normal => fl_window_clear_modal_states (This.Void_Ptr); when Non_Modal => fl_window_set_non_modal (This.Void_Ptr); when Modal => fl_window_set_modal (This.Void_Ptr); end case; end Set_Modal_State; function Get_Label (This : in Window) return String is Ptr : Interfaces.C.Strings.chars_ptr := fl_window_get_label (This.Void_Ptr); begin if Ptr = Interfaces.C.Strings.Null_Ptr then return ""; else -- pointer to internal buffer only, so no Free required return Interfaces.C.Strings.Value (Ptr); end if; end Get_Label; procedure Set_Label (This : in out Window; Text : in String) is begin fl_window_set_label (This.Void_Ptr, Interfaces.C.To_C (Text)); end Set_Label; procedure Hotspot (This : in out Window; X, Y : in Integer; Offscreen : in Boolean := False) is begin fl_window_hotspot (This.Void_Ptr, Interfaces.C.int (X), Interfaces.C.int (Y), Boolean'Pos (Offscreen)); end Hotspot; procedure Hotspot (This : in out Window; Item : in Widget'Class; Offscreen : in Boolean := False) is begin fl_window_hotspot2 (This.Void_Ptr, Item.Void_Ptr, Boolean'Pos (Offscreen)); end Hotspot; procedure Set_Size_Range (This : in out Window; Min_W, Min_H : in Integer; Max_W, Max_H, Incre_W, Incre_H : in Integer := 0; Keep_Aspect : in Boolean := False) is begin fl_window_size_range (This.Void_Ptr, Interfaces.C.int (Min_W), Interfaces.C.int (Min_H), Interfaces.C.int (Max_W), Interfaces.C.int (Max_H), Interfaces.C.int (Incre_W), Interfaces.C.int (Incre_H), Boolean'Pos (Keep_Aspect)); end Set_Size_Range; procedure Shape (This : in out Window; Pic : in out FLTK.Images.Image'Class) is begin fl_window_shape (This.Void_Ptr, Wrapper (Pic).Void_Ptr); end Shape; function Get_X_Root (This : in Window) return Integer is begin return Integer (fl_window_get_x_root (This.Void_Ptr)); end Get_X_Root; function Get_Y_Root (This : in Window) return Integer is begin return Integer (fl_window_get_y_root (This.Void_Ptr)); end Get_Y_Root; function Get_Decorated_W (This : in Window) return Integer is begin return Integer (fl_window_get_decorated_w (This.Void_Ptr)); end Get_Decorated_W; function Get_Decorated_H (This : in Window) return Integer is begin return Integer (fl_window_get_decorated_h (This.Void_Ptr)); end Get_Decorated_H; procedure Draw (This : in out Window) is begin fl_window_draw (This.Void_Ptr); end Draw; function Handle (This : in out Window; Event : in Event_Kind) return Event_Outcome is begin return Event_Outcome'Val (fl_window_handle (This.Void_Ptr, Event_Kind'Pos (Event))); end Handle; end FLTK.Widgets.Groups.Windows;
reznikmm/matreshka
Ada
3,704
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.Script_Event_Listener_Elements is pragma Preelaborate; type ODF_Script_Event_Listener is limited interface and XML.DOM.Elements.DOM_Element; type ODF_Script_Event_Listener_Access is access all ODF_Script_Event_Listener'Class with Storage_Size => 0; end ODF.DOM.Script_Event_Listener_Elements;
reznikmm/increment
Ada
249
ads
-- Copyright (c) 2015-2017 Maxim Reznik <[email protected]> -- -- SPDX-License-Identifier: MIT -- License-Filename: LICENSE ------------------------------------------------------------- package Incr.Parsers is pragma Pure; end Incr.Parsers;
io7m/coreland-vector-ada
Ada
719
adb
package body vector.angle_norm is -- C imports function vec_angle_norm_f (a, b : vector_f_t; n : ic.int) return scalar_f_t; pragma import (c, vec_angle_norm_f, "vec_anglenormNf_aligned"); function vec_angle_norm_d (a, b : vector_d_t; n : ic.int) return scalar_d_t; pragma import (c, vec_angle_norm_d, "vec_anglenormNd_aligned"); -- angle between normalized vectors function f (a, b : in vector_f_t) return scalar_f_t is begin return vec_angle_norm_f (a, b, ic.int (size)); end f; pragma inline (f); function d (a, b : in vector_d_t) return scalar_d_t is begin return vec_angle_norm_d (a, b, ic.int (size)); end d; pragma inline (d); end vector.angle_norm;
stcarrez/ada-ado
Ada
2,612
ads
----------------------------------------------------------------------- -- ado-queries-loaders -- Loader for Database Queries -- Copyright (C) 2011, 2012, 2017, 2019 Stephane Carrez -- Written by Stephane Carrez ([email protected]) -- -- Licensed under the Apache License, Version 2.0 (the "License"); -- you may not use this file except in compliance with the License. -- You may obtain a copy of the License at -- -- http://www.apache.org/licenses/LICENSE-2.0 -- -- Unless required by applicable law or agreed to in writing, software -- distributed under the License is distributed on an "AS IS" BASIS, -- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -- See the License for the specific language governing permissions and -- limitations under the License. ----------------------------------------------------------------------- with ADO.Connections; package ADO.Queries.Loaders is generic Path : String; Sha1 : String; package File is Name : aliased constant String := Path; Hash : aliased constant String := Sha1; File : aliased Query_File; end File; generic Name : String; File : Query_File_Access; package Query is Query_Name : aliased constant String := Name; Query : aliased Query_Definition; end Query; -- Read the query definition. procedure Read_Query (Manager : in Query_Manager; Into : in Query_Definition_Access); -- Register the query definition in the query file. Registration is done -- in the package elaboration phase. procedure Register (File : in Query_File_Access; Query : in Query_Definition_Access); -- Initialize the queries to look in the list of directories specified by <b>Paths</b>. -- Each search directory is separated by ';' (yes, even on Unix). -- When <b>Load</b> is true, read the XML query file and initialize the query -- definitions from that file. procedure Initialize (Manager : in out Query_Manager; Config : in ADO.Connections.Configuration'Class); -- Find the query identified by the given name. function Find_Query (Name : in String) return Query_Definition_Access; private -- Returns True if the XML query file must be reloaded. function Is_Modified (File : in out Query_File_Info) return Boolean; -- Read the query file and all the associated definitions. procedure Read_Query (Manager : in Query_Manager; File : in out Query_File_Info); end ADO.Queries.Loaders;
meowthsli/EVB1000
Ada
2,239
ads
------------------------------------------------------------------------------- -- Copyright (c) 2016 Daniel King -- -- Permission is hereby granted, free of charge, to any person obtaining a copy -- of this software and associated documentation files (the "Software"), to -- deal in the Software without restriction, including without limitation the -- rights to use, copy, modify, merge, publish, distribute, sublicense, and/or -- sell copies of the Software, and to permit persons to whom the Software is -- furnished to do so, subject to the following conditions: -- -- The above copyright notice and this permission notice shall be included in -- all copies or substantial portions of the Software. -- -- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING -- FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS -- IN THE SOFTWARE. ------------------------------------------------------------------------------- -- Provides an API for controlling the four LEDs on the EVB1000 that are -- available to the host processor (STM32F105). -- -- The LEDs are numbered 1 .. 4 in this API, with LED 1 being the leftmost LED -- and LED 4 being the rightmost LED. -- -- LEDs 1 and 2 are yellow, and LEDs 3 and 4 are red in color. package EVB1000.LED with SPARK_Mode => On, Abstract_State => (LEDs_State with External), Initializes => LEDs_State is type LED_Number is range 1 .. 4; type LED_Array is array (LED_Number) of Boolean; procedure Set_LED(LED : in LED_Number; On : in Boolean) with Global => (In_Out => LEDs_State), Depends => (LEDs_State => + (LED, On)); procedure Set_LEDs(LEDs : in LED_Array) with Global => (Output => LEDs_State), Depends => (LEDs_State => LEDs); procedure Toggle_LED (LED : in LED_Number) with Global => (In_Out => LEDs_State), Depends => (LEDs_State => + LED); end EVB1000.LED;
Fabien-Chouteau/Ada_Drivers_Library
Ada
6,781
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 NRF51_SVD.UICR is pragma Preelaborate; --------------- -- Registers -- --------------- -- Readback protect region 0. Will be ignored if pre-programmed factory -- code is present on the chip. type RBPCONF_PR0_Field is ( -- Enabled. Enabled, -- Disabled. Disabled) with Size => 8; for RBPCONF_PR0_Field use (Enabled => 0, Disabled => 255); -- Readback protect all code in the device. type RBPCONF_PALL_Field is ( -- Enabled. Enabled, -- Disabled. Disabled) with Size => 8; for RBPCONF_PALL_Field use (Enabled => 0, Disabled => 255); -- Readback protection configuration. type RBPCONF_Register is record -- Readback protect region 0. Will be ignored if pre-programmed factory -- code is present on the chip. PR0 : RBPCONF_PR0_Field := NRF51_SVD.UICR.Disabled; -- Readback protect all code in the device. PALL : RBPCONF_PALL_Field := NRF51_SVD.UICR.Disabled; -- unspecified Reserved_16_31 : HAL.UInt16 := 16#FFFF#; end record with Volatile_Full_Access, Size => 32, Bit_Order => System.Low_Order_First; for RBPCONF_Register use record PR0 at 0 range 0 .. 7; PALL at 0 range 8 .. 15; Reserved_16_31 at 0 range 16 .. 31; end record; -- Reset value for CLOCK XTALFREQ register. type XTALFREQ_XTALFREQ_Field is ( -- 32MHz Xtal is used. XTALFREQ_XTALFREQ_Field_32Mhz, -- 16MHz Xtal is used. XTALFREQ_XTALFREQ_Field_16Mhz) with Size => 8; for XTALFREQ_XTALFREQ_Field use (XTALFREQ_XTALFREQ_Field_32Mhz => 0, XTALFREQ_XTALFREQ_Field_16Mhz => 255); -- Reset value for CLOCK XTALFREQ register. type XTALFREQ_Register is record -- Reset value for CLOCK XTALFREQ register. XTALFREQ : XTALFREQ_XTALFREQ_Field := NRF51_SVD.UICR.XTALFREQ_XTALFREQ_Field_16Mhz; -- unspecified Reserved_8_31 : HAL.UInt24 := 16#FFFFFF#; end record with Volatile_Full_Access, Size => 32, Bit_Order => System.Low_Order_First; for XTALFREQ_Register use record XTALFREQ at 0 range 0 .. 7; Reserved_8_31 at 0 range 8 .. 31; end record; subtype FWID_FWID_Field is HAL.UInt16; -- Firmware ID. type FWID_Register is record -- Read-only. Identification number for the firmware loaded into the -- chip. FWID : FWID_FWID_Field; -- unspecified Reserved_16_31 : HAL.UInt16; end record with Volatile_Full_Access, Size => 32, Bit_Order => System.Low_Order_First; for FWID_Register use record FWID at 0 range 0 .. 15; Reserved_16_31 at 0 range 16 .. 31; end record; -- Reserved for Nordic firmware design. -- Reserved for Nordic firmware design. type NRFFW_Registers is array (0 .. 14) of HAL.UInt32 with Volatile; -- Reserved for Nordic hardware design. -- Reserved for Nordic hardware design. type NRFHW_Registers is array (0 .. 11) of HAL.UInt32 with Volatile; -- Reserved for customer. -- Reserved for customer. type CUSTOMER_Registers is array (0 .. 31) of HAL.UInt32 with Volatile; ----------------- -- Peripherals -- ----------------- type UICR_Disc is ( Mode_1, Mode_2); -- User Information Configuration. type UICR_Peripheral (Discriminent : UICR_Disc := Mode_1) is record -- Length of code region 0. CLENR0 : aliased HAL.UInt32; -- Readback protection configuration. RBPCONF : aliased RBPCONF_Register; -- Reset value for CLOCK XTALFREQ register. XTALFREQ : aliased XTALFREQ_Register; -- Firmware ID. FWID : aliased FWID_Register; -- Reserved for Nordic hardware design. NRFHW : aliased NRFHW_Registers; -- Reserved for customer. CUSTOMER : aliased CUSTOMER_Registers; case Discriminent is when Mode_1 => -- Bootloader start address. BOOTLOADERADDR : aliased HAL.UInt32; when Mode_2 => -- Reserved for Nordic firmware design. NRFFW : aliased NRFFW_Registers; end case; end record with Unchecked_Union, Volatile; for UICR_Peripheral use record CLENR0 at 16#0# range 0 .. 31; RBPCONF at 16#4# range 0 .. 31; XTALFREQ at 16#8# range 0 .. 31; FWID at 16#10# range 0 .. 31; NRFHW at 16#50# range 0 .. 383; CUSTOMER at 16#80# range 0 .. 1023; BOOTLOADERADDR at 16#14# range 0 .. 31; NRFFW at 16#14# range 0 .. 479; end record; -- User Information Configuration. UICR_Periph : aliased UICR_Peripheral with Import, Address => System'To_Address (16#10001000#); end NRF51_SVD.UICR;
zhmu/ananas
Ada
1,634
adb
-- { dg-do compile } -- { dg-options "-fdump-tree-gimple" } with Atomic6_Pkg; use Atomic6_Pkg; procedure Atomic6_2 is Temp : Integer; begin Counter1 := Counter1 + Counter2; Timer1 := Timer1 + Timer2; Counter1 := Counter1 + Int(Timer1); Timer1 := Timer1 + Integer(Counter1); Temp := Integer(Counter1) + Timer1; Counter1 := Int(Timer1) + Int(Temp); Timer1 := Integer(Counter1) + Temp; if Counter1 /= Counter2 then raise Program_Error; end if; if Timer1 /= Timer2 then raise Program_Error; end if; end; -- { dg-final { scan-tree-dump-times "atomic_load\[^\n\r\]*&atomic6_pkg__counter1" 6 "gimple"} } -- { dg-final { scan-tree-dump-times "atomic_load\[^\n\r\]*&atomic6_pkg__counter2" 2 "gimple"} } -- { dg-final { scan-tree-dump-times "atomic_load\[^\n\r\]*&atomic6_pkg__timer1" 6 "gimple"} } -- { dg-final { scan-tree-dump-times "atomic_load\[^\n\r\]*&atomic6_pkg__timer2" 2 "gimple"} } -- { dg-final { scan-tree-dump-times "atomic_load\[^\n\r\]*&temp" 0 "gimple"} } -- { dg-final { scan-tree-dump-times "atomic_load\[^\n\r\]*ptr" 0 "gimple"} } -- { dg-final { scan-tree-dump-times "atomic_store\[^\n\r\]*&atomic6_pkg__counter1" 3 "gimple"} } -- { dg-final { scan-tree-dump-times "atomic_store\[^\n\r\]*&atomic6_pkg__counter2" 0 "gimple"} } -- { dg-final { scan-tree-dump-times "atomic_store\[^\n\r\]*&atomic6_pkg__timer1" 3 "gimple"} } -- { dg-final { scan-tree-dump-times "atomic_store\[^\n\r\]*&atomic6_pkg__timer2" 0 "gimple"} } -- { dg-final { scan-tree-dump-times "atomic_store\[^\n\r\]*&temp" 0 "gimple"} } -- { dg-final { scan-tree-dump-times "atomic_store\[^\n\r\]*ptr" 0 "gimple"} }
MinimSecure/unum-sdk
Ada
912
adb
-- Copyright 2008-2019 Free Software Foundation, Inc. -- -- This program is free software; you can redistribute it and/or modify -- it under the terms of the GNU General Public License as published by -- the Free Software Foundation; either version 3 of the License, or -- (at your option) any later version. -- -- This program is distributed in the hope that it will be useful, -- but WITHOUT ANY WARRANTY; without even the implied warranty of -- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -- GNU General Public License for more details. -- -- You should have received a copy of the GNU General Public License -- along with this program. If not, see <http://www.gnu.org/licenses/>. with Pck; use Pck; procedure Foo is My_String : constant String := "Hello World"; begin First := ASCII.NUL; Last := ASCII.NUL; Length := -1; Call_Me (My_String); -- STOP end Foo;
reznikmm/matreshka
Ada
10,519
adb
------------------------------------------------------------------------------ -- -- -- Matreshka Project -- -- -- -- Localization, Internationalization, Globalization for Ada -- -- -- -- Runtime Library Component -- -- -- ------------------------------------------------------------------------------ -- -- -- Copyright © 2011-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$ ------------------------------------------------------------------------------ package body Matreshka.Internals.Calendars.Gregorian is -- Gregorian_Epoch : constant := 1_721_426; Min_Year : constant := -10_000; Julian_Epoch : constant := 1_931_305; -- days from Min_Year to zero julian day Days_In_4_Years : constant := 365 * 4 + 1; Days_In_400_Years : constant := ((365 * 4 + 1) * 25 - 1) * 4 + 1; procedure Split (Julian_Day : Julian_Day_Number; Shifted_Year : out Julian_Day_Number; Day_In_Year : out Julian_Day_Number); --------- -- Day -- --------- function Day (Julian_Day : Julian_Day_Number) return Day_Number is Days : Julian_Day_Number; Years : Julian_Day_Number; Shifted_Month : Julian_Day_Number; begin Split (Julian_Day, Shifted_Year => Years, Day_In_Year => Days); Shifted_Month := (5 * Days + 2) / 153; return Day_Number (Days - (153 * Shifted_Month + 2) / 5 + 1); end Day; ----------------- -- Day_Of_Week -- ----------------- function Day_Of_Week (Julian_Day : Julian_Day_Number) return Day_Of_Week_Number is begin return Day_Of_Week_Number ((Julian_Day mod 7) + 1); end Day_Of_Week; ----------------- -- Day_Of_Year -- ----------------- function Day_Of_Year (Julian_Day : Julian_Day_Number) return Day_Of_Year_Number is Days : Julian_Day_Number; Years : Julian_Day_Number; begin Split (Julian_Day, Shifted_Year => Years, Day_In_Year => Days); return Day_Of_Year_Number (Days + 1); end Day_Of_Year; ------------------- -- Days_In_Month -- ------------------- function Days_In_Month (Date : Julian_Day_Number) return Day_Number is begin return Days_In_Month (Year (Date), Month (Date)); end Days_In_Month; ------------------- -- Days_In_Month -- ------------------- function Days_In_Month (Year : Year_Number; Month : Year_Number) return Day_Number is -- Length of months has some kind of regularity and circularity: -- -- 12 31 7 31 -- 1 31 8 31 -- 2 28/29 9 30 -- 3 31 10 31 -- 4 30 11 30 -- 5 31 -- 6 30 -- -- To make December be first month the reminder of 12 of Month is -- computed. Reminder of 7 is used to compute number of month in cycle. -- Now, base number of days can be computed as: -- -- Base := 30 + Month_In_Cycle mod 2 -- -- Later, correction is computed: -- -- +1, then month_in_cycle = 0, so, for July and December. -- -1, then Month = 2 and Is_Leap_Year (Year), so for February of leap -- year -- -2, then Month = 2 and not Is_Leap_Year (Year), so for February of -- non leap year. -- 0, otherwise Month_In_Cycle : constant Integer := (Month mod 12) mod 7; Base : Integer := 30 + (Month_In_Cycle mod 2); begin if Month_In_Cycle = 0 then Base := Base + 1; elsif Month = 2 then Base := Base - 1; if not Is_Leap_Year (Year) then Base := Base - 1; end if; end if; return Base; end Days_In_Month; ------------------ -- Days_In_Year -- ------------------ function Days_In_Year (Date : Julian_Day_Number) return Day_Of_Year_Number is begin return Days_In_Year (Year (Date)); end Days_In_Year; ------------------ -- Days_In_Year -- ------------------ function Days_In_Year (Year : Year_Number) return Day_Of_Year_Number is begin if Is_Leap_Year (Year) then return 366; else return 365; end if; end Days_In_Year; ------------------ -- Is_Leap_Year -- ------------------ function Is_Leap_Year (Date : Julian_Day_Number) return Boolean is begin return Is_Leap_Year (Year (Date)); end Is_Leap_Year; ------------------ -- Is_Leap_Year -- ------------------ function Is_Leap_Year (Year : Year_Number) return Boolean is begin return Year mod 4 = 0 and (Year mod 100 /= 0 or Year mod 400 = 0); end Is_Leap_Year; ---------------- -- Julian_Day -- ---------------- function Julian_Day (Year : Year_Number; Month : Month_Number; Day : Day_Number) return Julian_Day_Number is Shifted_Year : constant Julian_Day_Number := Julian_Day_Number (Year - Min_Year) - Boolean'Pos (Month <= 2); Shifted_Month : constant Julian_Day_Number := Julian_Day_Number (Month - 3) mod 12; begin return Julian_Day_Number (Day - 1) + (153 * Shifted_Month + 2) / 5 -- first day of year for month + 365 * Shifted_Year + Shifted_Year / 4 -- number of leap years - Shifted_Year / 100 -- excluding 100 + Shifted_Year / 400 -- includeing 400 - Julian_Epoch; -- days from Min_Year to zero julian day end Julian_Day; ----------- -- Month -- ----------- function Month (Julian_Day : Julian_Day_Number) return Month_Number is Days : Julian_Day_Number; Years : Julian_Day_Number; Shifted_Month : Julian_Day_Number; begin Split (Julian_Day, Shifted_Year => Years, Day_In_Year => Days); Shifted_Month := (5 * Days + 2) / 153; return Month_Number (((Shifted_Month + 2) mod 12) + 1); end Month; ----------- -- Split -- ----------- procedure Split (Date : Julian_Day_Number; Year : out Year_Number; Month : out Month_Number; Day : out Day_Number) is Days : Julian_Day_Number; Years : Julian_Day_Number; Shifted_Month : Julian_Day_Number; begin Split (Date, Shifted_Year => Years, Day_In_Year => Days); Shifted_Month := (5 * Days + 2) / 153; Year := Year_Number (Years + Boolean'Pos (Days > 305) + Min_Year); Month := Month_Number (((Shifted_Month + 2) mod 12) + 1); Day := Day_Number (Days - (153 * Shifted_Month + 2) / 5 + 1); end Split; ----------- -- Split -- ----------- procedure Split (Julian_Day : Julian_Day_Number; Shifted_Year : out Julian_Day_Number; Day_In_Year : out Julian_Day_Number) is Days : Julian_Day_Number := Julian_Day + Julian_Epoch; Years : Julian_Day_Number; Centuries : constant Julian_Day_Number := (4 * Days + 3) / Days_In_400_Years; begin Days := Days - Centuries * Days_In_400_Years / 4; Years := (Days * 4 + 3) / Days_In_4_Years; Day_In_Year := Days - Years * Days_In_4_Years / 4; Shifted_Year := 100 * Centuries + Years; end Split; ---------- -- Year -- ---------- function Year (Julian_Day : Julian_Day_Number) return Year_Number is Days : Julian_Day_Number; Years : Julian_Day_Number; begin Split (Julian_Day, Shifted_Year => Years, Day_In_Year => Days); return Year_Number (Years + Boolean'Pos (Days > 305) + Min_Year); end Year; end Matreshka.Internals.Calendars.Gregorian;
GPUWorks/lumen2
Ada
2,190
ads
-- Lumen.Binary.Endian -- Parent package for big- vs. little-endian -- byte-ordering services -- -- -- Chip Richards, NiEstu, Phoenix AZ, Summer 2010 -- This code is covered by the ISC License: -- -- Copyright © 2010, NiEstu -- -- Permission to use, copy, modify, and/or distribute this software for any -- purpose with or without fee is hereby granted, provided that the above -- copyright notice and this permission notice appear in all copies. -- -- The software is provided "as is" and the author disclaims all warranties -- with regard to this software including all implied warranties of -- merchantability and fitness. In no event shall the author be liable for any -- special, direct, indirect, or consequential damages or any damages -- whatsoever resulting from loss of use, data or profits, whether in an -- action of contract, negligence or other tortious action, arising out of or -- in connection with the use or performance of this software. package Lumen.Binary.Endian is pragma Elaborate_Body; --------------------------------------------------------------------------- type Byte_Order is (High_Order_First, Low_Order_First); --------------------------------------------------------------------------- -- This is the order defined as "network byte order" by the widely-used BSD -- networking routines, and by common practice on the Internet. Network_Byte_Order : constant Byte_Order := High_Order_First; --------------------------------------------------------------------------- -- Returns the current system's byte ordering configuration. function System_Byte_Order return Byte_Order with Inline => True; --------------------------------------------------------------------------- private -- This type is needed by the byte-order test in the Endian package body -- init code; otherwise, it could just go in the package body for -- Endian.Two_Byte type Two_Bytes is record B0 : Byte; B1 : Byte; end record; for Two_Bytes'Size use Short_Bits; for Two_Bytes use record B0 at 0 range 0 .. 7; B1 at 1 range 0 .. 7; end record; end Lumen.Binary.Endian;
stcarrez/ada-asf
Ada
925
ads
----------------------------------------------------------------------- -- asf-sessions -- ASF Sessions -- Copyright (C) 2010, 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. ----------------------------------------------------------------------- with Servlet.Sessions; package ASF.Sessions renames Servlet.Sessions;
annexi-strayline/ASAP-Unicode
Ada
3,448
ads
------------------------------------------------------------------------------ -- -- -- Unicode Utilities -- -- -- -- Normalization Form Utilities -- -- -- -- ------------------------------------------------------------------------ -- -- -- -- Copyright (C) 2019, ANNEXI-STRAYLINE Trans-Human Ltd. -- -- All rights reserved. -- -- -- -- Original Contributors: -- -- * Richard Wai (ANNEXI-STRAYLINE) -- -- -- -- Redistribution and use in source and binary forms, with or without -- -- modification, are permitted provided that the following conditions are -- -- met: -- -- -- -- * Redistributions of source code must retain the above copyright -- -- notice, this list of conditions and the following disclaimer. -- -- -- -- * Redistributions in binary form must reproduce the above copyright -- -- notice, this list of conditions and the following disclaimer in -- -- the documentation and/or other materials provided with the -- -- distribution. -- -- -- -- * Neither the name of the copyright holder nor the names of its -- -- contributors may be used to endorse or promote products derived -- -- from this software without specific prior written permission. -- -- -- -- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -- -- "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -- -- LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A -- -- PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -- -- OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -- -- SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -- -- LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -- -- DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -- -- THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -- -- (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -- -- OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -- -- -- ------------------------------------------------------------------------------ package Unicode.Normalization with Pure is end;
twdroeger/ada-awa
Ada
24,637
ads
----------------------------------------------------------------------- -- AWA.Counters.Models -- AWA.Counters.Models ----------------------------------------------------------------------- -- File generated by ada-gen DO NOT MODIFY -- Template used: templates/model/package-spec.xhtml -- Ada Generator: https://ada-gen.googlecode.com/svn/trunk Revision 1095 ----------------------------------------------------------------------- -- Copyright (C) 2019 Stephane Carrez -- Written by Stephane Carrez ([email protected]) -- -- Licensed under the Apache License, Version 2.0 (the "License"); -- you may not use this file except in compliance with the License. -- You may obtain a copy of the License at -- -- http://www.apache.org/licenses/LICENSE-2.0 -- -- Unless required by applicable law or agreed to in writing, software -- distributed under the License is distributed on an "AS IS" BASIS, -- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -- See the License for the specific language governing permissions and -- limitations under the License. ----------------------------------------------------------------------- pragma Warnings (Off); with ADO.Sessions; with ADO.Objects; with ADO.Statements; with ADO.SQL; with ADO.Schemas; with ADO.Queries; with ADO.Queries.Loaders; with Ada.Calendar; with Ada.Containers.Vectors; with Ada.Strings.Unbounded; with Util.Beans.Objects; with Util.Beans.Basic.Lists; with Util.Beans.Methods; pragma Warnings (On); package AWA.Counters.Models is pragma Style_Checks ("-mr"); type Counter_Ref is new ADO.Objects.Object_Ref with null record; type Counter_Definition_Ref is new ADO.Objects.Object_Ref with null record; type Visit_Ref is new ADO.Objects.Object_Ref with null record; -- Create an object key for Counter. function Counter_Key (Id : in ADO.Identifier) return ADO.Objects.Object_Key; -- Create an object key for Counter from a string. -- Raises Constraint_Error if the string cannot be converted into the object key. function Counter_Key (Id : in String) return ADO.Objects.Object_Key; Null_Counter : constant Counter_Ref; function "=" (Left, Right : Counter_Ref'Class) return Boolean; -- Set the object associated with the counter. procedure Set_Object_Id (Object : in out Counter_Ref; Value : in ADO.Identifier); -- Get the object associated with the counter. function Get_Object_Id (Object : in Counter_Ref) return ADO.Identifier; -- Set the day associated with the counter. procedure Set_Date (Object : in out Counter_Ref; Value : in Ada.Calendar.Time); -- Get the day associated with the counter. function Get_Date (Object : in Counter_Ref) return Ada.Calendar.Time; -- Set the counter value. procedure Set_Counter (Object : in out Counter_Ref; Value : in Integer); -- Get the counter value. function Get_Counter (Object : in Counter_Ref) return Integer; -- Set the counter definition identifier. procedure Set_Definition_Id (Object : in out Counter_Ref; Value : in ADO.Identifier); -- Get the counter definition identifier. function Get_Definition_Id (Object : in Counter_Ref) return ADO.Identifier; -- Load the entity identified by 'Id'. -- Raises the NOT_FOUND exception if it does not exist. procedure Load (Object : in out Counter_Ref; Session : in out ADO.Sessions.Session'Class; Id : in ADO.Identifier); -- Load the entity identified by 'Id'. -- Returns True in <b>Found</b> if the object was found and False if it does not exist. procedure Load (Object : in out Counter_Ref; Session : in out ADO.Sessions.Session'Class; Id : in ADO.Identifier; Found : out Boolean); -- Find and load the entity. overriding procedure Find (Object : in out Counter_Ref; Session : in out ADO.Sessions.Session'Class; Query : in ADO.SQL.Query'Class; Found : out Boolean); -- Save the entity. If the entity does not have an identifier, an identifier is allocated -- and it is inserted in the table. Otherwise, only data fields which have been changed -- are updated. overriding procedure Save (Object : in out Counter_Ref; Session : in out ADO.Sessions.Master_Session'Class); -- Delete the entity. overriding procedure Delete (Object : in out Counter_Ref; Session : in out ADO.Sessions.Master_Session'Class); overriding function Get_Value (From : in Counter_Ref; Name : in String) return Util.Beans.Objects.Object; -- Table definition COUNTER_TABLE : constant ADO.Schemas.Class_Mapping_Access; -- Internal method to allocate the Object_Record instance overriding procedure Allocate (Object : in out Counter_Ref); -- Copy of the object. procedure Copy (Object : in Counter_Ref; Into : in out Counter_Ref); -- -------------------- -- A counter definition defines what the counter represents. It uniquely identifies -- the counter for the Counter table. A counter may be associated with a database -- table. In that case, the counter definition has a relation to the corresponding Entity_Type. -- -------------------- -- Create an object key for Counter_Definition. function Counter_Definition_Key (Id : in ADO.Identifier) return ADO.Objects.Object_Key; -- Create an object key for Counter_Definition from a string. -- Raises Constraint_Error if the string cannot be converted into the object key. function Counter_Definition_Key (Id : in String) return ADO.Objects.Object_Key; Null_Counter_Definition : constant Counter_Definition_Ref; function "=" (Left, Right : Counter_Definition_Ref'Class) return Boolean; -- Set the counter name. procedure Set_Name (Object : in out Counter_Definition_Ref; Value : in Ada.Strings.Unbounded.Unbounded_String); procedure Set_Name (Object : in out Counter_Definition_Ref; Value : in String); -- Get the counter name. function Get_Name (Object : in Counter_Definition_Ref) return Ada.Strings.Unbounded.Unbounded_String; function Get_Name (Object : in Counter_Definition_Ref) return String; -- Set the counter unique id. procedure Set_Id (Object : in out Counter_Definition_Ref; Value : in ADO.Identifier); -- Get the counter unique id. function Get_Id (Object : in Counter_Definition_Ref) return ADO.Identifier; -- Set the optional entity type that identifies the database table. procedure Set_Entity_Type (Object : in out Counter_Definition_Ref; Value : in ADO.Nullable_Entity_Type); -- Get the optional entity type that identifies the database table. function Get_Entity_Type (Object : in Counter_Definition_Ref) return ADO.Nullable_Entity_Type; -- Load the entity identified by 'Id'. -- Raises the NOT_FOUND exception if it does not exist. procedure Load (Object : in out Counter_Definition_Ref; Session : in out ADO.Sessions.Session'Class; Id : in ADO.Identifier); -- Load the entity identified by 'Id'. -- Returns True in <b>Found</b> if the object was found and False if it does not exist. procedure Load (Object : in out Counter_Definition_Ref; Session : in out ADO.Sessions.Session'Class; Id : in ADO.Identifier; Found : out Boolean); -- Find and load the entity. overriding procedure Find (Object : in out Counter_Definition_Ref; Session : in out ADO.Sessions.Session'Class; Query : in ADO.SQL.Query'Class; Found : out Boolean); -- Save the entity. If the entity does not have an identifier, an identifier is allocated -- and it is inserted in the table. Otherwise, only data fields which have been changed -- are updated. overriding procedure Save (Object : in out Counter_Definition_Ref; Session : in out ADO.Sessions.Master_Session'Class); -- Delete the entity. overriding procedure Delete (Object : in out Counter_Definition_Ref; Session : in out ADO.Sessions.Master_Session'Class); overriding function Get_Value (From : in Counter_Definition_Ref; Name : in String) return Util.Beans.Objects.Object; -- Table definition COUNTER_DEFINITION_TABLE : constant ADO.Schemas.Class_Mapping_Access; -- Internal method to allocate the Object_Record instance overriding procedure Allocate (Object : in out Counter_Definition_Ref); -- Copy of the object. procedure Copy (Object : in Counter_Definition_Ref; Into : in out Counter_Definition_Ref); -- Create an object key for Visit. function Visit_Key (Id : in ADO.Identifier) return ADO.Objects.Object_Key; -- Create an object key for Visit from a string. -- Raises Constraint_Error if the string cannot be converted into the object key. function Visit_Key (Id : in String) return ADO.Objects.Object_Key; Null_Visit : constant Visit_Ref; function "=" (Left, Right : Visit_Ref'Class) return Boolean; -- Set the entity identifier. procedure Set_Object_Id (Object : in out Visit_Ref; Value : in ADO.Identifier); -- Get the entity identifier. function Get_Object_Id (Object : in Visit_Ref) return ADO.Identifier; -- Set the number of times the entity was visited by the user. procedure Set_Counter (Object : in out Visit_Ref; Value : in Integer); -- Get the number of times the entity was visited by the user. function Get_Counter (Object : in Visit_Ref) return Integer; -- Set the date and time when the entity was last visited. procedure Set_Date (Object : in out Visit_Ref; Value : in Ada.Calendar.Time); -- Get the date and time when the entity was last visited. function Get_Date (Object : in Visit_Ref) return Ada.Calendar.Time; -- Set the user who visited the entity. procedure Set_User (Object : in out Visit_Ref; Value : in ADO.Identifier); -- Get the user who visited the entity. function Get_User (Object : in Visit_Ref) return ADO.Identifier; -- Set the counter definition identifier. procedure Set_Definition_Id (Object : in out Visit_Ref; Value : in ADO.Identifier); -- Get the counter definition identifier. function Get_Definition_Id (Object : in Visit_Ref) return ADO.Identifier; -- Load the entity identified by 'Id'. -- Raises the NOT_FOUND exception if it does not exist. procedure Load (Object : in out Visit_Ref; Session : in out ADO.Sessions.Session'Class; Id : in ADO.Identifier); -- Load the entity identified by 'Id'. -- Returns True in <b>Found</b> if the object was found and False if it does not exist. procedure Load (Object : in out Visit_Ref; Session : in out ADO.Sessions.Session'Class; Id : in ADO.Identifier; Found : out Boolean); -- Find and load the entity. overriding procedure Find (Object : in out Visit_Ref; Session : in out ADO.Sessions.Session'Class; Query : in ADO.SQL.Query'Class; Found : out Boolean); -- Save the entity. If the entity does not have an identifier, an identifier is allocated -- and it is inserted in the table. Otherwise, only data fields which have been changed -- are updated. overriding procedure Save (Object : in out Visit_Ref; Session : in out ADO.Sessions.Master_Session'Class); -- Delete the entity. overriding procedure Delete (Object : in out Visit_Ref; Session : in out ADO.Sessions.Master_Session'Class); overriding function Get_Value (From : in Visit_Ref; Name : in String) return Util.Beans.Objects.Object; -- Table definition VISIT_TABLE : constant ADO.Schemas.Class_Mapping_Access; -- Internal method to allocate the Object_Record instance overriding procedure Allocate (Object : in out Visit_Ref); -- Copy of the object. procedure Copy (Object : in Visit_Ref; Into : in out Visit_Ref); package Visit_Vectors is new Ada.Containers.Vectors (Index_Type => Natural, Element_Type => Visit_Ref, "=" => "="); subtype Visit_Vector is Visit_Vectors.Vector; procedure List (Object : in out Visit_Vector; Session : in out ADO.Sessions.Session'Class; Query : in ADO.SQL.Query'Class); -- -------------------- -- The month statistics. -- -------------------- type Stat_Info is new Util.Beans.Basic.Bean with record -- the counter date. Date : Ada.Calendar.Time; -- the counter value. Count : Natural; end record; -- Get the bean attribute identified by the name. overriding function Get_Value (From : in Stat_Info; Name : in String) return Util.Beans.Objects.Object; -- Set the bean attribute identified by the name. overriding procedure Set_Value (Item : in out Stat_Info; Name : in String; Value : in Util.Beans.Objects.Object); package Stat_Info_Beans is new Util.Beans.Basic.Lists (Element_Type => Stat_Info); package Stat_Info_Vectors renames Stat_Info_Beans.Vectors; subtype Stat_Info_List_Bean is Stat_Info_Beans.List_Bean; type Stat_Info_List_Bean_Access is access all Stat_Info_List_Bean; -- Run the query controlled by <b>Context</b> and append the list in <b>Object</b>. procedure List (Object : in out Stat_Info_List_Bean'Class; Session : in out ADO.Sessions.Session'Class; Context : in out ADO.Queries.Context'Class); subtype Stat_Info_Vector is Stat_Info_Vectors.Vector; -- Run the query controlled by <b>Context</b> and append the list in <b>Object</b>. procedure List (Object : in out Stat_Info_Vector; Session : in out ADO.Sessions.Session'Class; Context : in out ADO.Queries.Context'Class); Query_Counter_Update : constant ADO.Queries.Query_Definition_Access; Query_Counter_Update_Field : constant ADO.Queries.Query_Definition_Access; -- -------------------- -- The Stat_List_Bean is the bean that allows to retrieve the counter statistics -- for a given database entity and provide the values through a bean to the -- presentation layer.load the counters for the entity and the timeframe. -- -------------------- type Stat_List_Bean is abstract limited new Util.Beans.Basic.Bean and Util.Beans.Methods.Method_Bean with record -- the entity type name. Entity_Type : Ada.Strings.Unbounded.Unbounded_String; -- the first date. First_Date : Ada.Strings.Unbounded.Unbounded_String; -- the last date. Last_Date : Ada.Strings.Unbounded.Unbounded_String; -- the entity identifier. Entity_Id : ADO.Identifier; Counter_Name : Ada.Strings.Unbounded.Unbounded_String; Query_Name : Ada.Strings.Unbounded.Unbounded_String; end record; -- This bean provides some methods that can be used in a Method_Expression. overriding function Get_Method_Bindings (From : in Stat_List_Bean) return Util.Beans.Methods.Method_Binding_Array_Access; -- Get the bean attribute identified by the name. overriding function Get_Value (From : in Stat_List_Bean; Name : in String) return Util.Beans.Objects.Object; -- Set the bean attribute identified by the name. overriding procedure Set_Value (Item : in out Stat_List_Bean; Name : in String; Value : in Util.Beans.Objects.Object); procedure Load (Bean : in out Stat_List_Bean; Outcome : in out Ada.Strings.Unbounded.Unbounded_String) is abstract; private COUNTER_NAME : aliased constant String := "awa_counter"; COL_0_1_NAME : aliased constant String := "object_id"; COL_1_1_NAME : aliased constant String := "date"; COL_2_1_NAME : aliased constant String := "counter"; COL_3_1_NAME : aliased constant String := "definition_id"; COUNTER_DEF : aliased constant ADO.Schemas.Class_Mapping := (Count => 4, Table => COUNTER_NAME'Access, Members => ( 1 => COL_0_1_NAME'Access, 2 => COL_1_1_NAME'Access, 3 => COL_2_1_NAME'Access, 4 => COL_3_1_NAME'Access) ); COUNTER_TABLE : constant ADO.Schemas.Class_Mapping_Access := COUNTER_DEF'Access; Null_Counter : constant Counter_Ref := Counter_Ref'(ADO.Objects.Object_Ref with null record); type Counter_Impl is new ADO.Objects.Object_Record (Key_Type => ADO.Objects.KEY_INTEGER, Of_Class => COUNTER_DEF'Access) with record Object_Id : ADO.Identifier; Date : Ada.Calendar.Time; Counter : Integer; end record; type Counter_Access is access all Counter_Impl; overriding procedure Destroy (Object : access Counter_Impl); overriding procedure Find (Object : in out Counter_Impl; Session : in out ADO.Sessions.Session'Class; Query : in ADO.SQL.Query'Class; Found : out Boolean); overriding procedure Load (Object : in out Counter_Impl; Session : in out ADO.Sessions.Session'Class); procedure Load (Object : in out Counter_Impl; Stmt : in out ADO.Statements.Query_Statement'Class; Session : in out ADO.Sessions.Session'Class); overriding procedure Save (Object : in out Counter_Impl; Session : in out ADO.Sessions.Master_Session'Class); procedure Create (Object : in out Counter_Impl; Session : in out ADO.Sessions.Master_Session'Class); overriding procedure Delete (Object : in out Counter_Impl; Session : in out ADO.Sessions.Master_Session'Class); procedure Set_Field (Object : in out Counter_Ref'Class; Impl : out Counter_Access); COUNTER_DEFINITION_NAME : aliased constant String := "awa_counter_definition"; COL_0_2_NAME : aliased constant String := "name"; COL_1_2_NAME : aliased constant String := "id"; COL_2_2_NAME : aliased constant String := "entity_type"; COUNTER_DEFINITION_DEF : aliased constant ADO.Schemas.Class_Mapping := (Count => 3, Table => COUNTER_DEFINITION_NAME'Access, Members => ( 1 => COL_0_2_NAME'Access, 2 => COL_1_2_NAME'Access, 3 => COL_2_2_NAME'Access) ); COUNTER_DEFINITION_TABLE : constant ADO.Schemas.Class_Mapping_Access := COUNTER_DEFINITION_DEF'Access; Null_Counter_Definition : constant Counter_Definition_Ref := Counter_Definition_Ref'(ADO.Objects.Object_Ref with null record); type Counter_Definition_Impl is new ADO.Objects.Object_Record (Key_Type => ADO.Objects.KEY_INTEGER, Of_Class => COUNTER_DEFINITION_DEF'Access) with record Name : Ada.Strings.Unbounded.Unbounded_String; Entity_Type : ADO.Nullable_Entity_Type; end record; type Counter_Definition_Access is access all Counter_Definition_Impl; overriding procedure Destroy (Object : access Counter_Definition_Impl); overriding procedure Find (Object : in out Counter_Definition_Impl; Session : in out ADO.Sessions.Session'Class; Query : in ADO.SQL.Query'Class; Found : out Boolean); overriding procedure Load (Object : in out Counter_Definition_Impl; Session : in out ADO.Sessions.Session'Class); procedure Load (Object : in out Counter_Definition_Impl; Stmt : in out ADO.Statements.Query_Statement'Class; Session : in out ADO.Sessions.Session'Class); overriding procedure Save (Object : in out Counter_Definition_Impl; Session : in out ADO.Sessions.Master_Session'Class); procedure Create (Object : in out Counter_Definition_Impl; Session : in out ADO.Sessions.Master_Session'Class); overriding procedure Delete (Object : in out Counter_Definition_Impl; Session : in out ADO.Sessions.Master_Session'Class); procedure Set_Field (Object : in out Counter_Definition_Ref'Class; Impl : out Counter_Definition_Access); VISIT_NAME : aliased constant String := "awa_visit"; COL_0_3_NAME : aliased constant String := "object_id"; COL_1_3_NAME : aliased constant String := "counter"; COL_2_3_NAME : aliased constant String := "date"; COL_3_3_NAME : aliased constant String := "user"; COL_4_3_NAME : aliased constant String := "definition_id"; VISIT_DEF : aliased constant ADO.Schemas.Class_Mapping := (Count => 5, Table => VISIT_NAME'Access, Members => ( 1 => COL_0_3_NAME'Access, 2 => COL_1_3_NAME'Access, 3 => COL_2_3_NAME'Access, 4 => COL_3_3_NAME'Access, 5 => COL_4_3_NAME'Access) ); VISIT_TABLE : constant ADO.Schemas.Class_Mapping_Access := VISIT_DEF'Access; Null_Visit : constant Visit_Ref := Visit_Ref'(ADO.Objects.Object_Ref with null record); type Visit_Impl is new ADO.Objects.Object_Record (Key_Type => ADO.Objects.KEY_INTEGER, Of_Class => VISIT_DEF'Access) with record Object_Id : ADO.Identifier; Counter : Integer; Date : Ada.Calendar.Time; User : ADO.Identifier; end record; type Visit_Access is access all Visit_Impl; overriding procedure Destroy (Object : access Visit_Impl); overriding procedure Find (Object : in out Visit_Impl; Session : in out ADO.Sessions.Session'Class; Query : in ADO.SQL.Query'Class; Found : out Boolean); overriding procedure Load (Object : in out Visit_Impl; Session : in out ADO.Sessions.Session'Class); procedure Load (Object : in out Visit_Impl; Stmt : in out ADO.Statements.Query_Statement'Class; Session : in out ADO.Sessions.Session'Class); overriding procedure Save (Object : in out Visit_Impl; Session : in out ADO.Sessions.Master_Session'Class); procedure Create (Object : in out Visit_Impl; Session : in out ADO.Sessions.Master_Session'Class); overriding procedure Delete (Object : in out Visit_Impl; Session : in out ADO.Sessions.Master_Session'Class); procedure Set_Field (Object : in out Visit_Ref'Class; Impl : out Visit_Access); package File_1 is new ADO.Queries.Loaders.File (Path => "counter-update.xml", Sha1 => "6C157006E7A28699E1FE0E2CB571BACA2706E58D"); package Def_Statinfo_Counter_Update is new ADO.Queries.Loaders.Query (Name => "counter-update", File => File_1.File'Access); Query_Counter_Update : constant ADO.Queries.Query_Definition_Access := Def_Statinfo_Counter_Update.Query'Access; package Def_Statinfo_Counter_Update_Field is new ADO.Queries.Loaders.Query (Name => "counter-update-field", File => File_1.File'Access); Query_Counter_Update_Field : constant ADO.Queries.Query_Definition_Access := Def_Statinfo_Counter_Update_Field.Query'Access; end AWA.Counters.Models;
reznikmm/matreshka
Ada
11,839
ads
------------------------------------------------------------------------------ -- -- -- Matreshka Project -- -- -- -- Ada Modeling Framework -- -- -- -- Runtime Library Component -- -- -- ------------------------------------------------------------------------------ -- -- -- Copyright © 2012-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$ ------------------------------------------------------------------------------ -- This file is generated, don't edit it. ------------------------------------------------------------------------------ with AMF.CMOF.Associations; with AMF.CMOF.Classes; with AMF.CMOF.Data_Types; with AMF.Factories.OCL_Factories; with AMF.Links; with AMF.OCL.Any_Types; with AMF.OCL.Association_Class_Call_Exps; with AMF.OCL.Bag_Types; with AMF.OCL.Boolean_Literal_Exps; with AMF.OCL.Collection_Items; with AMF.OCL.Collection_Literal_Exps; with AMF.OCL.Collection_Ranges; with AMF.OCL.Collection_Types; with AMF.OCL.Enum_Literal_Exps; with AMF.OCL.Expression_In_Ocls; with AMF.OCL.If_Exps; with AMF.OCL.Integer_Literal_Exps; with AMF.OCL.Invalid_Literal_Exps; with AMF.OCL.Invalid_Types; with AMF.OCL.Iterate_Exps; with AMF.OCL.Iterator_Exps; with AMF.OCL.Let_Exps; with AMF.OCL.Message_Exps; with AMF.OCL.Message_Types; with AMF.OCL.Null_Literal_Exps; with AMF.OCL.Operation_Call_Exps; with AMF.OCL.Ordered_Set_Types; with AMF.OCL.Property_Call_Exps; with AMF.OCL.Real_Literal_Exps; with AMF.OCL.Sequence_Types; with AMF.OCL.Set_Types; with AMF.OCL.State_Exps; with AMF.OCL.String_Literal_Exps; with AMF.OCL.Template_Parameter_Types; with AMF.OCL.Tuple_Literal_Exps; with AMF.OCL.Tuple_Literal_Parts; with AMF.OCL.Tuple_Types; with AMF.OCL.Type_Exps; with AMF.OCL.Unlimited_Natural_Literal_Exps; with AMF.OCL.Unspecified_Value_Exps; with AMF.OCL.Variable_Exps; with AMF.OCL.Variables; with AMF.OCL.Void_Types; with League.Holders; package AMF.Internals.Factories.OCL_Factories is type OCL_Factory is limited new AMF.Internals.Factories.Metamodel_Factory_Base and AMF.Factories.OCL_Factories.OCL_Factory with null record; overriding function Convert_To_String (Self : not null access OCL_Factory; Data_Type : not null access AMF.CMOF.Data_Types.CMOF_Data_Type'Class; Value : League.Holders.Holder) return League.Strings.Universal_String; overriding function Create (Self : not null access OCL_Factory; Meta_Class : not null access AMF.CMOF.Classes.CMOF_Class'Class) return not null AMF.Elements.Element_Access; overriding function Create_From_String (Self : not null access OCL_Factory; Data_Type : not null access AMF.CMOF.Data_Types.CMOF_Data_Type'Class; Image : League.Strings.Universal_String) return League.Holders.Holder; overriding function Create_Link (Self : not null access OCL_Factory; Association : not null access AMF.CMOF.Associations.CMOF_Association'Class; First_Element : not null AMF.Elements.Element_Access; Second_Element : not null AMF.Elements.Element_Access) return not null AMF.Links.Link_Access; overriding function Get_Package (Self : not null access constant OCL_Factory) return AMF.CMOF.Packages.Collections.Set_Of_CMOF_Package; function Constructor (Extent : AMF.Internals.AMF_Extent) return not null AMF.Factories.Factory_Access; function Get_Package return not null AMF.CMOF.Packages.CMOF_Package_Access; function Create_Any_Type (Self : not null access OCL_Factory) return AMF.OCL.Any_Types.OCL_Any_Type_Access; function Create_Association_Class_Call_Exp (Self : not null access OCL_Factory) return AMF.OCL.Association_Class_Call_Exps.OCL_Association_Class_Call_Exp_Access; function Create_Bag_Type (Self : not null access OCL_Factory) return AMF.OCL.Bag_Types.OCL_Bag_Type_Access; function Create_Boolean_Literal_Exp (Self : not null access OCL_Factory) return AMF.OCL.Boolean_Literal_Exps.OCL_Boolean_Literal_Exp_Access; function Create_Collection_Item (Self : not null access OCL_Factory) return AMF.OCL.Collection_Items.OCL_Collection_Item_Access; function Create_Collection_Literal_Exp (Self : not null access OCL_Factory) return AMF.OCL.Collection_Literal_Exps.OCL_Collection_Literal_Exp_Access; function Create_Collection_Range (Self : not null access OCL_Factory) return AMF.OCL.Collection_Ranges.OCL_Collection_Range_Access; function Create_Collection_Type (Self : not null access OCL_Factory) return AMF.OCL.Collection_Types.OCL_Collection_Type_Access; function Create_Enum_Literal_Exp (Self : not null access OCL_Factory) return AMF.OCL.Enum_Literal_Exps.OCL_Enum_Literal_Exp_Access; function Create_Expression_In_Ocl (Self : not null access OCL_Factory) return AMF.OCL.Expression_In_Ocls.OCL_Expression_In_Ocl_Access; function Create_If_Exp (Self : not null access OCL_Factory) return AMF.OCL.If_Exps.OCL_If_Exp_Access; function Create_Integer_Literal_Exp (Self : not null access OCL_Factory) return AMF.OCL.Integer_Literal_Exps.OCL_Integer_Literal_Exp_Access; function Create_Invalid_Literal_Exp (Self : not null access OCL_Factory) return AMF.OCL.Invalid_Literal_Exps.OCL_Invalid_Literal_Exp_Access; function Create_Invalid_Type (Self : not null access OCL_Factory) return AMF.OCL.Invalid_Types.OCL_Invalid_Type_Access; function Create_Iterate_Exp (Self : not null access OCL_Factory) return AMF.OCL.Iterate_Exps.OCL_Iterate_Exp_Access; function Create_Iterator_Exp (Self : not null access OCL_Factory) return AMF.OCL.Iterator_Exps.OCL_Iterator_Exp_Access; function Create_Let_Exp (Self : not null access OCL_Factory) return AMF.OCL.Let_Exps.OCL_Let_Exp_Access; function Create_Message_Exp (Self : not null access OCL_Factory) return AMF.OCL.Message_Exps.OCL_Message_Exp_Access; function Create_Message_Type (Self : not null access OCL_Factory) return AMF.OCL.Message_Types.OCL_Message_Type_Access; function Create_Null_Literal_Exp (Self : not null access OCL_Factory) return AMF.OCL.Null_Literal_Exps.OCL_Null_Literal_Exp_Access; function Create_Operation_Call_Exp (Self : not null access OCL_Factory) return AMF.OCL.Operation_Call_Exps.OCL_Operation_Call_Exp_Access; function Create_Ordered_Set_Type (Self : not null access OCL_Factory) return AMF.OCL.Ordered_Set_Types.OCL_Ordered_Set_Type_Access; function Create_Property_Call_Exp (Self : not null access OCL_Factory) return AMF.OCL.Property_Call_Exps.OCL_Property_Call_Exp_Access; function Create_Real_Literal_Exp (Self : not null access OCL_Factory) return AMF.OCL.Real_Literal_Exps.OCL_Real_Literal_Exp_Access; function Create_Sequence_Type (Self : not null access OCL_Factory) return AMF.OCL.Sequence_Types.OCL_Sequence_Type_Access; function Create_Set_Type (Self : not null access OCL_Factory) return AMF.OCL.Set_Types.OCL_Set_Type_Access; function Create_State_Exp (Self : not null access OCL_Factory) return AMF.OCL.State_Exps.OCL_State_Exp_Access; function Create_String_Literal_Exp (Self : not null access OCL_Factory) return AMF.OCL.String_Literal_Exps.OCL_String_Literal_Exp_Access; function Create_Template_Parameter_Type (Self : not null access OCL_Factory) return AMF.OCL.Template_Parameter_Types.OCL_Template_Parameter_Type_Access; function Create_Tuple_Literal_Exp (Self : not null access OCL_Factory) return AMF.OCL.Tuple_Literal_Exps.OCL_Tuple_Literal_Exp_Access; function Create_Tuple_Literal_Part (Self : not null access OCL_Factory) return AMF.OCL.Tuple_Literal_Parts.OCL_Tuple_Literal_Part_Access; function Create_Tuple_Type (Self : not null access OCL_Factory) return AMF.OCL.Tuple_Types.OCL_Tuple_Type_Access; function Create_Type_Exp (Self : not null access OCL_Factory) return AMF.OCL.Type_Exps.OCL_Type_Exp_Access; function Create_Unlimited_Natural_Literal_Exp (Self : not null access OCL_Factory) return AMF.OCL.Unlimited_Natural_Literal_Exps.OCL_Unlimited_Natural_Literal_Exp_Access; function Create_Unspecified_Value_Exp (Self : not null access OCL_Factory) return AMF.OCL.Unspecified_Value_Exps.OCL_Unspecified_Value_Exp_Access; function Create_Variable (Self : not null access OCL_Factory) return AMF.OCL.Variables.OCL_Variable_Access; function Create_Variable_Exp (Self : not null access OCL_Factory) return AMF.OCL.Variable_Exps.OCL_Variable_Exp_Access; function Create_Void_Type (Self : not null access OCL_Factory) return AMF.OCL.Void_Types.OCL_Void_Type_Access; end AMF.Internals.Factories.OCL_Factories;
zhmu/ananas
Ada
10,977
ads
------------------------------------------------------------------------------ -- -- -- GNAT COMPILER COMPONENTS -- -- -- -- E X P _ C H 3 -- -- -- -- 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. See the GNU General Public License -- -- for more details. You should have received a copy of the GNU General -- -- Public License distributed with GNAT; see file COPYING3. If not, go to -- -- http://www.gnu.org/licenses for a complete copy of the license. -- -- -- -- GNAT was originally developed by the GNAT team at New York University. -- -- Extensive contributions were provided by Ada Core Technologies Inc. -- -- -- ------------------------------------------------------------------------------ -- Expand routines for chapter 3 constructs with Types; use Types; with Elists; use Elists; with Uintp; use Uintp; package Exp_Ch3 is procedure Expand_N_Object_Declaration (N : Node_Id); procedure Expand_N_Subtype_Indication (N : Node_Id); procedure Expand_N_Variant_Part (N : Node_Id); procedure Expand_N_Full_Type_Declaration (N : Node_Id); procedure Expand_Previous_Access_Type (Def_Id : Entity_Id); -- For a full type declaration that contains tasks, or that is a task, -- check whether there exists an access type whose designated type is an -- incomplete declarations for the current composite type. If so, build the -- master for that access type, now that it is known to denote an object -- with tasks. procedure Expand_Record_Extension (T : Entity_Id; Def : Node_Id); -- Add a field _parent in the extension part of the record procedure Build_Access_Subprogram_Wrapper_Body (Decl : Node_Id; New_Decl : Node_Id); -- Build the wrapper body, which holds the indirect call through an access- -- to-subprogram, and whose expansion incorporates the contracts of the -- access type declaration. Called from Build_Access_Subprogram_Wrapper. -- Building the wrapper is done during analysis to perform proper semantic -- checks on the relevant aspects. The wrapper body could be simplified to -- a null body when expansion is disabled ??? procedure Build_Discr_Checking_Funcs (N : Node_Id); -- Builds function which checks whether the component name is consistent -- with the current discriminants. N is the full type declaration node, -- and the discriminant checking functions are inserted after this node. function Build_Initialization_Call (Loc : Source_Ptr; Id_Ref : Node_Id; Typ : Entity_Id; In_Init_Proc : Boolean := False; Enclos_Type : Entity_Id := Empty; Discr_Map : Elist_Id := New_Elmt_List; With_Default_Init : Boolean := False; Constructor_Ref : Node_Id := Empty) return List_Id; -- Builds a call to the initialization procedure for the base type of Typ, -- passing it the object denoted by Id_Ref, plus additional parameters as -- appropriate for the type (the _Master, for task types, for example). -- Loc is the source location for the constructed tree. In_Init_Proc has -- to be set to True when the call is itself in an init proc in order to -- enable the use of discriminals. Enclos_Type is the enclosing type when -- initializing a component in an outer init proc, and it is used for -- various expansion cases including the case where Typ is a task type -- which is an array component, the indexes of the enclosing type are -- used to build the string that identifies each task at runtime. -- -- Discr_Map is used to replace discriminants by their discriminals in -- expressions used to constrain record components. In the presence of -- entry families bounded by discriminants, protected type discriminants -- can appear within expressions in array bounds (not as stand-alone -- identifiers) and a general replacement is necessary. -- -- Ada 2005 (AI-287): With_Default_Init is used to indicate that the -- initialization call corresponds to a default initialized component -- of an aggregate. -- -- Constructor_Ref is a call to a constructor subprogram. It is currently -- used only to support C++ constructors. function Build_Variant_Record_Equality (Typ : Entity_Id; Body_Id : Entity_Id; Param_Specs : List_Id) return Node_Id; -- Build the body of the equality function Body_Id for the untagged variant -- record Typ with the given parameters specification list. procedure Ensure_Activation_Chain_And_Master (Obj_Decl : Node_Id); -- If tasks are being declared (or might be declared) by the given object -- declaration then ensure to have an activation chain defined for the -- tasks (has no effect if we already have one), and also that a Master -- variable is established (and that the appropriate enclosing construct -- is established as a task master). function Freeze_Type (N : Node_Id) return Boolean; -- This function executes the freezing actions associated with the given -- freeze type node N and returns True if the node is to be deleted. We -- delete the node if it is present just for front end purpose and we don't -- want Gigi to see the node. This function can't delete the node itself -- since it would confuse any remaining processing of the freeze node. -- -- Note: for GNATprove we have a minimal variant of this routine in -- Exp_SPARK.SPARK_Freeze_Type. They need to be kept in sync. function Get_Simple_Init_Val (Typ : Entity_Id; N : Node_Id; Size : Uint := No_Uint) return Node_Id; -- Build an expression that represents the required initial value of type -- Typ for which predicate Needs_Simple_Initialization is True. N is a node -- whose source location is used in the construction of the expression. -- Size is used as follows: -- -- * If the size of the object to be initialized it is known, it should -- be passed to the routine. -- -- * If the size is unknown or is zero, then the Esize of Typ is used as -- an estimate of the size. -- -- The object size is needed to prepare a known invalid value for use by -- Normalize_Scalars. A call to this routine where Typ denotes a scalar -- type is valid only when Normalize_Scalars or Initialize_Scalars is -- active, or if N is the node for a 'Invalid_Value attribute node. function Init_Proc_Level_Formal (Proc : Entity_Id) return Entity_Id; -- Fetch the extra formal from an initalization procedure "proc" -- corresponding to the level of the object being initialized. When none -- is present Empty is returned. procedure Init_Secondary_Tags (Typ : Entity_Id; Target : Node_Id; Init_Tags_List : List_Id; Stmts_List : List_Id; Fixed_Comps : Boolean := True; Variable_Comps : Boolean := True); -- Ada 2005 (AI-251): Initialize the tags of the secondary dispatch tables -- of Typ. The generated code referencing tag fields of Target is appended -- to Init_Tags_List and the code required to complete the elaboration of -- the dispatch tables of Typ is appended to Stmts_List. If Fixed_Comps is -- True then the tag components located at fixed positions of Target are -- initialized; if Variable_Comps is True then tags components located at -- variable positions of Target are initialized. procedure Make_Controlling_Function_Wrappers (Tag_Typ : Entity_Id; Decl_List : out List_Id; Body_List : out List_Id); -- Ada 2005 (AI-391): Makes specs and bodies for the wrapper functions -- associated with inherited functions with controlling results which -- are not overridden. The body of each wrapper function consists solely -- of a return statement whose expression is an extension aggregate -- invoking the inherited subprogram's parent subprogram and extended -- with a null association list. procedure Make_Predefined_Primitive_Eq_Spec (Tag_Typ : Entity_Id; Predef_List : List_Id; Renamed_Eq : out Entity_Id); -- Creates spec for the predefined equality on a tagged type Tag_Typ, if -- required. If created, it will be appended to Predef_List. -- -- The Parameter Renamed_Eq either returns the value Empty, or else -- the defining unit name for the predefined equality function in the -- case where the type has a primitive operation that is a renaming -- of predefined equality (but only if there is also an overriding -- user-defined equality function). The returned Renamed_Eq will be -- passed to the corresponding parameter of Predefined_Primitive_Bodies. function Make_Tag_Assignment (N : Node_Id) return Node_Id; -- An object declaration that has an initialization for a tagged object -- requires a separate reassignment of the tag of the given type, because -- the expression may include an unchecked conversion. This tag assignment -- is inserted after the declaration, but if the object has an address -- clause the assignment is handled as part of the freezing of the object, -- see Check_Address_Clause. procedure Predefined_Primitive_Eq_Body (Tag_Typ : Entity_Id; Predef_List : List_Id; Renamed_Eq : Entity_Id); -- Creates body for the predefined equality (and ineqality, if required) on -- a tagged type Tag_Typ. If created they will be appended to Predef_List. -- -- The spec for the equality function has been created by -- Make_Predefined_Primitive_Eq_Spec; see there for description of -- the Renamed_Eq parameter. end Exp_Ch3;
reznikmm/matreshka
Ada
4,648
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.Horizontal_Rel_Attributes is ------------ -- Create -- ------------ overriding function Create (Parameters : not null access Matreshka.DOM_Attributes.Attribute_L2_Parameters) return Style_Horizontal_Rel_Attribute_Node is begin return Self : Style_Horizontal_Rel_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_Horizontal_Rel_Attribute_Node) return League.Strings.Universal_String is pragma Unreferenced (Self); begin return Matreshka.ODF_String_Constants.Horizontal_Rel_Attribute; end Get_Local_Name; begin Matreshka.DOM_Documents.Register_Attribute (Matreshka.ODF_String_Constants.Style_URI, Matreshka.ODF_String_Constants.Horizontal_Rel_Attribute, Style_Horizontal_Rel_Attribute_Node'Tag); end Matreshka.ODF_Style.Horizontal_Rel_Attributes;
AdaCore/libadalang
Ada
40
ads
with P.F; procedure P.Q.F renames P.F;
burratoo/Acton
Ada
889
ads
------------------------------------------------------------------------------------------ -- -- -- OAKLAND COMPONENTS -- -- -- -- ADA.CYCLIC_TASKS.DYNAMICS -- -- -- -- Copyright (C) 2016-2021, Patrick Bernardi -- -- -- ------------------------------------------------------------------------------------------ package Ada.Cyclic_Tasks.Dynamics is end Ada.Cyclic_Tasks.Dynamics;
MinimSecure/unum-sdk
Ada
928
ads
-- Copyright 2017-2019 Free Software Foundation, Inc. -- -- This program is free software; you can redistribute it and/or modify -- it under the terms of the GNU General Public License as published by -- the Free Software Foundation; either version 3 of the License, or -- (at your option) any later version. -- -- This program is distributed in the hope that it will be useful, -- but WITHOUT ANY WARRANTY; without even the implied warranty of -- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -- GNU General Public License for more details. -- -- You should have received a copy of the GNU General Public License -- along with this program. If not, see <http://www.gnu.org/licenses/>. package Pck is function Get_Val (Seed: Integer; Off_By_One: Boolean) return Integer; procedure Do_Nothing (Val: in out Integer); procedure Call_Me; procedure Increment (Val : in out Integer); end Pck;
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.Attributes; package ODF.DOM.Draw_Value_Attributes is pragma Preelaborate; type ODF_Draw_Value_Attribute is limited interface and XML.DOM.Attributes.DOM_Attribute; type ODF_Draw_Value_Attribute_Access is access all ODF_Draw_Value_Attribute'Class with Storage_Size => 0; end ODF.DOM.Draw_Value_Attributes;
reznikmm/matreshka
Ada
18,257
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.Elements; with AMF.Internals.Element_Collections; with AMF.Internals.Helpers; with AMF.Internals.Tables.UML_Attributes; with AMF.Visitors.UML_Iterators; with AMF.Visitors.UML_Visitors; with League.Strings.Internals; with Matreshka.Internals.Strings; package body AMF.Internals.UML_Time_Constraints is ------------------- -- Enter_Element -- ------------------- overriding procedure Enter_Element (Self : not null access constant UML_Time_Constraint_Proxy; Visitor : in out AMF.Visitors.Abstract_Visitor'Class; Control : in out AMF.Visitors.Traverse_Control) is begin if Visitor in AMF.Visitors.UML_Visitors.UML_Visitor'Class then AMF.Visitors.UML_Visitors.UML_Visitor'Class (Visitor).Enter_Time_Constraint (AMF.UML.Time_Constraints.UML_Time_Constraint_Access (Self), Control); end if; end Enter_Element; ------------------- -- Leave_Element -- ------------------- overriding procedure Leave_Element (Self : not null access constant UML_Time_Constraint_Proxy; Visitor : in out AMF.Visitors.Abstract_Visitor'Class; Control : in out AMF.Visitors.Traverse_Control) is begin if Visitor in AMF.Visitors.UML_Visitors.UML_Visitor'Class then AMF.Visitors.UML_Visitors.UML_Visitor'Class (Visitor).Leave_Time_Constraint (AMF.UML.Time_Constraints.UML_Time_Constraint_Access (Self), Control); end if; end Leave_Element; ------------------- -- Visit_Element -- ------------------- overriding procedure Visit_Element (Self : not null access constant UML_Time_Constraint_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.UML_Iterators.UML_Iterator'Class then AMF.Visitors.UML_Iterators.UML_Iterator'Class (Iterator).Visit_Time_Constraint (Visitor, AMF.UML.Time_Constraints.UML_Time_Constraint_Access (Self), Control); end if; end Visit_Element; --------------------- -- Get_First_Event -- --------------------- overriding function Get_First_Event (Self : not null access constant UML_Time_Constraint_Proxy) return AMF.Optional_Boolean is begin return AMF.Internals.Tables.UML_Attributes.Internal_Get_First_Event (Self.Element); end Get_First_Event; --------------------- -- Set_First_Event -- --------------------- overriding procedure Set_First_Event (Self : not null access UML_Time_Constraint_Proxy; To : AMF.Optional_Boolean) is begin AMF.Internals.Tables.UML_Attributes.Internal_Set_First_Event (Self.Element, To); end Set_First_Event; ----------------------- -- Get_Specification -- ----------------------- overriding function Get_Specification (Self : not null access constant UML_Time_Constraint_Proxy) return AMF.UML.Time_Intervals.UML_Time_Interval_Access is begin return AMF.UML.Time_Intervals.UML_Time_Interval_Access (AMF.Internals.Helpers.To_Element (AMF.Internals.Tables.UML_Attributes.Internal_Get_Specification (Self.Element))); end Get_Specification; ----------------------- -- Set_Specification -- ----------------------- overriding procedure Set_Specification (Self : not null access UML_Time_Constraint_Proxy; To : AMF.UML.Time_Intervals.UML_Time_Interval_Access) is begin AMF.Internals.Tables.UML_Attributes.Internal_Set_Specification (Self.Element, AMF.Internals.Helpers.To_Element (AMF.Elements.Element_Access (To))); end Set_Specification; ----------------------- -- Get_Specification -- ----------------------- overriding function Get_Specification (Self : not null access constant UML_Time_Constraint_Proxy) return AMF.UML.Intervals.UML_Interval_Access is begin return AMF.UML.Intervals.UML_Interval_Access (AMF.Internals.Helpers.To_Element (AMF.Internals.Tables.UML_Attributes.Internal_Get_Specification (Self.Element))); end Get_Specification; ----------------------- -- Set_Specification -- ----------------------- overriding procedure Set_Specification (Self : not null access UML_Time_Constraint_Proxy; To : AMF.UML.Intervals.UML_Interval_Access) is begin AMF.Internals.Tables.UML_Attributes.Internal_Set_Specification (Self.Element, AMF.Internals.Helpers.To_Element (AMF.Elements.Element_Access (To))); end Set_Specification; ----------------------------- -- Get_Constrained_Element -- ----------------------------- overriding function Get_Constrained_Element (Self : not null access constant UML_Time_Constraint_Proxy) return AMF.UML.Elements.Collections.Ordered_Set_Of_UML_Element is begin return AMF.UML.Elements.Collections.Wrap (AMF.Internals.Element_Collections.Wrap (AMF.Internals.Tables.UML_Attributes.Internal_Get_Constrained_Element (Self.Element))); end Get_Constrained_Element; ----------------- -- Get_Context -- ----------------- overriding function Get_Context (Self : not null access constant UML_Time_Constraint_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.UML_Attributes.Internal_Get_Context (Self.Element))); end Get_Context; ----------------- -- Set_Context -- ----------------- overriding procedure Set_Context (Self : not null access UML_Time_Constraint_Proxy; To : AMF.UML.Namespaces.UML_Namespace_Access) is begin raise Program_Error; end Set_Context; ----------------------- -- Get_Specification -- ----------------------- overriding function Get_Specification (Self : not null access constant UML_Time_Constraint_Proxy) return AMF.UML.Value_Specifications.UML_Value_Specification_Access is begin return AMF.UML.Value_Specifications.UML_Value_Specification_Access (AMF.Internals.Helpers.To_Element (AMF.Internals.Tables.UML_Attributes.Internal_Get_Specification (Self.Element))); end Get_Specification; ----------------------- -- Set_Specification -- ----------------------- overriding procedure Set_Specification (Self : not null access UML_Time_Constraint_Proxy; To : AMF.UML.Value_Specifications.UML_Value_Specification_Access) is begin AMF.Internals.Tables.UML_Attributes.Internal_Set_Specification (Self.Element, AMF.Internals.Helpers.To_Element (AMF.Elements.Element_Access (To))); end Set_Specification; --------------------------- -- Get_Client_Dependency -- --------------------------- overriding function Get_Client_Dependency (Self : not null access constant UML_Time_Constraint_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.UML_Attributes.Internal_Get_Client_Dependency (Self.Element))); end Get_Client_Dependency; ------------------------- -- Get_Name_Expression -- ------------------------- overriding function Get_Name_Expression (Self : not null access constant UML_Time_Constraint_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.UML_Attributes.Internal_Get_Name_Expression (Self.Element))); end Get_Name_Expression; ------------------------- -- Set_Name_Expression -- ------------------------- overriding procedure Set_Name_Expression (Self : not null access UML_Time_Constraint_Proxy; To : AMF.UML.String_Expressions.UML_String_Expression_Access) is begin AMF.Internals.Tables.UML_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 UML_Time_Constraint_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.UML_Attributes.Internal_Get_Namespace (Self.Element))); end Get_Namespace; ------------------------ -- Get_Qualified_Name -- ------------------------ overriding function Get_Qualified_Name (Self : not null access constant UML_Time_Constraint_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.UML_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_Owning_Template_Parameter -- ----------------------------------- overriding function Get_Owning_Template_Parameter (Self : not null access constant UML_Time_Constraint_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.UML_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 UML_Time_Constraint_Proxy; To : AMF.UML.Template_Parameters.UML_Template_Parameter_Access) is begin AMF.Internals.Tables.UML_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 UML_Time_Constraint_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.UML_Attributes.Internal_Get_Template_Parameter (Self.Element))); end Get_Template_Parameter; ---------------------------- -- Set_Template_Parameter -- ---------------------------- overriding procedure Set_Template_Parameter (Self : not null access UML_Time_Constraint_Proxy; To : AMF.UML.Template_Parameters.UML_Template_Parameter_Access) is begin AMF.Internals.Tables.UML_Attributes.Internal_Set_Template_Parameter (Self.Element, AMF.Internals.Helpers.To_Element (AMF.Elements.Element_Access (To))); end Set_Template_Parameter; ------------------------- -- All_Owning_Packages -- ------------------------- overriding function All_Owning_Packages (Self : not null access constant UML_Time_Constraint_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 UML_Time_Constraint_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 UML_Time_Constraint_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 UML_Time_Constraint_Proxy.Is_Distinguishable_From"; return Is_Distinguishable_From (Self, N, Ns); end Is_Distinguishable_From; --------------- -- Namespace -- --------------- overriding function Namespace (Self : not null access constant UML_Time_Constraint_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 UML_Time_Constraint_Proxy.Namespace"; return Namespace (Self); end Namespace; ------------------------ -- Is_Compatible_With -- ------------------------ overriding function Is_Compatible_With (Self : not null access constant UML_Time_Constraint_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 UML_Time_Constraint_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 UML_Time_Constraint_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 UML_Time_Constraint_Proxy.Is_Template_Parameter"; return Is_Template_Parameter (Self); end Is_Template_Parameter; end AMF.Internals.UML_Time_Constraints;
stahta01/emulator_8080
Ada
169
ads
package Emulator_8080 is type Byte_Type is mod 256; for Byte_Type'Size use 8; type Byte_Array_Type is array(Natural range <>) of Byte_Type; end Emulator_8080;
AdaCore/gpr
Ada
2,141
ads
-- -- Copyright (C) 2019-2023, AdaCore -- -- SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -- with Gpr_Parser_AdaSAT.Decisions; with Gpr_Parser_AdaSAT.Formulas; use Gpr_Parser_AdaSAT.Formulas; with Gpr_Parser_AdaSAT.Theory; -- This is the main package of this library. Users should instantiate their -- package with their custom theory (or use the SAT-only solver instantiated -- in package `Gpr_Parser_AdaSAT.Helpers`) and call `Solve` with their formula. -- A custom decision procedure can be given, else the default one will be -- used (see `Gpr_Parser_AdaSAT.Decisions` for more information). generic with package User_Theory is new Theory (<>); -- The theory against which SAT models will be checked with function Next_Decision (M : Model; First_Unset : in out Variable) return Variable_Or_Null is Gpr_Parser_AdaSAT.Decisions.First_Unassigned; -- The heuristic to use in order to choose which variable will be -- decided next. For problems that accept several solutions, this can be -- used guide the solver towards a specific one. For example, Langkit -- requires that we find them in a specific order that corresponds to the -- order in which its high-level equations would be traversed by a naive -- recursive-descent solver. On the other hand, a "wave function collapse" -- implementation requires that we collapse the tile with the lowest -- entropy (see the corresponding test). package Gpr_Parser_AdaSAT.DPLL is function Solve (F : Formula; Ctx : in out User_Theory.User_Context; M : in out Model; Min_Vars : Variable_Or_Null := 0) return Boolean; -- Determine whether the formula is satisfiable or not. -- In case it is satisfiable, fill the given model with a solution. -- if ``Min_Vars`` is not 0, the solver does not decide variables -- that after the given ``Min_Vars`` index. -- -- Note that the given formula becomes owned by the solver, and therefore -- its memory and that of its inner clauses will be deallocated when the -- solving terminates. end Gpr_Parser_AdaSAT.DPLL;
reznikmm/matreshka
Ada
4,615
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_Meta.Image_Count_Attributes is ------------ -- Create -- ------------ overriding function Create (Parameters : not null access Matreshka.DOM_Attributes.Attribute_L2_Parameters) return Meta_Image_Count_Attribute_Node is begin return Self : Meta_Image_Count_Attribute_Node do Matreshka.ODF_Meta.Constructors.Initialize (Self'Unchecked_Access, Parameters.Document, Matreshka.ODF_String_Constants.Meta_Prefix); end return; end Create; -------------------- -- Get_Local_Name -- -------------------- overriding function Get_Local_Name (Self : not null access constant Meta_Image_Count_Attribute_Node) return League.Strings.Universal_String is pragma Unreferenced (Self); begin return Matreshka.ODF_String_Constants.Image_Count_Attribute; end Get_Local_Name; begin Matreshka.DOM_Documents.Register_Attribute (Matreshka.ODF_String_Constants.Meta_URI, Matreshka.ODF_String_Constants.Image_Count_Attribute, Meta_Image_Count_Attribute_Node'Tag); end Matreshka.ODF_Meta.Image_Count_Attributes;