CombinedText
stringlengths
4
3.42M
with ada.Calendar; package collada.Asset -- -- Models a collada asset. -- is type Contributor is record Author : Text; authoring_Tool : Text; end record; type Unit is record Name : Text; Meter : Float; end record; type up_Direction is (X_up, Y_up, Z_up); type Item is record Contributor : asset.Contributor; Created : ada.Calendar.Time; Modified : ada.Calendar.Time; Unit : asset.Unit; up_Axis : up_Direction; end record; end collada.Asset;
-- Copyright 2009-2020 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/>. procedure Foo is type Small is range -32 .. 31; type SomePackedArray is array (Integer range <>) of Small; pragma Pack (SomePackedArray); type SomePackedRecord is record Y: SomePackedArray (1 .. 10); end record; pragma Pack (SomePackedRecord); Suite : SomePackedArray := (-1, -2, -3, -4, -5, -6, -7, -8, -9, -10); XP: SomePackedRecord := (Y => Suite); Slice : SomePackedArray renames XP.Y (3 .. 5); begin Slice (4) := 4; -- START end Foo;
------------------------------------------------------------------------------ -- -- -- 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 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 stm32f4xx_hal_tim.h -- -- @author MCD Application Team -- -- @version V1.1.0 -- -- @date 19-June-2014 -- -- @brief Header file of timers HAL module. -- -- -- -- COPYRIGHT(c) 2014 STMicroelectronics -- ------------------------------------------------------------------------------ -- This file provides definitions for the timers on the STM32F3 (ARM Cortex -- M4F) microcontrollers from ST Microelectronics. pragma Restrictions (No_Elaboration_Code); with System; use System; with STM32_SVD; package STM32.Timers is type Timer is limited private; procedure Enable (This : in out Timer) with Post => Enabled (This); procedure Disable (This : in out Timer) with Post => (if No_Outputs_Enabled (This) then not Enabled (This)); function Enabled (This : Timer) return Boolean; -- The Configure routines are overloaded for the sake of -- additional timer-class specific parameters. procedure Configure (This : in out Timer; Prescaler : UInt16; Period : UInt32) with Pre => (if Period > UInt32 (UInt16'Last) then Has_32bit_Counter (This)), Post => Current_Prescaler (This) = Prescaler and Current_Autoreload (This) = Period; procedure Set_Counter (This : in out Timer; Value : UInt16) with Post => Current_Counter (This) = UInt32 (Value); procedure Set_Counter (This : in out Timer; Value : UInt32) with Pre => Has_32bit_Counter (This), Post => Current_Counter (This) = Value; function Current_Counter (This : Timer) return UInt32; -- For those timers that actually have a 32-bit counter this function will -- return the full word value. For the other timers, the upper half-word of -- the result will be all zeros so in effect the result will be a half-word -- value. procedure Set_Repetition_Counter (This : in out Timer; Value : UInt32) with Pre => Complementary_Outputs_Supported (This) and (if Value > UInt32 (UInt8'Last) then Advanced_Timer (This)), Post => Current_Repetition_Counter (This) = Value; function Current_Repetition_Counter (This : Timer) return UInt32 with Pre => Complementary_Outputs_Supported (This); procedure Set_Autoreload (This : in out Timer; Value : UInt32) with Pre => (if Value > UInt32 (UInt16'Last) then Has_32bit_Counter (This)), Post => Current_Autoreload (This) = Value; function Current_Autoreload (This : Timer) return UInt32; -- Returns the value of the timer's Auto Reload Register (ARR) type Timer_Clock_Divisor is (Div1, Div2, Div4); procedure Set_Clock_Division (This : in out Timer; Value : Timer_Clock_Divisor) with Pre => not Basic_Timer (This), Post => Current_Clock_Division (This) = Value; function Current_Clock_Division (This : Timer) return Timer_Clock_Divisor; type Timer_Counter_Alignment_Mode is (Up, Down, Center_Aligned1, Center_Aligned2, Center_Aligned3); -- We combine the up-down direction and the center-aligned mode selection -- into a single type because the two are interdependent and we don't want -- the user to have to remember to set the direction when not using one -- of the center-aligned choices. The discontiguous binary values used to -- represent the enumerals reflect the combination of the adjacent fields -- within the timer representation. for Timer_Counter_Alignment_Mode use (Up => 2#000#, Down => 2#001#, Center_Aligned1 => 2#010#, Center_Aligned2 => 2#100#, Center_Aligned3 => 2#110#); procedure Set_Counter_Mode (This : in out Timer; Value : Timer_Counter_Alignment_Mode) with Post => Current_Counter_Mode (This) = Value; function Current_Counter_Mode (This : Timer) return Timer_Counter_Alignment_Mode; -- Note that the basic timers only count up. procedure Configure (This : in out Timer; Prescaler : UInt16; Period : UInt32; Clock_Divisor : Timer_Clock_Divisor; Counter_Mode : Timer_Counter_Alignment_Mode) with Pre => not Basic_Timer (This) and (if Period > UInt32 (UInt16'Last) then Has_32bit_Counter (This)), Post => Current_Prescaler (This) = Prescaler and Current_Clock_Division (This) = Clock_Divisor and Current_Counter_Mode (This) = Counter_Mode and Current_Autoreload (This) = Period; type Timer_Prescaler_Reload_Mode is (Update, Immediate); procedure Configure_Prescaler (This : in out Timer; Prescaler : UInt16; Reload_Mode : Timer_Prescaler_Reload_Mode) with Post => Current_Prescaler (This) = Prescaler; function Current_Prescaler (This : Timer) return UInt16; procedure Set_UpdateDisable (This : in out Timer; To : Boolean); type Timer_Update_Source is (Global, Regular); procedure Set_UpdateRequest (This : in out Timer; Source : Timer_Update_Source); procedure Set_Autoreload_Preload (This : in out Timer; To : Boolean); type Timer_One_Pulse_Mode is (Repetitive, Single); procedure Select_One_Pulse_Mode (This : in out Timer; Mode : Timer_One_Pulse_Mode) with Post => (if Mode = Single then not Enabled (This)); procedure Compute_Prescaler_And_Period (This : access Timer; Requested_Frequency : UInt32; Prescaler : out UInt32; Period : out UInt32) with Pre => Requested_Frequency > 0; -- Computes the minimum prescaler and thus the maximum resolution for the -- given timer, based on the system clocks and the requested frequency. -- Computes the period required for the requested frequency. Invalid_Request : exception; -- Raised when the requested frequency is too high or too low for the given -- timer and system clocks when calling Configure_PWM_Timer, or when -- the requested time is too high for the specified frequency when calling -- Set_Duty_Time. ---------------------------------------------------------------------------- -- Interrupts, DMA, Flags Management -------------------------------------- ---------------------------------------------------------------------------- type Timer_Interrupt is (Timer_Update_Interrupt, Timer_CC1_Interrupt, Timer_CC2_Interrupt, Timer_CC3_Interrupt, Timer_CC4_Interrupt, Timer_COM_Interrupt, Timer_Trigger_Interrupt, Timer_Break_Interrupt); for Timer_Interrupt use (Timer_Update_Interrupt => 2#00000001#, Timer_CC1_Interrupt => 2#00000010#, Timer_CC2_Interrupt => 2#00000100#, Timer_CC3_Interrupt => 2#00001000#, Timer_CC4_Interrupt => 2#00010000#, Timer_COM_Interrupt => 2#00100000#, Timer_Trigger_Interrupt => 2#01000000#, Timer_Break_Interrupt => 2#10000000#); procedure Enable_Interrupt (This : in out Timer; Source : Timer_Interrupt) with Pre => (if Basic_Timer (This) then Source = Timer_Update_Interrupt) and (if Source in Timer_COM_Interrupt | Timer_Break_Interrupt then Advanced_Timer (This)), Post => Interrupt_Enabled (This, Source); type Timer_Interrupt_List is array (Positive range <>) of Timer_Interrupt; procedure Enable_Interrupt (This : in out Timer; Sources : Timer_Interrupt_List) with Pre => (for all Source of Sources => (if Basic_Timer (This) then Source = Timer_Update_Interrupt) and (if Source in Timer_COM_Interrupt | Timer_Break_Interrupt then Advanced_Timer (This))), Post => (for all Source of Sources => Interrupt_Enabled (This, Source)); procedure Disable_Interrupt (This : in out Timer; Source : Timer_Interrupt) with Pre => (if Basic_Timer (This) then Source = Timer_Update_Interrupt) and (if Source in Timer_COM_Interrupt | Timer_Break_Interrupt then Advanced_Timer (This)), Post => not Interrupt_Enabled (This, Source); procedure Clear_Pending_Interrupt (This : in out Timer; Source : Timer_Interrupt) with Pre => (if Basic_Timer (This) then Source = Timer_Update_Interrupt) and (if Source in Timer_COM_Interrupt | Timer_Break_Interrupt then Advanced_Timer (This)); function Interrupt_Enabled (This : Timer; Source : Timer_Interrupt) return Boolean with Pre => (if Basic_Timer (This) then Source = Timer_Update_Interrupt) and (if Source in Timer_COM_Interrupt | Timer_Break_Interrupt then Advanced_Timer (This)); type Timer_Event_Source is (Event_Source_Update, Event_Source_CC1, Event_Source_CC2, Event_Source_CC3, Event_Source_CC4, Event_Source_COM, Event_Source_Trigger, Event_Source_Break, Event_Source_Break2); for Timer_Event_Source use (Event_Source_Update => 16#0001#, Event_Source_CC1 => 16#0002#, Event_Source_CC2 => 16#0004#, Event_Source_CC3 => 16#0008#, Event_Source_CC4 => 16#0010#, Event_Source_COM => 16#0020#, Event_Source_Trigger => 16#0040#, Event_Source_Break => 16#0080#, Event_Source_Break2 => 16#0100#); -- TODO: consider alternative to bit-masks procedure Generate_Event (This : in out Timer; Source : Timer_Event_Source) with Pre => (if Basic_Timer (This) then Source = Event_Source_Update) and (if Source in Event_Source_COM | Event_Source_Break then Advanced_Timer (This)); type Timer_Status_Flag is (Timer_Update_Indicated, Timer_CC1_Indicated, Timer_CC2_Indicated, Timer_CC3_Indicated, Timer_CC4_Indicated, Timer_COM_Indicated, Timer_Trigger_Indicated, Timer_Break_Indicated, Timer_Break2_Indicated, Timer_CC1_Overcap_Indicated, Timer_CC2_Overcap_Indicated, Timer_CC3_Overcap_Indicated, Timer_CC4_Overcap_Indicated, Timer_CC5_Indicated, Timer_CC6_Indicated); for Timer_Status_Flag use (Timer_Update_Indicated => 16#00000001#, Timer_CC1_Indicated => 16#00000002#, Timer_CC2_Indicated => 16#00000004#, Timer_CC3_Indicated => 16#00000008#, Timer_CC4_Indicated => 16#00000010#, Timer_COM_Indicated => 16#00000020#, Timer_Trigger_Indicated => 16#00000040#, Timer_Break_Indicated => 16#00000080#, Timer_Break2_Indicated => 16#00000100#, Timer_CC1_Overcap_Indicated => 16#00000200#, Timer_CC2_Overcap_Indicated => 16#00000400#, Timer_CC3_Overcap_Indicated => 16#00000800#, Timer_CC4_Overcap_Indicated => 16#00001000#, Timer_CC5_Indicated => 16#00010000#, Timer_CC6_Indicated => 16#00020000#); function Status (This : Timer; Flag : Timer_Status_Flag) return Boolean with Pre => (if Basic_Timer (This) then Flag = Timer_Update_Indicated) and (if Flag in Timer_COM_Indicated | Timer_Break_Indicated then Advanced_Timer (This)); procedure Clear_Status (This : in out Timer; Flag : Timer_Status_Flag) with Pre => (if Basic_Timer (This) then Flag = Timer_Update_Indicated) and (if Flag in Timer_COM_Indicated | Timer_Break_Indicated then Advanced_Timer (This)), Post => not Status (This, Flag); type Timer_DMA_Source is (Timer_DMA_Update, Timer_DMA_CC1, Timer_DMA_CC2, Timer_DMA_CC3, Timer_DMA_CC4, Timer_DMA_COM, Timer_DMA_Trigger); for Timer_DMA_Source use (Timer_DMA_Update => 2#00000001_00000000#, Timer_DMA_CC1 => 2#00000010_00000000#, Timer_DMA_CC2 => 2#00000100_00000000#, Timer_DMA_CC3 => 2#00001000_00000000#, Timer_DMA_CC4 => 2#00010000_00000000#, Timer_DMA_COM => 2#00100000_00000000#, Timer_DMA_Trigger => 2#01000000_00000000#); -- TODO: consider using a packed array of booleans in the SR representation -- instead of bit-patterns, thereby obviating this rep clause procedure Enable_DMA_Source (This : in out Timer; Source : Timer_DMA_Source) with Pre => ((if Basic_Timer (This) then Source = Timer_DMA_Update) and (if Source in Timer_DMA_COM | Timer_DMA_Trigger then Advanced_Timer (This))) or else DMA_Supported (This), Post => DMA_Source_Enabled (This, Source); procedure Disable_DMA_Source (This : in out Timer; Source : Timer_DMA_Source) with Pre => ((if Basic_Timer (This) then Source = Timer_DMA_Update) and (if Source in Timer_DMA_COM | Timer_DMA_Trigger then Advanced_Timer (This))) or else DMA_Supported (This), Post => not DMA_Source_Enabled (This, Source); function DMA_Source_Enabled (This : Timer; Source : Timer_DMA_Source) return Boolean with Pre => ((if Basic_Timer (This) then Source = Timer_DMA_Update) and (if Source in Timer_DMA_COM | Timer_DMA_Trigger then Advanced_Timer (This))) or else DMA_Supported (This); type Timer_DMA_Burst_Length is (DMA_Burst_Length_1, DMA_Burst_Length_2, DMA_Burst_Length_3, DMA_Burst_Length_4, DMA_Burst_Length_5, DMA_Burst_Length_6, DMA_Burst_Length_7, DMA_Burst_Length_8, DMA_Burst_Length_9, DMA_Burst_Length_10, DMA_Burst_Length_11, DMA_Burst_Length_12, DMA_Burst_Length_13, DMA_Burst_Length_14, DMA_Burst_Length_15, DMA_Burst_Length_16, DMA_Burst_Length_17, DMA_Burst_Length_18, DMA_Burst_Length_19, DMA_Burst_Length_20, DMA_Burst_Length_21, DMA_Burst_Length_22, DMA_Burst_Length_23, DMA_Burst_Length_24, DMA_Burst_Length_25, DMA_Burst_Length_26); type Timer_DMA_Base_Address is (DMA_Base_CR1, DMA_Base_CR2, DMA_Base_SMCR, DMA_Base_DIER, DMA_Base_SR, DMA_Base_EGR, DMA_Base_CCMR1, DMA_Base_CCMR2, DMA_Base_CCER, DMA_Base_CNT, DMA_Base_PSC, DMA_Base_ARR, DMA_Base_RCR, DMA_Base_CCR1, DMA_Base_CCR2, DMA_Base_CCR3, DMA_Base_CCR4, DMA_Base_BDTR, DMA_Base_CCR5, DMA_Base_CCR6, DMA_Base_CCMR3, DMA_Base_DTR2, DMA_Base_ECR, DMA_Base_TISEL, DMA_Base_AF1, DMA_Base_AF2, DMA_Base_26, DMA_Base_27, DMA_Base_28, DMA_Base_29, DMA_Base_30, DMA_Base_31); procedure Configure_DMA (This : in out Timer; Base_Address : Timer_DMA_Base_Address; Burst_Length : Timer_DMA_Burst_Length); procedure Enable_Capture_Compare_DMA (This : in out Timer); procedure Disable_Capture_Compare_DMA (This : in out Timer); ---------------------------------------------------------------------------- -- Output Compare Management ---------------------------------------------- ---------------------------------------------------------------------------- type Timer_Channel is (Channel_1, Channel_2, Channel_3, Channel_4, Channel_5, Channel_6); procedure Enable_Channel (This : in out Timer; Channel : Timer_Channel) with Pre => not Basic_Timer (This), Post => Channel_Enabled (This, Channel); procedure Disable_Channel (This : in out Timer; Channel : Timer_Channel) with Pre => not Basic_Timer (This), Post => not Channel_Enabled (This, Channel); function Channel_Enabled (This : Timer; Channel : Timer_Channel) return Boolean; procedure Enable_Complementary_Channel (This : in out Timer; Channel : Timer_Channel) with Pre => Complementary_Outputs_Supported (This, Channel), Post => Complementary_Channel_Enabled (This, Channel); procedure Disable_Complementary_Channel (This : in out Timer; Channel : Timer_Channel) with Pre => Complementary_Outputs_Supported (This, Channel), Post => not Complementary_Channel_Enabled (This, Channel); function Complementary_Channel_Enabled (This : Timer; Channel : Timer_Channel) return Boolean with Pre => Complementary_Outputs_Supported (This, Channel); Timer_Channel_Access_Error : exception; -- Raised when accessing a given channel configuration with the wrong view: -- as an input when it is set to be an output, and vice versa type Timer_Output_Compare_And_PWM_Mode is (Frozen, Active, Inactive, Toggle, Force_Inactive, Force_Active, PWM1, PWM2, Retriggerable_OPM1, Retriggerable_OPM2, Combined_PWM1, Combined_PWM2, Asymmetric_PWM1, Asymmetric_PWM2); -- See RM pg 457 for the effects of these values for Timer_Output_Compare_And_PWM_Mode use (Frozen => 2#0000#, Active => 2#0001#, Inactive => 2#0010#, Toggle => 2#0011#, Force_Inactive => 2#0100#, Force_Active => 2#0101#, PWM1 => 2#0110#, PWM2 => 2#0111#, Retriggerable_OPM1 => 2#1000#, Retriggerable_OPM2 => 2#1001#, Combined_PWM1 => 2#1100#, Combined_PWM2 => 2#1101#, Asymmetric_PWM1 => 2#1110#, Asymmetric_PWM2 => 2#1111#); type Timer_Capture_Compare_State is (Disable, Enable); type Timer_Output_Compare_Polarity is (High, Low); procedure Configure_Channel_Output (This : in out Timer; Channel : Timer_Channel; Mode : Timer_Output_Compare_And_PWM_Mode; State : Timer_Capture_Compare_State; Pulse : UInt32; Polarity : Timer_Output_Compare_Polarity) with Pre => (CC_Channel_Exists (This, Channel) and Specific_Channel_Output_Supported (This, Channel)) and (if not Has_32bit_CC_Values (This) then Pulse <= 16#FFFF#), Post => (if State = Enable then Channel_Enabled (This, Channel) else not Channel_Enabled (This, Channel)); procedure Set_Compare_Value (This : in out Timer; Channel : Timer_Channel; Word_Value : UInt32) with Pre => Has_32bit_CC_Values (This), Post => Current_Capture_Value (This, Channel) = Word_Value; procedure Set_Compare_Value (This : in out Timer; Channel : Timer_Channel; Value : UInt16) with Pre => CC_Channel_Exists (This, Channel), Post => Current_Capture_Value (This, Channel) = Value; type Timer_Capture_Compare_Modes is (Output, Direct_TI, Indirect_TI, TRC); function Current_Capture_Compare_Mode (This : Timer; Channel : Timer_Channel) return Timer_Capture_Compare_Modes; -- A convenience routine that sets the capture/compare selection to be that -- of a single channel output and assigns all the controls of that output, -- as an alternative to calling the individual routines. Does not raise the -- access error exception because it explicitly sets the mode to Output. procedure Set_Single_Output (This : in out Timer; Channel : Timer_Channel; Mode : Timer_Output_Compare_And_PWM_Mode; OC_Clear_Enabled : Boolean; Preload_Enabled : Boolean; Fast_Enabled : Boolean) with Pre => CC_Channel_Exists (This, Channel), Post => Current_Capture_Compare_Mode (This, Channel) = Output; procedure Set_Output_Compare_Mode (This : in out Timer; Channel : Timer_Channel; Mode : Timer_Output_Compare_And_PWM_Mode) with Pre => (not Basic_Timer (This)) and (if Current_Capture_Compare_Mode (This, Channel) /= Output then raise Timer_Channel_Access_Error); procedure Set_Output_Preload_Enable (This : in out Timer; Channel : Timer_Channel; Enabled : Boolean) with Pre => CC_Channel_Exists (This, Channel) and (if Current_Capture_Compare_Mode (This, Channel) /= Output then raise Timer_Channel_Access_Error); procedure Set_Output_Fast_Enable (This : in out Timer; Channel : Timer_Channel; Enabled : Boolean) with Pre => CC_Channel_Exists (This, Channel) and (if Current_Capture_Compare_Mode (This, Channel) /= Output then raise Timer_Channel_Access_Error); procedure Set_Clear_Control (This : in out Timer; Channel : Timer_Channel; Enabled : Boolean) with Pre => CC_Channel_Exists (This, Channel) and (if Current_Capture_Compare_Mode (This, Channel) /= Output then raise Timer_Channel_Access_Error); procedure Set_Output_Forced_Action (This : in out Timer; Channel : Timer_Channel; Active : Boolean) with Pre => CC_Channel_Exists (This, Channel) and (if Current_Capture_Compare_Mode (This, Channel) /= Output then raise Timer_Channel_Access_Error); procedure Set_Output_Polarity (This : in out Timer; Channel : Timer_Channel; Polarity : Timer_Output_Compare_Polarity) with Pre => not Basic_Timer (This); procedure Set_Output_Complementary_Polarity (This : in out Timer; Channel : Timer_Channel; Polarity : Timer_Output_Compare_Polarity) with Pre => Advanced_Timer (This); function No_Outputs_Enabled (This : Timer) return Boolean; -- Indicates whether all outputs are disabled for all channels of the given -- timer. ---------------------------------------------------------------------------- -- Input Capture Management ----------------------------------------------- ---------------------------------------------------------------------------- type Timer_Input_Capture_Filter is (No_Filter, FCK_INT_N2, FCK_INT_N4, FCK_INT_N8, FDTS2_N6, FDTS2_N8, FDTS4_N6, FDTS4_N8, FDTS8_N6, FDTS8_N8, FDTS16_N5, FDTS16_N6, FDTS16_N8, FDTS32_N5, FDTS32_N6, FDTS32_N8); type Timer_Input_Capture_Polarity is (Rising, Falling, Both_Edges); subtype Timer_Input_Capture_Selection is Timer_Capture_Compare_Modes range Direct_TI .. TRC; type Timer_Input_Capture_Prescaler is (Div1, -- Capture performed each time an edge is detected on input Div2, -- Capture performed once every 2 events Div4, -- Capture performed once every 4 events Div8); -- Capture performed once every 8 events procedure Configure_Channel_Input (This : in out Timer; Channel : Timer_Channel; Polarity : Timer_Input_Capture_Polarity; Selection : Timer_Input_Capture_Selection; Prescaler : Timer_Input_Capture_Prescaler; Filter : Timer_Input_Capture_Filter) with Pre => CC_Channel_Exists (This, Channel) and (if Filter > FDTS4_N8 then Advanced_Timer (This)), Post => Channel_Enabled (This, Channel) and Current_Capture_Compare_Mode (This, Channel) = Selection; procedure Configure_Channel_Input_PWM (This : in out Timer; Channel : Timer_Channel; Selection : Timer_Input_Capture_Selection; Polarity : Timer_Input_Capture_Polarity; Prescaler : Timer_Input_Capture_Prescaler; Filter : Timer_Input_Capture_Filter) with Pre => Has_At_Least_2_CC_Channels (This) and Channel in Channel_1 | Channel_2, Post => Channel_Enabled (This, Channel) and Current_Capture_Compare_Mode (This, Channel) = Selection and Current_Input_Prescaler (This, Channel) = Prescaler; procedure Set_Input_Prescaler (This : in out Timer; Channel : Timer_Channel; Value : Timer_Input_Capture_Prescaler) with Pre => not Basic_Timer (This) and Current_Capture_Compare_Mode (This, Channel) /= Output, Post => Current_Input_Prescaler (This, Channel) = Value; function Current_Input_Prescaler (This : Timer; Channel : Timer_Channel) return Timer_Input_Capture_Prescaler; function Current_Capture_Value (This : Timer; Channel : Timer_Channel) return UInt32; -- Reading the upper reserved area of the CCR register does no harm when -- the timer does not support 32-bit CC registers so we do not protect -- this function with a precondition. function Current_Capture_Value (This : Timer; Channel : Timer_Channel) return UInt16; ---------------------------------------------------------------------------- -- Advanced control timers ------------------------------------------------ ---------------------------------------------------------------------------- procedure Enable_Main_Output (This : in out Timer) with Pre => Advanced_Timer (This), Post => Main_Output_Enabled (This); procedure Disable_Main_Output (This : in out Timer) with Pre => Advanced_Timer (This), Post => (if No_Outputs_Enabled (This) then not Main_Output_Enabled (This)); function Main_Output_Enabled (This : Timer) return Boolean; procedure Configure (This : in out Timer; Prescaler : UInt16; Period : UInt32; Clock_Divisor : Timer_Clock_Divisor; Counter_Mode : Timer_Counter_Alignment_Mode; Repetitions : UInt8) with Pre => Advanced_Timer (This) and (if Period > UInt32 (UInt16'Last) then Has_32bit_Counter (This)), Post => Current_Prescaler (This) = Prescaler and Current_Autoreload (This) = Period; procedure Configure_Channel_Output (This : in out Timer; Channel : Timer_Channel; Mode : Timer_Output_Compare_And_PWM_Mode; State : Timer_Capture_Compare_State; Pulse : UInt32; Polarity : Timer_Output_Compare_Polarity; Idle_State : Timer_Capture_Compare_State; Complementary_Polarity : Timer_Output_Compare_Polarity; Complementary_Idle_State : Timer_Capture_Compare_State) with Pre => Advanced_Timer (This) and (if not Has_32bit_CC_Values (This) then Pulse <= 16#FFFF#), Post => (if State = Enable then Channel_Enabled (This, Channel) else not Channel_Enabled (This, Channel)); procedure Enable_CC_Preload_Control (This : in out Timer) with Pre => Advanced_Timer (This); procedure Disable_CC_Preload_Control (This : in out Timer) with Pre => Advanced_Timer (This); procedure Select_Commutation (This : in out Timer) with Pre => Advanced_Timer (This); procedure Deselect_Commutation (This : in out Timer) with Pre => Advanced_Timer (This); type Timer_Break_Polarity is (Low, High); type Timer_Break_Filter is (No_Filter, FCK_INT_N2, FCK_INT_N4, FCK_INT_N8, FDTS2_N6, FDTS2_N8, FDTS4_N6, FDTS4_N8, FDTS8_N6, FDTS8_N8, FDTS16_N5, FDTS16_N6, FDTS16_N8, FDTS32_N5, FDTS32_N6, FDTS32_N8); type Timer_Lock_Level is (Off, Level_1, Level_2, Level_3); procedure Configure_Break (This : in out Timer; Automatic_Output_Enabled : Boolean; Break_Polarity : Timer_Break_Polarity; Break_Enabled : Boolean; Break_Filter : Timer_Break_Filter; Off_State_Selection_Run_Mode : Bit; Off_State_Selection_Idle_Mode : Bit) with Pre => Complementary_Outputs_Supported (This); procedure Configure_Break (This : in out Timer; Automatic_Output_Enabled : Boolean; Break_Polarity : Timer_Break_Polarity; Break_Enabled : Boolean; Break_Filter : Timer_Break_Filter; Break_2_Polarity : Timer_Break_Polarity; Break_2_Enabled : Boolean; Break_2_Filter : Timer_Break_Filter; Off_State_Selection_Run_Mode : Bit; Off_State_Selection_Idle_Mode : Bit) with Pre => Advanced_Timer (This); procedure Configure_Deadtime (This : in out Timer; Time : Float) with Pre => Complementary_Outputs_Supported (This); -- Configure the DTG bit-field for timer register BDTR such that -- the requested deadtime Time is obtained. -- Please refer to STM32F4 reference manual for details. procedure Set_BDTR_Lock (This : in out Timer; Lock : Timer_Lock_Level) with Pre => Complementary_Outputs_Supported (This); -- Write protection against software errors. ---------------------------------------------------------------------------- -- Synchronization Management --------------------------------------------- ---------------------------------------------------------------------------- type Timer_Trigger_Input_Source is (Internal_Trigger_0, -- ITR0 Internal_Trigger_1, -- ITR1 Internal_Trigger_2, -- ITR2 Internal_Trigger_3, -- ITR3 TI1_Edge_Detector, -- TI1F_ED Filtered_Timer_Input_1, -- TI1FP1 Filtered_Timer_Input_2, -- TI2FP2 External_Trigger_Input, -- ETRF Internal_Trigger_4, -- ITR4 Internal_Trigger_5, -- ITR5 Internal_Trigger_6, -- ITR6 Internal_Trigger_7, -- ITR7 Internal_Trigger_8, -- ITR8 Internal_Trigger_9, -- ITR9 Internal_Trigger_10) -- ITR10 with Size => 5; -- See RM0440 for ITRx internal connections: -- TIM1, TIM8, TIM20 - table 250, pg 1090, section 28.3.2. -- TIM2, TIM3, TIM4, TIM5, TIM6, TIM7 don't have. -- TIM15, TIM16, TIM17 table 290, pg 1351, section 30.4.2. procedure Select_Input_Trigger (This : in out Timer; Source : Timer_Trigger_Input_Source) with Pre => not Basic_Timer (This); type Timer_Trigger_Output_Source is (Reset, Enable, Update, Compare_Pulse_CC1, Compare_OC1Ref, Compare_OC2Ref, Compare_OC3Ref, Compare_OC4Ref); type Timer_Trigger_Output_Source_ADC is (Reset, Enable, Update, Compare_Pulse_CC1, Compare_OC1Ref, Compare_OC2Ref, Compare_OC3Ref, Compare_OC4Ref, Compare_OC5Ref, Compare_OC6Ref, Compare_Pulse_OC4Ref_R_F, Compare_Pulse_OC6Ref_R_F, Compare_Pulse_OC4Ref_R_OC6Ref_R, Compare_Pulse_OC4Ref_R_OC6Ref_F, Compare_Pulse_OC5Ref_R_OC6Ref_R, Compare_Pulse_OC5Ref_R_OC6Ref_F); procedure Select_Output_Trigger (This : in out Timer; Source : Timer_Trigger_Output_Source) with Pre => Trigger_Output_Selectable (This); -- any of Timer 1 .. 8 type Timer_Slave_Mode is (Disabled, Quadrature_Encoder_Mode_1, -- x2 mode, counting up/down on TI1FP1 edge depending on TI2FP2 -- level. Quadrature_Encoder_Mode_2, -- x2 mode, counting up/down on TI2FP2 edge depending on TI1FP1 -- level. Quadrature_Encoder_Mode_3, -- x4 mode, counting up/down on both TI1FP1 & TI2FP2 edges depending -- on the level of the other input. Reset, -- Counter reinitialize and update registers on TRGI rising edge. Gated, -- Counter is enabled when TRGI is high and stops when low without reset. Trigger, -- Counter starts at TRGI trigger rising edge. External_1, -- Counter clocked by TRGI rising edges. Combined_Reset_Trigger, -- Counter reinitialize, update registers and start the counter on TRGI. Combined_Reset_Gated, -- Counter reinitialize, update registers and start the counter on TRGI. Encoder_Mode_1, -- Clock plus direction, x2 mode. Encoder_Mode_2, -- Clock plus direction, x1 mode, TI2FP2 edge sensitivity is set by CC2P. Encoder_Mode_3, -- Directional clock, x2 mode. Encoder_Mode_4, -- Directional clock, x1 mode, TI1FP1 and TI2FP2 edge sensitivity is -- set by CC1P and CC2P. Quadrature_Encoder_Mode_4, -- x1 mode, counting on TI1FP1 edges only, edge sensitivity is set by CC1P. Quadrature_Encoder_Mode_5) -- x1 mode, counting on TI2FP2 edges only, edge sensitivity is set by CC2P. with Size => 4; procedure Select_Slave_Mode (This : in out Timer; Mode : Timer_Slave_Mode) with Pre => Slave_Mode_Supported (This); procedure Enable_Master_Slave_Mode (This : in out Timer) with Pre => Slave_Mode_Supported (This); procedure Disable_Master_Slave_Mode (This : in out Timer) with Pre => Slave_Mode_Supported (This); type Timer_External_Trigger_Polarity is (NonInverted, Inverted); type Timer_External_Trigger_Prescaler is (Off, Div_2, Div_4, Div_8); type Timer_External_Trigger_Filter is (No_Filter, FCK_INT_N2, FCK_INT_N4, FCK_INT_N8, FDTS2_N6, FDTS2_N8, FDTS4_N6, FDTS4_N8, FDTS8_N6, FDTS8_N8, FDTS16_N5, FDTS16_N6, FDTS16_N8, FDTS32_N5, FDTS32_N6, FDTS32_N8); procedure Configure_External_Trigger (This : in out Timer; Polarity : Timer_External_Trigger_Polarity; Prescaler : Timer_External_Trigger_Prescaler; Filter : Timer_External_Trigger_Filter) with Pre => External_Trigger_Supported (This); ---------------------------------------------------------------------------- -- Clocks Management ------------------------------------------------------ ---------------------------------------------------------------------------- procedure Select_Internal_Clock (This : in out Timer) renames Disable_Master_Slave_Mode; subtype Timer_Internal_Trigger_Source is Timer_Trigger_Input_Source range Internal_Trigger_0 .. Internal_Trigger_3; procedure Configure_As_External_Clock (This : in out Timer; Source : Timer_Internal_Trigger_Source) with Pre => Clock_Management_Supported (This); subtype Timer_External_Clock_Source is Timer_Trigger_Input_Source range TI1_Edge_Detector .. Filtered_Timer_Input_2; procedure Configure_As_External_Clock (This : in out Timer; Source : Timer_External_Clock_Source; Polarity : Timer_Input_Capture_Polarity; Filter : Timer_Input_Capture_Filter) with Pre => not Basic_Timer (This); procedure Configure_External_Clock_Mode1 (This : in out Timer; Polarity : Timer_External_Trigger_Polarity; Prescaler : Timer_External_Trigger_Prescaler; Filter : Timer_External_Trigger_Filter) with Pre => External_Trigger_Supported (This); procedure Configure_External_Clock_Mode2 (This : in out Timer; Polarity : Timer_External_Trigger_Polarity; Prescaler : Timer_External_Trigger_Prescaler; Filter : Timer_External_Trigger_Filter) with Pre => External_Trigger_Supported (This); ---------------------------------------------------------------------------- -- Misc functions --------------------------------------------------------- ---------------------------------------------------------------------------- type Timer_Encoder_Mode is -- subtype of Timer_Slave_Mode (Quadrature_Encoder_Mode_1, -- x2 mode, counting up/down on TI1FP1 edge depending on TI2FP2 -- level. Quadrature_Encoder_Mode_2, -- x2 mode, counting up/down on TI2FP2 edge depending on TI1FP1 -- level. Quadrature_Encoder_Mode_3, -- x4 mode, counting up/down on both TI1FP1 & TI2FP2 edges depending -- on the level of the other input. Encoder_Mode_1, -- Clock plus direction, x2 mode. Encoder_Mode_2, -- Clock plus direction, x1 mode, TI2FP2 edge sensitivity is set by CC2P. Encoder_Mode_3, -- Directional clock, x2 mode. Encoder_Mode_4, -- Directional clock, x1 mode, TI1FP1 and TI2FP2 edge sensitivity is -- set by CC1P and CC2P. Quadrature_Encoder_Mode_4, -- x1 mode, counting on TI1FP1 edges only, edge sensitivity is set by CC1P. Quadrature_Encoder_Mode_5) -- x1 mode, counting on TI2FP2 edges only, edge sensitivity is set by CC2P. with Size => 4; for Timer_Encoder_Mode use (Quadrature_Encoder_Mode_1 => 2#0001#, Quadrature_Encoder_Mode_2 => 2#0010#, Quadrature_Encoder_Mode_3 => 2#0011#, Encoder_Mode_1 => 2#1010#, Encoder_Mode_2 => 2#1011#, Encoder_Mode_3 => 2#1100#, Encoder_Mode_4 => 2#1101#, Quadrature_Encoder_Mode_4 => 2#1110#, Quadrature_Encoder_Mode_5 => 2#1111#); procedure Configure_Encoder_Interface (This : in out Timer; Mode : Timer_Encoder_Mode; IC1_Polarity : Timer_Input_Capture_Polarity; IC2_Polarity : Timer_Input_Capture_Polarity) with Pre => Has_At_Least_2_CC_Channels (This); procedure Enable_Hall_Sensor (This : in out Timer) with Pre => Hall_Sensor_Supported (This); procedure Disable_Hall_Sensor (This : in out Timer) with Pre => Hall_Sensor_Supported (This); type UIF_Remapping_State is (Disable, Enable); -- See RM pg. 443 ---------------------------------------------------------------------------- -- Classifier functions --------------------------------------------------- ---------------------------------------------------------------------------- -- Timers 6 and 7 function Basic_Timer (This : Timer) return Boolean is (This'Address = STM32_SVD.TIM6_Base or This'Address = STM32_SVD.TIM7_Base); -- Timer 1, 8 and 20 function Advanced_Timer (This : Timer) return Boolean is (This'Address = STM32_SVD.TIM1_Base or This'Address = STM32_SVD.TIM8_Base or This'Address = STM32_SVD.TIM20_Base); -- Timer 2 and 5 function Has_32bit_Counter (This : Timer) return Boolean is (This'Address = STM32_SVD.TIM2_Base or This'Address = STM32_SVD.TIM5_Base); -- The RM0440 section 29.5.13 pg 1327, indicates that timer 2 and 5 -- actually have the upper half of the counter available, and that the -- others must keep it reserved. This would appear to confirm the text -- in the introduction to timers 2, 3, 4 and 5 in the section 29.3. -- Timer 2 and 5 function Has_32bit_CC_Values (This : Timer) return Boolean renames Has_32bit_Counter; -- Timers 1 .. 5, 8, 15, 20 function Clock_Management_Supported (This : Timer) return Boolean is (This'Address = STM32_SVD.TIM1_Base or This'Address = STM32_SVD.TIM2_Base or This'Address = STM32_SVD.TIM3_Base or This'Address = STM32_SVD.TIM4_Base or This'Address = STM32_SVD.TIM5_Base or This'Address = STM32_SVD.TIM8_Base or This'Address = STM32_SVD.TIM15_Base or This'Address = STM32_SVD.TIM20_Base); -- Timers 1 .. 3, 15 function Has_At_Least_2_CC_Channels (This : Timer) return Boolean is (This'Address = STM32_SVD.TIM1_Base or This'Address = STM32_SVD.TIM2_Base or This'Address = STM32_SVD.TIM3_Base or This'Address = STM32_SVD.TIM15_Base); -- Timers 1 .. 5, 8 and 20 function Has_At_Least_3_CC_Channels (This : Timer) return Boolean is (This'Address = STM32_SVD.TIM1_Base or This'Address = STM32_SVD.TIM2_Base or This'Address = STM32_SVD.TIM3_Base or This'Address = STM32_SVD.TIM4_Base or This'Address = STM32_SVD.TIM5_Base or This'Address = STM32_SVD.TIM8_Base or This'Address = STM32_SVD.TIM20_Base); -- Timers 1 .. 5, 8 and 20 function Has_At_Least_4_CC_Channels (This : Timer) return Boolean renames Has_At_Least_3_CC_Channels; -- Timers 1, 8 and 20 function Has_At_Least_5_CC_Channels (This : Timer) return Boolean is (This'Address = STM32_SVD.TIM1_Base or This'Address = STM32_SVD.TIM8_Base or This'Address = STM32_SVD.TIM20_Base); -- Timers 1, 8 and 20 function Has_At_Least_6_CC_Channels (This : Timer) return Boolean renames Has_At_Least_5_CC_Channels; -- Not all timers have four channels available for capture/compare function CC_Channel_Exists (This : Timer; Channel : Timer_Channel) return Boolean is ((if Channel = Channel_1 then not Basic_Timer (This)) or (if Channel = Channel_2 then Has_At_Least_2_CC_Channels (This)) or (if Channel = Channel_3 then Has_At_Least_3_CC_Channels (This)) or (if Channel = Channel_4 then Has_At_Least_4_CC_Channels (This)) or (if Channel = Channel_5 then Has_At_Least_5_CC_Channels (This)) or (if Channel = Channel_6 then Has_At_Least_6_CC_Channels (This))); -- Timers 1 .. 5, 8 and 20 function Hall_Sensor_Supported (This : Timer) return Boolean is (This'Address = STM32_SVD.TIM1_Base or This'Address = STM32_SVD.TIM2_Base or This'Address = STM32_SVD.TIM3_Base or This'Address = STM32_SVD.TIM4_Base or This'Address = STM32_SVD.TIM5_Base or This'Address = STM32_SVD.TIM8_Base or This'Address = STM32_SVD.TIM20_Base); -- Timers 1 .. 5, 8, 15 and 20 function Input_XOR_Supported (This : Timer) return Boolean is (This'Address = STM32_SVD.TIM1_Base or This'Address = STM32_SVD.TIM2_Base or This'Address = STM32_SVD.TIM3_Base or This'Address = STM32_SVD.TIM4_Base or This'Address = STM32_SVD.TIM5_Base or This'Address = STM32_SVD.TIM8_Base or This'Address = STM32_SVD.TIM15_Base or This'Address = STM32_SVD.TIM20_Base); -- Timers 1 .. 5, 6, 7, 8, 15 ..17, 20 function DMA_Supported (This : Timer) return Boolean is (This'Address = STM32_SVD.TIM1_Base or This'Address = STM32_SVD.TIM2_Base or This'Address = STM32_SVD.TIM3_Base or This'Address = STM32_SVD.TIM4_Base or This'Address = STM32_SVD.TIM5_Base or This'Address = STM32_SVD.TIM6_Base or This'Address = STM32_SVD.TIM7_Base or This'Address = STM32_SVD.TIM8_Base or This'Address = STM32_SVD.TIM15_Base or This'Address = STM32_SVD.TIM16_Base or This'Address = STM32_SVD.TIM17_Base or This'Address = STM32_SVD.TIM20_Base); -- Timers 1 .. 5, 8, 15, 20 function Slave_Mode_Supported (This : Timer) return Boolean is (This'Address = STM32_SVD.TIM1_Base or This'Address = STM32_SVD.TIM2_Base or This'Address = STM32_SVD.TIM3_Base or This'Address = STM32_SVD.TIM4_Base or This'Address = STM32_SVD.TIM5_Base or This'Address = STM32_SVD.TIM8_Base or This'Address = STM32_SVD.TIM15_Base or This'Address = STM32_SVD.TIM20_Base); -- Timers 1 .. 5, 8, 15, 20 function Trigger_Output_Selectable (This : Timer) return Boolean is (This'Address = STM32_SVD.TIM1_Base or This'Address = STM32_SVD.TIM2_Base or This'Address = STM32_SVD.TIM3_Base or This'Address = STM32_SVD.TIM4_Base or This'Address = STM32_SVD.TIM5_Base or This'Address = STM32_SVD.TIM8_Base or This'Address = STM32_SVD.TIM15_Base or This'Address = STM32_SVD.TIM20_Base); -- Timers 1 .. 5, 8, 15, 20 function External_Trigger_Supported (This : Timer) return Boolean is (This'Address = STM32_SVD.TIM1_Base or This'Address = STM32_SVD.TIM2_Base or This'Address = STM32_SVD.TIM3_Base or This'Address = STM32_SVD.TIM4_Base or This'Address = STM32_SVD.TIM5_Base or This'Address = STM32_SVD.TIM8_Base or This'Address = STM32_SVD.TIM15_Base or This'Address = STM32_SVD.TIM20_Base); -- Timers 1 .. 8, 15 .. 17, 20 function Remapping_Capability_Supported (This : Timer) return Boolean is (This'Address = STM32_SVD.TIM1_Base or This'Address = STM32_SVD.TIM2_Base or This'Address = STM32_SVD.TIM3_Base or This'Address = STM32_SVD.TIM4_Base or This'Address = STM32_SVD.TIM5_Base or This'Address = STM32_SVD.TIM6_Base or This'Address = STM32_SVD.TIM7_Base or This'Address = STM32_SVD.TIM8_Base or This'Address = STM32_SVD.TIM15_Base or This'Address = STM32_SVD.TIM16_Base or This'Address = STM32_SVD.TIM17_Base or This'Address = STM32_SVD.TIM20_Base); -- Not all timers support output on all channels function Specific_Channel_Output_Supported (This : Timer; Channel : Timer_Channel) return Boolean is (This'Address = STM32_SVD.TIM1_Base or This'Address = STM32_SVD.TIM8_Base or This'Address = STM32_SVD.TIM20_Base -- all the above can be with any six channels or ((This'Address = STM32_SVD.TIM2_Base or This'Address = STM32_SVD.TIM3_Base or This'Address = STM32_SVD.TIM4_Base or This'Address = STM32_SVD.TIM5_Base) and Channel in Channel_1 | Channel_2 | Channel_3 | Channel_4) -- all the above can be with any four channels or (This'Address = STM32_SVD.TIM15_Base and Channel in Channel_1 | Channel_2) or ((This'Address = STM32_SVD.TIM16_Base or This'Address = STM32_SVD.TIM17_Base) and Channel = Channel_1)); -- Timer 1, 15, 16, 17 function Complementary_Outputs_Supported (This : Timer) return Boolean is (This'Address = STM32_SVD.TIM1_Base or This'Address = STM32_SVD.TIM8_Base or This'Address = STM32_SVD.TIM15_Base or This'Address = STM32_SVD.TIM16_Base or This'Address = STM32_SVD.TIM17_Base or This'Address = STM32_SVD.TIM20_Base); -- Timer 1, 8, 20 channels 1 .. 4, timers 15 .. 17 channel 1 function Complementary_Outputs_Supported (This : Timer; Channel : Timer_Channel) return Boolean is (((This'Address = STM32_SVD.TIM1_Base or This'Address = STM32_SVD.TIM8_Base or This'Address = STM32_SVD.TIM20_Base) and Channel in Channel_1 | Channel_2 | Channel_3 | Channel_4) or ((This'Address = STM32_SVD.TIM15_Base or This'Address = STM32_SVD.TIM16_Base or This'Address = STM32_SVD.TIM17_Base) and Channel = Channel_1)); private type TIMx_CR1 is record Reserved0 : UInt3; Dithering_Enable : Boolean; UIFREMAP : UIF_Remapping_State; Reserved1 : Bit; Clock_Division : Timer_Clock_Divisor; ARPE : Boolean; -- Auto-reload preload enable Mode_And_Dir : Timer_Counter_Alignment_Mode; One_Pulse_Mode : Timer_One_Pulse_Mode; Update_Request_Source : Boolean; Update_Disable : Boolean; Timer_Enabled : Boolean; end record with Volatile_Full_Access, Size => 32; for TIMx_CR1 use record Reserved0 at 0 range 13 .. 15; Dithering_Enable at 0 range 12 .. 12; UIFREMAP at 0 range 11 .. 11; Reserved1 at 0 range 10 .. 10; Clock_Division at 0 range 8 .. 9; ARPE at 0 range 7 .. 7; Mode_And_Dir at 0 range 4 .. 6; One_Pulse_Mode at 0 range 3 .. 3; Update_Request_Source at 0 range 2 .. 2; Update_Disable at 0 range 1 .. 1; Timer_Enabled at 0 range 0 .. 0; end record; ------------------------ representation for CR2 -------------------------- type TIMx_CR2 is record Reserved0 : UInt8; Master_Mode_Selection_2 : Timer_Trigger_Output_Source_ADC; Reserved1 : Bit; Channel_6_Output_Idle_State : Timer_Capture_Compare_State; Reserved2 : Bit; Channel_5_Output_Idle_State : Timer_Capture_Compare_State; Reserved3 : Bit; Channel_4_Output_Idle_State : Timer_Capture_Compare_State; Channel_3_Complementary_Output_Idle_State : Timer_Capture_Compare_State; Channel_3_Output_Idle_State : Timer_Capture_Compare_State; Channel_2_Complementary_Output_Idle_State : Timer_Capture_Compare_State; Channel_2_Output_Idle_State : Timer_Capture_Compare_State; Channel_1_Complementary_Output_Idle_State : Timer_Capture_Compare_State; Channel_1_Output_Idle_State : Timer_Capture_Compare_State; TI1_Selection : Boolean; Master_Mode_Selection : Timer_Trigger_Output_Source; Capture_Compare_DMA_Selection : Boolean; Capture_Compare_Control_Update_Selection : Boolean; Reserved4 : Bit; Capture_Compare_Preloaded_Control : Boolean; end record with Volatile_Full_Access, Size => 32; for TIMx_CR2 use record Reserved0 at 0 range 24 .. 31; Master_Mode_Selection_2 at 0 range 20 .. 23; Reserved1 at 0 range 19 .. 19; Channel_6_Output_Idle_State at 0 range 18 .. 18; Reserved2 at 0 range 17 .. 17; Channel_5_Output_Idle_State at 0 range 16 .. 16; Reserved3 at 0 range 15 .. 15; Channel_4_Output_Idle_State at 0 range 14 .. 14; Channel_3_Complementary_Output_Idle_State at 0 range 13 .. 13; Channel_3_Output_Idle_State at 0 range 12 .. 12; Channel_2_Complementary_Output_Idle_State at 0 range 11 .. 11; Channel_2_Output_Idle_State at 0 range 10 .. 10; Channel_1_Complementary_Output_Idle_State at 0 range 9 .. 9; Channel_1_Output_Idle_State at 0 range 8 .. 8; TI1_Selection at 0 range 7 .. 7; Master_Mode_Selection at 0 range 4 .. 6; Capture_Compare_DMA_Selection at 0 range 3 .. 3; Capture_Compare_Control_Update_Selection at 0 range 2 .. 2; Reserved4 at 0 range 1 .. 1; Capture_Compare_Preloaded_Control at 0 range 0 .. 0; end record; ------------ representation for slave mode control register -------------- type TIMx_SMCR is record Reserved0 : UInt6; SMS_Preload_Source : Boolean; SMS_Preload_Enable : Boolean; Reserved1 : UInt2; Trigger_Selection_1 : UInt2; -- Timer_External_Trigger_Filter Reserved2 : UInt3; Slave_Mode_Selection_2 : Boolean; -- Timer_Slave_Mode External_Trigger_Polarity : Timer_External_Trigger_Polarity; External_Clock_Enable : Boolean; External_Trigger_Prescaler : Timer_External_Trigger_Prescaler; External_Trigger_Filter : Timer_External_Trigger_Filter; Master_Slave_Mode : Boolean; Trigger_Selection : UInt3; -- Timer_External_Trigger_Filter OCREF_Clear_Selection : Boolean; Slave_Mode_Selection : UInt3; -- Timer_Slave_Mode end record with Volatile_Full_Access, Size => 32; for TIMx_SMCR use record Reserved0 at 0 range 26 .. 31; SMS_Preload_Source at 0 range 25 .. 25; SMS_Preload_Enable at 0 range 24 .. 24; Reserved1 at 0 range 22 .. 23; Trigger_Selection_1 at 0 range 20 .. 21; Reserved2 at 0 range 17 .. 19; Slave_Mode_Selection_2 at 0 range 16 .. 16; External_Trigger_Polarity at 0 range 15 .. 15; External_Clock_Enable at 0 range 14 .. 14; External_Trigger_Prescaler at 0 range 12 .. 13; External_Trigger_Filter at 0 range 8 .. 11; Master_Slave_Mode at 0 range 7 .. 7; Trigger_Selection at 0 range 4 .. 6; OCREF_Clear_Selection at 0 range 3 .. 3; Slave_Mode_Selection at 0 range 0 .. 2; end record; ------------ representation for CCMR1 and CCMR2 -------------------------- -- Per the ST Reference Manual, there are two words (registers) -- allocated within a timer to describe the capture-compare input/output -- configurations for the four channels. These are CCMR1 and CCMR2. Both -- currently only use the lower half of the word, with the upper half -- reserved. -- Each description is either that of a single input or a single output -- for the given channel. Both kinds of description require eight -- bits, therefore there are two channel descriptions in each word. -- Although both the input and output descriptions are the same size in -- terms of bits (eight bits each), they do not have the same logical fields. -- We use two distinct types to represent individual input and output -- descriptions. type Lower_Channel_Output_Descriptor is record OCxClear_Enable : Boolean; OCxMode : UInt3; OCxPreload_Enable : Boolean; OCxFast_Enable : Boolean; end record with Size => 6; for Lower_Channel_Output_Descriptor use record OCxClear_Enable at 0 range 5 .. 5; OCxMode at 0 range 2 .. 4; OCxPreload_Enable at 0 range 1 .. 1; OCxFast_Enable at 0 range 0 .. 0; end record; type Higher_Channel_Output_Descriptor is record OCxMode_3 : Boolean; end record with Size => 1; for Higher_Channel_Output_Descriptor use record OCxMode_3 at 0 range 0 .. 0; end record; type Lower_Channel_Input_Descriptor is record ICxFilter : Timer_Input_Capture_Filter; ICxPrescaler : Timer_Input_Capture_Prescaler; end record with Size => 6; for Lower_Channel_Input_Descriptor use record ICxFilter at 0 range 2 .. 5; ICxPrescaler at 0 range 0 .. 1; end record; -- So any given sixteen-bit description uses seven bits for the specific fields -- describing the input or output configuration. The other two bits are -- taken by a field selecting the kind of description, i.e., either an -- input or an output description. In the RM register definitions this -- is "CCxS" (where 'x' is a place-holder for a channel number). Although -- there is one kind of output, there are in fact three kinds of inputs. -- Thus any given channel description is a sixtenn-bit quantity that -- both indicates the kind and contains another set of dependent fields -- representing that kind. The dependent fields are logically mutually -- exclusive, i.e., if the CCxS selection field indicates an input then -- the output fields are not present, and vice versa. This logical layout -- is naturally represented in Ada as a discriminated type, where the -- discriminant is the CCxS "Selection" indicator. -- Note that the discriminant default value "Output" matches the default -- value of the hardware register bits when the device is powered up. -- Therefore we don't strictly speaking need pragma Import on the -- declarations of Timer objects, but it won't hurt. type Lower_IO_Descriptor (CCxSelection : Timer_Capture_Compare_Modes := Output) is record case CCxSelection is when Direct_TI .. TRC => Capture : Lower_Channel_Input_Descriptor; when Output => Compare_1 : Lower_Channel_Output_Descriptor; end case; end record with Size => 8; -- Per the RM, the input fields and the output fields are in the same -- locations in memory, that is, they overlay, coming after the common -- CCxS field. for Lower_IO_Descriptor use record Capture at 0 range 2 .. 7; Compare_1 at 0 range 2 .. 7; CCxSelection at 0 range 0 .. 1; end record; type Higher_IO_Descriptor (CCxSelection : Timer_Capture_Compare_Modes := Output) is record case CCxSelection is when Direct_TI .. TRC => Reserved : UInt6; when Output => Compare_2 : Higher_Channel_Output_Descriptor; end case; end record with Size => 8; for Higher_IO_Descriptor use record CCxSelection at 0 range 6 .. 7; Reserved at 0 range 0 .. 5; Compare_2 at 0 range 0 .. 0; end record; -- Thus we have a means of describing any single channel's configuration -- as either an input or an output. But how to get to them? As mentioned -- above, there are four channels so there are four I/O descriptions, -- spread across the two words of CCMR1 and CCMR2 in the timer -- representation. Specifically, the descriptions for channels 1 and 2 are -- in CCMR1, and the descriptions for channels 3 and 4 are in CCMR2. Rather -- than determine which register to use by having a dedicated routine -- for each channel, we use an array of descriptions allocated across the -- memory for the two registers and compute the description to use within -- the array for that channel. -- -- The remaining difficulty is the reserved upper halves of each of the -- two registers in memory. We cannot simply allocate four components in -- our array because we must skip the reserved areas, but we don't have -- non-contiguous arrays in Ada (nor should we). As a result we must -- either declare two arrays, each with two descriptions, thus requiring -- additional types to specify the reserved areas, or we declare one -- array of eight descriptions and only access the four "real" ones. If we -- take the latter approach the other four descriptions would occupy the -- reserved areas and would never be accessed. As long as the reserved -- areas remain at their reset values (all zeroes) all should be well... -- except that we also have the requirement to access the memory for the -- two registers as either half-words or words, so any simplicity gained -- from declaring an array larger than required would be lost when -- processing it. Hence the following takes the first approach, not -- mapping anything to the reserved upper halves of the two words. subtype Half_Index is Integer range 1 .. 2; -- Register CCMRx from bits 0 - 7 and 16 - 23 or -- from bits 8 - 15 and 24 - 31 type TIMx_CCMRx_Lower_Half is array (Half_Index) of Lower_IO_Descriptor with Volatile_Components, Component_Size => 8, Size => 16; type TIMx_CCMRx_Higher_Half is array (Half_Index) of Higher_IO_Descriptor with Volatile_Components, Component_Size => 8, Size => 16; type TIMx_CCMRx is record High_Descriptors : TIMx_CCMRx_Higher_Half; Low_Descriptors : TIMx_CCMRx_Lower_Half; end record with Volatile_Full_Access, Size => 32; for TIMx_CCMRx use record High_Descriptors at 0 range 16 .. 31; Low_Descriptors at 0 range 0 .. 15; end record; -- Then we can define the array of this final record type TIMx_CCMRx, -- taking the space of the two CCMR1 and CCMR2 register words in memory. subtype CCMRx_Index is Integer range 1 .. 3; -- Is this better than using bit masks? There's certainly a good bit more -- required for the declarations of the data structure! But the access code -- is pretty small and we would argue that the compile-time checking, and -- the readability, imply greater robustness and maintainability. (That -- said, the existing C libraries are very stable and mature.) This part -- of the hardware is definitely complicated in itself, and overlaying the -- input and output descriptions in memory didn't help. Performance should -- be reasonable, although not as good as bit-masking would be. Nowadays -- that's not necessarily where the money is, so we go with this approach -- for now... procedure Write_Channel_Input_Description (This : in out Timer; Channel : Timer_Channel; Kind : Timer_Input_Capture_Selection; Description : Lower_Channel_Input_Descriptor) with Pre => not Channel_Enabled (This, Channel); ------------ representation for the CCER --------------------------------- -- The CCER register is composed of a logical grouping of four sets of -- bits, one per channel. The type Single_CCE describe these four bits. -- Channels 1 through 4 have all four bits, channels 5 and 6 don't have the -- complementary enable and polarity bits. We pretend that it does for -- the type declaration and then treat it accordingly in the accessing -- subprograms. type Single_CCE is record CCxE : Timer_Capture_Compare_State; CCxP : Bit; CCxNE : Timer_Capture_Compare_State; CCxNP : Bit; end record with Size => 4; for Single_CCE use record CCxE at 0 range 0 .. 0; CCxP at 0 range 1 .. 1; CCxNE at 0 range 2 .. 2; CCxNP at 0 range 3 .. 3; end record; type TIMx_CCER is array (Timer_Channel'Range) of Single_CCE with Volatile_Full_Access, Component_Size => 4, Size => 24; -------- representation for CCR1 through CCR4 ---------------------------- -- Instead of declaring four individual record components, one per channel, -- each one a word in size, we just declare an array component representing -- all four values, indexed by the channel. Timers 2 and 5 actually use all -- 32 bits of each, the other timers only use the lower half. type Capture_Compare_Registers is array (Channel_1 .. Channel_4) of UInt32 with Volatile_Components, Component_Size => 32, Size => 128; ---------- representation for the Break and Dead Time Register - ---------- type TIMx_BDTR is record Reserved : UInt2; Break_2_Bidirectional : Boolean; Break_Bidirectional : Boolean; Break_2_Disarm : Boolean; Break_Disarm : Boolean; Break_2_Polarity : Timer_Break_Polarity; Break_2_Enable : Boolean; Break_2_Filter : Timer_Break_Filter; Break_Filter : Timer_Break_Filter; Main_Output_Enabled : Boolean; Automatic_Output_Enabled : Boolean; Break_Polarity : Timer_Break_Polarity; Break_Enable : Boolean; Off_State_Selection_Run_Mode : Bit; Off_State_Selection_Idle_Mode : Bit; Lock : Timer_Lock_Level; Deadtime_Generator : UInt8; end record with Volatile_Full_Access, Size => 32; for TIMx_BDTR use record Reserved at 0 range 30 .. 31; Break_2_Bidirectional at 0 range 29 .. 29; Break_Bidirectional at 0 range 28 .. 28; Break_2_Disarm at 0 range 27 .. 27; Break_Disarm at 0 range 26 .. 26; Break_2_Polarity at 0 range 25 .. 25; Break_2_Enable at 0 range 24 .. 24; Break_2_Filter at 0 range 20 .. 23; Break_Filter at 0 range 16 .. 19; Main_Output_Enabled at 0 range 15 .. 15; Automatic_Output_Enabled at 0 range 14 .. 14; Break_Polarity at 0 range 13 .. 13; Break_Enable at 0 range 12 .. 12; Off_State_Selection_Run_Mode at 0 range 11 .. 11; Off_State_Selection_Idle_Mode at 0 range 10 .. 10; Lock at 0 range 8 .. 9; Deadtime_Generator at 0 range 0 .. 7; end record; ----------- representation for the DMA Control Register type ------------- type TIMx_DCR is record Reserved0 : UInt16; Reserved1 : UInt3; Burst_Length : Timer_DMA_Burst_Length; Reserved2 : UInt3; Base_Address : Timer_DMA_Base_Address; end record with Volatile_Full_Access, Size => 32; for TIMx_DCR use record Reserved0 at 0 range 16 .. 31; Reserved1 at 0 range 13 .. 15; Burst_Length at 0 range 8 .. 12; Reserved2 at 0 range 5 .. 7; Base_Address at 0 range 0 .. 4; end record; ---------------- representation for the whole Timer type ----------------- type Timer is limited record CR1 : TIMx_CR1; CR2 : TIMx_CR2; SMCR : TIMx_SMCR; DIER : UInt32; SR : UInt32; EGR : UInt32; CCMR1 : TIMx_CCMRx; CCMR2 : TIMx_CCMRx; CCER : TIMx_CCER; Counter : UInt32 with Atomic; -- a full word for timer 2 Prescaler : UInt16; Reserved_Prescaler : UInt16; ARR : UInt32; RCR : UInt32; CCR1_4 : Capture_Compare_Registers; BDTR : TIMx_BDTR; CCR5 : UInt32; CCR6 : UInt32; CCMR3 : TIMx_CCMRx; DTR2 : UInt32; ECR : UInt32; TISEL : UInt32; AF1 : UInt32; AF2 : UInt32; DCR : TIMx_DCR; DMAR : UInt32; end record with Volatile, Size => 249 * 32; for Timer use record CR1 at 16#000# range 0 .. 31; CR2 at 16#004# range 0 .. 31; SMCR at 16#008# range 0 .. 31; DIER at 16#00C# range 0 .. 31; SR at 16#010# range 0 .. 31; EGR at 16#014# range 0 .. 31; CCMR1 at 16#018# range 0 .. 31; CCMR2 at 16#01C# range 0 .. 31; CCER at 16#020# range 0 .. 31; Counter at 16#024# range 0 .. 31; Prescaler at 16#028# range 0 .. 15; Reserved_Prescaler at 16#028# range 16 .. 31; ARR at 16#02C# range 0 .. 31; RCR at 16#030# range 0 .. 31; CCR1_4 at 16#034# range 0 .. 127; -- ie, 4 words BDTR at 16#044# range 0 .. 31; CCR5 at 16#048# range 0 .. 31; CCR6 at 16#04C# range 0 .. 31; CCMR3 at 16#050# range 0 .. 31; DTR2 at 16#054# range 0 .. 31; ECR at 16#058# range 0 .. 31; TISEL at 16#05C# range 0 .. 31; AF1 at 16#060# range 0 .. 31; AF2 at 16#064# range 0 .. 31; DCR at 16#3DC# range 0 .. 31; DMAR at 16#3E0# range 0 .. 31; end record; end STM32.Timers;
------------------------------------------------------------------------------ -- -- -- Matreshka Project -- -- -- -- Web Framework -- -- -- -- Runtime Library Component -- -- -- ------------------------------------------------------------------------------ -- -- -- Copyright © 2020, Vadim Godunko <vgodunko@gmail.com> -- -- All rights reserved. -- -- -- -- Redistribution and use in source and binary forms, with or without -- -- modification, are permitted provided that the following conditions -- -- are met: -- -- -- -- * Redistributions of source code must retain the above copyright -- -- notice, this list of conditions and the following disclaimer. -- -- -- -- * Redistributions in binary form must reproduce the above copyright -- -- notice, this list of conditions and the following disclaimer in the -- -- documentation and/or other materials provided with the distribution. -- -- -- -- * Neither the name of the Vadim Godunko, IE nor the names of its -- -- contributors may be used to endorse or promote products derived from -- -- this software without specific prior written permission. -- -- -- -- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -- -- "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -- -- LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -- -- A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -- -- HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -- -- SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED -- -- TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -- -- PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -- -- LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -- -- NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -- -- SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -- -- -- ------------------------------------------------------------------------------ -- $Revision: 5744 $ $Date: 2017-01-29 12:24:34 +0300 (Sun, 29 Jan 2017) $ ------------------------------------------------------------------------------ with Web.UI.Widgets.Buttons.Pushs; package Web.UI.Push_Buttons renames Web.UI.Widgets.Buttons.Pushs;
------------------------------------------------------------------------------ -- -- -- GNAT RUN-TIME COMPONENTS -- -- -- -- S Y S T E M -- -- -- -- S p e c -- -- (SUN Solaris Version) -- -- -- -- Copyright (C) 1992-2016, Free Software Foundation, Inc. -- -- -- -- This specification is derived from the Ada Reference Manual for use with -- -- GNAT. The copyright notice above, and the license provisions that follow -- -- apply solely to the contents of the part following the private keyword. -- -- -- -- GNAT is free software; you can redistribute it and/or modify it under -- -- terms of the GNU General Public License as published by the Free Soft- -- -- ware Foundation; either version 3, or (at your option) any later ver- -- -- sion. GNAT is distributed in the hope that it will be useful, but WITH- -- -- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY -- -- or FITNESS FOR A PARTICULAR PURPOSE. -- -- -- -- As a special exception under Section 7 of GPL version 3, you are granted -- -- additional permissions described in the GCC Runtime Library Exception, -- -- version 3.1, as published by the Free Software Foundation. -- -- -- -- You should have received a copy of the GNU General Public License and -- -- a copy of the GCC Runtime Library Exception along with this program; -- -- see the files COPYING3 and COPYING.RUNTIME respectively. If not, see -- -- <http://www.gnu.org/licenses/>. -- -- -- -- GNAT was originally developed by the GNAT team at New York University. -- -- Extensive contributions were provided by Ada Core Technologies Inc. -- -- -- ------------------------------------------------------------------------------ package System is pragma Pure; -- Note that we take advantage of the implementation permission to make -- this unit Pure instead of Preelaborable; see RM 13.7.1(15). In Ada -- 2005, this is Pure in any case (AI-362). pragma No_Elaboration_Code_All; -- Allow the use of that restriction in units that WITH this unit type Name is (SYSTEM_NAME_GNAT); System_Name : constant Name := SYSTEM_NAME_GNAT; -- System-Dependent Named Numbers Min_Int : constant := Long_Long_Integer'First; Max_Int : constant := Long_Long_Integer'Last; Max_Binary_Modulus : constant := 2 ** Long_Long_Integer'Size; Max_Nonbinary_Modulus : constant := 2 ** Integer'Size - 1; Max_Base_Digits : constant := Long_Long_Float'Digits; Max_Digits : constant := Long_Long_Float'Digits; Max_Mantissa : constant := 63; Fine_Delta : constant := 2.0 ** (-Max_Mantissa); Tick : constant := 0.01; -- Storage-related Declarations type Address is private; pragma Preelaborable_Initialization (Address); Null_Address : constant Address; Storage_Unit : constant := 8; Word_Size : constant := Standard'Word_Size; Memory_Size : constant := 2 ** Word_Size; -- Address comparison function "<" (Left, Right : Address) return Boolean; function "<=" (Left, Right : Address) return Boolean; function ">" (Left, Right : Address) return Boolean; function ">=" (Left, Right : Address) return Boolean; function "=" (Left, Right : Address) return Boolean; pragma Import (Intrinsic, "<"); pragma Import (Intrinsic, "<="); pragma Import (Intrinsic, ">"); pragma Import (Intrinsic, ">="); pragma Import (Intrinsic, "="); -- Other System-Dependent Declarations type Bit_Order is (High_Order_First, Low_Order_First); Default_Bit_Order : constant Bit_Order := High_Order_First; pragma Warnings (Off, Default_Bit_Order); -- kill constant condition warning -- Priority-related Declarations (RM D.1) Max_Priority : constant Positive := 30; Max_Interrupt_Priority : constant Positive := 31; subtype Any_Priority is Integer range 0 .. 31; subtype Priority is Any_Priority range 0 .. 30; subtype Interrupt_Priority is Any_Priority range 31 .. 31; Default_Priority : constant Priority := 15; private type Address is mod Memory_Size; Null_Address : constant Address := 0; -------------------------------------- -- System Implementation Parameters -- -------------------------------------- -- These parameters provide information about the target that is used -- by the compiler. They are in the private part of System, where they -- can be accessed using the special circuitry in the Targparm unit -- whose source should be consulted for more detailed descriptions -- of the individual switch values. Backend_Divide_Checks : constant Boolean := False; Backend_Overflow_Checks : constant Boolean := True; Command_Line_Args : constant Boolean := True; Configurable_Run_Time : constant Boolean := False; Denorm : constant Boolean := True; Duration_32_Bits : constant Boolean := False; Exit_Status_Supported : constant Boolean := True; Fractional_Fixed_Ops : constant Boolean := False; Frontend_Layout : constant Boolean := False; Machine_Overflows : constant Boolean := False; Machine_Rounds : constant Boolean := True; Preallocated_Stacks : constant Boolean := False; Signed_Zeros : constant Boolean := True; Stack_Check_Default : constant Boolean := False; Stack_Check_Probes : constant Boolean := True; Stack_Check_Limits : constant Boolean := False; Support_Aggregates : constant Boolean := True; Support_Atomic_Primitives : constant Boolean := True; Support_Composite_Assign : constant Boolean := True; Support_Composite_Compare : constant Boolean := True; Support_Long_Shifts : constant Boolean := True; Always_Compatible_Rep : constant Boolean := False; Suppress_Standard_Library : constant Boolean := False; Use_Ada_Main_Program_Name : constant Boolean := False; Frontend_Exceptions : constant Boolean := False; ZCX_By_Default : constant Boolean := True; end System;
-- SPDX-FileCopyrightText: 2019 Max Reznik <reznikmm@gmail.com> -- -- SPDX-License-Identifier: MIT ------------------------------------------------------------- with Program.Nodes.Generic_Vectors; with Program.Elements.Case_Expression_Paths; package Program.Nodes.Case_Expression_Path_Vectors is new Program.Nodes.Generic_Vectors (Program.Elements.Case_Expression_Paths .Case_Expression_Path_Vector); pragma Preelaborate (Program.Nodes.Case_Expression_Path_Vectors);
with openGL.FontImpl.texture, ada.unchecked_Deallocation; package body openGL.Font.texture is --------- -- Forge -- function to_Font_texture (fontFilePath : in String) return Font.texture.item is begin return Self : Font.texture.item do Self.define (fontImpl.texture.new_FontImpl_texture (Self'Access, fontFilePath)); end return; end to_Font_texture; function new_Font_texture (fontFilePath : in String) return Font.texture.view is Self : constant Font.texture.view := new Font.texture.item; begin Self.define (fontImpl.Texture.new_FontImpl_texture (Self, fontFilePath)); return Self; end new_Font_texture; function to_Font_texture (pBufferBytes : in FontImpl.unsigned_char_Pointer; bufferSizeInBytes : in Natural) return Font.texture.item is begin return Self : Font.texture.item do Self.define (fontImpl.Texture.new_FontImpl_texture (Self'Access, pBufferBytes, bufferSizeInBytes)); end return; end to_Font_texture; overriding procedure destruct (Self : in out Item) is begin destruct (openGL.Font.item (Self)); -- Destroy base class. end destruct; procedure free (Self : in out View) is procedure deallocate is new ada.unchecked_Deallocation (Item'Class, View); begin Self.destruct; deallocate (Self); end free; -------------- -- Attributes -- function gl_Texture (Self : in Item) return openGL.Texture.texture_Name is begin return fontImpl.texture.view (Self.Impl).gl_Texture; end gl_Texture; function Quad (Self : in Item; for_Character : in Character) return GlyphImpl.Texture.Quad_t is begin return fontImpl.texture.view (Self.Impl).Quad (for_Character); end Quad; -------------- -- Operations -- overriding function MakeGlyph (Self : access Item; Slot : in freetype_c.FT_GlyphSlot.item) return glyph.Container.Glyph_view is type FontImpl_texture_view is access all FontImpl.texture.Item'Class; myimpl : constant FontImpl_texture_view := FontImpl_texture_view (Self.impl); begin if myimpl = null then return null; end if; return myimpl.MakeGlyphImpl (Slot); end MakeGlyph; end openGL.Font.texture;
-- POK header -- -- The following file is a part of the POK project. Any modification should -- be made according to the POK licence. You CANNOT use this file or a part -- of a file for your own project. -- -- For more information on the POK licence, please see our LICENCE FILE -- -- Please follow the coding guidelines described in doc/CODING_GUIDELINES -- -- Copyright (c) 2007-2021 POK team -- --------------------------------------------------------------------------- -- -- -- PROCESS constant and type definitions and management services -- -- -- -- --------------------------------------------------------------------------- package APEX.Processes is Max_Number_Of_Processes : constant := System_Limit_Number_Of_Processes; Min_Priority_Value : constant := 0; Max_Priority_Value : constant := 249; Max_Lock_Level : constant := 32; subtype Process_Name_Type is Name_Type; type Process_Id_Type is private; Null_Process_Id : constant Process_Id_Type; subtype Lock_Level_Type is APEX_Integer range 0 .. Max_Lock_Level; subtype Stack_Size_Type is APEX_Unsigned; subtype Waiting_Range_Type is APEX_Integer range 0 .. Max_Number_Of_Processes; subtype Priority_Type is APEX_Integer range Min_Priority_Value .. Max_Priority_Value; type Process_State_Type is (Dormant, Ready, Running, Waiting); type Deadline_Type is (Soft, Hard); type Process_Attribute_Type is record Period : System_Time_Type; Time_Capacity : System_Time_Type; Entry_Point : System_Address_Type; Stack_Size : Stack_Size_Type; Base_Priority : Priority_Type; Deadline : Deadline_Type; Name : Process_Name_Type; end record; type Process_Status_Type is record Deadline_Time : System_Time_Type; Current_Priority : Priority_Type; Process_State : Process_State_Type; Attributes : Process_Attribute_Type; end record; procedure Create_Process (Attributes : in Process_Attribute_Type; Process_Id : out Process_Id_Type; Return_Code : out Return_Code_Type); procedure Set_Priority (Process_Id : in Process_Id_Type; Priority : in Priority_Type; Return_Code : out Return_Code_Type); procedure Suspend_Self (Time_Out : in System_Time_Type; Return_Code : out Return_Code_Type); procedure Suspend (Process_Id : in Process_Id_Type; Return_Code : out Return_Code_Type); procedure Resume (Process_Id : in Process_Id_Type; Return_Code : out Return_Code_Type); procedure Stop_Self; procedure Stop (Process_Id : in Process_Id_Type; Return_Code : out Return_Code_Type); procedure Start (Process_Id : in Process_Id_Type; Return_Code : out Return_Code_Type); procedure Delayed_Start (Process_Id : in Process_Id_Type; Delay_Time : in System_Time_Type; Return_Code : out Return_Code_Type); procedure Lock_Preemption (Lock_Level : out Lock_Level_Type; Return_Code : out Return_Code_Type); procedure Unlock_Preemption (Lock_Level : out Lock_Level_Type; Return_Code : out Return_Code_Type); procedure Get_My_Id (Process_Id : out Process_Id_Type; Return_Code : out Return_Code_Type); procedure Get_Process_Id (Process_Name : in Process_Name_Type; Process_Id : out Process_Id_Type; Return_Code : out Return_Code_Type); procedure Get_Process_Status (Process_Id : in Process_Id_Type; Process_Status : out Process_Status_Type; Return_Code : out Return_Code_Type); private type Process_ID_Type is new APEX_Integer; Null_Process_Id : constant Process_Id_Type := 0; pragma Convention (C, Process_State_Type); pragma Convention (C, Deadline_Type); pragma Convention (C, Process_Attribute_Type); pragma Convention (C, Process_Status_Type); -- POK BINDINGS pragma Import (C, Create_Process, "CREATE_PROCESS"); pragma Import (C, Set_Priority, "SET_PRIORITY"); pragma Import (C, Suspend_Self, "SUSPEND_SELF"); pragma Import (C, Suspend, "SUSPEND"); pragma Import (C, Resume, "SUSPEND"); pragma Import (C, Stop_Self, "STOP_SELF"); pragma Import (C, Stop, "STOP"); pragma Import (C, Start, "START"); pragma Import (C, Delayed_Start, "DELAYED_START"); pragma Import (C, Lock_Preemption, "LOCK_PREEMPTION"); pragma Import (C, Unlock_Preemption, "UNLOCK_PREEMPTION"); pragma Import (C, Get_My_Id, "GET_MY_ID"); pragma Import (C, Get_Process_Id, "GET_PROCESS_ID"); pragma Import (C, Get_Process_Status, "GET_PROCESS_STATUS"); -- END OF POK BINDINGS end APEX.Processes;
----------------------------------------------------------------------- -- schemas Tests -- Test loading of database schema for MySQL -- Copyright (C) 2009, 2010, 2011 Stephane Carrez -- Written by Stephane Carrez (Stephane.Carrez@gmail.com) -- -- Licensed under the Apache License, Version 2.0 (the "License"); -- you may not use this file except in compliance with the License. -- You may obtain a copy of the License at -- -- http://www.apache.org/licenses/LICENSE-2.0 -- -- Unless required by applicable law or agreed to in writing, software -- distributed under the License is distributed on an "AS IS" BASIS, -- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -- See the License for the specific language governing permissions and -- limitations under the License. ----------------------------------------------------------------------- with Util.Tests; package ADO.Schemas.Mysql.Tests is procedure Add_Tests (Suite : in Util.Tests.Access_Test_Suite); type Test is new Util.Tests.Test with null record; procedure Test_Load_Schema (T : in out Test); end ADO.Schemas.Mysql.Tests;
------------------------------------------------------------------------------ -- -- -- GNAT RUN-TIME COMPONENTS -- -- -- -- S Y S T E M . S T R E A M _ A T T R I B U T E S -- -- -- -- B o d y -- -- -- -- Copyright (C) 1992-2009, Free Software Foundation, Inc. -- -- -- -- GNAT is free software; you can redistribute it and/or modify it under -- -- terms of the GNU General Public License as published by the Free Soft- -- -- ware Foundation; either version 3, or (at your option) any later ver- -- -- sion. GNAT is distributed in the hope that it will be useful, but WITH- -- -- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY -- -- or FITNESS FOR A PARTICULAR PURPOSE. -- -- -- -- As a special exception under Section 7 of GPL version 3, you are granted -- -- additional permissions described in the GCC Runtime Library Exception, -- -- version 3.1, as published by the Free Software Foundation. -- -- -- -- You should have received a copy of the GNU General Public License and -- -- a copy of the GCC Runtime Library Exception along with this program; -- -- see the files COPYING3 and COPYING.RUNTIME respectively. If not, see -- -- <http://www.gnu.org/licenses/>. -- -- -- -- GNAT was originally developed by the GNAT team at New York University. -- -- Extensive contributions were provided by Ada Core Technologies Inc. -- -- -- ------------------------------------------------------------------------------ with Ada.IO_Exceptions; with Ada.Streams; use Ada.Streams; with Ada.Unchecked_Conversion; package body System.Stream_Attributes is Err : exception renames Ada.IO_Exceptions.End_Error; -- Exception raised if insufficient data read (note that the RM implies -- that Data_Error might be the appropriate choice, but AI95-00132 -- decides with a binding interpretation that End_Error is preferred). SU : constant := System.Storage_Unit; subtype SEA is Ada.Streams.Stream_Element_Array; subtype SEO is Ada.Streams.Stream_Element_Offset; generic function UC renames Ada.Unchecked_Conversion; -- Subtypes used to define Stream_Element_Array values that map -- into the elementary types, using unchecked conversion. Thin_Pointer_Size : constant := System.Address'Size; Fat_Pointer_Size : constant := System.Address'Size * 2; subtype S_AD is SEA (1 .. (Fat_Pointer_Size + SU - 1) / SU); subtype S_AS is SEA (1 .. (Thin_Pointer_Size + SU - 1) / SU); subtype S_B is SEA (1 .. (Boolean'Size + SU - 1) / SU); subtype S_C is SEA (1 .. (Character'Size + SU - 1) / SU); subtype S_F is SEA (1 .. (Float'Size + SU - 1) / SU); subtype S_I is SEA (1 .. (Integer'Size + SU - 1) / SU); subtype S_LF is SEA (1 .. (Long_Float'Size + SU - 1) / SU); subtype S_LI is SEA (1 .. (Long_Integer'Size + SU - 1) / SU); subtype S_LLF is SEA (1 .. (Long_Long_Float'Size + SU - 1) / SU); subtype S_LLI is SEA (1 .. (Long_Long_Integer'Size + SU - 1) / SU); subtype S_LLU is SEA (1 .. (UST.Long_Long_Unsigned'Size + SU - 1) / SU); subtype S_LU is SEA (1 .. (UST.Long_Unsigned'Size + SU - 1) / SU); subtype S_SF is SEA (1 .. (Short_Float'Size + SU - 1) / SU); subtype S_SI is SEA (1 .. (Short_Integer'Size + SU - 1) / SU); subtype S_SSI is SEA (1 .. (Short_Short_Integer'Size + SU - 1) / SU); subtype S_SSU is SEA (1 .. (UST.Short_Short_Unsigned'Size + SU - 1) / SU); subtype S_SU is SEA (1 .. (UST.Short_Unsigned'Size + SU - 1) / SU); subtype S_U is SEA (1 .. (UST.Unsigned'Size + SU - 1) / SU); subtype S_WC is SEA (1 .. (Wide_Character'Size + SU - 1) / SU); subtype S_WWC is SEA (1 .. (Wide_Wide_Character'Size + SU - 1) / SU); -- Unchecked conversions from the elementary type to the stream type function From_AD is new UC (Fat_Pointer, S_AD); function From_AS is new UC (Thin_Pointer, S_AS); function From_F is new UC (Float, S_F); function From_I is new UC (Integer, S_I); function From_LF is new UC (Long_Float, S_LF); function From_LI is new UC (Long_Integer, S_LI); function From_LLF is new UC (Long_Long_Float, S_LLF); function From_LLI is new UC (Long_Long_Integer, S_LLI); function From_LLU is new UC (UST.Long_Long_Unsigned, S_LLU); function From_LU is new UC (UST.Long_Unsigned, S_LU); function From_SF is new UC (Short_Float, S_SF); function From_SI is new UC (Short_Integer, S_SI); function From_SSI is new UC (Short_Short_Integer, S_SSI); function From_SSU is new UC (UST.Short_Short_Unsigned, S_SSU); function From_SU is new UC (UST.Short_Unsigned, S_SU); function From_U is new UC (UST.Unsigned, S_U); function From_WC is new UC (Wide_Character, S_WC); function From_WWC is new UC (Wide_Wide_Character, S_WWC); -- Unchecked conversions from the stream type to elementary type function To_AD is new UC (S_AD, Fat_Pointer); function To_AS is new UC (S_AS, Thin_Pointer); function To_F is new UC (S_F, Float); function To_I is new UC (S_I, Integer); function To_LF is new UC (S_LF, Long_Float); function To_LI is new UC (S_LI, Long_Integer); function To_LLF is new UC (S_LLF, Long_Long_Float); function To_LLI is new UC (S_LLI, Long_Long_Integer); function To_LLU is new UC (S_LLU, UST.Long_Long_Unsigned); function To_LU is new UC (S_LU, UST.Long_Unsigned); function To_SF is new UC (S_SF, Short_Float); function To_SI is new UC (S_SI, Short_Integer); function To_SSI is new UC (S_SSI, Short_Short_Integer); function To_SSU is new UC (S_SSU, UST.Short_Short_Unsigned); function To_SU is new UC (S_SU, UST.Short_Unsigned); function To_U is new UC (S_U, UST.Unsigned); function To_WC is new UC (S_WC, Wide_Character); function To_WWC is new UC (S_WWC, Wide_Wide_Character); ----------------- -- Block_IO_OK -- ----------------- function Block_IO_OK return Boolean is begin return True; end Block_IO_OK; ---------- -- I_AD -- ---------- function I_AD (Stream : not null access RST) return Fat_Pointer is T : S_AD; L : SEO; begin Ada.Streams.Read (Stream.all, T, L); if L < T'Last then raise Err; else return To_AD (T); end if; end I_AD; ---------- -- I_AS -- ---------- function I_AS (Stream : not null access RST) return Thin_Pointer is T : S_AS; L : SEO; begin Ada.Streams.Read (Stream.all, T, L); if L < T'Last then raise Err; else return To_AS (T); end if; end I_AS; --------- -- I_B -- --------- function I_B (Stream : not null access RST) return Boolean is T : S_B; L : SEO; begin Ada.Streams.Read (Stream.all, T, L); if L < T'Last then raise Err; else return Boolean'Val (T (1)); end if; end I_B; --------- -- I_C -- --------- function I_C (Stream : not null access RST) return Character is T : S_C; L : SEO; begin Ada.Streams.Read (Stream.all, T, L); if L < T'Last then raise Err; else return Character'Val (T (1)); end if; end I_C; --------- -- I_F -- --------- function I_F (Stream : not null access RST) return Float is T : S_F; L : SEO; begin Ada.Streams.Read (Stream.all, T, L); if L < T'Last then raise Err; else return To_F (T); end if; end I_F; --------- -- I_I -- --------- function I_I (Stream : not null access RST) return Integer is T : S_I; L : SEO; begin Ada.Streams.Read (Stream.all, T, L); if L < T'Last then raise Err; else return To_I (T); end if; end I_I; ---------- -- I_LF -- ---------- function I_LF (Stream : not null access RST) return Long_Float is T : S_LF; L : SEO; begin Ada.Streams.Read (Stream.all, T, L); if L < T'Last then raise Err; else return To_LF (T); end if; end I_LF; ---------- -- I_LI -- ---------- function I_LI (Stream : not null access RST) return Long_Integer is T : S_LI; L : SEO; begin Ada.Streams.Read (Stream.all, T, L); if L < T'Last then raise Err; else return To_LI (T); end if; end I_LI; ----------- -- I_LLF -- ----------- function I_LLF (Stream : not null access RST) return Long_Long_Float is T : S_LLF; L : SEO; begin Ada.Streams.Read (Stream.all, T, L); if L < T'Last then raise Err; else return To_LLF (T); end if; end I_LLF; ----------- -- I_LLI -- ----------- function I_LLI (Stream : not null access RST) return Long_Long_Integer is T : S_LLI; L : SEO; begin Ada.Streams.Read (Stream.all, T, L); if L < T'Last then raise Err; else return To_LLI (T); end if; end I_LLI; ----------- -- I_LLU -- ----------- function I_LLU (Stream : not null access RST) return UST.Long_Long_Unsigned is T : S_LLU; L : SEO; begin Ada.Streams.Read (Stream.all, T, L); if L < T'Last then raise Err; else return To_LLU (T); end if; end I_LLU; ---------- -- I_LU -- ---------- function I_LU (Stream : not null access RST) return UST.Long_Unsigned is T : S_LU; L : SEO; begin Ada.Streams.Read (Stream.all, T, L); if L < T'Last then raise Err; else return To_LU (T); end if; end I_LU; ---------- -- I_SF -- ---------- function I_SF (Stream : not null access RST) return Short_Float is T : S_SF; L : SEO; begin Ada.Streams.Read (Stream.all, T, L); if L < T'Last then raise Err; else return To_SF (T); end if; end I_SF; ---------- -- I_SI -- ---------- function I_SI (Stream : not null access RST) return Short_Integer is T : S_SI; L : SEO; begin Ada.Streams.Read (Stream.all, T, L); if L < T'Last then raise Err; else return To_SI (T); end if; end I_SI; ----------- -- I_SSI -- ----------- function I_SSI (Stream : not null access RST) return Short_Short_Integer is T : S_SSI; L : SEO; begin Ada.Streams.Read (Stream.all, T, L); if L < T'Last then raise Err; else return To_SSI (T); end if; end I_SSI; ----------- -- I_SSU -- ----------- function I_SSU (Stream : not null access RST) return UST.Short_Short_Unsigned is T : S_SSU; L : SEO; begin Ada.Streams.Read (Stream.all, T, L); if L < T'Last then raise Err; else return To_SSU (T); end if; end I_SSU; ---------- -- I_SU -- ---------- function I_SU (Stream : not null access RST) return UST.Short_Unsigned is T : S_SU; L : SEO; begin Ada.Streams.Read (Stream.all, T, L); if L < T'Last then raise Err; else return To_SU (T); end if; end I_SU; --------- -- I_U -- --------- function I_U (Stream : not null access RST) return UST.Unsigned is T : S_U; L : SEO; begin Ada.Streams.Read (Stream.all, T, L); if L < T'Last then raise Err; else return To_U (T); end if; end I_U; ---------- -- I_WC -- ---------- function I_WC (Stream : not null access RST) return Wide_Character is T : S_WC; L : SEO; begin Ada.Streams.Read (Stream.all, T, L); if L < T'Last then raise Err; else return To_WC (T); end if; end I_WC; ----------- -- I_WWC -- ----------- function I_WWC (Stream : not null access RST) return Wide_Wide_Character is T : S_WWC; L : SEO; begin Ada.Streams.Read (Stream.all, T, L); if L < T'Last then raise Err; else return To_WWC (T); end if; end I_WWC; ---------- -- W_AD -- ---------- procedure W_AD (Stream : not null access RST; Item : Fat_Pointer) is T : constant S_AD := From_AD (Item); begin Ada.Streams.Write (Stream.all, T); end W_AD; ---------- -- W_AS -- ---------- procedure W_AS (Stream : not null access RST; Item : Thin_Pointer) is T : constant S_AS := From_AS (Item); begin Ada.Streams.Write (Stream.all, T); end W_AS; --------- -- W_B -- --------- procedure W_B (Stream : not null access RST; Item : Boolean) is T : S_B; begin T (1) := Boolean'Pos (Item); Ada.Streams.Write (Stream.all, T); end W_B; --------- -- W_C -- --------- procedure W_C (Stream : not null access RST; Item : Character) is T : S_C; begin T (1) := Character'Pos (Item); Ada.Streams.Write (Stream.all, T); end W_C; --------- -- W_F -- --------- procedure W_F (Stream : not null access RST; Item : Float) is T : constant S_F := From_F (Item); begin Ada.Streams.Write (Stream.all, T); end W_F; --------- -- W_I -- --------- procedure W_I (Stream : not null access RST; Item : Integer) is T : constant S_I := From_I (Item); begin Ada.Streams.Write (Stream.all, T); end W_I; ---------- -- W_LF -- ---------- procedure W_LF (Stream : not null access RST; Item : Long_Float) is T : constant S_LF := From_LF (Item); begin Ada.Streams.Write (Stream.all, T); end W_LF; ---------- -- W_LI -- ---------- procedure W_LI (Stream : not null access RST; Item : Long_Integer) is T : constant S_LI := From_LI (Item); begin Ada.Streams.Write (Stream.all, T); end W_LI; ----------- -- W_LLF -- ----------- procedure W_LLF (Stream : not null access RST; Item : Long_Long_Float) is T : constant S_LLF := From_LLF (Item); begin Ada.Streams.Write (Stream.all, T); end W_LLF; ----------- -- W_LLI -- ----------- procedure W_LLI (Stream : not null access RST; Item : Long_Long_Integer) is T : constant S_LLI := From_LLI (Item); begin Ada.Streams.Write (Stream.all, T); end W_LLI; ----------- -- W_LLU -- ----------- procedure W_LLU (Stream : not null access RST; Item : UST.Long_Long_Unsigned) is T : constant S_LLU := From_LLU (Item); begin Ada.Streams.Write (Stream.all, T); end W_LLU; ---------- -- W_LU -- ---------- procedure W_LU (Stream : not null access RST; Item : UST.Long_Unsigned) is T : constant S_LU := From_LU (Item); begin Ada.Streams.Write (Stream.all, T); end W_LU; ---------- -- W_SF -- ---------- procedure W_SF (Stream : not null access RST; Item : Short_Float) is T : constant S_SF := From_SF (Item); begin Ada.Streams.Write (Stream.all, T); end W_SF; ---------- -- W_SI -- ---------- procedure W_SI (Stream : not null access RST; Item : Short_Integer) is T : constant S_SI := From_SI (Item); begin Ada.Streams.Write (Stream.all, T); end W_SI; ----------- -- W_SSI -- ----------- procedure W_SSI (Stream : not null access RST; Item : Short_Short_Integer) is T : constant S_SSI := From_SSI (Item); begin Ada.Streams.Write (Stream.all, T); end W_SSI; ----------- -- W_SSU -- ----------- procedure W_SSU (Stream : not null access RST; Item : UST.Short_Short_Unsigned) is T : constant S_SSU := From_SSU (Item); begin Ada.Streams.Write (Stream.all, T); end W_SSU; ---------- -- W_SU -- ---------- procedure W_SU (Stream : not null access RST; Item : UST.Short_Unsigned) is T : constant S_SU := From_SU (Item); begin Ada.Streams.Write (Stream.all, T); end W_SU; --------- -- W_U -- --------- procedure W_U (Stream : not null access RST; Item : UST.Unsigned) is T : constant S_U := From_U (Item); begin Ada.Streams.Write (Stream.all, T); end W_U; ---------- -- W_WC -- ---------- procedure W_WC (Stream : not null access RST; Item : Wide_Character) is T : constant S_WC := From_WC (Item); begin Ada.Streams.Write (Stream.all, T); end W_WC; ----------- -- W_WWC -- ----------- procedure W_WWC (Stream : not null access RST; Item : Wide_Wide_Character) is T : constant S_WWC := From_WWC (Item); begin Ada.Streams.Write (Stream.all, T); end W_WWC; end System.Stream_Attributes;
------------------------------------------------------------------------------ -- -- -- Giza -- -- -- -- Copyright (C) 2016 Fabien Chouteau (chouteau@adacore.com) -- -- -- -- -- -- 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 Giza.Bitmaps.Indexed_4bits; package Giza.Image.Bitmap.Indexed_4bits is new Indexed_Bitmaps (Giza.Bitmaps.Indexed_4bits);
package FLTK.Widgets.Inputs.Secret is type Secret_Input is new Input with private; type Secret_Input_Reference (Data : not null access Secret_Input'Class) is limited null record with Implicit_Dereference => Data; package Forge is function Create (X, Y, W, H : in Integer; Text : in String) return Secret_Input; end Forge; procedure Draw (This : in out Secret_Input); function Handle (This : in out Secret_Input; Event : in Event_Kind) return Event_Outcome; private type Secret_Input is new Input with null record; overriding procedure Finalize (This : in out Secret_Input); pragma Inline (Draw); pragma Inline (Handle); end FLTK.Widgets.Inputs.Secret;
------------------------------------------------------------------------------ -- -- -- GNAT LIBRARY COMPONENTS -- -- -- -- A D A . C O N T A I N E R S . B O U N D E D _ H A S H E D _ S E T S -- -- -- -- B o d y -- -- -- -- Copyright (C) 2004-2019, Free Software Foundation, Inc. -- -- -- -- GNAT is free software; you can redistribute it and/or modify it under -- -- terms of the GNU General Public License as published by the Free Soft- -- -- ware Foundation; either version 3, or (at your option) any later ver- -- -- sion. GNAT is distributed in the hope that it will be useful, but WITH- -- -- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY -- -- or FITNESS FOR A PARTICULAR PURPOSE. -- -- -- -- As a special exception under Section 7 of GPL version 3, you are granted -- -- additional permissions described in the GCC Runtime Library Exception, -- -- version 3.1, as published by the Free Software Foundation. -- -- -- -- You should have received a copy of the GNU General Public License and -- -- a copy of the GCC Runtime Library Exception along with this program; -- -- see the files COPYING3 and COPYING.RUNTIME respectively. If not, see -- -- <http://www.gnu.org/licenses/>. -- -- -- -- This unit was originally developed by Matthew J Heaney. -- ------------------------------------------------------------------------------ with Ada.Containers.Hash_Tables.Generic_Bounded_Operations; pragma Elaborate_All (Ada.Containers.Hash_Tables.Generic_Bounded_Operations); with Ada.Containers.Hash_Tables.Generic_Bounded_Keys; pragma Elaborate_All (Ada.Containers.Hash_Tables.Generic_Bounded_Keys); with Ada.Containers.Helpers; use Ada.Containers.Helpers; with Ada.Containers.Prime_Numbers; use Ada.Containers.Prime_Numbers; with System; use type System.Address; package body Ada.Containers.Bounded_Hashed_Sets is pragma Warnings (Off, "variable ""Busy*"" is not referenced"); pragma Warnings (Off, "variable ""Lock*"" is not referenced"); -- See comment in Ada.Containers.Helpers ----------------------- -- Local Subprograms -- ----------------------- function Equivalent_Keys (Key : Element_Type; Node : Node_Type) return Boolean; pragma Inline (Equivalent_Keys); function Hash_Node (Node : Node_Type) return Hash_Type; pragma Inline (Hash_Node); procedure Insert (Container : in out Set; New_Item : Element_Type; Node : out Count_Type; Inserted : out Boolean); function Is_In (HT : Set; Key : Node_Type) return Boolean; pragma Inline (Is_In); procedure Set_Element (Node : in out Node_Type; Item : Element_Type); pragma Inline (Set_Element); function Next (Node : Node_Type) return Count_Type; pragma Inline (Next); procedure Set_Next (Node : in out Node_Type; Next : Count_Type); pragma Inline (Set_Next); function Vet (Position : Cursor) return Boolean; -------------------------- -- Local Instantiations -- -------------------------- package HT_Ops is new Hash_Tables.Generic_Bounded_Operations (HT_Types => HT_Types, Hash_Node => Hash_Node, Next => Next, Set_Next => Set_Next); package Element_Keys is new Hash_Tables.Generic_Bounded_Keys (HT_Types => HT_Types, Next => Next, Set_Next => Set_Next, Key_Type => Element_Type, Hash => Hash, Equivalent_Keys => Equivalent_Keys); procedure Replace_Element is new Element_Keys.Generic_Replace_Element (Hash_Node, Set_Element); --------- -- "=" -- --------- function "=" (Left, Right : Set) return Boolean is function Find_Equal_Key (R_HT : Hash_Table_Type'Class; L_Node : Node_Type) return Boolean; pragma Inline (Find_Equal_Key); function Is_Equal is new HT_Ops.Generic_Equal (Find_Equal_Key); -------------------- -- Find_Equal_Key -- -------------------- function Find_Equal_Key (R_HT : Hash_Table_Type'Class; L_Node : Node_Type) return Boolean is R_Index : constant Hash_Type := Element_Keys.Index (R_HT, L_Node.Element); R_Node : Count_Type := R_HT.Buckets (R_Index); begin loop if R_Node = 0 then return False; end if; if L_Node.Element = R_HT.Nodes (R_Node).Element then return True; end if; R_Node := Next (R_HT.Nodes (R_Node)); end loop; end Find_Equal_Key; -- Start of processing for "=" begin return Is_Equal (Left, Right); end "="; ------------ -- Assign -- ------------ procedure Assign (Target : in out Set; Source : Set) is procedure Insert_Element (Source_Node : Count_Type); procedure Insert_Elements is new HT_Ops.Generic_Iteration (Insert_Element); -------------------- -- Insert_Element -- -------------------- procedure Insert_Element (Source_Node : Count_Type) is N : Node_Type renames Source.Nodes (Source_Node); X : Count_Type; B : Boolean; begin Insert (Target, N.Element, X, B); pragma Assert (B); end Insert_Element; -- Start of processing for Assign begin if Target'Address = Source'Address then return; end if; if Checks and then Target.Capacity < Source.Length then raise Capacity_Error with "Target capacity is less than Source length"; end if; HT_Ops.Clear (Target); Insert_Elements (Source); end Assign; -------------- -- Capacity -- -------------- function Capacity (Container : Set) return Count_Type is begin return Container.Capacity; end Capacity; ----------- -- Clear -- ----------- procedure Clear (Container : in out Set) is begin HT_Ops.Clear (Container); end Clear; ------------------------ -- Constant_Reference -- ------------------------ function Constant_Reference (Container : aliased Set; Position : Cursor) return Constant_Reference_Type is begin if Checks and then Position.Container = null then raise Constraint_Error with "Position cursor has no element"; end if; if Checks and then Position.Container /= Container'Unrestricted_Access then raise Program_Error with "Position cursor designates wrong container"; end if; pragma Assert (Vet (Position), "bad cursor in Constant_Reference"); declare N : Node_Type renames Container.Nodes (Position.Node); TC : constant Tamper_Counts_Access := Container.TC'Unrestricted_Access; begin return R : constant Constant_Reference_Type := (Element => N.Element'Access, Control => (Controlled with TC)) do Lock (TC.all); end return; end; end Constant_Reference; -------------- -- Contains -- -------------- function Contains (Container : Set; Item : Element_Type) return Boolean is begin return Find (Container, Item) /= No_Element; end Contains; ---------- -- Copy -- ---------- function Copy (Source : Set; Capacity : Count_Type := 0; Modulus : Hash_Type := 0) return Set is C : Count_Type; M : Hash_Type; begin if Capacity = 0 then C := Source.Length; elsif Capacity >= Source.Length then C := Capacity; elsif Checks then raise Capacity_Error with "Capacity value too small"; end if; if Modulus = 0 then M := Default_Modulus (C); else M := Modulus; end if; return Target : Set (Capacity => C, Modulus => M) do Assign (Target => Target, Source => Source); end return; end Copy; --------------------- -- Default_Modulus -- --------------------- function Default_Modulus (Capacity : Count_Type) return Hash_Type is begin return To_Prime (Capacity); end Default_Modulus; ------------ -- Delete -- ------------ procedure Delete (Container : in out Set; Item : Element_Type) is X : Count_Type; begin Element_Keys.Delete_Key_Sans_Free (Container, Item, X); if Checks and then X = 0 then raise Constraint_Error with "attempt to delete element not in set"; end if; HT_Ops.Free (Container, X); end Delete; procedure Delete (Container : in out Set; Position : in out Cursor) is begin if Checks and then Position.Node = 0 then raise Constraint_Error with "Position cursor equals No_Element"; end if; if Checks and then Position.Container /= Container'Unrestricted_Access then raise Program_Error with "Position cursor designates wrong set"; end if; TC_Check (Container.TC); pragma Assert (Vet (Position), "bad cursor in Delete"); HT_Ops.Delete_Node_Sans_Free (Container, Position.Node); HT_Ops.Free (Container, Position.Node); Position := No_Element; end Delete; ---------------- -- Difference -- ---------------- procedure Difference (Target : in out Set; Source : Set) is Tgt_Node, Src_Node : Count_Type; Src : Set renames Source'Unrestricted_Access.all; TN : Nodes_Type renames Target.Nodes; SN : Nodes_Type renames Source.Nodes; begin if Target'Address = Source'Address then HT_Ops.Clear (Target); return; end if; if Source.Length = 0 then return; end if; TC_Check (Target.TC); if Source.Length < Target.Length then Src_Node := HT_Ops.First (Source); while Src_Node /= 0 loop Tgt_Node := Element_Keys.Find (Target, SN (Src_Node).Element); if Tgt_Node /= 0 then HT_Ops.Delete_Node_Sans_Free (Target, Tgt_Node); HT_Ops.Free (Target, Tgt_Node); end if; Src_Node := HT_Ops.Next (Src, Src_Node); end loop; else Tgt_Node := HT_Ops.First (Target); while Tgt_Node /= 0 loop if Is_In (Source, TN (Tgt_Node)) then declare X : constant Count_Type := Tgt_Node; begin Tgt_Node := HT_Ops.Next (Target, Tgt_Node); HT_Ops.Delete_Node_Sans_Free (Target, X); HT_Ops.Free (Target, X); end; else Tgt_Node := HT_Ops.Next (Target, Tgt_Node); end if; end loop; end if; end Difference; function Difference (Left, Right : Set) return Set is begin if Left'Address = Right'Address then return Empty_Set; end if; if Left.Length = 0 then return Empty_Set; end if; if Right.Length = 0 then return Left; end if; return Result : Set (Left.Length, To_Prime (Left.Length)) do Iterate_Left : declare procedure Process (L_Node : Count_Type); procedure Iterate is new HT_Ops.Generic_Iteration (Process); ------------- -- Process -- ------------- procedure Process (L_Node : Count_Type) is N : Node_Type renames Left.Nodes (L_Node); X : Count_Type; B : Boolean; begin if not Is_In (Right, N) then Insert (Result, N.Element, X, B); -- optimize this ??? pragma Assert (B); pragma Assert (X > 0); end if; end Process; -- Start of processing for Iterate_Left begin Iterate (Left); end Iterate_Left; end return; end Difference; ------------- -- Element -- ------------- function Element (Position : Cursor) return Element_Type is begin if Checks and then Position.Node = 0 then raise Constraint_Error with "Position cursor equals No_Element"; end if; pragma Assert (Vet (Position), "bad cursor in function Element"); declare S : Set renames Position.Container.all; N : Node_Type renames S.Nodes (Position.Node); begin return N.Element; end; end Element; --------------------- -- Equivalent_Sets -- --------------------- function Equivalent_Sets (Left, Right : Set) return Boolean is function Find_Equivalent_Key (R_HT : Hash_Table_Type'Class; L_Node : Node_Type) return Boolean; pragma Inline (Find_Equivalent_Key); function Is_Equivalent is new HT_Ops.Generic_Equal (Find_Equivalent_Key); ------------------------- -- Find_Equivalent_Key -- ------------------------- function Find_Equivalent_Key (R_HT : Hash_Table_Type'Class; L_Node : Node_Type) return Boolean is R_Index : constant Hash_Type := Element_Keys.Index (R_HT, L_Node.Element); R_Node : Count_Type := R_HT.Buckets (R_Index); RN : Nodes_Type renames R_HT.Nodes; begin loop if R_Node = 0 then return False; end if; if Equivalent_Elements (L_Node.Element, RN (R_Node).Element) then return True; end if; R_Node := Next (R_HT.Nodes (R_Node)); end loop; end Find_Equivalent_Key; -- Start of processing for Equivalent_Sets begin return Is_Equivalent (Left, Right); end Equivalent_Sets; ------------------------- -- Equivalent_Elements -- ------------------------- function Equivalent_Elements (Left, Right : Cursor) return Boolean is begin if Checks and then Left.Node = 0 then raise Constraint_Error with "Left cursor of Equivalent_Elements equals No_Element"; end if; if Checks and then Right.Node = 0 then raise Constraint_Error with "Right cursor of Equivalent_Elements equals No_Element"; end if; pragma Assert (Vet (Left), "bad Left cursor in Equivalent_Elements"); pragma Assert (Vet (Right), "bad Right cursor in Equivalent_Elements"); -- AI05-0022 requires that a container implementation detect element -- tampering by a generic actual subprogram. However, the following case -- falls outside the scope of that AI. Randy Brukardt explained on the -- ARG list on 2013/02/07 that: -- (Begin Quote): -- But for an operation like "<" [the ordered set analog of -- Equivalent_Elements], there is no need to "dereference" a cursor -- after the call to the generic formal parameter function, so nothing -- bad could happen if tampering is undetected. And the operation can -- safely return a result without a problem even if an element is -- deleted from the container. -- (End Quote). declare LN : Node_Type renames Left.Container.Nodes (Left.Node); RN : Node_Type renames Right.Container.Nodes (Right.Node); begin return Equivalent_Elements (LN.Element, RN.Element); end; end Equivalent_Elements; function Equivalent_Elements (Left : Cursor; Right : Element_Type) return Boolean is begin if Checks and then Left.Node = 0 then raise Constraint_Error with "Left cursor of Equivalent_Elements equals No_Element"; end if; pragma Assert (Vet (Left), "Left cursor in Equivalent_Elements is bad"); declare LN : Node_Type renames Left.Container.Nodes (Left.Node); begin return Equivalent_Elements (LN.Element, Right); end; end Equivalent_Elements; function Equivalent_Elements (Left : Element_Type; Right : Cursor) return Boolean is begin if Checks and then Right.Node = 0 then raise Constraint_Error with "Right cursor of Equivalent_Elements equals No_Element"; end if; pragma Assert (Vet (Right), "Right cursor of Equivalent_Elements is bad"); declare RN : Node_Type renames Right.Container.Nodes (Right.Node); begin return Equivalent_Elements (Left, RN.Element); end; end Equivalent_Elements; --------------------- -- Equivalent_Keys -- --------------------- function Equivalent_Keys (Key : Element_Type; Node : Node_Type) return Boolean is begin return Equivalent_Elements (Key, Node.Element); end Equivalent_Keys; ------------- -- Exclude -- ------------- procedure Exclude (Container : in out Set; Item : Element_Type) is X : Count_Type; begin Element_Keys.Delete_Key_Sans_Free (Container, Item, X); HT_Ops.Free (Container, X); end Exclude; -------------- -- Finalize -- -------------- procedure Finalize (Object : in out Iterator) is begin if Object.Container /= null then Unbusy (Object.Container.TC); end if; end Finalize; ---------- -- Find -- ---------- function Find (Container : Set; Item : Element_Type) return Cursor is Node : constant Count_Type := Element_Keys.Find (Container'Unrestricted_Access.all, Item); begin return (if Node = 0 then No_Element else Cursor'(Container'Unrestricted_Access, Node)); end Find; ----------- -- First -- ----------- function First (Container : Set) return Cursor is Node : constant Count_Type := HT_Ops.First (Container); begin return (if Node = 0 then No_Element else Cursor'(Container'Unrestricted_Access, Node)); end First; overriding function First (Object : Iterator) return Cursor is begin return Object.Container.First; end First; ------------------------ -- Get_Element_Access -- ------------------------ function Get_Element_Access (Position : Cursor) return not null Element_Access is begin return Position.Container.Nodes (Position.Node).Element'Access; end Get_Element_Access; ----------------- -- Has_Element -- ----------------- function Has_Element (Position : Cursor) return Boolean is begin pragma Assert (Vet (Position), "bad cursor in Has_Element"); return Position.Node /= 0; end Has_Element; --------------- -- Hash_Node -- --------------- function Hash_Node (Node : Node_Type) return Hash_Type is begin return Hash (Node.Element); end Hash_Node; ------------- -- Include -- ------------- procedure Include (Container : in out Set; New_Item : Element_Type) is Position : Cursor; Inserted : Boolean; begin Insert (Container, New_Item, Position, Inserted); if not Inserted then TE_Check (Container.TC); Container.Nodes (Position.Node).Element := New_Item; end if; end Include; ------------ -- Insert -- ------------ procedure Insert (Container : in out Set; New_Item : Element_Type; Position : out Cursor; Inserted : out Boolean) is begin Insert (Container, New_Item, Position.Node, Inserted); Position.Container := Container'Unchecked_Access; end Insert; procedure Insert (Container : in out Set; New_Item : Element_Type) is Position : Cursor; pragma Unreferenced (Position); Inserted : Boolean; begin Insert (Container, New_Item, Position, Inserted); if Checks and then not Inserted then raise Constraint_Error with "attempt to insert element already in set"; end if; end Insert; procedure Insert (Container : in out Set; New_Item : Element_Type; Node : out Count_Type; Inserted : out Boolean) is procedure Allocate_Set_Element (Node : in out Node_Type); pragma Inline (Allocate_Set_Element); function New_Node return Count_Type; pragma Inline (New_Node); procedure Local_Insert is new Element_Keys.Generic_Conditional_Insert (New_Node); procedure Allocate is new HT_Ops.Generic_Allocate (Allocate_Set_Element); --------------------------- -- Allocate_Set_Element -- --------------------------- procedure Allocate_Set_Element (Node : in out Node_Type) is begin Node.Element := New_Item; end Allocate_Set_Element; -------------- -- New_Node -- -------------- function New_Node return Count_Type is Result : Count_Type; begin Allocate (Container, Result); return Result; end New_Node; -- Start of processing for Insert begin -- The buckets array length is specified by the user as a discriminant -- of the container type, so it is possible for the buckets array to -- have a length of zero. We must check for this case specifically, in -- order to prevent divide-by-zero errors later, when we compute the -- buckets array index value for an element, given its hash value. if Checks and then Container.Buckets'Length = 0 then raise Capacity_Error with "No capacity for insertion"; end if; Local_Insert (Container, New_Item, Node, Inserted); end Insert; ------------------ -- Intersection -- ------------------ procedure Intersection (Target : in out Set; Source : Set) is Tgt_Node : Count_Type; TN : Nodes_Type renames Target.Nodes; begin if Target'Address = Source'Address then return; end if; if Source.Length = 0 then HT_Ops.Clear (Target); return; end if; TC_Check (Target.TC); Tgt_Node := HT_Ops.First (Target); while Tgt_Node /= 0 loop if Is_In (Source, TN (Tgt_Node)) then Tgt_Node := HT_Ops.Next (Target, Tgt_Node); else declare X : constant Count_Type := Tgt_Node; begin Tgt_Node := HT_Ops.Next (Target, Tgt_Node); HT_Ops.Delete_Node_Sans_Free (Target, X); HT_Ops.Free (Target, X); end; end if; end loop; end Intersection; function Intersection (Left, Right : Set) return Set is C : Count_Type; begin if Left'Address = Right'Address then return Left; end if; C := Count_Type'Min (Left.Length, Right.Length); if C = 0 then return Empty_Set; end if; return Result : Set (C, To_Prime (C)) do Iterate_Left : declare procedure Process (L_Node : Count_Type); procedure Iterate is new HT_Ops.Generic_Iteration (Process); ------------- -- Process -- ------------- procedure Process (L_Node : Count_Type) is N : Node_Type renames Left.Nodes (L_Node); X : Count_Type; B : Boolean; begin if Is_In (Right, N) then Insert (Result, N.Element, X, B); -- optimize ??? pragma Assert (B); pragma Assert (X > 0); end if; end Process; -- Start of processing for Iterate_Left begin Iterate (Left); end Iterate_Left; end return; end Intersection; -------------- -- Is_Empty -- -------------- function Is_Empty (Container : Set) return Boolean is begin return Container.Length = 0; end Is_Empty; ----------- -- Is_In -- ----------- function Is_In (HT : Set; Key : Node_Type) return Boolean is begin return Element_Keys.Find (HT'Unrestricted_Access.all, Key.Element) /= 0; end Is_In; --------------- -- Is_Subset -- --------------- function Is_Subset (Subset : Set; Of_Set : Set) return Boolean is Subset_Node : Count_Type; SN : Nodes_Type renames Subset.Nodes; begin if Subset'Address = Of_Set'Address then return True; end if; if Subset.Length > Of_Set.Length then return False; end if; Subset_Node := HT_Ops.First (Subset); while Subset_Node /= 0 loop if not Is_In (Of_Set, SN (Subset_Node)) then return False; end if; Subset_Node := HT_Ops.Next (Subset'Unrestricted_Access.all, Subset_Node); end loop; return True; end Is_Subset; ------------- -- Iterate -- ------------- procedure Iterate (Container : Set; Process : not null access procedure (Position : Cursor)) is procedure Process_Node (Node : Count_Type); pragma Inline (Process_Node); procedure Iterate is new HT_Ops.Generic_Iteration (Process_Node); ------------------ -- Process_Node -- ------------------ procedure Process_Node (Node : Count_Type) is begin Process (Cursor'(Container'Unrestricted_Access, Node)); end Process_Node; Busy : With_Busy (Container.TC'Unrestricted_Access); -- Start of processing for Iterate begin Iterate (Container); end Iterate; function Iterate (Container : Set) return Set_Iterator_Interfaces.Forward_Iterator'Class is begin Busy (Container.TC'Unrestricted_Access.all); return It : constant Iterator := Iterator'(Limited_Controlled with Container => Container'Unrestricted_Access); end Iterate; ------------ -- Length -- ------------ function Length (Container : Set) return Count_Type is begin return Container.Length; end Length; ---------- -- Move -- ---------- procedure Move (Target : in out Set; Source : in out Set) is begin if Target'Address = Source'Address then return; end if; TC_Check (Source.TC); Target.Assign (Source); Source.Clear; end Move; ---------- -- Next -- ---------- function Next (Node : Node_Type) return Count_Type is begin return Node.Next; end Next; function Next (Position : Cursor) return Cursor is begin if Position.Node = 0 then return No_Element; end if; pragma Assert (Vet (Position), "bad cursor in Next"); declare HT : Set renames Position.Container.all; Node : constant Count_Type := HT_Ops.Next (HT, Position.Node); begin if Node = 0 then return No_Element; end if; return Cursor'(Position.Container, Node); end; end Next; procedure Next (Position : in out Cursor) is begin Position := Next (Position); end Next; function Next (Object : Iterator; Position : Cursor) return Cursor is begin if Position.Container = null then return No_Element; end if; if Checks and then Position.Container /= Object.Container then raise Program_Error with "Position cursor of Next designates wrong set"; end if; return Next (Position); end Next; ------------- -- Overlap -- ------------- function Overlap (Left, Right : Set) return Boolean is Left_Node : Count_Type; begin if Right.Length = 0 then return False; end if; if Left'Address = Right'Address then return True; end if; Left_Node := HT_Ops.First (Left); while Left_Node /= 0 loop if Is_In (Right, Left.Nodes (Left_Node)) then return True; end if; Left_Node := HT_Ops.Next (Left'Unrestricted_Access.all, Left_Node); end loop; return False; end Overlap; ---------------------- -- Pseudo_Reference -- ---------------------- function Pseudo_Reference (Container : aliased Set'Class) return Reference_Control_Type is TC : constant Tamper_Counts_Access := Container.TC'Unrestricted_Access; begin return R : constant Reference_Control_Type := (Controlled with TC) do Lock (TC.all); end return; end Pseudo_Reference; ------------------- -- Query_Element -- ------------------- procedure Query_Element (Position : Cursor; Process : not null access procedure (Element : Element_Type)) is begin if Checks and then Position.Node = 0 then raise Constraint_Error with "Position cursor of Query_Element equals No_Element"; end if; pragma Assert (Vet (Position), "bad cursor in Query_Element"); declare S : Set renames Position.Container.all; Lock : With_Lock (S.TC'Unrestricted_Access); begin Process (S.Nodes (Position.Node).Element); end; end Query_Element; ---------- -- Read -- ---------- procedure Read (Stream : not null access Root_Stream_Type'Class; Container : out Set) is function Read_Node (Stream : not null access Root_Stream_Type'Class) return Count_Type; procedure Read_Nodes is new HT_Ops.Generic_Read (Read_Node); --------------- -- Read_Node -- --------------- function Read_Node (Stream : not null access Root_Stream_Type'Class) return Count_Type is procedure Read_Element (Node : in out Node_Type); pragma Inline (Read_Element); procedure Allocate is new HT_Ops.Generic_Allocate (Read_Element); procedure Read_Element (Node : in out Node_Type) is begin Element_Type'Read (Stream, Node.Element); end Read_Element; Node : Count_Type; -- Start of processing for Read_Node begin Allocate (Container, Node); return Node; end Read_Node; -- Start of processing for Read begin Read_Nodes (Stream, Container); end Read; procedure Read (Stream : not null access Root_Stream_Type'Class; Item : out Cursor) is begin raise Program_Error with "attempt to stream set cursor"; end Read; procedure Read (Stream : not null access Root_Stream_Type'Class; Item : out Constant_Reference_Type) is begin raise Program_Error with "attempt to stream reference"; end Read; ------------- -- Replace -- ------------- procedure Replace (Container : in out Set; New_Item : Element_Type) is Node : constant Count_Type := Element_Keys.Find (Container, New_Item); begin if Checks and then Node = 0 then raise Constraint_Error with "attempt to replace element not in set"; end if; TE_Check (Container.TC); Container.Nodes (Node).Element := New_Item; end Replace; procedure Replace_Element (Container : in out Set; Position : Cursor; New_Item : Element_Type) is begin if Checks and then Position.Node = 0 then raise Constraint_Error with "Position cursor equals No_Element"; end if; if Checks and then Position.Container /= Container'Unrestricted_Access then raise Program_Error with "Position cursor designates wrong set"; end if; pragma Assert (Vet (Position), "bad cursor in Replace_Element"); Replace_Element (Container, Position.Node, New_Item); end Replace_Element; ---------------------- -- Reserve_Capacity -- ---------------------- procedure Reserve_Capacity (Container : in out Set; Capacity : Count_Type) is begin if Checks and then Capacity > Container.Capacity then raise Capacity_Error with "requested capacity is too large"; end if; end Reserve_Capacity; ------------------ -- Set_Element -- ------------------ procedure Set_Element (Node : in out Node_Type; Item : Element_Type) is begin Node.Element := Item; end Set_Element; -------------- -- Set_Next -- -------------- procedure Set_Next (Node : in out Node_Type; Next : Count_Type) is begin Node.Next := Next; end Set_Next; -------------------------- -- Symmetric_Difference -- -------------------------- procedure Symmetric_Difference (Target : in out Set; Source : Set) is procedure Process (Source_Node : Count_Type); pragma Inline (Process); procedure Iterate is new HT_Ops.Generic_Iteration (Process); ------------- -- Process -- ------------- procedure Process (Source_Node : Count_Type) is N : Node_Type renames Source.Nodes (Source_Node); X : Count_Type; B : Boolean; begin if Is_In (Target, N) then Delete (Target, N.Element); else Insert (Target, N.Element, X, B); pragma Assert (B); end if; end Process; -- Start of processing for Symmetric_Difference begin if Target'Address = Source'Address then HT_Ops.Clear (Target); return; end if; if Target.Length = 0 then Assign (Target => Target, Source => Source); return; end if; TC_Check (Target.TC); Iterate (Source); end Symmetric_Difference; function Symmetric_Difference (Left, Right : Set) return Set is C : Count_Type; begin if Left'Address = Right'Address then return Empty_Set; end if; if Right.Length = 0 then return Left; end if; if Left.Length = 0 then return Right; end if; C := Left.Length + Right.Length; return Result : Set (C, To_Prime (C)) do Iterate_Left : declare procedure Process (L_Node : Count_Type); procedure Iterate is new HT_Ops.Generic_Iteration (Process); ------------- -- Process -- ------------- procedure Process (L_Node : Count_Type) is N : Node_Type renames Left.Nodes (L_Node); X : Count_Type; B : Boolean; begin if not Is_In (Right, N) then Insert (Result, N.Element, X, B); pragma Assert (B); end if; end Process; -- Start of processing for Iterate_Left begin Iterate (Left); end Iterate_Left; Iterate_Right : declare procedure Process (R_Node : Count_Type); procedure Iterate is new HT_Ops.Generic_Iteration (Process); ------------- -- Process -- ------------- procedure Process (R_Node : Count_Type) is N : Node_Type renames Right.Nodes (R_Node); X : Count_Type; B : Boolean; begin if not Is_In (Left, N) then Insert (Result, N.Element, X, B); pragma Assert (B); end if; end Process; -- Start of processing for Iterate_Right begin Iterate (Right); end Iterate_Right; end return; end Symmetric_Difference; ------------ -- To_Set -- ------------ function To_Set (New_Item : Element_Type) return Set is X : Count_Type; B : Boolean; begin return Result : Set (1, 1) do Insert (Result, New_Item, X, B); pragma Assert (B); end return; end To_Set; ----------- -- Union -- ----------- procedure Union (Target : in out Set; Source : Set) is procedure Process (Src_Node : Count_Type); procedure Iterate is new HT_Ops.Generic_Iteration (Process); ------------- -- Process -- ------------- procedure Process (Src_Node : Count_Type) is N : Node_Type renames Source.Nodes (Src_Node); X : Count_Type; B : Boolean; begin Insert (Target, N.Element, X, B); end Process; -- Start of processing for Union begin if Target'Address = Source'Address then return; end if; TC_Check (Target.TC); -- ??? why is this code commented out ??? -- declare -- N : constant Count_Type := Target.Length + Source.Length; -- begin -- if N > HT_Ops.Capacity (Target.HT) then -- HT_Ops.Reserve_Capacity (Target.HT, N); -- end if; -- end; Iterate (Source); end Union; function Union (Left, Right : Set) return Set is C : Count_Type; begin if Left'Address = Right'Address then return Left; end if; if Right.Length = 0 then return Left; end if; if Left.Length = 0 then return Right; end if; C := Left.Length + Right.Length; return Result : Set (C, To_Prime (C)) do Assign (Target => Result, Source => Left); Union (Target => Result, Source => Right); end return; end Union; --------- -- Vet -- --------- function Vet (Position : Cursor) return Boolean is begin if Position.Node = 0 then return Position.Container = null; end if; if Position.Container = null then return False; end if; declare S : Set renames Position.Container.all; N : Nodes_Type renames S.Nodes; X : Count_Type; begin if S.Length = 0 then return False; end if; if Position.Node > N'Last then return False; end if; if N (Position.Node).Next = Position.Node then return False; end if; X := S.Buckets (Element_Keys.Checked_Index (S, N (Position.Node).Element)); for J in 1 .. S.Length loop if X = Position.Node then return True; end if; if X = 0 then return False; end if; if X = N (X).Next then -- to prevent unnecessary looping return False; end if; X := N (X).Next; end loop; return False; end; end Vet; ----------- -- Write -- ----------- procedure Write (Stream : not null access Root_Stream_Type'Class; Container : Set) is procedure Write_Node (Stream : not null access Root_Stream_Type'Class; Node : Node_Type); pragma Inline (Write_Node); procedure Write_Nodes is new HT_Ops.Generic_Write (Write_Node); ---------------- -- Write_Node -- ---------------- procedure Write_Node (Stream : not null access Root_Stream_Type'Class; Node : Node_Type) is begin Element_Type'Write (Stream, Node.Element); end Write_Node; -- Start of processing for Write begin Write_Nodes (Stream, Container); end Write; procedure Write (Stream : not null access Root_Stream_Type'Class; Item : Cursor) is begin raise Program_Error with "attempt to stream set cursor"; end Write; procedure Write (Stream : not null access Root_Stream_Type'Class; Item : Constant_Reference_Type) is begin raise Program_Error with "attempt to stream reference"; end Write; package body Generic_Keys is ----------------------- -- Local Subprograms -- ----------------------- function Equivalent_Key_Node (Key : Key_Type; Node : Node_Type) return Boolean; pragma Inline (Equivalent_Key_Node); -------------------------- -- Local Instantiations -- -------------------------- package Key_Keys is new Hash_Tables.Generic_Bounded_Keys (HT_Types => HT_Types, Next => Next, Set_Next => Set_Next, Key_Type => Key_Type, Hash => Hash, Equivalent_Keys => Equivalent_Key_Node); ------------------------ -- Constant_Reference -- ------------------------ function Constant_Reference (Container : aliased Set; Key : Key_Type) return Constant_Reference_Type is Node : constant Count_Type := Key_Keys.Find (Container'Unrestricted_Access.all, Key); begin if Checks and then Node = 0 then raise Constraint_Error with "key not in set"; end if; declare N : Node_Type renames Container.Nodes (Node); TC : constant Tamper_Counts_Access := Container.TC'Unrestricted_Access; begin return R : constant Constant_Reference_Type := (Element => N.Element'Access, Control => (Controlled with TC)) do Lock (TC.all); end return; end; end Constant_Reference; -------------- -- Contains -- -------------- function Contains (Container : Set; Key : Key_Type) return Boolean is begin return Find (Container, Key) /= No_Element; end Contains; ------------ -- Delete -- ------------ procedure Delete (Container : in out Set; Key : Key_Type) is X : Count_Type; begin Key_Keys.Delete_Key_Sans_Free (Container, Key, X); if Checks and then X = 0 then raise Constraint_Error with "attempt to delete key not in set"; end if; HT_Ops.Free (Container, X); end Delete; ------------- -- Element -- ------------- function Element (Container : Set; Key : Key_Type) return Element_Type is Node : constant Count_Type := Key_Keys.Find (Container'Unrestricted_Access.all, Key); begin if Checks and then Node = 0 then raise Constraint_Error with "key not in set"; end if; return Container.Nodes (Node).Element; end Element; ------------------------- -- Equivalent_Key_Node -- ------------------------- function Equivalent_Key_Node (Key : Key_Type; Node : Node_Type) return Boolean is begin return Equivalent_Keys (Key, Generic_Keys.Key (Node.Element)); end Equivalent_Key_Node; ------------- -- Exclude -- ------------- procedure Exclude (Container : in out Set; Key : Key_Type) is X : Count_Type; begin Key_Keys.Delete_Key_Sans_Free (Container, Key, X); HT_Ops.Free (Container, X); end Exclude; -------------- -- Finalize -- -------------- procedure Finalize (Control : in out Reference_Control_Type) is begin if Control.Container /= null then Impl.Reference_Control_Type (Control).Finalize; if Checks and then Hash (Key (Element (Control.Old_Pos))) /= Control.Old_Hash then HT_Ops.Delete_Node_At_Index (Control.Container.all, Control.Index, Control.Old_Pos.Node); raise Program_Error with "key not preserved in reference"; end if; Control.Container := null; end if; end Finalize; ---------- -- Find -- ---------- function Find (Container : Set; Key : Key_Type) return Cursor is Node : constant Count_Type := Key_Keys.Find (Container'Unrestricted_Access.all, Key); begin return (if Node = 0 then No_Element else Cursor'(Container'Unrestricted_Access, Node)); end Find; --------- -- Key -- --------- function Key (Position : Cursor) return Key_Type is begin if Checks and then Position.Node = 0 then raise Constraint_Error with "Position cursor equals No_Element"; end if; pragma Assert (Vet (Position), "bad cursor in function Key"); return Key (Position.Container.Nodes (Position.Node).Element); end Key; ---------- -- Read -- ---------- procedure Read (Stream : not null access Root_Stream_Type'Class; Item : out Reference_Type) is begin raise Program_Error with "attempt to stream reference"; end Read; ------------------------------ -- Reference_Preserving_Key -- ------------------------------ function Reference_Preserving_Key (Container : aliased in out Set; Position : Cursor) return Reference_Type is begin if Checks and then Position.Container = null then raise Constraint_Error with "Position cursor has no element"; end if; if Checks and then Position.Container /= Container'Unrestricted_Access then raise Program_Error with "Position cursor designates wrong container"; end if; pragma Assert (Vet (Position), "bad cursor in function Reference_Preserving_Key"); declare N : Node_Type renames Container.Nodes (Position.Node); begin return R : constant Reference_Type := (Element => N.Element'Unrestricted_Access, Control => (Controlled with Container.TC'Unrestricted_Access, Container'Unrestricted_Access, Index => Key_Keys.Index (Container, Key (Position)), Old_Pos => Position, Old_Hash => Hash (Key (Position)))) do Lock (Container.TC); end return; end; end Reference_Preserving_Key; function Reference_Preserving_Key (Container : aliased in out Set; Key : Key_Type) return Reference_Type is Node : constant Count_Type := Key_Keys.Find (Container, Key); begin if Checks and then Node = 0 then raise Constraint_Error with "key not in set"; end if; declare P : constant Cursor := Find (Container, Key); begin return R : constant Reference_Type := (Element => Container.Nodes (Node).Element'Unrestricted_Access, Control => (Controlled with Container.TC'Unrestricted_Access, Container'Unrestricted_Access, Index => Key_Keys.Index (Container, Key), Old_Pos => P, Old_Hash => Hash (Key))) do Lock (Container.TC); end return; end; end Reference_Preserving_Key; ------------- -- Replace -- ------------- procedure Replace (Container : in out Set; Key : Key_Type; New_Item : Element_Type) is Node : constant Count_Type := Key_Keys.Find (Container, Key); begin if Checks and then Node = 0 then raise Constraint_Error with "attempt to replace key not in set"; end if; Replace_Element (Container, Node, New_Item); end Replace; ----------------------------------- -- Update_Element_Preserving_Key -- ----------------------------------- procedure Update_Element_Preserving_Key (Container : in out Set; Position : Cursor; Process : not null access procedure (Element : in out Element_Type)) is Indx : Hash_Type; N : Nodes_Type renames Container.Nodes; begin if Checks and then Position.Node = 0 then raise Constraint_Error with "Position cursor equals No_Element"; end if; if Checks and then Position.Container /= Container'Unrestricted_Access then raise Program_Error with "Position cursor designates wrong set"; end if; -- ??? why is this code commented out ??? -- if HT.Buckets = null -- or else HT.Buckets'Length = 0 -- or else HT.Length = 0 -- or else Position.Node.Next = Position.Node -- then -- raise Program_Error with -- "Position cursor is bad (set is empty)"; -- end if; pragma Assert (Vet (Position), "bad cursor in Update_Element_Preserving_Key"); -- Per AI05-0022, the container implementation is required to detect -- element tampering by a generic actual subprogram. declare E : Element_Type renames N (Position.Node).Element; K : constant Key_Type := Key (E); Lock : With_Lock (Container.TC'Unrestricted_Access); begin -- Record bucket now, in case key is changed Indx := HT_Ops.Index (Container.Buckets, N (Position.Node)); Process (E); if Equivalent_Keys (K, Key (E)) then return; end if; end; -- Key was modified, so remove this node from set. if Container.Buckets (Indx) = Position.Node then Container.Buckets (Indx) := N (Position.Node).Next; else declare Prev : Count_Type := Container.Buckets (Indx); begin while N (Prev).Next /= Position.Node loop Prev := N (Prev).Next; if Checks and then Prev = 0 then raise Program_Error with "Position cursor is bad (node not found)"; end if; end loop; N (Prev).Next := N (Position.Node).Next; end; end if; Container.Length := Container.Length - 1; HT_Ops.Free (Container, Position.Node); raise Program_Error with "key was modified"; end Update_Element_Preserving_Key; ----------- -- Write -- ----------- procedure Write (Stream : not null access Root_Stream_Type'Class; Item : Reference_Type) is begin raise Program_Error with "attempt to stream reference"; end Write; end Generic_Keys; end Ada.Containers.Bounded_Hashed_Sets;
------------------------------------------------------------------------------ -- -- -- GNAT RUN-TIME COMPONENTS -- -- -- -- A D A . W I D E _ W I D E _ T E X T _ I O . D E C I M A L _ I O -- -- -- -- B o d y -- -- -- -- Copyright (C) 1992-2005, Free Software Foundation, Inc. -- -- -- -- GNAT is free software; you can redistribute it and/or modify it under -- -- terms of the GNU General Public License as published by the Free Soft- -- -- ware Foundation; either version 2, or (at your option) any later ver- -- -- sion. GNAT is distributed in the hope that it will be useful, but WITH- -- -- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY -- -- or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -- -- for more details. You should have received a copy of the GNU General -- -- Public License distributed with GNAT; see file COPYING. If not, write -- -- to the Free Software Foundation, 51 Franklin Street, Fifth Floor, -- -- Boston, MA 02110-1301, USA. -- -- -- -- As a special exception, if other files instantiate generics from this -- -- unit, or you link this unit with other files to produce an executable, -- -- this unit does not by itself cause the resulting executable to be -- -- covered by the GNU General Public License. This exception does not -- -- however invalidate any other reasons why the executable file might be -- -- covered by the GNU Public License. -- -- -- -- GNAT was originally developed by the GNAT team at New York University. -- -- Extensive contributions were provided by Ada Core Technologies Inc. -- -- -- ------------------------------------------------------------------------------ with Ada.Wide_Wide_Text_IO.Decimal_Aux; with System.WCh_Con; use System.WCh_Con; with System.WCh_WtS; use System.WCh_WtS; package body Ada.Wide_Wide_Text_IO.Decimal_IO is subtype TFT is Ada.Wide_Wide_Text_IO.File_Type; -- File type required for calls to routines in Aux package Aux renames Ada.Wide_Wide_Text_IO.Decimal_Aux; Scale : constant Integer := Num'Scale; --------- -- Get -- --------- procedure Get (File : File_Type; Item : out Num; Width : Field := 0) is begin if Num'Size > Integer'Size then Item := Num (Aux.Get_LLD (TFT (File), Width, Scale)); -- Item := Num'Fixed_Value (Aux.Get_LLD (TFT (File), Width, Scale)); -- above is what we should write, but gets assert error ??? else Item := Num (Aux.Get_Dec (TFT (File), Width, Scale)); -- Item := Num'Fixed_Value (Aux.Get_Dec (TFT (File), Width, Scale)); -- above is what we should write, but gets assert error ??? end if; exception when Constraint_Error => raise Data_Error; end Get; procedure Get (Item : out Num; Width : Field := 0) is begin Get (Current_Input, Item, Width); end Get; procedure Get (From : Wide_Wide_String; Item : out Num; Last : out Positive) is S : constant String := Wide_Wide_String_To_String (From, WCEM_Upper); -- String on which we do the actual conversion. Note that the method -- used for wide character encoding is irrelevant, since if there is -- a character outside the Standard.Character range then the call to -- Aux.Gets will raise Data_Error in any case. begin if Num'Size > Integer'Size then -- Item := Num'Fixed_Value -- should write above, but gets assert error ??? Item := Num (Aux.Gets_LLD (S, Last'Unrestricted_Access, Scale)); else -- Item := Num'Fixed_Value -- should write above, but gets assert error ??? Item := Num (Aux.Gets_Dec (S, Last'Unrestricted_Access, Scale)); end if; exception when Constraint_Error => raise Data_Error; end Get; --------- -- Put -- --------- procedure Put (File : File_Type; Item : Num; Fore : Field := Default_Fore; Aft : Field := Default_Aft; Exp : Field := Default_Exp) is begin if Num'Size > Integer'Size then Aux.Put_LLD -- (TFT (File), Long_Long_Integer'Integer_Value (Item), -- ??? (TFT (File), Long_Long_Integer (Item), Fore, Aft, Exp, Scale); else Aux.Put_Dec -- (TFT (File), Integer'Integer_Value (Item), Fore, Aft, Exp, Scale); -- ??? (TFT (File), Integer (Item), Fore, Aft, Exp, Scale); end if; end Put; procedure Put (Item : Num; Fore : Field := Default_Fore; Aft : Field := Default_Aft; Exp : Field := Default_Exp) is pragma Unreferenced (Fore); -- ??? how come this is unreferenced, sounds wrong ??? begin Put (Current_Output, Item, Aft, Exp); end Put; procedure Put (To : out Wide_Wide_String; Item : Num; Aft : Field := Default_Aft; Exp : Field := Default_Exp) is S : String (To'First .. To'Last); begin if Num'Size > Integer'Size then -- Aux.Puts_LLD -- (S, Long_Long_Integer'Integer_Value (Item), Aft, Exp, Scale); -- ??? Aux.Puts_LLD (S, Long_Long_Integer (Item), Aft, Exp, Scale); else -- Aux.Puts_Dec (S, Integer'Integer_Value (Item), Aft, Exp, Scale); -- ??? Aux.Puts_Dec (S, Integer (Item), Aft, Exp, Scale); end if; for J in S'Range loop To (J) := Wide_Wide_Character'Val (Character'Pos (S (J))); end loop; end Put; end Ada.Wide_Wide_Text_IO.Decimal_IO;
pragma License (Unrestricted); package System.WCh_Con is pragma Pure; type WC_Encoding_Method is ( WCEM_Hex, WCEM_Upper, WCEM_Shift_JIS, WCEM_EUC, WCEM_UTF8, WCEM_Brackets); end System.WCh_Con;
package agar.gui.widget.separator is type type_t is (SEPARATOR_HORIZ, SEPARATOR_VERT); for type_t use (SEPARATOR_HORIZ => 0, SEPARATOR_VERT => 1); for type_t'size use c.unsigned'size; pragma convention (c, type_t); type separator_t is limited private; type separator_access_t is access all separator_t; pragma convention (c, separator_access_t); function allocate (parent : widget_access_t; separator_type : type_t) return separator_access_t; pragma import (c, allocate, "AG_SeparatorNew"); function allocate_spacer (parent : widget_access_t; separator_type : type_t) return separator_access_t; pragma import (c, allocate_spacer, "AG_SpacerNew"); procedure set_padding (separator : separator_access_t; pixels : natural); pragma inline (set_padding); function widget (separator : separator_access_t) return widget_access_t; pragma inline (widget); private type separator_t is record widget : aliased widget_t; sep_type : type_t; padding : c.unsigned; visible : c.int; end record; pragma convention (c, separator_t); end agar.gui.widget.separator;
------------------------------------------------------------------------------ -- -- -- Copyright (C) 2017, AdaCore -- -- -- -- Redistribution and use in source and binary forms, with or without -- -- modification, are permitted provided that the following conditions are -- -- met: -- -- 1. Redistributions of source code must retain the above copyright -- -- notice, this list of conditions and the following disclaimer. -- -- 2. Redistributions in binary form must reproduce the above copyright -- -- notice, this list of conditions and the following disclaimer in -- -- the documentation and/or other materials provided with the -- -- distribution. -- -- 3. Neither the name of the copyright holder nor the names of its -- -- contributors may be used to endorse or promote products derived -- -- from this software without specific prior written permission. -- -- -- -- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -- -- "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -- -- LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -- -- A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -- -- HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -- -- SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -- -- LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -- -- DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -- -- THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -- -- (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -- -- OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -- -- -- ------------------------------------------------------------------------------ with HAL.GPIO; use HAL.GPIO; with Wire_Simulation; use Wire_Simulation; with Ada.Text_IO; use Ada.Text_IO; procedure TC_Virtual_Wire is pragma Assertion_Policy (Assert => Check); No_Pull_Wire : Virtual_Wire (Default_Pull => Floating, Max_Points => 2); Pull_Up_Wire : Virtual_Wire (Default_Pull => Pull_Up, Max_Points => 2); Pull_Down_Wire : Virtual_Wire (Default_Pull => Pull_Down, Max_Points => 2); Unref : Boolean with Unreferenced; begin -- Default mode -- pragma Assert (No_Pull_Wire.Point (1).Mode = Input, "Default point mode should be input"); -- State with only inputs and a wire pull resistor -- pragma Assert (Pull_Up_Wire.Point (1).Set, "Default state of pull up wire should be high"); pragma Assert (not Pull_Down_Wire.Point (1).Set, "Default state of pull down wire should be low"); -- State with only inputs and a point pull resistor -- pragma Assert (No_Pull_Wire.Point (1).Set_Pull_Resistor (Pull_Up), "It should be possible to change the pull resitor"); pragma Assert (No_Pull_Wire.Point (1).Set, "State of wire with one pull up point should be high"); Unref := No_Pull_Wire.Point (1).Set_Pull_Resistor (Pull_Down); pragma Assert (not No_Pull_Wire.Point (1).Set, "State of wire with one pull down point should be low"); -- State with one input one output and no pull resistor -- pragma Assert (No_Pull_Wire.Point (1).Set_Mode (Input), "It should be possible to change the mode"); Unref := No_Pull_Wire.Point (1).Set_Pull_Resistor (Pull_Down); Unref := No_Pull_Wire.Point (2).Set_Mode (Output); Unref := No_Pull_Wire.Point (2).Set_Pull_Resistor (Floating); No_Pull_Wire.Point (2).Set; pragma Assert (No_Pull_Wire.Point (1).Set, "Should be high"); No_Pull_Wire.Point (2).Clear; pragma Assert (not No_Pull_Wire.Point (1).Set, "Should be low"); -- State with one input one output and point pull resistor -- Unref := No_Pull_Wire.Point (1).Set_Mode (Input); Unref := No_Pull_Wire.Point (1).Set_Pull_Resistor (Pull_Up); Unref := No_Pull_Wire.Point (2).Set_Mode (Output); Unref := No_Pull_Wire.Point (2).Set_Pull_Resistor (Floating); No_Pull_Wire.Point (2).Set; pragma Assert (No_Pull_Wire.Point (1).Set, "Should be high"); No_Pull_Wire.Point (2).Clear; pragma Assert (not No_Pull_Wire.Point (1).Set, "Should be low"); Unref := No_Pull_Wire.Point (1).Set_Pull_Resistor (Pull_Down); No_Pull_Wire.Point (2).Set; pragma Assert (No_Pull_Wire.Point (1).Set, "Should be high"); No_Pull_Wire.Point (2).Clear; pragma Assert (not No_Pull_Wire.Point (1).Set, "Should be low"); -- Opposite pull on the same wire -- declare begin Unref := Pull_Down_Wire.Point (1).Set_Pull_Resistor (Pull_Up); exception when Invalid_Configuration => Put_Line ("Expected exception on oppposite pull (1)"); end; declare begin Unref := Pull_Up_Wire.Point (1).Set_Pull_Resistor (Pull_Down); exception when Invalid_Configuration => Put_Line ("Expected exception on oppposite pull (2)"); end; -- Two output point on a wire -- declare begin Unref := Pull_Up_Wire.Point (1).Set_Mode (Output); Unref := Pull_Up_Wire.Point (2).Set_Mode (Output); exception when Invalid_Configuration => Put_Line ("Expected exception on multiple output points"); end; -- Unknon state -- declare begin Unref := No_Pull_Wire.Point (1).Set_Mode (Input); Unref := No_Pull_Wire.Point (1).Set_Pull_Resistor (Floating); Unref := No_Pull_Wire.Point (2).Set_Mode (Input); Unref := No_Pull_Wire.Point (2).Set_Pull_Resistor (Floating); Unref := No_Pull_Wire.Point (2).Set; exception when Unknown_State => Put_Line ("Expected exception on unknown state"); end; end TC_Virtual_Wire;
------------------------------------------------------------------------------ -- -- -- GNAT COMPILER COMPONENTS -- -- -- -- S Y S T E M . P A R A M E T E R S -- -- -- -- S p e c -- -- -- -- Copyright (C) 1992-2012, Free Software Foundation, Inc. -- -- -- -- GNAT is free software; you can redistribute it and/or modify it under -- -- terms of the GNU General Public License as published by the Free Soft- -- -- ware Foundation; either version 3, or (at your option) any later ver- -- -- sion. GNAT is distributed in the hope that it will be useful, but WITH- -- -- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY -- -- or FITNESS FOR A PARTICULAR PURPOSE. -- -- -- -- -- -- -- -- -- -- -- -- You should have received a copy of the GNU General Public License and -- -- a copy of the GCC Runtime Library Exception along with this program; -- -- see the files COPYING3 and COPYING.RUNTIME respectively. If not, see -- -- <http://www.gnu.org/licenses/>. -- -- -- -- GNAT was originally developed by the GNAT team at New York University. -- -- Extensive contributions were provided by Ada Core Technologies Inc. -- -- -- ------------------------------------------------------------------------------ -- This is a generic bare board version the package, for small targets -- This package defines some system dependent parameters for GNAT. These -- are values that are referenced by the runtime library and are therefore -- relevant to the target machine. -- The parameters whose value is defined in the spec are not generally -- expected to be changed. If they are changed, it will be necessary to -- recompile the run-time library. -- The parameters which are defined by functions can be changed by modifying -- the body of System.Parameters in file s-parame.adb. A change to this body -- requires only rebinding and relinking of the application. -- Note: do not introduce any pragma Inline statements into this unit, since -- otherwise the relinking and rebinding capability would be deactivated. package System.Parameters is pragma Pure; --------------------------------------- -- Task And Stack Allocation Control -- --------------------------------------- type Task_Storage_Size is new Integer; -- Type used in tasking units for task storage size type Size_Type is new Task_Storage_Size; -- Type used to provide task storage size to runtime Unspecified_Size : constant Size_Type := Size_Type'First; -- Value used to indicate that no size type is set subtype Percentage is Size_Type range -1 .. 100; Dynamic : constant Size_Type := -1; -- The secondary stack ratio is a constant between 0 and 100 which -- determines the percentage of the allocated task stack that is -- used by the secondary stack (the rest being the primary stack). -- The special value of minus one indicates that the secondary -- stack is to be allocated from the heap instead. Sec_Stack_Percentage : constant Percentage := 10; -- This constant defines the handling of the secondary stack, see above -- comment, so the 25 here means a 25% amount. Sec_Stack_Dynamic : constant Boolean := Sec_Stack_Percentage = Dynamic; -- Convenient Boolean for testing for dynamic secondary stack Default_Stack_Size : constant Size_Type := 4 * 1024; -- Default task stack size used if none is specified Minimum_Stack_Size : constant Size_Type := 512; -- Minimum task stack size permitted function Adjust_Storage_Size (Size : Size_Type) return Size_Type; -- Given the storage size stored in the TCB, return the Storage_Size -- value required by the RM for the Storage_Size attribute. The -- required adjustment is as follows: -- -- when Size = Unspecified_Size, return Default_Stack_Size -- otherwise return given Size Stack_Grows_Down : constant Boolean := True; -- This constant indicates whether the stack grows up (False) or -- down (True) in memory as functions are called. It is used for -- proper implementation of the stack overflow check. ---------------------------------------------- -- Characteristics of types in Interfaces.C -- ---------------------------------------------- long_bits : constant := Long_Integer'Size; -- Number of bits in type long and unsigned_long. The normal convention -- is that this is the same as type Long_Integer, but this is not true -- of all targets. For example, in OpenVMS long /= Long_Integer. ptr_bits : constant := Standard'Address_Size; subtype C_Address is System.Address; -- Number of bits in Interfaces.C pointers, normally a standard address, -- except on 64-bit VMS where they are 32-bit addresses, for compatibility -- with legacy code. C_Malloc_Linkname : constant String := "__gnat_malloc"; -- Name of runtime function used to allocate such a pointer ---------------------------------------------- -- Behavior of Pragma Finalize_Storage_Only -- ---------------------------------------------- -- Garbage_Collected is a Boolean constant whose value indicates the -- effect of the pragma Finalize_Storage_Entry on a controlled type. -- Garbage_Collected = False -- The system releases all storage on program termination only, -- but not other garbage collection occurs, so finalization calls -- are ommitted only for outer level onjects can be omitted if -- pragma Finalize_Storage_Only is used. -- Garbage_Collected = True -- The system provides full garbage collection, so it is never -- necessary to release storage for controlled objects for which -- a pragma Finalize_Storage_Only is used. Garbage_Collected : constant Boolean := False; -- The storage mode for this system (release on program exit) --------------------- -- Tasking Profile -- --------------------- -- In the following sections, constant parameters are defined to -- allow some optimizations and fine tuning within the tasking run time -- based on restrictions on the tasking features. ---------------------- -- Locking Strategy -- ---------------------- Single_Lock : constant Boolean := True; -- Indicates whether a single lock should be used within the tasking -- run-time to protect internal structures. If True, a single lock -- will be used, meaning less locking/unlocking operations, but also -- more global contention. In general, Single_Lock should be set to -- True on single processor machines, and to False to multi-processor -- systems, but this can vary from application to application and also -- depends on the scheduling policy. ------------------- -- Task Abortion -- ------------------- No_Abort : constant Boolean := True; -- This constant indicates whether abort statements and asynchronous -- transfer of control (ATC) are disallowed. If set to True, it is -- assumed that neither construct is used, and the run time does not -- need to defer/undefer abort and check for pending actions at -- completion points. A value of True for No_Abort corresponds to: -- pragma Restrictions (No_Abort_Statements); -- pragma Restrictions (Max_Asynchronous_Select_Nesting => 0); --------------------- -- Task Attributes -- --------------------- Default_Attribute_Count : constant := 0; -- Number of pre-allocated Address-sized task attributes stored in the -- task control block. -------------------- -- Runtime Traces -- -------------------- Runtime_Traces : constant Boolean := False; -- This constant indicates whether the runtime outputs traces to a -- predefined output or not (True means that traces are output). -- See System.Traces for more details. ----------------------- -- Task Image Length -- ----------------------- Max_Task_Image_Length : constant := 32; -- This constant specifies the maximum length of a task's image ------------------------------ -- Exception Message Length -- ------------------------------ Default_Exception_Msg_Max_Length : constant := 200; -- This constant specifies the default number of characters to allow -- in an exception message (200 is minimum required by RM 11.4.1(18)). end System.Parameters;
-- { dg-do run } with Ada.Containers.Vectors; with Ada.Strings.Unbounded; use Ada.Strings.Unbounded; procedure array3 is type Method_Kinds is (Signal, Slot, Method); package Unbounded_String_Vectors is new Ada.Containers.Vectors (Positive, Ada.Strings.Unbounded.Unbounded_String); Params_Vector : Unbounded_String_Vectors.Vector; type Method_Info is record Name : Ada.Strings.Unbounded.Unbounded_String; Signature : Ada.Strings.Unbounded.Unbounded_String; Parameters : Unbounded_String_Vectors.Vector; Kind : Method_Kinds; end record; package Method_Info_Vectors is new Ada.Containers.Vectors (Positive, Method_Info); Signals : Method_Info_Vectors.Vector; begin Unbounded_String_Vectors.Append (Params_Vector, Ada.Strings.Unbounded.To_Unbounded_String ("AAA")); Method_Info_Vectors.Append (Signals, (Name => To_Unbounded_String (""), Signature => To_Unbounded_String (""), Parameters => Params_Vector, Kind => Signal)); end;
------------------------------------------------------------------------------ -- -- -- GNAT RUN-TIME COMPONENTS -- -- -- -- S Y S T E M . E X N _ I N T -- -- -- -- S p e c -- -- -- -- Copyright (C) 1992-2014, Free Software Foundation, Inc. -- -- -- -- GNAT is free software; you can redistribute it and/or modify it under -- -- terms of the GNU General Public License as published by the Free Soft- -- -- ware Foundation; either version 3, or (at your option) any later ver- -- -- sion. GNAT is distributed in the hope that it will be useful, but WITH- -- -- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY -- -- or FITNESS FOR A PARTICULAR PURPOSE. -- -- -- -- As a special exception under Section 7 of GPL version 3, you are granted -- -- additional permissions described in the GCC Runtime Library Exception, -- -- version 3.1, as published by the Free Software Foundation. -- -- -- -- You should have received a copy of the GNU General Public License and -- -- a copy of the GCC Runtime Library Exception along with this program; -- -- see the files COPYING3 and COPYING.RUNTIME respectively. If not, see -- -- <http://www.gnu.org/licenses/>. -- -- -- -- GNAT was originally developed by the GNAT team at New York University. -- -- Extensive contributions were provided by Ada Core Technologies Inc. -- -- -- ------------------------------------------------------------------------------ -- Integer exponentiation (checks off) package System.Exn_Int is pragma Pure; function Exn_Integer (Left : Integer; Right : Natural) return Integer; end System.Exn_Int;
-- Copyright 2012-2020 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 begin Do_Nothing (Global_Char_Table'Address); end Foo;
-- Copyright 2016-2019 NXP -- All rights reserved.SPDX-License-Identifier: BSD-3-Clause -- This spec has been automatically generated from LPC55S6x.svd pragma Restrictions (No_Elaboration_Code); pragma Ada_2012; pragma Style_Checks (Off); with HAL; with System; package NXP_SVD.USBHSD is pragma Preelaborate; --------------- -- Registers -- --------------- subtype DEVCMDSTAT_DEV_ADDR_Field is HAL.UInt7; subtype DEVCMDSTAT_Speed_Field is HAL.UInt2; subtype DEVCMDSTAT_PHY_TEST_MODE_Field is HAL.UInt3; -- USB Device Command/Status register type DEVCMDSTAT_Register is record -- USB device address. DEV_ADDR : DEVCMDSTAT_DEV_ADDR_Field := 16#0#; -- USB device enable. DEV_EN : Boolean := False; -- SETUP token received. SETUP : Boolean := False; -- Forces the NEEDCLK output to always be on:. FORCE_NEEDCLK : Boolean := False; -- unspecified Reserved_10_10 : HAL.Bit := 16#0#; -- LPM Supported:. LPM_SUP : Boolean := True; -- Interrupt on NAK for interrupt and bulk OUT EP:. INTONNAK_AO : Boolean := False; -- Interrupt on NAK for interrupt and bulk IN EP:. INTONNAK_AI : Boolean := False; -- Interrupt on NAK for control OUT EP:. INTONNAK_CO : Boolean := False; -- Interrupt on NAK for control IN EP:. INTONNAK_CI : Boolean := False; -- Device status - connect. DCON : Boolean := False; -- Device status - suspend. DSUS : Boolean := False; -- unspecified Reserved_18_18 : HAL.Bit := 16#0#; -- Device status - LPM Suspend. LPM_SUS : Boolean := False; -- Read-only. LPM Remote Wake-up Enabled by USB host. LPM_REWP : Boolean := False; -- unspecified Reserved_21_21 : HAL.Bit := 16#0#; -- Read-only. This field indicates the speed at which the device -- operates: 00b: reserved 01b: full-speed 10b: high-speed 11b: -- super-speed (reserved for future use). Speed : DEVCMDSTAT_Speed_Field := 16#0#; -- Device status - connect change. DCON_C : Boolean := False; -- Device status - suspend change. DSUS_C : Boolean := False; -- Device status - reset change. DRES_C : Boolean := False; -- unspecified Reserved_27_27 : HAL.Bit := 16#0#; -- Read-only. This bit indicates if VBUS is detected or not. VBUS_DEBOUNCED : Boolean := False; -- This field is written by firmware to put the PHY into a test mode as -- defined by the USB2.0 specification PHY_TEST_MODE : DEVCMDSTAT_PHY_TEST_MODE_Field := 16#0#; end record with Volatile_Full_Access, Size => 32, Bit_Order => System.Low_Order_First; for DEVCMDSTAT_Register use record DEV_ADDR at 0 range 0 .. 6; DEV_EN at 0 range 7 .. 7; SETUP at 0 range 8 .. 8; FORCE_NEEDCLK at 0 range 9 .. 9; Reserved_10_10 at 0 range 10 .. 10; LPM_SUP at 0 range 11 .. 11; INTONNAK_AO at 0 range 12 .. 12; INTONNAK_AI at 0 range 13 .. 13; INTONNAK_CO at 0 range 14 .. 14; INTONNAK_CI at 0 range 15 .. 15; DCON at 0 range 16 .. 16; DSUS at 0 range 17 .. 17; Reserved_18_18 at 0 range 18 .. 18; LPM_SUS at 0 range 19 .. 19; LPM_REWP at 0 range 20 .. 20; Reserved_21_21 at 0 range 21 .. 21; Speed at 0 range 22 .. 23; DCON_C at 0 range 24 .. 24; DSUS_C at 0 range 25 .. 25; DRES_C at 0 range 26 .. 26; Reserved_27_27 at 0 range 27 .. 27; VBUS_DEBOUNCED at 0 range 28 .. 28; PHY_TEST_MODE at 0 range 29 .. 31; end record; subtype INFO_FRAME_NR_Field is HAL.UInt11; subtype INFO_ERR_CODE_Field is HAL.UInt4; subtype INFO_MINREV_Field is HAL.UInt8; subtype INFO_MAJREV_Field is HAL.UInt8; -- USB Info register type INFO_Register is record -- Read-only. Frame number. FRAME_NR : INFO_FRAME_NR_Field; -- Read-only. The error code which last occurred:. ERR_CODE : INFO_ERR_CODE_Field; -- unspecified Reserved_15_15 : HAL.Bit; -- Read-only. Minor revision. MINREV : INFO_MINREV_Field; -- Read-only. Major revision. MAJREV : INFO_MAJREV_Field; end record with Volatile_Full_Access, Size => 32, Bit_Order => System.Low_Order_First; for INFO_Register use record FRAME_NR at 0 range 0 .. 10; ERR_CODE at 0 range 11 .. 14; Reserved_15_15 at 0 range 15 .. 15; MINREV at 0 range 16 .. 23; MAJREV at 0 range 24 .. 31; end record; subtype EPLISTSTART_EP_LIST_PRG_Field is HAL.UInt12; subtype EPLISTSTART_EP_LIST_FIXED_Field is HAL.UInt12; -- USB EP Command/Status List start address type EPLISTSTART_Register is record -- unspecified Reserved_0_7 : HAL.UInt8 := 16#0#; -- Programmable portion of the USB EP Command/Status List address. EP_LIST_PRG : EPLISTSTART_EP_LIST_PRG_Field := 16#0#; -- Read-only. Fixed portion of USB EP Command/Status List address. EP_LIST_FIXED : EPLISTSTART_EP_LIST_FIXED_Field := 16#0#; end record with Volatile_Full_Access, Size => 32, Bit_Order => System.Low_Order_First; for EPLISTSTART_Register use record Reserved_0_7 at 0 range 0 .. 7; EP_LIST_PRG at 0 range 8 .. 19; EP_LIST_FIXED at 0 range 20 .. 31; end record; subtype LPM_HIRD_HW_Field is HAL.UInt4; subtype LPM_HIRD_SW_Field is HAL.UInt4; -- USB Link Power Management register type LPM_Register is record -- Read-only. Host Initiated Resume Duration - HW. HIRD_HW : LPM_HIRD_HW_Field := 16#0#; -- Host Initiated Resume Duration - SW. HIRD_SW : LPM_HIRD_SW_Field := 16#0#; -- As long as this bit is set to one and LPM supported bit is set to -- one, HW will return a NYET handshake on every LPM token it receives. DATA_PENDING : Boolean := False; -- unspecified Reserved_9_31 : HAL.UInt23 := 16#0#; end record with Volatile_Full_Access, Size => 32, Bit_Order => System.Low_Order_First; for LPM_Register use record HIRD_HW at 0 range 0 .. 3; HIRD_SW at 0 range 4 .. 7; DATA_PENDING at 0 range 8 .. 8; Reserved_9_31 at 0 range 9 .. 31; end record; subtype EPSKIP_SKIP_Field is HAL.UInt12; -- USB Endpoint skip type EPSKIP_Register is record -- Endpoint skip: Writing 1 to one of these bits, will indicate to HW -- that it must deactivate the buffer assigned to this endpoint and -- return control back to software. SKIP : EPSKIP_SKIP_Field := 16#0#; -- unspecified Reserved_12_31 : HAL.UInt20 := 16#0#; end record with Volatile_Full_Access, Size => 32, Bit_Order => System.Low_Order_First; for EPSKIP_Register use record SKIP at 0 range 0 .. 11; Reserved_12_31 at 0 range 12 .. 31; end record; subtype EPINUSE_BUF_Field is HAL.UInt10; -- USB Endpoint Buffer in use type EPINUSE_Register is record -- unspecified Reserved_0_1 : HAL.UInt2 := 16#0#; -- Buffer in use: This register has one bit per physical endpoint. BUF : EPINUSE_BUF_Field := 16#0#; -- unspecified Reserved_12_31 : HAL.UInt20 := 16#0#; end record with Volatile_Full_Access, Size => 32, Bit_Order => System.Low_Order_First; for EPINUSE_Register use record Reserved_0_1 at 0 range 0 .. 1; BUF at 0 range 2 .. 11; Reserved_12_31 at 0 range 12 .. 31; end record; subtype EPBUFCFG_BUF_SB_Field is HAL.UInt10; -- USB Endpoint Buffer Configuration register type EPBUFCFG_Register is record -- unspecified Reserved_0_1 : HAL.UInt2 := 16#0#; -- Buffer usage: This register has one bit per physical endpoint. BUF_SB : EPBUFCFG_BUF_SB_Field := 16#0#; -- unspecified Reserved_12_31 : HAL.UInt20 := 16#0#; end record with Volatile_Full_Access, Size => 32, Bit_Order => System.Low_Order_First; for EPBUFCFG_Register use record Reserved_0_1 at 0 range 0 .. 1; BUF_SB at 0 range 2 .. 11; Reserved_12_31 at 0 range 12 .. 31; end record; -- USB interrupt status register type INTSTAT_Register is record -- Interrupt status register bit for the Control EP0 OUT direction. EP0OUT : Boolean := False; -- Interrupt status register bit for the Control EP0 IN direction. EP0IN : Boolean := False; -- Interrupt status register bit for the EP1 OUT direction. EP1OUT : Boolean := False; -- Interrupt status register bit for the EP1 IN direction. EP1IN : Boolean := False; -- Interrupt status register bit for the EP2 OUT direction. EP2OUT : Boolean := False; -- Interrupt status register bit for the EP2 IN direction. EP2IN : Boolean := False; -- Interrupt status register bit for the EP3 OUT direction. EP3OUT : Boolean := False; -- Interrupt status register bit for the EP3 IN direction. EP3IN : Boolean := False; -- Interrupt status register bit for the EP4 OUT direction. EP4OUT : Boolean := False; -- Interrupt status register bit for the EP4 IN direction. EP4IN : Boolean := False; -- Interrupt status register bit for the EP5 OUT direction. EP5OUT : Boolean := False; -- Interrupt status register bit for the EP5 IN direction. EP5IN : Boolean := False; -- unspecified Reserved_12_29 : HAL.UInt18 := 16#0#; -- Frame interrupt. FRAME_INT : Boolean := False; -- Device status interrupt. DEV_INT : Boolean := False; end record with Volatile_Full_Access, Size => 32, Bit_Order => System.Low_Order_First; for INTSTAT_Register use record EP0OUT at 0 range 0 .. 0; EP0IN at 0 range 1 .. 1; EP1OUT at 0 range 2 .. 2; EP1IN at 0 range 3 .. 3; EP2OUT at 0 range 4 .. 4; EP2IN at 0 range 5 .. 5; EP3OUT at 0 range 6 .. 6; EP3IN at 0 range 7 .. 7; EP4OUT at 0 range 8 .. 8; EP4IN at 0 range 9 .. 9; EP5OUT at 0 range 10 .. 10; EP5IN at 0 range 11 .. 11; Reserved_12_29 at 0 range 12 .. 29; FRAME_INT at 0 range 30 .. 30; DEV_INT at 0 range 31 .. 31; end record; subtype INTEN_EP_INT_EN_Field is HAL.UInt12; -- USB interrupt enable register type INTEN_Register is record -- If this bit is set and the corresponding USB interrupt status bit is -- set, a HW interrupt is generated on the interrupt line. EP_INT_EN : INTEN_EP_INT_EN_Field := 16#0#; -- unspecified Reserved_12_29 : HAL.UInt18 := 16#0#; -- If this bit is set and the corresponding USB interrupt status bit is -- set, a HW interrupt is generated on the interrupt line. FRAME_INT_EN : Boolean := False; -- If this bit is set and the corresponding USB interrupt status bit is -- set, a HW interrupt is generated on the interrupt line. DEV_INT_EN : Boolean := False; end record with Volatile_Full_Access, Size => 32, Bit_Order => System.Low_Order_First; for INTEN_Register use record EP_INT_EN at 0 range 0 .. 11; Reserved_12_29 at 0 range 12 .. 29; FRAME_INT_EN at 0 range 30 .. 30; DEV_INT_EN at 0 range 31 .. 31; end record; subtype INTSETSTAT_EP_SET_INT_Field is HAL.UInt12; -- USB set interrupt status register type INTSETSTAT_Register is record -- If software writes a one to one of these bits, the corresponding USB -- interrupt status bit is set. EP_SET_INT : INTSETSTAT_EP_SET_INT_Field := 16#0#; -- unspecified Reserved_12_29 : HAL.UInt18 := 16#0#; -- If software writes a one to one of these bits, the corresponding USB -- interrupt status bit is set. FRAME_SET_INT : Boolean := False; -- If software writes a one to one of these bits, the corresponding USB -- interrupt status bit is set. DEV_SET_INT : Boolean := False; end record with Volatile_Full_Access, Size => 32, Bit_Order => System.Low_Order_First; for INTSETSTAT_Register use record EP_SET_INT at 0 range 0 .. 11; Reserved_12_29 at 0 range 12 .. 29; FRAME_SET_INT at 0 range 30 .. 30; DEV_SET_INT at 0 range 31 .. 31; end record; subtype EPTOGGLE_TOGGLE_Field is HAL.UInt30; -- USB Endpoint toggle register type EPTOGGLE_Register is record -- Read-only. Endpoint data toggle: This field indicates the current -- value of the data toggle for the corresponding endpoint. TOGGLE : EPTOGGLE_TOGGLE_Field; -- unspecified Reserved_30_31 : HAL.UInt2; end record with Volatile_Full_Access, Size => 32, Bit_Order => System.Low_Order_First; for EPTOGGLE_Register use record TOGGLE at 0 range 0 .. 29; Reserved_30_31 at 0 range 30 .. 31; end record; ----------------- -- Peripherals -- ----------------- -- USB1 High-speed Device Controller type USBHSD_Peripheral is record -- USB Device Command/Status register DEVCMDSTAT : aliased DEVCMDSTAT_Register; -- USB Info register INFO : aliased INFO_Register; -- USB EP Command/Status List start address EPLISTSTART : aliased EPLISTSTART_Register; -- USB Data buffer start address DATABUFSTART : aliased HAL.UInt32; -- USB Link Power Management register LPM : aliased LPM_Register; -- USB Endpoint skip EPSKIP : aliased EPSKIP_Register; -- USB Endpoint Buffer in use EPINUSE : aliased EPINUSE_Register; -- USB Endpoint Buffer Configuration register EPBUFCFG : aliased EPBUFCFG_Register; -- USB interrupt status register INTSTAT : aliased INTSTAT_Register; -- USB interrupt enable register INTEN : aliased INTEN_Register; -- USB set interrupt status register INTSETSTAT : aliased INTSETSTAT_Register; -- USB Endpoint toggle register EPTOGGLE : aliased EPTOGGLE_Register; end record with Volatile; for USBHSD_Peripheral use record DEVCMDSTAT at 16#0# range 0 .. 31; INFO at 16#4# range 0 .. 31; EPLISTSTART at 16#8# range 0 .. 31; DATABUFSTART at 16#C# range 0 .. 31; LPM at 16#10# range 0 .. 31; EPSKIP at 16#14# range 0 .. 31; EPINUSE at 16#18# range 0 .. 31; EPBUFCFG at 16#1C# range 0 .. 31; INTSTAT at 16#20# range 0 .. 31; INTEN at 16#24# range 0 .. 31; INTSETSTAT at 16#28# range 0 .. 31; EPTOGGLE at 16#34# range 0 .. 31; end record; -- USB1 High-speed Device Controller USBHSD_Periph : aliased USBHSD_Peripheral with Import, Address => System'To_Address (16#40094000#); end NXP_SVD.USBHSD;
-- Copyright © by Jeff Foley 2020-2022. All rights reserved. -- Use of this source code is governed by Apache 2 LICENSE that can be found in the LICENSE file. -- SPDX-License-Identifier: Apache-2.0 local json = require("json") name = "Censys" type = "cert" function start() set_rate_limit(3) end function vertical(ctx, domain) local c local cfg = datasrc_config() if cfg ~= nil then c = cfg.credentials end if (c == nil or c.key == nil or c.key == "" or c.secret == nil or c.secret == "") then return end api_query(ctx, cfg, domain) end function api_query(ctx, cfg, domain) local p = 1 while(true) do local err, body, resp body, err = json.encode({ ['query']="parsed.names: " .. domain, ['page']=p, ['fields']={"parsed.names"}, }) if (err ~= nil and err ~= "") then return end resp, err = request(ctx, { method="POST", data=body, ['url']="https://www.censys.io/api/v1/search/certificates", headers={['Content-Type']="application/json"}, id=cfg["credentials"].key, pass=cfg["credentials"].secret, }) if (err ~= nil and err ~= "") then log(ctx, "vertical request to service failed: " .. err) return end local d = json.decode(resp) if (d == nil or d.status ~= "ok" or #(d.results) == 0) then return end for _, r in pairs(d.results) do for _, v in pairs(r["parsed.names"]) do new_name(ctx, v) end end if d["metadata"].page >= d["metadata"].pages then return end p = p + 1 end end
package body impact.d2.Joint.revolute is -- #include <Box2D/Dynamics/Joints/b2RevoluteJoint.h> -- #include <Box2D/Dynamics/b2Body.h> -- #include <Box2D/Dynamics/b2TimeStep.h> -- -- // Point-to-point constraint -- // C = p2 - p1 -- // Cdot = v2 - v1 -- // = v2 + cross(w2, r2) - v1 - cross(w1, r1) -- // J = [-I -r1_skew I r2_skew ] -- // Identity used: -- // w k % (rx i + ry j) = w * (-ry i + rx j) -- -- // Motor constraint -- // Cdot = w2 - w1 -- // J = [0 0 -1 0 0 1] -- // K = invI1 + invI2 -- -- void b2RevoluteJointDef::Initialize(b2Body* b1, b2Body* b2, const b2Vec2& anchor) -- { -- bodyA = b1; -- bodyB = b2; -- localAnchorA = bodyA->GetLocalPoint(anchor); -- localAnchorB = bodyB->GetLocalPoint(anchor); -- referenceAngle = bodyB->GetAngle() - bodyA->GetAngle(); -- } -- -- b2RevoluteJoint::b2RevoluteJoint(const b2RevoluteJointDef* def) -- : b2Joint(def) -- { -- m_localAnchor1 = def->localAnchorA; -- m_localAnchor2 = def->localAnchorB; -- m_referenceAngle = def->referenceAngle; -- -- m_impulse.SetZero(); -- m_motorImpulse = 0.0f; -- -- m_lowerAngle = def->lowerAngle; -- m_upperAngle = def->upperAngle; -- m_maxMotorTorque = def->maxMotorTorque; -- m_motorSpeed = def->motorSpeed; -- m_enableLimit = def->enableLimit; -- m_enableMotor = def->enableMotor; -- m_limitState = e_inactiveLimit; -- } -- -- void b2RevoluteJoint::InitVelocityConstraints(const b2TimeStep& step) -- { -- b2Body* b1 = m_bodyA; -- b2Body* b2 = m_bodyB; -- -- if (m_enableMotor || m_enableLimit) -- { -- // You cannot create a rotation limit between bodies that -- // both have fixed rotation. -- b2Assert(b1->m_invI > 0.0f || b2->m_invI > 0.0f); -- } -- -- // Compute the effective mass matrix. -- b2Vec2 r1 = b2Mul(b1->GetTransform().R, m_localAnchor1 - b1->GetLocalCenter()); -- b2Vec2 r2 = b2Mul(b2->GetTransform().R, m_localAnchor2 - b2->GetLocalCenter()); -- -- // J = [-I -r1_skew I r2_skew] -- // [ 0 -1 0 1] -- // r_skew = [-ry; rx] -- -- // Matlab -- // K = [ m1+r1y^2*i1+m2+r2y^2*i2, -r1y*i1*r1x-r2y*i2*r2x, -r1y*i1-r2y*i2] -- // [ -r1y*i1*r1x-r2y*i2*r2x, m1+r1x^2*i1+m2+r2x^2*i2, r1x*i1+r2x*i2] -- // [ -r1y*i1-r2y*i2, r1x*i1+r2x*i2, i1+i2] -- -- float32 m1 = b1->m_invMass, m2 = b2->m_invMass; -- float32 i1 = b1->m_invI, i2 = b2->m_invI; -- -- m_mass.col1.x = m1 + m2 + r1.y * r1.y * i1 + r2.y * r2.y * i2; -- m_mass.col2.x = -r1.y * r1.x * i1 - r2.y * r2.x * i2; -- m_mass.col3.x = -r1.y * i1 - r2.y * i2; -- m_mass.col1.y = m_mass.col2.x; -- m_mass.col2.y = m1 + m2 + r1.x * r1.x * i1 + r2.x * r2.x * i2; -- m_mass.col3.y = r1.x * i1 + r2.x * i2; -- m_mass.col1.z = m_mass.col3.x; -- m_mass.col2.z = m_mass.col3.y; -- m_mass.col3.z = i1 + i2; -- -- m_motorMass = i1 + i2; -- if (m_motorMass > 0.0f) -- { -- m_motorMass = 1.0f / m_motorMass; -- } -- -- if (m_enableMotor == false) -- { -- m_motorImpulse = 0.0f; -- } -- -- if (m_enableLimit) -- { -- float32 jointAngle = b2->m_sweep.a - b1->m_sweep.a - m_referenceAngle; -- if (b2Abs(m_upperAngle - m_lowerAngle) < 2.0f * b2_angularSlop) -- { -- m_limitState = e_equalLimits; -- } -- else if (jointAngle <= m_lowerAngle) -- { -- if (m_limitState != e_atLowerLimit) -- { -- m_impulse.z = 0.0f; -- } -- m_limitState = e_atLowerLimit; -- } -- else if (jointAngle >= m_upperAngle) -- { -- if (m_limitState != e_atUpperLimit) -- { -- m_impulse.z = 0.0f; -- } -- m_limitState = e_atUpperLimit; -- } -- else -- { -- m_limitState = e_inactiveLimit; -- m_impulse.z = 0.0f; -- } -- } -- else -- { -- m_limitState = e_inactiveLimit; -- } -- -- if (step.warmStarting) -- { -- // Scale impulses to support a variable time step. -- m_impulse *= step.dtRatio; -- m_motorImpulse *= step.dtRatio; -- -- b2Vec2 P(m_impulse.x, m_impulse.y); -- -- b1->m_linearVelocity -= m1 * P; -- b1->m_angularVelocity -= i1 * (b2Cross(r1, P) + m_motorImpulse + m_impulse.z); -- -- b2->m_linearVelocity += m2 * P; -- b2->m_angularVelocity += i2 * (b2Cross(r2, P) + m_motorImpulse + m_impulse.z); -- } -- else -- { -- m_impulse.SetZero(); -- m_motorImpulse = 0.0f; -- } -- } -- -- void b2RevoluteJoint::SolveVelocityConstraints(const b2TimeStep& step) -- { -- b2Body* b1 = m_bodyA; -- b2Body* b2 = m_bodyB; -- -- b2Vec2 v1 = b1->m_linearVelocity; -- float32 w1 = b1->m_angularVelocity; -- b2Vec2 v2 = b2->m_linearVelocity; -- float32 w2 = b2->m_angularVelocity; -- -- float32 m1 = b1->m_invMass, m2 = b2->m_invMass; -- float32 i1 = b1->m_invI, i2 = b2->m_invI; -- -- // Solve motor constraint. -- if (m_enableMotor && m_limitState != e_equalLimits) -- { -- float32 Cdot = w2 - w1 - m_motorSpeed; -- float32 impulse = m_motorMass * (-Cdot); -- float32 oldImpulse = m_motorImpulse; -- float32 maxImpulse = step.dt * m_maxMotorTorque; -- m_motorImpulse = b2Clamp(m_motorImpulse + impulse, -maxImpulse, maxImpulse); -- impulse = m_motorImpulse - oldImpulse; -- -- w1 -= i1 * impulse; -- w2 += i2 * impulse; -- } -- -- // Solve limit constraint. -- if (m_enableLimit && m_limitState != e_inactiveLimit) -- { -- b2Vec2 r1 = b2Mul(b1->GetTransform().R, m_localAnchor1 - b1->GetLocalCenter()); -- b2Vec2 r2 = b2Mul(b2->GetTransform().R, m_localAnchor2 - b2->GetLocalCenter()); -- -- // Solve point-to-point constraint -- b2Vec2 Cdot1 = v2 + b2Cross(w2, r2) - v1 - b2Cross(w1, r1); -- float32 Cdot2 = w2 - w1; -- b2Vec3 Cdot(Cdot1.x, Cdot1.y, Cdot2); -- -- b2Vec3 impulse = m_mass.Solve33(-Cdot); -- -- if (m_limitState == e_equalLimits) -- { -- m_impulse += impulse; -- } -- else if (m_limitState == e_atLowerLimit) -- { -- float32 newImpulse = m_impulse.z + impulse.z; -- if (newImpulse < 0.0f) -- { -- b2Vec2 reduced = m_mass.Solve22(-Cdot1); -- impulse.x = reduced.x; -- impulse.y = reduced.y; -- impulse.z = -m_impulse.z; -- m_impulse.x += reduced.x; -- m_impulse.y += reduced.y; -- m_impulse.z = 0.0f; -- } -- } -- else if (m_limitState == e_atUpperLimit) -- { -- float32 newImpulse = m_impulse.z + impulse.z; -- if (newImpulse > 0.0f) -- { -- b2Vec2 reduced = m_mass.Solve22(-Cdot1); -- impulse.x = reduced.x; -- impulse.y = reduced.y; -- impulse.z = -m_impulse.z; -- m_impulse.x += reduced.x; -- m_impulse.y += reduced.y; -- m_impulse.z = 0.0f; -- } -- } -- -- b2Vec2 P(impulse.x, impulse.y); -- -- v1 -= m1 * P; -- w1 -= i1 * (b2Cross(r1, P) + impulse.z); -- -- v2 += m2 * P; -- w2 += i2 * (b2Cross(r2, P) + impulse.z); -- } -- else -- { -- b2Vec2 r1 = b2Mul(b1->GetTransform().R, m_localAnchor1 - b1->GetLocalCenter()); -- b2Vec2 r2 = b2Mul(b2->GetTransform().R, m_localAnchor2 - b2->GetLocalCenter()); -- -- // Solve point-to-point constraint -- b2Vec2 Cdot = v2 + b2Cross(w2, r2) - v1 - b2Cross(w1, r1); -- b2Vec2 impulse = m_mass.Solve22(-Cdot); -- -- m_impulse.x += impulse.x; -- m_impulse.y += impulse.y; -- -- v1 -= m1 * impulse; -- w1 -= i1 * b2Cross(r1, impulse); -- -- v2 += m2 * impulse; -- w2 += i2 * b2Cross(r2, impulse); -- } -- -- b1->m_linearVelocity = v1; -- b1->m_angularVelocity = w1; -- b2->m_linearVelocity = v2; -- b2->m_angularVelocity = w2; -- } -- -- bool b2RevoluteJoint::SolvePositionConstraints(float32 baumgarte) -- { -- // TODO_ERIN block solve with limit. -- -- B2_NOT_USED(baumgarte); -- -- b2Body* b1 = m_bodyA; -- b2Body* b2 = m_bodyB; -- -- float32 angularError = 0.0f; -- float32 positionError = 0.0f; -- -- // Solve angular limit constraint. -- if (m_enableLimit && m_limitState != e_inactiveLimit) -- { -- float32 angle = b2->m_sweep.a - b1->m_sweep.a - m_referenceAngle; -- float32 limitImpulse = 0.0f; -- -- if (m_limitState == e_equalLimits) -- { -- // Prevent large angular corrections -- float32 C = b2Clamp(angle - m_lowerAngle, -b2_maxAngularCorrection, b2_maxAngularCorrection); -- limitImpulse = -m_motorMass * C; -- angularError = b2Abs(C); -- } -- else if (m_limitState == e_atLowerLimit) -- { -- float32 C = angle - m_lowerAngle; -- angularError = -C; -- -- // Prevent large angular corrections and allow some slop. -- C = b2Clamp(C + b2_angularSlop, -b2_maxAngularCorrection, 0.0f); -- limitImpulse = -m_motorMass * C; -- } -- else if (m_limitState == e_atUpperLimit) -- { -- float32 C = angle - m_upperAngle; -- angularError = C; -- -- // Prevent large angular corrections and allow some slop. -- C = b2Clamp(C - b2_angularSlop, 0.0f, b2_maxAngularCorrection); -- limitImpulse = -m_motorMass * C; -- } -- -- b1->m_sweep.a -= b1->m_invI * limitImpulse; -- b2->m_sweep.a += b2->m_invI * limitImpulse; -- -- b1->SynchronizeTransform(); -- b2->SynchronizeTransform(); -- } -- -- // Solve point-to-point constraint. -- { -- b2Vec2 r1 = b2Mul(b1->GetTransform().R, m_localAnchor1 - b1->GetLocalCenter()); -- b2Vec2 r2 = b2Mul(b2->GetTransform().R, m_localAnchor2 - b2->GetLocalCenter()); -- -- b2Vec2 C = b2->m_sweep.c + r2 - b1->m_sweep.c - r1; -- positionError = C.Length(); -- -- float32 invMass1 = b1->m_invMass, invMass2 = b2->m_invMass; -- float32 invI1 = b1->m_invI, invI2 = b2->m_invI; -- -- // Handle large detachment. -- const float32 k_allowedStretch = 10.0f * b2_linearSlop; -- if (C.LengthSquared() > k_allowedStretch * k_allowedStretch) -- { -- // Use a particle solution (no rotation). -- b2Vec2 u = C; u.Normalize(); -- float32 m = invMass1 + invMass2; -- if (m > 0.0f) -- { -- m = 1.0f / m; -- } -- b2Vec2 impulse = m * (-C); -- const float32 k_beta = 0.5f; -- b1->m_sweep.c -= k_beta * invMass1 * impulse; -- b2->m_sweep.c += k_beta * invMass2 * impulse; -- -- C = b2->m_sweep.c + r2 - b1->m_sweep.c - r1; -- } -- -- b2Mat22 K1; -- K1.col1.x = invMass1 + invMass2; K1.col2.x = 0.0f; -- K1.col1.y = 0.0f; K1.col2.y = invMass1 + invMass2; -- -- b2Mat22 K2; -- K2.col1.x = invI1 * r1.y * r1.y; K2.col2.x = -invI1 * r1.x * r1.y; -- K2.col1.y = -invI1 * r1.x * r1.y; K2.col2.y = invI1 * r1.x * r1.x; -- -- b2Mat22 K3; -- K3.col1.x = invI2 * r2.y * r2.y; K3.col2.x = -invI2 * r2.x * r2.y; -- K3.col1.y = -invI2 * r2.x * r2.y; K3.col2.y = invI2 * r2.x * r2.x; -- -- b2Mat22 K = K1 + K2 + K3; -- b2Vec2 impulse = K.Solve(-C); -- -- b1->m_sweep.c -= b1->m_invMass * impulse; -- b1->m_sweep.a -= b1->m_invI * b2Cross(r1, impulse); -- -- b2->m_sweep.c += b2->m_invMass * impulse; -- b2->m_sweep.a += b2->m_invI * b2Cross(r2, impulse); -- -- b1->SynchronizeTransform(); -- b2->SynchronizeTransform(); -- } -- -- return positionError <= b2_linearSlop && angularError <= b2_angularSlop; -- } -- -- b2Vec2 b2RevoluteJoint::GetAnchorA() const -- { -- return m_bodyA->GetWorldPoint(m_localAnchor1); -- } -- -- b2Vec2 b2RevoluteJoint::GetAnchorB() const -- { -- return m_bodyB->GetWorldPoint(m_localAnchor2); -- } -- -- b2Vec2 b2RevoluteJoint::GetReactionForce(float32 inv_dt) const -- { -- b2Vec2 P(m_impulse.x, m_impulse.y); -- return inv_dt * P; -- } -- -- float32 b2RevoluteJoint::GetReactionTorque(float32 inv_dt) const -- { -- return inv_dt * m_impulse.z; -- } -- -- float32 b2RevoluteJoint::GetJointAngle() const -- { -- b2Body* b1 = m_bodyA; -- b2Body* b2 = m_bodyB; -- return b2->m_sweep.a - b1->m_sweep.a - m_referenceAngle; -- } -- -- float32 b2RevoluteJoint::GetJointSpeed() const -- { -- b2Body* b1 = m_bodyA; -- b2Body* b2 = m_bodyB; -- return b2->m_angularVelocity - b1->m_angularVelocity; -- } -- -- bool b2RevoluteJoint::IsMotorEnabled() const -- { -- return m_enableMotor; -- } -- -- void b2RevoluteJoint::EnableMotor(bool flag) -- { -- m_bodyA->SetAwake(true); -- m_bodyB->SetAwake(true); -- m_enableMotor = flag; -- } -- -- float32 b2RevoluteJoint::GetMotorTorque() const -- { -- return m_motorImpulse; -- } -- -- void b2RevoluteJoint::SetMotorSpeed(float32 speed) -- { -- m_bodyA->SetAwake(true); -- m_bodyB->SetAwake(true); -- m_motorSpeed = speed; -- } -- -- void b2RevoluteJoint::SetMaxMotorTorque(float32 torque) -- { -- m_bodyA->SetAwake(true); -- m_bodyB->SetAwake(true); -- m_maxMotorTorque = torque; -- } -- -- bool b2RevoluteJoint::IsLimitEnabled() const -- { -- return m_enableLimit; -- } -- -- void b2RevoluteJoint::EnableLimit(bool flag) -- { -- m_bodyA->SetAwake(true); -- m_bodyB->SetAwake(true); -- m_enableLimit = flag; -- } -- -- float32 b2RevoluteJoint::GetLowerLimit() const -- { -- return m_lowerAngle; -- } -- -- float32 b2RevoluteJoint::GetUpperLimit() const -- { -- return m_upperAngle; -- } -- -- void b2RevoluteJoint::SetLimits(float32 lower, float32 upper) -- { -- b2Assert(lower <= upper); -- m_bodyA->SetAwake(true); -- m_bodyB->SetAwake(true); -- m_lowerAngle = lower; -- m_upperAngle = upper; -- } procedure dummy is begin null; end dummy; end impact.d2.Joint.revolute;
-- This file is generated by SWIG. Please do not modify by hand. -- with Interfaces.C; with Interfaces.C; with Interfaces.C.Pointers; package xcb.xcb_glx_get_pixel_mapfv_cookie_t is -- Item -- type Item is record sequence : aliased Interfaces.C.unsigned; end record; -- Item_Array -- type Item_Array is array (Interfaces.C .size_t range <>) of aliased xcb.xcb_glx_get_pixel_mapfv_cookie_t .Item; -- Pointer -- package C_Pointers is new Interfaces.C.Pointers (Index => Interfaces.C.size_t, Element => xcb.xcb_glx_get_pixel_mapfv_cookie_t.Item, Element_Array => xcb.xcb_glx_get_pixel_mapfv_cookie_t.Item_Array, Default_Terminator => (others => <>)); subtype Pointer is C_Pointers.Pointer; -- Pointer_Array -- type Pointer_Array is array (Interfaces.C .size_t range <>) of aliased xcb.xcb_glx_get_pixel_mapfv_cookie_t .Pointer; -- Pointer_Pointer -- package C_Pointer_Pointers is new Interfaces.C.Pointers (Index => Interfaces.C.size_t, Element => xcb.xcb_glx_get_pixel_mapfv_cookie_t.Pointer, Element_Array => xcb.xcb_glx_get_pixel_mapfv_cookie_t.Pointer_Array, Default_Terminator => null); subtype Pointer_Pointer is C_Pointer_Pointers.Pointer; end xcb.xcb_glx_get_pixel_mapfv_cookie_t;
------------------------------------------------------------------------------ -- -- -- Ada User Repository Annex (AURA) -- -- ANNEXI-STRAYLINE Reference Implementation -- -- -- -- Command Line Interface -- -- -- -- ------------------------------------------------------------------------ -- -- -- -- Copyright (C) 2020, 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. -- -- -- ------------------------------------------------------------------------------ with Ada.Text_IO; with Ada.Streams; with Ada.Directories; with Ada.Strings.Bounded; with Ada.Characters.Conversions; with Ada.Strings.UTF_Encoding.Wide_Wide_Strings; with Platform_Info; with Child_Processes; with Child_Processes.Path_Searching; with Child_Processes.Wait_And_Buffer; separate (Configuration) procedure Step_3b (Target: in out Subsystem) is package ACC renames Ada.Characters.Conversions; package UTF_8 renames Ada.Strings.UTF_Encoding.Wide_Wide_Strings; package Subsystems renames Registrar.Subsystems; Config_Package_Name: constant Wide_Wide_String := Config_Unit_Name (Target).To_String; Config_Build_Root: constant String := "./.aura/cfg_tmp" & '/' & ACC.To_String (Target.Name.To_String); package Program_Paths renames Child_Processes.Path_Searching; GNAT_Make_Program: aliased constant String := "gnatmake"; GNAT_Make: constant Program_Paths.Elaboration_Path_Search := Program_Paths.Initialize (GNAT_Make_Program); -- Note that this is for the native gnatmake, not the target gnatmake. -- We are using it to compile the generated extraction program that -- retrieves the configuration values from the AURA package configuration, -- hence we don't append the Toolchain_Prefix. -- -- Obviously this is GNAT-specific, one day it might make sense to -- hand-write an internal compile-bind-link subprogram to make AURA more -- portable -- Wait_And_Buffer instantiation package Output_Buffers is new Ada.Strings.Bounded.Generic_Bounded_Length (2048); procedure Buffer_Append (Buffer: in out Output_Buffers.Bounded_String; Item : in String) is begin Output_Buffers.Append (Source => Buffer, New_Item => Item); end Buffer_Append; procedure Wait_And_Buffer is new Child_Processes.Wait_And_Buffer (Buffer_Type => Output_Buffers.Bounded_String, Append => Buffer_Append, Empty_Buffer => Output_Buffers.Null_Bounded_String); -- These are to catch errors in the compilation process, mostly package TIO renames Ada.Text_IO; Out_File: TIO.File_Type; Tab: constant String := (1 .. 4 => ' '); procedure NL (File : in TIO.File_Type := Out_File; Spacing: in TIO.Positive_Count := 1) renames TIO.New_Line; procedure Put (Item: in String; File: in TIO.File_Type := Out_File) is begin TIO.Put (File, Item); end Put; procedure Gen_Loader (Package_Name: Wide_Wide_String; Configs : Subsystems.Configuration_Vector) is -- String'Output (STDOUT, AURA.Subsystem.Package_Name.Element); Target_Prefix: constant String := UTF_8.Encode (Config_Package_Name & '.' & Package_Name); begin for Item of Configs loop Put (Tab & "String'Output (STDOUT, " & Target_Prefix & '.' & UTF_8.Encode (WWU.To_Wide_Wide_String (Item.Name)) & ");"); NL; end loop; NL; end Gen_Loader; procedure Load (Stream : not null access Ada.Streams.Root_Stream_Type'Class; Configs: in out Subsystems.Configuration_Vector) is use Subsystems.Configuration_Vectors; begin for Item of Configs loop Item.Value := UBS.To_Unbounded_String (String'Input (Stream)); end loop; -- Now remove any items with an empty value, start from the "bottom up" -- to try to make it a little more efficient for I in reverse Configs.First_Index .. Configs.Last_Index loop if UBS.Length (Configs(I).Value) = 0 then Configs.Delete (I); end if; end loop; end Load; begin declare use Ada.Directories; begin if Exists (Config_Build_Root) then Delete_Tree (Config_Build_Root); end if; Create_Path (Config_Build_Root); end; -- Phase one: generate the extraction program TIO.Create (File => Out_File, Mode => TIO.Out_File, Name => Config_Build_Root & '/' & "extract.adb"); Put ("with " & UTF_8.Encode (Config_Package_Name) & ';'); NL; Put ("with Ada.Text_IO.Text_Streams; use Ada.Text_IO.Text_Streams;"); NL; NL; Put ("procedure Extract is"); NL; Put (Tab & "STDOUT: constant Stream_Access "); Put (":= Stream (Ada.Text_IO.Standard_Output);"); NL; Put ("begin"); NL; NL; Gen_Loader ("build.external_libraries", Target.Configuration.External_Libraries); Gen_Loader ("build.ada.compiler_options", Target.Configuration.Ada_Compiler_Opts); Gen_Loader ("build.c.compiler_options", Target.Configuration.C_Compiler_Opts); Gen_Loader ("build.c.preprocessor_definitions", Target.Configuration.C_Definitions); Gen_Loader ("codepaths", Target.Configuration.Codepaths); Gen_Loader ("information", Target.Configuration.Information); Put ("end Extract;"); NL; TIO.Close (Out_File); -- Phase two: compile the extraction program declare use Child_Processes; use Output_Buffers; STDOUT, STDERR: Bounded_String; Compiler: Child_Process'Class := Spawn_Process (Image_Path => Program_Paths.Image_Path (GNAT_Make), Arguments => "-I../../../ extract.adb", Working_Directory => Config_Build_Root); Timed_Out: Boolean; Status : Exit_Status; begin Wait_And_Buffer (Process => Compiler, Poll_Rate => 0.1, Timeout => 120.0, Output => STDOUT, Error => STDERR, Timed_Out => Timed_Out, Status => Status); Assert (Check => not Timed_Out and then Status = Success, Message => New_Line & "Compilation of the configuration extraction " & "program failed" & (if Timed_Out then "(Timed out)" else "") & ':' & New_Line & To_String (STDERR)); end; -- Phase three: run the extraction program declare use Child_Processes; use Output_Buffers; STDERR_Buffer: Bounded_String; Extractor: Child_Process'Class := Spawn_Process (Image_Path => Config_Build_Root & "/extract", Arguments => "", Working_Directory => Ada.Directories.Current_Directory); Timed_Out: Boolean; Status : Exit_Status; begin Extractor.Set_Stream_Timeout (Selector => Standard_Output, Timeout => 30.0); declare STDOUT: constant not null access Ada.Streams.Root_Stream_Type'Class := Extractor.IO_Stream (Standard_Output); begin Load (STDOUT, Target.Configuration.External_Libraries); Load (STDOUT, Target.Configuration.Ada_Compiler_Opts ); Load (STDOUT, Target.Configuration.C_Compiler_Opts ); Load (STDOUT, Target.Configuration.C_Definitions ); Load (STDOUT, Target.Configuration.Codepaths ); Load (STDOUT, Target.Configuration.Information ); end; Extractor.Wait_Terminated (Timeout => 10.0, Timed_Out => Timed_Out, Status => Status); if Timed_Out then raise Ada.Assertions.Assertion_Error with "Extractor program timed-out"; elsif Status /= Success then -- Attempt to flush STDERR declare STDERR: constant not null access Ada.Streams.Root_Stream_Type'Class := Extractor.IO_Stream (Standard_Error); C: Character; begin loop Character'Read (STDERR, C); Append (Source => STDERR_Buffer, New_Item => C); end loop; exception when others => null; end; raise Ada.Assertions.Assertion_Error with "Extractor program failed:" & New_Line & To_String (STDERR_Buffer); end if; end; Step_4 (Target); end Step_3b;
with TEXT_IO; package WORD_PARAMETERS is -- This package defines a number of parameters that areused in the program -- The default values are set in the body, so that they may be changed easily CHANGE_PARAMETERS_CHARACTER : CHARACTER := '#'; CHANGE_LANGUAGE_CHARACTER : CHARACTER := '~'; HELP_CHARACTER : CHARACTER := '?'; -- These files are used by the program if requested, but not necessary -- They are all text files and human readable -- MODE_FILE is used by the program to remember MODE values between runs MODE_FILE : TEXT_IO.FILE_TYPE; -- OUTPUT is used to write out and save the results of a run OUTPUT : TEXT_IO.FILE_TYPE; INPUT : TEXT_IO.FILE_TYPE; -- UNKNOWNS is used to record the words that the program fails to find UNKNOWNS : TEXT_IO.FILE_TYPE; -- This is a flag to tell if there has been trimming for this word TRIMMED : BOOLEAN := FALSE; type MODE_TYPE is ( TRIM_OUTPUT, HAVE_OUTPUT_FILE, WRITE_OUTPUT_TO_FILE, DO_UNKNOWNS_ONLY, WRITE_UNKNOWNS_TO_FILE, IGNORE_UNKNOWN_NAMES, IGNORE_UNKNOWN_CAPS, DO_COMPOUNDS, DO_FIXES, DO_TRICKS, DO_DICTIONARY_FORMS, SHOW_AGE, SHOW_FREQUENCY, DO_EXAMPLES, DO_ONLY_MEANINGS, DO_STEMS_FOR_UNKNOWN ); package MODE_TYPE_IO is new TEXT_IO.ENUMERATION_IO(MODE_TYPE); type MODE_ARRAY is array (MODE_TYPE) of BOOLEAN; WORDS_MODE : MODE_ARRAY; -- Initialized in body procedure CHANGE_PARAMETERS; procedure INITIALIZE_WORD_PARAMETERS; end WORD_PARAMETERS;
with Ada.Containers.Array_Sorting; with System.Long_Long_Integer_Types; procedure Ada.Containers.Generic_Sort (First, Last : Index_Type'Base) is subtype Word_Integer is System.Long_Long_Integer_Types.Word_Integer; begin if Index_Type'Pos (Index_Type'First) in Long_Long_Integer (Word_Integer'First) .. Long_Long_Integer (Word_Integer'Last) and then Index_Type'Pos (Index_Type'Last) in Long_Long_Integer (Word_Integer'First) .. Long_Long_Integer (Word_Integer'Last) then declare function LT (Left, Right : Word_Integer; Params : System.Address) return Boolean; function LT (Left, Right : Word_Integer; Params : System.Address) return Boolean is pragma Unreferenced (Params); Left_Index : constant Index_Type := Index_Type'Val (Left); Right_Index : constant Index_Type := Index_Type'Val (Right); begin return Before (Left_Index, Right_Index); end LT; procedure Swap ( Left, Right : Word_Integer; Params : System.Address); procedure Swap ( Left, Right : Word_Integer; Params : System.Address) is pragma Unreferenced (Params); Left_Index : constant Index_Type := Index_Type'Val (Left); Right_Index : constant Index_Type := Index_Type'Val (Right); begin Swap (Left_Index, Right_Index); end Swap; begin Array_Sorting.In_Place_Merge_Sort ( Index_Type'Pos (First), Index_Type'Pos (Last), System.Null_Address, LT => LT'Access, Swap => Swap'Access); end; else declare type Context_Type is limited record Offset : Long_Long_Integer; end record; pragma Suppress_Initialization (Context_Type); function LT (Left, Right : Word_Integer; Params : System.Address) return Boolean; function LT (Left, Right : Word_Integer; Params : System.Address) return Boolean is Context : Context_Type; for Context'Address use Params; Left_Index : constant Index_Type := Index_Type'Val (Long_Long_Integer (Left) + Context.Offset); Right_Index : constant Index_Type := Index_Type'Val (Long_Long_Integer (Right) + Context.Offset); begin return Before (Left_Index, Right_Index); end LT; procedure Swap ( Left, Right : Word_Integer; Params : System.Address); procedure Swap ( Left, Right : Word_Integer; Params : System.Address) is Context : Context_Type; for Context'Address use Params; Left_Index : constant Index_Type := Index_Type'Val (Long_Long_Integer (Left) + Context.Offset); Right_Index : constant Index_Type := Index_Type'Val (Long_Long_Integer (Right) + Context.Offset); begin Swap (Left_Index, Right_Index); end Swap; Offset : constant Long_Long_Integer := Index_Type'Pos (First); Context : aliased Context_Type := (Offset => Offset); begin Array_Sorting.In_Place_Merge_Sort ( 0, Word_Integer (Long_Long_Integer'(Index_Type'Pos (Last) - Offset)), Context'Address, LT => LT'Access, Swap => Swap'Access); end; end if; end Ada.Containers.Generic_Sort;
------------------------------------------------------------------------------ -- -- -- Copyright (C) 2016-2019, 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 Cortex_M.NVIC; with System.Machine_Code; use System.Machine_Code; package body nRF51.Interrupts is Handlers : array (nRF51.Interrupts.Interrupt_Name) of Handler := (others => null); procedure GNAT_IRQ_Handler; pragma Export (Asm, GNAT_IRQ_Handler, "__adl_irq_handler"); ------------------ -- Set_Priority -- ------------------ procedure Set_Priority (Int : Interrupt_Name; Prio : Interrupt_Priority) is begin Cortex_M.NVIC.Set_Priority (Int'Enum_Rep, Prio); end Set_Priority; ------------ -- Enable -- ------------ procedure Enable (Int : Interrupt_Name) is begin Cortex_M.NVIC.Enable_Interrupt (Int'Enum_Rep); end Enable; ------------- -- Disable -- ------------- procedure Disable (Int : Interrupt_Name) is begin Cortex_M.NVIC.Disable_Interrupt (Int'Enum_Rep); end Disable; ------------- -- Pending -- ------------- function Pending (Int : Interrupt_Name) return Boolean is begin return Cortex_M.NVIC.Pending (Int'Enum_Rep); end Pending; -------------- -- Register -- -------------- procedure Register (Id : nRF51.Interrupts.Interrupt_Name; Hdl : Handler) is begin Handlers (Id) := Hdl; end Register; ---------------------- -- GNAT_IRQ_Handler -- ---------------------- procedure GNAT_IRQ_Handler is Id : nRF51.Interrupts.Interrupt_Name; IPSR : UInt32; begin Asm ("mrs %0, ipsr", UInt32'Asm_Output ("=r", IPSR), Volatile => True); IPSR := IPSR and 16#FF#; Id := nRF51.Interrupts.Interrupt_Name'Val (IPSR - 16); if Handlers (Id) /= null then Handlers (Id).all; end if; end GNAT_IRQ_Handler; end nRF51.Interrupts;
------------------------------------------------------------------------------ -- -- -- Ada binding for OpenGL/WebGL -- -- -- -- Runtime Library Component -- -- -- ------------------------------------------------------------------------------ -- -- -- Copyright © 2016-2018, Vadim Godunko <vgodunko@gmail.com> -- -- All rights reserved. -- -- -- -- Redistribution and use in source and binary forms, with or without -- -- modification, are permitted provided that the following conditions -- -- are met: -- -- -- -- * Redistributions of source code must retain the above copyright -- -- notice, this list of conditions and the following disclaimer. -- -- -- -- * Redistributions in binary form must reproduce the above copyright -- -- notice, this list of conditions and the following disclaimer in the -- -- documentation and/or other materials provided with the distribution. -- -- -- -- * Neither the name of the Vadim Godunko, IE nor the names of its -- -- contributors may be used to endorse or promote products derived from -- -- this software without specific prior written permission. -- -- -- -- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -- -- "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -- -- LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -- -- A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -- -- HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -- -- SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED -- -- TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -- -- PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -- -- LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -- -- NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -- -- SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -- -- -- ------------------------------------------------------------------------------ with OpenGL.Contexts.Internals; with OpenGL.Renderbuffers.Internals; with OpenGL.Textures.Internals; package body OpenGL.Framebuffers is use type WebAPI.WebGL.Framebuffers.WebGL_Framebuffer_Access; use type WebAPI.WebGL.Rendering_Contexts.WebGL_Rendering_Context_Access; ---------- -- Bind -- ---------- function Bind (Self : in out OpenGL_Framebuffer'Class) return Boolean is begin if Self.Context = null or Self.Context /= OpenGL.Contexts.Internals.Current_WebGL_Context or Self.Framebuffer = null then return False; end if; Self.Context.Bind_Framebuffer (WebAPI.WebGL.Rendering_Contexts.FRAMEBUFFER, Self.Framebuffer); return True; end Bind; ---------- -- Bind -- ---------- procedure Bind (Self : in out OpenGL_Framebuffer'Class) is begin if not Self.Bind then raise Program_Error; end if; end Bind; ------------ -- Create -- ------------ function Create (Self : in out OpenGL_Framebuffer'Class) return Boolean is begin if Self.Context = null then Self.Context := OpenGL.Contexts.Internals.Current_WebGL_Context; if Self.Context = null then return False; end if; end if; if Self.Framebuffer = null then Self.Framebuffer := Self.Context.Create_Framebuffer; if Self.Framebuffer = null then return False; end if; end if; return True; end Create; ------------ -- Create -- ------------ procedure Create (Self : in out OpenGL_Framebuffer'Class) is begin if not Self.Create then raise Program_Error; end if; end Create; ------------ -- Delete -- ------------ procedure Delete (Self : in out OpenGL_Framebuffer'Class) is begin if Self.Context = null or Self.Context /= OpenGL.Contexts.Internals.Current_WebGL_Context or Self.Framebuffer = null then return; end if; Self.Context.Delete_Framebuffer (Self.Framebuffer); Self.Framebuffer := null; Self.Context := null; end Delete; ----------------- -- Read_Pixels -- ----------------- procedure Read_Pixels (Self : in out OpenGL_Framebuffer'Class; X : OpenGL.GLint; Y : OpenGL.GLint; Width : OpenGL.GLsizei; Height : OpenGL.GLsizei; Data : out OpenGL.GLubyte_Vector_4_Array) is begin if Self.Context = null or Self.Context /= OpenGL.Contexts.Internals.Current_WebGL_Context or Self.Framebuffer = null then return; end if; Self.Context.Read_Pixels (WebAPI.WebGL.GLint (X), WebAPI.WebGL.GLint (Y), WebAPI.WebGL.GLsizei (Width), WebAPI.WebGL.GLsizei (Height), WebAPI.WebGL.Rendering_Contexts.RGBA, WebAPI.WebGL.Rendering_Contexts.UNSIGNED_BYTE, Data'Address); end Read_Pixels; ------------- -- Release -- ------------- procedure Release (Self : in out OpenGL_Framebuffer'Class) is begin if Self.Context = null or Self.Context /= OpenGL.Contexts.Internals.Current_WebGL_Context or Self.Framebuffer = null then return; end if; Self.Context.Bind_Framebuffer (WebAPI.WebGL.Rendering_Contexts.FRAMEBUFFER, null); end Release; ---------------------- -- Set_Renderbuffer -- ---------------------- procedure Set_Renderbuffer (Self : in out OpenGL_Framebuffer'Class; Renderbuffer : OpenGL.Renderbuffers.OpenGL_Renderbuffer'Class; Attachment : OpenGL.GLenum) is begin if Self.Context = null or Self.Context /= OpenGL.Contexts.Internals.Current_WebGL_Context or Self.Framebuffer = null then return; end if; Self.Context.Framebuffer_Renderbuffer (WebAPI.WebGL.Rendering_Contexts.FRAMEBUFFER, (case Attachment is when OpenGL.GL_COLOR_ATTACHMENT0 => WebAPI.WebGL.Rendering_Contexts.COLOR_ATTACHMENT0, when OpenGL.GL_DEPTH_ATTACHMENT => WebAPI.WebGL.Rendering_Contexts.DEPTH_ATTACHMENT, when OpenGL.GL_STENCIL_ATTACHMENT => WebAPI.WebGL.Rendering_Contexts.STENCIL_ATTACHMENT, when others => WebAPI.WebGL.Rendering_Contexts.COLOR_ATTACHMENT0), -- raise Constraint_Error), WebAPI.WebGL.Rendering_Contexts.RENDERBUFFER, OpenGL.Renderbuffers.Internals.Get_WebGL_Renderbuffer (Renderbuffer)); end Set_Renderbuffer; ----------------- -- Set_Texture -- ----------------- procedure Set_Texture (Self : in out OpenGL_Framebuffer'Class; Texture : OpenGL.Textures.OpenGL_Texture'Class; Attachment : OpenGL.GLenum) is begin if Self.Context = null or Self.Context /= OpenGL.Contexts.Internals.Current_WebGL_Context or Self.Framebuffer = null then return; end if; Self.Context.Framebuffer_Texture_2D (WebAPI.WebGL.Rendering_Contexts.FRAMEBUFFER, (case Attachment is when OpenGL.GL_COLOR_ATTACHMENT0 => WebAPI.WebGL.Rendering_Contexts.COLOR_ATTACHMENT0, when OpenGL.GL_DEPTH_ATTACHMENT => WebAPI.WebGL.Rendering_Contexts.DEPTH_ATTACHMENT, when OpenGL.GL_STENCIL_ATTACHMENT => WebAPI.WebGL.Rendering_Contexts.STENCIL_ATTACHMENT, when others => WebAPI.WebGL.Rendering_Contexts.COLOR_ATTACHMENT0), -- raise Constraint_Error), (case Texture.Texture_Type is when Texture_2D => WebAPI.WebGL.Rendering_Contexts.TEXTURE_2D, when Cube_Map_Positive_X => WebAPI.WebGL.Rendering_Contexts.TEXTURE_CUBE_MAP_POSITIVE_X, when Cube_Map_Negative_X => WebAPI.WebGL.Rendering_Contexts.TEXTURE_CUBE_MAP_NEGATIVE_X, when Cube_Map_Positive_Y => WebAPI.WebGL.Rendering_Contexts.TEXTURE_CUBE_MAP_POSITIVE_Y, when Cube_Map_Negative_Y => WebAPI.WebGL.Rendering_Contexts.TEXTURE_CUBE_MAP_NEGATIVE_Y, when Cube_Map_Positive_Z => WebAPI.WebGL.Rendering_Contexts.TEXTURE_CUBE_MAP_POSITIVE_Z, when Cube_Map_Negative_Z => WebAPI.WebGL.Rendering_Contexts.TEXTURE_CUBE_MAP_NEGATIVE_Z), OpenGL.Textures.Internals.Get_WebGL_Texture (Texture), 0); end Set_Texture; end OpenGL.Framebuffers;
with System.Tasks; with System.Debug; -- assertions with C.winbase; with C.windef; with C.winerror; package body System.Synchronous_Objects.Abortable is use type C.windef.DWORD; -- queue procedure Take ( Object : in out Queue; Item : out Queue_Node_Access; Params : Address; Filter : Queue_Filter; Aborted : out Boolean) is begin Aborted := Tasks.Is_Aborted; Enter (Object.Mutex.all); declare Previous : Queue_Node_Access := null; I : Queue_Node_Access := Object.Head; begin Taking : loop Take_No_Sync (Object, Item, Params, Filter, Previous, I); exit Taking when Item /= null; -- not found declare Tail_On_Waiting : constant Queue_Node_Access := Object.Tail; begin Object.Params := Params; Object.Filter := Filter; loop Object.Waiting := True; Leave (Object.Mutex.all); Wait (Object.Event, Aborted => Aborted); Enter (Object.Mutex.all); Object.Waiting := False; exit Taking when Aborted; exit when Object.Tail /= Tail_On_Waiting; end loop; if Tail_On_Waiting /= null then Previous := Tail_On_Waiting; I := Tail_On_Waiting.Next; else Previous := null; I := Object.Head; end if; end; end loop Taking; end; Leave (Object.Mutex.all); end Take; -- event procedure Wait ( Object : in out Event; Aborted : out Boolean) is Abort_Event : constant access Event := Tasks.Abort_Event; begin if Abort_Event /= null then declare Handles : aliased array (0 .. 1) of aliased C.winnt.HANDLE := (Object.Handle, Abort_Event.Handle); Signaled : C.windef.DWORD; begin Signaled := C.winbase.WaitForMultipleObjects ( 2, Handles (0)'Access, 0, C.winbase.INFINITE); pragma Check (Debug, Check => Signaled = C.winbase.WAIT_OBJECT_0 or else Signaled = C.winbase.WAIT_OBJECT_0 + 1 or else Debug.Runtime_Error ( "WaitForMultipleObjects failed")); Aborted := Signaled = C.winbase.WAIT_OBJECT_0 + 1; end; else Wait (Object); Aborted := Tasks.Is_Aborted; end if; end Wait; procedure Wait ( Object : in out Event; Timeout : Duration; Value : out Boolean; Aborted : out Boolean) is Abort_Event : constant access Event := Tasks.Abort_Event; begin if Abort_Event /= null then declare Handles : aliased array (0 .. 1) of aliased C.winnt.HANDLE := (Object.Handle, Abort_Event.Handle); Milliseconds : constant C.windef.DWORD := C.windef.DWORD (Timeout * 1_000); Signaled : C.windef.DWORD; begin Signaled := C.winbase.WaitForMultipleObjects ( 2, Handles (0)'Access, 0, Milliseconds); pragma Check (Debug, Check => Signaled = C.winbase.WAIT_OBJECT_0 or else Signaled = C.winbase.WAIT_OBJECT_0 + 1 or else Signaled = C.winerror.WAIT_TIMEOUT or else Debug.Runtime_Error ( "WaitForMultipleObjects failed")); Value := Signaled = C.winbase.WAIT_OBJECT_0 or else Get (Object); Aborted := Signaled = C.winbase.WAIT_OBJECT_0 + 1; end; else Wait (Object, Timeout, Value); Aborted := Tasks.Is_Aborted; end if; end Wait; end System.Synchronous_Objects.Abortable;
----------------------------------------------------------------------- -- ado.schemas -- Database Schemas -- Copyright (C) 2009, 2010, 2018 Stephane Carrez -- Written by Stephane Carrez (Stephane.Carrez@gmail.com) -- -- Licensed under the Apache License, Version 2.0 (the "License"); -- you may not use this file except in compliance with the License. -- You may obtain a copy of the License at -- -- http://www.apache.org/licenses/LICENSE-2.0 -- -- Unless required by applicable law or agreed to in writing, software -- distributed under the License is distributed on an "AS IS" BASIS, -- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -- See the License for the specific language governing permissions and -- limitations under the License. ----------------------------------------------------------------------- with Ada.Unchecked_Deallocation; with Ada.Strings.Equal_Case_Insensitive; package body ADO.Schemas is procedure Free is new Ada.Unchecked_Deallocation (Object => Column, Name => Column_Definition); procedure Free is new Ada.Unchecked_Deallocation (Object => Table, Name => Table_Definition); procedure Free is new Ada.Unchecked_Deallocation (Object => Schema, Name => Schema_Access); -- ------------------------------ -- Get the hash value associated with the class mapping. -- ------------------------------ function Hash (Mapping : Class_Mapping_Access) return Ada.Containers.Hash_Type is begin if Mapping = null then return 0; else return Util.Strings.Hash (Mapping.Table); end if; end Hash; -- ------------------------------ -- Column Representation -- ------------------------------ -- ------------------------------ -- Get the column name -- ------------------------------ function Get_Name (Column : Column_Definition) return String is begin return To_String (Column.Name); end Get_Name; -- ------------------------------ -- Get the column type -- ------------------------------ function Get_Type (Column : Column_Definition) return Column_Type is begin return Column.Col_Type; end Get_Type; -- ------------------------------ -- Get the default column value -- ------------------------------ function Get_Default (Column : Column_Definition) return String is begin return To_String (Column.Default); end Get_Default; -- ------------------------------ -- Get the column collation (for string based columns) -- ------------------------------ function Get_Collation (Column : Column_Definition) return String is begin return To_String (Column.Collation); end Get_Collation; -- ------------------------------ -- Check whether the column can be null -- ------------------------------ function Is_Null (Column : Column_Definition) return Boolean is begin return Column.Is_Null; end Is_Null; -- ------------------------------ -- Check whether the column is an unsigned number -- ------------------------------ function Is_Unsigned (Column : Column_Definition) return Boolean is begin return Column.Is_Unsigned; end Is_Unsigned; -- ------------------------------ -- Returns true if the column can hold a binary string -- ------------------------------ function Is_Binary (Column : Column_Definition) return Boolean is begin return Column.Is_Binary; end Is_Binary; -- ------------------------------ -- Returns true if the column is a primary key. -- ------------------------------ function Is_Primary (Column : Column_Definition) return Boolean is begin return Column.Is_Primary; end Is_Primary; -- ------------------------------ -- Get the column length -- ------------------------------ function Get_Size (Column : Column_Definition) return Natural is begin return Column.Size; end Get_Size; -- ------------------------------ -- Column iterator -- ------------------------------ -- ------------------------------ -- Returns true if the iterator contains more column -- ------------------------------ function Has_Element (Cursor : Column_Cursor) return Boolean is begin return Cursor.Current /= null; end Has_Element; -- ------------------------------ -- Move to the next column -- ------------------------------ procedure Next (Cursor : in out Column_Cursor) is begin if Cursor.Current /= null then Cursor.Current := Cursor.Current.Next_Column; end if; end Next; -- ------------------------------ -- Get the current column definition -- ------------------------------ function Element (Cursor : Column_Cursor) return Column_Definition is begin return Cursor.Current; end Element; -- ------------------------------ -- Table Representation -- ------------------------------ -- ------------------------------ -- Get the table name -- ------------------------------ function Get_Name (Table : Table_Definition) return String is begin return To_String (Table.Name); end Get_Name; -- ------------------------------ -- Get the column iterator -- ------------------------------ function Get_Columns (Table : Table_Definition) return Column_Cursor is begin return Column_Cursor '(Current => Table.First_Column); end Get_Columns; -- ------------------------------ -- Find the column having the given name -- ------------------------------ function Find_Column (Table : Table_Definition; Name : String) return Column_Definition is Column : Column_Definition := Table.First_Column; begin while Column /= null loop if Ada.Strings.Equal_Case_Insensitive (To_String (Column.Name), Name) then return Column; end if; Column := Column.Next_Column; end loop; return null; end Find_Column; -- ------------------------------ -- Table iterator -- ------------------------------ -- ------------------------------ -- Returns true if the iterator contains more tables -- ------------------------------ function Has_Element (Cursor : Table_Cursor) return Boolean is begin return Cursor.Current /= null; end Has_Element; -- ------------------------------ -- Move to the next column -- ------------------------------ procedure Next (Cursor : in out Table_Cursor) is begin if Cursor.Current /= null then Cursor.Current := Cursor.Current.Next_Table; end if; end Next; -- ------------------------------ -- Get the current table definition -- ------------------------------ function Element (Cursor : Table_Cursor) return Table_Definition is begin return Cursor.Current; end Element; -- ------------------------------ -- Database Schema -- ------------------------------ -- ------------------------------ -- Find a table knowing its name -- ------------------------------ function Find_Table (Schema : Schema_Definition; Name : String) return Table_Definition is Table : Table_Definition; begin if Schema.Schema /= null then Table := Schema.Schema.First_Table; while Table /= null loop if Ada.Strings.Equal_Case_Insensitive (To_String (Table.Name), Name) then return Table; end if; Table := Table.Next_Table; end loop; end if; return null; end Find_Table; function Get_Tables (Schema : Schema_Definition) return Table_Cursor is begin if Schema.Schema = null then return Table_Cursor '(Current => null); else return Table_Cursor '(Current => Schema.Schema.First_Table); end if; end Get_Tables; procedure Finalize (Schema : in out Schema_Definition) is begin if Schema.Schema /= null then declare Table : Table_Definition; Column : Column_Definition; begin loop Table := Schema.Schema.First_Table; exit when Table = null; loop Column := Table.First_Column; exit when Column = null; Table.First_Column := Column.Next_Column; Free (Column); end loop; Schema.Schema.First_Table := Table.Next_Table; Free (Table); end loop; end; Free (Schema.Schema); end if; end Finalize; end ADO.Schemas;
---------------------------------------------------------------- -- ZLib for Ada thick binding. -- -- -- -- Copyright (C) 2002-2003 Dmitriy Anisimkov -- -- -- -- Open source license information is in the zlib.ads file. -- ---------------------------------------------------------------- -- $Id: zlib-streams.adb,v 1.9 2003/08/12 13:15:31 vagul Exp $ with Ada.Unchecked_Deallocation; package body ZLib.Streams is ----------- -- Close -- ----------- procedure Close (Stream : in out Stream_Type) is procedure Free is new Ada.Unchecked_Deallocation (Stream_Element_Array, Buffer_Access); begin if Stream.Mode = Out_Stream or Stream.Mode = Duplex then -- We should flush the data written by the writer. Flush (Stream, Finish); Close (Stream.Writer); end if; if Stream.Mode = In_Stream or Stream.Mode = Duplex then Close (Stream.Reader); Free (Stream.Buffer); end if; end Close; ------------ -- Create -- ------------ procedure Create (Stream : out Stream_Type; Mode : in Stream_Mode; Back : in Stream_Access; Back_Compressed : in Boolean; Level : in Compression_Level := Default_Compression; Strategy : in Strategy_Type := Default_Strategy; Header : in Header_Type := Default; Read_Buffer_Size : in Ada.Streams.Stream_Element_Offset := Default_Buffer_Size; Write_Buffer_Size : in Ada.Streams.Stream_Element_Offset := Default_Buffer_Size) is subtype Buffer_Subtype is Stream_Element_Array (1 .. Read_Buffer_Size); procedure Init_Filter (Filter : in out Filter_Type; Compress : in Boolean); ----------------- -- Init_Filter -- ----------------- procedure Init_Filter (Filter : in out Filter_Type; Compress : in Boolean) is begin if Compress then Deflate_Init (Filter, Level, Strategy, Header => Header); else Inflate_Init (Filter, Header => Header); end if; end Init_Filter; begin Stream.Back := Back; Stream.Mode := Mode; if Mode = Out_Stream or Mode = Duplex then Init_Filter (Stream.Writer, Back_Compressed); Stream.Buffer_Size := Write_Buffer_Size; else Stream.Buffer_Size := 0; end if; if Mode = In_Stream or Mode = Duplex then Init_Filter (Stream.Reader, not Back_Compressed); Stream.Buffer := new Buffer_Subtype; Stream.Rest_First := Stream.Buffer'Last + 1; end if; end Create; ----------- -- Flush -- ----------- procedure Flush (Stream : in out Stream_Type; Mode : in Flush_Mode := Sync_Flush) is Buffer : Stream_Element_Array (1 .. Stream.Buffer_Size); Last : Stream_Element_Offset; begin loop Flush (Stream.Writer, Buffer, Last, Mode); Ada.Streams.Write (Stream.Back.all, Buffer (1 .. Last)); exit when Last < Buffer'Last; end loop; end Flush; ---------- -- Read -- ---------- procedure Read (Stream : in out Stream_Type; Item : out Stream_Element_Array; Last : out Stream_Element_Offset) is procedure Read (Item : out Stream_Element_Array; Last : out Stream_Element_Offset); ---------- -- Read -- ---------- procedure Read (Item : out Stream_Element_Array; Last : out Stream_Element_Offset) is begin Ada.Streams.Read (Stream.Back.all, Item, Last); end Read; procedure Read is new ZLib.Read (Read => Read, Buffer => Stream.Buffer.all, Rest_First => Stream.Rest_First, Rest_Last => Stream.Rest_Last); begin Read (Stream.Reader, Item, Last); end Read; ------------------- -- Read_Total_In -- ------------------- function Read_Total_In (Stream : in Stream_Type) return Count is begin return Total_In (Stream.Reader); end Read_Total_In; -------------------- -- Read_Total_Out -- -------------------- function Read_Total_Out (Stream : in Stream_Type) return Count is begin return Total_Out (Stream.Reader); end Read_Total_Out; ----------- -- Write -- ----------- procedure Write (Stream : in out Stream_Type; Item : in Stream_Element_Array) is procedure Write (Item : in Stream_Element_Array); ----------- -- Write -- ----------- procedure Write (Item : in Stream_Element_Array) is begin Ada.Streams.Write (Stream.Back.all, Item); end Write; procedure Write is new ZLib.Write (Write => Write, Buffer_Size => Stream.Buffer_Size); begin Write (Stream.Writer, Item, No_Flush); end Write; -------------------- -- Write_Total_In -- -------------------- function Write_Total_In (Stream : in Stream_Type) return Count is begin return Total_In (Stream.Writer); end Write_Total_In; --------------------- -- Write_Total_Out -- --------------------- function Write_Total_Out (Stream : in Stream_Type) return Count is begin return Total_Out (Stream.Writer); end Write_Total_Out; end ZLib.Streams;
-- { dg-do compile } -- { dg-options "-flto" { target lto } } procedure Lto2 (Nbytes : Natural) is type Message_T (Length : Natural) is record case Length is when 0 => null; when others => Id : Natural; end case; end record; type Local_Message_T is new Message_T (Nbytes); function One_message return Local_Message_T is M : Local_Message_T; begin if M.Length > 0 then M.Id := 1; end if; return M; end; procedure Process (X : Local_Message_T) is begin null; end; begin Process (One_Message); end;
------------------------------------------------------------------------------ -- -- -- Matreshka Project -- -- -- -- Ada Modeling Framework -- -- -- -- Runtime Library Component -- -- -- ------------------------------------------------------------------------------ -- -- -- Copyright © 2011-2012, Vadim Godunko <vgodunko@gmail.com> -- -- All rights reserved. -- -- -- -- Redistribution and use in source and binary forms, with or without -- -- modification, are permitted provided that the following conditions -- -- are met: -- -- -- -- * Redistributions of source code must retain the above copyright -- -- notice, this list of conditions and the following disclaimer. -- -- -- -- * Redistributions in binary form must reproduce the above copyright -- -- notice, this list of conditions and the following disclaimer in the -- -- documentation and/or other materials provided with the distribution. -- -- -- -- * Neither the name of the Vadim Godunko, IE nor the names of its -- -- contributors may be used to endorse or promote products derived from -- -- this software without specific prior written permission. -- -- -- -- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -- -- "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -- -- LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -- -- A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -- -- HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -- -- SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED -- -- TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -- -- PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -- -- LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -- -- NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -- -- SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -- -- -- ------------------------------------------------------------------------------ -- $Revision$ $Date$ ------------------------------------------------------------------------------ -- This file is generated, don't edit it. ------------------------------------------------------------------------------ with AMF.Generic_Collections; package AMF.UML.Template_Signatures.Collections is pragma Preelaborate; package UML_Template_Signature_Collections is new AMF.Generic_Collections (UML_Template_Signature, UML_Template_Signature_Access); type Set_Of_UML_Template_Signature is new UML_Template_Signature_Collections.Set with null record; Empty_Set_Of_UML_Template_Signature : constant Set_Of_UML_Template_Signature; type Ordered_Set_Of_UML_Template_Signature is new UML_Template_Signature_Collections.Ordered_Set with null record; Empty_Ordered_Set_Of_UML_Template_Signature : constant Ordered_Set_Of_UML_Template_Signature; type Bag_Of_UML_Template_Signature is new UML_Template_Signature_Collections.Bag with null record; Empty_Bag_Of_UML_Template_Signature : constant Bag_Of_UML_Template_Signature; type Sequence_Of_UML_Template_Signature is new UML_Template_Signature_Collections.Sequence with null record; Empty_Sequence_Of_UML_Template_Signature : constant Sequence_Of_UML_Template_Signature; private Empty_Set_Of_UML_Template_Signature : constant Set_Of_UML_Template_Signature := (UML_Template_Signature_Collections.Set with null record); Empty_Ordered_Set_Of_UML_Template_Signature : constant Ordered_Set_Of_UML_Template_Signature := (UML_Template_Signature_Collections.Ordered_Set with null record); Empty_Bag_Of_UML_Template_Signature : constant Bag_Of_UML_Template_Signature := (UML_Template_Signature_Collections.Bag with null record); Empty_Sequence_Of_UML_Template_Signature : constant Sequence_Of_UML_Template_Signature := (UML_Template_Signature_Collections.Sequence with null record); end AMF.UML.Template_Signatures.Collections;
with INFLECTIONS_PACKAGE; use INFLECTIONS_PACKAGE; with DICTIONARY_PACKAGE; use DICTIONARY_PACKAGE; package UNIQUES_PACKAGE is type UNIQUE_ITEM; type UNIQUE_LIST is access UNIQUE_ITEM; type UNIQUE_ITEM is record STEM : STEM_TYPE := NULL_STEM_TYPE; QUAL : QUALITY_RECORD := NULL_QUALITY_RECORD; KIND : KIND_ENTRY := NULL_KIND_ENTRY; MNPC : DICT_IO.COUNT := NULL_MNPC; SUCC : UNIQUE_LIST; end record; type LATIN_UNIQUES is array (CHARACTER range 'a'..'z') of UNIQUE_LIST; NULL_LATIN_UNIQUES : LATIN_UNIQUES := (others => null); UNQ : LATIN_UNIQUES := NULL_LATIN_UNIQUES; type UNIQUES_DE_ARRAY is array (DICT_IO.POSITIVE_COUNT range <>) of DICTIONARY_ENTRY; UNIQUES_DE : UNIQUES_DE_ARRAY(1..100) := (others => NULL_DICTIONARY_ENTRY); end UNIQUES_PACKAGE;
-------------------------------------------------------------------------------- -- * Spec name vector.ads -- * Project name ctffttest -- * -- * Version 1.0 -- * Last update 11/5/08 -- * -- * Created by Adrian Hoe on 11/5/08. -- * Copyright (c) 2008 AdaStar Informatics http://adastarinformatics.com -- * All rights reserved. -- * -------------------------------------------------------------------------------- with Ada.Numerics.Generic_Complex_Types; package Vector is subtype Index is Positive; subtype Real_Number is Long_Long_Float; package Complex_Types is new Ada.Numerics.Generic_Complex_Types (Real_Number); use Complex_Types; subtype Complex_Number is Complex; type Real_Vector_Type is array (Index range <>) of Real_Number; type Real_Vector_Handle is access Real_Vector_Type; type Complex_Vector_Type is array (Index range <>) of Complex_Number; type Complex_Vector_Handle is access Complex_Vector_Type; -- procedure Get (Num : out Real_Vector_Type); -- procedure Get (File : in File_Type; -- Num : out Real_Vector_Type); procedure Put (Data : in Real_Vector_Type; Width : in Integer := 1); -- procedure Put (File : in File_Type; -- Num : in Real_Vector_Type; -- Width : in Integer := 1); end Vector;
------------------------------------------------------------------------------ -- -- -- Copyright (C) 2018-2021, 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 Interfaces; package USB.Device.HID.Gamepad is Gamepad_Report_Size : constant := 7; subtype Parent is Abstract_HID_Class; type Instance is new Parent (Gamepad_Report_Size) with private; type Axis is (X, Y, Z, Rx, Ry, Rz); procedure Set_Axis (This : in out Instance; A : Axis; Value : Interfaces.Integer_8); -- Set value of stick axis procedure Set_Buttons (This : in out Instance; Buttons : UInt8); -- Set the buttons state private type Instance is new Abstract_HID_Class (Gamepad_Report_Size) with null record; HID_Gamepad_Report_Desc : aliased constant UInt8_Array := ( -- https://gist.github.com/wereii/b215c799a267af10154087b5d5af3a6b 16#05#, 16#01#, -- USAGE_PAGE (Generic Desktop) 16#09#, 16#05#, -- USAGE (Game pad) 16#a1#, 16#01#, -- COLLECTION (Application) 16#09#, 16#01#, -- USAGE (Pointer) 16#a1#, 16#00#, -- COLLECTION (Physical) -- Sticks -- 16#05#, 16#01#, -- USAGE_PAGE (Generic Desktop) 16#09#, 16#30#, -- USAGE (X) 16#09#, 16#31#, -- USAGE (Y) 16#09#, 16#32#, -- USAGE (Z) 16#09#, 16#33#, -- USAGE (Rx) 16#09#, 16#34#, -- USAGE (Ry) 16#09#, 16#35#, -- USAGE (Rz) 16#15#, 16#81#, -- LOGICAL_MINIMUM (-127) 16#25#, 16#7f#, -- LOGICAL_MAXIMUM (127) 16#95#, 16#06#, -- REPORT_COUNT (6) 16#75#, 16#08#, -- REPORT_SIZE (8) 16#81#, 16#02#, -- INPUT (Data,Var,Abs) -- Buttons 16#05#, 16#09#, -- USAGE_PAGE (Button) 16#19#, 16#01#, -- USAGE_MINIMUM (Button 1) 16#29#, 16#08#, -- USAGE_MAXIMUM (Button 8) 16#15#, 16#00#, -- LOGICAL_MINIMUM (0) 16#25#, 16#01#, -- LOGICAL_MAXIMUM (1) 16#75#, 16#01#, -- REPORT_SIZE (1) 16#95#, 16#08#, -- REPORT_COUNT (8) 16#81#, 16#02#, -- INPUT (Data,Var,Abs) 16#c0#, -- END_COLLECTION 16#c0# -- END_COLLECTION ); overriding function Report_Descriptor (This : Instance) return not null Report_Descriptor_Access is (HID_Gamepad_Report_Desc'Access); end USB.Device.HID.Gamepad;
package Kafka.Topic.Config is -- -- Creates a new kafka topic config object -- -- librdkafka equivalent: rd_kafka_topic_conf_new -- function Create return Topic_Config_Type with Import => True, Convention => C, External_Name => "rd_kafka_topic_conf_new"; -- -- Destroys a kafka topic config object -- -- librdkafka equivalent: rd_kafka_topic_conf_destroy -- -- @param Config configuration to destroy -- procedure Destroy(Config : Topic_Config_Type) with Import => True, Convention => C, External_Name => "rd_kafka_topic_conf_destroy"; -- -- Duplicates a kafka topic config object -- -- librdkafka equivalent: rd_kafka_topic_conf_dup -- -- @param Config configuration to duplicate -- function Duplicate(Config : Topic_Config_Type) return Topic_Config_Type with Import => True, Convention => C, External_Name => "rd_kafka_topic_conf_dup"; -- -- Sets a kafka topic config property for a given kafka topic config. -- -- librdkafka equivalent: rd_kafka_topic_conf_set -- -- @param Config configuration to set the property in -- @param Name name of property to set -- @param Value value of property to set -- @raises Kafka_Error on error -- procedure Set(Config : Topic_Config_Type; Name : String; Value : String); private function rd_kafka_topic_conf_set(conf : Topic_Config_Type; name : chars_ptr; value : chars_ptr; errstr : chars_ptr; errstr_size : size_t) return Integer with Import => True, Convention => C, External_Name => "rd_kafka_topic_conf_set"; end Kafka.Topic.Config;
----------------------------------------------------------------------- -- awa-wikis-servlets -- Serve files saved in the storage service -- Copyright (C) 2016, 2018 Stephane Carrez -- Written by Stephane Carrez (Stephane.Carrez@gmail.com) -- -- Licensed under the Apache License, Version 2.0 (the "License"); -- you may not use this file except in compliance with the License. -- You may obtain a copy of the License at -- -- http://www.apache.org/licenses/LICENSE-2.0 -- -- Unless required by applicable law or agreed to in writing, software -- distributed under the License is distributed on an "AS IS" BASIS, -- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -- See the License for the specific language governing permissions and -- limitations under the License. ----------------------------------------------------------------------- with AWA.Images.Modules; with AWA.Wikis.Modules; package body AWA.Wikis.Servlets is -- ------------------------------ -- Load the data content that correspond to the GET request and get the name as well -- as mime-type and date. -- ------------------------------ overriding procedure Load (Server : in Image_Servlet; Request : in out ASF.Requests.Request'Class; Name : out Ada.Strings.Unbounded.Unbounded_String; Mime : out Ada.Strings.Unbounded.Unbounded_String; Date : out Ada.Calendar.Time; Data : out ADO.Blob_Ref) is pragma Unreferenced (Server, Name); Wiki : constant String := Request.Get_Path_Parameter (1); File : constant String := Request.Get_Path_Parameter (2); Size : constant String := Request.Get_Path_Parameter (3); Module : constant AWA.Wikis.Modules.Wiki_Module_Access := Wikis.Modules.Get_Wiki_Module; Wiki_Id : ADO.Identifier; File_Id : ADO.Identifier; Width : Natural; Height : Natural; Img_Width : Natural; Img_Height : Natural; begin Wiki_Id := ADO.Identifier'Value (Wiki); File_Id := ADO.Identifier'Value (File); AWA.Images.Modules.Get_Sizes (Dimension => Size, Width => Width, Height => Height); Img_Width := Width; Img_Height := Height; Module.Load_Image (Wiki_Id => Wiki_Id, Image_Id => File_Id, Width => Img_Width, Height => Img_Height, Mime => Mime, Date => Date, Into => Data); end Load; -- ------------------------------ -- Get the expected return mode (content disposition for download or inline). -- ------------------------------ overriding function Get_Format (Server : in Image_Servlet; Request : in ASF.Requests.Request'Class) return AWA.Storages.Servlets.Get_Type is pragma Unreferenced (Server, Request); begin return AWA.Storages.Servlets.DEFAULT; end Get_Format; end AWA.Wikis.Servlets;
------------------------------------------------------------------------------ -- -- -- GNAT RUN-TIME COMPONENTS -- -- -- -- A D A . T A G S -- -- -- -- B o d y -- -- -- -- Copyright (C) 1992-2020, Free Software Foundation, Inc. -- -- -- -- GNAT is free software; you can redistribute it and/or modify it under -- -- terms of the GNU General Public License as published by the Free Soft- -- -- ware Foundation; either version 3, or (at your option) any later ver- -- -- sion. GNAT is distributed in the hope that it will be useful, but WITH- -- -- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY -- -- or FITNESS FOR A PARTICULAR PURPOSE. -- -- -- -- As a special exception under Section 7 of GPL version 3, you are granted -- -- additional permissions described in the GCC Runtime Library Exception, -- -- version 3.1, as published by the Free Software Foundation. -- -- -- -- You should have received a copy of the GNU General Public License and -- -- a copy of the GCC Runtime Library Exception along with this program; -- -- see the files COPYING3 and COPYING.RUNTIME respectively. If not, see -- -- <http://www.gnu.org/licenses/>. -- -- -- -- GNAT was originally developed by the GNAT team at New York University. -- -- Extensive contributions were provided by Ada Core Technologies Inc. -- -- -- ------------------------------------------------------------------------------ with Ada.Exceptions; with Ada.Unchecked_Conversion; with System.HTable; with System.Storage_Elements; use System.Storage_Elements; with System.WCh_Con; use System.WCh_Con; with System.WCh_StW; use System.WCh_StW; pragma Elaborate (System.HTable); -- Elaborate needed instead of Elaborate_All to avoid elaboration cycles -- when polling is turned on. This is safe because HTable doesn't do anything -- at elaboration time; it just contains a generic package we want to -- instantiate. package body Ada.Tags is ----------------------- -- Local Subprograms -- ----------------------- function Get_External_Tag (T : Tag) return System.Address; -- Returns address of a null terminated string containing the external name function Is_Primary_DT (T : Tag) return Boolean; -- Given a tag returns True if it has the signature of a primary dispatch -- table. This is Inline_Always since it is called from other Inline_ -- Always subprograms where we want no out of line code to be generated. function IW_Membership (Descendant_TSD : Type_Specific_Data_Ptr; T : Tag) return Boolean; -- Subsidiary function of IW_Membership and CW_Membership which factorizes -- the functionality needed to check if a given descendant implements an -- interface tag T. function Length (Str : Cstring_Ptr) return Natural; -- Length of string represented by the given pointer (treating the string -- as a C-style string, which is Nul terminated). See comment in body -- explaining why we cannot use the normal strlen built-in. function OSD (T : Tag) return Object_Specific_Data_Ptr; -- Ada 2005 (AI-251): Given a pointer T to a secondary dispatch table, -- retrieve the address of the record containing the Object Specific -- Data table. function SSD (T : Tag) return Select_Specific_Data_Ptr; -- Ada 2005 (AI-251): Given a pointer T to a dispatch Table, retrieves the -- address of the record containing the Select Specific Data in T's TSD. pragma Inline_Always (Get_External_Tag); pragma Inline_Always (Is_Primary_DT); pragma Inline_Always (OSD); pragma Inline_Always (SSD); -- Unchecked conversions function To_Address is new Unchecked_Conversion (Cstring_Ptr, System.Address); function To_Cstring_Ptr is new Unchecked_Conversion (System.Address, Cstring_Ptr); -- Disable warnings on possible aliasing problem function To_Tag is new Unchecked_Conversion (Integer_Address, Tag); function To_Addr_Ptr is new Ada.Unchecked_Conversion (System.Address, Addr_Ptr); function To_Address is new Ada.Unchecked_Conversion (Tag, System.Address); function To_Dispatch_Table_Ptr is new Ada.Unchecked_Conversion (Tag, Dispatch_Table_Ptr); function To_Dispatch_Table_Ptr is new Ada.Unchecked_Conversion (System.Address, Dispatch_Table_Ptr); function To_Object_Specific_Data_Ptr is new Ada.Unchecked_Conversion (System.Address, Object_Specific_Data_Ptr); function To_Tag_Ptr is new Ada.Unchecked_Conversion (System.Address, Tag_Ptr); function To_Type_Specific_Data_Ptr is new Ada.Unchecked_Conversion (System.Address, Type_Specific_Data_Ptr); ------------------------------- -- Inline_Always Subprograms -- ------------------------------- -- Inline_always subprograms must be placed before their first call to -- avoid defeating the frontend inlining mechanism and thus ensure the -- generation of their correct debug info. ------------------- -- CW_Membership -- ------------------- -- Canonical implementation of Classwide Membership corresponding to: -- Obj in Typ'Class -- Each dispatch table contains a reference to a table of ancestors (stored -- in the first part of the Tags_Table) and a count of the level of -- inheritance "Idepth". -- Obj is in Typ'Class if Typ'Tag is in the table of ancestors that are -- contained in the dispatch table referenced by Obj'Tag . Knowing the -- level of inheritance of both types, this can be computed in constant -- time by the formula: -- TSD (Obj'tag).Tags_Table (TSD (Obj'tag).Idepth - TSD (Typ'tag).Idepth) -- = Typ'tag function CW_Membership (Obj_Tag : Tag; Typ_Tag : Tag) return Boolean is Obj_TSD_Ptr : constant Addr_Ptr := To_Addr_Ptr (To_Address (Obj_Tag) - DT_Typeinfo_Ptr_Size); Typ_TSD_Ptr : constant Addr_Ptr := To_Addr_Ptr (To_Address (Typ_Tag) - DT_Typeinfo_Ptr_Size); Obj_TSD : constant Type_Specific_Data_Ptr := To_Type_Specific_Data_Ptr (Obj_TSD_Ptr.all); Typ_TSD : constant Type_Specific_Data_Ptr := To_Type_Specific_Data_Ptr (Typ_TSD_Ptr.all); Pos : constant Integer := Obj_TSD.Idepth - Typ_TSD.Idepth; begin return Pos >= 0 and then Obj_TSD.Tags_Table (Pos) = Typ_Tag; end CW_Membership; ---------------------- -- Get_External_Tag -- ---------------------- function Get_External_Tag (T : Tag) return System.Address is TSD_Ptr : constant Addr_Ptr := To_Addr_Ptr (To_Address (T) - DT_Typeinfo_Ptr_Size); TSD : constant Type_Specific_Data_Ptr := To_Type_Specific_Data_Ptr (TSD_Ptr.all); begin return To_Address (TSD.External_Tag); end Get_External_Tag; ----------------- -- Is_Abstract -- ----------------- function Is_Abstract (T : Tag) return Boolean is TSD_Ptr : Addr_Ptr; TSD : Type_Specific_Data_Ptr; begin if T = No_Tag then raise Tag_Error; end if; TSD_Ptr := To_Addr_Ptr (To_Address (T) - DT_Typeinfo_Ptr_Size); TSD := To_Type_Specific_Data_Ptr (TSD_Ptr.all); return TSD.Is_Abstract; end Is_Abstract; ------------------- -- Is_Primary_DT -- ------------------- function Is_Primary_DT (T : Tag) return Boolean is begin return DT (T).Signature = Primary_DT; end Is_Primary_DT; --------- -- OSD -- --------- function OSD (T : Tag) return Object_Specific_Data_Ptr is OSD_Ptr : constant Addr_Ptr := To_Addr_Ptr (To_Address (T) - DT_Typeinfo_Ptr_Size); begin return To_Object_Specific_Data_Ptr (OSD_Ptr.all); end OSD; --------- -- SSD -- --------- function SSD (T : Tag) return Select_Specific_Data_Ptr is TSD_Ptr : constant Addr_Ptr := To_Addr_Ptr (To_Address (T) - DT_Typeinfo_Ptr_Size); TSD : constant Type_Specific_Data_Ptr := To_Type_Specific_Data_Ptr (TSD_Ptr.all); begin return TSD.SSD; end SSD; ------------------------- -- External_Tag_HTable -- ------------------------- type HTable_Headers is range 1 .. 64; -- The following internal package defines the routines used for the -- instantiation of a new System.HTable.Static_HTable (see below). See -- spec in g-htable.ads for details of usage. package HTable_Subprograms is procedure Set_HT_Link (T : Tag; Next : Tag); function Get_HT_Link (T : Tag) return Tag; function Hash (F : System.Address) return HTable_Headers; function Equal (A, B : System.Address) return Boolean; end HTable_Subprograms; package External_Tag_HTable is new System.HTable.Static_HTable ( Header_Num => HTable_Headers, Element => Dispatch_Table, Elmt_Ptr => Tag, Null_Ptr => null, Set_Next => HTable_Subprograms.Set_HT_Link, Next => HTable_Subprograms.Get_HT_Link, Key => System.Address, Get_Key => Get_External_Tag, Hash => HTable_Subprograms.Hash, Equal => HTable_Subprograms.Equal); ------------------------ -- HTable_Subprograms -- ------------------------ -- Bodies of routines for hash table instantiation package body HTable_Subprograms is ----------- -- Equal -- ----------- function Equal (A, B : System.Address) return Boolean is Str1 : constant Cstring_Ptr := To_Cstring_Ptr (A); Str2 : constant Cstring_Ptr := To_Cstring_Ptr (B); J : Integer; begin J := 1; loop if Str1 (J) /= Str2 (J) then return False; elsif Str1 (J) = ASCII.NUL then return True; else J := J + 1; end if; end loop; end Equal; ----------------- -- Get_HT_Link -- ----------------- function Get_HT_Link (T : Tag) return Tag is TSD_Ptr : constant Addr_Ptr := To_Addr_Ptr (To_Address (T) - DT_Typeinfo_Ptr_Size); TSD : constant Type_Specific_Data_Ptr := To_Type_Specific_Data_Ptr (TSD_Ptr.all); begin return TSD.HT_Link.all; end Get_HT_Link; ---------- -- Hash -- ---------- function Hash (F : System.Address) return HTable_Headers is function H is new System.HTable.Hash (HTable_Headers); Str : constant Cstring_Ptr := To_Cstring_Ptr (F); Res : constant HTable_Headers := H (Str (1 .. Length (Str))); begin return Res; end Hash; ----------------- -- Set_HT_Link -- ----------------- procedure Set_HT_Link (T : Tag; Next : Tag) is TSD_Ptr : constant Addr_Ptr := To_Addr_Ptr (To_Address (T) - DT_Typeinfo_Ptr_Size); TSD : constant Type_Specific_Data_Ptr := To_Type_Specific_Data_Ptr (TSD_Ptr.all); begin TSD.HT_Link.all := Next; end Set_HT_Link; end HTable_Subprograms; ------------------ -- Base_Address -- ------------------ function Base_Address (This : System.Address) return System.Address is begin return This + Offset_To_Top (This); end Base_Address; --------------- -- Check_TSD -- --------------- procedure Check_TSD (TSD : Type_Specific_Data_Ptr) is T : Tag; E_Tag_Len : constant Integer := Length (TSD.External_Tag); E_Tag : String (1 .. E_Tag_Len); for E_Tag'Address use TSD.External_Tag.all'Address; pragma Import (Ada, E_Tag); Dup_Ext_Tag : constant String := "duplicated external tag """; begin -- Verify that the external tag of this TSD is not registered in the -- runtime hash table. T := External_Tag_HTable.Get (To_Address (TSD.External_Tag)); if T /= null then -- Avoid concatenation, as it is not allowed in no run time mode declare Msg : String (1 .. Dup_Ext_Tag'Length + E_Tag_Len + 1); begin Msg (1 .. Dup_Ext_Tag'Length) := Dup_Ext_Tag; Msg (Dup_Ext_Tag'Length + 1 .. Dup_Ext_Tag'Length + E_Tag_Len) := E_Tag; Msg (Msg'Last) := '"'; raise Program_Error with Msg; end; end if; end Check_TSD; -------------------- -- Descendant_Tag -- -------------------- function Descendant_Tag (External : String; Ancestor : Tag) return Tag is Int_Tag : constant Tag := Internal_Tag (External); begin if not Is_Descendant_At_Same_Level (Int_Tag, Ancestor) then raise Tag_Error; else return Int_Tag; end if; end Descendant_Tag; -------------- -- Displace -- -------------- function Displace (This : System.Address; T : Tag) return System.Address is Iface_Table : Interface_Data_Ptr; Obj_Base : System.Address; Obj_DT : Dispatch_Table_Ptr; Obj_DT_Tag : Tag; begin if System."=" (This, System.Null_Address) then return System.Null_Address; end if; Obj_Base := Base_Address (This); Obj_DT_Tag := To_Tag_Ptr (Obj_Base).all; Obj_DT := DT (To_Tag_Ptr (Obj_Base).all); Iface_Table := To_Type_Specific_Data_Ptr (Obj_DT.TSD).Interfaces_Table; if Iface_Table /= null then for Id in 1 .. Iface_Table.Nb_Ifaces loop if Iface_Table.Ifaces_Table (Id).Iface_Tag = T then -- Case of Static value of Offset_To_Top if Iface_Table.Ifaces_Table (Id).Static_Offset_To_Top then Obj_Base := Obj_Base - Iface_Table.Ifaces_Table (Id).Offset_To_Top_Value; -- Otherwise call the function generated by the expander to -- provide the value. else Obj_Base := Obj_Base - Iface_Table.Ifaces_Table (Id).Offset_To_Top_Func.all (Obj_Base); end if; return Obj_Base; end if; end loop; end if; -- Check if T is an immediate ancestor. This is required to handle -- conversion of class-wide interfaces to tagged types. if CW_Membership (Obj_DT_Tag, T) then return Obj_Base; end if; -- If the object does not implement the interface we must raise CE raise Constraint_Error with "invalid interface conversion"; end Displace; -------- -- DT -- -------- function DT (T : Tag) return Dispatch_Table_Ptr is Offset : constant SSE.Storage_Offset := To_Dispatch_Table_Ptr (T).Prims_Ptr'Position; begin return To_Dispatch_Table_Ptr (To_Address (T) - Offset); end DT; ------------------- -- IW_Membership -- ------------------- function IW_Membership (Descendant_TSD : Type_Specific_Data_Ptr; T : Tag) return Boolean is Iface_Table : Interface_Data_Ptr; begin Iface_Table := Descendant_TSD.Interfaces_Table; if Iface_Table /= null then for Id in 1 .. Iface_Table.Nb_Ifaces loop if Iface_Table.Ifaces_Table (Id).Iface_Tag = T then return True; end if; end loop; end if; -- Look for the tag in the ancestor tags table. This is required for: -- Iface_CW in Typ'Class for Id in 0 .. Descendant_TSD.Idepth loop if Descendant_TSD.Tags_Table (Id) = T then return True; end if; end loop; return False; end IW_Membership; ------------------- -- IW_Membership -- ------------------- -- Canonical implementation of Classwide Membership corresponding to: -- Obj in Iface'Class -- Each dispatch table contains a table with the tags of all the -- implemented interfaces. -- Obj is in Iface'Class if Iface'Tag is found in the table of interfaces -- that are contained in the dispatch table referenced by Obj'Tag. function IW_Membership (This : System.Address; T : Tag) return Boolean is Obj_Base : System.Address; Obj_DT : Dispatch_Table_Ptr; Obj_TSD : Type_Specific_Data_Ptr; begin Obj_Base := Base_Address (This); Obj_DT := DT (To_Tag_Ptr (Obj_Base).all); Obj_TSD := To_Type_Specific_Data_Ptr (Obj_DT.TSD); return IW_Membership (Obj_TSD, T); end IW_Membership; ------------------- -- Expanded_Name -- ------------------- function Expanded_Name (T : Tag) return String is Result : Cstring_Ptr; TSD_Ptr : Addr_Ptr; TSD : Type_Specific_Data_Ptr; begin if T = No_Tag then raise Tag_Error; end if; TSD_Ptr := To_Addr_Ptr (To_Address (T) - DT_Typeinfo_Ptr_Size); TSD := To_Type_Specific_Data_Ptr (TSD_Ptr.all); Result := TSD.Expanded_Name; return Result (1 .. Length (Result)); end Expanded_Name; ------------------ -- External_Tag -- ------------------ function External_Tag (T : Tag) return String is Result : Cstring_Ptr; TSD_Ptr : Addr_Ptr; TSD : Type_Specific_Data_Ptr; begin if T = No_Tag then raise Tag_Error; end if; TSD_Ptr := To_Addr_Ptr (To_Address (T) - DT_Typeinfo_Ptr_Size); TSD := To_Type_Specific_Data_Ptr (TSD_Ptr.all); Result := TSD.External_Tag; return Result (1 .. Length (Result)); end External_Tag; --------------------- -- Get_Entry_Index -- --------------------- function Get_Entry_Index (T : Tag; Position : Positive) return Positive is begin return SSD (T).SSD_Table (Position).Index; end Get_Entry_Index; ---------------------- -- Get_Prim_Op_Kind -- ---------------------- function Get_Prim_Op_Kind (T : Tag; Position : Positive) return Prim_Op_Kind is begin return SSD (T).SSD_Table (Position).Kind; end Get_Prim_Op_Kind; ---------------------- -- Get_Offset_Index -- ---------------------- function Get_Offset_Index (T : Tag; Position : Positive) return Positive is begin if Is_Primary_DT (T) then return Position; else return OSD (T).OSD_Table (Position); end if; end Get_Offset_Index; --------------------- -- Get_Tagged_Kind -- --------------------- function Get_Tagged_Kind (T : Tag) return Tagged_Kind is begin return DT (T).Tag_Kind; end Get_Tagged_Kind; ----------------------------- -- Interface_Ancestor_Tags -- ----------------------------- function Interface_Ancestor_Tags (T : Tag) return Tag_Array is TSD_Ptr : constant Addr_Ptr := To_Addr_Ptr (To_Address (T) - DT_Typeinfo_Ptr_Size); TSD : constant Type_Specific_Data_Ptr := To_Type_Specific_Data_Ptr (TSD_Ptr.all); Iface_Table : constant Interface_Data_Ptr := TSD.Interfaces_Table; begin if Iface_Table = null then declare Table : Tag_Array (1 .. 0); begin return Table; end; else declare Table : Tag_Array (1 .. Iface_Table.Nb_Ifaces); begin for J in 1 .. Iface_Table.Nb_Ifaces loop Table (J) := Iface_Table.Ifaces_Table (J).Iface_Tag; end loop; return Table; end; end if; end Interface_Ancestor_Tags; ------------------ -- Internal_Tag -- ------------------ -- Internal tags have the following format: -- "Internal tag at 16#ADDRESS#: <full-name-of-tagged-type>" Internal_Tag_Header : constant String := "Internal tag at "; Header_Separator : constant Character := '#'; function Internal_Tag (External : String) return Tag is pragma Unsuppress (All_Checks); -- To make T'Class'Input robust in the case of bad data Res : Tag := null; begin -- Raise Tag_Error for empty strings and very long strings. This makes -- T'Class'Input robust in the case of bad data, for example -- -- String (123456789..1234) -- -- The limit of 10,000 characters is arbitrary, but is unlikely to be -- exceeded by legitimate external tag names. if External'Length not in 1 .. 10_000 then raise Tag_Error; end if; -- Handle locally defined tagged types if External'Length > Internal_Tag_Header'Length and then External (External'First .. External'First + Internal_Tag_Header'Length - 1) = Internal_Tag_Header then declare Addr_First : constant Natural := External'First + Internal_Tag_Header'Length; Addr_Last : Natural; Addr : Integer_Address; begin -- Search the second separator (#) to identify the address Addr_Last := Addr_First; for J in 1 .. 2 loop while Addr_Last <= External'Last and then External (Addr_Last) /= Header_Separator loop Addr_Last := Addr_Last + 1; end loop; -- Skip the first separator if J = 1 then Addr_Last := Addr_Last + 1; end if; end loop; if Addr_Last <= External'Last then -- Protect the run-time against wrong internal tags. We -- cannot use exception handlers here because it would -- disable the use of this run-time compiling with -- restriction No_Exception_Handler. declare C : Character; Wrong_Tag : Boolean := False; begin if External (Addr_First) /= '1' or else External (Addr_First + 1) /= '6' or else External (Addr_First + 2) /= '#' then Wrong_Tag := True; else for J in Addr_First + 3 .. Addr_Last - 1 loop C := External (J); if not (C in '0' .. '9') and then not (C in 'A' .. 'F') and then not (C in 'a' .. 'f') then Wrong_Tag := True; exit; end if; end loop; end if; -- Convert the numeric value into a tag if not Wrong_Tag then Addr := Integer_Address'Value (External (Addr_First .. Addr_Last)); -- Internal tags never have value 0 if Addr /= 0 then return To_Tag (Addr); end if; end if; end; end if; end; -- Handle library-level tagged types else -- Make NUL-terminated copy of external tag string declare Ext_Copy : aliased String (External'First .. External'Last + 1); pragma Assert (Ext_Copy'Length > 1); -- See Length check at top begin Ext_Copy (External'Range) := External; Ext_Copy (Ext_Copy'Last) := ASCII.NUL; Res := External_Tag_HTable.Get (Ext_Copy'Address); end; end if; if Res = null then declare Msg1 : constant String := "unknown tagged type: "; Msg2 : String (1 .. Msg1'Length + External'Length); begin Msg2 (1 .. Msg1'Length) := Msg1; Msg2 (Msg1'Length + 1 .. Msg1'Length + External'Length) := External; Ada.Exceptions.Raise_Exception (Tag_Error'Identity, Msg2); end; end if; return Res; end Internal_Tag; --------------------------------- -- Is_Descendant_At_Same_Level -- --------------------------------- function Is_Descendant_At_Same_Level (Descendant : Tag; Ancestor : Tag) return Boolean is begin if Descendant = Ancestor then return True; else declare D_TSD_Ptr : constant Addr_Ptr := To_Addr_Ptr (To_Address (Descendant) - DT_Typeinfo_Ptr_Size); A_TSD_Ptr : constant Addr_Ptr := To_Addr_Ptr (To_Address (Ancestor) - DT_Typeinfo_Ptr_Size); D_TSD : constant Type_Specific_Data_Ptr := To_Type_Specific_Data_Ptr (D_TSD_Ptr.all); A_TSD : constant Type_Specific_Data_Ptr := To_Type_Specific_Data_Ptr (A_TSD_Ptr.all); begin return D_TSD.Access_Level = A_TSD.Access_Level and then (CW_Membership (Descendant, Ancestor) or else IW_Membership (D_TSD, Ancestor)); end; end if; end Is_Descendant_At_Same_Level; ------------ -- Length -- ------------ -- Note: This unit is used in the Ravenscar runtime library, so it cannot -- depend on System.CTRL. Furthermore, this happens on CPUs where the GCC -- intrinsic strlen may not be available, so we need to recode our own Ada -- version here. function Length (Str : Cstring_Ptr) return Natural is Len : Integer; begin Len := 1; while Str (Len) /= ASCII.NUL loop Len := Len + 1; end loop; return Len - 1; end Length; ------------------- -- Offset_To_Top -- ------------------- function Offset_To_Top (This : System.Address) return SSE.Storage_Offset is Tag_Size : constant SSE.Storage_Count := SSE.Storage_Count (1 * (Standard'Address_Size / System.Storage_Unit)); type Storage_Offset_Ptr is access SSE.Storage_Offset; function To_Storage_Offset_Ptr is new Unchecked_Conversion (System.Address, Storage_Offset_Ptr); Curr_DT : Dispatch_Table_Ptr; begin Curr_DT := DT (To_Tag_Ptr (This).all); -- See the documentation of Dispatch_Table_Wrapper.Offset_To_Top if Curr_DT.Offset_To_Top = SSE.Storage_Offset'Last then -- The parent record type has variable-size components, so the -- instance-specific offset is stored in the tagged record, right -- after the reference to Curr_DT (which is a secondary dispatch -- table). return To_Storage_Offset_Ptr (This + Tag_Size).all; else -- The offset is compile-time known, so it is simply stored in the -- Offset_To_Top field. return Curr_DT.Offset_To_Top; end if; end Offset_To_Top; ------------------------ -- Needs_Finalization -- ------------------------ function Needs_Finalization (T : Tag) return Boolean is TSD_Ptr : constant Addr_Ptr := To_Addr_Ptr (To_Address (T) - DT_Typeinfo_Ptr_Size); TSD : constant Type_Specific_Data_Ptr := To_Type_Specific_Data_Ptr (TSD_Ptr.all); begin return TSD.Needs_Finalization; end Needs_Finalization; ----------------- -- Parent_Size -- ----------------- function Parent_Size (Obj : System.Address; T : Tag) return SSE.Storage_Count is Parent_Slot : constant Positive := 1; -- The tag of the parent is always in the first slot of the table of -- ancestor tags. TSD_Ptr : constant Addr_Ptr := To_Addr_Ptr (To_Address (T) - DT_Typeinfo_Ptr_Size); TSD : constant Type_Specific_Data_Ptr := To_Type_Specific_Data_Ptr (TSD_Ptr.all); -- Pointer to the TSD Parent_Tag : constant Tag := TSD.Tags_Table (Parent_Slot); Parent_TSD_Ptr : constant Addr_Ptr := To_Addr_Ptr (To_Address (Parent_Tag) - DT_Typeinfo_Ptr_Size); Parent_TSD : constant Type_Specific_Data_Ptr := To_Type_Specific_Data_Ptr (Parent_TSD_Ptr.all); begin -- Here we compute the size of the _parent field of the object return SSE.Storage_Count (Parent_TSD.Size_Func.all (Obj)); end Parent_Size; ---------------- -- Parent_Tag -- ---------------- function Parent_Tag (T : Tag) return Tag is TSD_Ptr : Addr_Ptr; TSD : Type_Specific_Data_Ptr; begin if T = No_Tag then raise Tag_Error; end if; TSD_Ptr := To_Addr_Ptr (To_Address (T) - DT_Typeinfo_Ptr_Size); TSD := To_Type_Specific_Data_Ptr (TSD_Ptr.all); -- The Parent_Tag of a root-level tagged type is defined to be No_Tag. -- The first entry in the Ancestors_Tags array will be null for such -- a type, but it's better to be explicit about returning No_Tag in -- this case. if TSD.Idepth = 0 then return No_Tag; else return TSD.Tags_Table (1); end if; end Parent_Tag; ------------------------------- -- Register_Interface_Offset -- ------------------------------- procedure Register_Interface_Offset (Prim_T : Tag; Interface_T : Tag; Is_Static : Boolean; Offset_Value : SSE.Storage_Offset; Offset_Func : Offset_To_Top_Function_Ptr) is Prim_DT : constant Dispatch_Table_Ptr := DT (Prim_T); Iface_Table : constant Interface_Data_Ptr := To_Type_Specific_Data_Ptr (Prim_DT.TSD).Interfaces_Table; begin -- Save Offset_Value in the table of interfaces of the primary DT. -- This data will be used by the subprogram "Displace" to give support -- to backward abstract interface type conversions. -- Register the offset in the table of interfaces if Iface_Table /= null then for Id in 1 .. Iface_Table.Nb_Ifaces loop if Iface_Table.Ifaces_Table (Id).Iface_Tag = Interface_T then if Is_Static or else Offset_Value = 0 then Iface_Table.Ifaces_Table (Id).Static_Offset_To_Top := True; Iface_Table.Ifaces_Table (Id).Offset_To_Top_Value := Offset_Value; else Iface_Table.Ifaces_Table (Id).Static_Offset_To_Top := False; Iface_Table.Ifaces_Table (Id).Offset_To_Top_Func := Offset_Func; end if; return; end if; end loop; end if; -- If we arrive here there is some error in the run-time data structure raise Program_Error; end Register_Interface_Offset; ------------------ -- Register_Tag -- ------------------ procedure Register_Tag (T : Tag) is begin External_Tag_HTable.Set (T); end Register_Tag; ------------------- -- Secondary_Tag -- ------------------- function Secondary_Tag (T, Iface : Tag) return Tag is Iface_Table : Interface_Data_Ptr; Obj_DT : Dispatch_Table_Ptr; begin if not Is_Primary_DT (T) then raise Program_Error; end if; Obj_DT := DT (T); Iface_Table := To_Type_Specific_Data_Ptr (Obj_DT.TSD).Interfaces_Table; if Iface_Table /= null then for Id in 1 .. Iface_Table.Nb_Ifaces loop if Iface_Table.Ifaces_Table (Id).Iface_Tag = Iface then return Iface_Table.Ifaces_Table (Id).Secondary_DT; end if; end loop; end if; -- If the object does not implement the interface we must raise CE raise Constraint_Error with "invalid interface conversion"; end Secondary_Tag; --------------------- -- Set_Entry_Index -- --------------------- procedure Set_Entry_Index (T : Tag; Position : Positive; Value : Positive) is begin SSD (T).SSD_Table (Position).Index := Value; end Set_Entry_Index; ------------------------------- -- Set_Dynamic_Offset_To_Top -- ------------------------------- procedure Set_Dynamic_Offset_To_Top (This : System.Address; Prim_T : Tag; Interface_T : Tag; Offset_Value : SSE.Storage_Offset; Offset_Func : Offset_To_Top_Function_Ptr) is Sec_Base : System.Address; Sec_DT : Dispatch_Table_Ptr; begin -- Save the offset to top field in the secondary dispatch table if Offset_Value /= 0 then Sec_Base := This - Offset_Value; Sec_DT := DT (To_Tag_Ptr (Sec_Base).all); Sec_DT.Offset_To_Top := SSE.Storage_Offset'Last; end if; Register_Interface_Offset (Prim_T, Interface_T, False, Offset_Value, Offset_Func); end Set_Dynamic_Offset_To_Top; ---------------------- -- Set_Prim_Op_Kind -- ---------------------- procedure Set_Prim_Op_Kind (T : Tag; Position : Positive; Value : Prim_Op_Kind) is begin SSD (T).SSD_Table (Position).Kind := Value; end Set_Prim_Op_Kind; -------------------- -- Unregister_Tag -- -------------------- procedure Unregister_Tag (T : Tag) is begin External_Tag_HTable.Remove (Get_External_Tag (T)); end Unregister_Tag; ------------------------ -- Wide_Expanded_Name -- ------------------------ WC_Encoding : Character; pragma Import (C, WC_Encoding, "__gl_wc_encoding"); -- Encoding method for source, as exported by binder function Wide_Expanded_Name (T : Tag) return Wide_String is S : constant String := Expanded_Name (T); W : Wide_String (1 .. S'Length); L : Natural; begin String_To_Wide_String (S, W, L, Get_WC_Encoding_Method (WC_Encoding)); return W (1 .. L); end Wide_Expanded_Name; ----------------------------- -- Wide_Wide_Expanded_Name -- ----------------------------- function Wide_Wide_Expanded_Name (T : Tag) return Wide_Wide_String is S : constant String := Expanded_Name (T); W : Wide_Wide_String (1 .. S'Length); L : Natural; begin String_To_Wide_Wide_String (S, W, L, Get_WC_Encoding_Method (WC_Encoding)); return W (1 .. L); end Wide_Wide_Expanded_Name; end Ada.Tags;
with Ada.Unchecked_Conversion; package Tkmrpc.Request.Ike.Cc_Check_Ca.Convert is function To_Request is new Ada.Unchecked_Conversion ( Source => Cc_Check_Ca.Request_Type, Target => Request.Data_Type); function From_Request is new Ada.Unchecked_Conversion ( Source => Request.Data_Type, Target => Cc_Check_Ca.Request_Type); end Tkmrpc.Request.Ike.Cc_Check_Ca.Convert;
-- This file is generated by SWIG. Please do not modify by hand. -- with Interfaces; with Interfaces.C; with Interfaces.C.Pointers; package xcb.xcb_map_subwindows_request_t is -- Item -- type Item is record major_opcode : aliased Interfaces.Unsigned_8; pad0 : aliased Interfaces.Unsigned_8; length : aliased Interfaces.Unsigned_16; window : aliased xcb.xcb_window_t; end record; -- Item_Array -- type Item_Array is array (Interfaces.C .size_t range <>) of aliased xcb.xcb_map_subwindows_request_t .Item; -- Pointer -- package C_Pointers is new Interfaces.C.Pointers (Index => Interfaces.C.size_t, Element => xcb.xcb_map_subwindows_request_t.Item, Element_Array => xcb.xcb_map_subwindows_request_t.Item_Array, Default_Terminator => (others => <>)); subtype Pointer is C_Pointers.Pointer; -- Pointer_Array -- type Pointer_Array is array (Interfaces.C .size_t range <>) of aliased xcb.xcb_map_subwindows_request_t .Pointer; -- Pointer_Pointer -- package C_Pointer_Pointers is new Interfaces.C.Pointers (Index => Interfaces.C.size_t, Element => xcb.xcb_map_subwindows_request_t.Pointer, Element_Array => xcb.xcb_map_subwindows_request_t.Pointer_Array, Default_Terminator => null); subtype Pointer_Pointer is C_Pointer_Pointers.Pointer; end xcb.xcb_map_subwindows_request_t;
-- -- Copyright (C) 2021 Jeremy Grosser <jeremy@synack.me> -- -- SPDX-License-Identifier: BSD-3-Clause -- with RP.Device; with RP; use RP; package body Piezo is procedure Beep (This : Beeper; Duration : Milliseconds := 1_000; Frequency : Hertz := 440; Count : Positive := 1) is use RP.GPIO; use RP.PWM; Period : constant := 10_000; Half : constant := Period / 2; begin if This.Point_A /= null then Configure (This.Point_A.all, Output, Floating, RP.GPIO.PWM); end if; if This.Point_B /= null then Configure (This.Point_B.all, Output, Floating, RP.GPIO.PWM); end if; Set_Mode (This.Slice, Free_Running); Set_Frequency (This.Slice, Frequency * Period); Set_Interval (This.Slice, Period); Set_Invert (This.Slice, Channel_A => False, Channel_B => True); Set_Duty_Cycle (This.Slice, 0, 0); Enable (This.Slice); for I in 1 .. Count loop Set_Duty_Cycle (This.Slice, Half, Half); RP.Device.Timer.Delay_Milliseconds (Duration); Set_Duty_Cycle (This.Slice, 0, 0); if I /= Count then RP.Device.Timer.Delay_Milliseconds (Duration); end if; end loop; end Beep; end Piezo;
-- Copyright (c) 2013, Nordic Semiconductor ASA -- All rights reserved. -- -- Redistribution and use in source and binary forms, with or without -- modification, are permitted provided that the following conditions are met: -- -- * Redistributions of source code must retain the above copyright notice, this -- list of conditions and the following disclaimer. -- -- * Redistributions in binary form must reproduce the above copyright notice, -- this list of conditions and the following disclaimer in the documentation -- and/or other materials provided with the distribution. -- -- * Neither the name of Nordic Semiconductor ASA nor the names of its -- contributors may be used to endorse or promote products derived from -- this software without specific prior written permission. -- -- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" -- AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -- IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE -- DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE -- FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL -- DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR -- SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER -- CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, -- OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -- OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -- -- This spec has been automatically generated from nrf51.svd pragma Restrictions (No_Elaboration_Code); pragma Ada_2012; pragma Style_Checks (Off); with HAL; with System; package NRF_SVD.MPU is pragma Preelaborate; --------------- -- Registers -- --------------- -- POWER_CLOCK region configuration. type PERR0_POWER_CLOCK_Field is (-- Peripheral configured in region 1. Inregion1, -- Peripheral configured in region 0. Inregion0) with Size => 1; for PERR0_POWER_CLOCK_Field use (Inregion1 => 0, Inregion0 => 1); -- RADIO region configuration. type PERR0_RADIO_Field is (-- Peripheral configured in region 1. Inregion1, -- Peripheral configured in region 0. Inregion0) with Size => 1; for PERR0_RADIO_Field use (Inregion1 => 0, Inregion0 => 1); -- UART0 region configuration. type PERR0_UART0_Field is (-- Peripheral configured in region 1. Inregion1, -- Peripheral configured in region 0. Inregion0) with Size => 1; for PERR0_UART0_Field use (Inregion1 => 0, Inregion0 => 1); -- SPI0 and TWI0 region configuration. type PERR0_SPI0_TWI0_Field is (-- Peripheral configured in region 1. Inregion1, -- Peripheral configured in region 0. Inregion0) with Size => 1; for PERR0_SPI0_TWI0_Field use (Inregion1 => 0, Inregion0 => 1); -- SPI1 and TWI1 region configuration. type PERR0_SPI1_TWI1_Field is (-- Peripheral configured in region 1. Inregion1, -- Peripheral configured in region 0. Inregion0) with Size => 1; for PERR0_SPI1_TWI1_Field use (Inregion1 => 0, Inregion0 => 1); -- GPIOTE region configuration. type PERR0_GPIOTE_Field is (-- Peripheral configured in region 1. Inregion1, -- Peripheral configured in region 0. Inregion0) with Size => 1; for PERR0_GPIOTE_Field use (Inregion1 => 0, Inregion0 => 1); -- ADC region configuration. type PERR0_ADC_Field is (-- Peripheral configured in region 1. Inregion1, -- Peripheral configured in region 0. Inregion0) with Size => 1; for PERR0_ADC_Field use (Inregion1 => 0, Inregion0 => 1); -- TIMER0 region configuration. type PERR0_TIMER0_Field is (-- Peripheral configured in region 1. Inregion1, -- Peripheral configured in region 0. Inregion0) with Size => 1; for PERR0_TIMER0_Field use (Inregion1 => 0, Inregion0 => 1); -- PERR0_TIMER array type PERR0_TIMER_Field_Array is array (0 .. 2) of PERR0_TIMER0_Field with Component_Size => 1, Size => 3; -- Type definition for PERR0_TIMER type PERR0_TIMER_Field (As_Array : Boolean := False) is record case As_Array is when False => -- TIMER as a value Val : HAL.UInt3; when True => -- TIMER as an array Arr : PERR0_TIMER_Field_Array; end case; end record with Unchecked_Union, Size => 3; for PERR0_TIMER_Field use record Val at 0 range 0 .. 2; Arr at 0 range 0 .. 2; end record; -- RTC0 region configuration. type PERR0_RTC0_Field is (-- Peripheral configured in region 1. Inregion1, -- Peripheral configured in region 0. Inregion0) with Size => 1; for PERR0_RTC0_Field use (Inregion1 => 0, Inregion0 => 1); -- TEMP region configuration. type PERR0_TEMP_Field is (-- Peripheral configured in region 1. Inregion1, -- Peripheral configured in region 0. Inregion0) with Size => 1; for PERR0_TEMP_Field use (Inregion1 => 0, Inregion0 => 1); -- RNG region configuration. type PERR0_RNG_Field is (-- Peripheral configured in region 1. Inregion1, -- Peripheral configured in region 0. Inregion0) with Size => 1; for PERR0_RNG_Field use (Inregion1 => 0, Inregion0 => 1); -- ECB region configuration. type PERR0_ECB_Field is (-- Peripheral configured in region 1. Inregion1, -- Peripheral configured in region 0. Inregion0) with Size => 1; for PERR0_ECB_Field use (Inregion1 => 0, Inregion0 => 1); -- CCM and AAR region configuration. type PERR0_CCM_AAR_Field is (-- Peripheral configured in region 1. Inregion1, -- Peripheral configured in region 0. Inregion0) with Size => 1; for PERR0_CCM_AAR_Field use (Inregion1 => 0, Inregion0 => 1); -- WDT region configuration. type PERR0_WDT_Field is (-- Peripheral configured in region 1. Inregion1, -- Peripheral configured in region 0. Inregion0) with Size => 1; for PERR0_WDT_Field use (Inregion1 => 0, Inregion0 => 1); -- RTC1 region configuration. type PERR0_RTC1_Field is (-- Peripheral configured in region 1. Inregion1, -- Peripheral configured in region 0. Inregion0) with Size => 1; for PERR0_RTC1_Field use (Inregion1 => 0, Inregion0 => 1); -- QDEC region configuration. type PERR0_QDEC_Field is (-- Peripheral configured in region 1. Inregion1, -- Peripheral configured in region 0. Inregion0) with Size => 1; for PERR0_QDEC_Field use (Inregion1 => 0, Inregion0 => 1); -- LPCOMP region configuration. type PERR0_LPCOMP_Field is (-- Peripheral configured in region 1. Inregion1, -- Peripheral configured in region 0. Inregion0) with Size => 1; for PERR0_LPCOMP_Field use (Inregion1 => 0, Inregion0 => 1); -- NVMC region configuration. type PERR0_NVMC_Field is (-- Peripheral configured in region 1. Inregion1, -- Peripheral configured in region 0. Inregion0) with Size => 1; for PERR0_NVMC_Field use (Inregion1 => 0, Inregion0 => 1); -- PPI region configuration. type PERR0_PPI_Field is (-- Peripheral configured in region 1. Inregion1, -- Peripheral configured in region 0. Inregion0) with Size => 1; for PERR0_PPI_Field use (Inregion1 => 0, Inregion0 => 1); -- Configuration of peripherals in mpu regions. type PERR0_Register is record -- POWER_CLOCK region configuration. POWER_CLOCK : PERR0_POWER_CLOCK_Field := NRF_SVD.MPU.Inregion1; -- RADIO region configuration. RADIO : PERR0_RADIO_Field := NRF_SVD.MPU.Inregion1; -- UART0 region configuration. UART0 : PERR0_UART0_Field := NRF_SVD.MPU.Inregion1; -- SPI0 and TWI0 region configuration. SPI0_TWI0 : PERR0_SPI0_TWI0_Field := NRF_SVD.MPU.Inregion1; -- SPI1 and TWI1 region configuration. SPI1_TWI1 : PERR0_SPI1_TWI1_Field := NRF_SVD.MPU.Inregion1; -- unspecified Reserved_5_5 : HAL.Bit := 16#0#; -- GPIOTE region configuration. GPIOTE : PERR0_GPIOTE_Field := NRF_SVD.MPU.Inregion1; -- ADC region configuration. ADC : PERR0_ADC_Field := NRF_SVD.MPU.Inregion1; -- TIMER0 region configuration. TIMER : PERR0_TIMER_Field := (As_Array => False, Val => 16#0#); -- RTC0 region configuration. RTC0 : PERR0_RTC0_Field := NRF_SVD.MPU.Inregion1; -- TEMP region configuration. TEMP : PERR0_TEMP_Field := NRF_SVD.MPU.Inregion1; -- RNG region configuration. RNG : PERR0_RNG_Field := NRF_SVD.MPU.Inregion1; -- ECB region configuration. ECB : PERR0_ECB_Field := NRF_SVD.MPU.Inregion1; -- CCM and AAR region configuration. CCM_AAR : PERR0_CCM_AAR_Field := NRF_SVD.MPU.Inregion1; -- WDT region configuration. WDT : PERR0_WDT_Field := NRF_SVD.MPU.Inregion1; -- RTC1 region configuration. RTC1 : PERR0_RTC1_Field := NRF_SVD.MPU.Inregion1; -- QDEC region configuration. QDEC : PERR0_QDEC_Field := NRF_SVD.MPU.Inregion1; -- LPCOMP region configuration. LPCOMP : PERR0_LPCOMP_Field := NRF_SVD.MPU.Inregion1; -- unspecified Reserved_20_29 : HAL.UInt10 := 16#0#; -- NVMC region configuration. NVMC : PERR0_NVMC_Field := NRF_SVD.MPU.Inregion1; -- PPI region configuration. PPI : PERR0_PPI_Field := NRF_SVD.MPU.Inregion1; end record with Volatile_Full_Access, Object_Size => 32, Bit_Order => System.Low_Order_First; for PERR0_Register use record POWER_CLOCK at 0 range 0 .. 0; RADIO at 0 range 1 .. 1; UART0 at 0 range 2 .. 2; SPI0_TWI0 at 0 range 3 .. 3; SPI1_TWI1 at 0 range 4 .. 4; Reserved_5_5 at 0 range 5 .. 5; GPIOTE at 0 range 6 .. 6; ADC at 0 range 7 .. 7; TIMER at 0 range 8 .. 10; RTC0 at 0 range 11 .. 11; TEMP at 0 range 12 .. 12; RNG at 0 range 13 .. 13; ECB at 0 range 14 .. 14; CCM_AAR at 0 range 15 .. 15; WDT at 0 range 16 .. 16; RTC1 at 0 range 17 .. 17; QDEC at 0 range 18 .. 18; LPCOMP at 0 range 19 .. 19; Reserved_20_29 at 0 range 20 .. 29; NVMC at 0 range 30 .. 30; PPI at 0 range 31 .. 31; end record; -- Protection enable for region 0. type PROTENSET0_PROTREG0_Field is (-- Protection disabled. Disabled, -- Protection enabled. Enabled) with Size => 1; for PROTENSET0_PROTREG0_Field use (Disabled => 0, Enabled => 1); -- Protection enable for region 0. type PROTENSET0_PROTREG0_Field_1 is (-- Reset value for the field Protenset0_Protreg0_Field_Reset, -- Enable protection on write. Set) with Size => 1; for PROTENSET0_PROTREG0_Field_1 use (Protenset0_Protreg0_Field_Reset => 0, Set => 1); -- PROTENSET0_PROTREG array type PROTENSET0_PROTREG_Field_Array is array (0 .. 31) of PROTENSET0_PROTREG0_Field_1 with Component_Size => 1, Size => 32; -- Erase and write protection bit enable set register. type PROTENSET0_Register (As_Array : Boolean := False) is record case As_Array is when False => -- PROTREG as a value Val : HAL.UInt32; when True => -- PROTREG as an array Arr : PROTENSET0_PROTREG_Field_Array; end case; end record with Unchecked_Union, Size => 32, Volatile_Full_Access, Object_Size => 32, Bit_Order => System.Low_Order_First; for PROTENSET0_Register use record Val at 0 range 0 .. 31; Arr at 0 range 0 .. 31; end record; -- Protection enable for region 32. type PROTENSET1_PROTREG32_Field is (-- Protection disabled. Disabled, -- Protection enabled. Enabled) with Size => 1; for PROTENSET1_PROTREG32_Field use (Disabled => 0, Enabled => 1); -- Protection enable for region 32. type PROTENSET1_PROTREG32_Field_1 is (-- Reset value for the field Protenset1_Protreg32_Field_Reset, -- Enable protection on write. Set) with Size => 1; for PROTENSET1_PROTREG32_Field_1 use (Protenset1_Protreg32_Field_Reset => 0, Set => 1); -- PROTENSET1_PROTREG array type PROTENSET1_PROTREG_Field_Array is array (32 .. 63) of PROTENSET1_PROTREG32_Field_1 with Component_Size => 1, Size => 32; -- Erase and write protection bit enable set register. type PROTENSET1_Register (As_Array : Boolean := False) is record case As_Array is when False => -- PROTREG as a value Val : HAL.UInt32; when True => -- PROTREG as an array Arr : PROTENSET1_PROTREG_Field_Array; end case; end record with Unchecked_Union, Size => 32, Volatile_Full_Access, Object_Size => 32, Bit_Order => System.Low_Order_First; for PROTENSET1_Register use record Val at 0 range 0 .. 31; Arr at 0 range 0 .. 31; end record; -- Disable protection mechanism in debug mode. type DISABLEINDEBUG_DISABLEINDEBUG_Field is (-- Protection enabled. Enabled, -- Protection disabled. Disabled) with Size => 1; for DISABLEINDEBUG_DISABLEINDEBUG_Field use (Enabled => 0, Disabled => 1); -- Disable erase and write protection mechanism in debug mode. type DISABLEINDEBUG_Register is record -- Disable protection mechanism in debug mode. DISABLEINDEBUG : DISABLEINDEBUG_DISABLEINDEBUG_Field := NRF_SVD.MPU.Disabled; -- unspecified Reserved_1_31 : HAL.UInt31 := 16#0#; end record with Volatile_Full_Access, Object_Size => 32, Bit_Order => System.Low_Order_First; for DISABLEINDEBUG_Register use record DISABLEINDEBUG at 0 range 0 .. 0; Reserved_1_31 at 0 range 1 .. 31; end record; -- Erase and write protection block size. type PROTBLOCKSIZE_PROTBLOCKSIZE_Field is (-- Erase and write protection block size is 4k. Val_4K) with Size => 2; for PROTBLOCKSIZE_PROTBLOCKSIZE_Field use (Val_4K => 0); -- Erase and write protection block size. type PROTBLOCKSIZE_Register is record -- Erase and write protection block size. PROTBLOCKSIZE : PROTBLOCKSIZE_PROTBLOCKSIZE_Field := NRF_SVD.MPU.Val_4K; -- unspecified Reserved_2_31 : HAL.UInt30 := 16#0#; end record with Volatile_Full_Access, Object_Size => 32, Bit_Order => System.Low_Order_First; for PROTBLOCKSIZE_Register use record PROTBLOCKSIZE at 0 range 0 .. 1; Reserved_2_31 at 0 range 2 .. 31; end record; ----------------- -- Peripherals -- ----------------- -- Memory Protection Unit. type MPU_Peripheral is record -- Configuration of peripherals in mpu regions. PERR0 : aliased PERR0_Register; -- Length of RAM region 0. RLENR0 : aliased HAL.UInt32; -- Erase and write protection bit enable set register. PROTENSET0 : aliased PROTENSET0_Register; -- Erase and write protection bit enable set register. PROTENSET1 : aliased PROTENSET1_Register; -- Disable erase and write protection mechanism in debug mode. DISABLEINDEBUG : aliased DISABLEINDEBUG_Register; -- Erase and write protection block size. PROTBLOCKSIZE : aliased PROTBLOCKSIZE_Register; end record with Volatile; for MPU_Peripheral use record PERR0 at 16#528# range 0 .. 31; RLENR0 at 16#52C# range 0 .. 31; PROTENSET0 at 16#600# range 0 .. 31; PROTENSET1 at 16#604# range 0 .. 31; DISABLEINDEBUG at 16#608# range 0 .. 31; PROTBLOCKSIZE at 16#60C# range 0 .. 31; end record; -- Memory Protection Unit. MPU_Periph : aliased MPU_Peripheral with Import, Address => MPU_Base; end NRF_SVD.MPU;
------------------------------------------------------------------------------ -- -- -- GNAT RUN-TIME COMPONENTS -- -- -- -- S Y S T E M . W W D _ W C H A R -- -- -- -- B o d y -- -- -- -- Copyright (C) 1992-2005, Free Software Foundation, Inc. -- -- -- -- GNAT is free software; you can redistribute it and/or modify it under -- -- terms of the GNU General Public License as published by the Free Soft- -- -- ware Foundation; either version 2, or (at your option) any later ver- -- -- sion. GNAT is distributed in the hope that it will be useful, but WITH- -- -- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY -- -- or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -- -- for more details. You should have received a copy of the GNU General -- -- Public License distributed with GNAT; see file COPYING. If not, write -- -- to the Free Software Foundation, 51 Franklin Street, Fifth Floor, -- -- Boston, MA 02110-1301, USA. -- -- -- -- As a special exception, if other files instantiate generics from this -- -- unit, or you link this unit with other files to produce an executable, -- -- this unit does not by itself cause the resulting executable to be -- -- covered by the GNU General Public License. This exception does not -- -- however invalidate any other reasons why the executable file might be -- -- covered by the GNU Public License. -- -- -- -- GNAT was originally developed by the GNAT team at New York University. -- -- Extensive contributions were provided by Ada Core Technologies Inc. -- -- -- ------------------------------------------------------------------------------ with Interfaces; use Interfaces; with System.WWd_Char; package body System.Wwd_WChar is ------------------------------------ -- Wide_Wide_Width_Wide_Character -- ------------------------------------ -- This is the case where we are talking about the Wide_Wide_Image of -- a Wide_Character, which is always the same character sequence as the -- Wide_Image of the same Wide_Character. function Wide_Wide_Width_Wide_Character (Lo, Hi : Wide_Character) return Natural is begin return Wide_Width_Wide_Character (Lo, Hi); end Wide_Wide_Width_Wide_Character; ------------------------------------ -- Wide_Wide_Width_Wide_Wide_Char -- ------------------------------------ function Wide_Wide_Width_Wide_Wide_Char (Lo, Hi : Wide_Wide_Character) return Natural is LV : constant Unsigned_32 := Wide_Wide_Character'Pos (Lo); HV : constant Unsigned_32 := Wide_Wide_Character'Pos (Hi); begin -- Return zero if empty range if LV > HV then return 0; -- Return max value (12) for wide character (Hex_hhhhhhhh) elsif HV > 255 then return 12; -- If any characters in normal character range, then use normal -- Wide_Wide_Width attribute on this range to find out a starting point. -- Otherwise start with zero. else return System.WWd_Char.Wide_Wide_Width_Character (Lo => Character'Val (LV), Hi => Character'Val (Unsigned_32'Min (255, HV))); end if; end Wide_Wide_Width_Wide_Wide_Char; ------------------------------- -- Wide_Width_Wide_Character -- ------------------------------- function Wide_Width_Wide_Character (Lo, Hi : Wide_Character) return Natural is LV : constant Unsigned_32 := Wide_Character'Pos (Lo); HV : constant Unsigned_32 := Wide_Character'Pos (Hi); begin -- Return zero if empty range if LV > HV then return 0; -- Return max value (12) for wide character (Hex_hhhhhhhh) elsif HV > 255 then return 12; -- If any characters in normal character range, then use normal -- Wide_Wide_Width attribute on this range to find out a starting point. -- Otherwise start with zero. else return System.WWd_Char.Wide_Width_Character (Lo => Character'Val (LV), Hi => Character'Val (Unsigned_32'Min (255, HV))); end if; end Wide_Width_Wide_Character; ------------------------------------ -- Wide_Width_Wide_Wide_Character -- ------------------------------------ function Wide_Width_Wide_Wide_Character (Lo, Hi : Wide_Wide_Character) return Natural is begin return Wide_Wide_Width_Wide_Wide_Char (Lo, Hi); end Wide_Width_Wide_Wide_Character; end System.Wwd_WChar;
with Ada.Text_IO; with PrimeUtilities; package body Problem_70 is package IO renames Ada.Text_IO; subtype Ten_Million is Integer range 1 .. 9_999_999; package Ten_Million_Primes is new PrimeUtilities(Ten_Million); type Digit_Count is Array(Character range '0' .. '9') of Natural; procedure Solve is sieve : constant Ten_Million_Primes.Sieve := Ten_Million_Primes.Generate_Sieve(Ten_Million'Last / 2); best : Ten_Million := 1; best_ratio : Long_Float := 0.0; function Convert(num : Ten_Million) return Digit_Count is str : constant String := Ten_Million'Image(num); counts : Digit_Count := (others => 0); begin for i in 2 .. str'Last loop counts(str(i)) := counts(str(i)) + 1; end loop; return counts; end Convert; procedure Check(num, euler : Ten_Million; ratio : Long_Float) is num_c : constant Digit_Count := Convert(num); euler_c : constant Digit_Count := Convert(euler); begin for c in num_c'Range loop if num_c(c) /= euler_c(c) then return; end if; end loop; best := num; best_ratio := ratio; end Check; procedure Solve_Recursive(min_index : Positive; start_ratio : Long_Float; start_euler, so_far : Ten_Million) is prime : Ten_Million; total : Ten_Million; euler : Ten_Million; ratio : Long_Float; begin for prime_index in min_index .. sieve'Last loop prime := sieve(prime_index); exit when Ten_Million'Last / prime < so_far; total := so_far * prime; euler := start_euler * (prime - 1); ratio := start_ratio * (1.0 - 1.0 / Long_Float(prime)); exit when ratio < 0.1; loop if ratio > best_ratio then Check(total, euler, ratio); end if; Solve_Recursive(prime_index + 1, ratio, euler, total); exit when Ten_Million'Last / prime < total; total := total * prime; euler := euler * prime; end loop; end loop; end Solve_Recursive; begin Solve_Recursive(sieve'First, 1.0, 1, 1); IO.Put_Line(Integer'Image(best)); end Solve; end Problem_70;
------------------------------------------------------------------------------ -- -- -- 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.RSR.IWDG1RSTF then -- Clear the reset flag RCC_Periph.RSR.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; -------------------- -- Start_Watchdog -- -------------------- procedure Start_Watchdog (Window : UInt12) is begin IWDG_Periph.WINR.WIN := Window; 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;
------------------------------------------------------------------------------ -- -- -- GNAT COMPILER COMPONENTS -- -- -- -- S Y S T E M . V A L _ C H A R -- -- -- -- B o d y -- -- -- -- Copyright (C) 1992-2012, Free Software Foundation, Inc. -- -- -- -- GNAT is free software; you can redistribute it and/or modify it under -- -- terms of the GNU General Public License as published by the Free Soft- -- -- ware Foundation; either version 3, or (at your option) any later ver- -- -- sion. GNAT is distributed in the hope that it will be useful, but WITH- -- -- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY -- -- or FITNESS FOR A PARTICULAR PURPOSE. -- -- -- -- As a special exception under Section 7 of GPL version 3, you are granted -- -- additional permissions described in the GCC Runtime Library Exception, -- -- version 3.1, as published by the Free Software Foundation. -- -- -- -- You should have received a copy of the GNU General Public License and -- -- a copy of the GCC Runtime Library Exception along with this program; -- -- see the files COPYING3 and COPYING.RUNTIME respectively. If not, see -- -- <http://www.gnu.org/licenses/>. -- -- -- -- GNAT was originally developed by the GNAT team at New York University. -- -- Extensive contributions were provided by Ada Core Technologies Inc. -- -- -- ------------------------------------------------------------------------------ with System.Val_Util; use System.Val_Util; package body System.Val_Char is --------------------- -- Value_Character -- --------------------- function Value_Character (Str : String) return Character is F : Natural; L : Natural; S : String (Str'Range) := Str; begin Normalize_String (S, F, L); -- Accept any single character enclosed in quotes if L - F = 2 and then S (F) = ''' and then S (L) = ''' then return Character'Val (Character'Pos (S (F + 1))); -- Check control character cases else for C in Character'Val (16#00#) .. Character'Val (16#1F#) loop if S (F .. L) = Character'Image (C) then return C; end if; end loop; for C in Character'Val (16#7F#) .. Character'Val (16#9F#) loop if S (F .. L) = Character'Image (C) then return C; end if; end loop; if S (F .. L) = "SOFT_HYPHEN" then return Character'Val (16#AD#); end if; Bad_Value (Str); end if; end Value_Character; end System.Val_Char;
-- C43224A.ADA -- Grant of Unlimited Rights -- -- Under contracts F33600-87-D-0337, F33600-84-D-0280, MDA903-79-C-0687, -- F08630-91-C-0015, and DCA100-97-D-0025, the U.S. Government obtained -- unlimited rights in the software and documentation contained herein. -- Unlimited rights are defined in DFAR 252.227-7013(a)(19). By making -- this public release, the Government intends to confer upon all -- recipients unlimited rights equal to those held by the Government. -- These rights include rights to use, duplicate, release or disclose the -- released technical data and computer software in whole or in part, in -- any manner and for any purpose whatsoever, and to have or permit others -- to do so. -- -- DISCLAIMER -- -- ALL MATERIALS OR INFORMATION HEREIN RELEASED, MADE AVAILABLE OR -- DISCLOSED ARE AS IS. THE GOVERNMENT MAKES NO EXPRESS OR IMPLIED -- WARRANTY AS TO ANY MATTER WHATSOEVER, INCLUDING THE CONDITIONS OF THE -- SOFTWARE, DOCUMENTATION OR OTHER INFORMATION RELEASED, MADE AVAILABLE -- OR DISCLOSED, OR THE OWNERSHIP, MERCHANTABILITY, OR FITNESS FOR A -- PARTICULAR PURPOSE OF SAID MATERIAL. --* -- OBJECTIVE: -- CHECK THAT A NON-STATIC CHOICE OF AN ARRAY AGGREGATE CAN BE A -- 'RANGE ATTRIBUTE. -- HISTORY: -- DHH 08/15/88 CREATED ORIGINAL TEST. WITH REPORT; USE REPORT; PROCEDURE C43224A IS M, O : INTEGER := IDENT_INT(2); N : INTEGER := IDENT_INT(3); TYPE ARR IS ARRAY(INTEGER RANGE <>) OF INTEGER; TYPE D3_ARR IS ARRAY(INTEGER RANGE <>, INTEGER RANGE <>, INTEGER RANGE <>) OF INTEGER; SUBTYPE ARR1 IS ARR(IDENT_INT(2) .. IDENT_INT(3)); SUBTYPE ARR2 IS D3_ARR(1 .. M, 1 .. N, 1 ..O); SUB : ARR1; SUB1 : ARR2; PROCEDURE PROC(ARRY : IN OUT ARR) IS BEGIN ARRY := (ARR1'RANGE => IDENT_INT(7)); IF ARRY(IDENT_INT(ARRY'FIRST)) /= IDENT_INT(7) THEN FAILED("RANGE NOT INITIALIZED - 1"); END IF; END PROC; PROCEDURE PROC1(ARRY : IN OUT D3_ARR) IS BEGIN ARRY := (ARR2'RANGE(1) => (ARRY'RANGE(2) => (ARRY'RANGE(3) => IDENT_INT(7)))); IF ARRY(IDENT_INT(1), IDENT_INT(2), IDENT_INT(1)) /= IDENT_INT(7) THEN FAILED("RANGE NOT INITIALIZED - 2"); END IF; END PROC1; BEGIN TEST("C43224A", "CHECK THAT A NON-STATIC CHOICE OF AN ARRAY " & "AGGREGATE CAN BE A 'RANGE ATTRIBUTE"); PROC(SUB); PROC1(SUB1); RESULT; END C43224A;
-- This file is generated by SWIG. Please do not modify by hand. -- with Interfaces; with Interfaces.C; with Interfaces.C.Pointers; package xcb.xcb_glx_get_tex_genfv_request_t is -- Item -- type Item is record major_opcode : aliased Interfaces.Unsigned_8; minor_opcode : aliased Interfaces.Unsigned_8; length : aliased Interfaces.Unsigned_16; context_tag : aliased xcb.xcb_glx_context_tag_t; coord : aliased Interfaces.Unsigned_32; pname : aliased Interfaces.Unsigned_32; end record; -- Item_Array -- type Item_Array is array (Interfaces.C .size_t range <>) of aliased xcb.xcb_glx_get_tex_genfv_request_t .Item; -- Pointer -- package C_Pointers is new Interfaces.C.Pointers (Index => Interfaces.C.size_t, Element => xcb.xcb_glx_get_tex_genfv_request_t.Item, Element_Array => xcb.xcb_glx_get_tex_genfv_request_t.Item_Array, Default_Terminator => (others => <>)); subtype Pointer is C_Pointers.Pointer; -- Pointer_Array -- type Pointer_Array is array (Interfaces.C .size_t range <>) of aliased xcb.xcb_glx_get_tex_genfv_request_t .Pointer; -- Pointer_Pointer -- package C_Pointer_Pointers is new Interfaces.C.Pointers (Index => Interfaces.C.size_t, Element => xcb.xcb_glx_get_tex_genfv_request_t.Pointer, Element_Array => xcb.xcb_glx_get_tex_genfv_request_t.Pointer_Array, Default_Terminator => null); subtype Pointer_Pointer is C_Pointer_Pointers.Pointer; end xcb.xcb_glx_get_tex_genfv_request_t;
pragma Style_Checks (Off); with Interfaces.C; use Interfaces.C; with Interfaces.C.Extensions; package stdint_h is subtype uint8_t is unsigned_char; -- /usr/include/stdint.h:48 end stdint_h;
------------------------------------------------------------------------------ -- A d a r u n - t i m e s p e c i f i c a t i o n -- -- ASIS implementation for Gela project, a portable Ada compiler -- -- http://gela.ada-ru.org -- -- - - - - - - - - - - - - - - - -- -- Read copyright and license at the end of ada.ads file -- ------------------------------------------------------------------------------ -- $Revision: 209 $ $Date: 2013-11-30 21:03:24 +0200 (Сб., 30 нояб. 2013) $ generic type Element_Type (<>) is private; with function "<" (Left : in Element_Type; Right : in Element_Type) return Boolean is <>; with function "=" (Left : in Element_Type; Right : in Element_Type) return Boolean is <>; package Ada.Containers.Indefinite_Ordered_Sets is pragma Preelaborate (Indefinite_Ordered_Sets); function Equivalent_Elements (Left : in Element_Type; Right : in Element_Type) return Boolean; type Set is tagged private; pragma Preelaborable_Initialization (Set); type Cursor is private; pragma Preelaborable_Initialization (Cursor); Empty_Set : constant Set; No_Element : constant Cursor; function "=" (Left : in Set; Right : in Set) return Boolean; function Equivalent_Sets (Left : in Set; Right : in Set) return Boolean; function To_Set (New_Item : in Element_Type) return Set; function Length (Container : in Set) return Count_Type; function Is_Empty (Container : in Set) return Boolean; procedure Clear (Container : in out Set); function Element (Position : in Cursor) return Element_Type; procedure Replace_Element (Container : in out Set; Position : in Cursor; New_Item : in Element_Type); procedure Query_Element (Position : in Cursor; Process : not null access procedure (Element : in Element_Type)); procedure Move (Target : in out Set; Source : in out Set); procedure Insert (Container : in out Set; New_Item : in Element_Type; Position : out Cursor; Inserted : out Boolean); procedure Insert (Container : in out Set; New_Item : in Element_Type); procedure Include (Container : in out Set; New_Item : in Element_Type); procedure Replace (Container : in out Set; New_Item : in Element_Type); procedure Exclude (Container : in out Set; Item : in Element_Type); procedure Delete (Container : in out Set; Item : in Element_Type); procedure Delete (Container : in out Set; Position : in out Cursor); procedure Delete_First (Container : in out Set); procedure Delete_Last (Container : in out Set); procedure Union (Target : in out Set; Source : in Set); function Union (Left : in Set; Right : in Set) return Set; function "or" (Left : in Set; Right : in Set) return Set renames Union; procedure Intersection (Target : in out Set; Source : in Set); function Intersection (Left : in Set; Right : in Set) return Set; function "and" (Left : in Set; Right : in Set) return Set renames Intersection; procedure Difference (Target : in out Set; Source : in Set); function Difference (Left : in Set; Right : in Set) return Set; function "-" (Left : in Set; Right : in Set) return Set renames Difference; procedure Symmetric_Difference (Target : in out Set; Source : in Set); function Symmetric_Difference (Left : in Set; Right : in Set) return Set; function "xor" (Left : in Set; Right : in Set) return Set renames Symmetric_Difference; function Overlap (Left : in Set; Right : in Set) return Boolean; function Is_Subset (Subset : in Set; Of_Set : in Set) return Boolean; function First (Container : in Set) return Cursor; function First_Element (Container : in Set) return Element_Type; function Last (Container : in Set) return Cursor; function Last_Element (Container : in Set) return Element_Type; function Next (Position : in Cursor) return Cursor; procedure Next (Position : in out Cursor); function Previous (Position : in Cursor) return Cursor; procedure Previous (Position : in out Cursor); function Find (Container : in Set; Item : in Element_Type) return Cursor; function Floor (Container : in Set; Item : in Element_Type) return Cursor; function Ceiling (Container : in Set; Item : in Element_Type) return Cursor; function Contains (Container : in Set; Item : in Element_Type) return Boolean; function Has_Element (Position : in Cursor) return Boolean; function "<" (Left : in Cursor; Right : in Cursor) return Boolean; function ">" (Left : in Cursor; Right : in Cursor) return Boolean; function "<" (Left : in Cursor; Right : in Element_Type) return Boolean; function ">" (Left : in Cursor; Right : in Element_Type) return Boolean; function "<" (Left : in Element_Type; Right : in Cursor) return Boolean; function ">" (Left : in Element_Type; Right : in Cursor) return Boolean; procedure Iterate (Container : in Set; Process : not null access procedure (Position : in Cursor)); procedure Reverse_Iterate (Container : in Set; Process : not null access procedure (Position : in Cursor)); generic type Key_Type (<>) is private; with function Key (Element : in Element_Type) return Key_Type; with function "<" (Left : in Key_Type; Right : in Key_Type) return Boolean is <>; package Generic_Keys is function Equivalent_Keys (Left : in Key_Type; Right : in Key_Type) return Boolean; function Key (Position : in Cursor) return Key_Type; function Element (Container : in Set; Key : in Key_Type) return Element_Type; procedure Replace (Container : in out Set; Key : in Key_Type; New_Item : in Element_Type); procedure Exclude (Container : in out Set; Key : in Key_Type); procedure Delete (Container : in out Set; Key : in Key_Type); function Find (Container : in Set; Key : in Key_Type) return Cursor; function Floor (Container : in Set; Key : in Key_Type) return Cursor; function Ceiling (Container : in Set; Key : in Key_Type) return Cursor; function Contains (Container : in Set; Key : in Key_Type) return Boolean; procedure Update_Element_Preserving_Key (Container : in out Set; Position : in Cursor; Process : not null access procedure (Element : in out Element_Type)); end Generic_Keys; private type Set is tagged null record; Empty_Set : constant Set := (null record); type Cursor is null record; No_Element : constant Cursor := (null record); end Ada.Containers.Indefinite_Ordered_Sets;
------------------------------------------------------------------------------ -- -- -- THIS IS AN AUTOMATICALLY GENERATED FILE! DO NOT EDIT! -- -- -- -- WAVEFILES -- -- -- -- Wavefile data I/O operations -- -- -- -- The MIT License (MIT) -- -- -- -- Copyright (c) 2015 -- 2021 Gustavo A. Hoffmann -- -- -- -- 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. -- ------------------------------------------------------------------------------ #if NUM_TYPE'Defined and then (NUM_TYPE = "FLOAT") then package body Audio.Wavefiles.Generic_Float_Wav_IO is #else package body Audio.Wavefiles.Generic_Fixed_Wav_IO is #end if; #if NUM_TYPE'Defined and then (NUM_TYPE = "FLOAT") then #else procedure Read_Wav_Sample_Bytes (File_Access : Ada.Streams.Stream_IO.Stream_Access; Sample : out Wav_Sample) with Inline; procedure Write_Wav_Sample_Bytes (File_Access : Ada.Streams.Stream_IO.Stream_Access; Sample : Wav_Sample) with Inline; #end if; procedure Read_Wav_MC_Sample (WF : in out Wavefile; Wav : out Wav_MC_Sample) with Inline; procedure Write_Wav_MC_Sample (WF : in out Wavefile; Wav : Wav_MC_Sample) with Inline; #if NUM_TYPE'Defined and then (NUM_TYPE = "FLOAT") then #else --------------------------- -- Read_Wav_Sample_Bytes -- --------------------------- procedure Read_Wav_Sample_Bytes (File_Access : Ada.Streams.Stream_IO.Stream_Access; Sample : out Wav_Sample) is Bytes : Byte_Array (1 .. Sample'Size / 8) with Address => Sample'Address, Import, Volatile; Last_Valid_Byte : constant Long_Integer := Wav_Sample'Size / 8; use type Byte; begin Byte_Array'Read (File_Access, Bytes (1 .. Wav_Sample'Size / 8)); -- Account for sign bit in internal representation, -- which might not match the wavefile representation. if Sample'Size > Wav_Sample'Size then Bytes (Last_Valid_Byte + 1 .. Bytes'Last) := (others => (if Bytes (Last_Valid_Byte) >= 16#80# then 16#FF# else 16#00#)); end if; end Read_Wav_Sample_Bytes; ---------------------------- -- Write_Wav_Sample_Bytes -- ---------------------------- procedure Write_Wav_Sample_Bytes (File_Access : Ada.Streams.Stream_IO.Stream_Access; Sample : Wav_Sample) is Bytes : Byte_Array (1 .. Wav_Sample'Size / 8) with Address => Sample'Address, Import, Volatile; begin Byte_Array'Write (File_Access, Bytes); end Write_Wav_Sample_Bytes; #end if; ------------------------ -- Read_Wav_MC_Sample -- ------------------------ procedure Read_Wav_MC_Sample (WF : in out Wavefile; Wav : out Wav_MC_Sample) is N_Ch : constant Positive := Number_Of_Channels (WF); Sample : Wav_Sample; use Ada.Streams.Stream_IO; Prev_File_Index : constant Positive_Count := Index (WF.File) with Ghost; Expected_Byte_IO : constant Positive_Count := Positive_Count (To_Positive (WF.Wave_Format.Bits_Per_Sample) * N_Ch / 8) with Ghost; begin for J in Wav'Range loop #if NUM_TYPE'Defined and then (NUM_TYPE = "FLOAT") then Wav_Sample'Read (WF.File_Access, Sample); #else -- Patch for 24-bit wavefiles if Wav_Sample'Size = 24 then Read_Wav_Sample_Bytes (WF.File_Access, Sample); else Wav_Sample'Read (WF.File_Access, Sample); end if; #end if; Wav (J) := Sample; if Ada.Streams.Stream_IO.End_Of_File (WF.File) and then J < Wav'Last then -- Cannot read data for all channels WF.Set_Error (Wavefile_Error_File_Too_Short); end if; end loop; WF.Sample_Pos.Current := WF.Sample_Pos.Current + 1; pragma Assert (Ada.Streams.Stream_IO.Index (WF.File) = Prev_File_Index + Expected_Byte_IO); end Read_Wav_MC_Sample; ------------------------- -- Write_Wav_MC_Sample -- ------------------------- procedure Write_Wav_MC_Sample (WF : in out Wavefile; Wav : Wav_MC_Sample) is N_Ch : constant Positive := Number_Of_Channels (WF); use Ada.Streams.Stream_IO; Prev_File_Index : constant Positive_Count := Index (WF.File) with Ghost; Expected_Byte_IO : constant Positive_Count := Positive_Count (To_Positive (WF.Wave_Format.Bits_Per_Sample) * N_Ch / 8) with Ghost; begin #if NUM_TYPE'Defined and then (NUM_TYPE = "FLOAT") then Wav_MC_Sample'Write (WF.File_Access, Wav); #else if Wav_Sample'Size = 24 then for Sample of Wav loop Write_Wav_Sample_Bytes (WF.File_Access, Sample); end loop; else Wav_MC_Sample'Write (WF.File_Access, Wav); end if; #end if; WF.Sample_Pos := (Total => WF.Sample_Pos.Total + 1, Current => WF.Sample_Pos.Current + 1); pragma Assert (Ada.Streams.Stream_IO.Index (WF.File) = Prev_File_Index + Expected_Byte_IO); end Write_Wav_MC_Sample; --------- -- Get -- --------- function Get (WF : in out Wavefile) return Wav_MC_Sample is N_Ch : constant Positive := Number_Of_Channels (WF); Channel_Range_Valid_Last : constant Channel_Range := Channel_Range'Val (N_Ch - 1 + Channel_Range'Pos (Channel_Range'First)); subtype Valid_Channel_Range is Channel_Range range Channel_Range'First .. Channel_Range_Valid_Last; begin return Wav : Wav_MC_Sample (Valid_Channel_Range) do Read_Wav_MC_Sample (WF, Wav); end return; end Get; --------- -- Get -- --------- procedure Get (WF : in out Wavefile; Wav : out Wav_MC_Sample) is begin Read_Wav_MC_Sample (WF, Wav); end Get; --------- -- Put -- --------- procedure Put (WF : in out Wavefile; Wav : Wav_MC_Sample) is begin Write_Wav_MC_Sample (WF, Wav); end Put; #if NUM_TYPE'Defined and then (NUM_TYPE = "FLOAT") then end Audio.Wavefiles.Generic_Float_Wav_IO; #else end Audio.Wavefiles.Generic_Fixed_Wav_IO; #end if;
with ACO.CANopen; with Ada.Real_Time; private with ACO.Events; package ACO.Protocols.Network_Management.Masters is type Master (Id : ACO.Messages.Node_Nr; Handler : not null access ACO.CANopen.Handler; Od : not null access ACO.OD.Object_Dictionary'Class) is new NMT with private; procedure Request_State (This : in out Master; State : in ACO.States.State); procedure Set_Heartbeat_Timeout (This : in out Master; Timeout : in Natural); procedure Periodic_Actions (This : in out Master; T_Now : in Ada.Real_Time.Time); private type Heartbeat_Subscriber (Ref : not null access Master) is new ACO.Events.Event_Listener (ACO.Events.Heartbeat_Received) with null record; overriding procedure On_Event (This : in out Heartbeat_Subscriber; Data : in ACO.Events.Event_Data); type Master (Id : ACO.Messages.Node_Nr; Handler : not null access ACO.CANopen.Handler; Od : not null access ACO.OD.Object_Dictionary'Class) is new NMT (Id, Od) with record Heartbeat_Update : aliased Heartbeat_Subscriber (Master'Access); T_Heartbeat_Update : Ada.Real_Time.Time := Ada.Real_Time.Time_Last; Timeout_Ms : Natural := 0; end record; overriding procedure Initialize (This : in out Master); overriding procedure Finalize (This : in out Master); end ACO.Protocols.Network_Management.Masters;
-- Copyright 2019-2021 Simon Symeonidis (psyomn) -- -- Licensed under the Apache License, Version 2.0 (the "License"); -- you may not use this file except in compliance with the License. -- You may obtain a copy of the License at -- -- http://www.apache.org/licenses/LICENSE-2.0 -- -- Unless required by applicable law or agreed to in writing, software -- distributed under the License is distributed on an "AS IS" BASIS, -- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -- See the License for the specific language governing permissions and -- limitations under the License. with Ada.IO_Exceptions; with File_Utils; with Common_Utils; with HTTP_Status; use HTTP_Status; with Request_Helpers, Response_Helpers; use Request_Helpers, Response_Helpers; package body Transaction_Handlers is function Handle_Request (R : String; Context : String) return String is R_Type : constant Request_Method := Parse_Request_Type (R); URI : constant String := Parse_Request_URI (R); First, Last : Positive; begin case R_Type is when GET => Common_Utils.Empty_String_Range (Context, First, Last); -- TODO Sanitize URLs declare CFirst : constant Positive := Context'First; Path : constant String := Context (CFirst .. First) & URI; begin if File_Utils.Is_Dir (Path) then return Make_Response (OK, File_Utils.Read (Path & "/index.html")); else return Make_Response (OK, File_Utils.Read (Path)); end if; end; when POST | PUT | DELETE | HEAD | OPTIONS | TRACE => return Make_Response ( NOT_IMPLEMENTED, "<h1>Got Request - Haven't been implemented yet though</h1>" ); end case; exception when E : Ada.IO_Exceptions.Device_Error | Ada.IO_Exceptions.Name_Error => Common_Utils.Print_Exception (E, "request for a non existant resource"); return Make_Response ( NOT_FOUND, "Resource not found" ); when E : Request_Helpers.Request_Type_Error => Common_Utils.Print_Exception (E, "request type error"); return Make_Response ( BAD_REQUEST, "bad request" ); when E : others => Common_Utils.Print_Exception (E, "unknown error"); return Make_Response ( INTERNAL_ERROR, "something really bad happened" ); end Handle_Request; end Transaction_Handlers;
------------------------------------------------------------------------------ -- -- -- Copyright (C) 2016-2020, 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 System; with NRF_SVD.POWER; with NRF_SVD.CLOCK; with NRF_SVD.GPIOTE; with NRF_SVD.PPI; with NRF_SVD.RADIO; with NRF_SVD.TIMER; with NRF_SVD.RTC; with NRF_SVD.WDT; with NRF_SVD.RNG; with NRF_SVD.TEMP; with NRF_SVD.ECB; with NRF_SVD.CCM; with NRF_SVD.AAR; with NRF_SVD.TWI; with NRF_SVD.UART; with NRF_SVD.QDEC; with NRF_SVD.SAADC; with HAL; use HAL; package nRF.Tasks is procedure Trigger (T : Task_Type); -- Software task trigger function Get_Address (T : Task_Type) return System.Address; function Get_Address (T : Task_Type) return UInt32; -- Power management tasks Power_CONSTLAT : constant Task_Type; Power_LOWPWR : constant Task_Type; -- Clock tasks Clock_HFCLKSTART : constant Task_Type; Clock_HFCLKSTOP : constant Task_Type; Clock_LFCLKSTART : constant Task_Type; Clock_LFCLKSTOP : constant Task_Type; Clock_CAL : constant Task_Type; Clock_CTSTART : constant Task_Type; Clock_CTSTOP : constant Task_Type; -- GPIO tasks GPIOTE_OUT_0 : constant Task_Type; GPIOTE_OUT_1 : constant Task_Type; GPIOTE_OUT_2 : constant Task_Type; GPIOTE_OUT_3 : constant Task_Type; -- Programmable Peripheral Interconnect tasks PPI_CHG_0_EN : constant Task_Type; PPI_CHG_0_DIS : constant Task_Type; PPI_CHG_1_EN : constant Task_Type; PPI_CHG_1_DIS : constant Task_Type; PPI_CHG_2_EN : constant Task_Type; PPI_CHG_2_DIS : constant Task_Type; PPI_CHG_3_EN : constant Task_Type; PPI_CHG_3_DIS : constant Task_Type; -- Radio tasks Radio_TXEN : constant Task_Type; Radio_RXEN : constant Task_Type; Radio_START : constant Task_Type; Radio_STOP : constant Task_Type; Radio_DISABLE : constant Task_Type; Radio_RSSISTART : constant Task_Type; Radio_RSSISTOP : constant Task_Type; Radio_BCSTART : constant Task_Type; Radio_BCSTOP : constant Task_Type; -- Timer 0 tasks Timer_0_START : constant Task_Type; Timer_0_STOP : constant Task_Type; Timer_0_COUNT : constant Task_Type; Timer_0_CLEAR : constant Task_Type; Timer_0_CAPTURE_0 : constant Task_Type; Timer_0_CAPTURE_1 : constant Task_Type; Timer_0_CAPTURE_2 : constant Task_Type; Timer_0_CAPTURE_3 : constant Task_Type; -- Timer 1 tasks Timer_1_START : constant Task_Type; Timer_1_STOP : constant Task_Type; Timer_1_COUNT : constant Task_Type; Timer_1_CLEAR : constant Task_Type; Timer_1_CAPTURE_0 : constant Task_Type; Timer_1_CAPTURE_1 : constant Task_Type; Timer_1_CAPTURE_2 : constant Task_Type; Timer_1_CAPTURE_3 : constant Task_Type; -- Timer 2 tasks Timer_2_START : constant Task_Type; Timer_2_STOP : constant Task_Type; Timer_2_COUNT : constant Task_Type; Timer_2_CLEAR : constant Task_Type; Timer_2_CAPTURE_0 : constant Task_Type; Timer_2_CAPTURE_1 : constant Task_Type; Timer_2_CAPTURE_2 : constant Task_Type; Timer_2_CAPTURE_3 : constant Task_Type; -- RTC 0 tasks RTC_0_START : constant Task_Type; RTC_0_STOP : constant Task_Type; RTC_0_CLEAR : constant Task_Type; RTC_0_TRIGOVRFLW : constant Task_Type; -- RTC 1 tasks RTC_1_START : constant Task_Type; RTC_1_STOP : constant Task_Type; RTC_1_CLEAR : constant Task_Type; RTC_1_TRIGOVRFLW : constant Task_Type; -- Watchdog task Watchdog_START : constant Task_Type; -- Random Number Genrator tasks RNG_START : constant Task_Type; RNG_STOP : constant Task_Type; -- Temperature tasks Temperature_START : constant Task_Type; Temperature_STOP : constant Task_Type; -- AES Electronic Codebook mode encryption (ECB) tasks ECB_START : constant Task_Type; ECB_STOP : constant Task_Type; -- AES CCM mode encryption (CCM) tasks CCM_KSGEN : constant Task_Type; CCM_CRYPT : constant Task_Type; CCM_STOP : constant Task_Type; -- Accelerated Address Resolver (AAR) tasks AAR_START : constant Task_Type; AAR_STOP : constant Task_Type; -- Two Wire Interface (TWI) 0 tasks TWI_0_STARTRX : constant Task_Type; TWI_0_STARTTX : constant Task_Type; TWI_0_STOP : constant Task_Type; TWI_0_SUSPEND : constant Task_Type; TWI_0_RESUME : constant Task_Type; -- Two Wire Interface (TWI) 1 tasks TWI_1_STARTRX : constant Task_Type; TWI_1_STARTTX : constant Task_Type; TWI_1_STOP : constant Task_Type; TWI_1_SUSPEND : constant Task_Type; TWI_1_RESUME : constant Task_Type; -- Universal Asynchronous Receiver/Transmitter (UART) Tasks UART_STARTRX : constant Task_Type; UART_STOPRX : constant Task_Type; UART_STARTTX : constant Task_Type; UART_STOPTX : constant Task_Type; -- Quadrature Decoder (QDEC) QDEC_START : constant Task_Type; QDEC_STOP : constant Task_Type; QDEC_READCLRACC : constant Task_Type; -- Analog to Digital Converter (ADC) ADC_START : constant Task_Type; ADC_SAMPLE : constant Task_Type; ADC_STOP : constant Task_Type; private -- Power management tasks Power_CONSTLAT : constant Task_Type := Task_Type (NRF_SVD.POWER.POWER_Periph.TASKS_CONSTLAT'Address); Power_LOWPWR : constant Task_Type := Task_Type (NRF_SVD.POWER.POWER_Periph.TASKS_LOWPWR'Address); -- Clock tasks Clock_HFCLKSTART : constant Task_Type := Task_Type (NRF_SVD.CLOCK.CLOCK_Periph.TASKS_HFCLKSTART'Address); Clock_HFCLKSTOP : constant Task_Type := Task_Type (NRF_SVD.CLOCK.CLOCK_Periph.TASKS_HFCLKSTOP'Address); Clock_LFCLKSTART : constant Task_Type := Task_Type (NRF_SVD.CLOCK.CLOCK_Periph.TASKS_LFCLKSTART'Address); Clock_LFCLKSTOP : constant Task_Type := Task_Type (NRF_SVD.CLOCK.CLOCK_Periph.TASKS_LFCLKSTOP'Address); Clock_CAL : constant Task_Type := Task_Type (NRF_SVD.CLOCK.CLOCK_Periph.TASKS_CAL'Address); Clock_CTSTART : constant Task_Type := Task_Type (NRF_SVD.CLOCK.CLOCK_Periph.TASKS_CTSTART'Address); Clock_CTSTOP : constant Task_Type := Task_Type (NRF_SVD.CLOCK.CLOCK_Periph.TASKS_CTSTOP'Address); -- GPIOTE tasks GPIOTE_OUT_0 : constant Task_Type := Task_Type (NRF_SVD.GPIOTE.GPIOTE_Periph.TASKS_OUT (0)'Address); GPIOTE_OUT_1 : constant Task_Type := Task_Type (NRF_SVD.GPIOTE.GPIOTE_Periph.TASKS_OUT (1)'Address); GPIOTE_OUT_2 : constant Task_Type := Task_Type (NRF_SVD.GPIOTE.GPIOTE_Periph.TASKS_OUT (2)'Address); GPIOTE_OUT_3 : constant Task_Type := Task_Type (NRF_SVD.GPIOTE.GPIOTE_Periph.TASKS_OUT (3)'Address); -- Programmable Peripheral Interconnect Tasks PPI_CHG_0_EN : constant Task_Type := Task_Type (NRF_SVD.PPI.PPI_Periph.TASKS_CHG (0).EN'Address); PPI_CHG_0_DIS : constant Task_Type := Task_Type (NRF_SVD.PPI.PPI_Periph.TASKS_CHG (0).DIS'Address); PPI_CHG_1_EN : constant Task_Type := Task_Type (NRF_SVD.PPI.PPI_Periph.TASKS_CHG (1).EN'Address); PPI_CHG_1_DIS : constant Task_Type := Task_Type (NRF_SVD.PPI.PPI_Periph.TASKS_CHG (1).DIS'Address); PPI_CHG_2_EN : constant Task_Type := Task_Type (NRF_SVD.PPI.PPI_Periph.TASKS_CHG (2).EN'Address); PPI_CHG_2_DIS : constant Task_Type := Task_Type (NRF_SVD.PPI.PPI_Periph.TASKS_CHG (2).DIS'Address); PPI_CHG_3_EN : constant Task_Type := Task_Type (NRF_SVD.PPI.PPI_Periph.TASKS_CHG (3).EN'Address); PPI_CHG_3_DIS : constant Task_Type := Task_Type (NRF_SVD.PPI.PPI_Periph.TASKS_CHG (3).DIS'Address); -- Radio tasks Radio_TXEN : constant Task_Type := Task_Type (NRF_SVD.RADIO.RADIO_Periph.TASKS_TXEN'Address); Radio_RXEN : constant Task_Type := Task_Type (NRF_SVD.RADIO.RADIO_Periph.TASKS_RXEN'Address); Radio_START : constant Task_Type := Task_Type (NRF_SVD.RADIO.RADIO_Periph.TASKS_START'Address); Radio_STOP : constant Task_Type := Task_Type (NRF_SVD.RADIO.RADIO_Periph.TASKS_STOP'Address); Radio_DISABLE : constant Task_Type := Task_Type (NRF_SVD.RADIO.RADIO_Periph.TASKS_DISABLE'Address); Radio_RSSISTART : constant Task_Type := Task_Type (NRF_SVD.RADIO.RADIO_Periph.TASKS_RSSISTART'Address); Radio_RSSISTOP : constant Task_Type := Task_Type (NRF_SVD.RADIO.RADIO_Periph.TASKS_RSSISTOP'Address); Radio_BCSTART : constant Task_Type := Task_Type (NRF_SVD.RADIO.RADIO_Periph.TASKS_BCSTART'Address); Radio_BCSTOP : constant Task_Type := Task_Type (NRF_SVD.RADIO.RADIO_Periph.TASKS_BCSTOP'Address); -- Timer 0 tasks Timer_0_START : constant Task_Type := Task_Type (NRF_SVD.TIMER.TIMER0_Periph.TASKS_START'Address); Timer_0_STOP : constant Task_Type := Task_Type (NRF_SVD.TIMER.TIMER0_Periph.TASKS_START'Address); Timer_0_COUNT : constant Task_Type := Task_Type (NRF_SVD.TIMER.TIMER0_Periph.TASKS_START'Address); Timer_0_CLEAR : constant Task_Type := Task_Type (NRF_SVD.TIMER.TIMER0_Periph.TASKS_START'Address); Timer_0_CAPTURE_0 : constant Task_Type := Task_Type (NRF_SVD.TIMER.TIMER0_Periph.TASKS_START'Address); Timer_0_CAPTURE_1 : constant Task_Type := Task_Type (NRF_SVD.TIMER.TIMER0_Periph.TASKS_START'Address); Timer_0_CAPTURE_2 : constant Task_Type := Task_Type (NRF_SVD.TIMER.TIMER0_Periph.TASKS_START'Address); Timer_0_CAPTURE_3 : constant Task_Type := Task_Type (NRF_SVD.TIMER.TIMER0_Periph.TASKS_START'Address); -- Timer 1 tasks Timer_1_START : constant Task_Type := Task_Type (NRF_SVD.TIMER.TIMER1_Periph.TASKS_START'Address); Timer_1_STOP : constant Task_Type := Task_Type (NRF_SVD.TIMER.TIMER1_Periph.TASKS_START'Address); Timer_1_COUNT : constant Task_Type := Task_Type (NRF_SVD.TIMER.TIMER1_Periph.TASKS_START'Address); Timer_1_CLEAR : constant Task_Type := Task_Type (NRF_SVD.TIMER.TIMER1_Periph.TASKS_START'Address); Timer_1_CAPTURE_0 : constant Task_Type := Task_Type (NRF_SVD.TIMER.TIMER1_Periph.TASKS_START'Address); Timer_1_CAPTURE_1 : constant Task_Type := Task_Type (NRF_SVD.TIMER.TIMER1_Periph.TASKS_START'Address); Timer_1_CAPTURE_2 : constant Task_Type := Task_Type (NRF_SVD.TIMER.TIMER1_Periph.TASKS_START'Address); Timer_1_CAPTURE_3 : constant Task_Type := Task_Type (NRF_SVD.TIMER.TIMER1_Periph.TASKS_START'Address); -- Timer 2 tasks Timer_2_START : constant Task_Type := Task_Type (NRF_SVD.TIMER.TIMER2_Periph.TASKS_START'Address); Timer_2_STOP : constant Task_Type := Task_Type (NRF_SVD.TIMER.TIMER2_Periph.TASKS_START'Address); Timer_2_COUNT : constant Task_Type := Task_Type (NRF_SVD.TIMER.TIMER2_Periph.TASKS_START'Address); Timer_2_CLEAR : constant Task_Type := Task_Type (NRF_SVD.TIMER.TIMER2_Periph.TASKS_START'Address); Timer_2_CAPTURE_0 : constant Task_Type := Task_Type (NRF_SVD.TIMER.TIMER2_Periph.TASKS_START'Address); Timer_2_CAPTURE_1 : constant Task_Type := Task_Type (NRF_SVD.TIMER.TIMER2_Periph.TASKS_START'Address); Timer_2_CAPTURE_2 : constant Task_Type := Task_Type (NRF_SVD.TIMER.TIMER2_Periph.TASKS_START'Address); Timer_2_CAPTURE_3 : constant Task_Type := Task_Type (NRF_SVD.TIMER.TIMER2_Periph.TASKS_START'Address); -- RTC 0 tasks RTC_0_START : constant Task_Type := Task_Type (NRF_SVD.RTC.RTC0_Periph.TASKS_START'Address); RTC_0_STOP : constant Task_Type := Task_Type (NRF_SVD.RTC.RTC0_Periph.TASKS_STOP'Address); RTC_0_CLEAR : constant Task_Type := Task_Type (NRF_SVD.RTC.RTC0_Periph.TASKS_CLEAR'Address); RTC_0_TRIGOVRFLW : constant Task_Type := Task_Type (NRF_SVD.RTC.RTC0_Periph.TASKS_TRIGOVRFLW'Address); -- RTC 1 tasks RTC_1_START : constant Task_Type := Task_Type (NRF_SVD.RTC.RTC1_Periph.TASKS_START'Address); RTC_1_STOP : constant Task_Type := Task_Type (NRF_SVD.RTC.RTC1_Periph.TASKS_STOP'Address); RTC_1_CLEAR : constant Task_Type := Task_Type (NRF_SVD.RTC.RTC1_Periph.TASKS_CLEAR'Address); RTC_1_TRIGOVRFLW : constant Task_Type := Task_Type (NRF_SVD.RTC.RTC1_Periph.TASKS_TRIGOVRFLW'Address); -- Watchdog tasks Watchdog_START : constant Task_Type := Task_Type (NRF_SVD.WDT.WDT_Periph.TASKS_START'Address); -- Random Number Genrator tasks RNG_START : constant Task_Type := Task_Type (NRF_SVD.RNG.RNG_Periph.TASKS_START'Address); RNG_STOP : constant Task_Type := Task_Type (NRF_SVD.RNG.RNG_Periph.TASKS_START'Address); -- Temperature tasks Temperature_START : constant Task_Type := Task_Type (NRF_SVD.TEMP.TEMP_Periph.TASKS_START'Address); Temperature_STOP : constant Task_Type := Task_Type (NRF_SVD.TEMP.TEMP_Periph.TASKS_STOP'Address); -- AES Electronic Codebook mode encryption (ECB) tasks ECB_START : constant Task_Type := Task_Type (NRF_SVD.ECB.ECB_Periph.TASKS_STARTECB'Address); ECB_STOP : constant Task_Type := Task_Type (NRF_SVD.ECB.ECB_Periph.TASKS_STOPECB'Address); -- AES CCM mode encryption (CCM) tasks CCM_KSGEN : constant Task_Type := Task_Type (NRF_SVD.CCM.CCM_Periph.TASKS_KSGEN'Address); CCM_CRYPT : constant Task_Type := Task_Type (NRF_SVD.CCM.CCM_Periph.TASKS_CRYPT'Address); CCM_STOP : constant Task_Type := Task_Type (NRF_SVD.CCM.CCM_Periph.TASKS_STOP'Address); -- Accelerated Address Resolver (AAR) tasks AAR_START : constant Task_Type := Task_Type (NRF_SVD.AAR.AAR_Periph.TASKS_START'Address); AAR_STOP : constant Task_Type := Task_Type (NRF_SVD.AAR.AAR_Periph.TASKS_STOP'Address); -- Two Wire Interface (TWI) 0 tasks TWI_0_STARTRX : constant Task_Type := Task_Type (NRF_SVD.TWI.TWI0_Periph.TASKS_STARTRX'Address); TWI_0_STARTTX : constant Task_Type := Task_Type (NRF_SVD.TWI.TWI0_Periph.TASKS_STARTTX'Address); TWI_0_STOP : constant Task_Type := Task_Type (NRF_SVD.TWI.TWI0_Periph.TASKS_STOP'Address); TWI_0_SUSPEND : constant Task_Type := Task_Type (NRF_SVD.TWI.TWI0_Periph.TASKS_SUSPEND'Address); TWI_0_RESUME : constant Task_Type := Task_Type (NRF_SVD.TWI.TWI0_Periph.TASKS_RESUME'Address); -- Two Wire Interface (TWI) 1 tasks TWI_1_STARTRX : constant Task_Type := Task_Type (NRF_SVD.TWI.TWI1_Periph.TASKS_STARTRX'Address); TWI_1_STARTTX : constant Task_Type := Task_Type (NRF_SVD.TWI.TWI1_Periph.TASKS_STARTTX'Address); TWI_1_STOP : constant Task_Type := Task_Type (NRF_SVD.TWI.TWI1_Periph.TASKS_STOP'Address); TWI_1_SUSPEND : constant Task_Type := Task_Type (NRF_SVD.TWI.TWI1_Periph.TASKS_SUSPEND'Address); TWI_1_RESUME : constant Task_Type := Task_Type (NRF_SVD.TWI.TWI1_Periph.TASKS_RESUME'Address); -- Universal Asynchronous Receiver/Transmitter (UART) Tasks UART_STARTRX : constant Task_Type := Task_Type (NRF_SVD.UART.UART0_Periph.TASKS_STARTRX'Address); UART_STOPRX : constant Task_Type := Task_Type (NRF_SVD.UART.UART0_Periph.TASKS_STOPRX'Address); UART_STARTTX : constant Task_Type := Task_Type (NRF_SVD.UART.UART0_Periph.TASKS_STARTTX'Address); UART_STOPTX : constant Task_Type := Task_Type (NRF_SVD.UART.UART0_Periph.TASKS_STOPTX'Address); -- Quadrature Decoder (QDEC) QDEC_START : constant Task_Type := Task_Type (NRF_SVD.QDEC.QDEC_Periph.TASKS_START'Address); QDEC_STOP : constant Task_Type := Task_Type (NRF_SVD.QDEC.QDEC_Periph.TASKS_STOP'Address); QDEC_READCLRACC : constant Task_Type := Task_Type (NRF_SVD.QDEC.QDEC_Periph.TASKS_READCLRACC'Address); -- Analog to Digital Converter (ADC) ADC_START : constant Task_Type := Task_Type (NRF_SVD.SAADC.SAADC_Periph.TASKS_START'Address); ADC_STOP : constant Task_Type := Task_Type (NRF_SVD.SAADC.SAADC_Periph.TASKS_STOP'Address); ADC_SAMPLE : constant Task_Type := Task_Type (NRF_SVD.SAADC.SAADC_Periph.TASKS_SAMPLE'Address); end nRF.Tasks;
with STM32GD.Board; use STM32GD.Board; with Monotonic_Counter; procedure Main is begin Init; Text_IO.Put_Line ("Starting SYSTICK..."); Monotonic_Counter.Reset; loop STM32GD.WFI; end loop; end Main;
------------------------------------------------------------------------------ -- -- -- Matreshka Project -- -- -- -- Ada Modeling Framework -- -- -- -- Runtime Library Component -- -- -- ------------------------------------------------------------------------------ -- -- -- Copyright © 2011-2012, Vadim Godunko <vgodunko@gmail.com> -- -- All rights reserved. -- -- -- -- Redistribution and use in source and binary forms, with or without -- -- modification, are permitted provided that the following conditions -- -- are met: -- -- -- -- * Redistributions of source code must retain the above copyright -- -- notice, this list of conditions and the following disclaimer. -- -- -- -- * Redistributions in binary form must reproduce the above copyright -- -- notice, this list of conditions and the following disclaimer in the -- -- documentation and/or other materials provided with the distribution. -- -- -- -- * Neither the name of the Vadim Godunko, IE nor the names of its -- -- contributors may be used to endorse or promote products derived from -- -- this software without specific prior written permission. -- -- -- -- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -- -- "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -- -- LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -- -- A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -- -- HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -- -- SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED -- -- TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -- -- PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -- -- LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -- -- NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -- -- SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -- -- -- ------------------------------------------------------------------------------ -- $Revision$ $Date$ ------------------------------------------------------------------------------ -- This file is generated, don't edit it. ------------------------------------------------------------------------------ -- A constraint is a condition or restriction expressed in natural language -- text or in a machine readable language for the purpose of declaring some -- of the semantics of an element. ------------------------------------------------------------------------------ limited with AMF.UML.Elements.Collections; limited with AMF.UML.Namespaces; with AMF.UML.Packageable_Elements; limited with AMF.UML.Value_Specifications; package AMF.UML.Constraints is pragma Preelaborate; type UML_Constraint is limited interface and AMF.UML.Packageable_Elements.UML_Packageable_Element; type UML_Constraint_Access is access all UML_Constraint'Class; for UML_Constraint_Access'Storage_Size use 0; not overriding function Get_Constrained_Element (Self : not null access constant UML_Constraint) return AMF.UML.Elements.Collections.Ordered_Set_Of_UML_Element is abstract; -- Getter of Constraint::constrainedElement. -- -- The ordered set of Elements referenced by this Constraint. not overriding function Get_Context (Self : not null access constant UML_Constraint) return AMF.UML.Namespaces.UML_Namespace_Access is abstract; -- Getter of Constraint::context. -- -- Specifies the namespace that owns the NamedElement. not overriding procedure Set_Context (Self : not null access UML_Constraint; To : AMF.UML.Namespaces.UML_Namespace_Access) is abstract; -- Setter of Constraint::context. -- -- Specifies the namespace that owns the NamedElement. not overriding function Get_Specification (Self : not null access constant UML_Constraint) return AMF.UML.Value_Specifications.UML_Value_Specification_Access is abstract; -- Getter of Constraint::specification. -- -- A condition that must be true when evaluated in order for the -- constraint to be satisfied. not overriding procedure Set_Specification (Self : not null access UML_Constraint; To : AMF.UML.Value_Specifications.UML_Value_Specification_Access) is abstract; -- Setter of Constraint::specification. -- -- A condition that must be true when evaluated in order for the -- constraint to be satisfied. end AMF.UML.Constraints;
------------------------------------------------------------------------------ -- -- -- 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 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 stm32f4xx_hal_tim.c -- -- @author MCD Application Team -- -- @version V1.1.0 -- -- @date 19-June-2014 -- -- @brief timers HAL module driver. -- -- -- -- COPYRIGHT(c) 2014 STMicroelectronics -- ------------------------------------------------------------------------------ with STM32.Device; package body STM32.Timers is --------------- -- Configure -- --------------- procedure Configure (This : in out Timer; Prescaler : UInt16; Period : UInt32) is begin This.ARR := Period; This.Prescaler := Prescaler; end Configure; --------------- -- Configure -- --------------- procedure Configure (This : in out Timer; Prescaler : UInt16; Period : UInt32; Clock_Divisor : Timer_Clock_Divisor; Counter_Mode : Timer_Counter_Alignment_Mode) is begin This.ARR := Period; This.Prescaler := Prescaler; This.CR1.Clock_Division := Clock_Divisor; This.CR1.Mode_And_Dir := Counter_Mode; end Configure; ---------------------- -- Set_Counter_Mode -- ---------------------- procedure Set_Counter_Mode (This : in out Timer; Value : Timer_Counter_Alignment_Mode) is begin This.CR1.Mode_And_Dir := Value; end Set_Counter_Mode; ------------------------ -- Set_Clock_Division -- ------------------------ procedure Set_Clock_Division (This : in out Timer; Value : Timer_Clock_Divisor) is begin This.CR1.Clock_Division := Value; end Set_Clock_Division; ---------------------------- -- Current_Clock_Division -- ---------------------------- function Current_Clock_Division (This : Timer) return Timer_Clock_Divisor is begin return This.CR1.Clock_Division; end Current_Clock_Division; --------------- -- Configure -- --------------- procedure Configure (This : in out Timer; Prescaler : UInt16; Period : UInt32; Clock_Divisor : Timer_Clock_Divisor; Counter_Mode : Timer_Counter_Alignment_Mode; Repetitions : UInt8) is begin This.ARR := Period; This.Prescaler := Prescaler; This.CR1.Clock_Division := Clock_Divisor; This.CR1.Mode_And_Dir := Counter_Mode; This.RCR := UInt32 (Repetitions); This.EGR := Immediate'Enum_Rep; end Configure; ------------ -- Enable -- ------------ procedure Enable (This : in out Timer) is begin This.CR1.Timer_Enabled := True; end Enable; ------------- -- Enabled -- ------------- function Enabled (This : Timer) return Boolean is begin return This.CR1.Timer_Enabled; end Enabled; ------------------------ -- No_Outputs_Enabled -- ------------------------ function No_Outputs_Enabled (This : Timer) return Boolean is begin for C in Channel_1 .. Channel_3 loop if This.CCER (C).CCxE = Enable or This.CCER (C).CCxNE = Enable then return False; end if; end loop; -- Channel_4 doesn't have the complementary enabler and polarity bits. -- If it did they would be in the reserved area, which is zero, so we -- could be tricky and pretend that they exist for this function but -- doing that would be unnecessarily subtle. The money is on clarity. if This.CCER (Channel_4).CCxE = Enable then return False; end if; return True; end No_Outputs_Enabled; ------------- -- Disable -- ------------- procedure Disable (This : in out Timer) is begin if No_Outputs_Enabled (This) then This.CR1.Timer_Enabled := False; end if; end Disable; ------------------------ -- Enable_Main_Output -- ------------------------ procedure Enable_Main_Output (This : in out Timer) is begin This.BDTR.Main_Output_Enabled := True; end Enable_Main_Output; ------------------------- -- Disable_Main_Output -- ------------------------- procedure Disable_Main_Output (This : in out Timer) is begin if No_Outputs_Enabled (This) then This.BDTR.Main_Output_Enabled := False; end if; end Disable_Main_Output; ------------------------- -- Main_Output_Enabled -- ------------------------- function Main_Output_Enabled (This : Timer) return Boolean is begin return This.BDTR.Main_Output_Enabled; end Main_Output_Enabled; ----------------- -- Set_Counter -- ----------------- procedure Set_Counter (This : in out Timer; Value : UInt16) is begin This.Counter := UInt32 (Value); end Set_Counter; ----------------- -- Set_Counter -- ----------------- procedure Set_Counter (This : in out Timer; Value : UInt32) is begin This.Counter := Value; end Set_Counter; --------------------- -- Current_Counter -- --------------------- function Current_Counter (This : Timer) return UInt32 is begin return This.Counter; end Current_Counter; ---------------------------- -- Set_Repetition_Counter -- ---------------------------- procedure Set_Repetition_Counter (This : in out Timer; Value : UInt32) is begin This.RCR := Value; end Set_Repetition_Counter; -------------------------------- -- Current_Repetition_Counter -- -------------------------------- function Current_Repetition_Counter (This : Timer) return UInt32 is begin return This.RCR; end Current_Repetition_Counter; -------------------- -- Set_Autoreload -- -------------------- procedure Set_Autoreload (This : in out Timer; Value : UInt32) is begin This.ARR := Value; end Set_Autoreload; ------------------------ -- Current_Autoreload -- ------------------------ function Current_Autoreload (This : Timer) return UInt32 is begin return This.ARR; end Current_Autoreload; ---------------------- -- Enable_Interrupt -- ---------------------- procedure Enable_Interrupt (This : in out Timer; Source : Timer_Interrupt) is begin This.DIER := This.DIER or Source'Enum_Rep; end Enable_Interrupt; ---------------------- -- Enable_Interrupt -- ---------------------- procedure Enable_Interrupt (This : in out Timer; Sources : Timer_Interrupt_List) is begin for Source of Sources loop This.DIER := This.DIER or Source'Enum_Rep; end loop; end Enable_Interrupt; ----------------------- -- Disable_Interrupt -- ----------------------- procedure Disable_Interrupt (This : in out Timer; Source : Timer_Interrupt) is begin This.DIER := This.DIER and not Source'Enum_Rep; end Disable_Interrupt; ----------------------------- -- Clear_Pending_Interrupt -- ----------------------------- procedure Clear_Pending_Interrupt (This : in out Timer; Source : Timer_Interrupt) is begin This.SR := not Source'Enum_Rep; -- We do not, and must not, use the read-modify-write pattern because -- it leaves a window of vulnerability open to changes to the state -- after the read but before the write. The hardware for this register -- is designed so that writing other bits will not change them. This is -- indicated by the "rc_w0" notation in the status register definition. -- See the RM, page 57 for that notation explanation. end Clear_Pending_Interrupt; ----------------------- -- Interrupt_Enabled -- ----------------------- function Interrupt_Enabled (This : Timer; Source : Timer_Interrupt) return Boolean is begin return (This.DIER and Source'Enum_Rep) = Source'Enum_Rep; end Interrupt_Enabled; ------------ -- Status -- ------------ function Status (This : Timer; Flag : Timer_Status_Flag) return Boolean is begin return (This.SR and Flag'Enum_Rep) = Flag'Enum_Rep; end Status; ------------------ -- Clear_Status -- ------------------ procedure Clear_Status (This : in out Timer; Flag : Timer_Status_Flag) is begin This.SR := not Flag'Enum_Rep; -- We do not, and must not, use the read-modify-write pattern because -- it leaves a window of vulnerability open to changes to the state -- after the read but before the write. The hardware for this register -- is designed so that writing other bits will not change them. This is -- indicated by the "rc_w0" notation in the status register definition. -- See the RM, page 57 for that notation explanation. end Clear_Status; ----------------------- -- Enable_DMA_Source -- ----------------------- procedure Enable_DMA_Source (This : in out Timer; Source : Timer_DMA_Source) is begin This.DIER := This.DIER or Source'Enum_Rep; end Enable_DMA_Source; ------------------------ -- Disable_DMA_Source -- ------------------------ procedure Disable_DMA_Source (This : in out Timer; Source : Timer_DMA_Source) is begin This.DIER := This.DIER and not Source'Enum_Rep; end Disable_DMA_Source; ------------------------ -- DMA_Source_Enabled -- ------------------------ function DMA_Source_Enabled (This : Timer; Source : Timer_DMA_Source) return Boolean is begin return (This.DIER and Source'Enum_Rep) = Source'Enum_Rep; end DMA_Source_Enabled; ------------------------- -- Configure_Prescaler -- ------------------------- procedure Configure_Prescaler (This : in out Timer; Prescaler : UInt16; Reload_Mode : Timer_Prescaler_Reload_Mode) is begin This.Prescaler := Prescaler; This.EGR := Reload_Mode'Enum_Rep; end Configure_Prescaler; ------------------- -- Configure_DMA -- ------------------- procedure Configure_DMA (This : in out Timer; Base_Address : Timer_DMA_Base_Address; Burst_Length : Timer_DMA_Burst_Length) is begin This.DCR.Base_Address := Base_Address; This.DCR.Burst_Length := Burst_Length; end Configure_DMA; -------------------------------- -- Enable_Capture_Compare_DMA -- -------------------------------- procedure Enable_Capture_Compare_DMA (This : in out Timer) -- TODO: note that the CCDS field description in the RM, page 550, seems -- to indicate other than simply enabled/disabled is begin This.CR2.Capture_Compare_DMA_Selection := True; end Enable_Capture_Compare_DMA; --------------------------------- -- Disable_Capture_Compare_DMA -- --------------------------------- procedure Disable_Capture_Compare_DMA (This : in out Timer) -- TODO: note that the CCDS field description in the RM, page 550, seems -- to indicate other than simply enabled/disabled is begin This.CR2.Capture_Compare_DMA_Selection := False; end Disable_Capture_Compare_DMA; ----------------------- -- Current_Prescaler -- ----------------------- function Current_Prescaler (This : Timer) return UInt16 is begin return This.Prescaler; end Current_Prescaler; ----------------------- -- Set_UpdateDisable -- ----------------------- procedure Set_UpdateDisable (This : in out Timer; To : Boolean) is begin This.CR1.Update_Disable := To; end Set_UpdateDisable; ----------------------- -- Set_UpdateRequest -- ----------------------- procedure Set_UpdateRequest (This : in out Timer; Source : Timer_Update_Source) is begin This.CR1.Update_Request_Source := Source /= Global; end Set_UpdateRequest; ---------------------------- -- Set_Autoreload_Preload -- ---------------------------- procedure Set_Autoreload_Preload (This : in out Timer; To : Boolean) is begin This.CR1.ARPE := To; end Set_Autoreload_Preload; --------------------------- -- Select_One_Pulse_Mode -- --------------------------- procedure Select_One_Pulse_Mode (This : in out Timer; Mode : Timer_One_Pulse_Mode) is begin This.CR1.One_Pulse_Mode := Mode; end Select_One_Pulse_Mode; ---------------------------------- -- Compute_Prescaler_and_Period -- ---------------------------------- procedure Compute_Prescaler_And_Period (This : access Timer; Requested_Frequency : UInt32; Prescaler : out UInt32; Period : out UInt32) is Max_Prescaler : constant := 16#FFFF#; Max_Period : UInt32; Hardware_Frequency : UInt32; CK_CNT : UInt32; begin Hardware_Frequency := STM32.Device.Get_Clock_Frequency (This.all); if Has_32bit_Counter (This.all) then Max_Period := 16#FFFF_FFFF#; else Max_Period := 16#FFFF#; end if; if Requested_Frequency > Hardware_Frequency then raise Invalid_Request with "Frequency too high"; end if; Prescaler := 0; -- Corresponds to value 1 loop -- Compute the Counter's clock CK_CNT := Hardware_Frequency / (Prescaler + 1); -- Determine the CK_CNT periods to achieve the requested frequency Period := CK_CNT / Requested_Frequency; exit when ((Period <= Max_Period) or (Prescaler > Max_Prescaler)); Prescaler := Prescaler + 1; end loop; if Prescaler > Max_Prescaler then raise Invalid_Request with "Frequency too low"; end if; end Compute_Prescaler_And_Period; ----------------------- -- Counter_Direction -- ----------------------- function Current_Counter_Mode (This : Timer) return Timer_Counter_Alignment_Mode is begin if Basic_Timer (This) then return Up; else return This.CR1.Mode_And_Dir; end if; end Current_Counter_Mode; -------------------- -- Generate_Event -- -------------------- procedure Generate_Event (This : in out Timer; Source : Timer_Event_Source) is Temp_EGR : UInt32 := This.EGR; begin Temp_EGR := Temp_EGR or Source'Enum_Rep; This.EGR := Temp_EGR; end Generate_Event; --------------------------- -- Select_Output_Trigger -- --------------------------- procedure Select_Output_Trigger (This : in out Timer; Source : Timer_Trigger_Output_Source) is begin This.CR2.Master_Mode_Selection := Source; end Select_Output_Trigger; ----------------------- -- Select_Slave_Mode -- ----------------------- procedure Select_Slave_Mode (This : in out Timer; Mode : Timer_Slave_Mode) is begin case Mode is when Disabled .. External_1 => This.SMCR.Slave_Mode_Selection_2 := False; This.SMCR.Slave_Mode_Selection := UInt3 (Mode'Enum_Rep); when Combined_Reset_Trigger .. Quadrature_Encoder_Mode_5 => This.SMCR.Slave_Mode_Selection_2 := True; This.SMCR.Slave_Mode_Selection := UInt3 (Mode'Enum_Rep); end case; end Select_Slave_Mode; ------------------------------ -- Enable_Master_Slave_Mode -- ------------------------------ procedure Enable_Master_Slave_Mode (This : in out Timer) is begin This.SMCR.Master_Slave_Mode := True; end Enable_Master_Slave_Mode; ------------------------------- -- Disable_Master_Slave_Mode -- ------------------------------- procedure Disable_Master_Slave_Mode (This : in out Timer) is begin This.SMCR.Master_Slave_Mode := False; end Disable_Master_Slave_Mode; -------------------------------- -- Configure_External_Trigger -- -------------------------------- procedure Configure_External_Trigger (This : in out Timer; Polarity : Timer_External_Trigger_Polarity; Prescaler : Timer_External_Trigger_Prescaler; Filter : Timer_External_Trigger_Filter) is begin This.SMCR.External_Trigger_Polarity := Polarity; This.SMCR.External_Trigger_Prescaler := Prescaler; This.SMCR.External_Trigger_Filter := Filter; end Configure_External_Trigger; --------------------------------- -- Configure_As_External_Clock -- --------------------------------- procedure Configure_As_External_Clock (This : in out Timer; Source : Timer_Internal_Trigger_Source) is begin Select_Input_Trigger (This, Source); Select_Slave_Mode (This, External_1); end Configure_As_External_Clock; --------------------------------- -- Configure_As_External_Clock -- --------------------------------- procedure Configure_As_External_Clock (This : in out Timer; Source : Timer_External_Clock_Source; Polarity : Timer_Input_Capture_Polarity; Filter : Timer_Input_Capture_Filter) is begin if Source = Filtered_Timer_Input_2 then Configure_Channel_Input (This, Channel_2, Polarity, Direct_TI, Div1, -- default prescalar zero value Filter); else Configure_Channel_Input (This, Channel_1, Polarity, Direct_TI, Div1, -- default prescalar zero value Filter); end if; Select_Input_Trigger (This, Source); Select_Slave_Mode (This, External_1); end Configure_As_External_Clock; ------------------------------------ -- Configure_External_Clock_Mode1 -- ------------------------------------ procedure Configure_External_Clock_Mode1 (This : in out Timer; Polarity : Timer_External_Trigger_Polarity; Prescaler : Timer_External_Trigger_Prescaler; Filter : Timer_External_Trigger_Filter) is begin Configure_External_Trigger (This, Polarity, Prescaler, Filter); Select_Slave_Mode (This, External_1); Select_Input_Trigger (This, External_Trigger_Input); end Configure_External_Clock_Mode1; ------------------------------------ -- Configure_External_Clock_Mode2 -- ------------------------------------ procedure Configure_External_Clock_Mode2 (This : in out Timer; Polarity : Timer_External_Trigger_Polarity; Prescaler : Timer_External_Trigger_Prescaler; Filter : Timer_External_Trigger_Filter) is begin Configure_External_Trigger (This, Polarity, Prescaler, Filter); This.SMCR.External_Clock_Enable := True; end Configure_External_Clock_Mode2; -------------------------- -- Select_Input_Trigger -- -------------------------- procedure Select_Input_Trigger (This : in out Timer; Source : Timer_Trigger_Input_Source) is begin This.SMCR.Trigger_Selection := UInt3 (Source'Enum_Rep); This.SMCR.Trigger_Selection_1 := UInt2 (Shift_Right (UInt8 (Source'Enum_Rep), 3)); end Select_Input_Trigger; ------------------------------ -- Configure_Channel_Output -- ------------------------------ procedure Configure_Channel_Output (This : in out Timer; Channel : Timer_Channel; Mode : Timer_Output_Compare_And_PWM_Mode; State : Timer_Capture_Compare_State; Pulse : UInt32; Polarity : Timer_Output_Compare_Polarity) is begin -- first disable the channel CC output This.CCER (Channel).CCxE := Disable; Set_Output_Compare_Mode (This, Channel, Mode); This.CCER (Channel).CCxE := State; This.CCER (Channel).CCxP := Polarity'Enum_Rep; case Channel is when Channel_1 .. Channel_4 => This.CCR1_4 (Channel) := Pulse; when Channel_5 => This.CCR5 := Pulse; when Channel_6 => This.CCR6 := Pulse; end case; -- Only timers 2 and 5 have 32-bit CCR registers. The others must -- maintain the upper half at zero. We use a precondition to ensure -- values greater than a half-word are only specified for the proper -- timers. end Configure_Channel_Output; ------------------------------ -- Configure_Channel_Output -- ------------------------------ procedure Configure_Channel_Output (This : in out Timer; Channel : Timer_Channel; Mode : Timer_Output_Compare_And_PWM_Mode; State : Timer_Capture_Compare_State; Pulse : UInt32; Polarity : Timer_Output_Compare_Polarity; Idle_State : Timer_Capture_Compare_State; Complementary_Polarity : Timer_Output_Compare_Polarity; Complementary_Idle_State : Timer_Capture_Compare_State) is begin -- first disable the channel CC output This.CCER (Channel).CCxE := Disable; Set_Output_Compare_Mode (This, Channel, Mode); This.CCER (Channel).CCxE := State; This.CCER (Channel).CCxNP := Complementary_Polarity'Enum_Rep; This.CCER (Channel).CCxP := Polarity'Enum_Rep; case Channel is when Channel_1 => This.CR2.Channel_1_Output_Idle_State := Idle_State; This.CR2.Channel_1_Complementary_Output_Idle_State := Complementary_Idle_State; when Channel_2 => This.CR2.Channel_2_Output_Idle_State := Idle_State; This.CR2.Channel_2_Complementary_Output_Idle_State := Complementary_Idle_State; when Channel_3 => This.CR2.Channel_3_Output_Idle_State := Idle_State; This.CR2.Channel_3_Complementary_Output_Idle_State := Complementary_Idle_State; when Channel_4 => This.CR2.Channel_4_Output_Idle_State := Idle_State; when Channel_5 => This.CR2.Channel_5_Output_Idle_State := Idle_State; when Channel_6 => This.CR2.Channel_6_Output_Idle_State := Idle_State; end case; case Channel is when Channel_1 .. Channel_4 => This.CCR1_4 (Channel) := Pulse; when Channel_5 => This.CCR5 := Pulse; when Channel_6 => This.CCR6 := Pulse; end case; -- Only timers 2 and 5 have 32-bit CCR registers. The others must -- maintain the upper half at zero. We use a precondition to ensure -- values greater than a half-word are only specified for the proper -- timers. end Configure_Channel_Output; ----------------------- -- Set_Single_Output -- ----------------------- procedure Set_Single_Output (This : in out Timer; Channel : Timer_Channel; Mode : Timer_Output_Compare_And_PWM_Mode; OC_Clear_Enabled : Boolean; Preload_Enabled : Boolean; Fast_Enabled : Boolean) is CCMR_Index : CCMRx_Index; Descriptor_Index : Half_Index; Temp : TIMx_CCMRx; Mode0_2 : UInt3; Mode_3 : Boolean; Description_1 : Lower_Channel_Output_Descriptor; Description_2 : Higher_Channel_Output_Descriptor; begin case Channel is when Channel_1 => CCMR_Index := 1; Descriptor_Index := 1; when Channel_2 => CCMR_Index := 1; Descriptor_Index := 2; when Channel_3 => CCMR_Index := 2; Descriptor_Index := 1; when Channel_4 => CCMR_Index := 2; Descriptor_Index := 2; when Channel_5 => CCMR_Index := 3; Descriptor_Index := 1; when Channel_6 => CCMR_Index := 3; Descriptor_Index := 2; end case; case CCMR_Index is -- effectively get CCMR1, CCMR2 or CCMR3 when 1 => Temp := This.CCMR1; when 2 => Temp := This.CCMR2; when 3 => Temp := This.CCMR3; end case; Mode0_2 := UInt3 (Mode'Enum_Rep); Mode_3 := Mode'Enum_Rep > 7; Description_1 := (OCxMode => Mode0_2, OCxFast_Enable => Fast_Enabled, OCxPreload_Enable => Preload_Enabled, OCxClear_Enable => OC_Clear_Enabled); Description_2 := (OCxMode_3 => Mode_3); Temp.Low_Descriptors (Descriptor_Index) := (Output, Description_1); Temp.High_Descriptors (Descriptor_Index) := (Output, Description_2); case CCMR_Index is when 1 => This.CCMR1 := Temp; when 2 => This.CCMR2 := Temp; when 3 => This.CCMR3 := Temp; end case; end Set_Single_Output; ----------------------------- -- Set_Output_Compare_Mode -- ----------------------------- procedure Set_Output_Compare_Mode (This : in out Timer; Channel : Timer_Channel; Mode : Timer_Output_Compare_And_PWM_Mode) is CCMR_Index : CCMRx_Index; Descriptor_Index : Half_Index; Temp : TIMx_CCMRx; Mode0_2 : UInt3; Mode_3 : Boolean; begin case Channel is when Channel_1 => CCMR_Index := 1; Descriptor_Index := 1; when Channel_2 => CCMR_Index := 1; Descriptor_Index := 2; when Channel_3 => CCMR_Index := 2; Descriptor_Index := 1; when Channel_4 => CCMR_Index := 2; Descriptor_Index := 2; when Channel_5 => CCMR_Index := 3; Descriptor_Index := 1; when Channel_6 => CCMR_Index := 3; Descriptor_Index := 2; end case; case CCMR_Index is -- effectively get CCMR1, CCMR2 or CCMR3 when 1 => Temp := This.CCMR1; when 2 => Temp := This.CCMR2; when 3 => Temp := This.CCMR3; end case; if Temp.Low_Descriptors (Descriptor_Index).CCxSelection /= Output then raise Timer_Channel_Access_Error; end if; Mode0_2 := UInt3 (Mode'Enum_Rep); Mode_3 := Mode'Enum_Rep > 7; Temp.Low_Descriptors (Descriptor_Index).Compare_1.OCxMode := Mode0_2; Temp.High_Descriptors (Descriptor_Index).Compare_2.OCxMode_3 := Mode_3; case CCMR_Index is when 1 => This.CCMR1 := Temp; when 2 => This.CCMR2 := Temp; when 3 => This.CCMR3 := Temp; end case; end Set_Output_Compare_Mode; ---------------------------------- -- Current_Capture_Compare_Mode -- ---------------------------------- function Current_Capture_Compare_Mode (This : Timer; Channel : Timer_Channel) return Timer_Capture_Compare_Modes is CCMR_Index : CCMRx_Index; Descriptor_Index : Half_Index; Temp : TIMx_CCMRx; begin case Channel is when Channel_1 => CCMR_Index := 1; Descriptor_Index := 1; when Channel_2 => CCMR_Index := 1; Descriptor_Index := 2; when Channel_3 => CCMR_Index := 2; Descriptor_Index := 1; when Channel_4 => CCMR_Index := 2; Descriptor_Index := 2; when Channel_5 => CCMR_Index := 3; Descriptor_Index := 1; when Channel_6 => CCMR_Index := 3; Descriptor_Index := 2; end case; case CCMR_Index is -- effectively get CCMR1, CCMR2 or CCMR3 when 1 => Temp := This.CCMR1; return Temp.Low_Descriptors (Descriptor_Index).CCxSelection; when 2 => Temp := This.CCMR2; return Temp.Low_Descriptors (Descriptor_Index).CCxSelection; when 3 => Temp := This.CCMR3; return Temp.Low_Descriptors (Descriptor_Index).CCxSelection; end case; end Current_Capture_Compare_Mode; ------------------------------ -- Set_Output_Forced_Action -- ------------------------------ procedure Set_Output_Forced_Action (This : in out Timer; Channel : Timer_Channel; Active : Boolean) is CCMR_Index : CCMRx_Index; Descriptor_Index : Half_Index; Temp : TIMx_CCMRx; Mode0_2 : UInt3; Mode_3 : Boolean; begin case Channel is when Channel_1 => CCMR_Index := 1; Descriptor_Index := 1; when Channel_2 => CCMR_Index := 1; Descriptor_Index := 2; when Channel_3 => CCMR_Index := 2; Descriptor_Index := 1; when Channel_4 => CCMR_Index := 2; Descriptor_Index := 2; when Channel_5 => CCMR_Index := 3; Descriptor_Index := 1; when Channel_6 => CCMR_Index := 3; Descriptor_Index := 2; end case; case CCMR_Index is -- effectively get CCMR1, CCMR2 or CCMR3 when 1 => Temp := This.CCMR1; when 2 => Temp := This.CCMR2; when 3 => Temp := This.CCMR3; end case; if Temp.Low_Descriptors (Descriptor_Index).CCxSelection /= Output then raise Timer_Channel_Access_Error; end if; if Active then Mode0_2 := UInt3 (Force_Active'Enum_Rep); Mode_3 := Force_Active'Enum_Rep > 7; Temp.Low_Descriptors (Descriptor_Index).Compare_1.OCxMode := Mode0_2; Temp.High_Descriptors (Descriptor_Index).Compare_2.OCxMode_3 := Mode_3; else Mode0_2 := UInt3 (Force_Inactive'Enum_Rep); Mode_3 := Force_Inactive'Enum_Rep > 7; Temp.Low_Descriptors (Descriptor_Index).Compare_1.OCxMode := Mode0_2; Temp.High_Descriptors (Descriptor_Index).Compare_2.OCxMode_3 := Mode_3; end if; case CCMR_Index is when 1 => This.CCMR1 := Temp; when 2 => This.CCMR2 := Temp; when 3 => This.CCMR3 := Temp; end case; end Set_Output_Forced_Action; ------------------------------- -- Set_Output_Preload_Enable -- ------------------------------- procedure Set_Output_Preload_Enable (This : in out Timer; Channel : Timer_Channel; Enabled : Boolean) is CCMR_Index : CCMRx_Index; Descriptor_Index : Half_Index; Temp : TIMx_CCMRx; begin case Channel is when Channel_1 => CCMR_Index := 1; Descriptor_Index := 1; when Channel_2 => CCMR_Index := 1; Descriptor_Index := 2; when Channel_3 => CCMR_Index := 2; Descriptor_Index := 1; when Channel_4 => CCMR_Index := 2; Descriptor_Index := 2; when Channel_5 => CCMR_Index := 3; Descriptor_Index := 1; when Channel_6 => CCMR_Index := 3; Descriptor_Index := 2; end case; case CCMR_Index is -- effectively get CCMR1, CCMR2 or CCMR3 when 1 => Temp := This.CCMR1; when 2 => Temp := This.CCMR2; when 3 => Temp := This.CCMR3; end case; Temp.Low_Descriptors (Descriptor_Index).Compare_1.OCxPreload_Enable := Enabled; case CCMR_Index is when 1 => This.CCMR1 := Temp; when 2 => This.CCMR2 := Temp; when 3 => This.CCMR3 := Temp; end case; end Set_Output_Preload_Enable; ---------------------------- -- Set_Output_Fast_Enable -- ---------------------------- procedure Set_Output_Fast_Enable (This : in out Timer; Channel : Timer_Channel; Enabled : Boolean) is CCMR_Index : CCMRx_Index; Descriptor_Index : Half_Index; Temp : TIMx_CCMRx; begin case Channel is when Channel_1 => CCMR_Index := 1; Descriptor_Index := 1; when Channel_2 => CCMR_Index := 1; Descriptor_Index := 2; when Channel_3 => CCMR_Index := 2; Descriptor_Index := 1; when Channel_4 => CCMR_Index := 2; Descriptor_Index := 2; when Channel_5 => CCMR_Index := 3; Descriptor_Index := 1; when Channel_6 => CCMR_Index := 3; Descriptor_Index := 2; end case; case CCMR_Index is -- effectively get CCMR1, CCMR2 or CCMR3 when 1 => Temp := This.CCMR1; when 2 => Temp := This.CCMR2; when 3 => Temp := This.CCMR3; end case; Temp.Low_Descriptors (Descriptor_Index).Compare_1.OCxFast_Enable := Enabled; case CCMR_Index is when 1 => This.CCMR1 := Temp; when 2 => This.CCMR2 := Temp; when 3 => This.CCMR3 := Temp; end case; end Set_Output_Fast_Enable; ----------------------- -- Set_Clear_Control -- ----------------------- procedure Set_Clear_Control (This : in out Timer; Channel : Timer_Channel; Enabled : Boolean) is CCMR_Index : CCMRx_Index; Descriptor_Index : Half_Index; Temp : TIMx_CCMRx; begin case Channel is when Channel_1 => CCMR_Index := 1; Descriptor_Index := 1; when Channel_2 => CCMR_Index := 1; Descriptor_Index := 2; when Channel_3 => CCMR_Index := 2; Descriptor_Index := 1; when Channel_4 => CCMR_Index := 2; Descriptor_Index := 2; when Channel_5 => CCMR_Index := 3; Descriptor_Index := 1; when Channel_6 => CCMR_Index := 3; Descriptor_Index := 2; end case; case CCMR_Index is -- effectively get CCMR1, CCMR2 or CCMR3 when 1 => Temp := This.CCMR1; when 2 => Temp := This.CCMR2; when 3 => Temp := This.CCMR3; end case; Temp.Low_Descriptors (Descriptor_Index).Compare_1.OCxClear_Enable := Enabled; case CCMR_Index is when 1 => This.CCMR1 := Temp; when 2 => This.CCMR2 := Temp; when 3 => This.CCMR3 := Temp; end case; end Set_Clear_Control; -------------------- -- Enable_Channel -- -------------------- procedure Enable_Channel (This : in out Timer; Channel : Timer_Channel) is Temp_EGR : UInt32 := This.EGR; begin This.CCER (Channel).CCxE := Enable; -- Trigger an event to initialize preload register Temp_EGR := Temp_EGR or (2 ** (Timer_Channel'Pos (Channel) + 1)); This.EGR := Temp_EGR; end Enable_Channel; ------------------------- -- Set_Output_Polarity -- ------------------------- procedure Set_Output_Polarity (This : in out Timer; Channel : Timer_Channel; Polarity : Timer_Output_Compare_Polarity) is begin This.CCER (Channel).CCxP := Polarity'Enum_Rep; end Set_Output_Polarity; --------------------------------------- -- Set_Output_Complementary_Polarity -- --------------------------------------- procedure Set_Output_Complementary_Polarity (This : in out Timer; Channel : Timer_Channel; Polarity : Timer_Output_Compare_Polarity) is begin This.CCER (Channel).CCxNP := Polarity'Enum_Rep; end Set_Output_Complementary_Polarity; --------------------- -- Disable_Channel -- --------------------- procedure Disable_Channel (This : in out Timer; Channel : Timer_Channel) is begin This.CCER (Channel).CCxE := Disable; end Disable_Channel; --------------------- -- Channel_Enabled -- --------------------- function Channel_Enabled (This : Timer; Channel : Timer_Channel) return Boolean is begin return This.CCER (Channel).CCxE = Enable; end Channel_Enabled; ---------------------------------- -- Enable_Complementary_Channel -- ---------------------------------- procedure Enable_Complementary_Channel (This : in out Timer; Channel : Timer_Channel) is begin This.CCER (Channel).CCxNE := Enable; end Enable_Complementary_Channel; ----------------------------------- -- Disable_Complementary_Channel -- ----------------------------------- procedure Disable_Complementary_Channel (This : in out Timer; Channel : Timer_Channel) is begin This.CCER (Channel).CCxNE := Disable; end Disable_Complementary_Channel; ----------------------------------- -- Complementary_Channel_Enabled -- ----------------------------------- function Complementary_Channel_Enabled (This : Timer; Channel : Timer_Channel) return Boolean is begin return This.CCER (Channel).CCxNE = Enable; end Complementary_Channel_Enabled; ----------------------- -- Set_Compare_Value -- ----------------------- procedure Set_Compare_Value (This : in out Timer; Channel : Timer_Channel; Word_Value : UInt32) is begin This.CCR1_4 (Channel) := Word_Value; -- Timers 2 and 5 really do have 32-bit capture/compare registers so we -- don't need to require half-words as inputs. end Set_Compare_Value; ----------------------- -- Set_Compare_Value -- ----------------------- procedure Set_Compare_Value (This : in out Timer; Channel : Timer_Channel; Value : UInt16) is begin This.CCR1_4 (Channel) := UInt32 (Value); -- These capture/compare registers are really only 15-bits wide, except -- for those of timers 2 and 5. For the sake of simplicity we represent -- all of them with full words, but only write word values when -- appropriate. The caller has to treat them as half-word values, since -- that's the type for the formal parameter, therefore our casting up to -- a word value will retain the reserved upper half-word value of zero. end Set_Compare_Value; --------------------------- -- Current_Capture_Value -- --------------------------- function Current_Capture_Value (This : Timer; Channel : Timer_Channel) return UInt32 is begin return This.CCR1_4 (Channel); end Current_Capture_Value; --------------------------- -- Current_Capture_Value -- --------------------------- function Current_Capture_Value (This : Timer; Channel : Timer_Channel) return UInt16 is begin return UInt16 (This.CCR1_4 (Channel)); end Current_Capture_Value; ------------------------------------- -- Write_Channel_Input_Description -- ------------------------------------- procedure Write_Channel_Input_Description (This : in out Timer; Channel : Timer_Channel; Kind : Timer_Input_Capture_Selection; Description : Lower_Channel_Input_Descriptor) is CCMR_Index : CCMRx_Index; Descriptor_Index : Half_Index; Temp : TIMx_CCMRx; New_Value : Lower_IO_Descriptor; begin case Kind is when Direct_TI => New_Value := (CCxSelection => Direct_TI, Capture => Description); when Indirect_TI => New_Value := (CCxSelection => Indirect_TI, Capture => Description); when TRC => New_Value := (CCxSelection => TRC, Capture => Description); end case; case Channel is when Channel_1 => CCMR_Index := 1; Descriptor_Index := 1; when Channel_2 => CCMR_Index := 1; Descriptor_Index := 2; when Channel_3 => CCMR_Index := 2; Descriptor_Index := 1; when Channel_4 => CCMR_Index := 2; Descriptor_Index := 2; when others => null; end case; case CCMR_Index is -- effectively get CCMR1 or CCMR2 when 1 => Temp := This.CCMR1; when 2 => Temp := This.CCMR2; when 3 => null; end case; Temp.Low_Descriptors (Descriptor_Index) := New_Value; case CCMR_Index is when 1 => This.CCMR1 := Temp; when 2 => This.CCMR2 := Temp; when 3 => null; end case; end Write_Channel_Input_Description; ------------------------- -- Set_Input_Prescaler -- ------------------------- procedure Set_Input_Prescaler (This : in out Timer; Channel : Timer_Channel; Value : Timer_Input_Capture_Prescaler) is CCMR_Index : CCMRx_Index; Descriptor_Index : Half_Index; Temp : TIMx_CCMRx; begin case Channel is when Channel_1 => CCMR_Index := 1; Descriptor_Index := 1; when Channel_2 => CCMR_Index := 1; Descriptor_Index := 2; when Channel_3 => CCMR_Index := 2; Descriptor_Index := 1; when Channel_4 => CCMR_Index := 2; Descriptor_Index := 2; when others => null; end case; case CCMR_Index is -- effectively get CCMR1 or CCMR2 when 1 => Temp := This.CCMR1; when 2 => Temp := This.CCMR2; when 3 => null; end case; Temp.Low_Descriptors (Descriptor_Index).Capture.ICxPrescaler := Value; case CCMR_Index is when 1 => This.CCMR1 := Temp; when 2 => This.CCMR2 := Temp; when 3 => null; end case; end Set_Input_Prescaler; ----------------------------- -- Current_Input_Prescaler -- ----------------------------- function Current_Input_Prescaler (This : Timer; Channel : Timer_Channel) return Timer_Input_Capture_Prescaler is CCMR_Index : CCMRx_Index; Descriptor_Index : Half_Index; Temp : TIMx_CCMRx; begin case Channel is when Channel_1 => CCMR_Index := 1; Descriptor_Index := 1; when Channel_2 => CCMR_Index := 1; Descriptor_Index := 2; when Channel_3 => CCMR_Index := 2; Descriptor_Index := 1; when Channel_4 => CCMR_Index := 2; Descriptor_Index := 2; when others => null; end case; case CCMR_Index is -- effectively get CCMR1 or CCMR2 when 1 => Temp := This.CCMR1; when 2 => Temp := This.CCMR2; when 3 => null; end case; return Temp.Low_Descriptors (Descriptor_Index).Capture.ICxPrescaler; end Current_Input_Prescaler; ----------------------------- -- Configure_Channel_Input -- ----------------------------- procedure Configure_Channel_Input (This : in out Timer; Channel : Timer_Channel; Polarity : Timer_Input_Capture_Polarity; Selection : Timer_Input_Capture_Selection; Prescaler : Timer_Input_Capture_Prescaler; Filter : Timer_Input_Capture_Filter) is Input : Lower_Channel_Input_Descriptor; begin -- first disable the channel This.CCER (Channel).CCxE := Disable; Input := (ICxFilter => Filter, ICxPrescaler => Prescaler); Write_Channel_Input_Description (This => This, Channel => Channel, Kind => Selection, Description => Input); case Polarity is when Rising => This.CCER (Channel).CCxNP := 0; This.CCER (Channel).CCxP := 0; when Falling => This.CCER (Channel).CCxNP := 0; This.CCER (Channel).CCxP := 1; when Both_Edges => This.CCER (Channel).CCxNP := 1; This.CCER (Channel).CCxP := 1; end case; This.CCER (Channel).CCxE := Enable; end Configure_Channel_Input; --------------------------------- -- Configure_Channel_Input_PWM -- --------------------------------- procedure Configure_Channel_Input_PWM (This : in out Timer; Channel : Timer_Channel; Selection : Timer_Input_Capture_Selection; Polarity : Timer_Input_Capture_Polarity; Prescaler : Timer_Input_Capture_Prescaler; Filter : Timer_Input_Capture_Filter) is Opposite_Polarity : Timer_Input_Capture_Polarity; Opposite_Selection : Timer_Input_Capture_Selection; begin Disable_Channel (This, Channel); if Polarity = Rising then Opposite_Polarity := Falling; else Opposite_Polarity := Rising; end if; if Selection = Indirect_TI then Opposite_Selection := Direct_TI; else Opposite_Selection := Indirect_TI; end if; if Channel = Channel_1 then Configure_Channel_Input (This, Channel_1, Polarity, Selection, Prescaler, Filter); Configure_Channel_Input (This, Channel_2, Opposite_Polarity, Opposite_Selection, Prescaler, Filter); else Configure_Channel_Input (This, Channel_2, Polarity, Selection, Prescaler, Filter); Configure_Channel_Input (This, Channel_1, Opposite_Polarity, Opposite_Selection, Prescaler, Filter); end if; Enable_Channel (This, Channel); end Configure_Channel_Input_PWM; ------------------------------- -- Enable_CC_Preload_Control -- ------------------------------- procedure Enable_CC_Preload_Control (This : in out Timer) is begin This.CR2.Capture_Compare_Preloaded_Control := True; end Enable_CC_Preload_Control; -------------------------------- -- Disable_CC_Preload_Control -- -------------------------------- procedure Disable_CC_Preload_Control (This : in out Timer) is begin This.CR2.Capture_Compare_Preloaded_Control := False; end Disable_CC_Preload_Control; ------------------------ -- Select_Commutation -- ------------------------ procedure Select_Commutation (This : in out Timer) is begin This.CR2.Capture_Compare_Control_Update_Selection := True; end Select_Commutation; -------------------------- -- Deselect_Commutation -- -------------------------- procedure Deselect_Commutation (This : in out Timer) is begin This.CR2.Capture_Compare_Control_Update_Selection := False; end Deselect_Commutation; --------------------- -- Configure_Break -- --------------------- procedure Configure_Break (This : in out Timer; Automatic_Output_Enabled : Boolean; Break_Polarity : Timer_Break_Polarity; Break_Enabled : Boolean; Break_Filter : Timer_Break_Filter; Off_State_Selection_Run_Mode : Bit; Off_State_Selection_Idle_Mode : Bit) is begin This.BDTR.Automatic_Output_Enabled := Automatic_Output_Enabled; This.BDTR.Break_Polarity := Break_Polarity; This.BDTR.Break_Enable := Break_Enabled; This.BDTR.Break_Filter := Break_Filter; This.BDTR.Off_State_Selection_Run_Mode := Off_State_Selection_Run_Mode; This.BDTR.Off_State_Selection_Idle_Mode := Off_State_Selection_Idle_Mode; end Configure_Break; --------------------- -- Configure_Break -- --------------------- procedure Configure_Break (This : in out Timer; Automatic_Output_Enabled : Boolean; Break_Polarity : Timer_Break_Polarity; Break_Enabled : Boolean; Break_Filter : Timer_Break_Filter; Break_2_Polarity : Timer_Break_Polarity; Break_2_Enabled : Boolean; Break_2_Filter : Timer_Break_Filter; Off_State_Selection_Run_Mode : Bit; Off_State_Selection_Idle_Mode : Bit) is begin This.BDTR.Automatic_Output_Enabled := Automatic_Output_Enabled; This.BDTR.Break_Polarity := Break_Polarity; This.BDTR.Break_Enable := Break_Enabled; This.BDTR.Break_2_Filter := Break_2_Filter; This.BDTR.Break_2_Polarity := Break_2_Polarity; This.BDTR.Break_2_Enable := Break_2_Enabled; This.BDTR.Break_Filter := Break_Filter; This.BDTR.Off_State_Selection_Run_Mode := Off_State_Selection_Run_Mode; This.BDTR.Off_State_Selection_Idle_Mode := Off_State_Selection_Idle_Mode; end Configure_Break; ------------------------ -- Configure_Deadtime -- ------------------------ procedure Configure_Deadtime (This : in out Timer; Time : Float) is Timer_Frequency : constant UInt32 := STM32.Device.Get_Clock_Frequency (This); -- The clock frequency of this timer. Clock_Divisor : constant Float := (case Current_Clock_Division (This) is when Div1 => 1.0, when Div2 => 2.0, when Div4 => 4.0); -- The division factor for dead-time of this timer. T_DTS : constant Float := Clock_Divisor / Float (Timer_Frequency); -- Time period for one cycle of the input timer frequency. Deadtime : UInt8 := 0; begin declare Tick_Time : Float; -- Time for one tick of the timer. DT_Max_Factor : constant array (0 .. 3) of Float := (2.0**7 - 1.0, (64.0 + 2.0**6 - 1.0) * 2.0, (32.0 + 2.0**5 - 1.0) * 8.0, (32.0 + 2.0**5 - 1.0) * 16.0); begin for I in DT_Max_Factor'Range loop if Time <= DT_Max_Factor (I) * T_DTS then case I is when 0 => Tick_Time := Time / T_DTS; Deadtime := UInt8 (UInt7 (Tick_Time)); exit; when 1 => Tick_Time := Time / T_DTS / 2.0 - 64.0; Deadtime := 16#80# + UInt8 (UInt6 (Tick_Time)); exit; when 2 => Tick_Time := Time / T_DTS / 8.0 - 32.0; Deadtime := 16#C0# + UInt8 (UInt5 (Tick_Time)); exit; when 3 => Tick_Time := Time / T_DTS / 16.0 - 32.0; Deadtime := 16#E0# + UInt8 (UInt5 (Tick_Time)); exit; end case; end if; end loop; end; This.BDTR.Deadtime_Generator := Deadtime; end Configure_Deadtime; ------------------- -- Set_BDTR_Lock -- ------------------- procedure Set_BDTR_Lock (This : in out Timer; Lock : Timer_Lock_Level) is begin This.BDTR.Lock := Lock; end Set_BDTR_Lock; --------------------------------- -- Configure_Encoder_Interface -- --------------------------------- procedure Configure_Encoder_Interface (This : in out Timer; Mode : Timer_Encoder_Mode; IC1_Polarity : Timer_Input_Capture_Polarity; IC2_Polarity : Timer_Input_Capture_Polarity) is begin case Mode is when Quadrature_Encoder_Mode_1 .. Quadrature_Encoder_Mode_3 => This.SMCR.Slave_Mode_Selection_2 := False; This.SMCR.Slave_Mode_Selection := UInt3 (Mode'Enum_Rep); when Encoder_Mode_1 .. Quadrature_Encoder_Mode_5 => This.SMCR.Slave_Mode_Selection_2 := True; This.SMCR.Slave_Mode_Selection := UInt3 (Mode'Enum_Rep); end case; Write_Channel_Input_Description (This, Channel => Channel_1, Kind => Direct_TI, Description => Lower_Channel_Input_Descriptor'(ICxFilter => No_Filter, ICxPrescaler => Div1)); Write_Channel_Input_Description (This, Channel => Channel_2, Kind => Direct_TI, Description => Lower_Channel_Input_Descriptor'(ICxFilter => No_Filter, ICxPrescaler => Div1)); case IC1_Polarity is when Rising => This.CCER (Channel_1).CCxNP := 0; This.CCER (Channel_1).CCxP := 0; when Falling => This.CCER (Channel_1).CCxNP := 0; This.CCER (Channel_1).CCxP := 1; when Both_Edges => This.CCER (Channel_1).CCxNP := 1; This.CCER (Channel_1).CCxP := 1; end case; case IC2_Polarity is when Rising => This.CCER (Channel_2).CCxNP := 0; This.CCER (Channel_2).CCxP := 0; when Falling => This.CCER (Channel_2).CCxNP := 0; This.CCER (Channel_2).CCxP := 1; when Both_Edges => This.CCER (Channel_2).CCxNP := 1; This.CCER (Channel_2).CCxP := 1; end case; end Configure_Encoder_Interface; ------------------------ -- Enable_Hall_Sensor -- ------------------------ procedure Enable_Hall_Sensor (This : in out Timer) is begin This.CR2.TI1_Selection := True; end Enable_Hall_Sensor; ------------------------- -- Disable_Hall_Sensor -- ------------------------- procedure Disable_Hall_Sensor (This : in out Timer) is begin This.CR2.TI1_Selection := False; end Disable_Hall_Sensor; end STM32.Timers;
------------------------------------------------------------------------------ -- -- -- Matreshka Project -- -- -- -- Ada Modeling Framework -- -- -- -- Runtime Library Component -- -- -- ------------------------------------------------------------------------------ -- -- -- Copyright © 2012, Vadim Godunko <vgodunko@gmail.com> -- -- All rights reserved. -- -- -- -- Redistribution and use in source and binary forms, with or without -- -- modification, are permitted provided that the following conditions -- -- are met: -- -- -- -- * Redistributions of source code must retain the above copyright -- -- notice, this list of conditions and the following disclaimer. -- -- -- -- * Redistributions in binary form must reproduce the above copyright -- -- notice, this list of conditions and the following disclaimer in the -- -- documentation and/or other materials provided with the distribution. -- -- -- -- * Neither the name of the Vadim Godunko, IE nor the names of its -- -- contributors may be used to endorse or promote products derived from -- -- this software without specific prior written permission. -- -- -- -- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -- -- "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -- -- LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -- -- A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -- -- HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -- -- SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED -- -- TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -- -- PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -- -- LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -- -- NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -- -- SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -- -- -- ------------------------------------------------------------------------------ -- $Revision$ $Date$ ------------------------------------------------------------------------------ with AMF.Elements; with AMF.Holders.Elements; package body AMF.Internals.Holders.UMLDI_Holders is --------------- -- To_Holder -- --------------- function To_Holder (Item : AMF.UMLDI.UML_Diagram_Elements.UMLDI_UML_Diagram_Element_Access) return League.Holders.Holder is begin return AMF.Holders.Elements.To_Holder (AMF.Elements.Element_Access (Item)); end To_Holder; --------------- -- To_Holder -- --------------- function To_Holder (Item : AMF.UMLDI.UML_Labels.UMLDI_UML_Label_Access) return League.Holders.Holder is begin return AMF.Holders.Elements.To_Holder (AMF.Elements.Element_Access (Item)); end To_Holder; --------------- -- To_Holder -- --------------- function To_Holder (Item : AMF.UMLDI.UML_Styles.UMLDI_UML_Style_Access) return League.Holders.Holder is begin return AMF.Holders.Elements.To_Holder (AMF.Elements.Element_Access (Item)); end To_Holder; end AMF.Internals.Holders.UMLDI_Holders;
-- Copyright 2007-2016 Free Software Foundation, Inc. -- -- This program is free software; you can redistribute it and/or modify -- it under the terms of the GNU General Public License as published by -- the Free Software Foundation; either version 3 of the License, or -- (at your option) any later version. -- -- This program is distributed in the hope that it will be useful, -- but WITHOUT ANY WARRANTY; without even the implied warranty of -- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -- GNU General Public License for more details. -- -- You should have received a copy of the GNU General Public License -- along with this program. If not, see <http://www.gnu.org/licenses/>. package body Pck is procedure Same (C : Character) is begin Procedure_Result := C; end Same; procedure Next (C : in out Character) is begin if C = Character'Last then C := Character'First; else C := Character'Succ (C); end if; Procedure_Result := C; end Next; end Pck;
-- AoC 2020, Day 9 with Ada.Text_IO; with Ada.Containers.Ordered_Sets; package body Day is package TIO renames Ada.Text_IO; function load_file(filename : in String) return XMAS_Vector.Vector is package Long_Integer_Text_IO is new Ada.Text_IO.Integer_IO(Long_Integer); file : TIO.File_Type; v : XMAS_Vector.Vector; n : Long_Integer := 0; begin TIO.open(File => file, Mode => TIO.In_File, Name => filename); while not TIO.end_of_file(file) loop Long_Integer_Text_IO.get(file, n); v.append(n); end loop; TIO.close(file); return v; end load_file; package Sum_Sets is new Ada.Containers.Ordered_Sets (Element_Type => Long_Integer); use Sum_Sets; package Sum_Vectors is new Ada.Containers.Vectors (Index_Type => Natural, Element_Type => Sum_Sets.Set); use Sum_Vectors; function initialize_sums(v : in XMAS_Vector.Vector; preamble : in Positive) return Sum_Vectors.Vector is sums : Sum_Vectors.Vector := Sum_Vectors.Empty_Vector; last_idx : constant Natural := preamble-1; begin for i in 0..preamble-1 loop declare set : Sum_Sets.Set := Empty_Set; final : constant Natural := Natural'Min(i+preamble, last_idx); begin for j in i+1..final loop set.include(v(i) + v(j)); end loop; sums.append(set); end; end loop; return sums; end initialize_sums; procedure update_sums(sums : in out Sum_Vectors.Vector; v : in XMAS_Vector.Vector; index : in Positive) is start_index : constant Natural := index - (Natural(length(sums)) - 1); new_value : constant Long_Integer := v(index); new_set : Sum_Sets.Set := Empty_Set; begin sums.delete(0); for i in 0..Natural(length(sums))-1 loop declare curr_set : Sum_Sets.Set := sums(i); begin curr_set.include(v(start_index + i) + new_value); sums(i) := curr_set; end; end loop; new_set.include(new_value + v(index-1)); sums.append(new_set); end update_sums; function contains(sums: Sum_Vectors.Vector; target : in Long_Integer) return Boolean is begin for set of sums loop if contains(set, target) then return true; end if; end loop; return false; end contains; function first_invalid(v : in XMAS_Vector.Vector; preamble : in Positive) return Long_Integer is sums : Sum_Vectors.Vector := initialize_sums(v, preamble); begin for idx in preamble..v.last_index loop if not contains(sums, v(idx)) then return v(idx); end if; update_sums(sums, v, idx); end loop; return 0; end first_invalid; function min_max_sum(v : in XMAS_Vector.Vector; start_idx : in Natural; end_idx : in Natural) return Long_Integer is min : Long_Integer := Long_Integer'Last; max : Long_Integer := 0; begin for idx in start_idx..end_idx loop if min > v(idx) then min := v(idx); end if; if max < v(idx) then max := v(idx); end if; end loop; return min + max; end min_max_sum; function find_sum(v : in XMAS_Vector.Vector; target : in Long_Integer) return Long_Integer is sum : Long_Integer := 0; begin for i in v.first_index .. v.last_index loop sum := 0; for j in i .. v.last_index loop sum := sum + v(j); if sum = target then return min_max_sum(v, i, j); elsif sum > target then exit; end if; end loop; end loop; return 0; end find_sum; end Day;
----------------------------------------------------------------------- -- akt-commands-password -- Add/Change/Remove the wallet password -- Copyright (C) 2019 Stephane Carrez -- Written by Stephane Carrez (Stephane.Carrez@gmail.com) -- -- Licensed under the Apache License, Version 2.0 (the "License"); -- you may not use this file except in compliance with the License. -- You may obtain a copy of the License at -- -- http://www.apache.org/licenses/LICENSE-2.0 -- -- Unless required by applicable law or agreed to in writing, software -- distributed under the License is distributed on an "AS IS" BASIS, -- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -- See the License for the specific language governing permissions and -- limitations under the License. ----------------------------------------------------------------------- with AKT.Commands.Drivers; with Keystore; private package AKT.Commands.Password is type Command_Type is abstract new AKT.Commands.Drivers.Command_Type with private; overriding procedure Execute (Command : in out Command_Type; Name : in String; Args : in Argument_List'Class; Context : in out Context_Type); -- Setup the command before parsing the arguments and executing it. overriding procedure Setup (Command : in out Command_Type; Config : in out GNAT.Command_Line.Command_Line_Configuration; Context : in out Context_Type); private type Command_Type is abstract new AKT.Commands.Drivers.Command_Type with record Mode : Keystore.Mode_Type := Keystore.KEY_ADD; Counter_Range : aliased GNAT.Strings.String_Access; Password_File : aliased GNAT.Strings.String_Access; Password_Env : aliased GNAT.Strings.String_Access; Unsafe_Password : aliased GNAT.Strings.String_Access; Gpg_User : aliased GNAT.Strings.String_Access; end record; end AKT.Commands.Password;
with lace.fast_Pool; package body impact.d3.solver_Constraint is package Pool is new lace.fast_Pool (Item, View, 20_000); function new_solver_Constraint return View is Self : constant View := Pool.new_Item; begin -- Self.all := null_Constraint; return Self; end new_solver_Constraint; procedure free (Self : in out View) is begin Pool.free (Self); end free; end impact.d3.solver_Constraint;
-- C54A42C.ADA -- Grant of Unlimited Rights -- -- Under contracts F33600-87-D-0337, F33600-84-D-0280, MDA903-79-C-0687, -- F08630-91-C-0015, and DCA100-97-D-0025, the U.S. Government obtained -- unlimited rights in the software and documentation contained herein. -- Unlimited rights are defined in DFAR 252.227-7013(a)(19). By making -- this public release, the Government intends to confer upon all -- recipients unlimited rights equal to those held by the Government. -- These rights include rights to use, duplicate, release or disclose the -- released technical data and computer software in whole or in part, in -- any manner and for any purpose whatsoever, and to have or permit others -- to do so. -- -- DISCLAIMER -- -- ALL MATERIALS OR INFORMATION HEREIN RELEASED, MADE AVAILABLE OR -- DISCLOSED ARE AS IS. THE GOVERNMENT MAKES NO EXPRESS OR IMPLIED -- WARRANTY AS TO ANY MATTER WHATSOEVER, INCLUDING THE CONDITIONS OF THE -- SOFTWARE, DOCUMENTATION OR OTHER INFORMATION RELEASED, MADE AVAILABLE -- OR DISCLOSED, OR THE OWNERSHIP, MERCHANTABILITY, OR FITNESS FOR A -- PARTICULAR PURPOSE OF SAID MATERIAL. --* -- CHECK THAT A CASE_STATEMENT CORRECTLY HANDLES A SPARSE SET OF -- POTENTIAL VALUES (OF TYPE INTEGER) IN A LARGE RANGE. -- (OPTIMIZATION TEST) -- RM 03/26/81 WITH REPORT; PROCEDURE C54A42C IS USE REPORT ; BEGIN TEST( "C54A42C" , "TEST THAT A CASE_STATEMENT HANDLES CORRECTLY" & " A SPARSE SET OF POTENTIAL VALUES IN A LARGE" & " RANGE" ); DECLARE NUMBER : CONSTANT := 1001 ; LITEXPR : CONSTANT := NUMBER + 998 ; STATCON : CONSTANT INTEGER RANGE 1..INTEGER'LAST := 1000 ; DYNVAR : INTEGER RANGE 1..INTEGER'LAST := IDENT_INT( INTEGER'LAST-50 ); DYNCON : CONSTANT INTEGER RANGE 1..INTEGER'LAST := IDENT_INT( 1000 ); BEGIN CASE INTEGER'( NUMBER ) IS WHEN 1 .. 10 => FAILED("WRONG ALTERNATIVE F1"); WHEN 1000 => FAILED("WRONG ALTERNATIVE F2"); WHEN 2000 => FAILED("WRONG ALTERNATIVE F3"); WHEN 4000 .. 4100 => FAILED("WRONG ALTERNATIVE F4"); WHEN INTEGER'LAST-100 .. INTEGER'LAST => FAILED("WRONG ALTERNATIVE F5"); WHEN OTHERS => NULL ; END CASE; CASE IDENT_INT( 10 ) IS WHEN 1 .. 10 => NULL ; WHEN 1000 => FAILED("WRONG ALTERNATIVE G2"); WHEN 2000 => FAILED("WRONG ALTERNATIVE G3"); WHEN 4000 .. 4100 => FAILED("WRONG ALTERNATIVE G4"); WHEN INTEGER'LAST -100 .. INTEGER'LAST => FAILED("WRONG ALTERNATIVE G5"); WHEN OTHERS => FAILED("WRONG ALTERNATIVE G6"); END CASE; CASE IDENT_INT(LITEXPR) IS WHEN 1 .. 10 => FAILED("WRONG ALTERNATIVE H1"); WHEN 1000 => FAILED("WRONG ALTERNATIVE H2"); WHEN 2000 => FAILED("WRONG ALTERNATIVE H3"); WHEN 4000 .. 4100 => FAILED("WRONG ALTERNATIVE H4"); WHEN INTEGER'LAST -100 .. INTEGER'LAST => FAILED("WRONG ALTERNATIVE H5"); WHEN OTHERS => NULL ; END CASE; CASE STATCON IS WHEN 1 .. 10 => FAILED("WRONG ALTERNATIVE I1"); WHEN 1000 => NULL ; WHEN 2000 => FAILED("WRONG ALTERNATIVE I3"); WHEN 4000 .. 4100 => FAILED("WRONG ALTERNATIVE I4"); WHEN INTEGER'LAST -100 .. INTEGER'LAST => FAILED("WRONG ALTERNATIVE I5"); WHEN OTHERS => FAILED("WRONG ALTERNATIVE I6"); END CASE; CASE DYNVAR IS WHEN 1 .. 10 => FAILED("WRONG ALTERNATIVE J1"); WHEN 1000 => FAILED("WRONG ALTERNATIVE J2"); WHEN 2000 => FAILED("WRONG ALTERNATIVE J3"); WHEN 4000 .. 4100 => FAILED("WRONG ALTERNATIVE J4"); WHEN INTEGER'LAST -100 .. INTEGER'LAST => NULL ; WHEN OTHERS => FAILED("WRONG ALTERNATIVE J6"); END CASE; CASE DYNCON IS WHEN 1 .. 10 => FAILED("WRONG ALTERNATIVE K1"); WHEN 1000 => NULL ; WHEN 2000 => FAILED("WRONG ALTERNATIVE K3"); WHEN 4000 .. 4100 => FAILED("WRONG ALTERNATIVE K4"); WHEN INTEGER'LAST -100 .. INTEGER'LAST => FAILED("WRONG ALTERNATIVE K5"); WHEN OTHERS => FAILED("WRONG ALTERNATIVE K6"); END CASE; END ; RESULT ; END C54A42C ;
------------------------------------------------------------------------------ -- AGAR GUI LIBRARY -- -- A G A R . T E X T -- -- S p e c -- ------------------------------------------------------------------------------ with Ada.Containers.Indefinite_Vectors; with Interfaces; use Interfaces; with Interfaces.C; with Interfaces.C.Pointers; with Interfaces.C.Strings; with Agar.Types; use Agar.Types; with Agar.Object; with Agar.Surface; with System; package Agar.Text is package C renames Interfaces.C; package CS renames Interfaces.C.Strings; package SU renames Agar.Surface; use type C.int; use type C.unsigned; TEXT_STATES_MAX : constant C.unsigned := $AG_TEXT_STATES_MAX; FONT_BOLD : constant C.unsigned := 16#01#; FONT_ITALIC : constant C.unsigned := 16#02#; FONT_UNDERLINE : constant C.unsigned := 16#04#; FONT_UPPERCASE : constant C.unsigned := 16#08#; ----------------------------------- -- Horizontal Justification Mode -- ----------------------------------- type AG_Text_Justify is (LEFT, CENTER, RIGHT); for AG_Text_Justify use (LEFT => 0, CENTER => 1, RIGHT => 2); for AG_Text_Justify'Size use C.int'Size; ----------------------------- -- Vertical Alignment Mode -- ----------------------------- type AG_Text_Valign is (TOP, MIDDLE, BOTTOM); for AG_Text_Valign use (TOP => 0, MIDDLE => 1, BOTTOM => 2); for AG_Text_Valign'Size use C.int'Size; -------------------------------- -- Type of message to display -- -------------------------------- type AG_Text_Message_Title is (ERROR, -- Error message alert WARNING, -- Warning (ignorable) INFO); -- Informational message (ignorable) for AG_Text_Message_Title use (ERROR => 0, WARNING => 1, INFO => 2); for AG_Text_Message_Title'Size use C.int'Size; ------------------ -- Type of font -- ------------------ type AG_Font_Type is (VECTOR, -- Vector font engine (e.g., FreeType) BITMAP, -- Bitmap font engine (builtin) DUMMY); -- Null font engine for AG_Font_Type use (VECTOR => 0, BITMAP => 1, DUMMY => 2); for AG_Font_Type'Size use C.int'Size; ------------------------------------------- -- Type of data source to load font from -- ------------------------------------------- type AG_Font_Spec_Source is (FONT_FILE, -- Load font from file FONT_IN_MEMORY); -- Deserialize in-memory font data for AG_Font_Spec_Source use (FONT_FILE => 0, FONT_IN_MEMORY => 1); for AG_Font_Spec_Source'Size use C.int'Size; ---------------------------- -- Size of font in points -- ---------------------------- #if HAVE_FLOAT subtype AG_Font_Points is C.double; #else subtype AG_Font_Points is C.int; #end if; type Font_Points_Access is access all AG_Font_Points with Convention => C; ---------------------- -- Filename of font -- ---------------------- type AG_Font_Source_Filename is array (1 .. $AG_FILENAME_MAX) of aliased C.char with Convention => C; ----------------------------- -- Agar font specification -- ----------------------------- type AG_Font_Spec (Spec_Source : AG_Font_Spec_Source := FONT_FILE) is record Size : AG_Font_Points; -- Font size in points Index : C.int; -- Font index (FC_INDEX) Font_Type : AG_Font_Type; -- Font engine Font_Source : AG_Font_Spec_Source; -- Source type #if HAVE_FLOAT Matrix_XX : C.double; -- 1 -- -- Transformation matrix Matrix_XY : C.double; -- 0 -- Matrix_YX : C.double; -- 0 -- Matrix_YY : C.double; -- 1 -- #end if; case Spec_Source is when FONT_FILE => File_Source : AG_Font_Source_Filename; -- Font file name when FONT_IN_MEMORY => Memory_Source : access Unsigned_8; -- Source memory region Memory_Size : AG_Size; -- Size in bytes end case; end record with Convention => C; pragma Unchecked_Union (AG_Font_Spec); type Font_Spec_Access is access all AG_Font_Spec with Convention => C; ------------------ -- An Agar Font -- ------------------ type AG_Font; type Font_Access is access all AG_Font with Convention => C; subtype Font_not_null_Access is not null Font_Access; type AG_Font_Entry is limited record Next : Font_Access; Prev : access Font_Access; end record with Convention => C; type AG_Font_Bitmap_Spec is array (1 .. 32) of aliased C.char with Convention => C; type AG_Font is limited record Super : aliased Agar.Object.Object; -- [Font] Spec : aliased AG_Font_Spec; -- Font specification Flags : C.unsigned; -- Options Height : C.int; -- Height in pixels Ascent : C.int; -- Ascent relative to baseline Descent : C.int; -- Descent relative to baseline Line_Skip : C.int; -- Multiline Y-increment TTF : System.Address; -- TODO TTF interface Bitmap_Spec : aliased AG_Font_Bitmap_Spec; -- Bitmap font spec Bitmap_Glyphs : System.Address; -- TODO Bitmap glyph array Bitmap_Glyph_Count : C.unsigned; -- Bitmap glyph count Char_0, Char_1 : AG_Char; -- Bitmap font spec Reference_Count : C.unsigned; -- Reference count for cache Entry_in_Cache : AG_Font_Entry; -- Entry in cache end record with Convention => C; ---------------------------------- -- A rendered (in-memory) glyph -- ---------------------------------- type AG_Glyph; type Glyph_Access is access all AG_Glyph with Convention => C; type AG_Glyph_Entry is limited record Next : Glyph_Access; end record with Convention => C; type AG_Glyph is limited record Font : Font_not_null_Access; -- Back pointer to font Color : SU.AG_Color; -- Base color Char : AG_Char; -- Native character Surface : SU.Surface_not_null_Access; -- Rendered surface Advance : C.int; -- Advance in pixels Texture : C.unsigned; -- Mapped texture (by driver) Texcoords : SU.AG_Texcoord; -- Texture coordinates Entry_in_Cache : AG_Glyph_Entry; -- Entry in cache end record with Convention => C; --------------------------------------- -- Pushable/poppable state variables -- --------------------------------------- type AG_Text_State is record Font : Font_not_null_Access; -- Font face Color : SU.AG_Color; -- Foreground text color Color_BG : SU.AG_Color; -- Background color Justify : AG_Text_Justify; -- Justification mode Valign : AG_Text_Valign; -- Vertical alignment Tab_Wd : C.int; -- Width of tabs in pixels end record with Convention => C; ------------------------------------------ -- Statically-compiled font description -- ------------------------------------------ type AG_Static_Font is array (1 .. $SIZEOF_AG_StaticFont) of aliased Unsigned_8 with Convention => C; for AG_Static_Font'Size use $SIZEOF_AG_StaticFont * System.Storage_Unit; ------------------------------ -- Measure of rendered text -- ------------------------------ type AG_Text_Metrics is record W, H : C.int; -- Dimensions in pixels Line_Widths : access C.unsigned; -- Width of each line Line_Count : C.unsigned; -- Total line count end record with Convention => C; type Text_Metrics_Access is access all AG_Text_Metrics with Convention => C; subtype Text_Metrics_not_null_Access is not null Text_Metrics_Access; package Text_Line_Widths_Packages is new Ada.Containers.Indefinite_Vectors (Index_Type => Positive, Element_Type => Natural); subtype Text_Line_Widths is Text_Line_Widths_Packages.Vector; -------------------------- -- Internal glyph cache -- -------------------------- type AG_Glyph_Cache is array (1 .. $SIZEOF_AG_GlyphCache) of aliased Unsigned_8 with Convention => C; for AG_Glyph_Cache'Size use $SIZEOF_AG_GlyphCache * System.Storage_Unit; -- -- Initialize the font engine. -- function Init_Text_Subsystem return Boolean; -- -- Release all resources allocated by the font engine. -- procedure Destroy_Text_Subsystem; -- -- Set the default Agar font (by access to a Font object). -- procedure Set_Default_Font (Font : in Font_not_null_Access) with Import, Convention => C, Link_Name => "AG_SetDefaultFont"; -- -- Set the default Agar font (by a font specification string). -- -- Syntax: "(family):(size):(style)". Valid field separators include -- `:', `,', `.' and `/'. This works with fontconfig if available. -- Size is whole points (no fractional allowed with the default font). -- Style may include `b' (bold), `i' (italic) and `U' (uppercase). -- procedure Set_Default_Font (Spec : in String); -- -- Load (or fetch from cache) a font. -- function Fetch_Font (Family : in String := "_agFontVera"; Size : in AG_Font_Points := AG_Font_Points(12); Bold : in Boolean := False; Italic : in Boolean := False; Underlined : in Boolean := False; Uppercase : in Boolean := False) return Font_Access; -- -- Decrement the reference count of a font (and free unreferenced fonts). -- procedure Unused_Font (Font : in Font_not_null_Access) with Import, Convention => C, Link_Name => "AG_UnusedFont"; -- -- Push and pop the font engine rendering state. -- procedure Push_Text_State with Import, Convention => C, Link_Name => "AG_PushTextState"; procedure Pop_Text_State with Import, Convention => C, Link_Name => "AG_PopTextState"; -- -- Set the current font to the specified family+size+style (or just size). -- function Set_Font (Family : in String; Size : in AG_Font_Points := AG_Font_Points(12); Bold : in Boolean := False; Italic : in Boolean := False; Underlined : in Boolean := False; Uppercase : in Boolean := False) return Font_Access; -- -- Set the current font to a given % of the current font size. -- function Set_Font (Percent : in Natural) return Font_Access; -- -- Return the expected size in pixels of rendered (UTF-8) text. -- procedure Size_Text (Text : in String; W,H : out Natural); procedure Size_Text (Text : in String; W,H : out Natural; Line_Count : out Natural); procedure Size_Text (Text : in String; W,H : out Natural; Line_Count : out Natural; Line_Widths : out Text_Line_Widths); -- -- Display an informational message window (canned dialog). -- procedure Message_Box (Title : in AG_Text_Message_Title := INFO; Text : in String); #if AG_TIMERS procedure Message_Box (Title : in AG_Text_Message_Title := INFO; Text : in String; Time : in Natural := 2000); #end if; private function AG_InitTextSubsystem return C.int with Import, Convention => C, Link_Name => "AG_InitTextSubsystem"; procedure AG_DestroyTextSubsystem with Import, Convention => C, Link_Name => "AG_DestroyTextSubsystem"; procedure AG_TextParseFontSpec (Spec : in CS.chars_ptr) with Import, Convention => C, Link_Name => "AG_TextParseFontSpec"; function AG_FetchFont (Family : in CS.chars_ptr; Size : in Font_Points_Access; Flags : in C.unsigned) return Font_Access with Import, Convention => C, Link_Name => "AG_FetchFont"; function AG_TextFontLookup (Family : in CS.chars_ptr; Size : in Font_Points_Access; Flags : in C.unsigned) return Font_Access with Import, Convention => C, Link_Name => "AG_TextFontLookup"; function AG_TextFontPct (Percent : in C.int) return Font_Access with Import, Convention => C, Link_Name => "AG_TextFontPct"; procedure AG_TextSize (Text : in CS.chars_ptr; W,H : access C.int) with Import, Convention => C, Link_Name => "AG_TextSize"; type AG_TextSizeMulti_Line_Entry is array (C.unsigned range <>) of aliased C.unsigned with Convention => C; package Line_Width_Array is new Interfaces.C.Pointers (Index => C.unsigned, Element => C.unsigned, Element_Array => AG_TextSizeMulti_Line_Entry, Default_Terminator => 0); procedure AG_TextSizeMulti (Text : in CS.chars_ptr; W,H : access C.int; W_Lines : in Line_Width_Array.Pointer; N_Lines : access C.unsigned) with Import, Convention => C, Link_Name => "AG_TextSizeMulti"; procedure AG_TextMsgS (Title : in AG_Text_Message_Title; Text : in CS.chars_ptr) with Import, Convention => C, Link_Name => "AG_TextMsgS"; #if AG_TIMERS procedure AG_TextTmsgS (Title : in AG_Text_Message_Title; Time : in Unsigned_32; Text : in CS.chars_ptr) with Import, Convention => C, Link_Name => "AG_TextTmsgS"; #end if; end Agar.Text;
-- Copyright (c) 2019 Maxim Reznik <reznikmm@gmail.com> -- -- SPDX-License-Identifier: MIT -- License-Filename: LICENSE ------------------------------------------------------------- with Ada.Containers.Hashed_Maps; with League.Strings.Hash; with League.JSON.Objects; with Slim.Players; with Slim.Menu_Models.Play_Lists; package Slim.Menu_Models.JSON is type JSON_Menu_Model (Player : Slim.Players.Player_Access) is limited new Slim.Menu_Models.Menu_Model with private; procedure Initialize (Self : in out JSON_Menu_Model'Class; File : League.Strings.Universal_String); private type Play_List_Access is access all Slim.Menu_Models.Play_Lists.Play_List_Menu_Model; package Playlist_Maps is new Ada.Containers.Hashed_Maps (Key_Type => League.Strings.Universal_String, Element_Type => Play_List_Access, Hash => League.Strings.Hash, Equivalent_Keys => League.Strings."="); type JSON_Menu_Model (Player : Slim.Players.Player_Access) is limited new Slim.Menu_Models.Menu_Model with record Root : League.JSON.Objects.JSON_Object; Nested : League.Strings.Universal_String; Label : League.Strings.Universal_String; URL : League.Strings.Universal_String; Path : League.Strings.Universal_String; Playlist : League.Strings.Universal_String; Playlists : Playlist_Maps.Map; end record; overriding function Label (Self : JSON_Menu_Model; Path : Slim.Menu_Models.Menu_Path) return League.Strings.Universal_String; overriding function Item_Count (Self : JSON_Menu_Model; Path : Slim.Menu_Models.Menu_Path) return Natural; overriding function Enter_Command (Self : JSON_Menu_Model; Path : Menu_Path) return Slim.Menu_Commands.Menu_Command_Access; overriding function Play_Command (Self : JSON_Menu_Model; Path : Menu_Path) return Slim.Menu_Commands.Menu_Command_Access; end Slim.Menu_Models.JSON;
<?xml version="1.0" encoding="UTF-8" standalone="yes" ?> <!DOCTYPE boost_serialization> <boost_serialization signature="serialization::archive" version="11"> <syndb class_id="0" tracking_level="0" version="0"> <userIPLatency>-1</userIPLatency> <userIPName></userIPName> <cdfg class_id="1" tracking_level="1" version="0" object_id="_0"> <name>matrixmul</name> <ret_bitwidth>0</ret_bitwidth> <ports class_id="2" tracking_level="0" version="0"> <count>3</count> <item_version>0</item_version> <item class_id="3" tracking_level="1" version="0" object_id="_1"> <Value class_id="4" tracking_level="0" version="0"> <Obj class_id="5" tracking_level="0" version="0"> <type>1</type> <id>1</id> <name>a</name> <fileName></fileName> <fileDirectory></fileDirectory> <lineNumber>0</lineNumber> <contextFuncName></contextFuncName> <inlineStackInfo class_id="6" tracking_level="0" version="0"> <count>0</count> <item_version>0</item_version> </inlineStackInfo> <originalName>a</originalName> <rtlName></rtlName> <coreName></coreName> </Obj> <bitwidth>8</bitwidth> </Value> <direction>0</direction> <if_type>1</if_type> <array_size>9</array_size> <bit_vecs class_id="7" tracking_level="0" version="0"> <count>0</count> <item_version>0</item_version> </bit_vecs> </item> <item class_id_reference="3" object_id="_2"> <Value> <Obj> <type>1</type> <id>2</id> <name>b</name> <fileName></fileName> <fileDirectory></fileDirectory> <lineNumber>0</lineNumber> <contextFuncName></contextFuncName> <inlineStackInfo> <count>0</count> <item_version>0</item_version> </inlineStackInfo> <originalName>b</originalName> <rtlName></rtlName> <coreName></coreName> </Obj> <bitwidth>8</bitwidth> </Value> <direction>0</direction> <if_type>1</if_type> <array_size>9</array_size> <bit_vecs> <count>0</count> <item_version>0</item_version> </bit_vecs> </item> <item class_id_reference="3" object_id="_3"> <Value> <Obj> <type>1</type> <id>3</id> <name>res</name> <fileName></fileName> <fileDirectory></fileDirectory> <lineNumber>0</lineNumber> <contextFuncName></contextFuncName> <inlineStackInfo> <count>0</count> <item_version>0</item_version> </inlineStackInfo> <originalName>res</originalName> <rtlName></rtlName> <coreName></coreName> </Obj> <bitwidth>16</bitwidth> </Value> <direction>2</direction> <if_type>1</if_type> <array_size>9</array_size> <bit_vecs> <count>0</count> <item_version>0</item_version> </bit_vecs> </item> </ports> <nodes class_id="8" tracking_level="0" version="0"> <count>53</count> <item_version>0</item_version> <item class_id="9" tracking_level="1" version="0" object_id="_4"> <Value> <Obj> <type>0</type> <id>8</id> <name></name> <fileName>matrixmul.cpp</fileName> <fileDirectory>d:/opt/source/Vivado/Vivado_HLS_Tutorial/Design_Optimization/lab1</fileDirectory> <lineNumber>54</lineNumber> <contextFuncName>matrixmul</contextFuncName> <inlineStackInfo> <count>1</count> <item_version>0</item_version> <item class_id="10" tracking_level="0" version="0"> <first>d:/opt/source/Vivado/Vivado_HLS_Tutorial/Design_Optimization/lab1</first> <second class_id="11" tracking_level="0" version="0"> <count>1</count> <item_version>0</item_version> <item class_id="12" tracking_level="0" version="0"> <first class_id="13" tracking_level="0" version="0"> <first>matrixmul.cpp</first> <second>matrixmul</second> </first> <second>54</second> </item> </second> </item> </inlineStackInfo> <originalName></originalName> <rtlName></rtlName> <coreName></coreName> </Obj> <bitwidth>0</bitwidth> </Value> <oprand_edges> <count>1</count> <item_version>0</item_version> <item>78</item> </oprand_edges> <opcode>br</opcode> </item> <item class_id_reference="9" object_id="_5"> <Value> <Obj> <type>0</type> <id>10</id> <name>indvar_flatten</name> <fileName></fileName> <fileDirectory></fileDirectory> <lineNumber>0</lineNumber> <contextFuncName></contextFuncName> <inlineStackInfo> <count>0</count> <item_version>0</item_version> </inlineStackInfo> <originalName></originalName> <rtlName></rtlName> <coreName></coreName> </Obj> <bitwidth>4</bitwidth> </Value> <oprand_edges> <count>4</count> <item_version>0</item_version> <item>80</item> <item>81</item> <item>82</item> <item>83</item> </oprand_edges> <opcode>phi</opcode> </item> <item class_id_reference="9" object_id="_6"> <Value> <Obj> <type>0</type> <id>11</id> <name>i</name> <fileName>matrixmul.cpp</fileName> <fileDirectory>d:/opt/source/Vivado/Vivado_HLS_Tutorial/Design_Optimization/lab1</fileDirectory> <lineNumber>56</lineNumber> <contextFuncName>matrixmul</contextFuncName> <inlineStackInfo> <count>1</count> <item_version>0</item_version> <item> <first>d:/opt/source/Vivado/Vivado_HLS_Tutorial/Design_Optimization/lab1</first> <second> <count>1</count> <item_version>0</item_version> <item> <first> <first>matrixmul.cpp</first> <second>matrixmul</second> </first> <second>56</second> </item> </second> </item> </inlineStackInfo> <originalName></originalName> <rtlName></rtlName> <coreName></coreName> </Obj> <bitwidth>2</bitwidth> </Value> <oprand_edges> <count>4</count> <item_version>0</item_version> <item>85</item> <item>86</item> <item>87</item> <item>88</item> </oprand_edges> <opcode>phi</opcode> </item> <item class_id_reference="9" object_id="_7"> <Value> <Obj> <type>0</type> <id>12</id> <name>j</name> <fileName></fileName> <fileDirectory></fileDirectory> <lineNumber>0</lineNumber> <contextFuncName></contextFuncName> <inlineStackInfo> <count>0</count> <item_version>0</item_version> </inlineStackInfo> <originalName>j</originalName> <rtlName></rtlName> <coreName></coreName> </Obj> <bitwidth>2</bitwidth> </Value> <oprand_edges> <count>4</count> <item_version>0</item_version> <item>89</item> <item>90</item> <item>91</item> <item>92</item> </oprand_edges> <opcode>phi</opcode> </item> <item class_id_reference="9" object_id="_8"> <Value> <Obj> <type>0</type> <id>13</id> <name>exitcond_flatten</name> <fileName></fileName> <fileDirectory></fileDirectory> <lineNumber>0</lineNumber> <contextFuncName></contextFuncName> <inlineStackInfo> <count>0</count> <item_version>0</item_version> </inlineStackInfo> <originalName></originalName> <rtlName></rtlName> <coreName></coreName> </Obj> <bitwidth>1</bitwidth> </Value> <oprand_edges> <count>2</count> <item_version>0</item_version> <item>93</item> <item>95</item> </oprand_edges> <opcode>icmp</opcode> </item> <item class_id_reference="9" object_id="_9"> <Value> <Obj> <type>0</type> <id>14</id> <name>indvar_flatten_next</name> <fileName></fileName> <fileDirectory></fileDirectory> <lineNumber>0</lineNumber> <contextFuncName></contextFuncName> <inlineStackInfo> <count>0</count> <item_version>0</item_version> </inlineStackInfo> <originalName></originalName> <rtlName></rtlName> <coreName></coreName> </Obj> <bitwidth>4</bitwidth> </Value> <oprand_edges> <count>2</count> <item_version>0</item_version> <item>96</item> <item>98</item> </oprand_edges> <opcode>add</opcode> </item> <item class_id_reference="9" object_id="_10"> <Value> <Obj> <type>0</type> <id>15</id> <name></name> <fileName></fileName> <fileDirectory></fileDirectory> <lineNumber>0</lineNumber> <contextFuncName></contextFuncName> <inlineStackInfo> <count>0</count> <item_version>0</item_version> </inlineStackInfo> <originalName></originalName> <rtlName></rtlName> <coreName></coreName> </Obj> <bitwidth>0</bitwidth> </Value> <oprand_edges> <count>3</count> <item_version>0</item_version> <item>99</item> <item>100</item> <item>101</item> </oprand_edges> <opcode>br</opcode> </item> <item class_id_reference="9" object_id="_11"> <Value> <Obj> <type>0</type> <id>19</id> <name>exitcond1</name> <fileName>matrixmul.cpp</fileName> <fileDirectory>d:/opt/source/Vivado/Vivado_HLS_Tutorial/Design_Optimization/lab1</fileDirectory> <lineNumber>56</lineNumber> <contextFuncName>matrixmul</contextFuncName> <inlineStackInfo> <count>1</count> <item_version>0</item_version> <item> <first>d:/opt/source/Vivado/Vivado_HLS_Tutorial/Design_Optimization/lab1</first> <second> <count>1</count> <item_version>0</item_version> <item> <first> <first>matrixmul.cpp</first> <second>matrixmul</second> </first> <second>56</second> </item> </second> </item> </inlineStackInfo> <originalName></originalName> <rtlName></rtlName> <coreName></coreName> </Obj> <bitwidth>1</bitwidth> </Value> <oprand_edges> <count>2</count> <item_version>0</item_version> <item>155</item> <item>156</item> </oprand_edges> <opcode>icmp</opcode> </item> <item class_id_reference="9" object_id="_12"> <Value> <Obj> <type>0</type> <id>20</id> <name>j_mid2</name> <fileName>matrixmul.cpp</fileName> <fileDirectory>d:/opt/source/Vivado/Vivado_HLS_Tutorial/Design_Optimization/lab1</fileDirectory> <lineNumber>56</lineNumber> <contextFuncName>matrixmul</contextFuncName> <inlineStackInfo> <count>1</count> <item_version>0</item_version> <item> <first>d:/opt/source/Vivado/Vivado_HLS_Tutorial/Design_Optimization/lab1</first> <second> <count>1</count> <item_version>0</item_version> <item> <first> <first>matrixmul.cpp</first> <second>matrixmul</second> </first> <second>56</second> </item> </second> </item> </inlineStackInfo> <originalName></originalName> <rtlName></rtlName> <coreName></coreName> </Obj> <bitwidth>2</bitwidth> </Value> <oprand_edges> <count>3</count> <item_version>0</item_version> <item>157</item> <item>158</item> <item>159</item> </oprand_edges> <opcode>select</opcode> </item> <item class_id_reference="9" object_id="_13"> <Value> <Obj> <type>0</type> <id>21</id> <name>i_s</name> <fileName>matrixmul.cpp</fileName> <fileDirectory>d:/opt/source/Vivado/Vivado_HLS_Tutorial/Design_Optimization/lab1</fileDirectory> <lineNumber>54</lineNumber> <contextFuncName>matrixmul</contextFuncName> <inlineStackInfo> <count>1</count> <item_version>0</item_version> <item> <first>d:/opt/source/Vivado/Vivado_HLS_Tutorial/Design_Optimization/lab1</first> <second> <count>1</count> <item_version>0</item_version> <item> <first> <first>matrixmul.cpp</first> <second>matrixmul</second> </first> <second>54</second> </item> </second> </item> </inlineStackInfo> <originalName></originalName> <rtlName></rtlName> <coreName></coreName> </Obj> <bitwidth>2</bitwidth> </Value> <oprand_edges> <count>2</count> <item_version>0</item_version> <item>160</item> <item>161</item> </oprand_edges> <opcode>add</opcode> </item> <item class_id_reference="9" object_id="_14"> <Value> <Obj> <type>0</type> <id>22</id> <name>i_mid2</name> <fileName>matrixmul.cpp</fileName> <fileDirectory>d:/opt/source/Vivado/Vivado_HLS_Tutorial/Design_Optimization/lab1</fileDirectory> <lineNumber>56</lineNumber> <contextFuncName>matrixmul</contextFuncName> <inlineStackInfo> <count>1</count> <item_version>0</item_version> <item> <first>d:/opt/source/Vivado/Vivado_HLS_Tutorial/Design_Optimization/lab1</first> <second> <count>1</count> <item_version>0</item_version> <item> <first> <first>matrixmul.cpp</first> <second>matrixmul</second> </first> <second>56</second> </item> </second> </item> </inlineStackInfo> <originalName></originalName> <rtlName></rtlName> <coreName></coreName> </Obj> <bitwidth>2</bitwidth> </Value> <oprand_edges> <count>3</count> <item_version>0</item_version> <item>162</item> <item>163</item> <item>164</item> </oprand_edges> <opcode>select</opcode> </item> <item class_id_reference="9" object_id="_15"> <Value> <Obj> <type>0</type> <id>25</id> <name>tmp_trn5_cast</name> <fileName>matrixmul.cpp</fileName> <fileDirectory>d:/opt/source/Vivado/Vivado_HLS_Tutorial/Design_Optimization/lab1</fileDirectory> <lineNumber>57</lineNumber> <contextFuncName>matrixmul</contextFuncName> <inlineStackInfo> <count>1</count> <item_version>0</item_version> <item> <first>d:/opt/source/Vivado/Vivado_HLS_Tutorial/Design_Optimization/lab1</first> <second> <count>1</count> <item_version>0</item_version> <item> <first> <first>matrixmul.cpp</first> <second>matrixmul</second> </first> <second>57</second> </item> </second> </item> </inlineStackInfo> <originalName></originalName> <rtlName></rtlName> <coreName></coreName> </Obj> <bitwidth>5</bitwidth> </Value> <oprand_edges> <count>1</count> <item_version>0</item_version> <item>165</item> </oprand_edges> <opcode>zext</opcode> </item> <item class_id_reference="9" object_id="_16"> <Value> <Obj> <type>0</type> <id>26</id> <name>tmp_2_trn6_cast</name> <fileName>matrixmul.cpp</fileName> <fileDirectory>d:/opt/source/Vivado/Vivado_HLS_Tutorial/Design_Optimization/lab1</fileDirectory> <lineNumber>56</lineNumber> <contextFuncName>matrixmul</contextFuncName> <inlineStackInfo> <count>1</count> <item_version>0</item_version> <item> <first>d:/opt/source/Vivado/Vivado_HLS_Tutorial/Design_Optimization/lab1</first> <second> <count>1</count> <item_version>0</item_version> <item> <first> <first>matrixmul.cpp</first> <second>matrixmul</second> </first> <second>56</second> </item> </second> </item> </inlineStackInfo> <originalName></originalName> <rtlName></rtlName> <coreName></coreName> </Obj> <bitwidth>6</bitwidth> </Value> <oprand_edges> <count>1</count> <item_version>0</item_version> <item>166</item> </oprand_edges> <opcode>zext</opcode> </item> <item class_id_reference="9" object_id="_17"> <Value> <Obj> <type>0</type> <id>27</id> <name>tmp</name> <fileName>matrixmul.cpp</fileName> <fileDirectory>d:/opt/source/Vivado/Vivado_HLS_Tutorial/Design_Optimization/lab1</fileDirectory> <lineNumber>56</lineNumber> <contextFuncName>matrixmul</contextFuncName> <inlineStackInfo> <count>1</count> <item_version>0</item_version> <item> <first>d:/opt/source/Vivado/Vivado_HLS_Tutorial/Design_Optimization/lab1</first> <second> <count>1</count> <item_version>0</item_version> <item> <first> <first>matrixmul.cpp</first> <second>matrixmul</second> </first> <second>56</second> </item> </second> </item> </inlineStackInfo> <originalName></originalName> <rtlName></rtlName> <coreName></coreName> </Obj> <bitwidth>4</bitwidth> </Value> <oprand_edges> <count>3</count> <item_version>0</item_version> <item>167</item> <item>168</item> <item>169</item> </oprand_edges> <opcode>bitconcatenate</opcode> </item> <item class_id_reference="9" object_id="_18"> <Value> <Obj> <type>0</type> <id>28</id> <name>p_shl_cast</name> <fileName>matrixmul.cpp</fileName> <fileDirectory>d:/opt/source/Vivado/Vivado_HLS_Tutorial/Design_Optimization/lab1</fileDirectory> <lineNumber>57</lineNumber> <contextFuncName>matrixmul</contextFuncName> <inlineStackInfo> <count>1</count> <item_version>0</item_version> <item> <first>d:/opt/source/Vivado/Vivado_HLS_Tutorial/Design_Optimization/lab1</first> <second> <count>1</count> <item_version>0</item_version> <item> <first> <first>matrixmul.cpp</first> <second>matrixmul</second> </first> <second>57</second> </item> </second> </item> </inlineStackInfo> <originalName></originalName> <rtlName></rtlName> <coreName></coreName> </Obj> <bitwidth>5</bitwidth> </Value> <oprand_edges> <count>1</count> <item_version>0</item_version> <item>170</item> </oprand_edges> <opcode>zext</opcode> </item> <item class_id_reference="9" object_id="_19"> <Value> <Obj> <type>0</type> <id>29</id> <name>p_addr7</name> <fileName>matrixmul.cpp</fileName> <fileDirectory>d:/opt/source/Vivado/Vivado_HLS_Tutorial/Design_Optimization/lab1</fileDirectory> <lineNumber>57</lineNumber> <contextFuncName>matrixmul</contextFuncName> <inlineStackInfo> <count>1</count> <item_version>0</item_version> <item> <first>d:/opt/source/Vivado/Vivado_HLS_Tutorial/Design_Optimization/lab1</first> <second> <count>1</count> <item_version>0</item_version> <item> <first> <first>matrixmul.cpp</first> <second>matrixmul</second> </first> <second>57</second> </item> </second> </item> </inlineStackInfo> <originalName></originalName> <rtlName></rtlName> <coreName></coreName> </Obj> <bitwidth>5</bitwidth> </Value> <oprand_edges> <count>2</count> <item_version>0</item_version> <item>171</item> <item>172</item> </oprand_edges> <opcode>sub</opcode> </item> <item class_id_reference="9" object_id="_20"> <Value> <Obj> <type>0</type> <id>30</id> <name>p_addr7_cast</name> <fileName>matrixmul.cpp</fileName> <fileDirectory>d:/opt/source/Vivado/Vivado_HLS_Tutorial/Design_Optimization/lab1</fileDirectory> <lineNumber>57</lineNumber> <contextFuncName>matrixmul</contextFuncName> <inlineStackInfo> <count>1</count> <item_version>0</item_version> <item> <first>d:/opt/source/Vivado/Vivado_HLS_Tutorial/Design_Optimization/lab1</first> <second> <count>1</count> <item_version>0</item_version> <item> <first> <first>matrixmul.cpp</first> <second>matrixmul</second> </first> <second>57</second> </item> </second> </item> </inlineStackInfo> <originalName></originalName> <rtlName></rtlName> <coreName></coreName> </Obj> <bitwidth>6</bitwidth> </Value> <oprand_edges> <count>1</count> <item_version>0</item_version> <item>173</item> </oprand_edges> <opcode>sext</opcode> </item> <item class_id_reference="9" object_id="_21"> <Value> <Obj> <type>0</type> <id>31</id> <name>p_addr8</name> <fileName>matrixmul.cpp</fileName> <fileDirectory>d:/opt/source/Vivado/Vivado_HLS_Tutorial/Design_Optimization/lab1</fileDirectory> <lineNumber>57</lineNumber> <contextFuncName>matrixmul</contextFuncName> <inlineStackInfo> <count>1</count> <item_version>0</item_version> <item> <first>d:/opt/source/Vivado/Vivado_HLS_Tutorial/Design_Optimization/lab1</first> <second> <count>1</count> <item_version>0</item_version> <item> <first> <first>matrixmul.cpp</first> <second>matrixmul</second> </first> <second>57</second> </item> </second> </item> </inlineStackInfo> <originalName></originalName> <rtlName></rtlName> <coreName></coreName> </Obj> <bitwidth>6</bitwidth> </Value> <oprand_edges> <count>2</count> <item_version>0</item_version> <item>174</item> <item>175</item> </oprand_edges> <opcode>add</opcode> </item> <item class_id_reference="9" object_id="_22"> <Value> <Obj> <type>0</type> <id>32</id> <name>p_addr8_cast</name> <fileName>matrixmul.cpp</fileName> <fileDirectory>d:/opt/source/Vivado/Vivado_HLS_Tutorial/Design_Optimization/lab1</fileDirectory> <lineNumber>57</lineNumber> <contextFuncName>matrixmul</contextFuncName> <inlineStackInfo> <count>1</count> <item_version>0</item_version> <item> <first>d:/opt/source/Vivado/Vivado_HLS_Tutorial/Design_Optimization/lab1</first> <second> <count>1</count> <item_version>0</item_version> <item> <first> <first>matrixmul.cpp</first> <second>matrixmul</second> </first> <second>57</second> </item> </second> </item> </inlineStackInfo> <originalName></originalName> <rtlName></rtlName> <coreName></coreName> </Obj> <bitwidth>32</bitwidth> </Value> <oprand_edges> <count>1</count> <item_version>0</item_version> <item>176</item> </oprand_edges> <opcode>sext</opcode> </item> <item class_id_reference="9" object_id="_23"> <Value> <Obj> <type>0</type> <id>33</id> <name>tmp_1</name> <fileName>matrixmul.cpp</fileName> <fileDirectory>d:/opt/source/Vivado/Vivado_HLS_Tutorial/Design_Optimization/lab1</fileDirectory> <lineNumber>57</lineNumber> <contextFuncName>matrixmul</contextFuncName> <inlineStackInfo> <count>1</count> <item_version>0</item_version> <item> <first>d:/opt/source/Vivado/Vivado_HLS_Tutorial/Design_Optimization/lab1</first> <second> <count>1</count> <item_version>0</item_version> <item> <first> <first>matrixmul.cpp</first> <second>matrixmul</second> </first> <second>57</second> </item> </second> </item> </inlineStackInfo> <originalName></originalName> <rtlName></rtlName> <coreName></coreName> </Obj> <bitwidth>64</bitwidth> </Value> <oprand_edges> <count>1</count> <item_version>0</item_version> <item>177</item> </oprand_edges> <opcode>zext</opcode> </item> <item class_id_reference="9" object_id="_24"> <Value> <Obj> <type>0</type> <id>34</id> <name>res_addr</name> <fileName>matrixmul.cpp</fileName> <fileDirectory>d:/opt/source/Vivado/Vivado_HLS_Tutorial/Design_Optimization/lab1</fileDirectory> <lineNumber>57</lineNumber> <contextFuncName>matrixmul</contextFuncName> <inlineStackInfo> <count>1</count> <item_version>0</item_version> <item> <first>d:/opt/source/Vivado/Vivado_HLS_Tutorial/Design_Optimization/lab1</first> <second> <count>1</count> <item_version>0</item_version> <item> <first> <first>matrixmul.cpp</first> <second>matrixmul</second> </first> <second>57</second> </item> </second> </item> </inlineStackInfo> <originalName></originalName> <rtlName></rtlName> <coreName></coreName> </Obj> <bitwidth>4</bitwidth> </Value> <oprand_edges> <count>3</count> <item_version>0</item_version> <item>178</item> <item>179</item> <item>180</item> </oprand_edges> <opcode>getelementptr</opcode> </item> <item class_id_reference="9" object_id="_25"> <Value> <Obj> <type>0</type> <id>35</id> <name></name> <fileName>matrixmul.cpp</fileName> <fileDirectory>d:/opt/source/Vivado/Vivado_HLS_Tutorial/Design_Optimization/lab1</fileDirectory> <lineNumber>57</lineNumber> <contextFuncName>matrixmul</contextFuncName> <inlineStackInfo> <count>1</count> <item_version>0</item_version> <item> <first>d:/opt/source/Vivado/Vivado_HLS_Tutorial/Design_Optimization/lab1</first> <second> <count>1</count> <item_version>0</item_version> <item> <first> <first>matrixmul.cpp</first> <second>matrixmul</second> </first> <second>57</second> </item> </second> </item> </inlineStackInfo> <originalName></originalName> <rtlName></rtlName> <coreName></coreName> </Obj> <bitwidth>0</bitwidth> </Value> <oprand_edges> <count>2</count> <item_version>0</item_version> <item>182</item> <item>183</item> </oprand_edges> <opcode>store</opcode> </item> <item class_id_reference="9" object_id="_26"> <Value> <Obj> <type>0</type> <id>36</id> <name></name> <fileName>matrixmul.cpp</fileName> <fileDirectory>d:/opt/source/Vivado/Vivado_HLS_Tutorial/Design_Optimization/lab1</fileDirectory> <lineNumber>59</lineNumber> <contextFuncName>matrixmul</contextFuncName> <inlineStackInfo> <count>1</count> <item_version>0</item_version> <item> <first>d:/opt/source/Vivado/Vivado_HLS_Tutorial/Design_Optimization/lab1</first> <second> <count>1</count> <item_version>0</item_version> <item> <first> <first>matrixmul.cpp</first> <second>matrixmul</second> </first> <second>59</second> </item> </second> </item> </inlineStackInfo> <originalName></originalName> <rtlName></rtlName> <coreName></coreName> </Obj> <bitwidth>0</bitwidth> </Value> <oprand_edges> <count>1</count> <item_version>0</item_version> <item>184</item> </oprand_edges> <opcode>br</opcode> </item> <item class_id_reference="9" object_id="_27"> <Value> <Obj> <type>0</type> <id>38</id> <name>k</name> <fileName></fileName> <fileDirectory></fileDirectory> <lineNumber>0</lineNumber> <contextFuncName></contextFuncName> <inlineStackInfo> <count>0</count> <item_version>0</item_version> </inlineStackInfo> <originalName>k</originalName> <rtlName></rtlName> <coreName></coreName> </Obj> <bitwidth>2</bitwidth> </Value> <oprand_edges> <count>4</count> <item_version>0</item_version> <item>102</item> <item>103</item> <item>104</item> <item>105</item> </oprand_edges> <opcode>phi</opcode> </item> <item class_id_reference="9" object_id="_28"> <Value> <Obj> <type>0</type> <id>39</id> <name>exitcond</name> <fileName>matrixmul.cpp</fileName> <fileDirectory>d:/opt/source/Vivado/Vivado_HLS_Tutorial/Design_Optimization/lab1</fileDirectory> <lineNumber>59</lineNumber> <contextFuncName>matrixmul</contextFuncName> <inlineStackInfo> <count>1</count> <item_version>0</item_version> <item> <first>d:/opt/source/Vivado/Vivado_HLS_Tutorial/Design_Optimization/lab1</first> <second> <count>1</count> <item_version>0</item_version> <item> <first> <first>matrixmul.cpp</first> <second>matrixmul</second> </first> <second>59</second> </item> </second> </item> </inlineStackInfo> <originalName></originalName> <rtlName></rtlName> <coreName></coreName> </Obj> <bitwidth>1</bitwidth> </Value> <oprand_edges> <count>2</count> <item_version>0</item_version> <item>106</item> <item>108</item> </oprand_edges> <opcode>icmp</opcode> </item> <item class_id_reference="9" object_id="_29"> <Value> <Obj> <type>0</type> <id>40</id> <name>k_1</name> <fileName>matrixmul.cpp</fileName> <fileDirectory>d:/opt/source/Vivado/Vivado_HLS_Tutorial/Design_Optimization/lab1</fileDirectory> <lineNumber>59</lineNumber> <contextFuncName>matrixmul</contextFuncName> <inlineStackInfo> <count>1</count> <item_version>0</item_version> <item> <first>d:/opt/source/Vivado/Vivado_HLS_Tutorial/Design_Optimization/lab1</first> <second> <count>1</count> <item_version>0</item_version> <item> <first> <first>matrixmul.cpp</first> <second>matrixmul</second> </first> <second>59</second> </item> </second> </item> </inlineStackInfo> <originalName>k</originalName> <rtlName></rtlName> <coreName></coreName> </Obj> <bitwidth>2</bitwidth> </Value> <oprand_edges> <count>2</count> <item_version>0</item_version> <item>109</item> <item>111</item> </oprand_edges> <opcode>add</opcode> </item> <item class_id_reference="9" object_id="_30"> <Value> <Obj> <type>0</type> <id>41</id> <name></name> <fileName>matrixmul.cpp</fileName> <fileDirectory>d:/opt/source/Vivado/Vivado_HLS_Tutorial/Design_Optimization/lab1</fileDirectory> <lineNumber>59</lineNumber> <contextFuncName>matrixmul</contextFuncName> <inlineStackInfo> <count>1</count> <item_version>0</item_version> <item> <first>d:/opt/source/Vivado/Vivado_HLS_Tutorial/Design_Optimization/lab1</first> <second> <count>1</count> <item_version>0</item_version> <item> <first> <first>matrixmul.cpp</first> <second>matrixmul</second> </first> <second>59</second> </item> </second> </item> </inlineStackInfo> <originalName></originalName> <rtlName></rtlName> <coreName></coreName> </Obj> <bitwidth>0</bitwidth> </Value> <oprand_edges> <count>3</count> <item_version>0</item_version> <item>112</item> <item>113</item> <item>114</item> </oprand_edges> <opcode>br</opcode> </item> <item class_id_reference="9" object_id="_31"> <Value> <Obj> <type>0</type> <id>47</id> <name>tmp_4_trn_cast1</name> <fileName>matrixmul.cpp</fileName> <fileDirectory>d:/opt/source/Vivado/Vivado_HLS_Tutorial/Design_Optimization/lab1</fileDirectory> <lineNumber>60</lineNumber> <contextFuncName>matrixmul</contextFuncName> <inlineStackInfo> <count>1</count> <item_version>0</item_version> <item> <first>d:/opt/source/Vivado/Vivado_HLS_Tutorial/Design_Optimization/lab1</first> <second> <count>1</count> <item_version>0</item_version> <item> <first> <first>matrixmul.cpp</first> <second>matrixmul</second> </first> <second>60</second> </item> </second> </item> </inlineStackInfo> <originalName></originalName> <rtlName></rtlName> <coreName></coreName> </Obj> <bitwidth>6</bitwidth> </Value> <oprand_edges> <count>1</count> <item_version>0</item_version> <item>115</item> </oprand_edges> <opcode>zext</opcode> </item> <item class_id_reference="9" object_id="_32"> <Value> <Obj> <type>0</type> <id>48</id> <name>tmp_4_trn_cast</name> <fileName>matrixmul.cpp</fileName> <fileDirectory>d:/opt/source/Vivado/Vivado_HLS_Tutorial/Design_Optimization/lab1</fileDirectory> <lineNumber>60</lineNumber> <contextFuncName>matrixmul</contextFuncName> <inlineStackInfo> <count>1</count> <item_version>0</item_version> <item> <first>d:/opt/source/Vivado/Vivado_HLS_Tutorial/Design_Optimization/lab1</first> <second> <count>1</count> <item_version>0</item_version> <item> <first> <first>matrixmul.cpp</first> <second>matrixmul</second> </first> <second>60</second> </item> </second> </item> </inlineStackInfo> <originalName></originalName> <rtlName></rtlName> <coreName></coreName> </Obj> <bitwidth>5</bitwidth> </Value> <oprand_edges> <count>1</count> <item_version>0</item_version> <item>116</item> </oprand_edges> <opcode>zext</opcode> </item> <item class_id_reference="9" object_id="_33"> <Value> <Obj> <type>0</type> <id>49</id> <name>p_addr1</name> <fileName>matrixmul.cpp</fileName> <fileDirectory>d:/opt/source/Vivado/Vivado_HLS_Tutorial/Design_Optimization/lab1</fileDirectory> <lineNumber>60</lineNumber> <contextFuncName>matrixmul</contextFuncName> <inlineStackInfo> <count>1</count> <item_version>0</item_version> <item> <first>d:/opt/source/Vivado/Vivado_HLS_Tutorial/Design_Optimization/lab1</first> <second> <count>1</count> <item_version>0</item_version> <item> <first> <first>matrixmul.cpp</first> <second>matrixmul</second> </first> <second>60</second> </item> </second> </item> </inlineStackInfo> <originalName></originalName> <rtlName></rtlName> <coreName></coreName> </Obj> <bitwidth>6</bitwidth> </Value> <oprand_edges> <count>2</count> <item_version>0</item_version> <item>117</item> <item>118</item> </oprand_edges> <opcode>add</opcode> </item> <item class_id_reference="9" object_id="_34"> <Value> <Obj> <type>0</type> <id>50</id> <name>p_addr1_cast</name> <fileName>matrixmul.cpp</fileName> <fileDirectory>d:/opt/source/Vivado/Vivado_HLS_Tutorial/Design_Optimization/lab1</fileDirectory> <lineNumber>60</lineNumber> <contextFuncName>matrixmul</contextFuncName> <inlineStackInfo> <count>1</count> <item_version>0</item_version> <item> <first>d:/opt/source/Vivado/Vivado_HLS_Tutorial/Design_Optimization/lab1</first> <second> <count>1</count> <item_version>0</item_version> <item> <first> <first>matrixmul.cpp</first> <second>matrixmul</second> </first> <second>60</second> </item> </second> </item> </inlineStackInfo> <originalName></originalName> <rtlName></rtlName> <coreName></coreName> </Obj> <bitwidth>32</bitwidth> </Value> <oprand_edges> <count>1</count> <item_version>0</item_version> <item>119</item> </oprand_edges> <opcode>sext</opcode> </item> <item class_id_reference="9" object_id="_35"> <Value> <Obj> <type>0</type> <id>51</id> <name>tmp_2</name> <fileName>matrixmul.cpp</fileName> <fileDirectory>d:/opt/source/Vivado/Vivado_HLS_Tutorial/Design_Optimization/lab1</fileDirectory> <lineNumber>60</lineNumber> <contextFuncName>matrixmul</contextFuncName> <inlineStackInfo> <count>1</count> <item_version>0</item_version> <item> <first>d:/opt/source/Vivado/Vivado_HLS_Tutorial/Design_Optimization/lab1</first> <second> <count>1</count> <item_version>0</item_version> <item> <first> <first>matrixmul.cpp</first> <second>matrixmul</second> </first> <second>60</second> </item> </second> </item> </inlineStackInfo> <originalName></originalName> <rtlName></rtlName> <coreName></coreName> </Obj> <bitwidth>64</bitwidth> </Value> <oprand_edges> <count>1</count> <item_version>0</item_version> <item>120</item> </oprand_edges> <opcode>zext</opcode> </item> <item class_id_reference="9" object_id="_36"> <Value> <Obj> <type>0</type> <id>52</id> <name>a_addr</name> <fileName>matrixmul.cpp</fileName> <fileDirectory>d:/opt/source/Vivado/Vivado_HLS_Tutorial/Design_Optimization/lab1</fileDirectory> <lineNumber>60</lineNumber> <contextFuncName>matrixmul</contextFuncName> <inlineStackInfo> <count>1</count> <item_version>0</item_version> <item> <first>d:/opt/source/Vivado/Vivado_HLS_Tutorial/Design_Optimization/lab1</first> <second> <count>1</count> <item_version>0</item_version> <item> <first> <first>matrixmul.cpp</first> <second>matrixmul</second> </first> <second>60</second> </item> </second> </item> </inlineStackInfo> <originalName></originalName> <rtlName></rtlName> <coreName></coreName> </Obj> <bitwidth>4</bitwidth> </Value> <oprand_edges> <count>3</count> <item_version>0</item_version> <item>121</item> <item>123</item> <item>124</item> </oprand_edges> <opcode>getelementptr</opcode> </item> <item class_id_reference="9" object_id="_37"> <Value> <Obj> <type>0</type> <id>53</id> <name>a_load</name> <fileName>matrixmul.cpp</fileName> <fileDirectory>d:/opt/source/Vivado/Vivado_HLS_Tutorial/Design_Optimization/lab1</fileDirectory> <lineNumber>60</lineNumber> <contextFuncName>matrixmul</contextFuncName> <inlineStackInfo> <count>1</count> <item_version>0</item_version> <item> <first>d:/opt/source/Vivado/Vivado_HLS_Tutorial/Design_Optimization/lab1</first> <second> <count>1</count> <item_version>0</item_version> <item> <first> <first>matrixmul.cpp</first> <second>matrixmul</second> </first> <second>60</second> </item> </second> </item> </inlineStackInfo> <originalName></originalName> <rtlName></rtlName> <coreName></coreName> </Obj> <bitwidth>8</bitwidth> </Value> <oprand_edges> <count>1</count> <item_version>0</item_version> <item>125</item> </oprand_edges> <opcode>load</opcode> </item> <item class_id_reference="9" object_id="_38"> <Value> <Obj> <type>0</type> <id>54</id> <name>tmp_5</name> <fileName>matrixmul.cpp</fileName> <fileDirectory>d:/opt/source/Vivado/Vivado_HLS_Tutorial/Design_Optimization/lab1</fileDirectory> <lineNumber>60</lineNumber> <contextFuncName>matrixmul</contextFuncName> <inlineStackInfo> <count>1</count> <item_version>0</item_version> <item> <first>d:/opt/source/Vivado/Vivado_HLS_Tutorial/Design_Optimization/lab1</first> <second> <count>1</count> <item_version>0</item_version> <item> <first> <first>matrixmul.cpp</first> <second>matrixmul</second> </first> <second>60</second> </item> </second> </item> </inlineStackInfo> <originalName></originalName> <rtlName></rtlName> <coreName></coreName> </Obj> <bitwidth>16</bitwidth> </Value> <oprand_edges> <count>1</count> <item_version>0</item_version> <item>126</item> </oprand_edges> <opcode>sext</opcode> </item> <item class_id_reference="9" object_id="_39"> <Value> <Obj> <type>0</type> <id>55</id> <name>tmp_4</name> <fileName>matrixmul.cpp</fileName> <fileDirectory>d:/opt/source/Vivado/Vivado_HLS_Tutorial/Design_Optimization/lab1</fileDirectory> <lineNumber>59</lineNumber> <contextFuncName>matrixmul</contextFuncName> <inlineStackInfo> <count>1</count> <item_version>0</item_version> <item> <first>d:/opt/source/Vivado/Vivado_HLS_Tutorial/Design_Optimization/lab1</first> <second> <count>1</count> <item_version>0</item_version> <item> <first> <first>matrixmul.cpp</first> <second>matrixmul</second> </first> <second>59</second> </item> </second> </item> </inlineStackInfo> <originalName></originalName> <rtlName></rtlName> <coreName></coreName> </Obj> <bitwidth>4</bitwidth> </Value> <oprand_edges> <count>3</count> <item_version>0</item_version> <item>128</item> <item>129</item> <item>130</item> </oprand_edges> <opcode>bitconcatenate</opcode> </item> <item class_id_reference="9" object_id="_40"> <Value> <Obj> <type>0</type> <id>56</id> <name>p_shl9_cast</name> <fileName>matrixmul.cpp</fileName> <fileDirectory>d:/opt/source/Vivado/Vivado_HLS_Tutorial/Design_Optimization/lab1</fileDirectory> <lineNumber>60</lineNumber> <contextFuncName>matrixmul</contextFuncName> <inlineStackInfo> <count>1</count> <item_version>0</item_version> <item> <first>d:/opt/source/Vivado/Vivado_HLS_Tutorial/Design_Optimization/lab1</first> <second> <count>1</count> <item_version>0</item_version> <item> <first> <first>matrixmul.cpp</first> <second>matrixmul</second> </first> <second>60</second> </item> </second> </item> </inlineStackInfo> <originalName></originalName> <rtlName></rtlName> <coreName></coreName> </Obj> <bitwidth>5</bitwidth> </Value> <oprand_edges> <count>1</count> <item_version>0</item_version> <item>131</item> </oprand_edges> <opcode>zext</opcode> </item> <item class_id_reference="9" object_id="_41"> <Value> <Obj> <type>0</type> <id>57</id> <name>p_addr3</name> <fileName>matrixmul.cpp</fileName> <fileDirectory>d:/opt/source/Vivado/Vivado_HLS_Tutorial/Design_Optimization/lab1</fileDirectory> <lineNumber>60</lineNumber> <contextFuncName>matrixmul</contextFuncName> <inlineStackInfo> <count>1</count> <item_version>0</item_version> <item> <first>d:/opt/source/Vivado/Vivado_HLS_Tutorial/Design_Optimization/lab1</first> <second> <count>1</count> <item_version>0</item_version> <item> <first> <first>matrixmul.cpp</first> <second>matrixmul</second> </first> <second>60</second> </item> </second> </item> </inlineStackInfo> <originalName></originalName> <rtlName></rtlName> <coreName></coreName> </Obj> <bitwidth>5</bitwidth> </Value> <oprand_edges> <count>2</count> <item_version>0</item_version> <item>132</item> <item>133</item> </oprand_edges> <opcode>sub</opcode> </item> <item class_id_reference="9" object_id="_42"> <Value> <Obj> <type>0</type> <id>58</id> <name>p_addr3_cast</name> <fileName>matrixmul.cpp</fileName> <fileDirectory>d:/opt/source/Vivado/Vivado_HLS_Tutorial/Design_Optimization/lab1</fileDirectory> <lineNumber>60</lineNumber> <contextFuncName>matrixmul</contextFuncName> <inlineStackInfo> <count>1</count> <item_version>0</item_version> <item> <first>d:/opt/source/Vivado/Vivado_HLS_Tutorial/Design_Optimization/lab1</first> <second> <count>1</count> <item_version>0</item_version> <item> <first> <first>matrixmul.cpp</first> <second>matrixmul</second> </first> <second>60</second> </item> </second> </item> </inlineStackInfo> <originalName></originalName> <rtlName></rtlName> <coreName></coreName> </Obj> <bitwidth>6</bitwidth> </Value> <oprand_edges> <count>1</count> <item_version>0</item_version> <item>134</item> </oprand_edges> <opcode>sext</opcode> </item> <item class_id_reference="9" object_id="_43"> <Value> <Obj> <type>0</type> <id>59</id> <name>p_addr4</name> <fileName>matrixmul.cpp</fileName> <fileDirectory>d:/opt/source/Vivado/Vivado_HLS_Tutorial/Design_Optimization/lab1</fileDirectory> <lineNumber>60</lineNumber> <contextFuncName>matrixmul</contextFuncName> <inlineStackInfo> <count>1</count> <item_version>0</item_version> <item> <first>d:/opt/source/Vivado/Vivado_HLS_Tutorial/Design_Optimization/lab1</first> <second> <count>1</count> <item_version>0</item_version> <item> <first> <first>matrixmul.cpp</first> <second>matrixmul</second> </first> <second>60</second> </item> </second> </item> </inlineStackInfo> <originalName></originalName> <rtlName></rtlName> <coreName></coreName> </Obj> <bitwidth>6</bitwidth> </Value> <oprand_edges> <count>2</count> <item_version>0</item_version> <item>135</item> <item>136</item> </oprand_edges> <opcode>add</opcode> </item> <item class_id_reference="9" object_id="_44"> <Value> <Obj> <type>0</type> <id>60</id> <name>p_addr4_cast</name> <fileName>matrixmul.cpp</fileName> <fileDirectory>d:/opt/source/Vivado/Vivado_HLS_Tutorial/Design_Optimization/lab1</fileDirectory> <lineNumber>60</lineNumber> <contextFuncName>matrixmul</contextFuncName> <inlineStackInfo> <count>1</count> <item_version>0</item_version> <item> <first>d:/opt/source/Vivado/Vivado_HLS_Tutorial/Design_Optimization/lab1</first> <second> <count>1</count> <item_version>0</item_version> <item> <first> <first>matrixmul.cpp</first> <second>matrixmul</second> </first> <second>60</second> </item> </second> </item> </inlineStackInfo> <originalName></originalName> <rtlName></rtlName> <coreName></coreName> </Obj> <bitwidth>32</bitwidth> </Value> <oprand_edges> <count>1</count> <item_version>0</item_version> <item>137</item> </oprand_edges> <opcode>sext</opcode> </item> <item class_id_reference="9" object_id="_45"> <Value> <Obj> <type>0</type> <id>61</id> <name>tmp_s</name> <fileName>matrixmul.cpp</fileName> <fileDirectory>d:/opt/source/Vivado/Vivado_HLS_Tutorial/Design_Optimization/lab1</fileDirectory> <lineNumber>60</lineNumber> <contextFuncName>matrixmul</contextFuncName> <inlineStackInfo> <count>1</count> <item_version>0</item_version> <item> <first>d:/opt/source/Vivado/Vivado_HLS_Tutorial/Design_Optimization/lab1</first> <second> <count>1</count> <item_version>0</item_version> <item> <first> <first>matrixmul.cpp</first> <second>matrixmul</second> </first> <second>60</second> </item> </second> </item> </inlineStackInfo> <originalName></originalName> <rtlName></rtlName> <coreName></coreName> </Obj> <bitwidth>64</bitwidth> </Value> <oprand_edges> <count>1</count> <item_version>0</item_version> <item>138</item> </oprand_edges> <opcode>zext</opcode> </item> <item class_id_reference="9" object_id="_46"> <Value> <Obj> <type>0</type> <id>62</id> <name>b_addr</name> <fileName>matrixmul.cpp</fileName> <fileDirectory>d:/opt/source/Vivado/Vivado_HLS_Tutorial/Design_Optimization/lab1</fileDirectory> <lineNumber>60</lineNumber> <contextFuncName>matrixmul</contextFuncName> <inlineStackInfo> <count>1</count> <item_version>0</item_version> <item> <first>d:/opt/source/Vivado/Vivado_HLS_Tutorial/Design_Optimization/lab1</first> <second> <count>1</count> <item_version>0</item_version> <item> <first> <first>matrixmul.cpp</first> <second>matrixmul</second> </first> <second>60</second> </item> </second> </item> </inlineStackInfo> <originalName></originalName> <rtlName></rtlName> <coreName></coreName> </Obj> <bitwidth>4</bitwidth> </Value> <oprand_edges> <count>3</count> <item_version>0</item_version> <item>139</item> <item>140</item> <item>141</item> </oprand_edges> <opcode>getelementptr</opcode> </item> <item class_id_reference="9" object_id="_47"> <Value> <Obj> <type>0</type> <id>63</id> <name>b_load</name> <fileName>matrixmul.cpp</fileName> <fileDirectory>d:/opt/source/Vivado/Vivado_HLS_Tutorial/Design_Optimization/lab1</fileDirectory> <lineNumber>60</lineNumber> <contextFuncName>matrixmul</contextFuncName> <inlineStackInfo> <count>1</count> <item_version>0</item_version> <item> <first>d:/opt/source/Vivado/Vivado_HLS_Tutorial/Design_Optimization/lab1</first> <second> <count>1</count> <item_version>0</item_version> <item> <first> <first>matrixmul.cpp</first> <second>matrixmul</second> </first> <second>60</second> </item> </second> </item> </inlineStackInfo> <originalName></originalName> <rtlName></rtlName> <coreName></coreName> </Obj> <bitwidth>8</bitwidth> </Value> <oprand_edges> <count>1</count> <item_version>0</item_version> <item>142</item> </oprand_edges> <opcode>load</opcode> </item> <item class_id_reference="9" object_id="_48"> <Value> <Obj> <type>0</type> <id>64</id> <name>tmp_6</name> <fileName>matrixmul.cpp</fileName> <fileDirectory>d:/opt/source/Vivado/Vivado_HLS_Tutorial/Design_Optimization/lab1</fileDirectory> <lineNumber>60</lineNumber> <contextFuncName>matrixmul</contextFuncName> <inlineStackInfo> <count>1</count> <item_version>0</item_version> <item> <first>d:/opt/source/Vivado/Vivado_HLS_Tutorial/Design_Optimization/lab1</first> <second> <count>1</count> <item_version>0</item_version> <item> <first> <first>matrixmul.cpp</first> <second>matrixmul</second> </first> <second>60</second> </item> </second> </item> </inlineStackInfo> <originalName></originalName> <rtlName></rtlName> <coreName></coreName> </Obj> <bitwidth>16</bitwidth> </Value> <oprand_edges> <count>1</count> <item_version>0</item_version> <item>143</item> </oprand_edges> <opcode>sext</opcode> </item> <item class_id_reference="9" object_id="_49"> <Value> <Obj> <type>0</type> <id>65</id> <name>tmp_7</name> <fileName>matrixmul.cpp</fileName> <fileDirectory>d:/opt/source/Vivado/Vivado_HLS_Tutorial/Design_Optimization/lab1</fileDirectory> <lineNumber>60</lineNumber> <contextFuncName>matrixmul</contextFuncName> <inlineStackInfo> <count>1</count> <item_version>0</item_version> <item> <first>d:/opt/source/Vivado/Vivado_HLS_Tutorial/Design_Optimization/lab1</first> <second> <count>1</count> <item_version>0</item_version> <item> <first> <first>matrixmul.cpp</first> <second>matrixmul</second> </first> <second>60</second> </item> </second> </item> </inlineStackInfo> <originalName></originalName> <rtlName></rtlName> <coreName></coreName> </Obj> <bitwidth>16</bitwidth> </Value> <oprand_edges> <count>2</count> <item_version>0</item_version> <item>144</item> <item>145</item> </oprand_edges> <opcode>mul</opcode> </item> <item class_id_reference="9" object_id="_50"> <Value> <Obj> <type>0</type> <id>66</id> <name>res_load</name> <fileName>matrixmul.cpp</fileName> <fileDirectory>d:/opt/source/Vivado/Vivado_HLS_Tutorial/Design_Optimization/lab1</fileDirectory> <lineNumber>60</lineNumber> <contextFuncName>matrixmul</contextFuncName> <inlineStackInfo> <count>1</count> <item_version>0</item_version> <item> <first>d:/opt/source/Vivado/Vivado_HLS_Tutorial/Design_Optimization/lab1</first> <second> <count>1</count> <item_version>0</item_version> <item> <first> <first>matrixmul.cpp</first> <second>matrixmul</second> </first> <second>60</second> </item> </second> </item> </inlineStackInfo> <originalName></originalName> <rtlName></rtlName> <coreName></coreName> </Obj> <bitwidth>16</bitwidth> </Value> <oprand_edges> <count>1</count> <item_version>0</item_version> <item>146</item> </oprand_edges> <opcode>load</opcode> </item> <item class_id_reference="9" object_id="_51"> <Value> <Obj> <type>0</type> <id>67</id> <name>tmp_8</name> <fileName>matrixmul.cpp</fileName> <fileDirectory>d:/opt/source/Vivado/Vivado_HLS_Tutorial/Design_Optimization/lab1</fileDirectory> <lineNumber>60</lineNumber> <contextFuncName>matrixmul</contextFuncName> <inlineStackInfo> <count>1</count> <item_version>0</item_version> <item> <first>d:/opt/source/Vivado/Vivado_HLS_Tutorial/Design_Optimization/lab1</first> <second> <count>1</count> <item_version>0</item_version> <item> <first> <first>matrixmul.cpp</first> <second>matrixmul</second> </first> <second>60</second> </item> </second> </item> </inlineStackInfo> <originalName></originalName> <rtlName></rtlName> <coreName></coreName> </Obj> <bitwidth>16</bitwidth> </Value> <oprand_edges> <count>2</count> <item_version>0</item_version> <item>147</item> <item>148</item> </oprand_edges> <opcode>add</opcode> </item> <item class_id_reference="9" object_id="_52"> <Value> <Obj> <type>0</type> <id>68</id> <name></name> <fileName>matrixmul.cpp</fileName> <fileDirectory>d:/opt/source/Vivado/Vivado_HLS_Tutorial/Design_Optimization/lab1</fileDirectory> <lineNumber>60</lineNumber> <contextFuncName>matrixmul</contextFuncName> <inlineStackInfo> <count>1</count> <item_version>0</item_version> <item> <first>d:/opt/source/Vivado/Vivado_HLS_Tutorial/Design_Optimization/lab1</first> <second> <count>1</count> <item_version>0</item_version> <item> <first> <first>matrixmul.cpp</first> <second>matrixmul</second> </first> <second>60</second> </item> </second> </item> </inlineStackInfo> <originalName></originalName> <rtlName></rtlName> <coreName></coreName> </Obj> <bitwidth>0</bitwidth> </Value> <oprand_edges> <count>3</count> <item_version>0</item_version> <item>149</item> <item>150</item> <item>247</item> </oprand_edges> <opcode>store</opcode> </item> <item class_id_reference="9" object_id="_53"> <Value> <Obj> <type>0</type> <id>70</id> <name></name> <fileName></fileName> <fileDirectory></fileDirectory> <lineNumber>0</lineNumber> <contextFuncName></contextFuncName> <inlineStackInfo> <count>0</count> <item_version>0</item_version> </inlineStackInfo> <originalName></originalName> <rtlName></rtlName> <coreName></coreName> </Obj> <bitwidth>0</bitwidth> </Value> <oprand_edges> <count>1</count> <item_version>0</item_version> <item>151</item> </oprand_edges> <opcode>br</opcode> </item> <item class_id_reference="9" object_id="_54"> <Value> <Obj> <type>0</type> <id>73</id> <name>j_1</name> <fileName>matrixmul.cpp</fileName> <fileDirectory>d:/opt/source/Vivado/Vivado_HLS_Tutorial/Design_Optimization/lab1</fileDirectory> <lineNumber>56</lineNumber> <contextFuncName>matrixmul</contextFuncName> <inlineStackInfo> <count>1</count> <item_version>0</item_version> <item> <first>d:/opt/source/Vivado/Vivado_HLS_Tutorial/Design_Optimization/lab1</first> <second> <count>1</count> <item_version>0</item_version> <item> <first> <first>matrixmul.cpp</first> <second>matrixmul</second> </first> <second>56</second> </item> </second> </item> </inlineStackInfo> <originalName>j</originalName> <rtlName></rtlName> <coreName></coreName> </Obj> <bitwidth>2</bitwidth> </Value> <oprand_edges> <count>2</count> <item_version>0</item_version> <item>152</item> <item>153</item> </oprand_edges> <opcode>add</opcode> </item> <item class_id_reference="9" object_id="_55"> <Value> <Obj> <type>0</type> <id>74</id> <name></name> <fileName>matrixmul.cpp</fileName> <fileDirectory>d:/opt/source/Vivado/Vivado_HLS_Tutorial/Design_Optimization/lab1</fileDirectory> <lineNumber>56</lineNumber> <contextFuncName>matrixmul</contextFuncName> <inlineStackInfo> <count>1</count> <item_version>0</item_version> <item> <first>d:/opt/source/Vivado/Vivado_HLS_Tutorial/Design_Optimization/lab1</first> <second> <count>1</count> <item_version>0</item_version> <item> <first> <first>matrixmul.cpp</first> <second>matrixmul</second> </first> <second>56</second> </item> </second> </item> </inlineStackInfo> <originalName></originalName> <rtlName></rtlName> <coreName></coreName> </Obj> <bitwidth>0</bitwidth> </Value> <oprand_edges> <count>1</count> <item_version>0</item_version> <item>154</item> </oprand_edges> <opcode>br</opcode> </item> <item class_id_reference="9" object_id="_56"> <Value> <Obj> <type>0</type> <id>76</id> <name></name> <fileName>matrixmul.cpp</fileName> <fileDirectory>d:/opt/source/Vivado/Vivado_HLS_Tutorial/Design_Optimization/lab1</fileDirectory> <lineNumber>65</lineNumber> <contextFuncName>matrixmul</contextFuncName> <inlineStackInfo> <count>1</count> <item_version>0</item_version> <item> <first>d:/opt/source/Vivado/Vivado_HLS_Tutorial/Design_Optimization/lab1</first> <second> <count>1</count> <item_version>0</item_version> <item> <first> <first>matrixmul.cpp</first> <second>matrixmul</second> </first> <second>65</second> </item> </second> </item> </inlineStackInfo> <originalName></originalName> <rtlName></rtlName> <coreName></coreName> </Obj> <bitwidth>0</bitwidth> </Value> <oprand_edges> <count>0</count> <item_version>0</item_version> </oprand_edges> <opcode>ret</opcode> </item> </nodes> <consts class_id="15" tracking_level="0" version="0"> <count>8</count> <item_version>0</item_version> <item class_id="16" tracking_level="1" version="0" object_id="_57"> <Value> <Obj> <type>2</type> <id>79</id> <name>empty</name> <fileName></fileName> <fileDirectory></fileDirectory> <lineNumber>0</lineNumber> <contextFuncName></contextFuncName> <inlineStackInfo> <count>0</count> <item_version>0</item_version> </inlineStackInfo> <originalName></originalName> <rtlName></rtlName> <coreName></coreName> </Obj> <bitwidth>4</bitwidth> </Value> <const_type>0</const_type> <content>0</content> </item> <item class_id_reference="16" object_id="_58"> <Value> <Obj> <type>2</type> <id>84</id> <name>empty</name> <fileName></fileName> <fileDirectory></fileDirectory> <lineNumber>0</lineNumber> <contextFuncName></contextFuncName> <inlineStackInfo> <count>0</count> <item_version>0</item_version> </inlineStackInfo> <originalName></originalName> <rtlName></rtlName> <coreName></coreName> </Obj> <bitwidth>2</bitwidth> </Value> <const_type>0</const_type> <content>0</content> </item> <item class_id_reference="16" object_id="_59"> <Value> <Obj> <type>2</type> <id>94</id> <name>empty</name> <fileName></fileName> <fileDirectory></fileDirectory> <lineNumber>0</lineNumber> <contextFuncName></contextFuncName> <inlineStackInfo> <count>0</count> <item_version>0</item_version> </inlineStackInfo> <originalName></originalName> <rtlName></rtlName> <coreName></coreName> </Obj> <bitwidth>4</bitwidth> </Value> <const_type>0</const_type> <content>9</content> </item> <item class_id_reference="16" object_id="_60"> <Value> <Obj> <type>2</type> <id>97</id> <name>empty</name> <fileName></fileName> <fileDirectory></fileDirectory> <lineNumber>0</lineNumber> <contextFuncName></contextFuncName> <inlineStackInfo> <count>0</count> <item_version>0</item_version> </inlineStackInfo> <originalName></originalName> <rtlName></rtlName> <coreName></coreName> </Obj> <bitwidth>4</bitwidth> </Value> <const_type>0</const_type> <content>1</content> </item> <item class_id_reference="16" object_id="_61"> <Value> <Obj> <type>2</type> <id>107</id> <name>empty</name> <fileName></fileName> <fileDirectory></fileDirectory> <lineNumber>0</lineNumber> <contextFuncName></contextFuncName> <inlineStackInfo> <count>0</count> <item_version>0</item_version> </inlineStackInfo> <originalName></originalName> <rtlName></rtlName> <coreName></coreName> </Obj> <bitwidth>2</bitwidth> </Value> <const_type>0</const_type> <content>3</content> </item> <item class_id_reference="16" object_id="_62"> <Value> <Obj> <type>2</type> <id>110</id> <name>empty</name> <fileName></fileName> <fileDirectory></fileDirectory> <lineNumber>0</lineNumber> <contextFuncName></contextFuncName> <inlineStackInfo> <count>0</count> <item_version>0</item_version> </inlineStackInfo> <originalName></originalName> <rtlName></rtlName> <coreName></coreName> </Obj> <bitwidth>2</bitwidth> </Value> <const_type>0</const_type> <content>1</content> </item> <item class_id_reference="16" object_id="_63"> <Value> <Obj> <type>2</type> <id>122</id> <name>empty</name> <fileName></fileName> <fileDirectory></fileDirectory> <lineNumber>0</lineNumber> <contextFuncName></contextFuncName> <inlineStackInfo> <count>0</count> <item_version>0</item_version> </inlineStackInfo> <originalName></originalName> <rtlName></rtlName> <coreName></coreName> </Obj> <bitwidth>64</bitwidth> </Value> <const_type>0</const_type> <content>0</content> </item> <item class_id_reference="16" object_id="_64"> <Value> <Obj> <type>2</type> <id>181</id> <name>empty</name> <fileName></fileName> <fileDirectory></fileDirectory> <lineNumber>0</lineNumber> <contextFuncName></contextFuncName> <inlineStackInfo> <count>0</count> <item_version>0</item_version> </inlineStackInfo> <originalName></originalName> <rtlName></rtlName> <coreName></coreName> </Obj> <bitwidth>16</bitwidth> </Value> <const_type>0</const_type> <content>0</content> </item> </consts> <blocks class_id="17" tracking_level="0" version="0"> <count>7</count> <item_version>0</item_version> <item class_id="18" tracking_level="1" version="0" object_id="_65"> <Obj> <type>3</type> <id>9</id> <name></name> <fileName></fileName> <fileDirectory></fileDirectory> <lineNumber>0</lineNumber> <contextFuncName></contextFuncName> <inlineStackInfo> <count>0</count> <item_version>0</item_version> </inlineStackInfo> <originalName></originalName> <rtlName></rtlName> <coreName></coreName> </Obj> <node_objs> <count>1</count> <item_version>0</item_version> <item>8</item> </node_objs> </item> <item class_id_reference="18" object_id="_66"> <Obj> <type>3</type> <id>16</id> <name></name> <fileName></fileName> <fileDirectory></fileDirectory> <lineNumber>0</lineNumber> <contextFuncName></contextFuncName> <inlineStackInfo> <count>0</count> <item_version>0</item_version> </inlineStackInfo> <originalName></originalName> <rtlName></rtlName> <coreName></coreName> </Obj> <node_objs> <count>6</count> <item_version>0</item_version> <item>10</item> <item>11</item> <item>12</item> <item>13</item> <item>14</item> <item>15</item> </node_objs> </item> <item class_id_reference="18" object_id="_67"> <Obj> <type>3</type> <id>37</id> <name>.reset</name> <fileName></fileName> <fileDirectory></fileDirectory> <lineNumber>0</lineNumber> <contextFuncName></contextFuncName> <inlineStackInfo> <count>0</count> <item_version>0</item_version> </inlineStackInfo> <originalName></originalName> <rtlName></rtlName> <coreName></coreName> </Obj> <node_objs> <count>16</count> <item_version>0</item_version> <item>19</item> <item>20</item> <item>21</item> <item>22</item> <item>25</item> <item>26</item> <item>27</item> <item>28</item> <item>29</item> <item>30</item> <item>31</item> <item>32</item> <item>33</item> <item>34</item> <item>35</item> <item>36</item> </node_objs> </item> <item class_id_reference="18" object_id="_68"> <Obj> <type>3</type> <id>42</id> <name></name> <fileName></fileName> <fileDirectory></fileDirectory> <lineNumber>0</lineNumber> <contextFuncName></contextFuncName> <inlineStackInfo> <count>0</count> <item_version>0</item_version> </inlineStackInfo> <originalName></originalName> <rtlName></rtlName> <coreName></coreName> </Obj> <node_objs> <count>4</count> <item_version>0</item_version> <item>38</item> <item>39</item> <item>40</item> <item>41</item> </node_objs> </item> <item class_id_reference="18" object_id="_69"> <Obj> <type>3</type> <id>71</id> <name>ifBlock</name> <fileName></fileName> <fileDirectory></fileDirectory> <lineNumber>0</lineNumber> <contextFuncName></contextFuncName> <inlineStackInfo> <count>0</count> <item_version>0</item_version> </inlineStackInfo> <originalName></originalName> <rtlName></rtlName> <coreName></coreName> </Obj> <node_objs> <count>23</count> <item_version>0</item_version> <item>47</item> <item>48</item> <item>49</item> <item>50</item> <item>51</item> <item>52</item> <item>53</item> <item>54</item> <item>55</item> <item>56</item> <item>57</item> <item>58</item> <item>59</item> <item>60</item> <item>61</item> <item>62</item> <item>63</item> <item>64</item> <item>65</item> <item>66</item> <item>67</item> <item>68</item> <item>70</item> </node_objs> </item> <item class_id_reference="18" object_id="_70"> <Obj> <type>3</type> <id>75</id> <name></name> <fileName></fileName> <fileDirectory></fileDirectory> <lineNumber>0</lineNumber> <contextFuncName></contextFuncName> <inlineStackInfo> <count>0</count> <item_version>0</item_version> </inlineStackInfo> <originalName></originalName> <rtlName></rtlName> <coreName></coreName> </Obj> <node_objs> <count>2</count> <item_version>0</item_version> <item>73</item> <item>74</item> </node_objs> </item> <item class_id_reference="18" object_id="_71"> <Obj> <type>3</type> <id>77</id> <name></name> <fileName></fileName> <fileDirectory></fileDirectory> <lineNumber>0</lineNumber> <contextFuncName></contextFuncName> <inlineStackInfo> <count>0</count> <item_version>0</item_version> </inlineStackInfo> <originalName></originalName> <rtlName></rtlName> <coreName></coreName> </Obj> <node_objs> <count>1</count> <item_version>0</item_version> <item>76</item> </node_objs> </item> </blocks> <edges class_id="19" tracking_level="0" version="0"> <count>105</count> <item_version>0</item_version> <item class_id="20" tracking_level="1" version="0" object_id="_72"> <id>78</id> <edge_type>2</edge_type> <source_obj>16</source_obj> <sink_obj>8</sink_obj> </item> <item class_id_reference="20" object_id="_73"> <id>80</id> <edge_type>1</edge_type> <source_obj>79</source_obj> <sink_obj>10</sink_obj> </item> <item class_id_reference="20" object_id="_74"> <id>81</id> <edge_type>2</edge_type> <source_obj>9</source_obj> <sink_obj>10</sink_obj> </item> <item class_id_reference="20" object_id="_75"> <id>82</id> <edge_type>1</edge_type> <source_obj>14</source_obj> <sink_obj>10</sink_obj> </item> <item class_id_reference="20" object_id="_76"> <id>83</id> <edge_type>2</edge_type> <source_obj>75</source_obj> <sink_obj>10</sink_obj> </item> <item class_id_reference="20" object_id="_77"> <id>85</id> <edge_type>1</edge_type> <source_obj>84</source_obj> <sink_obj>11</sink_obj> </item> <item class_id_reference="20" object_id="_78"> <id>86</id> <edge_type>2</edge_type> <source_obj>9</source_obj> <sink_obj>11</sink_obj> </item> <item class_id_reference="20" object_id="_79"> <id>87</id> <edge_type>1</edge_type> <source_obj>22</source_obj> <sink_obj>11</sink_obj> </item> <item class_id_reference="20" object_id="_80"> <id>88</id> <edge_type>2</edge_type> <source_obj>75</source_obj> <sink_obj>11</sink_obj> </item> <item class_id_reference="20" object_id="_81"> <id>89</id> <edge_type>1</edge_type> <source_obj>84</source_obj> <sink_obj>12</sink_obj> </item> <item class_id_reference="20" object_id="_82"> <id>90</id> <edge_type>2</edge_type> <source_obj>9</source_obj> <sink_obj>12</sink_obj> </item> <item class_id_reference="20" object_id="_83"> <id>91</id> <edge_type>1</edge_type> <source_obj>73</source_obj> <sink_obj>12</sink_obj> </item> <item class_id_reference="20" object_id="_84"> <id>92</id> <edge_type>2</edge_type> <source_obj>75</source_obj> <sink_obj>12</sink_obj> </item> <item class_id_reference="20" object_id="_85"> <id>93</id> <edge_type>1</edge_type> <source_obj>10</source_obj> <sink_obj>13</sink_obj> </item> <item class_id_reference="20" object_id="_86"> <id>95</id> <edge_type>1</edge_type> <source_obj>94</source_obj> <sink_obj>13</sink_obj> </item> <item class_id_reference="20" object_id="_87"> <id>96</id> <edge_type>1</edge_type> <source_obj>10</source_obj> <sink_obj>14</sink_obj> </item> <item class_id_reference="20" object_id="_88"> <id>98</id> <edge_type>1</edge_type> <source_obj>97</source_obj> <sink_obj>14</sink_obj> </item> <item class_id_reference="20" object_id="_89"> <id>99</id> <edge_type>1</edge_type> <source_obj>13</source_obj> <sink_obj>15</sink_obj> </item> <item class_id_reference="20" object_id="_90"> <id>100</id> <edge_type>2</edge_type> <source_obj>37</source_obj> <sink_obj>15</sink_obj> </item> <item class_id_reference="20" object_id="_91"> <id>101</id> <edge_type>2</edge_type> <source_obj>77</source_obj> <sink_obj>15</sink_obj> </item> <item class_id_reference="20" object_id="_92"> <id>102</id> <edge_type>1</edge_type> <source_obj>84</source_obj> <sink_obj>38</sink_obj> </item> <item class_id_reference="20" object_id="_93"> <id>103</id> <edge_type>2</edge_type> <source_obj>37</source_obj> <sink_obj>38</sink_obj> </item> <item class_id_reference="20" object_id="_94"> <id>104</id> <edge_type>1</edge_type> <source_obj>40</source_obj> <sink_obj>38</sink_obj> </item> <item class_id_reference="20" object_id="_95"> <id>105</id> <edge_type>2</edge_type> <source_obj>71</source_obj> <sink_obj>38</sink_obj> </item> <item class_id_reference="20" object_id="_96"> <id>106</id> <edge_type>1</edge_type> <source_obj>38</source_obj> <sink_obj>39</sink_obj> </item> <item class_id_reference="20" object_id="_97"> <id>108</id> <edge_type>1</edge_type> <source_obj>107</source_obj> <sink_obj>39</sink_obj> </item> <item class_id_reference="20" object_id="_98"> <id>109</id> <edge_type>1</edge_type> <source_obj>38</source_obj> <sink_obj>40</sink_obj> </item> <item class_id_reference="20" object_id="_99"> <id>111</id> <edge_type>1</edge_type> <source_obj>110</source_obj> <sink_obj>40</sink_obj> </item> <item class_id_reference="20" object_id="_100"> <id>112</id> <edge_type>1</edge_type> <source_obj>39</source_obj> <sink_obj>41</sink_obj> </item> <item class_id_reference="20" object_id="_101"> <id>113</id> <edge_type>2</edge_type> <source_obj>71</source_obj> <sink_obj>41</sink_obj> </item> <item class_id_reference="20" object_id="_102"> <id>114</id> <edge_type>2</edge_type> <source_obj>75</source_obj> <sink_obj>41</sink_obj> </item> <item class_id_reference="20" object_id="_103"> <id>115</id> <edge_type>1</edge_type> <source_obj>38</source_obj> <sink_obj>47</sink_obj> </item> <item class_id_reference="20" object_id="_104"> <id>116</id> <edge_type>1</edge_type> <source_obj>38</source_obj> <sink_obj>48</sink_obj> </item> <item class_id_reference="20" object_id="_105"> <id>117</id> <edge_type>1</edge_type> <source_obj>30</source_obj> <sink_obj>49</sink_obj> </item> <item class_id_reference="20" object_id="_106"> <id>118</id> <edge_type>1</edge_type> <source_obj>47</source_obj> <sink_obj>49</sink_obj> </item> <item class_id_reference="20" object_id="_107"> <id>119</id> <edge_type>1</edge_type> <source_obj>49</source_obj> <sink_obj>50</sink_obj> </item> <item class_id_reference="20" object_id="_108"> <id>120</id> <edge_type>1</edge_type> <source_obj>50</source_obj> <sink_obj>51</sink_obj> </item> <item class_id_reference="20" object_id="_109"> <id>121</id> <edge_type>1</edge_type> <source_obj>1</source_obj> <sink_obj>52</sink_obj> </item> <item class_id_reference="20" object_id="_110"> <id>123</id> <edge_type>1</edge_type> <source_obj>122</source_obj> <sink_obj>52</sink_obj> </item> <item class_id_reference="20" object_id="_111"> <id>124</id> <edge_type>1</edge_type> <source_obj>51</source_obj> <sink_obj>52</sink_obj> </item> <item class_id_reference="20" object_id="_112"> <id>125</id> <edge_type>1</edge_type> <source_obj>52</source_obj> <sink_obj>53</sink_obj> </item> <item class_id_reference="20" object_id="_113"> <id>126</id> <edge_type>1</edge_type> <source_obj>53</source_obj> <sink_obj>54</sink_obj> </item> <item class_id_reference="20" object_id="_114"> <id>129</id> <edge_type>1</edge_type> <source_obj>38</source_obj> <sink_obj>55</sink_obj> </item> <item class_id_reference="20" object_id="_115"> <id>130</id> <edge_type>1</edge_type> <source_obj>84</source_obj> <sink_obj>55</sink_obj> </item> <item class_id_reference="20" object_id="_116"> <id>131</id> <edge_type>1</edge_type> <source_obj>55</source_obj> <sink_obj>56</sink_obj> </item> <item class_id_reference="20" object_id="_117"> <id>132</id> <edge_type>1</edge_type> <source_obj>56</source_obj> <sink_obj>57</sink_obj> </item> <item class_id_reference="20" object_id="_118"> <id>133</id> <edge_type>1</edge_type> <source_obj>48</source_obj> <sink_obj>57</sink_obj> </item> <item class_id_reference="20" object_id="_119"> <id>134</id> <edge_type>1</edge_type> <source_obj>57</source_obj> <sink_obj>58</sink_obj> </item> <item class_id_reference="20" object_id="_120"> <id>135</id> <edge_type>1</edge_type> <source_obj>58</source_obj> <sink_obj>59</sink_obj> </item> <item class_id_reference="20" object_id="_121"> <id>136</id> <edge_type>1</edge_type> <source_obj>26</source_obj> <sink_obj>59</sink_obj> </item> <item class_id_reference="20" object_id="_122"> <id>137</id> <edge_type>1</edge_type> <source_obj>59</source_obj> <sink_obj>60</sink_obj> </item> <item class_id_reference="20" object_id="_123"> <id>138</id> <edge_type>1</edge_type> <source_obj>60</source_obj> <sink_obj>61</sink_obj> </item> <item class_id_reference="20" object_id="_124"> <id>139</id> <edge_type>1</edge_type> <source_obj>2</source_obj> <sink_obj>62</sink_obj> </item> <item class_id_reference="20" object_id="_125"> <id>140</id> <edge_type>1</edge_type> <source_obj>122</source_obj> <sink_obj>62</sink_obj> </item> <item class_id_reference="20" object_id="_126"> <id>141</id> <edge_type>1</edge_type> <source_obj>61</source_obj> <sink_obj>62</sink_obj> </item> <item class_id_reference="20" object_id="_127"> <id>142</id> <edge_type>1</edge_type> <source_obj>62</source_obj> <sink_obj>63</sink_obj> </item> <item class_id_reference="20" object_id="_128"> <id>143</id> <edge_type>1</edge_type> <source_obj>63</source_obj> <sink_obj>64</sink_obj> </item> <item class_id_reference="20" object_id="_129"> <id>144</id> <edge_type>1</edge_type> <source_obj>64</source_obj> <sink_obj>65</sink_obj> </item> <item class_id_reference="20" object_id="_130"> <id>145</id> <edge_type>1</edge_type> <source_obj>54</source_obj> <sink_obj>65</sink_obj> </item> <item class_id_reference="20" object_id="_131"> <id>146</id> <edge_type>1</edge_type> <source_obj>34</source_obj> <sink_obj>66</sink_obj> </item> <item class_id_reference="20" object_id="_132"> <id>147</id> <edge_type>1</edge_type> <source_obj>65</source_obj> <sink_obj>67</sink_obj> </item> <item class_id_reference="20" object_id="_133"> <id>148</id> <edge_type>1</edge_type> <source_obj>66</source_obj> <sink_obj>67</sink_obj> </item> <item class_id_reference="20" object_id="_134"> <id>149</id> <edge_type>1</edge_type> <source_obj>67</source_obj> <sink_obj>68</sink_obj> </item> <item class_id_reference="20" object_id="_135"> <id>150</id> <edge_type>1</edge_type> <source_obj>34</source_obj> <sink_obj>68</sink_obj> </item> <item class_id_reference="20" object_id="_136"> <id>151</id> <edge_type>2</edge_type> <source_obj>42</source_obj> <sink_obj>70</sink_obj> </item> <item class_id_reference="20" object_id="_137"> <id>152</id> <edge_type>1</edge_type> <source_obj>20</source_obj> <sink_obj>73</sink_obj> </item> <item class_id_reference="20" object_id="_138"> <id>153</id> <edge_type>1</edge_type> <source_obj>110</source_obj> <sink_obj>73</sink_obj> </item> <item class_id_reference="20" object_id="_139"> <id>154</id> <edge_type>2</edge_type> <source_obj>16</source_obj> <sink_obj>74</sink_obj> </item> <item class_id_reference="20" object_id="_140"> <id>155</id> <edge_type>1</edge_type> <source_obj>12</source_obj> <sink_obj>19</sink_obj> </item> <item class_id_reference="20" object_id="_141"> <id>156</id> <edge_type>1</edge_type> <source_obj>107</source_obj> <sink_obj>19</sink_obj> </item> <item class_id_reference="20" object_id="_142"> <id>157</id> <edge_type>1</edge_type> <source_obj>19</source_obj> <sink_obj>20</sink_obj> </item> <item class_id_reference="20" object_id="_143"> <id>158</id> <edge_type>1</edge_type> <source_obj>84</source_obj> <sink_obj>20</sink_obj> </item> <item class_id_reference="20" object_id="_144"> <id>159</id> <edge_type>1</edge_type> <source_obj>12</source_obj> <sink_obj>20</sink_obj> </item> <item class_id_reference="20" object_id="_145"> <id>160</id> <edge_type>1</edge_type> <source_obj>11</source_obj> <sink_obj>21</sink_obj> </item> <item class_id_reference="20" object_id="_146"> <id>161</id> <edge_type>1</edge_type> <source_obj>110</source_obj> <sink_obj>21</sink_obj> </item> <item class_id_reference="20" object_id="_147"> <id>162</id> <edge_type>1</edge_type> <source_obj>19</source_obj> <sink_obj>22</sink_obj> </item> <item class_id_reference="20" object_id="_148"> <id>163</id> <edge_type>1</edge_type> <source_obj>21</source_obj> <sink_obj>22</sink_obj> </item> <item class_id_reference="20" object_id="_149"> <id>164</id> <edge_type>1</edge_type> <source_obj>11</source_obj> <sink_obj>22</sink_obj> </item> <item class_id_reference="20" object_id="_150"> <id>165</id> <edge_type>1</edge_type> <source_obj>22</source_obj> <sink_obj>25</sink_obj> </item> <item class_id_reference="20" object_id="_151"> <id>166</id> <edge_type>1</edge_type> <source_obj>20</source_obj> <sink_obj>26</sink_obj> </item> <item class_id_reference="20" object_id="_152"> <id>168</id> <edge_type>1</edge_type> <source_obj>22</source_obj> <sink_obj>27</sink_obj> </item> <item class_id_reference="20" object_id="_153"> <id>169</id> <edge_type>1</edge_type> <source_obj>84</source_obj> <sink_obj>27</sink_obj> </item> <item class_id_reference="20" object_id="_154"> <id>170</id> <edge_type>1</edge_type> <source_obj>27</source_obj> <sink_obj>28</sink_obj> </item> <item class_id_reference="20" object_id="_155"> <id>171</id> <edge_type>1</edge_type> <source_obj>28</source_obj> <sink_obj>29</sink_obj> </item> <item class_id_reference="20" object_id="_156"> <id>172</id> <edge_type>1</edge_type> <source_obj>25</source_obj> <sink_obj>29</sink_obj> </item> <item class_id_reference="20" object_id="_157"> <id>173</id> <edge_type>1</edge_type> <source_obj>29</source_obj> <sink_obj>30</sink_obj> </item> <item class_id_reference="20" object_id="_158"> <id>174</id> <edge_type>1</edge_type> <source_obj>30</source_obj> <sink_obj>31</sink_obj> </item> <item class_id_reference="20" object_id="_159"> <id>175</id> <edge_type>1</edge_type> <source_obj>26</source_obj> <sink_obj>31</sink_obj> </item> <item class_id_reference="20" object_id="_160"> <id>176</id> <edge_type>1</edge_type> <source_obj>31</source_obj> <sink_obj>32</sink_obj> </item> <item class_id_reference="20" object_id="_161"> <id>177</id> <edge_type>1</edge_type> <source_obj>32</source_obj> <sink_obj>33</sink_obj> </item> <item class_id_reference="20" object_id="_162"> <id>178</id> <edge_type>1</edge_type> <source_obj>3</source_obj> <sink_obj>34</sink_obj> </item> <item class_id_reference="20" object_id="_163"> <id>179</id> <edge_type>1</edge_type> <source_obj>122</source_obj> <sink_obj>34</sink_obj> </item> <item class_id_reference="20" object_id="_164"> <id>180</id> <edge_type>1</edge_type> <source_obj>33</source_obj> <sink_obj>34</sink_obj> </item> <item class_id_reference="20" object_id="_165"> <id>182</id> <edge_type>1</edge_type> <source_obj>181</source_obj> <sink_obj>35</sink_obj> </item> <item class_id_reference="20" object_id="_166"> <id>183</id> <edge_type>1</edge_type> <source_obj>34</source_obj> <sink_obj>35</sink_obj> </item> <item class_id_reference="20" object_id="_167"> <id>184</id> <edge_type>2</edge_type> <source_obj>42</source_obj> <sink_obj>36</sink_obj> </item> <item class_id_reference="20" object_id="_168"> <id>239</id> <edge_type>2</edge_type> <source_obj>9</source_obj> <sink_obj>16</sink_obj> </item> <item class_id_reference="20" object_id="_169"> <id>240</id> <edge_type>2</edge_type> <source_obj>16</source_obj> <sink_obj>77</sink_obj> </item> <item class_id_reference="20" object_id="_170"> <id>241</id> <edge_type>2</edge_type> <source_obj>16</source_obj> <sink_obj>37</sink_obj> </item> <item class_id_reference="20" object_id="_171"> <id>242</id> <edge_type>2</edge_type> <source_obj>37</source_obj> <sink_obj>42</sink_obj> </item> <item class_id_reference="20" object_id="_172"> <id>243</id> <edge_type>2</edge_type> <source_obj>42</source_obj> <sink_obj>75</sink_obj> </item> <item class_id_reference="20" object_id="_173"> <id>244</id> <edge_type>2</edge_type> <source_obj>42</source_obj> <sink_obj>71</sink_obj> </item> <item class_id_reference="20" object_id="_174"> <id>245</id> <edge_type>2</edge_type> <source_obj>71</source_obj> <sink_obj>42</sink_obj> </item> <item class_id_reference="20" object_id="_175"> <id>246</id> <edge_type>2</edge_type> <source_obj>75</source_obj> <sink_obj>16</sink_obj> </item> <item class_id_reference="20" object_id="_176"> <id>247</id> <edge_type>4</edge_type> <source_obj>66</source_obj> <sink_obj>68</sink_obj> </item> </edges> </cdfg> <cdfg_regions class_id="21" tracking_level="0" version="0"> <count>7</count> <item_version>0</item_version> <item class_id="22" tracking_level="1" version="0" object_id="_177"> <mId>1</mId> <mTag>matrixmul</mTag> <mType>0</mType> <sub_regions> <count>3</count> <item_version>0</item_version> <item>2</item> <item>3</item> <item>7</item> </sub_regions> <basic_blocks> <count>0</count> <item_version>0</item_version> </basic_blocks> <mII>-1</mII> <mDepth>-1</mDepth> <mMinTripCount>-1</mMinTripCount> <mMaxTripCount>-1</mMaxTripCount> <mMinLatency>82</mMinLatency> <mMaxLatency>-1</mMaxLatency> <mIsDfPipe>0</mIsDfPipe> <mDfPipe class_id="-1"></mDfPipe> </item> <item class_id_reference="22" object_id="_178"> <mId>2</mId> <mTag>Entry</mTag> <mType>0</mType> <sub_regions> <count>0</count> <item_version>0</item_version> </sub_regions> <basic_blocks> <count>1</count> <item_version>0</item_version> <item>9</item> </basic_blocks> <mII>-1</mII> <mDepth>-1</mDepth> <mMinTripCount>-1</mMinTripCount> <mMaxTripCount>-1</mMaxTripCount> <mMinLatency>0</mMinLatency> <mMaxLatency>-1</mMaxLatency> <mIsDfPipe>0</mIsDfPipe> <mDfPipe class_id="-1"></mDfPipe> </item> <item class_id_reference="22" object_id="_179"> <mId>3</mId> <mTag>Row_Col</mTag> <mType>1</mType> <sub_regions> <count>3</count> <item_version>0</item_version> <item>4</item> <item>5</item> <item>6</item> </sub_regions> <basic_blocks> <count>0</count> <item_version>0</item_version> </basic_blocks> <mII>-1</mII> <mDepth>-1</mDepth> <mMinTripCount>9</mMinTripCount> <mMaxTripCount>9</mMaxTripCount> <mMinLatency>81</mMinLatency> <mMaxLatency>-1</mMaxLatency> <mIsDfPipe>0</mIsDfPipe> <mDfPipe class_id="-1"></mDfPipe> </item> <item class_id_reference="22" object_id="_180"> <mId>4</mId> <mTag>Region 1</mTag> <mType>0</mType> <sub_regions> <count>0</count> <item_version>0</item_version> </sub_regions> <basic_blocks> <count>2</count> <item_version>0</item_version> <item>16</item> <item>37</item> </basic_blocks> <mII>-1</mII> <mDepth>-1</mDepth> <mMinTripCount>-1</mMinTripCount> <mMaxTripCount>-1</mMaxTripCount> <mMinLatency>0</mMinLatency> <mMaxLatency>-1</mMaxLatency> <mIsDfPipe>0</mIsDfPipe> <mDfPipe class_id="-1"></mDfPipe> </item> <item class_id_reference="22" object_id="_181"> <mId>5</mId> <mTag>Product</mTag> <mType>1</mType> <sub_regions> <count>0</count> <item_version>0</item_version> </sub_regions> <basic_blocks> <count>2</count> <item_version>0</item_version> <item>42</item> <item>71</item> </basic_blocks> <mII>2</mII> <mDepth>2</mDepth> <mMinTripCount>3</mMinTripCount> <mMaxTripCount>3</mMaxTripCount> <mMinLatency>6</mMinLatency> <mMaxLatency>-1</mMaxLatency> <mIsDfPipe>0</mIsDfPipe> <mDfPipe class_id="-1"></mDfPipe> </item> <item class_id_reference="22" object_id="_182"> <mId>6</mId> <mTag>Region 2</mTag> <mType>0</mType> <sub_regions> <count>0</count> <item_version>0</item_version> </sub_regions> <basic_blocks> <count>1</count> <item_version>0</item_version> <item>75</item> </basic_blocks> <mII>-1</mII> <mDepth>-1</mDepth> <mMinTripCount>-1</mMinTripCount> <mMaxTripCount>-1</mMaxTripCount> <mMinLatency>0</mMinLatency> <mMaxLatency>-1</mMaxLatency> <mIsDfPipe>0</mIsDfPipe> <mDfPipe class_id="-1"></mDfPipe> </item> <item class_id_reference="22" object_id="_183"> <mId>7</mId> <mTag>Return</mTag> <mType>0</mType> <sub_regions> <count>0</count> <item_version>0</item_version> </sub_regions> <basic_blocks> <count>1</count> <item_version>0</item_version> <item>77</item> </basic_blocks> <mII>-1</mII> <mDepth>-1</mDepth> <mMinTripCount>-1</mMinTripCount> <mMaxTripCount>-1</mMaxTripCount> <mMinLatency>0</mMinLatency> <mMaxLatency>-1</mMaxLatency> <mIsDfPipe>0</mIsDfPipe> <mDfPipe class_id="-1"></mDfPipe> </item> </cdfg_regions> <fsm class_id="-1"></fsm> <res class_id="25" tracking_level="1" version="0" object_id="_184"> <dp_component_resource class_id="26" tracking_level="0" version="0"> <count>0</count> <item_version>0</item_version> </dp_component_resource> <dp_expression_resource> <count>0</count> <item_version>0</item_version> </dp_expression_resource> <dp_fifo_resource> <count>0</count> <item_version>0</item_version> </dp_fifo_resource> <dp_memory_resource> <count>0</count> <item_version>0</item_version> </dp_memory_resource> <dp_multiplexer_resource> <count>0</count> <item_version>0</item_version> </dp_multiplexer_resource> <dp_register_resource> <count>0</count> <item_version>0</item_version> </dp_register_resource> <dp_component_map class_id="27" tracking_level="0" version="0"> <count>0</count> <item_version>0</item_version> </dp_component_map> <dp_expression_map> <count>0</count> <item_version>0</item_version> </dp_expression_map> <dp_fifo_map> <count>0</count> <item_version>0</item_version> </dp_fifo_map> <dp_memory_map> <count>0</count> <item_version>0</item_version> </dp_memory_map> </res> <node_label_latency class_id="28" tracking_level="0" version="0"> <count>53</count> <item_version>0</item_version> <item class_id="29" tracking_level="0" version="0"> <first>8</first> <second class_id="30" tracking_level="0" version="0"> <first>0</first> <second>0</second> </second> </item> <item> <first>10</first> <second> <first>1</first> <second>0</second> </second> </item> <item> <first>11</first> <second> <first>1</first> <second>0</second> </second> </item> <item> <first>12</first> <second> <first>1</first> <second>0</second> </second> </item> <item> <first>13</first> <second> <first>1</first> <second>0</second> </second> </item> <item> <first>14</first> <second> <first>1</first> <second>0</second> </second> </item> <item> <first>15</first> <second> <first>1</first> <second>0</second> </second> </item> <item> <first>19</first> <second> <first>1</first> <second>0</second> </second> </item> <item> <first>20</first> <second> <first>1</first> <second>0</second> </second> </item> <item> <first>21</first> <second> <first>1</first> <second>0</second> </second> </item> <item> <first>22</first> <second> <first>1</first> <second>0</second> </second> </item> <item> <first>25</first> <second> <first>1</first> <second>0</second> </second> </item> <item> <first>26</first> <second> <first>1</first> <second>0</second> </second> </item> <item> <first>27</first> <second> <first>1</first> <second>0</second> </second> </item> <item> <first>28</first> <second> <first>1</first> <second>0</second> </second> </item> <item> <first>29</first> <second> <first>1</first> <second>0</second> </second> </item> <item> <first>30</first> <second> <first>1</first> <second>0</second> </second> </item> <item> <first>31</first> <second> <first>1</first> <second>0</second> </second> </item> <item> <first>32</first> <second> <first>1</first> <second>0</second> </second> </item> <item> <first>33</first> <second> <first>1</first> <second>0</second> </second> </item> <item> <first>34</first> <second> <first>1</first> <second>0</second> </second> </item> <item> <first>35</first> <second> <first>1</first> <second>0</second> </second> </item> <item> <first>36</first> <second> <first>1</first> <second>0</second> </second> </item> <item> <first>38</first> <second> <first>2</first> <second>0</second> </second> </item> <item> <first>39</first> <second> <first>2</first> <second>0</second> </second> </item> <item> <first>40</first> <second> <first>2</first> <second>0</second> </second> </item> <item> <first>41</first> <second> <first>2</first> <second>0</second> </second> </item> <item> <first>47</first> <second> <first>2</first> <second>0</second> </second> </item> <item> <first>48</first> <second> <first>2</first> <second>0</second> </second> </item> <item> <first>49</first> <second> <first>2</first> <second>0</second> </second> </item> <item> <first>50</first> <second> <first>2</first> <second>0</second> </second> </item> <item> <first>51</first> <second> <first>2</first> <second>0</second> </second> </item> <item> <first>52</first> <second> <first>2</first> <second>0</second> </second> </item> <item> <first>53</first> <second> <first>2</first> <second>1</second> </second> </item> <item> <first>54</first> <second> <first>3</first> <second>0</second> </second> </item> <item> <first>55</first> <second> <first>2</first> <second>0</second> </second> </item> <item> <first>56</first> <second> <first>2</first> <second>0</second> </second> </item> <item> <first>57</first> <second> <first>2</first> <second>0</second> </second> </item> <item> <first>58</first> <second> <first>2</first> <second>0</second> </second> </item> <item> <first>59</first> <second> <first>2</first> <second>0</second> </second> </item> <item> <first>60</first> <second> <first>2</first> <second>0</second> </second> </item> <item> <first>61</first> <second> <first>2</first> <second>0</second> </second> </item> <item> <first>62</first> <second> <first>2</first> <second>0</second> </second> </item> <item> <first>63</first> <second> <first>2</first> <second>1</second> </second> </item> <item> <first>64</first> <second> <first>3</first> <second>0</second> </second> </item> <item> <first>65</first> <second> <first>3</first> <second>0</second> </second> </item> <item> <first>66</first> <second> <first>2</first> <second>1</second> </second> </item> <item> <first>67</first> <second> <first>3</first> <second>0</second> </second> </item> <item> <first>68</first> <second> <first>3</first> <second>0</second> </second> </item> <item> <first>70</first> <second> <first>3</first> <second>0</second> </second> </item> <item> <first>73</first> <second> <first>3</first> <second>0</second> </second> </item> <item> <first>74</first> <second> <first>3</first> <second>0</second> </second> </item> <item> <first>76</first> <second> <first>1</first> <second>0</second> </second> </item> </node_label_latency> <bblk_ent_exit class_id="31" tracking_level="0" version="0"> <count>7</count> <item_version>0</item_version> <item class_id="32" tracking_level="0" version="0"> <first>9</first> <second class_id="33" tracking_level="0" version="0"> <first>0</first> <second>0</second> </second> </item> <item> <first>16</first> <second> <first>1</first> <second>1</second> </second> </item> <item> <first>37</first> <second> <first>1</first> <second>1</second> </second> </item> <item> <first>42</first> <second> <first>2</first> <second>2</second> </second> </item> <item> <first>71</first> <second> <first>2</first> <second>3</second> </second> </item> <item> <first>75</first> <second> <first>3</first> <second>3</second> </second> </item> <item> <first>77</first> <second> <first>1</first> <second>1</second> </second> </item> </bblk_ent_exit> <regions class_id="34" tracking_level="0" version="0"> <count>1</count> <item_version>0</item_version> <item class_id="35" tracking_level="1" version="0" object_id="_185"> <region_name>Product</region_name> <basic_blocks> <count>2</count> <item_version>0</item_version> <item>42</item> <item>71</item> </basic_blocks> <nodes> <count>0</count> <item_version>0</item_version> </nodes> <anchor_node>-1</anchor_node> <region_type>8</region_type> <interval>2</interval> <pipe_depth>2</pipe_depth> </item> </regions> <dp_fu_nodes class_id="36" tracking_level="0" version="0"> <count>0</count> <item_version>0</item_version> </dp_fu_nodes> <dp_fu_nodes_expression class_id="37" tracking_level="0" version="0"> <count>0</count> <item_version>0</item_version> </dp_fu_nodes_expression> <dp_fu_nodes_module> <count>0</count> <item_version>0</item_version> </dp_fu_nodes_module> <dp_fu_nodes_io> <count>0</count> <item_version>0</item_version> </dp_fu_nodes_io> <return_ports> <count>0</count> <item_version>0</item_version> </return_ports> <dp_mem_port_nodes class_id="38" tracking_level="0" version="0"> <count>0</count> <item_version>0</item_version> </dp_mem_port_nodes> <dp_reg_nodes> <count>0</count> <item_version>0</item_version> </dp_reg_nodes> <dp_regname_nodes> <count>0</count> <item_version>0</item_version> </dp_regname_nodes> <dp_reg_phi> <count>0</count> <item_version>0</item_version> </dp_reg_phi> <dp_regname_phi> <count>0</count> <item_version>0</item_version> </dp_regname_phi> <dp_port_io_nodes class_id="39" tracking_level="0" version="0"> <count>0</count> <item_version>0</item_version> </dp_port_io_nodes> <port2core class_id="40" tracking_level="0" version="0"> <count>0</count> <item_version>0</item_version> </port2core> <node2core> <count>0</count> <item_version>0</item_version> </node2core> </syndb> </boost_serialization>
------------------------------------------------------------------------------ -- -- -- 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 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 stm32f4xx_hal_cortex.h -- -- @author MCD Application Team -- -- @version V1.1.0 -- -- @date 19-June-2014 -- -- @brief Header file of CORTEX HAL module. -- -- -- -- COPYRIGHT(c) 2014 STMicroelectronics -- ------------------------------------------------------------------------------ -- This file provides Nested Vector interrupt Controller definitions for the -- ARM Cortex M0 microcontrollers from ST Microelectronics. with HAL; use HAL; package Cortex_M.NVIC is -- the Nested Vectored Interrupt Controller subtype Interrupt_ID is Natural range 0 .. 31; subtype Interrupt_Priority is UInt8; procedure Set_Priority (IRQn : Interrupt_ID; Priority : Interrupt_Priority) with Inline; procedure Enable_Interrupt (IRQn : Interrupt_ID) with Inline; procedure Disable_Interrupt (IRQn : Interrupt_ID) with Inline; function Enabled (IRQn : Interrupt_ID) return Boolean with Inline; function Pending (IRQn : Interrupt_ID) return Boolean with Inline; procedure Set_Pending (IRQn : Interrupt_ID) with Inline; procedure Clear_Pending (IRQn : Interrupt_ID) with Inline; end Cortex_M.NVIC;
-- WORDS, a Latin dictionary, by Colonel William Whitaker (USAF, Retired) -- -- Copyright William A. Whitaker (1936–2010) -- -- This is a free program, which means it is proper to copy it and pass -- it on to your friends. Consider it a developmental item for which -- there is no charge. However, just for form, it is Copyrighted -- (c). Permission is hereby freely given for any and all use of program -- and data. You can sell it as your own, but at least tell me. -- -- This version is distributed without obligation, but the developer -- would appreciate comments and suggestions. -- -- All parts of the WORDS system, source code and data files, are made freely -- available to anyone who wishes to use them, for whatever purpose. separate (Support_Utils.Addons_Package) package body Tackon_Entry_Io is procedure Get (F : in File_Type; I : out Tackon_Entry) is begin Get (F, I.Base); end Get; procedure Get (I : out Tackon_Entry) is begin Get (I.Base); end Get; procedure Put (F : in File_Type; I : in Tackon_Entry) is begin Put (F, I.Base); end Put; procedure Put (I : in Tackon_Entry) is begin Put (I.Base); end Put; procedure Get (S : in String; I : out Tackon_Entry; Last : out Integer) is L : constant Integer := S'First - 1; begin Get (S (L + 1 .. S'Last), I.Base, Last); end Get; procedure Put (S : out String; I : in Tackon_Entry) is L : constant Integer := S'First - 1; M : Integer := 0; begin M := L + Target_Entry_Io.Default_Width; Put (S (L + 1 .. M), I.Base); S (S'First .. S'Last) := (others => ' '); end Put; end Tackon_Entry_Io;
with Tkmrpc.Servers.Cfg; with Tkmrpc.Response.Cfg.Tkm_Limits.Convert; package body Tkmrpc.Operation_Handlers.Cfg.Tkm_Limits is ------------------------------------------------------------------------- procedure Handle (Req : Request.Data_Type; Res : out Response.Data_Type) is pragma Unreferenced (Req); Specific_Res : Response.Cfg.Tkm_Limits.Response_Type; begin Specific_Res := Response.Cfg.Tkm_Limits.Null_Response; Servers.Cfg.Tkm_Limits (Result => Specific_Res.Header.Result, Max_Active_Requests => Specific_Res.Data.Max_Active_Requests, Authag_Contexts => Specific_Res.Data.Authag_Contexts, Cag_Contexts => Specific_Res.Data.Cag_Contexts, Li_Contexts => Specific_Res.Data.Li_Contexts, Ri_Contexts => Specific_Res.Data.Ri_Contexts, Iag_Contexts => Specific_Res.Data.Iag_Contexts, Eag_Contexts => Specific_Res.Data.Eag_Contexts, Dhag_Contexts => Specific_Res.Data.Dhag_Contexts, Sp_Contexts => Specific_Res.Data.Sp_Contexts, Authp_Contexts => Specific_Res.Data.Authp_Contexts, Dhp_Contexts => Specific_Res.Data.Dhp_Contexts, Autha_Contexts => Specific_Res.Data.Autha_Contexts, Ca_Contexts => Specific_Res.Data.Ca_Contexts, Lc_Contexts => Specific_Res.Data.Lc_Contexts, Ia_Contexts => Specific_Res.Data.Ia_Contexts, Ea_Contexts => Specific_Res.Data.Ea_Contexts, Dha_Contexts => Specific_Res.Data.Dha_Contexts); Res := Response.Cfg.Tkm_Limits.Convert.To_Response (S => Specific_Res); end Handle; end Tkmrpc.Operation_Handlers.Cfg.Tkm_Limits;
package body UxAS.Common.Sentinel_Serial_Buffers is ----------------------------- -- Get_Next_Payload_String -- ----------------------------- procedure Get_Next_Payload_String (This : in out Sentinel_Serial_Buffer; New_Data_Chunk : String; Result : out String) is begin -- Generated stub: replace with real body! pragma Compile_Time_Warning (Standard.True, "Get_Next_Payload_String unimplemented"); raise Program_Error with "Unimplemented procedure Get_Next_Payload_String"; end Get_Next_Payload_String; -------------------------------- -- Create_Sentinelized_String -- -------------------------------- function Create_Sentinelized_String (Data : String) return String is begin -- Generated stub: replace with real body! pragma Compile_Time_Warning (Standard.True, "Create_Sentinelized_String unimplemented"); return raise Program_Error with "Unimplemented function Create_Sentinelized_String"; end Create_Sentinelized_String; ------------------------- -- Calculated_Checksum -- ------------------------- function Calculated_Checksum (Str : String) return UInt32 is Result : UInt32 := 0; begin for C of Str loop Result := Result + Character'Pos (C); end loop; return Result; end Calculated_Checksum; ---------------------------------------------- -- Get_Detect_Sentinel_Base_Strings_Message -- ---------------------------------------------- function Get_Detect_Sentinel_Base_Strings_Message (Data : String) return String is begin -- Generated stub: replace with real body! pragma Compile_Time_Warning (Standard.True, "Get_Detect_Sentinel_Base_Strings_Message unimplemented"); return raise Program_Error with "Unimplemented function Get_Detect_Sentinel_Base_Strings_Message"; end Get_Detect_Sentinel_Base_Strings_Message; end UxAS.Common.Sentinel_Serial_Buffers;
----------------------------------------------------------------------- -- aws-attachments-extend -- ASF extensions for AWS attachments -- Copyright (C) 2012 Stephane Carrez -- Written by Stephane Carrez (Stephane.Carrez@gmail.com) -- -- Licensed under the Apache License, Version 2.0 (the "License"); -- you may not use this file except in compliance with the License. -- You may obtain a copy of the License at -- -- http://www.apache.org/licenses/LICENSE-2.0 -- -- Unless required by applicable law or agreed to in writing, software -- distributed under the License is distributed on an "AS IS" BASIS, -- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -- See the License for the specific language governing permissions and -- limitations under the License. ----------------------------------------------------------------------- package body AWS.Attachments.Extend is -- ------------------------------ -- Get the length of the data content. -- ------------------------------ function Get_Length (E : in Element) return Natural is begin case E.Kind is when Data => return E.Data.Length; when others => return 0; end case; end Get_Length; -- ------------------------------ -- Get the name of the attachement. -- ------------------------------ function Get_Name (E : in Element) return String is begin case E.Kind is when Data => return To_String (E.Data.Content_Id); when others => return ""; end case; end Get_Name; end AWS.Attachments.Extend;
------------------------------------------------------------------------------ -- -- -- GNAT RUNTIME COMPONENTS -- -- -- -- S Y S T E M . P A C K _ 5 2 -- -- -- -- S p e c -- -- -- -- $Revision$ -- -- -- Copyright (C) 1992-1999 Free Software Foundation, Inc. -- -- -- -- GNAT is free software; you can redistribute it and/or modify it under -- -- terms of the GNU General Public License as published by the Free Soft- -- -- ware Foundation; either version 2, or (at your option) any later ver- -- -- sion. GNAT is distributed in the hope that it will be useful, but WITH- -- -- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY -- -- or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -- -- for more details. You should have received a copy of the GNU General -- -- Public License distributed with GNAT; see file COPYING. If not, write -- -- to the Free Software Foundation, 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. -- -- -- -- GNAT was originally developed by the GNAT team at New York University. -- -- Extensive contributions were provided by Ada Core Technologies Inc. -- -- -- ------------------------------------------------------------------------------ -- Handling of packed arrays with Component_Size = 52 package System.Pack_52 is pragma Preelaborate (Pack_52); Bits : constant := 52; type Bits_52 is mod 2 ** Bits; for Bits_52'Size use Bits; function Get_52 (Arr : System.Address; N : Natural) return Bits_52; -- Arr is the address of the packed array, N is the zero-based -- subscript. This element is extracted and returned. procedure Set_52 (Arr : System.Address; N : Natural; E : Bits_52); -- Arr is the address of the packed array, N is the zero-based -- subscript. This element is set to the given value. function GetU_52 (Arr : System.Address; N : Natural) return Bits_52; -- Arr is the address of the packed array, N is the zero-based -- subscript. This element is extracted and returned. This version -- is used when Arr may represent an unaligned address. procedure SetU_52 (Arr : System.Address; N : Natural; E : Bits_52); -- Arr is the address of the packed array, N is the zero-based -- subscript. This element is set to the given value. This version -- is used when Arr may represent an unaligned address end System.Pack_52;
-- Copyright 2015 Free Software Foundation, Inc. -- -- This program is free software; you can redistribute it and/or modify -- it under the terms of the GNU General Public License as published by -- the Free Software Foundation; either version 3 of the License, or -- (at your option) any later version. -- -- This program is distributed in the hope that it will be useful, -- but WITHOUT ANY WARRANTY; without even the implied warranty of -- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -- GNU General Public License for more details. -- -- You should have received a copy of the GNU General Public License -- along with this program. If not, see <http://www.gnu.org/licenses/>. with System; package Pck is type Table is array (Positive range <>) of Integer; type Object (N : Integer) is record Data : Table (1 .. N); end record; type Small is new Integer range 0 .. 255; for Small'Size use 8; type Small_Table is array (Positive range <>) of Small; pragma Pack (Small_Table); type Small_Object (N : Integer) is record Data : Table (1 .. N); end record; procedure Do_Nothing (A : System.Address); end Pck;
<?xml version="1.0" encoding="UTF-8" standalone="yes" ?> <!DOCTYPE boost_serialization> <boost_serialization signature="serialization::archive" version="15"> <syndb class_id="0" tracking_level="0" version="0"> <userIPLatency>-1</userIPLatency> <userIPName></userIPName> <cdfg class_id="1" tracking_level="1" version="0" object_id="_0"> <name>colorthresholding_9_0_3_2160_3840_1_entry12</name> <ret_bitwidth>0</ret_bitwidth> <ports class_id="2" tracking_level="0" version="0"> <count>4</count> <item_version>0</item_version> <item class_id="3" tracking_level="1" version="0" object_id="_1"> <Value class_id="4" tracking_level="0" version="0"> <Obj class_id="5" tracking_level="0" version="0"> <type>1</type> <id>1</id> <name>p_src_mat_rows</name> <fileName></fileName> <fileDirectory></fileDirectory> <lineNumber>0</lineNumber> <contextFuncName></contextFuncName> <contextNormFuncName></contextNormFuncName> <inlineStackInfo class_id="6" tracking_level="0" version="0"> <count>0</count> <item_version>0</item_version> </inlineStackInfo> <originalName></originalName> <rtlName></rtlName> <control></control> <opType></opType> <implIndex></implIndex> <coreName>FIFO_SRL</coreName> <coreId>49</coreId> </Obj> <bitwidth>32</bitwidth> </Value> <direction>0</direction> <if_type>3</if_type> <array_size>0</array_size> <bit_vecs class_id="7" tracking_level="0" version="0"> <count>0</count> <item_version>0</item_version> </bit_vecs> </item> <item class_id_reference="3" object_id="_2"> <Value> <Obj> <type>1</type> <id>2</id> <name>p_src_mat_cols</name> <fileName></fileName> <fileDirectory></fileDirectory> <lineNumber>0</lineNumber> <contextFuncName></contextFuncName> <contextNormFuncName></contextNormFuncName> <inlineStackInfo> <count>0</count> <item_version>0</item_version> </inlineStackInfo> <originalName></originalName> <rtlName></rtlName> <control></control> <opType></opType> <implIndex></implIndex> <coreName>FIFO_SRL</coreName> <coreId>52</coreId> </Obj> <bitwidth>32</bitwidth> </Value> <direction>0</direction> <if_type>3</if_type> <array_size>0</array_size> <bit_vecs> <count>0</count> <item_version>0</item_version> </bit_vecs> </item> <item class_id_reference="3" object_id="_3"> <Value> <Obj> <type>1</type> <id>3</id> <name>p_src_mat_rows_out</name> <fileName></fileName> <fileDirectory></fileDirectory> <lineNumber>0</lineNumber> <contextFuncName></contextFuncName> <contextNormFuncName></contextNormFuncName> <inlineStackInfo> <count>0</count> <item_version>0</item_version> </inlineStackInfo> <originalName></originalName> <rtlName></rtlName> <control></control> <opType></opType> <implIndex></implIndex> <coreName>FIFO_SRL</coreName> <coreId>49</coreId> </Obj> <bitwidth>16</bitwidth> </Value> <direction>1</direction> <if_type>3</if_type> <array_size>0</array_size> <bit_vecs> <count>0</count> <item_version>0</item_version> </bit_vecs> </item> <item class_id_reference="3" object_id="_4"> <Value> <Obj> <type>1</type> <id>4</id> <name>p_src_mat_cols_out</name> <fileName></fileName> <fileDirectory></fileDirectory> <lineNumber>0</lineNumber> <contextFuncName></contextFuncName> <contextNormFuncName></contextNormFuncName> <inlineStackInfo> <count>0</count> <item_version>0</item_version> </inlineStackInfo> <originalName></originalName> <rtlName></rtlName> <control></control> <opType></opType> <implIndex></implIndex> <coreName>FIFO_SRL</coreName> <coreId>49</coreId> </Obj> <bitwidth>16</bitwidth> </Value> <direction>1</direction> <if_type>3</if_type> <array_size>0</array_size> <bit_vecs> <count>0</count> <item_version>0</item_version> </bit_vecs> </item> </ports> <nodes class_id="8" tracking_level="0" version="0"> <count>7</count> <item_version>0</item_version> <item class_id="9" tracking_level="1" version="0" object_id="_5"> <Value> <Obj> <type>0</type> <id>7</id> <name>p_src_mat_rows_read</name> <fileName></fileName> <fileDirectory></fileDirectory> <lineNumber>0</lineNumber> <contextFuncName></contextFuncName> <contextNormFuncName></contextNormFuncName> <inlineStackInfo> <count>0</count> <item_version>0</item_version> </inlineStackInfo> <originalName></originalName> <rtlName></rtlName> <control>auto</control> <opType>fifo</opType> <implIndex>srl</implIndex> <coreName>FIFO_SRL</coreName> <coreId>81</coreId> </Obj> <bitwidth>32</bitwidth> </Value> <oprand_edges> <count>2</count> <item_version>0</item_version> <item>18</item> <item>19</item> </oprand_edges> <opcode>read</opcode> <m_Display>0</m_Display> <m_isOnCriticalPath>0</m_isOnCriticalPath> <m_isLCDNode>0</m_isLCDNode> <m_isStartOfPath>0</m_isStartOfPath> <m_delay>3.40</m_delay> <m_topoIndex>1</m_topoIndex> <m_clusterGroupNumber>-1</m_clusterGroupNumber> </item> <item class_id_reference="9" object_id="_6"> <Value> <Obj> <type>0</type> <id>8</id> <name>empty</name> <fileName></fileName> <fileDirectory></fileDirectory> <lineNumber>0</lineNumber> <contextFuncName></contextFuncName> <contextNormFuncName></contextNormFuncName> <inlineStackInfo> <count>0</count> <item_version>0</item_version> </inlineStackInfo> <originalName></originalName> <rtlName></rtlName> <control></control> <opType></opType> <implIndex></implIndex> <coreName></coreName> <coreId>0</coreId> </Obj> <bitwidth>16</bitwidth> </Value> <oprand_edges> <count>1</count> <item_version>0</item_version> <item>20</item> </oprand_edges> <opcode>trunc</opcode> <m_Display>0</m_Display> <m_isOnCriticalPath>0</m_isOnCriticalPath> <m_isLCDNode>0</m_isLCDNode> <m_isStartOfPath>0</m_isStartOfPath> <m_delay>0.00</m_delay> <m_topoIndex>2</m_topoIndex> <m_clusterGroupNumber>-1</m_clusterGroupNumber> </item> <item class_id_reference="9" object_id="_7"> <Value> <Obj> <type>0</type> <id>10</id> <name>p_src_mat_rows_out_write_ln0</name> <fileName></fileName> <fileDirectory></fileDirectory> <lineNumber>0</lineNumber> <contextFuncName></contextFuncName> <contextNormFuncName></contextNormFuncName> <inlineStackInfo> <count>0</count> <item_version>0</item_version> </inlineStackInfo> <originalName></originalName> <rtlName></rtlName> <control>auto</control> <opType>fifo</opType> <implIndex>srl</implIndex> <coreName>FIFO_SRL</coreName> <coreId>81</coreId> </Obj> <bitwidth>0</bitwidth> </Value> <oprand_edges> <count>3</count> <item_version>0</item_version> <item>22</item> <item>23</item> <item>24</item> </oprand_edges> <opcode>write</opcode> <m_Display>0</m_Display> <m_isOnCriticalPath>0</m_isOnCriticalPath> <m_isLCDNode>0</m_isLCDNode> <m_isStartOfPath>0</m_isStartOfPath> <m_delay>3.40</m_delay> <m_topoIndex>3</m_topoIndex> <m_clusterGroupNumber>-1</m_clusterGroupNumber> </item> <item class_id_reference="9" object_id="_8"> <Value> <Obj> <type>0</type> <id>11</id> <name>p_src_mat_cols_read</name> <fileName></fileName> <fileDirectory></fileDirectory> <lineNumber>0</lineNumber> <contextFuncName></contextFuncName> <contextNormFuncName></contextNormFuncName> <inlineStackInfo> <count>0</count> <item_version>0</item_version> </inlineStackInfo> <originalName></originalName> <rtlName></rtlName> <control>auto</control> <opType>fifo</opType> <implIndex>srl</implIndex> <coreName>FIFO_SRL</coreName> <coreId>81</coreId> </Obj> <bitwidth>32</bitwidth> </Value> <oprand_edges> <count>2</count> <item_version>0</item_version> <item>25</item> <item>26</item> </oprand_edges> <opcode>read</opcode> <m_Display>0</m_Display> <m_isOnCriticalPath>0</m_isOnCriticalPath> <m_isLCDNode>0</m_isLCDNode> <m_isStartOfPath>0</m_isStartOfPath> <m_delay>3.40</m_delay> <m_topoIndex>4</m_topoIndex> <m_clusterGroupNumber>-1</m_clusterGroupNumber> </item> <item class_id_reference="9" object_id="_9"> <Value> <Obj> <type>0</type> <id>12</id> <name>empty_33</name> <fileName></fileName> <fileDirectory></fileDirectory> <lineNumber>0</lineNumber> <contextFuncName></contextFuncName> <contextNormFuncName></contextNormFuncName> <inlineStackInfo> <count>0</count> <item_version>0</item_version> </inlineStackInfo> <originalName></originalName> <rtlName></rtlName> <control></control> <opType></opType> <implIndex></implIndex> <coreName></coreName> <coreId>132</coreId> </Obj> <bitwidth>16</bitwidth> </Value> <oprand_edges> <count>1</count> <item_version>0</item_version> <item>27</item> </oprand_edges> <opcode>trunc</opcode> <m_Display>0</m_Display> <m_isOnCriticalPath>0</m_isOnCriticalPath> <m_isLCDNode>0</m_isLCDNode> <m_isStartOfPath>0</m_isStartOfPath> <m_delay>0.00</m_delay> <m_topoIndex>5</m_topoIndex> <m_clusterGroupNumber>-1</m_clusterGroupNumber> </item> <item class_id_reference="9" object_id="_10"> <Value> <Obj> <type>0</type> <id>14</id> <name>p_src_mat_cols_out_write_ln0</name> <fileName></fileName> <fileDirectory></fileDirectory> <lineNumber>0</lineNumber> <contextFuncName></contextFuncName> <contextNormFuncName></contextNormFuncName> <inlineStackInfo> <count>0</count> <item_version>0</item_version> </inlineStackInfo> <originalName></originalName> <rtlName></rtlName> <control>auto</control> <opType>fifo</opType> <implIndex>srl</implIndex> <coreName>FIFO_SRL</coreName> <coreId>81</coreId> </Obj> <bitwidth>0</bitwidth> </Value> <oprand_edges> <count>3</count> <item_version>0</item_version> <item>28</item> <item>29</item> <item>30</item> </oprand_edges> <opcode>write</opcode> <m_Display>0</m_Display> <m_isOnCriticalPath>0</m_isOnCriticalPath> <m_isLCDNode>0</m_isLCDNode> <m_isStartOfPath>0</m_isStartOfPath> <m_delay>3.40</m_delay> <m_topoIndex>6</m_topoIndex> <m_clusterGroupNumber>-1</m_clusterGroupNumber> </item> <item class_id_reference="9" object_id="_11"> <Value> <Obj> <type>0</type> <id>15</id> <name>_ln0</name> <fileName></fileName> <fileDirectory></fileDirectory> <lineNumber>0</lineNumber> <contextFuncName></contextFuncName> <contextNormFuncName></contextNormFuncName> <inlineStackInfo> <count>0</count> <item_version>0</item_version> </inlineStackInfo> <originalName></originalName> <rtlName></rtlName> <control></control> <opType></opType> <implIndex></implIndex> <coreName></coreName> <coreId>129</coreId> </Obj> <bitwidth>0</bitwidth> </Value> <oprand_edges> <count>0</count> <item_version>0</item_version> </oprand_edges> <opcode>ret</opcode> <m_Display>0</m_Display> <m_isOnCriticalPath>0</m_isOnCriticalPath> <m_isLCDNode>0</m_isLCDNode> <m_isStartOfPath>0</m_isStartOfPath> <m_delay>0.00</m_delay> <m_topoIndex>7</m_topoIndex> <m_clusterGroupNumber>-1</m_clusterGroupNumber> </item> </nodes> <consts class_id="11" tracking_level="0" version="0"> <count>0</count> <item_version>0</item_version> </consts> <blocks class_id="12" tracking_level="0" version="0"> <count>1</count> <item_version>0</item_version> <item class_id="13" tracking_level="1" version="0" object_id="_12"> <Obj> <type>3</type> <id>16</id> <name>colorthresholding&lt;9, 0, 3, 2160, 3840, 1&gt;.entry12</name> <fileName></fileName> <fileDirectory></fileDirectory> <lineNumber>0</lineNumber> <contextFuncName></contextFuncName> <contextNormFuncName></contextNormFuncName> <inlineStackInfo> <count>0</count> <item_version>0</item_version> </inlineStackInfo> <originalName></originalName> <rtlName></rtlName> <control></control> <opType></opType> <implIndex></implIndex> <coreName></coreName> <coreId>129</coreId> </Obj> <node_objs> <count>7</count> <item_version>0</item_version> <item>7</item> <item>8</item> <item>10</item> <item>11</item> <item>12</item> <item>14</item> <item>15</item> </node_objs> </item> </blocks> <edges class_id="14" tracking_level="0" version="0"> <count>8</count> <item_version>0</item_version> <item class_id="15" tracking_level="1" version="0" object_id="_13"> <id>19</id> <edge_type>1</edge_type> <source_obj>1</source_obj> <sink_obj>7</sink_obj> <is_back_edge>0</is_back_edge> </item> <item class_id_reference="15" object_id="_14"> <id>20</id> <edge_type>1</edge_type> <source_obj>7</source_obj> <sink_obj>8</sink_obj> <is_back_edge>0</is_back_edge> </item> <item class_id_reference="15" object_id="_15"> <id>23</id> <edge_type>1</edge_type> <source_obj>3</source_obj> <sink_obj>10</sink_obj> <is_back_edge>0</is_back_edge> </item> <item class_id_reference="15" object_id="_16"> <id>24</id> <edge_type>1</edge_type> <source_obj>8</source_obj> <sink_obj>10</sink_obj> <is_back_edge>0</is_back_edge> </item> <item class_id_reference="15" object_id="_17"> <id>26</id> <edge_type>1</edge_type> <source_obj>2</source_obj> <sink_obj>11</sink_obj> <is_back_edge>0</is_back_edge> </item> <item class_id_reference="15" object_id="_18"> <id>27</id> <edge_type>1</edge_type> <source_obj>11</source_obj> <sink_obj>12</sink_obj> <is_back_edge>0</is_back_edge> </item> <item class_id_reference="15" object_id="_19"> <id>29</id> <edge_type>1</edge_type> <source_obj>4</source_obj> <sink_obj>14</sink_obj> <is_back_edge>0</is_back_edge> </item> <item class_id_reference="15" object_id="_20"> <id>30</id> <edge_type>1</edge_type> <source_obj>12</source_obj> <sink_obj>14</sink_obj> <is_back_edge>0</is_back_edge> </item> </edges> </cdfg> <cdfg_regions class_id="16" tracking_level="0" version="0"> <count>1</count> <item_version>0</item_version> <item class_id="17" tracking_level="1" version="0" object_id="_21"> <mId>1</mId> <mTag>colorthresholding&lt;9, 0, 3, 2160, 3840, 1&gt;.entry12</mTag> <mNormTag>colorthresholding_9_0_3_2160_3840_1_entry12</mNormTag> <mType>0</mType> <sub_regions> <count>0</count> <item_version>0</item_version> </sub_regions> <basic_blocks> <count>1</count> <item_version>0</item_version> <item>16</item> </basic_blocks> <mII>-1</mII> <mDepth>-1</mDepth> <mMinTripCount>-1</mMinTripCount> <mMaxTripCount>-1</mMaxTripCount> <mMinLatency>0</mMinLatency> <mMaxLatency>0</mMaxLatency> <mIsDfPipe>0</mIsDfPipe> <mDfPipe class_id="-1"></mDfPipe> </item> </cdfg_regions> <fsm class_id="19" tracking_level="1" version="0" object_id="_22"> <states class_id="20" tracking_level="0" version="0"> <count>1</count> <item_version>0</item_version> <item class_id="21" tracking_level="1" version="0" object_id="_23"> <id>1</id> <operations class_id="22" tracking_level="0" version="0"> <count>11</count> <item_version>0</item_version> <item class_id="23" tracking_level="1" version="0" object_id="_24"> <id>5</id> <stage>1</stage> <latency>1</latency> </item> <item class_id_reference="23" object_id="_25"> <id>6</id> <stage>1</stage> <latency>1</latency> </item> <item class_id_reference="23" object_id="_26"> <id>7</id> <stage>1</stage> <latency>1</latency> </item> <item class_id_reference="23" object_id="_27"> <id>8</id> <stage>1</stage> <latency>1</latency> </item> <item class_id_reference="23" object_id="_28"> <id>9</id> <stage>1</stage> <latency>1</latency> </item> <item class_id_reference="23" object_id="_29"> <id>10</id> <stage>1</stage> <latency>1</latency> </item> <item class_id_reference="23" object_id="_30"> <id>11</id> <stage>1</stage> <latency>1</latency> </item> <item class_id_reference="23" object_id="_31"> <id>12</id> <stage>1</stage> <latency>1</latency> </item> <item class_id_reference="23" object_id="_32"> <id>13</id> <stage>1</stage> <latency>1</latency> </item> <item class_id_reference="23" object_id="_33"> <id>14</id> <stage>1</stage> <latency>1</latency> </item> <item class_id_reference="23" object_id="_34"> <id>15</id> <stage>1</stage> <latency>1</latency> </item> </operations> </item> </states> <transitions class_id="24" tracking_level="0" version="0"> <count>0</count> <item_version>0</item_version> </transitions> </fsm> <res class_id="-1"></res> <node_label_latency class_id="26" tracking_level="0" version="0"> <count>7</count> <item_version>0</item_version> <item class_id="27" tracking_level="0" version="0"> <first>7</first> <second class_id="28" tracking_level="0" version="0"> <first>0</first> <second>0</second> </second> </item> <item> <first>8</first> <second> <first>0</first> <second>0</second> </second> </item> <item> <first>10</first> <second> <first>0</first> <second>0</second> </second> </item> <item> <first>11</first> <second> <first>0</first> <second>0</second> </second> </item> <item> <first>12</first> <second> <first>0</first> <second>0</second> </second> </item> <item> <first>14</first> <second> <first>0</first> <second>0</second> </second> </item> <item> <first>15</first> <second> <first>0</first> <second>0</second> </second> </item> </node_label_latency> <bblk_ent_exit class_id="29" tracking_level="0" version="0"> <count>1</count> <item_version>0</item_version> <item class_id="30" tracking_level="0" version="0"> <first>16</first> <second class_id="31" tracking_level="0" version="0"> <first>0</first> <second>0</second> </second> </item> </bblk_ent_exit> <regions class_id="32" tracking_level="0" version="0"> <count>0</count> <item_version>0</item_version> </regions> <dp_fu_nodes class_id="33" tracking_level="0" version="0"> <count>6</count> <item_version>0</item_version> <item class_id="34" tracking_level="0" version="0"> <first>26</first> <second> <count>1</count> <item_version>0</item_version> <item>7</item> </second> </item> <item> <first>32</first> <second> <count>1</count> <item_version>0</item_version> <item>10</item> </second> </item> <item> <first>39</first> <second> <count>1</count> <item_version>0</item_version> <item>11</item> </second> </item> <item> <first>45</first> <second> <count>1</count> <item_version>0</item_version> <item>14</item> </second> </item> <item> <first>52</first> <second> <count>1</count> <item_version>0</item_version> <item>8</item> </second> </item> <item> <first>57</first> <second> <count>1</count> <item_version>0</item_version> <item>12</item> </second> </item> </dp_fu_nodes> <dp_fu_nodes_expression class_id="36" tracking_level="0" version="0"> <count>2</count> <item_version>0</item_version> <item class_id="37" tracking_level="0" version="0"> <first>empty_33_fu_57</first> <second> <count>1</count> <item_version>0</item_version> <item>12</item> </second> </item> <item> <first>empty_fu_52</first> <second> <count>1</count> <item_version>0</item_version> <item>8</item> </second> </item> </dp_fu_nodes_expression> <dp_fu_nodes_module> <count>0</count> <item_version>0</item_version> </dp_fu_nodes_module> <dp_fu_nodes_io> <count>4</count> <item_version>0</item_version> <item> <first>p_src_mat_cols_read_read_fu_39</first> <second> <count>1</count> <item_version>0</item_version> <item>11</item> </second> </item> <item> <first>p_src_mat_rows_read_read_fu_26</first> <second> <count>1</count> <item_version>0</item_version> <item>7</item> </second> </item> <item> <first>write_ln0_write_fu_32</first> <second> <count>1</count> <item_version>0</item_version> <item>10</item> </second> </item> <item> <first>write_ln0_write_fu_45</first> <second> <count>1</count> <item_version>0</item_version> <item>14</item> </second> </item> </dp_fu_nodes_io> <return_ports> <count>0</count> <item_version>0</item_version> </return_ports> <dp_mem_port_nodes class_id="38" tracking_level="0" version="0"> <count>0</count> <item_version>0</item_version> </dp_mem_port_nodes> <dp_reg_nodes> <count>0</count> <item_version>0</item_version> </dp_reg_nodes> <dp_regname_nodes> <count>0</count> <item_version>0</item_version> </dp_regname_nodes> <dp_reg_phi> <count>0</count> <item_version>0</item_version> </dp_reg_phi> <dp_regname_phi> <count>0</count> <item_version>0</item_version> </dp_regname_phi> <dp_port_io_nodes class_id="39" tracking_level="0" version="0"> <count>4</count> <item_version>0</item_version> <item class_id="40" tracking_level="0" version="0"> <first>p_src_mat_cols</first> <second> <count>1</count> <item_version>0</item_version> <item> <first>read</first> <second> <count>1</count> <item_version>0</item_version> <item>11</item> </second> </item> </second> </item> <item> <first>p_src_mat_cols_out</first> <second> <count>1</count> <item_version>0</item_version> <item> <first>write</first> <second> <count>1</count> <item_version>0</item_version> <item>14</item> </second> </item> </second> </item> <item> <first>p_src_mat_rows</first> <second> <count>1</count> <item_version>0</item_version> <item> <first>read</first> <second> <count>1</count> <item_version>0</item_version> <item>7</item> </second> </item> </second> </item> <item> <first>p_src_mat_rows_out</first> <second> <count>1</count> <item_version>0</item_version> <item> <first>write</first> <second> <count>1</count> <item_version>0</item_version> <item>10</item> </second> </item> </second> </item> </dp_port_io_nodes> <port2core> <count>4</count> <item_version>0</item_version> <item> <first>1</first> <second> <first>1150</first> <second>10</second> </second> </item> <item> <first>2</first> <second> <first>1150</first> <second>10</second> </second> </item> <item> <first>3</first> <second> <first>1151</first> <second>10</second> </second> </item> <item> <first>4</first> <second> <first>1151</first> <second>10</second> </second> </item> </port2core> <node2core> <count>4</count> <item_version>0</item_version> <item> <first>7</first> <second> <first>1150</first> <second>10</second> </second> </item> <item> <first>10</first> <second> <first>1151</first> <second>10</second> </second> </item> <item> <first>11</first> <second> <first>1150</first> <second>10</second> </second> </item> <item> <first>14</first> <second> <first>1151</first> <second>10</second> </second> </item> </node2core> </syndb> </boost_serialization>
------------------------------------------------------------------------------ -- Copyright (c) 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. -- ------------------------------------------------------------------------------ package body Natools.Time_Statistics is ---------------------- -- Public Interface -- ---------------------- overriding procedure Add (Self : in out Summary; Measure : in Duration) is begin Self.Data.Add (Measure); end Add; ------------------------------ -- Summary Protected Object -- ------------------------------ protected body Summary_Data is procedure Add (Measure : in Duration) is begin if Measure > Max then Max := Measure; end if; if Measure < Min then Min := Measure; end if; Count := Count + 1; Current_Mean := Current_Mean + (Measure - Current_Mean) / Duration (Count); end Add; function Minimum return Duration is begin return Min; end Minimum; function Maximum return Duration is begin return Max; end Maximum; function Mean return Duration is begin return Current_Mean; end Mean; function Sample_Count return Natural is begin return Count; end Sample_Count; end Summary_Data; end Natools.Time_Statistics;
-- Copyright 2019 Michael Casadevall <michael@casadevall.pro> -- -- Permission is hereby granted, free of charge, to any person obtaining a copy -- of this software and associated documentation files (the "Software"), to -- deal in the Software without restriction, including without limitation the -- rights to use, copy, modify, merge, publish, distribute, sublicense, and/or -- sell copies of the Software, and to permit persons to whom the Software is -- furnished to do so, subject to the following conditions: -- -- The above copyright notice and this permission notice shall be included in -- all copies or substantial portions of the Software. -- -- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL -- THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING -- FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER -- DEALINGS IN THE SOFTWARE. with Ada.Strings.Unbounded; use Ada.Strings.Unbounded; with GNAT.Sockets; use GNAT.Sockets; with DNSCatcher.Utils.Logger; use DNSCatcher.Utils.Logger; -- @summary -- Configuration information used by the DNSCatcher library -- -- @description -- The DNSCatcher library (and daemons) require configuration to know external -- resources such as validation resolvers, database storage information, and -- logger information. -- -- This information can be stored as a configuration file, loaded from the -- database (to be implemented), or programmatically stored. It is intended -- for configuration information to be dynamically updatable (either through -- runtime commands or sending SIGHUP to the Catcher daemon). As such -- configuration information will be migrated to being a protected object -- with standard setters and getters to prevent race conditions. -- package DNSCatcher.Config is -- Configuration record information -- -- @field Local_Listen_Port -- Port currently used to determine where DNS requests are listened for when -- accepting legacy DNS traffic. Defaults to 53. -- -- @field Upstream_DNS_Server -- Currently used to denote servers requests are forwarded to. At the moment -- only one server is supported at a time -- -- @field Upstream_DNS_Server_Port Port to communicate with the server with. -- Defaults to 53. -- -- @field Logger_Config -- Global configuration of the Logger object type Configuration is limited record Local_Listen_Port : Port_Type; Upstream_DNS_Server : Unbounded_String; Upstream_DNS_Server_Port : Port_Type; Logger_Config : Logger_Configuration; end record; --type Configuration_Ptr is access Configuration; -- Functions -- Initializes the Configuration parser by loading methods to handle data -- values and storage. Must be called before calling Parse_Config_File procedure Initialize_Config_Parse; -- Initializes a configuration object and returns it with default values set -- ready for further config procedure Initialize (Config : in out Configuration); -- Handles parsing the configuration file -- -- It is the caller's responsibility to deallocate the pointer after all -- DNSCatcher services have shutdown. -- -- @value Config -- Configuration object -- -- @value Config_File_Path -- Path to the configuration file -- -- @exception Malformed_Line -- Raised when a line is malformed and can't be properly parsed -- -- @exception Missing_Mandatory_Config_Option Raised when a mandatory option -- in the config file is not present -- procedure Read_Cfg_File (Config : in out Configuration; Config_File_Path : String); -- Defined Exceptions Malformed_Line : exception; Missing_Mandatory_Config_Option : exception; end DNSCatcher.Config;
----------------------------------------------------------------------- -- security-policies-urls -- URL security policy -- Copyright (C) 2010, 2011, 2012, 2017, 2018, 2019 Stephane Carrez -- Written by Stephane Carrez (Stephane.Carrez@gmail.com) -- -- Licensed under the Apache License, Version 2.0 (the "License"); -- you may not use this file except in compliance with the License. -- You may obtain a copy of the License at -- -- http://www.apache.org/licenses/LICENSE-2.0 -- -- Unless required by applicable law or agreed to in writing, software -- distributed under the License is distributed on an "AS IS" BASIS, -- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -- See the License for the specific language governing permissions and -- limitations under the License. ----------------------------------------------------------------------- with Ada.Containers.Hashed_Maps; with Ada.Containers.Vectors; with Util.Refs; with Util.Strings; with Util.Serialize.Mappers; with GNAT.Regexp; with Security.Contexts; -- == URL Security Policy == -- The `Security.Policies.Urls` implements a security policy intended to be used -- in web servers. It allows to protect an URL by defining permissions that must be granted -- for a user to get access to the URL. A typical example is a web server that has a set of -- administration pages, these pages should be accessed by users having some admin permission. -- -- === Policy creation === -- An instance of the `URL_Policy` must be created and registered in the policy manager. -- Get or declare the following variables: -- -- Manager : Security.Policies.Policy_Manager; -- Policy : Security.Policies.Urls.URL_Policy_Access; -- -- Create the URL policy and register it in the policy manager as follows: -- -- Policy := new URL_Policy; -- Manager.Add_Policy (Policy.all'Access); -- -- === Policy Configuration === -- Once the URL policy is registered, the policy manager can read and process the following -- XML configuration: -- -- <policy-rules> -- <url-policy id='1'> -- <permission>create-workspace</permission> -- <permission>admin</permission> -- <url-pattern>/workspace/create</url-pattern> -- <url-pattern>/workspace/setup/*</url-pattern> -- </url-policy> -- ... -- </policy-rules> -- -- This policy gives access to the URL that match one of the URL pattern if the -- security context has the permission `create-workspace` or `admin`. -- These two permissions are checked according to another security policy. -- The XML configuration can define several `url-policy`. They are checked in -- the order defined in the XML. In other words, the first `url-policy` that matches -- the URL is used to verify the permission. -- -- The `url-policy` definition can contain several `permission`. -- The first permission that is granted gives access to the URL. -- -- === Checking for permission === -- To check a URL permission, you must declare a `URL_Permission` object with the URL. -- -- URL : constant String := ...; -- Perm : constant Policies.URLs.URL_Permission (URL'Length) -- := URL_Permission '(Len => URI'Length, URL => URL); -- -- Then, we can check the permission: -- -- Result : Boolean := Security.Contexts.Has_Permission (Perm); -- package Security.Policies.URLs is NAME : constant String := "URL-Policy"; package P_URL is new Security.Permissions.Definition ("url"); -- ------------------------------ -- URL Permission -- ------------------------------ -- Represents a permission to access a given URL. type URL_Permission (Len : Natural) is new Permissions.Permission (P_URL.Permission) with record URL : String (1 .. Len); end record; -- ------------------------------ -- URL policy -- ------------------------------ type URL_Policy is new Policy with private; type URL_Policy_Access is access all URL_Policy'Class; Invalid_Name : exception; -- Get the policy name. overriding function Get_Name (From : in URL_Policy) return String; -- Returns True if the user has the permission to access the given URI permission. function Has_Permission (Manager : in URL_Policy; Context : in Contexts.Security_Context'Class; Permission : in URL_Permission'Class) return Boolean; -- Grant the permission to access to the given <b>URI</b> to users having the <b>To</b> -- permissions. procedure Grant_URI_Permission (Manager : in out URL_Policy; URI : in String; To : in String); -- Initialize the permission manager. overriding procedure Initialize (Manager : in out URL_Policy); -- Finalize the permission manager. overriding procedure Finalize (Manager : in out URL_Policy); -- Setup the XML parser to read the <b>policy</b> description. overriding procedure Prepare_Config (Policy : in out URL_Policy; Mapper : in out Util.Serialize.Mappers.Processing); -- Get the URL policy associated with the given policy manager. -- Returns the URL policy instance or null if it was not registered in the policy manager. function Get_URL_Policy (Manager : in Security.Policies.Policy_Manager'Class) return URL_Policy_Access; private use Util.Strings; -- The <b>Access_Rule</b> represents a list of permissions to verify to grant -- access to the resource. To make it simple, the user must have one of the -- permission from the list. Each permission will refer to a specific permission -- controller. type Access_Rule (Count : Natural) is new Util.Refs.Ref_Entity with record Permissions : Permission_Index_Array (1 .. Count); end record; type Access_Rule_Access is access all Access_Rule; package Access_Rule_Refs is new Util.Refs.Indefinite_References (Element_Type => Access_Rule, Element_Access => Access_Rule_Access); subtype Access_Rule_Ref is Access_Rule_Refs.Ref; -- Find the access rule of the policy that matches the given URI. -- Returns the No_Rule value (disable access) if no rule is found. function Find_Access_Rule (Manager : in URL_Policy; URI : in String) return Access_Rule_Ref; -- The <b>Policy</b> defines the access rules that are applied on a given -- URL, set of URLs or files. type Policy is record Id : Natural; Pattern : GNAT.Regexp.Regexp; Rule : Access_Rule_Ref; end record; -- The <b>Policy_Vector</b> represents the whole permission policy. The order of -- policy in the list is important as policies can override each other. package Policy_Vector is new Ada.Containers.Vectors (Index_Type => Positive, Element_Type => Policy); package Rules_Maps is new Ada.Containers.Hashed_Maps (Key_Type => String_Ref, Element_Type => Access_Rule_Ref, Hash => Hash, Equivalent_Keys => Equivalent_Keys, "=" => Access_Rule_Refs."="); type Rules is new Util.Refs.Ref_Entity with record Map : Rules_Maps.Map; end record; type Rules_Access is access all Rules; package Rules_Ref is new Util.Refs.References (Rules, Rules_Access); package Atomic_Rules_Ref is new Rules_Ref.IR.Atomic; type Rules_Ref_Access is access Atomic_Rules_Ref.Atomic_Ref; type Controller_Access_Array_Access is access all Controller_Access_Array; type URL_Policy is new Security.Policies.Policy with record Cache : Rules_Ref_Access; Policies : Policy_Vector.Vector; Id : Natural := 0; Permissions : Util.Beans.Objects.Vectors.Vector; Patterns : Util.Beans.Objects.Vectors.Vector; end record; end Security.Policies.URLs;
with ObjectPack, AbstractStrategyCombinatorPackage, IntrospectorPackage, StrategyPackage; use ObjectPack, AbstractStrategyCombinatorPackage, IntrospectorPackage, StrategyPackage; with Ada.Containers.Ordered_Sets; with Ada.Containers.Doubly_Linked_Lists; package MuStrategy is VAR : constant Integer := 0; V : constant Integer := 1; type Mu is new AbstractStrategyCombinator and Object with record expanded : Boolean := false; end record; type MuPtr is access all Mu; package StrategyStr_Sets is new Ada.Containers.Ordered_Sets(StrategyPtr, "<"); package StrategyStr_LL is new Ada.Containers.Doubly_Linked_Lists(MuPtr); ---------------------------------------------------------------------------- -- Object implementation ---------------------------------------------------------------------------- function toString(c: Mu) return String; ---------------------------------------------------------------------------- -- Strategy implementation ---------------------------------------------------------------------------- function visitLight(str:access Mu; any: ObjectPtr; i: access Introspector'Class) return ObjectPtr; function visit(str: access Mu; i: access Introspector'Class) return Integer; ---------------------------------------------------------------------------- function newMu(var, v: StrategyPtr) return StrategyPtr; procedure expand(s: StrategyPtr); end MuStrategy;
-- C52102B.ADA -- Grant of Unlimited Rights -- -- Under contracts F33600-87-D-0337, F33600-84-D-0280, MDA903-79-C-0687, -- F08630-91-C-0015, and DCA100-97-D-0025, the U.S. Government obtained -- unlimited rights in the software and documentation contained herein. -- Unlimited rights are defined in DFAR 252.227-7013(a)(19). By making -- this public release, the Government intends to confer upon all -- recipients unlimited rights equal to those held by the Government. -- These rights include rights to use, duplicate, release or disclose the -- released technical data and computer software in whole or in part, in -- any manner and for any purpose whatsoever, and to have or permit others -- to do so. -- -- DISCLAIMER -- -- ALL MATERIALS OR INFORMATION HEREIN RELEASED, MADE AVAILABLE OR -- DISCLOSED ARE AS IS. THE GOVERNMENT MAKES NO EXPRESS OR IMPLIED -- WARRANTY AS TO ANY MATTER WHATSOEVER, INCLUDING THE CONDITIONS OF THE -- SOFTWARE, DOCUMENTATION OR OTHER INFORMATION RELEASED, MADE AVAILABLE -- OR DISCLOSED, OR THE OWNERSHIP, MERCHANTABILITY, OR FITNESS FOR A -- PARTICULAR PURPOSE OF SAID MATERIAL. --* -- CHECK THAT THE ASSIGNMENT OF OVERLAPPING SOURCE AND TARGET VARIABLES -- (INCLUDING ARRAYS AND SLICES IN VARIOUS COMBINATIONS) SATISFIES -- THE SEMANTICS OF "COPY" ASSIGNMENT. (THIS TEST IS IN TWO PARTS, -- COVERING RESPECTIVELY STATIC AND DYNAMIC BOUNDS.) -- PART 2: DYNAMIC BOUNDS -- RM 02/27/80 -- SPS 2/18/83 -- JBG 3/15/84 -- JBG 6/9/84 WITH REPORT; PROCEDURE C52102B IS USE REPORT; IDENT_INT_0 : INTEGER := IDENT_INT(0); IDENT_INT_1 : INTEGER := IDENT_INT (1); IDENT_INT_2 : INTEGER := IDENT_INT (2); IDENT_INT_3 : INTEGER := IDENT_INT (3); IDENT_INT_4 : INTEGER := IDENT_INT (4); IDENT_INT_5 : INTEGER := IDENT_INT (5); IDENT_INT_6 : INTEGER := IDENT_INT (6); IDENT_INT_8 : INTEGER := IDENT_INT (8); IDENT_INT_9 : INTEGER := IDENT_INT (9); BEGIN TEST( "C52102B" , "CHECK THAT THE ASSIGNMENT OF OVERLAPPING " & "SOURCE AND TARGET VARIABLES (INCLUDING " & "ARRAYS AND SLICES IN VARIOUS COMBINATIONS) " & "SATISFIES THE SEMANTICS OF ""COPY"" " & "ASSIGNMENT (PART 2: DYNAMIC BOUNDS)" ); ------------------------------------------------------------------- -------------------- ARRAYS OF INTEGERS ------------------------- DECLARE A : ARRAY( 1..IDENT_INT_4 ) OF INTEGER; BEGIN A := ( 11 , 12 , 13 , 14 ); A := ( 1 , A(IDENT_INT_1) , A(IDENT_INT_2) , A(IDENT_INT_1) ); IF A /= ( 1 , 11 , 12 , 11 ) THEN FAILED( "WRONG VALUES - I1" ); END IF; A := ( 11 , 12 , 13 , 14 ); A := ( A(IDENT_INT_4) , A(IDENT_INT_3) , A(IDENT_INT_4) , 1 ); IF A /= ( 14 , 13 , 14 , 1 ) THEN FAILED( "WRONG VALUES - I2" ); END IF; END; DECLARE A : ARRAY( -4..IDENT_INT_4 ) OF INTEGER; BEGIN A := ( -4 , -3 , -2 , -1 , 100 , 1 , 2 , 3 , 4 ); A(-4..IDENT_INT_0) := A(IDENT_INT_0..4); IF A /= ( 100 , 1 , 2 , 3 , 4 , 1 , 2 , 3 , 4 ) THEN FAILED( "WRONG VALUES - I3" ); END IF; A := ( -4 , -3 , -2 , -1 , 100 , 1 , 2 , 3 , 4 ); A(IDENT_INT_0..4) := A(-4..IDENT_INT_0); IF A /= ( -4 , -3 , -2 , -1 , -4 , -3 , -2 , -1 , 100 ) THEN FAILED( "WRONG VALUES - I4" ); END IF; END; DECLARE TYPE ARR IS ARRAY (INTEGER RANGE <>) OF INTEGER; A : ARR (1..10); BEGIN A := ( 1 , 2 , 3 , 4 , 5 , 6 , 7 , 8 , 9 , 10 ); A := 0 & A(IDENT_INT_1..IDENT_INT_2) & A(IDENT_INT_1..IDENT_INT_2) & A(IDENT_INT_1..IDENT_INT_5); IF A /= ( 0 , 1 , 2 , 1 , 2 , 1 , 2 , 3 , 4 , 5 ) THEN FAILED( "WRONG VALUES - I5" ); END IF; A := ( 1 , 2 , 3 , 4 , 5 , 6 , 7 , 8 , 9 , 10 ); A := A(IDENT_INT_6..IDENT_INT_9) & A(IDENT_INT_8..IDENT_INT_9) & A(IDENT_INT_8..IDENT_INT_9) & 0 & 0; IF A /= ( 6 , 7 , 8 , 9 , 8 , 9 , 8 , 9 , 0 , 0 ) THEN FAILED( "WRONG VALUES - I6" ); END IF; END; ------------------------------------------------------------------- -------------------- ARRAYS OF BOOLEANS ------------------------- DECLARE A : ARRAY( 1..4 ) OF BOOLEAN; BEGIN A := ( FALSE , TRUE , TRUE , FALSE ); A := ( TRUE , A(IDENT_INT_1) , A(IDENT_INT_2) , A(IDENT_INT_1) ); IF A /= ( TRUE , FALSE , TRUE , FALSE ) THEN FAILED( "WRONG VALUES - B1" ); END IF; A := ( FALSE , TRUE , TRUE , FALSE ); A := ( A(IDENT_INT_4) , A(IDENT_INT_3) , A(IDENT_INT_4) , TRUE ); IF A /= ( FALSE , TRUE , FALSE, TRUE ) THEN FAILED( "WRONG VALUES - B2" ); END IF; END; DECLARE A : ARRAY( -IDENT_INT_4..4 ) OF BOOLEAN; BEGIN A := (FALSE,FALSE,FALSE,FALSE,FALSE,TRUE, TRUE, TRUE,TRUE); A(-IDENT_INT_4..IDENT_INT_0) := A(IDENT_INT_0..4); IF A /= (FALSE, TRUE, TRUE, TRUE, TRUE,TRUE, TRUE, TRUE,TRUE) THEN FAILED( "WRONG VALUES - B3" ); END IF; A := (FALSE,FALSE,FALSE,FALSE, TRUE,TRUE, TRUE, TRUE,TRUE); A(IDENT_INT_0..4) := A(-4..IDENT_INT_0); IF A /= (FALSE,FALSE,FALSE,FALSE,FALSE,FALSE,FALSE,FALSE,TRUE) THEN FAILED( "WRONG VALUES - B4" ); END IF; END; DECLARE TYPE B_ARR IS ARRAY (INTEGER RANGE <>) OF BOOLEAN; A : B_ARR (1..10); BEGIN A := (TRUE,FALSE,TRUE,FALSE,TRUE,FALSE,TRUE,FALSE,TRUE,FALSE); A := FALSE & A(IDENT_INT_1..IDENT_INT_2) & A(IDENT_INT_1..IDENT_INT_2) & A(IDENT_INT_1..IDENT_INT_5); IF A/=(FALSE,TRUE,FALSE,TRUE,FALSE,TRUE,FALSE,TRUE,FALSE,TRUE) THEN FAILED( "WRONG VALUES - B5" ); END IF; A := (TRUE,FALSE,TRUE,FALSE,TRUE,FALSE,TRUE,FALSE,TRUE,FALSE); A := A(IDENT_INT_6..IDENT_INT_9) & A(IDENT_INT_8..IDENT_INT_9) & A(IDENT_INT_8..IDENT_INT_9) & FALSE & TRUE; IF A/=(FALSE,TRUE,FALSE,TRUE,FALSE,TRUE,FALSE,TRUE,FALSE,TRUE) THEN FAILED( "WRONG VALUES - B6" ); END IF; END; ------------------------------------------------------------------- -------------------- CHARACTER STRINGS -------------------------- DECLARE A : STRING( 1..4 ); BEGIN A := "ARGH"; A := ( 'Q' , A(IDENT_INT_1) , A(IDENT_INT_2) , A(IDENT_INT_1) ); IF A /= "QARA" THEN FAILED( "WRONG VALUES - C1" ); END IF; A := "ARGH"; A := ( A(IDENT_INT_4) , A(IDENT_INT_3) , A(IDENT_INT_4) , 'X' ); IF A /= "HGHX" THEN FAILED( "WRONG VALUES - C2" ); END IF; END; DECLARE A : STRING( IDENT_INT(96)..104 ); BEGIN A := "APHRODITE"; A(IDENT_INT(96)..IDENT_INT(100)) := A(IDENT_INT(100).. IDENT_INT(104)); IF A /= "ODITEDITE" THEN FAILED( "WRONG VALUES - C3" ); END IF; A := "APHRODITE"; A(IDENT_INT(100)..IDENT_INT(104)) := A(IDENT_INT(96).. IDENT_INT(100)) ; IF A /= "APHRAPHRO" THEN FAILED( "WRONG VALUES - C4" ); END IF; END; DECLARE TYPE CH_ARR IS ARRAY (INTEGER RANGE <>) OF CHARACTER; A : CH_ARR (IDENT_INT_1..9); BEGIN A := "CAMBRIDGE"; A := 'S' & A(IDENT_INT_1..IDENT_INT_2) & A(IDENT_INT_1..IDENT_INT_2) & A(IDENT_INT_1..IDENT_INT_4); IF A /= "SCACACAMB" THEN FAILED( "WRONG VALUES - C5" ); END IF; A := "CAMBRIDGE"; A := A(IDENT_INT_8..IDENT_INT_8) & A(IDENT_INT_6..IDENT_INT_8) & A(IDENT_INT_6..IDENT_INT_8) & "EA"; IF A /= "GIDGIDGEA" THEN FAILED( "WRONG VALUES - C6" ); END IF; END; RESULT; END C52102B;
-------------------------------------------------------------------------------------------------------------------- -- 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.Error -- -- Error message handling. -------------------------------------------------------------------------------------------------------------------- package SDL.Error is procedure Clear with Import => True, Convention => C, External_Name => "SDL_ClearError"; procedure Set (S : in String); function Get return String; end SDL.Error;
----------------------------------------------------------------------- -- util-serialize-io-xml -- XML Serialization Driver -- Copyright (C) 2011, 2012, 2013, 2016, 2017, 2020, 2021 Stephane Carrez -- Written by Stephane Carrez (Stephane.Carrez@gmail.com) -- -- Licensed under the Apache License, Version 2.0 (the "License"); -- you may not use this file except in compliance with the License. -- You may obtain a copy of the License at -- -- http://www.apache.org/licenses/LICENSE-2.0 -- -- Unless required by applicable law or agreed to in writing, software -- distributed under the License is distributed on an "AS IS" BASIS, -- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -- See the License for the specific language governing permissions and -- limitations under the License. ----------------------------------------------------------------------- with Ada.Characters.Conversions; with Unicode; with Unicode.CES.Utf8; with Util.Log.Loggers; with Util.Strings; with Util.Dates.ISO8601; with Util.Streams.Texts.TR; with Util.Streams.Texts.WTR; with Util.Beans.Objects.Maps; package body Util.Serialize.IO.XML is use Sax.Readers; use Sax.Exceptions; use Sax.Locators; use Sax.Attributes; use Unicode; use Unicode.CES; use Ada.Strings.Unbounded; -- The logger Log : constant Util.Log.Loggers.Logger := Util.Log.Loggers.Create ("Util.Serialize.IO.XML"); -- Return the location where the exception was raised. function Get_Location (Except : Sax.Exceptions.Sax_Parse_Exception'Class) return String is separate; -- ------------------------------ -- Warning -- ------------------------------ overriding procedure Warning (Handler : in out Xhtml_Reader; Except : Sax.Exceptions.Sax_Parse_Exception'Class) is pragma Warnings (Off, Handler); begin Log.Warn ("{0}", Get_Message (Except)); end Warning; -- ------------------------------ -- Error -- ------------------------------ overriding procedure Error (Handler : in out Xhtml_Reader; Except : in Sax.Exceptions.Sax_Parse_Exception'Class) is Msg : constant String := Get_Message (Except); Pos : constant Natural := Util.Strings.Index (Msg, ' '); begin -- The SAX error message contains the line+file name. Remove it because this part -- will be added by the <b>Error</b> procedure. if Pos > Msg'First and then Msg (Pos - 1) = ':' then Handler.Handler.Error (Msg (Pos + 1 .. Msg'Last)); else Handler.Handler.Error (Msg); end if; end Error; -- ------------------------------ -- Fatal_Error -- ------------------------------ overriding procedure Fatal_Error (Handler : in out Xhtml_Reader; Except : in Sax.Exceptions.Sax_Parse_Exception'Class) is begin Handler.Error (Except); end Fatal_Error; -- ------------------------------ -- Set_Document_Locator -- ------------------------------ overriding procedure Set_Document_Locator (Handler : in out Xhtml_Reader; Loc : in out Sax.Locators.Locator) is begin Handler.Handler.Locator := Loc; end Set_Document_Locator; -- ------------------------------ -- Start_Document -- ------------------------------ overriding procedure Start_Document (Handler : in out Xhtml_Reader) is begin null; end Start_Document; -- ------------------------------ -- End_Document -- ------------------------------ overriding procedure End_Document (Handler : in out Xhtml_Reader) is begin null; end End_Document; -- ------------------------------ -- Start_Prefix_Mapping -- ------------------------------ overriding procedure Start_Prefix_Mapping (Handler : in out Xhtml_Reader; Prefix : in Unicode.CES.Byte_Sequence; URI : in Unicode.CES.Byte_Sequence) is begin null; end Start_Prefix_Mapping; -- ------------------------------ -- End_Prefix_Mapping -- ------------------------------ overriding procedure End_Prefix_Mapping (Handler : in out Xhtml_Reader; Prefix : in Unicode.CES.Byte_Sequence) is begin null; end End_Prefix_Mapping; -- ------------------------------ -- Start_Element -- ------------------------------ overriding procedure Start_Element (Handler : in out Xhtml_Reader; Namespace_URI : in Unicode.CES.Byte_Sequence := ""; Local_Name : in Unicode.CES.Byte_Sequence := ""; Qname : in Unicode.CES.Byte_Sequence := ""; Atts : in Sax.Attributes.Attributes'Class) is pragma Unreferenced (Namespace_URI, Qname); Attr_Count : Natural; begin Log.Debug ("Start object {0}", Local_Name); Handler.Sink.Start_Object (Local_Name, Handler.Handler.all); Attr_Count := Get_Length (Atts); for I in 0 .. Attr_Count - 1 loop declare Name : constant String := Get_Qname (Atts, I); Value : constant String := Get_Value (Atts, I); begin Handler.Sink.Set_Member (Name => Name, Value => Util.Beans.Objects.To_Object (Value), Logger => Handler.Handler.all, Attribute => True); end; end loop; end Start_Element; -- ------------------------------ -- End_Element -- ------------------------------ overriding procedure End_Element (Handler : in out Xhtml_Reader; Namespace_URI : in Unicode.CES.Byte_Sequence := ""; Local_Name : in Unicode.CES.Byte_Sequence := ""; Qname : in Unicode.CES.Byte_Sequence := "") is pragma Unreferenced (Namespace_URI, Qname); Len : constant Natural := Length (Handler.Text); begin Handler.Sink.Finish_Object (Local_Name, Handler.Handler.all); if Len > 0 then -- Add debug message only when it is active (saves the To_String conversion). if Log.Get_Level >= Util.Log.DEBUG_LEVEL then Log.Debug ("Close object {0} -> {1}", Local_Name, To_String (Handler.Text)); end if; Handler.Sink.Set_Member (Local_Name, Util.Beans.Objects.To_Object (Handler.Text), Handler.Handler.all); -- Clear the string using Delete so that the buffer is kept. Ada.Strings.Unbounded.Delete (Source => Handler.Text, From => 1, Through => Len); else Log.Debug ("Close object {0}", Local_Name); Handler.Sink.Set_Member (Local_Name, Util.Beans.Objects.To_Object (Handler.Text), Handler.Handler.all); end if; end End_Element; procedure Collect_Text (Handler : in out Xhtml_Reader; Content : Unicode.CES.Byte_Sequence) is begin Append (Handler.Text, Content); end Collect_Text; -- ------------------------------ -- Characters -- ------------------------------ overriding procedure Characters (Handler : in out Xhtml_Reader; Ch : in Unicode.CES.Byte_Sequence) is begin Collect_Text (Handler, Ch); end Characters; -- ------------------------------ -- Ignorable_Whitespace -- ------------------------------ overriding procedure Ignorable_Whitespace (Handler : in out Xhtml_Reader; Ch : in Unicode.CES.Byte_Sequence) is begin if not Handler.Ignore_White_Spaces then Collect_Text (Handler, Ch); end if; end Ignorable_Whitespace; -- ------------------------------ -- Processing_Instruction -- ------------------------------ overriding procedure Processing_Instruction (Handler : in out Xhtml_Reader; Target : in Unicode.CES.Byte_Sequence; Data : in Unicode.CES.Byte_Sequence) is pragma Unreferenced (Handler); begin Log.Error ("Processing instruction: {0}: {1}", Target, Data); end Processing_Instruction; -- ------------------------------ -- Skipped_Entity -- ------------------------------ overriding procedure Skipped_Entity (Handler : in out Xhtml_Reader; Name : in Unicode.CES.Byte_Sequence) is pragma Unmodified (Handler); begin null; end Skipped_Entity; -- ------------------------------ -- Start_Cdata -- ------------------------------ overriding procedure Start_Cdata (Handler : in out Xhtml_Reader) is pragma Unmodified (Handler); pragma Unreferenced (Handler); begin Log.Info ("Start CDATA"); end Start_Cdata; -- ------------------------------ -- End_Cdata -- ------------------------------ overriding procedure End_Cdata (Handler : in out Xhtml_Reader) is pragma Unmodified (Handler); pragma Unreferenced (Handler); begin Log.Info ("End CDATA"); end End_Cdata; -- ------------------------------ -- Resolve_Entity -- ------------------------------ overriding function Resolve_Entity (Handler : Xhtml_Reader; Public_Id : Unicode.CES.Byte_Sequence; System_Id : Unicode.CES.Byte_Sequence) return Input_Sources.Input_Source_Access is pragma Unreferenced (Handler); begin Log.Error ("Cannot resolve entity {0} - {1}", Public_Id, System_Id); return null; end Resolve_Entity; overriding procedure Start_DTD (Handler : in out Xhtml_Reader; Name : Unicode.CES.Byte_Sequence; Public_Id : Unicode.CES.Byte_Sequence := ""; System_Id : Unicode.CES.Byte_Sequence := "") is begin null; end Start_DTD; -- ------------------------------ -- Set the XHTML reader to ignore or not the white spaces. -- When set to True, the ignorable white spaces will not be kept. -- ------------------------------ procedure Set_Ignore_White_Spaces (Reader : in out Parser; Value : in Boolean) is begin Reader.Ignore_White_Spaces := Value; end Set_Ignore_White_Spaces; -- ------------------------------ -- Set the XHTML reader to ignore empty lines. -- ------------------------------ procedure Set_Ignore_Empty_Lines (Reader : in out Parser; Value : in Boolean) is begin Reader.Ignore_Empty_Lines := Value; end Set_Ignore_Empty_Lines; -- ------------------------------ -- Get the current location (file and line) to report an error message. -- ------------------------------ function Get_Location (Handler : in Parser) return String is File : constant String := Util.Serialize.IO.Parser (Handler).Get_Location; begin if Handler.Locator = Sax.Locators.No_Locator then return File; else return File & Sax.Locators.To_String (Handler.Locator); end if; end Get_Location; -- ------------------------------ -- Parse an XML stream, and calls the appropriate SAX callbacks for each -- event. -- This is not re-entrant: you can not call Parse with the same Parser -- argument in one of the SAX callbacks. This has undefined behavior. -- ------------------------------ -- Parse the stream using the JSON parser. procedure Parse (Handler : in out Parser; Stream : in out Util.Streams.Buffered.Input_Buffer_Stream'Class; Sink : in out Reader'Class) is Buffer_Size : constant Positive := 256; type String_Access is access all String (1 .. Buffer_Size); type Stream_Input is new Input_Sources.Input_Source with record Index : Natural; Last : Natural; Encoding : Unicode.CES.Encoding_Scheme; Buffer : String_Access; end record; -- Return the next character in the string. procedure Next_Char (From : in out Stream_Input; C : out Unicode.Unicode_Char); -- True if From is past the last character in the string. function Eof (From : in Stream_Input) return Boolean; procedure Fill (From : in out Stream_Input'Class); procedure Fill (From : in out Stream_Input'Class) is Last : Natural := From.Last; begin -- Move to the buffer start if Last > From.Index and From.Index > From.Buffer'First then From.Buffer (From.Buffer'First .. Last - 1 - From.Index + From.Buffer'First) := From.Buffer (From.Index .. Last - 1); Last := Last - From.Index + From.Buffer'First; From.Index := From.Buffer'First; end if; if From.Index > From.Last then From.Index := From.Buffer'First; end if; begin while not Stream.Is_Eof loop Stream.Read (From.Buffer (Last)); Last := Last + 1; exit when Last > From.Buffer'Last; end loop; exception when others => null; end; From.Last := Last; end Fill; -- Return the next character in the string. procedure Next_Char (From : in out Stream_Input; C : out Unicode.Unicode_Char) is begin if From.Index + 6 >= From.Last then Fill (From); end if; From.Encoding.Read (From.Buffer.all, From.Index, C); end Next_Char; -- True if From is past the last character in the string. function Eof (From : in Stream_Input) return Boolean is begin if From.Index < From.Last then return False; end if; return Stream.Is_Eof; end Eof; Input : Stream_Input; Xml_Parser : Xhtml_Reader; Buf : aliased String (1 .. Buffer_Size); begin Input.Buffer := Buf'Access; Input.Index := Buf'First + 1; Input.Last := Buf'First; Input.Set_Encoding (Unicode.CES.Utf8.Utf8_Encoding); Input.Encoding := Unicode.CES.Utf8.Utf8_Encoding; Xml_Parser.Handler := Handler'Unchecked_Access; Xml_Parser.Ignore_White_Spaces := Handler.Ignore_White_Spaces; Xml_Parser.Ignore_Empty_Lines := Handler.Ignore_Empty_Lines; Xml_Parser.Sink := Sink'Unchecked_Access; Sax.Readers.Reader (Xml_Parser).Parse (Input); Handler.Locator := Sax.Locators.No_Locator; -- Ignore the Program_Error exception that SAX could raise if we know that the -- error was reported. exception when Program_Error => Handler.Locator := Sax.Locators.No_Locator; if not Handler.Has_Error then raise; end if; when others => Handler.Locator := Sax.Locators.No_Locator; raise; end Parse; -- Close the current XML entity if an entity was started procedure Close_Current (Stream : in out Output_Stream'Class; Indent : in Boolean); -- ------------------------------ -- Close the current XML entity if an entity was started -- ------------------------------ procedure Close_Current (Stream : in out Output_Stream'Class; Indent : in Boolean) is begin if Stream.Close_Start then Stream.Write ('>'); Stream.Close_Start := False; end if; if Indent then if Stream.Indent /= 0 then Stream.Write (ASCII.LF); end if; for I in 1 .. Stream.Level loop Stream.Write (' '); end loop; end if; end Close_Current; -- ----------------------- -- Set the target output stream. -- ----------------------- procedure Initialize (Stream : in out Output_Stream; Output : in Util.Streams.Texts.Print_Stream_Access) is begin Stream.Stream := Output; end Initialize; -- ----------------------- -- Flush the buffer (if any) to the sink. -- ----------------------- overriding procedure Flush (Stream : in out Output_Stream) is begin Stream.Stream.Flush; end Flush; -- ----------------------- -- Close the sink. -- ----------------------- overriding procedure Close (Stream : in out Output_Stream) is begin Stream.Stream.Close; end Close; -- ----------------------- -- Write the buffer array to the output stream. -- ----------------------- overriding procedure Write (Stream : in out Output_Stream; Buffer : in Ada.Streams.Stream_Element_Array) is begin Stream.Stream.Write (Buffer); end Write; -- ------------------------------ -- Write a character on the response stream and escape that character as necessary. -- ------------------------------ procedure Write_Escape (Stream : in out Output_Stream'Class; Char : in Wide_Wide_Character) is type Unicode_Char is mod 2**32; Code : constant Unicode_Char := Wide_Wide_Character'Pos (Char); begin -- If "?" or over, no escaping is needed (this covers -- most of the Latin alphabet) if Code >= 16#80# then Stream.Write_Wide (Char); elsif Code > 16#3F# or Code <= 16#20# then Stream.Write (Character'Val (Code)); elsif Char = '<' then Stream.Write ("&lt;"); elsif Char = '>' then Stream.Write ("&gt;"); elsif Char = '&' then Stream.Write ("&amp;"); else Stream.Write (Character'Val (Code)); end if; end Write_Escape; -- ------------------------------ -- Write the value as a XML string. Special characters are escaped using the XML -- escape rules. -- ------------------------------ procedure Write_String (Stream : in out Output_Stream; Value : in String) is begin Close_Current (Stream, False); for I in Value'Range loop Stream.Write_Escape (Ada.Characters.Conversions.To_Wide_Wide_Character (Value (I))); end loop; end Write_String; -- ------------------------------ -- Write the value as a XML string. Special characters are escaped using the XML -- escape rules. -- ------------------------------ procedure Write_Wide_String (Stream : in out Output_Stream; Value : in Wide_Wide_String) is begin Close_Current (Stream, False); for I in Value'Range loop Stream.Write_Escape (Value (I)); end loop; end Write_Wide_String; -- ------------------------------ -- Write the value as a XML string. Special characters are escaped using the XML -- escape rules. -- ------------------------------ procedure Write_String (Stream : in out Output_Stream; Value : in Util.Beans.Objects.Object) is use Util.Beans.Objects; begin Close_Current (Stream, False); case Util.Beans.Objects.Get_Type (Value) is when TYPE_NULL => null; when TYPE_BOOLEAN => if Util.Beans.Objects.To_Boolean (Value) then Stream.Write ("true"); else Stream.Write ("false"); end if; when TYPE_INTEGER => Stream.Stream.Write (Util.Beans.Objects.To_Long_Long_Integer (Value)); when others => Stream.Write_String (Util.Beans.Objects.To_String (Value)); end case; end Write_String; -- ------------------------------ -- Start a new XML object. -- ------------------------------ procedure Start_Entity (Stream : in out Output_Stream; Name : in String) is begin Close_Current (Stream, True); Stream.Close_Start := True; Stream.Is_Closed := False; Stream.Write ('<'); Stream.Write (Name); Stream.Level := Stream.Level + 1; end Start_Entity; -- ------------------------------ -- Terminates the current XML object. -- ------------------------------ procedure End_Entity (Stream : in out Output_Stream; Name : in String) is begin Stream.Level := Stream.Level - 1; Close_Current (Stream, Stream.Is_Closed); Stream.Write ("</"); Stream.Write (Name); Stream.Write ('>'); Stream.Is_Closed := True; end End_Entity; -- ------------------------------ -- Write the attribute name/value pair. -- ------------------------------ overriding procedure Write_Attribute (Stream : in out Output_Stream; Name : in String; Value : in String) is begin Stream.Write (' '); Stream.Write (Name); Stream.Write ("="""); Util.Streams.Texts.TR.Escape_Xml (Content => Value, Into => Stream.Stream.all); Stream.Write ('"'); end Write_Attribute; overriding procedure Write_Wide_Attribute (Stream : in out Output_Stream; Name : in String; Value : in Wide_Wide_String) is begin Stream.Write (' '); Stream.Write (Name); Stream.Write ("="""); Util.Streams.Texts.WTR.Escape_Xml (Content => Value, Into => Stream.Stream.all); Stream.Write ('"'); end Write_Wide_Attribute; overriding procedure Write_Attribute (Stream : in out Output_Stream; Name : in String; Value : in Integer) is begin Stream.Write (' '); Stream.Write (Name); Stream.Write ("="""); Stream.Stream.Write (Value); Stream.Write ('"'); end Write_Attribute; overriding procedure Write_Attribute (Stream : in out Output_Stream; Name : in String; Value : in Boolean) is begin Stream.Write (' '); Stream.Write (Name); if Value then Stream.Write ("=""true"""); else Stream.Write ("=""false"""); end if; end Write_Attribute; -- ------------------------------ -- Write a XML name/value attribute. -- ------------------------------ procedure Write_Attribute (Stream : in out Output_Stream; Name : in String; Value : in Util.Beans.Objects.Object) is use Util.Beans.Objects; begin Stream.Write (' '); Stream.Write (Name); Stream.Write ("="""); case Util.Beans.Objects.Get_Type (Value) is when TYPE_NULL => null; when TYPE_BOOLEAN => if Util.Beans.Objects.To_Boolean (Value) then Stream.Write ("true"); else Stream.Write ("false"); end if; when TYPE_INTEGER => Stream.Stream.Write (Util.Beans.Objects.To_Long_Long_Integer (Value)); when others => Stream.Write (Util.Beans.Objects.To_String (Value)); end case; Stream.Write ('"'); end Write_Attribute; -- ------------------------------ -- Write the attribute with a null value. -- ------------------------------ overriding procedure Write_Null_Attribute (Stream : in out Output_Stream; Name : in String) is begin null; end Write_Null_Attribute; -- ------------------------------ -- Write the entity value. -- ------------------------------ overriding procedure Write_Entity (Stream : in out Output_Stream; Name : in String; Value : in String) is begin Close_Current (Stream, True); Stream.Write ('<'); Stream.Write (Name); Stream.Close_Start := True; Stream.Write_String (Value); Stream.Write ("</"); Stream.Write (Name); Stream.Write ('>'); Stream.Is_Closed := True; end Write_Entity; overriding procedure Write_Wide_Entity (Stream : in out Output_Stream; Name : in String; Value : in Wide_Wide_String) is begin Close_Current (Stream, True); Stream.Write ('<'); Stream.Write (Name); Stream.Close_Start := True; Stream.Write_Wide_String (Value); Stream.Write ("</"); Stream.Write (Name); Stream.Write ('>'); Stream.Is_Closed := True; end Write_Wide_Entity; overriding procedure Write_Entity (Stream : in out Output_Stream; Name : in String; Value : in Boolean) is begin Close_Current (Stream, True); Stream.Write ('<'); Stream.Write (Name); if Value then Stream.Write (">true</"); else Stream.Write (">false</"); end if; Stream.Write (Name); Stream.Write ('>'); Stream.Is_Closed := True; end Write_Entity; overriding procedure Write_Entity (Stream : in out Output_Stream; Name : in String; Value : in Integer) is begin Close_Current (Stream, True); Stream.Write ('<'); Stream.Write (Name); Stream.Write ('>'); Stream.Stream.Write (Value); Stream.Write ("</"); Stream.Write (Name); Stream.Write ('>'); Stream.Is_Closed := True; end Write_Entity; overriding procedure Write_Entity (Stream : in out Output_Stream; Name : in String; Value : in Ada.Calendar.Time) is begin Stream.Write_Entity (Name, Util.Dates.ISO8601.Image (Value, Util.Dates.ISO8601.SUBSECOND)); end Write_Entity; overriding procedure Write_Long_Entity (Stream : in out Output_Stream; Name : in String; Value : in Long_Long_Integer) is begin Close_Current (Stream, True); Stream.Write ('<'); Stream.Write (Name); Stream.Write ('>'); Stream.Stream.Write (Value); Stream.Write ("</"); Stream.Write (Name); Stream.Write ('>'); Stream.Is_Closed := True; end Write_Long_Entity; overriding procedure Write_Enum_Entity (Stream : in out Output_Stream; Name : in String; Value : in String) is begin Stream.Write_Entity (Name, Value); end Write_Enum_Entity; -- ------------------------------ -- Write a XML name/value entity (see Write_Attribute). -- ------------------------------ procedure Write_Entity (Stream : in out Output_Stream; Name : in String; Value : in Util.Beans.Objects.Object) is use Util.Beans.Objects; begin case Util.Beans.Objects.Get_Type (Value) is when TYPE_NULL => Close_Current (Stream, True); Stream.Write ('<'); Stream.Write (Name); Stream.Close_Start := True; Stream.Write ("null"); Stream.Write ("</"); Stream.Write (Name); Stream.Write ('>'); Stream.Is_Closed := True; when TYPE_BOOLEAN => Close_Current (Stream, True); Stream.Write ('<'); Stream.Write (Name); Stream.Close_Start := True; if Util.Beans.Objects.To_Boolean (Value) then Stream.Write ("true"); else Stream.Write ("false"); end if; Stream.Write ("</"); Stream.Write (Name); Stream.Write ('>'); Stream.Is_Closed := True; when TYPE_INTEGER => Close_Current (Stream, True); Stream.Write ('<'); Stream.Write (Name); Stream.Close_Start := True; Stream.Stream.Write (Util.Beans.Objects.To_Long_Long_Integer (Value)); Stream.Write ("</"); Stream.Write (Name); Stream.Write ('>'); Stream.Is_Closed := True; when TYPE_BEAN | TYPE_ARRAY => if Is_Array (Value) then declare Count : constant Natural := Util.Beans.Objects.Get_Count (Value); begin Close_Current (Stream, False); for I in 1 .. Count loop Stream.Write_Entity (Name, Util.Beans.Objects.Get_Value (Value, I)); end loop; end; else declare procedure Process (Name : in String; Item : in Object); procedure Process (Name : in String; Item : in Object) is begin Stream.Write_Entity (Name, Item); end Process; begin Close_Current (Stream, True); Stream.Write ('<'); Stream.Write (Name); Stream.Close_Start := True; Util.Beans.Objects.Maps.Iterate (Value, Process'Access); Stream.Write ("</"); Stream.Write (Name); Stream.Write ('>'); Stream.Is_Closed := True; end; end if; when others => Close_Current (Stream, True); Stream.Write ('<'); Stream.Write (Name); Stream.Close_Start := True; Stream.Write_String (Util.Beans.Objects.To_String (Value)); Stream.Write ("</"); Stream.Write (Name); Stream.Write ('>'); Stream.Is_Closed := True; end case; end Write_Entity; -- ------------------------------ -- Write an entity with a null value. -- ------------------------------ overriding procedure Write_Null_Entity (Stream : in out Output_Stream; Name : in String) is begin null; end Write_Null_Entity; -- ------------------------------ -- Starts a XML array. -- ------------------------------ overriding procedure Start_Array (Stream : in out Output_Stream; Name : in String) is pragma Unreferenced (Stream, Name); begin null; end Start_Array; -- ------------------------------ -- Terminates a XML array. -- ------------------------------ overriding procedure End_Array (Stream : in out Output_Stream; Name : in String) is begin null; end End_Array; -- ------------------------------ -- Set the indentation level when writing XML entities. -- ------------------------------ procedure Set_Indentation (Stream : in out Output_Stream; Count : in Natural) is begin Stream.Indent := Count; end Set_Indentation; end Util.Serialize.IO.XML;
------------------------------------------------------------------------------- -- LSE -- L-System Editor -- Author: Heziode -- -- License: -- MIT License -- -- Copyright (c) 2018 Quentin Dauprat (Heziode) <Heziode@protonmail.com> -- -- 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 LSE.Model.IO.Turtle_Utils; use LSE.Model.IO.Turtle_Utils; -- @description -- This package provides position saving LOGO Turtle Symbol. -- package LSE.Model.Grammar.Symbol.LogoPositionSave is type Instance is new LSE.Model.Grammar.Symbol.Instance with null record; overriding procedure Initialize (This : out Instance); overriding procedure Interpret (This : in out Instance; T : in out Holder); end LSE.Model.Grammar.Symbol.LogoPositionSave;
------------------------------------------------------------------------------ -- -- -- GNAT RUN-TIME COMPONENTS -- -- -- -- S Y S T E M . P A C K _ 2 2 -- -- -- -- S p e c -- -- -- -- Copyright (C) 1992-2020, Free Software Foundation, Inc. -- -- -- -- GNAT is free software; you can redistribute it and/or modify it under -- -- terms of the GNU General Public License as published by the Free Soft- -- -- ware Foundation; either version 3, or (at your option) any later ver- -- -- sion. GNAT is distributed in the hope that it will be useful, but WITH- -- -- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY -- -- or FITNESS FOR A PARTICULAR PURPOSE. -- -- -- -- As a special exception under Section 7 of GPL version 3, you are granted -- -- additional permissions described in the GCC Runtime Library Exception, -- -- version 3.1, as published by the Free Software Foundation. -- -- -- -- You should have received a copy of the GNU General Public License and -- -- a copy of the GCC Runtime Library Exception along with this program; -- -- see the files COPYING3 and COPYING.RUNTIME respectively. If not, see -- -- <http://www.gnu.org/licenses/>. -- -- -- -- GNAT was originally developed by the GNAT team at New York University. -- -- Extensive contributions were provided by Ada Core Technologies Inc. -- -- -- ------------------------------------------------------------------------------ -- Handling of packed arrays with Component_Size = 22 package System.Pack_22 is pragma Preelaborate; Bits : constant := 22; type Bits_22 is mod 2 ** Bits; for Bits_22'Size use Bits; -- In all subprograms below, Rev_SSO is set True if the array has the -- non-default scalar storage order. function Get_22 (Arr : System.Address; N : Natural; Rev_SSO : Boolean) return Bits_22 with Inline; -- Arr is the address of the packed array, N is the zero-based -- subscript. This element is extracted and returned. procedure Set_22 (Arr : System.Address; N : Natural; E : Bits_22; Rev_SSO : Boolean) with Inline; -- Arr is the address of the packed array, N is the zero-based -- subscript. This element is set to the given value. function GetU_22 (Arr : System.Address; N : Natural; Rev_SSO : Boolean) return Bits_22 with Inline; -- Arr is the address of the packed array, N is the zero-based -- subscript. This element is extracted and returned. This version -- is used when Arr may represent an unaligned address. procedure SetU_22 (Arr : System.Address; N : Natural; E : Bits_22; Rev_SSO : Boolean) with Inline; -- Arr is the address of the packed array, N is the zero-based -- subscript. This element is set to the given value. This version -- is used when Arr may represent an unaligned address end System.Pack_22;
-- { dg-do compile } with Text_IO; use Text_IO; procedure Deferred_Const1 is I : Integer := 16#20_3A_2D_28#; S : constant string(1..4); for S'address use I'address; -- { dg-warning "constant overlays a variable" } pragma Import (Ada, S); begin Put_Line (S); end;
-- Copyright (c) 2019 Maxim Reznik <reznikmm@gmail.com> -- -- SPDX-License-Identifier: MIT -- License-Filename: LICENSE ------------------------------------------------------------- with Program.Lexical_Elements; with Program.Contexts; package Program.Compilations is pragma Pure; -- A specific Compilation value is valid (usable) for as long as the -- Context variable, used to create it, remains open. Once an Context is -- closed, all associated Compilation values become invalid. It is -- erroneous to use an invalid Compilation value. type Compilation is limited interface; -- The Ada Compilation abstraction: -- -- The text of a program is submitted to the compiler in one or more -- compilations. Each compilation is a succession of compilation units. type Compilation_Access is access all Compilation'Class with Storage_Size => 0; function Is_Assigned (Self : access Compilation'Class) return Boolean is (Self /= null); not overriding function Context (Self : Compilation) return not null Program.Contexts.Context_Access is abstract; -- Return corresponding context not overriding function Text_Name (Self : Compilation) return Text is abstract; -- Returns the name of the text, or other structure, that was the source of -- the compilation that resulted in this Compilation. Returns a null string -- if the text name is not available for any reason. not overriding function Object_Name (Self : Compilation) return Text is abstract; -- Returns the name of the object, or other structure, that contains the -- binary result of the compilation for this Compilation. Returns a null -- string if the object name is not available for any reason. not overriding function Line_Count (Self : Compilation) return Natural is abstract; not overriding function Line (Self : Compilation; Index : Positive) return Text is abstract; not overriding function Lexical_Element_Count (Self : Compilation) return Natural is abstract; not overriding function Lexical_Element (Self : Compilation; Index : Positive) return Program.Lexical_Elements.Lexical_Element_Access is abstract; -- TODO: Compilation_Pragmas? end Program.Compilations;
-- Abstract : -- -- see spec. -- -- Copyright (C) 2018 - 2019 Free Software Foundation, Inc. -- -- 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. pragma License (Modified_GPL); with Ada.Containers; with Ada.Exceptions; with Ada_Process_Actions; with System.Assertions; package body WisiToken.Parse.LR.McKenzie_Recover.Ada is use all type Ada_Process_Actions.Token_Enum_ID; -- token names use all type Semantic_Checks.Check_Status_Label; Descriptor : WisiToken.Descriptor renames Ada_Process_Actions.Descriptor; subtype Grammar_Token_ID_Set is WisiToken.Token_ID_Set (Descriptor.First_Terminal .. Descriptor.Last_Nonterminal); subtype Terminal_Token_ID_Set is WisiToken.Token_ID_Set (Descriptor.First_Terminal .. Descriptor.Last_Terminal); -- From ada.wy, all nonterms with a Match_Names check: -- -- nonterm <begin_name_token> <end_name_token> -- |-----------------------------|-------------------------|------------- -- accept_statement IDENTIFIER identifier_opt -- block_statement block_label_opt identifier_opt -- entry_body IDENTIFIER identifier_opt -- loop_statement block_label_opt identifier_opt -- package_body name name_opt -- package_specification name name_opt -- protected_body IDENTIFIER identifier_opt -- protected_type_declaration IDENTIFIER protected_definition -- single_protected_declaration IDENTIFIER protected_definition -- single_task_declaration IDENTIFIER identifier_opt -- subprogram_body subprogram_specification name_opt -- task_body IDENTIFIER identifier_opt -- task_type_declaration IDENTIFIER identifier_opt No_Statements_Nonterm_IDs : constant Grammar_Token_ID_Set := To_Token_ID_Set -- Nonterms that cannot contain a handled_sequence_of_statements -- (transitive). (Descriptor.First_Terminal, Descriptor.Last_Nonterminal, +package_specification_ID & (+protected_type_declaration_ID) & (+single_protected_declaration_ID) & (+single_task_declaration_ID) & (+task_type_declaration_ID)); End_Keyword_IDs : constant Terminal_Token_ID_Set := To_Token_ID_Set (Descriptor.First_Terminal, Descriptor.Last_Terminal, +CASE_ID & (+IF_ID) & (+LOOP_ID) & (+RECORD_ID) & (+RETURN_ID) & (+SELECT_ID)); procedure Handle_Check_Fail (Trace : in out WisiToken.Trace'Class; Lexer : access constant WisiToken.Lexer.Instance'Class; Parser_Label : in Natural; Parse_Table : in WisiToken.Parse.LR.Parse_Table; Terminals : in Base_Token_Arrays.Vector; Tree : in Syntax_Trees.Tree; Local_Config_Heap : in out Config_Heaps.Heap_Type; Config : in Configuration) with Pre => Config.Check_Status.Label /= Ok is procedure Put (Message : in String; Config : in Configuration) is begin Put (Message, Trace, Parser_Label, Terminals, Config); end Put; End_Name_Token : Recover_Token renames Config.Check_Status.End_Name; begin -- There is a top level exception handler in McKenzie_Recover; the -- user has no way to work around an exception. If we are trying to -- fix a particular use case, the trace messages will be enough. case Config.Check_Status.Label is when Ok => raise SAL.Programmer_Error; when Match_Names_Error => -- There are several cases: -- -- 0. User name error. The input looks like: -- -- "<begin_name_token> ... <end_name_token> ;" -- -- where the names do not match, because the user is changing them. -- -- The fix is to ignore the error. See -- test/ada_mode-recover_change_name.adb. -- -- 1. The mismatch indicates one or more missing 'end's. The input -- looks like: -- -- "<correct_begin_name_token> ... <bad_begin_name_token> ... <end_name_token> ;" -- -- where <correct_begin_name_token> matches <end_name_token>, but -- <bad_begin_name_token> does not, and the erroneous reduce has -- matched <bad_begin_name_token> with <end_name_token>. -- -- The fix is to insert one or more 'end ;' before <end_name_token>. -- See test_mckenzie_recover.adb Block_Match_Names_1, Extra_Name_2. -- -- 2. The mismatch indicates a missing block start. The input looks like: -- -- "<bad_begin_name_token> ... begin ... end <end_name_token> ;" -- -- where the matching begin name token has been deleted. -- -- The fix is to insert a matching block start before the 'begin'. -- See test/ada_mode-recover_deleted_procedure_1.adb -- -- -- It is not possible for the mismatch to indicate an extra 'end'; -- that would generate either a Missing_Name_Error, or a syntax -- error. -- -- To distinguish between case 0 and 1, we search the stack for -- <correct_begin_name_token>. If found, it's case 1, otherwise case -- 0 or 2. We cannot distinguish between 0 and 2 (without parsing -- ahead). -- -- If there is more than one missing 'end', a later recover operation -- will fix the others. For example, in test_mckenzie_recover -- Extra_Name_2, we get here on a second semantic check error. -- This case doesn't use Tree, and it can handle some virtual tokens. declare End_Name : constant String := Lexer.Buffer_Text (End_Name_Token.Name); Matching_Name_Index : SAL.Peek_Type := 3; -- start search before <end_name_token> begin Find_Matching_Name (Config, Lexer, End_Name, Matching_Name_Index, Case_Insensitive => True); if Matching_Name_Index = Config.Stack.Depth then -- case 0 or 2. if Ada_Process_Actions.Token_Enum_ID'(-Config.Error_Token.ID) in protected_body_ID | protected_type_declaration_ID | single_protected_declaration_ID | single_task_declaration_ID then -- Not case 2 return; end if; declare New_Config : Configuration := Config; begin -- These solutions must compete with 'ignore check fail', so give them the same cost. New_Config.Cost := New_Config.Cost + Parse_Table.McKenzie_Param.Ignore_Check_Fail; New_Config.Strategy_Counts (Language_Fix) := New_Config.Strategy_Counts (Language_Fix) + 1; New_Config.Error_Token.ID := Invalid_Token_ID; New_Config.Check_Status := (Label => Ok); case Ada_Process_Actions.Token_Enum_ID'(-Config.Error_Token.ID) is when block_statement_ID => Push_Back_Check (New_Config, (+SEMICOLON_ID, +identifier_opt_ID, +END_ID)); Insert (New_Config, +BEGIN_ID); when entry_body_ID => Push_Back_Check (New_Config, (+SEMICOLON_ID, +name_opt_ID, +END_ID, +handled_sequence_of_statements_ID)); Insert (New_Config, +BEGIN_ID); when loop_statement_ID => Push_Back_Check (New_Config, (+SEMICOLON_ID, +identifier_opt_ID, +LOOP_ID, +END_ID)); Insert (New_Config, +LOOP_ID); when package_body_ID => Push_Back_Check (New_Config, (+SEMICOLON_ID, +name_opt_ID, +END_ID)); if New_Config.Stack.Peek (1).Token.ID = +handled_sequence_of_statements_ID then Push_Back_Check (New_Config, (+handled_sequence_of_statements_ID, +BEGIN_ID)); end if; Push_Back_Check (New_Config, (1 => +declarative_part_opt_ID)); Insert (New_Config, (+PACKAGE_ID, +BODY_ID, +IDENTIFIER_ID, +IS_ID)); when package_specification_ID => Push_Back_Check (New_Config, (+name_opt_ID, +END_ID, +declarative_part_opt_ID)); if New_Config.Stack.Peek (1).Token.ID = +PRIVATE_ID then Push_Back_Check (New_Config, (+PRIVATE_ID, +declarative_part_opt_ID)); end if; Insert (New_Config, (+PACKAGE_ID, +IDENTIFIER_ID, +IS_ID)); when subprogram_body_ID => Push_Back_Check (New_Config, (+SEMICOLON_ID, +name_opt_ID, +END_ID, +handled_sequence_of_statements_ID, +BEGIN_ID, +declarative_part_opt_ID)); Insert (New_Config, (+PROCEDURE_ID, +IDENTIFIER_ID, +IS_ID)); when task_body_ID => Push_Back_Check (New_Config, (+SEMICOLON_ID, +name_opt_ID, +END_ID, +handled_sequence_of_statements_ID)); Insert (New_Config, +BEGIN_ID); when others => if Trace_McKenzie > Outline then Put ("Language_Fixes Match_Names_Error 2: unknown error token", Config); end if; return; end case; if Trace_McKenzie > Detail then Put ("Language_Fixes Match_Names_Error 2 " & Image (Config.Error_Token.ID, Descriptor), New_Config); end if; Local_Config_Heap.Add (New_Config); exception when Bad_Config => null; end; else -- Case 1. declare New_Config : Configuration := Config; begin New_Config.Error_Token.ID := Invalid_Token_ID; New_Config.Check_Status := (Label => Ok); New_Config.Strategy_Counts (Language_Fix) := New_Config.Strategy_Counts (Language_Fix) + 1; Push_Back_Check (New_Config, (+SEMICOLON_ID, (case Ada_Process_Actions.Token_Enum_ID'(-Config.Error_Token.ID) is when package_body_ID | package_specification_ID | subprogram_body_ID => +name_opt_ID, when protected_type_declaration_ID | single_protected_declaration_ID => +protected_definition_ID, when others => +identifier_opt_ID))); if New_Config.Stack.Peek.Token.Min_Terminal_Index = Invalid_Token_Index then -- 'end' is on top of stack. We want to set Current_Shared_Token to -- 'end'; we can't if it has an invalid index (which it has if it was -- pushed after a previous fix). -- -- We don't check earlier for Invalid_Indices, because we can handle -- other tokens having invalid indices. return; end if; Push_Back_Check (New_Config, +END_ID); -- We don't insert ';' here, because we may need to insert other -- stuff first; let Minimal_Complete_Actions handle it. Insert (New_Config, +END_ID); Local_Config_Heap.Add (New_Config); if Trace_McKenzie > Detail then Put ("Language_Fixes Match_Names_Error 1 " & Image (Config.Error_Token.ID, Descriptor), New_Config); end if; exception when Bad_Config => null; when E : System.Assertions.Assert_Failure => if Trace_McKenzie > Outline then Trace.Put_Line ("Match_Names_Error 1 " & Standard.Ada.Exceptions.Exception_Message (E) & " " & Image (Config.Error_Token.ID, Descriptor)); end if; end; end if; end; when Missing_Name_Error => -- 0. User name error. The input looks like: -- -- "<begin_name_token> ... <end_name_token> ;" -- -- where <end_name_token> is empty, because the user is changing it. -- -- There are two cases: -- -- 0a. The nonterm can contain a handled_sequence_of_statements; ie a subprogram or named block -- -- 0b. The nonterm cannot contain a handled_sequence_of_statements; -- ie a protected object or type declaration. -- -- The fix is to ignore the error. -- -- 1. missing 'begin' or extra 'end'. The stack looks like: -- -- "<begin_named_token> ... begin handled_sequence_of_statements end <end_name_token> ;" -- -- where the <end_name_token> is empty. See test_mckenzie_recover.adb -- Missing_Name_*, ada_mode-recover_15.adb. -- -- There are two subcases: -- -- 1a. The 'end <end_name_token> ;' is left over from editing, and -- should be deleted. Note that there could be an End_Keyword_IDs -- with that end instead of a name. -- -- 1b. There is a missing 'begin'. -- -- We can distinguish between 1a and 1b by looking for 'exception'; -- if it is present, it is more likely there is a missing 'begin'. -- However, 'exception' is contained by -- 'handled_sequence_of_statements' on the stack, so we have to look -- inside that using the syntax tree. -- -- We cannot distinguish between cases 0 and 1, other than by parsing -- ahead, except in case 0b. So we enqueue two solutions; 'ignore -- error' and either 'insert begin' or 'delete end;'. if not Valid_Tree_Indices (Config.Stack, SAL.Base_Peek_Type (Config.Check_Token_Count)) then -- Invalid tree indices happens when recover enqueues a config that -- contains tokens pushed during recover. The logic below depends on -- valid tree indices. return; end if; if No_Statements_Nonterm_IDs (Config.Error_Token.ID) then -- case 0b. -- test/ada_mode.ads return; end if; if Syntax_Trees.Invalid_Node_Index = Tree.Find_Child (Config.Stack.Peek (4).Tree_Index, +EXCEPTION_ID) then -- 'exception' not found; case 1a - assume extra 'end [keyword] ;'; delete it. declare use Config_Op_Arrays; New_Config : Configuration := Config; Ops : Config_Op_Arrays.Vector renames New_Config.Ops; Stack : Recover_Stacks.Stack renames New_Config.Stack; End_Item : Recover_Stack_Item; -- 'end' keyword; position in stack varies with case Keyword_Item : Recover_Stack_Item; -- keyword after 'end'; may not be present Semicolon_Item : Recover_Stack_Item; -- semicolon after 'end' begin New_Config.Error_Token.ID := Invalid_Token_ID; New_Config.Check_Status := (Label => Ok); -- This is a guess, and sometimes deleting the error keyword is better, so -- give it a cost. New_Config.Cost := New_Config.Cost + 1; New_Config.Strategy_Counts (Language_Fix) := New_Config.Strategy_Counts (Language_Fix) + 1; case To_Token_Enum (Config.Error_Token.ID) is when block_statement_ID | package_body_ID | subprogram_body_ID | task_body_ID => Semicolon_Item := Stack.Peek (1); End_Item := Stack.Peek (3); Push_Back_Check (New_Config, (+SEMICOLON_ID, (if Config.Error_Token.ID in +block_statement_ID | +task_body_ID then +identifier_opt_ID else +name_opt_ID), +END_ID)); if New_Config.Stack.Peek (1).Token.ID = +handled_sequence_of_statements_ID then Undo_Reduce_Check (New_Config, Tree, (+handled_sequence_of_statements_ID, +sequence_of_statements_opt_ID)); end if; when package_specification_ID => Semicolon_Item := Stack.Peek (1); End_Item := Stack.Peek (3); Push_Back_Check (New_Config, (+SEMICOLON_ID, +name_opt_ID, +END_ID)); Undo_Reduce_Check (New_Config, Tree, +declarative_part_opt_ID); when loop_statement_ID => Semicolon_Item := Stack.Peek (1); Keyword_Item := Stack.Peek (3); End_Item := Stack.Peek (4); Push_Back_Check (New_Config, (+SEMICOLON_ID, +identifier_opt_ID, +LOOP_ID, +END_ID)); if New_Config.Stack.Peek (1).Token.ID = +handled_sequence_of_statements_ID then Undo_Reduce_Check (New_Config, Tree, (+handled_sequence_of_statements_ID, +sequence_of_statements_opt_ID)); end if; when others => if Trace_McKenzie > Outline then Put ("Language_Fixes unimplemented nonterm for Missing_Name_Error.", Config); end if; raise Bad_Config; end case; if not Has_Space (Ops, 3) then raise Bad_Config; end if; Append (Ops, (Delete, +END_ID, End_Item.Token.Min_Terminal_Index)); if Keyword_Item.Token.ID /= Invalid_Token_ID then Append (Ops, (Delete, Keyword_Item.Token.ID, Keyword_Item.Token.Min_Terminal_Index)); end if; -- We don't need to delete the identifier|name ; it is missing and therefor empty. Append (Ops, (Delete, +SEMICOLON_ID, Semicolon_Item.Token.Min_Terminal_Index)); New_Config.Current_Shared_Token := Config.Current_Shared_Token; -- After pushed_back SEMICOLON. Local_Config_Heap.Add (New_Config); if Trace_McKenzie > Detail then Put ("Language_Fixes Missing_Name_Error 1a " & Image (Config.Error_Token.ID, Descriptor), New_Config); end if; exception when Bad_Config => null; end; else -- 'exception' found; case 1b - assume missing 'begin'; insert it -- before 'handled_sequence_of_statements' declare New_Config : Configuration := Config; begin New_Config.Error_Token.ID := Invalid_Token_ID; New_Config.Check_Status := (Label => Ok); New_Config.Cost := New_Config.Cost + 1; New_Config.Strategy_Counts (Language_Fix) := New_Config.Strategy_Counts (Language_Fix) + 1; Push_Back_Check (New_Config, (+SEMICOLON_ID, (if Config.Error_Token.ID = +block_statement_ID then +identifier_opt_ID else +name_opt_ID), +END_ID, +handled_sequence_of_statements_ID)); Insert (New_Config, +BEGIN_ID); Local_Config_Heap.Add (New_Config); if Trace_McKenzie > Detail then Put ("Language_Fixes Missing_Name_Error 1b " & Image (Config.Error_Token.ID, Descriptor), New_Config); end if; exception when Bad_Config => null; end; end if; when Extra_Name_Error => -- The input looks like -- -- "<begin_name_token> ... block_label_opt begin ... end <end_name_token> ;" -- -- where the erroneous reduce matches the empty 'block_label_opt' -- with '<end_name_Token>'. -- -- 0. If a matching <begin_name_token> is found, this is not a -- plausible user name error (but we always allow 'ignore error'). If -- it is not found, the user could be adding/deleting names; ignore -- error is appropriate. In either case, enqueue other solutions. -- -- 1. There is at least one missing 'end' before 'begin'. See -- test_mckenzie_recover.adb Extra_Name_1, Extra_Name_2, -- Two_Missing_Ends. The solution is to insert 'end ;' before the -- 'begin'. -- -- 2. There is at least one missing 'end' after 'begin'. See -- test_mckenzie_recover.adb Extra_Name_3, Block_Match_Names_1. The -- solution is to insert 'end ;' before the 'end'. -- -- 3. There is an extra 'begin', before the 'begin'. See -- test/ada_mode-recover_block_name_mismatch.adb -- -- There is no reliable way to distinguish between 1 and 2, so we -- enqueue both solutions. See test/ada_mode-recover_exception_1.adb -- -- If there is more than one missing 'end', a later recover operation -- will fix the others. -- This case can handle Config.Error_Token.Virtual = True, and it doesn't use -- Tree. declare End_Name : constant String := Lexer.Buffer_Text (End_Name_Token.Name); Matching_Name_Index : SAL.Peek_Type := 3; -- start search before <end_name_token> Begin_Count : Integer; begin Find_Matching_Name (Config, Lexer, End_Name, Matching_Name_Index, Other_ID => +BEGIN_ID, Other_Count => Begin_Count, Case_Insensitive => True); if Matching_Name_Index = Config.Stack.Depth then -- No matching name found; ignore error is the only fix. return; end if; if Begin_Count = 1 then -- Case 1 or 2. declare New_Config : Configuration := Config; begin New_Config.Error_Token.ID := Invalid_Token_ID; New_Config.Check_Status := (Label => Ok); New_Config.Strategy_Counts (Language_Fix) := New_Config.Strategy_Counts (Language_Fix) + 1; -- Push_Back the failed reduce tokens. for I in 1 .. New_Config.Check_Token_Count loop Push_Back (New_Config); end loop; Insert (New_Config, +END_ID); -- Let Minimal_Complete_Actions handle (insert ';'). Local_Config_Heap.Add (New_Config); if Trace_McKenzie > Detail then Put ("Language_Fixes Extra_Name_Error 1 " & Image (Config.Error_Token.ID, Descriptor), New_Config); end if; exception when Bad_Config => null; end; -- Case 2 declare New_Config : Configuration := Config; begin New_Config.Error_Token.ID := Invalid_Token_ID; New_Config.Check_Status := (Label => Ok); New_Config.Strategy_Counts (Language_Fix) := New_Config.Strategy_Counts (Language_Fix) + 1; case Ada_Process_Actions.Token_Enum_ID'(-Config.Error_Token.ID) is when block_statement_ID => -- There is almost always an open block of some sort; not worth -- checking. Push_Back_Check (New_Config, (+SEMICOLON_ID, +identifier_opt_ID, +END_ID)); when loop_statement_ID => Push_Back_Check (New_Config, (+SEMICOLON_ID, +identifier_opt_ID, +LOOP_ID, +END_ID)); when others => if Trace_McKenzie > Outline then Put ("Language_Fixes Extra_Name_Error 2: unrecognized Error_Token", Config); end if; raise Bad_Config; end case; -- Let Minimal_Complete_Actions finish insert Insert (New_Config, +END_ID); Local_Config_Heap.Add (New_Config); if Trace_McKenzie > Detail then Put ("Language_Fixes Extra_Name_Error 2 " & Image (Config.Error_Token.ID, Descriptor), New_Config); end if; exception when Bad_Config => null; end; else -- Case 3. Delete the extra begin -- -- If the first begin was inserted by recovery; we actually want to -- delete the second begin. see test/ada_mode-recover_indent_4.adb declare New_Config : Configuration := Config; I : SAL.Peek_Type := 1; First_Begin_I : SAL.Peek_Type; Second_Begin_I : SAL.Peek_Type; begin loop if New_Config.Stack.Peek (I).Token.ID = +BEGIN_ID then Second_Begin_I := I; exit; end if; I := I + 1; end loop; loop I := I + 1; if New_Config.Stack.Peek (I).Token.ID = +BEGIN_ID then First_Begin_I := I; exit; end if; end loop; if New_Config.Stack.Peek (First_Begin_I).Token.Virtual then if New_Config.Stack.Peek (Second_Begin_I).Token.Virtual then -- nothing we can do. return; end if; -- Delete the second begin for I in 1 .. Second_Begin_I loop Push_Back (New_Config); end loop; pragma Assert (New_Config.Stack.Peek.Token.ID = +block_label_opt_ID); if New_Config.Stack.Peek.Token.Byte_Region = Null_Buffer_Region then -- block label is empty Push_Back (New_Config); Delete_Check (Terminals, New_Config, +BEGIN_ID); else Push_Back (New_Config); declare Index : WisiToken.Token_Index := New_Config.Current_Shared_Token; begin Delete_Check (Terminals, New_Config, Index, +IDENTIFIER_ID); Delete_Check (Terminals, New_Config, Index, +COLON_ID); Delete_Check (Terminals, New_Config, Index, +BEGIN_ID); end; end if; if Undo_Reduce_Valid (New_Config.Stack, Tree) then Undo_Reduce_Check (New_Config, Tree, +sequence_of_statements_ID); else Push_Back_Check (New_Config, +sequence_of_statements_ID); end if; Local_Config_Heap.Add (New_Config); if Trace_McKenzie > Detail then Put ("Language_Fixes Extra_Name_Error 3a " & Image (Config.Error_Token.ID, Descriptor), New_Config); end if; else -- Delete the first begin. We assume it is in a subprogram body, so -- we don't need to adjust anything else. for I in 1 .. First_Begin_I loop Push_Back (New_Config); end loop; Delete_Check (Terminals, New_Config, +BEGIN_ID); Local_Config_Heap.Add (New_Config); if Trace_McKenzie > Detail then Put ("Language_Fixes Extra_Name_Error 3b " & Image (Config.Error_Token.ID, Descriptor), New_Config); end if; end if; end; end if; end; end case; exception when Bad_Config => null; when System.Assertions.Assert_Failure => if Trace_McKenzie > Outline then Trace.Put_Line ("Language_Fixes Handle_Check_Fail Assert fail"); end if; end Handle_Check_Fail; procedure Handle_Parse_Error (Trace : in out WisiToken.Trace'Class; Lexer : access constant WisiToken.Lexer.Instance'Class; Parser_Label : in Natural; Parse_Table : in WisiToken.Parse.LR.Parse_Table; Terminals : in Base_Token_Arrays.Vector; Tree : in Syntax_Trees.Tree; Local_Config_Heap : in out Config_Heaps.Heap_Type; Config : in Configuration) with Pre => Config.Check_Status.Label = Ok is use Config_Op_Arrays; use Sorted_Insert_Delete_Arrays, Insert_Delete_Array_Refs; use all type Standard.Ada.Containers.Count_Type; procedure Put (Message : in String; Config : in Configuration) is begin Put (Message, Trace, Parser_Label, Terminals, Config); end Put; begin if Config.Error_Token.ID = +COLON_ID and Config.Stack.Peek.Token.ID = +IDENTIFIER_ID then -- Code looks like: -- -- begin ... <variable_identifier> : [aliased constant] <subtype_indication> ... -- -- compare to "missing begin"/"extra begin" case below. -- -- Assume the user copied a declaration with an initializer, and is -- converting it to a subprogram parameter; see -- ada_mode-recover_02.adb). Delete the ': [aliased constant] -- <subtype_indication>'. -- -- Note that if the user was converting to an assignment, the error -- would be on 'constant', not ':'. if Length (Config.Insert_Delete) > 0 and then Token_Index (Constant_Ref (Config.Insert_Delete, Last_Index (Config.Insert_Delete))) >= Config.Current_Shared_Token then -- Can't delete tokens from here return; end if; declare New_Config : Configuration := Config; Delete_Index : WisiToken.Token_Index := Config.Current_Shared_Token; begin Delete_Check (Terminals, New_Config, Delete_Index, +COLON_ID); if Terminals (Delete_Index).ID = +ALIASED_ID then Delete_Check (Terminals, New_Config, Delete_Index, +ALIASED_ID); end if; if Terminals (Delete_Index).ID = +CONSTANT_ID then Delete_Check (Terminals, New_Config, Delete_Index, +CONSTANT_ID); end if; if Terminals (Delete_Index).ID = +NOT_ID then Delete_Check (Terminals, New_Config, Delete_Index, +NOT_ID); end if; if Terminals (Delete_Index).ID = +NULL_ID then Delete_Check (Terminals, New_Config, Delete_Index, +NULL_ID); end if; if Terminals (Delete_Index).ID = +IDENTIFIER_ID then Delete_Check (Terminals, New_Config, Delete_Index, +IDENTIFIER_ID); -- There might be more to the subtype_indication; we'll let explore sort that out. Local_Config_Heap.Add (New_Config); if Trace_McKenzie > Detail then Put ("Language_Fixes variable decl as param", New_Config); end if; else -- Something else is going on, abandon this return; end if; end; elsif Config.Error_Token.ID = +DOT_ID then -- We've encountered a Selected_Component when we were expecting a -- simple IDENTIFIER or a name. If the name is preceded by 'end', then -- this similar to a semantic check Extra_Name_Error, and the -- solutions are similar. if Config.Stack.Peek.Token.ID = +IDENTIFIER_ID and Config.Stack.Peek (2).Token.ID = +END_ID then -- The input looks like one of: -- -- 1) "<begin_name_token_1> ... <begin_name_token_2> ... begin ... begin ... end <end_name_token_1> ;" -- -- 2) "<begin_name_token_1> ... begin ... declare ... begin ... end <end_name_token_1> ;" -- -- Case 1) is missing 'end <end_name_token_2> ;' between the -- 'begin's, so parsing expects <end_name_token_1> to match the -- second 'begin', which looks like an unnamed block. See -- test_mckenzie_recover Match_Selected_Component_1. 'declare ...' -- may _not_ be present on the second begin. The solution is to -- insert 'end ;' before the second 'begin'. -- -- Case 2) is missing 'end;' after the second 'begin'. See -- test_mckenzie_recover Match_Selected_Component_2. 'declare ...' -- may be absent on the second begin, or a name may be present. The -- solution is to insert 'end;' after the second 'begin' (ie before -- the last 'end'). -- -- Minimal_Complete_Actions does not handle this case well. -- -- Note that it's _not_ possible the user is just editing names; that -- would generate a semantic check fail, not a parse table error, -- since a "." would be permitted. declare Label : constant String := "selected_component 1"; New_Config_1 : Configuration := Config; New_Config_2 : Configuration; begin New_Config_1.Error_Token.ID := Invalid_Token_ID; New_Config_1.Strategy_Counts (Language_Fix) := New_Config_1.Strategy_Counts (Language_Fix) + 1; Push_Back_Check (New_Config_1, (+IDENTIFIER_ID, +END_ID)); if New_Config_1.Stack.Peek (1).Token.ID = +handled_sequence_of_statements_ID then Undo_Reduce_Check (New_Config_1, Tree, (+handled_sequence_of_statements_ID, +sequence_of_statements_opt_ID)); end if; case To_Token_Enum (New_Config_1.Stack.Peek (3).Token.ID) is when block_label_opt_ID => -- no 'declare'; either case 1 or 2 New_Config_2 := New_Config_1; New_Config_2.Strategy_Counts (Language_Fix) := New_Config_2.Strategy_Counts (Language_Fix) + 1; Insert (New_Config_2, +END_ID); -- Let Minimal_Complete_Actions finish insert. Push_Back_Check (New_Config_1, (+handled_sequence_of_statements_ID, +BEGIN_ID, +block_label_opt_ID)); Insert (New_Config_1, +END_ID); -- Let Minimal_Complete_Actions finish insert. Local_Config_Heap.Add (New_Config_1); Local_Config_Heap.Add (New_Config_2); when declarative_part_opt_ID => -- case 2 Insert (New_Config_1, +END_ID); Local_Config_Heap.Add (New_Config_1); when others => if Trace_McKenzie > Outline then Put ("Language_Fixes " & Label & " missing case " & Image (New_Config_1.Stack.Peek (3).Token.ID, Descriptor), Config); Trace.Put_Line ("... new_config stack: " & Image (New_Config_1.Stack, Descriptor)); end if; return; end case; if Trace_McKenzie > Detail then Put ("Language_Fixes " & Label, New_Config_1); if Length (New_Config_2.Ops) > 0 then Put ("Language_Fixes " & Label, New_Config_2); end if; end if; exception when Bad_Config => null; end; end if; elsif Config.Error_Token.ID = +IDENTIFIER_ID and Config.Stack.Peek.Token.ID = +END_ID then -- We've encountered an identifier after 'end' when expecting a -- keyword. See test/ada_mode-recover_26.adb. -- -- If a matching 'begin name' is found on the stack, the input looks like: -- -- 1) "<begin_name_token> ... begin ... <compound_statement_begin> ... end <end_name_token> ;" -- -- There is a missing 'end <compound_statement_id> ;' before the -- 'end'. We can get the ID to insert from Parse_Table -- Minimal_Complete_Actions. -- -- Minimal_Complete_Actions does not handle this case well; it -- ignores the name. declare End_ID_Actions : constant Minimal_Action_Arrays.Vector := Parse_Table.States (Config.Stack.Peek.State).Minimal_Complete_Actions; End_Name : constant String := Lexer.Buffer_Text (Config.Error_Token.Byte_Region); Matching_Name_Index : SAL.Peek_Type := 2; -- start search before 'end' begin Find_Matching_Name (Config, Lexer, End_Name, Matching_Name_Index, Case_Insensitive => True); if Matching_Name_Index < Config.Stack.Depth and then End_ID_Actions.Length = 1 and then End_ID_Actions (End_ID_Actions.First_Index).Verb = Shift then declare Label : constant String := "missing end keyword"; New_Config : Configuration := Config; begin New_Config.Error_Token.ID := Invalid_Token_ID; New_Config.Strategy_Counts (Language_Fix) := New_Config.Strategy_Counts (Language_Fix) + 1; Push_Back_Check (New_Config, +END_ID); -- Inserting the end keyword and semicolon here avoids the costs added by -- Insert_Minimal_Complete_Actions. Insert (New_Config, (+END_ID, End_ID_Actions (End_ID_Actions.First_Index).ID, +SEMICOLON_ID)); Local_Config_Heap.Add (New_Config); if Trace_McKenzie > Detail then Put ("Language_Fixes " & Label, New_Config); end if; exception when Bad_Config => null; end; end if; end; elsif To_Token_Enum (Config.Error_Token.ID) in CONSTANT_ID | IDENTIFIER_ID and Config.Stack.Peek.Token.ID = +COLON_ID then -- Code looks like: -- -- ... <subprogram|package start> begin ... <variable_name> : [constant] <type_name>; -- -- The variable_name looks like a block_label. compare to "variable decl as -- param" case above. -- -- 1) There is a missing 'end;' before the <variable_name>. See -- test/ada_mode-recover_25.adb. Minimal_Complete now handles this -- case, but we enqueue the same solution here at lower cost, so it -- can compete with the solution for case 2.. -- -- 2) There is an extra 'begin' before the <variable_name>. See -- test/ada_mode-recover_27.adb. -- -- FIXME: if there is a sequence_of_statements between the 'begin' -- and the error point, or declarations before the 'begin', this is -- either a copied variable declaration that the user is converting -- to an assignment (solution: delete ': type'), or a subprogram -- begin split in two (solution: insert 'declare' or 'end; procedure -- name'). Need test cases. declare New_Config_1 : Configuration := Config; New_Config_2 : Configuration; begin New_Config_1.Strategy_Counts (Language_Fix) := New_Config_1.Strategy_Counts (Language_Fix) + 1; Push_Back_Check (New_Config_1, (+COLON_ID, +IDENTIFIER_ID)); New_Config_2 := New_Config_1; Insert (New_Config_1, +END_ID); -- Let Minimal_Complete finish insert; that will add cost, so no cost here. Local_Config_Heap.Add (New_Config_1); if Trace_McKenzie > Detail then Put ("Language_Fixes missing begin", New_Config_1); end if; -- Case 2. Push_Back_Check (New_Config_2, +BEGIN_ID); if Undo_Reduce_Valid (New_Config_2.Stack, Tree) then Undo_Reduce_Check (New_Config_2, Tree, +declarative_part_opt_ID); else return; end if; Delete_Check (Terminals, New_Config_2, +BEGIN_ID); -- This is a guess, so add a cost. New_Config_2.Cost := New_Config_2.Cost + 1; Local_Config_Heap.Add (New_Config_2); if Trace_McKenzie > Detail then Put ("Language_Fixes extra begin", New_Config_2); end if; end; elsif Config.Error_Token.ID = +OR_ID and then Config.Stack.Peek.Token.ID = +expression_opt_ID then -- Code looks like: -- -- expr1 and expr2 or expr3 -- -- where 'expr1 and expr2' is in the expression on the stack. Missing -- left paren before expr1. See test/ada_mode-recover_20.adb. -- -- We could check for the presence of 'and' in expression_opt, but -- that requires a syntax tree. If the left paren doesn't help, this -- config will be dropped. declare New_Config : Configuration := Config; begin New_Config.Strategy_Counts (Language_Fix) := New_Config.Strategy_Counts (Language_Fix) + 1; Push_Back_Check (New_Config, +expression_opt_ID); Insert (New_Config, +LEFT_PAREN_ID); -- Minimal_Complete will add the matching right paren. Local_Config_Heap.Add (New_Config); if Trace_McKenzie > Detail then Put ("Language_Fixes and/or", New_Config); end if; end; end if; exception when Bad_Config => null; when System.Assertions.Assert_Failure => if Trace_McKenzie > Outline then Trace.Put_Line ("Language_Fixes Handle_Parse_Error assert fail"); end if; end Handle_Parse_Error; ---------- -- Public subprograms procedure Language_Fixes (Trace : in out WisiToken.Trace'Class; Lexer : access constant WisiToken.Lexer.Instance'Class; Parser_Label : in Natural; Parse_Table : in WisiToken.Parse.LR.Parse_Table; Terminals : in Base_Token_Arrays.Vector; Tree : in Syntax_Trees.Tree; Local_Config_Heap : in out Config_Heaps.Heap_Type; Config : in Configuration) is begin if Trace_McKenzie > Extra then Put ("Language_Fixes", Trace, Parser_Label, Terminals, Config); Put_Line (Trace, Parser_Label, "config stack: " & Image (Config.Stack, Descriptor)); end if; case Config.Check_Status.Label is when Ok => Handle_Parse_Error (Trace, Lexer, Parser_Label, Parse_Table, Terminals, Tree, Local_Config_Heap, Config); when others => Handle_Check_Fail (Trace, Lexer, Parser_Label, Parse_Table, Terminals, Tree, Local_Config_Heap, Config); end case; end Language_Fixes; procedure Matching_Begin_Tokens (Tokens : in Token_ID_Array_1_3; Config : in Configuration; Matching_Tokens : out Token_ID_Arrays.Vector; Forbid_Minimal_Complete : out Boolean) is use Ada_Process_Actions; use Token_ID_Arrays; function Matching_Begin_For_End (Next_Index : in Positive) return Token_ID_Arrays.Vector is begin return Result : Token_ID_Arrays.Vector do if Tokens (Next_Index) = Invalid_Token_ID then -- Better to delete 'end' Result := Empty_Vector; else case To_Token_Enum (Tokens (Next_Index)) is when CASE_ID | IF_ID | LOOP_ID | RETURN_ID | SELECT_ID => Result := To_Vector (Tokens (Next_Index)); when IDENTIFIER_ID => if Tokens (Next_Index + 1) /= Invalid_Token_ID and then To_Token_Enum (Tokens (Next_Index + 1)) = DOT_ID then Result := To_Vector ((+PACKAGE_ID, +BODY_ID, +IDENTIFIER_ID, +IS_ID)); -- package body else Result := To_Vector ((+IDENTIFIER_ID, +COLON_ID, +BEGIN_ID)); -- named block begin end if; when SEMICOLON_ID => Result := To_Vector (+BEGIN_ID); when others => null; end case; end if; end return; end Matching_Begin_For_End; begin if Config.Stack.Depth > 0 and then Config.Stack.Peek.Token.ID = +END_ID then Matching_Tokens := Matching_Begin_For_End (1); else case To_Token_Enum (Tokens (1)) is when END_ID => Matching_Tokens := Matching_Begin_For_End (2); when ELSE_ID | ELSIF_ID | THEN_ID => Matching_Tokens := To_Vector (+IF_ID); when EXCEPTION_ID => Matching_Tokens := To_Vector (+BEGIN_ID); -- We don't return LEFT_PAREN for RIGHT_PAREN; better to delete it. when WHEN_ID => Matching_Tokens := To_Vector ((+CASE_ID, +IDENTIFIER_ID, +IS_ID)); when others => null; end case; end if; if Config.Stack.Peek.Token.ID = +END_ID and ((Tokens (1) = +IDENTIFIER_ID and (Tokens (2) /= Invalid_Token_ID and then -Tokens (2) in DOT_ID | SEMICOLON_ID)) or End_Keyword_IDs (Tokens (1))) then Forbid_Minimal_Complete := True; else Forbid_Minimal_Complete := False; end if; end Matching_Begin_Tokens; function String_ID_Set (Descriptor : in WisiToken.Descriptor; String_Literal_ID : in Token_ID) return Token_ID_Set is use Ada_Process_Actions; begin -- Character literal can be part of a string primary, so the nonterms -- are independent of String_Literal_ID. return Result : Token_ID_Set (Descriptor.First_Terminal .. Descriptor.Last_Nonterminal) := (others => False) do Result (String_Literal_ID) := True; Result (+name_ID) := True; Result (+primary_ID) := True; Result (+factor_ID) := True; Result (+term_ID) := True; Result (+term_list_ID) := True; Result (+simple_expression_ID) := True; Result (+relation_ID) := True; Result (+expression_ID) := True; end return; end String_ID_Set; end WisiToken.Parse.LR.McKenzie_Recover.Ada; -- Local Variables: -- ada-auto-case: not-upper-case -- End:
with Comm; package Sender is XFATAL : constant Comm.Errorcode_Type := Comm.Errorcode_Type(-2); procedure report(err : in Comm.Errorcode_Type); end Sender;
------------------------------------------------------------------------------ -- -- -- Matreshka Project -- -- -- -- Ada Modeling Framework -- -- -- -- Runtime Library Component -- -- -- ------------------------------------------------------------------------------ -- -- -- Copyright © 2011-2012, Vadim Godunko <vgodunko@gmail.com> -- -- All rights reserved. -- -- -- -- Redistribution and use in source and binary forms, with or without -- -- modification, are permitted provided that the following conditions -- -- are met: -- -- -- -- * Redistributions of source code must retain the above copyright -- -- notice, this list of conditions and the following disclaimer. -- -- -- -- * Redistributions in binary form must reproduce the above copyright -- -- notice, this list of conditions and the following disclaimer in the -- -- documentation and/or other materials provided with the distribution. -- -- -- -- * Neither the name of the Vadim Godunko, IE nor the names of its -- -- contributors may be used to endorse or promote products derived from -- -- this software without specific prior written permission. -- -- -- -- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -- -- "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -- -- LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -- -- A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -- -- HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -- -- SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED -- -- TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -- -- PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -- -- LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -- -- NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -- -- SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -- -- -- ------------------------------------------------------------------------------ -- $Revision$ $Date$ ------------------------------------------------------------------------------ -- This file is generated, don't edit it. ------------------------------------------------------------------------------ with AMF.Generic_Collections; package AMF.UML.Connectable_Element_Template_Parameters.Collections is pragma Preelaborate; package UML_Connectable_Element_Template_Parameter_Collections is new AMF.Generic_Collections (UML_Connectable_Element_Template_Parameter, UML_Connectable_Element_Template_Parameter_Access); type Set_Of_UML_Connectable_Element_Template_Parameter is new UML_Connectable_Element_Template_Parameter_Collections.Set with null record; Empty_Set_Of_UML_Connectable_Element_Template_Parameter : constant Set_Of_UML_Connectable_Element_Template_Parameter; type Ordered_Set_Of_UML_Connectable_Element_Template_Parameter is new UML_Connectable_Element_Template_Parameter_Collections.Ordered_Set with null record; Empty_Ordered_Set_Of_UML_Connectable_Element_Template_Parameter : constant Ordered_Set_Of_UML_Connectable_Element_Template_Parameter; type Bag_Of_UML_Connectable_Element_Template_Parameter is new UML_Connectable_Element_Template_Parameter_Collections.Bag with null record; Empty_Bag_Of_UML_Connectable_Element_Template_Parameter : constant Bag_Of_UML_Connectable_Element_Template_Parameter; type Sequence_Of_UML_Connectable_Element_Template_Parameter is new UML_Connectable_Element_Template_Parameter_Collections.Sequence with null record; Empty_Sequence_Of_UML_Connectable_Element_Template_Parameter : constant Sequence_Of_UML_Connectable_Element_Template_Parameter; private Empty_Set_Of_UML_Connectable_Element_Template_Parameter : constant Set_Of_UML_Connectable_Element_Template_Parameter := (UML_Connectable_Element_Template_Parameter_Collections.Set with null record); Empty_Ordered_Set_Of_UML_Connectable_Element_Template_Parameter : constant Ordered_Set_Of_UML_Connectable_Element_Template_Parameter := (UML_Connectable_Element_Template_Parameter_Collections.Ordered_Set with null record); Empty_Bag_Of_UML_Connectable_Element_Template_Parameter : constant Bag_Of_UML_Connectable_Element_Template_Parameter := (UML_Connectable_Element_Template_Parameter_Collections.Bag with null record); Empty_Sequence_Of_UML_Connectable_Element_Template_Parameter : constant Sequence_Of_UML_Connectable_Element_Template_Parameter := (UML_Connectable_Element_Template_Parameter_Collections.Sequence with null record); end AMF.UML.Connectable_Element_Template_Parameters.Collections;
------------------------------------------------------------------------------ -- -- -- Matreshka Project -- -- -- -- Ada Modeling Framework -- -- -- -- Runtime Library Component -- -- -- ------------------------------------------------------------------------------ -- -- -- Copyright © 2011-2012, Vadim Godunko <vgodunko@gmail.com> -- -- All rights reserved. -- -- -- -- Redistribution and use in source and binary forms, with or without -- -- modification, are permitted provided that the following conditions -- -- are met: -- -- -- -- * Redistributions of source code must retain the above copyright -- -- notice, this list of conditions and the following disclaimer. -- -- -- -- * Redistributions in binary form must reproduce the above copyright -- -- notice, this list of conditions and the following disclaimer in the -- -- documentation and/or other materials provided with the distribution. -- -- -- -- * Neither the name of the Vadim Godunko, IE nor the names of its -- -- contributors may be used to endorse or promote products derived from -- -- this software without specific prior written permission. -- -- -- -- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -- -- "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -- -- LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -- -- A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -- -- HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -- -- SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED -- -- TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -- -- PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -- -- LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -- -- NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -- -- SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -- -- -- ------------------------------------------------------------------------------ -- $Revision$ $Date$ ------------------------------------------------------------------------------ with AMF.Internals.UML_Packageable_Elements; with AMF.UML.Dependencies.Collections; with AMF.UML.Expressions; with AMF.UML.Named_Elements; with AMF.UML.Namespaces; with AMF.UML.Packages.Collections; with AMF.UML.Parameterable_Elements; with AMF.UML.String_Expressions; with AMF.UML.Template_Parameters; with AMF.UML.Types; with AMF.UML.Value_Specifications.Collections; with AMF.Visitors; package AMF.Internals.UML_Expressions is type UML_Expression_Proxy is limited new AMF.Internals.UML_Packageable_Elements.UML_Packageable_Element_Proxy and AMF.UML.Expressions.UML_Expression with null record; overriding function Get_Operand (Self : not null access constant UML_Expression_Proxy) return AMF.UML.Value_Specifications.Collections.Ordered_Set_Of_UML_Value_Specification; -- Getter of Expression::operand. -- -- Specifies a sequence of operands. overriding function Get_Symbol (Self : not null access constant UML_Expression_Proxy) return AMF.Optional_String; -- Getter of Expression::symbol. -- -- The symbol associated with the node in the expression tree. overriding procedure Set_Symbol (Self : not null access UML_Expression_Proxy; To : AMF.Optional_String); -- Setter of Expression::symbol. -- -- The symbol associated with the node in the expression tree. overriding function Get_Type (Self : not null access constant UML_Expression_Proxy) return AMF.UML.Types.UML_Type_Access; -- Getter of TypedElement::type. -- -- The type of the TypedElement. -- This information is derived from the return result for this Operation. overriding procedure Set_Type (Self : not null access UML_Expression_Proxy; To : AMF.UML.Types.UML_Type_Access); -- Setter of TypedElement::type. -- -- The type of the TypedElement. -- This information is derived from the return result for this Operation. overriding function Get_Client_Dependency (Self : not null access constant UML_Expression_Proxy) return AMF.UML.Dependencies.Collections.Set_Of_UML_Dependency; -- Getter of NamedElement::clientDependency. -- -- Indicates the dependencies that reference the client. overriding function Get_Name_Expression (Self : not null access constant UML_Expression_Proxy) return AMF.UML.String_Expressions.UML_String_Expression_Access; -- Getter of NamedElement::nameExpression. -- -- The string expression used to define the name of this named element. overriding procedure Set_Name_Expression (Self : not null access UML_Expression_Proxy; To : AMF.UML.String_Expressions.UML_String_Expression_Access); -- Setter of NamedElement::nameExpression. -- -- The string expression used to define the name of this named element. overriding function Get_Namespace (Self : not null access constant UML_Expression_Proxy) return AMF.UML.Namespaces.UML_Namespace_Access; -- Getter of NamedElement::namespace. -- -- Specifies the namespace that owns the NamedElement. overriding function Get_Qualified_Name (Self : not null access constant UML_Expression_Proxy) return AMF.Optional_String; -- Getter of NamedElement::qualifiedName. -- -- A name which allows the NamedElement to be identified within a -- hierarchy of nested Namespaces. It is constructed from the names of the -- containing namespaces starting at the root of the hierarchy and ending -- with the name of the NamedElement itself. overriding function Get_Owning_Template_Parameter (Self : not null access constant UML_Expression_Proxy) return AMF.UML.Template_Parameters.UML_Template_Parameter_Access; -- Getter of ParameterableElement::owningTemplateParameter. -- -- The formal template parameter that owns this element. overriding procedure Set_Owning_Template_Parameter (Self : not null access UML_Expression_Proxy; To : AMF.UML.Template_Parameters.UML_Template_Parameter_Access); -- Setter of ParameterableElement::owningTemplateParameter. -- -- The formal template parameter that owns this element. overriding function Get_Template_Parameter (Self : not null access constant UML_Expression_Proxy) return AMF.UML.Template_Parameters.UML_Template_Parameter_Access; -- Getter of ParameterableElement::templateParameter. -- -- The template parameter that exposes this element as a formal parameter. overriding procedure Set_Template_Parameter (Self : not null access UML_Expression_Proxy; To : AMF.UML.Template_Parameters.UML_Template_Parameter_Access); -- Setter of ParameterableElement::templateParameter. -- -- The template parameter that exposes this element as a formal parameter. overriding function Boolean_Value (Self : not null access constant UML_Expression_Proxy) return AMF.Optional_Boolean; -- Operation ValueSpecification::booleanValue. -- -- The query booleanValue() gives a single Boolean value when one can be -- computed. overriding function Integer_Value (Self : not null access constant UML_Expression_Proxy) return AMF.Optional_Integer; -- Operation ValueSpecification::integerValue. -- -- The query integerValue() gives a single Integer value when one can be -- computed. overriding function Is_Compatible_With (Self : not null access constant UML_Expression_Proxy; P : AMF.UML.Parameterable_Elements.UML_Parameterable_Element_Access) return Boolean; -- Operation ValueSpecification::isCompatibleWith. -- -- The query isCompatibleWith() determines if this parameterable element -- is compatible with the specified parameterable element. By default -- parameterable element P is compatible with parameterable element Q if -- the kind of P is the same or a subtype as the kind of Q. In addition, -- for ValueSpecification, the type must be conformant with the type of -- the specified parameterable element. overriding function Is_Computable (Self : not null access constant UML_Expression_Proxy) return Boolean; -- Operation ValueSpecification::isComputable. -- -- The query isComputable() determines whether a value specification can -- be computed in a model. This operation cannot be fully defined in OCL. -- A conforming implementation is expected to deliver true for this -- operation for all value specifications that it can compute, and to -- compute all of those for which the operation is true. A conforming -- implementation is expected to be able to compute the value of all -- literals. overriding function Is_Null (Self : not null access constant UML_Expression_Proxy) return Boolean; -- Operation ValueSpecification::isNull. -- -- The query isNull() returns true when it can be computed that the value -- is null. overriding function Real_Value (Self : not null access constant UML_Expression_Proxy) return AMF.Optional_Real; -- Operation ValueSpecification::realValue. -- -- The query realValue() gives a single Real value when one can be -- computed. overriding function String_Value (Self : not null access constant UML_Expression_Proxy) return AMF.Optional_String; -- Operation ValueSpecification::stringValue. -- -- The query stringValue() gives a single String value when one can be -- computed. overriding function Unlimited_Value (Self : not null access constant UML_Expression_Proxy) return AMF.Optional_Unlimited_Natural; -- Operation ValueSpecification::unlimitedValue. -- -- The query unlimitedValue() gives a single UnlimitedNatural value when -- one can be computed. overriding function All_Owning_Packages (Self : not null access constant UML_Expression_Proxy) return AMF.UML.Packages.Collections.Set_Of_UML_Package; -- Operation NamedElement::allOwningPackages. -- -- The query allOwningPackages() returns all the directly or indirectly -- owning packages. overriding function Is_Distinguishable_From (Self : not null access constant UML_Expression_Proxy; N : AMF.UML.Named_Elements.UML_Named_Element_Access; Ns : AMF.UML.Namespaces.UML_Namespace_Access) return Boolean; -- Operation NamedElement::isDistinguishableFrom. -- -- The query isDistinguishableFrom() determines whether two NamedElements -- may logically co-exist within a Namespace. By default, two named -- elements are distinguishable if (a) they have unrelated types or (b) -- they have related types but different names. overriding function Namespace (Self : not null access constant UML_Expression_Proxy) return AMF.UML.Namespaces.UML_Namespace_Access; -- Operation NamedElement::namespace. -- -- Missing derivation for NamedElement::/namespace : Namespace overriding function Is_Template_Parameter (Self : not null access constant UML_Expression_Proxy) return Boolean; -- Operation ParameterableElement::isTemplateParameter. -- -- The query isTemplateParameter() determines if this parameterable -- element is exposed as a formal template parameter. overriding procedure Enter_Element (Self : not null access constant UML_Expression_Proxy; Visitor : in out AMF.Visitors.Abstract_Visitor'Class; Control : in out AMF.Visitors.Traverse_Control); -- Dispatch call to corresponding subprogram of visitor interface. overriding procedure Leave_Element (Self : not null access constant UML_Expression_Proxy; Visitor : in out AMF.Visitors.Abstract_Visitor'Class; Control : in out AMF.Visitors.Traverse_Control); -- Dispatch call to corresponding subprogram of visitor interface. overriding procedure Visit_Element (Self : not null access constant UML_Expression_Proxy; Iterator : in out AMF.Visitors.Abstract_Iterator'Class; Visitor : in out AMF.Visitors.Abstract_Visitor'Class; Control : in out AMF.Visitors.Traverse_Control); -- Dispatch call to corresponding subprogram of iterator interface. end AMF.Internals.UML_Expressions;
with Ada.Streams; generic type Element_Type is private; package remote_type is pragma Remote_Types; type List is private; procedure Append (Container : in out List; New_Item : in Element_Type); private use Ada.Streams; type List_Record is record A : Boolean; end record; type List is access List_Record; procedure Read (S : access Root_Stream_Type'Class; L : out List); for List'Read use Read; procedure Write (S : access Root_Stream_Type'Class; L : in List); for List'Write use Write; end remote_type;
-- Copyright 2021 Jeff Foley. All rights reserved. -- Use of this source code is governed by Apache 2 LICENSE that can be found in the LICENSE file. local json = require("json") name = "PentestTools" type = "api" function start() set_rate_limit(1) end function check() local c local cfg = datasrc_config() if cfg ~= nil then c = cfg.credentials end if (c ~= nil and c.key ~= nil and c.key ~= "") then return true end return false end function vertical(ctx, domain) local c local cfg = datasrc_config() if cfg ~= nil then c = cfg.credentials end if (c == nil or c.key == nil or c.key == "") then return end local id = start_scan(domain, c.key) if id == "" then return end while(true) do local status = get_scan_status(id, c.key) if status == "failed" then return elseif status == "finished" then break end for _=1,5 do check_rate_limit() end end local output = get_output(id, c.key) if output ~= "" then for _, r in pairs(output) do new_name(ctx, r[1]) new_addr(ctx, r[2], r[1]) end end end function start_scan(domain, key) local body = json.encode({ ['op']="start_scan", ['tool_id']=20, ['target']=domain, ['tool_params'] = { ['web_details']="off", ['do_bing_search']="off", }, }) local resp, err = request(ctx, { ['url']=build_url(key), method="POST", data=body, headers={['Content-Type']="application/json"} }) if (err ~= nil and err ~= "") then log(ctx, "start_scan request to service failed: " .. err) return "" end d = json.decode(resp) if (d == nil or d.op_status ~= "success") then return "" end return d.scan_id end function get_scan_status(id, key) local body = json.encode({ ['op']="get_scan_status", ['scan_id']=id, }) local resp, err = request(ctx, { ['url']=build_url(key), method="POST", data=body, headers={['Content-Type']="application/json"} }) if (err ~= nil and err ~= "") then log(ctx, "get_scan_status request to service failed: " .. err) return "failed" end d = json.decode(resp) if (d == nil or d.op_status ~= "success") then return "failed" elseif (d.scan_status == "waiting" or d.scan_status == "running") then return "progress" else return "finished" end end function get_output(id, key) local body = json.encode({ ['op']="get_output", ['scan_id']=id, ['output_format']="json", }) local resp, err = request(ctx, { ['url']=build_url(key), method="POST", data=body, headers={['Content-Type']="application/json"} }) if (err ~= nil and err ~= "") then log(ctx, "get_output request to service failed: " .. err) return "" end d = json.decode(resp) if (d == nil or d.op_status ~= "success" or d.output_json == nil or #(d['output_json'].output_data) == 0) then return "" end return d['output_json'][1].output_data end function build_url(key) return "https://pentest-tools.com/api?key=" .. key end
------------------------------------------------------------------------------ -- -- -- GNAT RUN-TIME LIBRARY (GNARL) COMPONENTS -- -- -- -- S Y S T E M . B B . M C U _ P A R A M E T E R S -- -- -- -- B o d y -- -- -- -- Copyright (C) 2016, AdaCore -- -- -- -- GNAT is free software; you can redistribute it and/or modify it under -- -- terms of the GNU General Public License as published by the Free Soft- -- -- ware Foundation; either version 3, or (at your option) any later ver- -- -- sion. GNAT is distributed in the hope that it will be useful, but WITH- -- -- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY -- -- or FITNESS FOR A PARTICULAR PURPOSE. -- -- -- -- As a special exception under Section 7 of GPL version 3, you are granted -- -- additional permissions described in the GCC Runtime Library Exception, -- -- version 3.1, as published by the Free Software Foundation. -- -- -- -- You should have received a copy of the GNU General Public License and -- -- a copy of the GCC Runtime Library Exception along with this program; -- -- see the files COPYING3 and COPYING.RUNTIME respectively. If not, see -- -- <http://www.gnu.org/licenses/>. -- -- -- -- GNAT was originally developed by the GNAT team at New York University. -- -- Extensive contributions were provided by Ada Core Technologies Inc. -- -- -- -- The port of GNARL to bare board targets was initially developed by the -- -- Real-Time Systems Group at the Technical University of Madrid. -- -- -- ------------------------------------------------------------------------------ with Interfaces.STM32.PWR; use Interfaces.STM32.PWR; package body System.BB.MCU_Parameters is -------------------- -- PWR_Initialize -- -------------------- procedure PWR_Initialize is begin -- Set the PWR to Scale 1 mode to stabilize the MCU when in high -- performance mode. PWR_Periph.CR.VOS := 1; end PWR_Initialize; -------------------------- -- PWR_Overdrive_Enable -- -------------------------- procedure PWR_Overdrive_Enable is begin null; end PWR_Overdrive_Enable; end System.BB.MCU_Parameters;
------------------------------------------------------------------------------ -- -- -- 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. -- -- -- ------------------------------------------------------------------------------ package body STM32.Board is ------------------ -- All_LEDs_Off -- ------------------ procedure All_LEDs_Off is begin Set (All_LEDs); end All_LEDs_Off; ----------------- -- All_LEDs_On -- ----------------- procedure All_LEDs_On is begin Clear (All_LEDs); end All_LEDs_On; --------------------- -- Initialize_LEDs -- --------------------- procedure Initialize_LEDs is Conf : GPIO_Port_Configuration; begin Enable_Clock (All_LEDs); Conf.Mode := Mode_Out; Conf.Output_Type := Push_Pull; Conf.Speed := Speed_100MHz; Conf.Resistors := Floating; Configure_IO (All_LEDs, Conf); All_LEDs_Off; end Initialize_LEDs; ------------------------- -- Initialize_I2C_GPIO -- ------------------------- procedure Initialize_I2C_GPIO (Port : in out I2C_Port) is Id : constant I2C_Port_Id := As_Port_Id (Port); Points : GPIO_Points (1 .. 2); begin if Port_Enabled (Port) then return; end if; case Id is when I2C_Id_1 => Points := (I2C1_SDA, I2C1_SCL); when I2C_Id_2 => Points := (I2C2_SDA, I2C2_SCL); when others => raise Unknown_Device with "This I2C_Port cannot be used on this board"; end case; Enable_Clock (Points); if Id = I2C_Id_1 then Configure_Alternate_Function (Points, GPIO_AF_I2C1_4); else Configure_Alternate_Function (Points, GPIO_AF_I2C2_4); end if; Configure_IO (Points, (Speed => Speed_High, Mode => Mode_AF, Output_Type => Open_Drain, Resistors => Floating)); Lock (Points); Enable_Clock (Port); Reset (Port); end Initialize_I2C_GPIO; -------------------------------- -- Configure_User_Button_GPIO -- -------------------------------- procedure Configure_User_Button_GPIO is Config : GPIO_Port_Configuration; begin Enable_Clock (User_Button_Point); Config.Mode := Mode_In; Config.Resistors := Floating; Configure_IO (User_Button_Point, Config); end Configure_User_Button_GPIO; end STM32.Board;
------------------------------------------------------------------------------ -- -- -- Matreshka Project -- -- -- -- SQL Database Access -- -- -- -- Runtime Library Component -- -- -- ------------------------------------------------------------------------------ -- -- -- Copyright © 2011, Vadim Godunko <vgodunko@gmail.com> -- -- All rights reserved. -- -- -- -- Redistribution and use in source and binary forms, with or without -- -- modification, are permitted provided that the following conditions -- -- are met: -- -- -- -- * Redistributions of source code must retain the above copyright -- -- notice, this list of conditions and the following disclaimer. -- -- -- -- * Redistributions in binary form must reproduce the above copyright -- -- notice, this list of conditions and the following disclaimer in the -- -- documentation and/or other materials provided with the distribution. -- -- -- -- * Neither the name of the Vadim Godunko, IE nor the names of its -- -- contributors may be used to endorse or promote products derived from -- -- this software without specific prior written permission. -- -- -- -- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -- -- "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -- -- LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -- -- A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -- -- HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -- -- SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED -- -- TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -- -- PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -- -- LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -- -- NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -- -- SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -- -- -- ------------------------------------------------------------------------------ -- $Revision$ $Date$ ------------------------------------------------------------------------------ -- This package provides implementation of SQL statement parameter rewriter -- for SQLite3: every :name parameter placeholder is replaced by $N parameter -- placeholder. Duplicate names are replaced by the same parameter -- placeholder. ------------------------------------------------------------------------------ package Matreshka.Internals.SQL_Parameter_Rewriters.SQLite3 is type SQLite3_Parameter_Rewriter is new Abstract_Parameter_Rewriter with null record; overriding procedure Database_Placeholder (Self : SQLite3_Parameter_Rewriter; Name : League.Strings.Universal_String; Number : Positive; Placeholder : out League.Strings.Universal_String; Parameters : in out SQL_Parameter_Sets.Parameter_Set); -- Sets Placeholder to database specific placeholder for parameter with -- Name and number Number. Implementation must modify Parameters -- accordingly. end Matreshka.Internals.SQL_Parameter_Rewriters.SQLite3;
-- Abstract : -- -- Generic Emacs background process; packrat parse token stream, -- return parser actions. -- -- See gen_run_wisi_parse_packrat.ads for a standalone version. -- -- References : -- -- See gen_emacs_wisi_parse.ads -- -- Copyright (C) 2018 Free Software Foundation, Inc. -- -- This program is free software; you can redistribute it and/or -- modify it under terms of the GNU General Public License as -- published by the Free Software Foundation; either version 3, or (at -- your option) any later version. This program is distributed in the -- hope that it will be useful, but WITHOUT ANY WARRANTY; without even -- the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR -- PURPOSE. See the GNU General Public License for more details. You -- should have received a copy of the GNU General Public License -- distributed with this program; see file COPYING. If not, write to -- the Free Software Foundation, 51 Franklin Street, Suite 500, Boston, -- MA 02110-1335, USA. pragma License (GPL); with WisiToken.Parse.Packrat; with WisiToken.Syntax_Trees; with WisiToken.Wisi_Runtime; generic type Parse_Data_Type is new WisiToken.Wisi_Runtime.Parse_Data_Type with private; Name : in String; -- for Usage, error messages. "_wisi_parse_packrat" will be appended Descriptor : in WisiToken.Descriptor; with procedure Create_Parser (Parser : out WisiToken.Parse.Packrat.Parser; Trace : not null access WisiToken.Trace'Class; User_Data : in WisiToken.Syntax_Trees.User_Data_Access); procedure Gen_Emacs_Wisi_Parse_Packrat;
----------------------------------------------------------------------- -- asf-lifecycles-default -- Default Lifecycle handler -- Copyright (C) 2010, 2018 Stephane Carrez -- Written by Stephane Carrez (Stephane.Carrez@gmail.com) -- -- Licensed under the Apache License, Version 2.0 (the "License"); -- you may not use this file except in compliance with the License. -- You may obtain a copy of the License at -- -- http://www.apache.org/licenses/LICENSE-2.0 -- -- Unless required by applicable law or agreed to in writing, software -- distributed under the License is distributed on an "AS IS" BASIS, -- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -- See the License for the specific language governing permissions and -- limitations under the License. ----------------------------------------------------------------------- with ASF.Lifecycles.Restore; with ASF.Lifecycles.Apply; with ASF.Lifecycles.Validation; with ASF.Lifecycles.Update; with ASF.Lifecycles.Invoke; with ASF.Lifecycles.Response; package body ASF.Lifecycles.Default is -- ------------------------------ -- Creates the phase controllers by invoking the <b>Set_Controller</b> -- procedure for each phase. This is called by <b>Initialize</b> to build -- the lifecycle handler. -- ------------------------------ procedure Create_Phase_Controllers (Controller : in out Lifecycle) is use ASF.Events.Phases; begin Controller.Set_Controller (Phase => RESTORE_VIEW, Instance => new Lifecycles.Restore.Restore_Controller); Controller.Set_Controller (Phase => APPLY_REQUEST_VALUES, Instance => new Lifecycles.Apply.Apply_Controller); Controller.Set_Controller (Phase => PROCESS_VALIDATION, Instance => new Lifecycles.Validation.Validation_Controller); Controller.Set_Controller (Phase => UPDATE_MODEL_VALUES, Instance => new Lifecycles.Update.Update_Controller); Controller.Set_Controller (Phase => INVOKE_APPLICATION, Instance => new Lifecycles.Invoke.Invoke_Controller); Controller.Set_Controller (Phase => RENDER_RESPONSE, Instance => new Lifecycles.Response.Response_Controller); end Create_Phase_Controllers; -- ------------------------------ -- Initialize the the lifecycle handler. -- ------------------------------ overriding procedure Initialize (Controller : in out Lifecycle; Views : ASF.Applications.Views.View_Handler_Access) is begin Lifecycle'Class (Controller).Create_Phase_Controllers; for Phase in Controller.Controllers'Range loop Controller.Controllers (Phase).Initialize (Views); end loop; end Initialize; end ASF.Lifecycles.Default;
------------------------------------------------------------------------------ -- -- -- GNAT COMPILER COMPONENTS -- -- -- -- F N A M E -- -- -- -- S p e c -- -- -- -- Copyright (C) 1992-2014, Free Software Foundation, Inc. -- -- -- -- GNAT is free software; you can redistribute it and/or modify it under -- -- terms of the GNU General Public License as published by the Free Soft- -- -- ware Foundation; either version 3, or (at your option) any later ver- -- -- sion. GNAT is distributed in the hope that it will be useful, but WITH- -- -- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY -- -- or FITNESS FOR A PARTICULAR PURPOSE. -- -- -- -- As a special exception under Section 7 of GPL version 3, you are granted -- -- additional permissions described in the GCC Runtime Library Exception, -- -- version 3.1, as published by the Free Software Foundation. -- -- -- -- You should have received a copy of the GNU General Public License and -- -- a copy of the GCC Runtime Library Exception along with this program; -- -- see the files COPYING3 and COPYING.RUNTIME respectively. If not, see -- -- <http://www.gnu.org/licenses/>. -- -- -- -- GNAT was originally developed by the GNAT team at New York University. -- -- Extensive contributions were provided by Ada Core Technologies Inc. -- -- -- ------------------------------------------------------------------------------ -- This package, together with its child package Fname.UF define the -- association between source file names and unit names as defined -- (see package Uname for definition of format of unit names). with Namet; use Namet; package Fname is -- Note: this package spec does not depend on the Uname spec in the Ada -- sense, but the comments and description of the semantics do depend on -- the conventions established by Uname. --------------------------- -- File Name Conventions -- --------------------------- -- GNAT requires that there be a one to one correspondence between source -- file names (as used in the Osint package interface) and unit names as -- defined by the Uname package. This correspondence is defined by the -- two subprograms defined here in the Fname package. -- For full rules of file naming, see GNAT User's Guide. Note that the -- naming rules are affected by the presence of Source_File_Name pragmas -- that have been previously processed. -- Note that the file name does *not* include the directory name. The -- management of directories is provided by Osint, and full file names -- are used only for error message purposes within GNAT itself. ----------------- -- Subprograms -- ----------------- function Is_Predefined_File_Name (Fname : File_Name_Type; Renamings_Included : Boolean := True) return Boolean; -- This function determines if the given file name (which must be a simple -- file name with no directory information) is the file name for one of the -- predefined library units (i.e. part of the Ada, System, or Interface -- hierarchies). Note that units in the GNAT hierarchy are not considered -- predefined (see Is_Internal_File_Name below). On return, Name_Buffer -- contains the file name. The Renamings_Included parameter indicates -- whether annex J renamings such as Text_IO are to be considered as -- predefined. If Renamings_Included is True, then Text_IO will return -- True, otherwise only children of Ada, Interfaces and System return True. function Is_Predefined_File_Name (Renamings_Included : Boolean := True) return Boolean; -- This version is called with the file name already in Name_Buffer function Is_Internal_File_Name (Fname : File_Name_Type; Renamings_Included : Boolean := True) return Boolean; -- Similar to Is_Predefined_File_Name. The internal file set is a superset -- of the predefined file set including children of GNAT. procedure Tree_Read; -- Dummy procedure (reads dummy table values from tree file) procedure Tree_Write; -- Writes out internal tables to current tree file using Tree_Write -- This is actually a dummy routine, since the relevant table is -- no longer used, but we retain it for now, to avoid a tree file -- incompatibility with the 3.13 compiler. Should be removed for -- the 3.14a release ??? end Fname;