hexsha
stringlengths 40
40
| size
int64 3
1.05M
| ext
stringclasses 163
values | lang
stringclasses 53
values | max_stars_repo_path
stringlengths 3
945
| max_stars_repo_name
stringlengths 4
112
| max_stars_repo_head_hexsha
stringlengths 40
78
| max_stars_repo_licenses
sequencelengths 1
10
| max_stars_count
float64 1
191k
⌀ | max_stars_repo_stars_event_min_datetime
stringlengths 24
24
⌀ | max_stars_repo_stars_event_max_datetime
stringlengths 24
24
⌀ | max_issues_repo_path
stringlengths 3
945
| max_issues_repo_name
stringlengths 4
113
| max_issues_repo_head_hexsha
stringlengths 40
78
| max_issues_repo_licenses
sequencelengths 1
10
| max_issues_count
float64 1
116k
⌀ | max_issues_repo_issues_event_min_datetime
stringlengths 24
24
⌀ | max_issues_repo_issues_event_max_datetime
stringlengths 24
24
⌀ | max_forks_repo_path
stringlengths 3
945
| max_forks_repo_name
stringlengths 4
113
| max_forks_repo_head_hexsha
stringlengths 40
78
| max_forks_repo_licenses
sequencelengths 1
10
| max_forks_count
float64 1
105k
⌀ | max_forks_repo_forks_event_min_datetime
stringlengths 24
24
⌀ | max_forks_repo_forks_event_max_datetime
stringlengths 24
24
⌀ | content
stringlengths 3
1.05M
| avg_line_length
float64 1
966k
| max_line_length
int64 1
977k
| alphanum_fraction
float64 0
1
|
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
5e68747018a99d701a4dcddc1c333e5c0b42a3ed | 2,427 | ads | Ada | arch/ARM/STM32/driversL4x6/stm32-power_control.ads | morbos/Ada_Drivers_Library | a4ab26799be60997c38735f4056160c4af597ef7 | [
"BSD-3-Clause"
] | 2 | 2018-05-16T03:56:39.000Z | 2019-07-31T13:53:56.000Z | arch/ARM/STM32/driversL5/stm32-power_control.ads | morbos/Ada_Drivers_Library | a4ab26799be60997c38735f4056160c4af597ef7 | [
"BSD-3-Clause"
] | null | null | null | arch/ARM/STM32/driversL5/stm32-power_control.ads | morbos/Ada_Drivers_Library | a4ab26799be60997c38735f4056160c4af597ef7 | [
"BSD-3-Clause"
] | null | null | null | ------------------------------------------------------------------------------
-- --
-- Copyright (C) 2016, AdaCore --
-- --
-- Redistribution and use in source and binary forms, with or without --
-- modification, are permitted provided that the following conditions are --
-- met: --
-- 1. Redistributions of source code must retain the above copyright --
-- notice, this list of conditions and the following disclaimer. --
-- 2. Redistributions in binary form must reproduce the above copyright --
-- notice, this list of conditions and the following disclaimer in --
-- the documentation and/or other materials provided with the --
-- distribution. --
-- 3. Neither the name of the copyright holder nor the names of its --
-- contributors may be used to endorse or promote products derived --
-- from this software without specific prior written permission. --
-- --
-- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS --
-- "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT --
-- LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR --
-- A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT --
-- HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, --
-- SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT --
-- LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, --
-- DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY --
-- THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT --
-- (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE --
-- OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. --
-- --
------------------------------------------------------------------------------
package STM32.Power_Control is
end STM32.Power_Control;
| 71.382353 | 78 | 0.510507 |
19dd67ada05ecba7771467efb6b38cf23565cb96 | 3,644 | ads | Ada | source/amf/uml/amf-uml-broadcast_signal_actions-hash.ads | svn2github/matreshka | 9d222b3ad9da508855fb1f5adbe5e8a4fad4c530 | [
"BSD-3-Clause"
] | 24 | 2016-11-29T06:59:41.000Z | 2021-08-30T11:55:16.000Z | source/amf/uml/amf-uml-broadcast_signal_actions-hash.ads | svn2github/matreshka | 9d222b3ad9da508855fb1f5adbe5e8a4fad4c530 | [
"BSD-3-Clause"
] | 2 | 2019-01-16T05:15:20.000Z | 2019-02-03T10:03:32.000Z | source/amf/uml/amf-uml-broadcast_signal_actions-hash.ads | svn2github/matreshka | 9d222b3ad9da508855fb1f5adbe5e8a4fad4c530 | [
"BSD-3-Clause"
] | 4 | 2017-07-18T07:11:05.000Z | 2020-06-21T03:02:25.000Z | ------------------------------------------------------------------------------
-- --
-- Matreshka Project --
-- --
-- Ada Modeling Framework --
-- --
-- Runtime Library Component --
-- --
------------------------------------------------------------------------------
-- --
-- Copyright © 2011-2012, Vadim Godunko <[email protected]> --
-- All rights reserved. --
-- --
-- Redistribution and use in source and binary forms, with or without --
-- modification, are permitted provided that the following conditions --
-- are met: --
-- --
-- * Redistributions of source code must retain the above copyright --
-- notice, this list of conditions and the following disclaimer. --
-- --
-- * Redistributions in binary form must reproduce the above copyright --
-- notice, this list of conditions and the following disclaimer in the --
-- documentation and/or other materials provided with the distribution. --
-- --
-- * Neither the name of the Vadim Godunko, IE nor the names of its --
-- contributors may be used to endorse or promote products derived from --
-- this software without specific prior written permission. --
-- --
-- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS --
-- "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT --
-- LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR --
-- A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT --
-- HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, --
-- SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED --
-- TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR --
-- PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF --
-- LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING --
-- NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS --
-- SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. --
-- --
------------------------------------------------------------------------------
-- $Revision$ $Date$
------------------------------------------------------------------------------
-- This file is generated, don't edit it.
------------------------------------------------------------------------------
with AMF.Elements.Generic_Hash;
function AMF.UML.Broadcast_Signal_Actions.Hash is
new AMF.Elements.Generic_Hash (UML_Broadcast_Signal_Action, UML_Broadcast_Signal_Action_Access);
| 72.88 | 98 | 0.407794 |
1906acd821a3ca34586510c1d3c9095074aed4fe | 1,186 | ada | Ada | demos/en.ada | daveshields/AdaEd | 57daecfb7ccadfd9aaf13b4d54f51065affbe599 | [
"BSD-4-Clause",
"BSD-3-Clause"
] | 3 | 2019-05-11T04:11:33.000Z | 2021-04-18T14:55:43.000Z | demos/en.ada | daveshields/AdaEd | 57daecfb7ccadfd9aaf13b4d54f51065affbe599 | [
"BSD-4-Clause",
"BSD-3-Clause"
] | null | null | null | demos/en.ada | daveshields/AdaEd | 57daecfb7ccadfd9aaf13b4d54f51065affbe599 | [
"BSD-4-Clause",
"BSD-3-Clause"
] | 2 | 2016-10-29T22:52:56.000Z | 2021-04-18T14:55:45.000Z | -- DEMONSTRATION EXAMPLE:
-- Features:
-- Enumeration types, ENUM_IO (generic package),
-- arrays, dynamic exception handling, etc.
with TEXT_IO; use TEXT_IO;
procedure en is
type COLOR is (red, yellow, green, blue);
package COLOR_IO is new ENUMERATION_IO(COLOR);
ANSWER : constant array (red .. blue) of string (1..10) :=
("Anger ", "The Sun ", "Ada ",
"The Sky ");
procedure DIALOGUE is
use COLOR_IO;
CHOICE : COLOR;
function ENTER_COLOR return COLOR is
CHOICE : COLOR;
begin
loop
declare
begin
put_line("Select a color:");
get(CHOICE);
return CHOICE;
exception
when DATA_ERROR =>
put_line("Invalid color, try again. ");
end;
end loop;
end ENTER_COLOR;
begin -- body of DIALOGUE
loop
CHOICE := ENTER_COLOR;
put(CHOICE, SET => LOWER_CASE);
put_line(" => " & ANSWER(CHOICE));
end loop;
end DIALOGUE;
begin
DIALOGUE;
exception
when END_ERROR => put_line("End of dialogue.");
end en;
| 23.254902 | 61 | 0.538786 |
d16645bda7f7768ae8d696d39e1706fce3b88e50 | 94 | adb | Ada | applet/aide/source/palettes/aide-palette.adb | charlie5/aIDE | fab406dbcd9b72a4cb215ffebb05166c788d6365 | [
"MIT"
] | 3 | 2017-04-29T14:25:22.000Z | 2017-09-29T10:15:28.000Z | applet/aide/source/palettes/aide-palette.adb | charlie5/aIDE | fab406dbcd9b72a4cb215ffebb05166c788d6365 | [
"MIT"
] | null | null | null | applet/aide/source/palettes/aide-palette.adb | charlie5/aIDE | fab406dbcd9b72a4cb215ffebb05166c788d6365 | [
"MIT"
] | null | null | null | package body aIDE.Palette
is
procedure dummy is begin null; end dummy;
end aIDE.Palette;
| 13.428571 | 44 | 0.755319 |
0454a48e733c0f4528a03463a3f8685c3cecedd8 | 14,495 | ads | Ada | bb-runtimes/runtimes/zfp-stm32f3x4/gnat/i-stm32-gpio.ads | JCGobbi/Nucleo-STM32F334R8 | 2a0b1b4b2664c92773703ac5e95dcb71979d051c | [
"BSD-3-Clause"
] | null | null | null | bb-runtimes/runtimes/zfp-stm32f3x4/gnat/i-stm32-gpio.ads | JCGobbi/Nucleo-STM32F334R8 | 2a0b1b4b2664c92773703ac5e95dcb71979d051c | [
"BSD-3-Clause"
] | null | null | null | bb-runtimes/runtimes/zfp-stm32f3x4/gnat/i-stm32-gpio.ads | JCGobbi/Nucleo-STM32F334R8 | 2a0b1b4b2664c92773703ac5e95dcb71979d051c | [
"BSD-3-Clause"
] | null | null | null | --
-- Copyright (C) 2022, AdaCore
--
pragma Style_Checks (Off);
-- This spec has been automatically generated from STM32F3x4.svd
with System;
package Interfaces.STM32.GPIO is
pragma Preelaborate;
pragma No_Elaboration_Code_All;
---------------
-- Registers --
---------------
-- MODER array element
subtype MODER_Element is Interfaces.STM32.UInt2;
-- MODER array
type MODER_Field_Array is array (0 .. 15) of MODER_Element
with Component_Size => 2, Size => 32;
-- GPIO port mode register
type MODER_Register
(As_Array : Boolean := False)
is record
case As_Array is
when False =>
-- MODER as a value
Val : Interfaces.STM32.UInt32;
when True =>
-- MODER as an array
Arr : MODER_Field_Array;
end case;
end record
with Unchecked_Union, Size => 32, Volatile_Full_Access, Object_Size => 32,
Bit_Order => System.Low_Order_First;
for MODER_Register use record
Val at 0 range 0 .. 31;
Arr at 0 range 0 .. 31;
end record;
-- OTYPER_OT array element
subtype OTYPER_OT_Element is Interfaces.STM32.Bit;
-- OTYPER_OT array
type OTYPER_OT_Field_Array is array (0 .. 15) of OTYPER_OT_Element
with Component_Size => 1, Size => 16;
-- Type definition for OTYPER_OT
type OTYPER_OT_Field
(As_Array : Boolean := False)
is record
case As_Array is
when False =>
-- OT as a value
Val : Interfaces.STM32.UInt16;
when True =>
-- OT as an array
Arr : OTYPER_OT_Field_Array;
end case;
end record
with Unchecked_Union, Size => 16;
for OTYPER_OT_Field use record
Val at 0 range 0 .. 15;
Arr at 0 range 0 .. 15;
end record;
-- GPIO port output type register
type OTYPER_Register is record
-- Port x configuration bits (y = 0..15)
OT : OTYPER_OT_Field := (As_Array => False, Val => 16#0#);
-- unspecified
Reserved_16_31 : Interfaces.STM32.UInt16 := 16#0#;
end record
with Volatile_Full_Access, Object_Size => 32,
Bit_Order => System.Low_Order_First;
for OTYPER_Register use record
OT at 0 range 0 .. 15;
Reserved_16_31 at 0 range 16 .. 31;
end record;
-- OSPEEDR array element
subtype OSPEEDR_Element is Interfaces.STM32.UInt2;
-- OSPEEDR array
type OSPEEDR_Field_Array is array (0 .. 15) of OSPEEDR_Element
with Component_Size => 2, Size => 32;
-- GPIO port output speed register
type OSPEEDR_Register
(As_Array : Boolean := False)
is record
case As_Array is
when False =>
-- OSPEEDR as a value
Val : Interfaces.STM32.UInt32;
when True =>
-- OSPEEDR as an array
Arr : OSPEEDR_Field_Array;
end case;
end record
with Unchecked_Union, Size => 32, Volatile_Full_Access, Object_Size => 32,
Bit_Order => System.Low_Order_First;
for OSPEEDR_Register use record
Val at 0 range 0 .. 31;
Arr at 0 range 0 .. 31;
end record;
-- PUPDR array element
subtype PUPDR_Element is Interfaces.STM32.UInt2;
-- PUPDR array
type PUPDR_Field_Array is array (0 .. 15) of PUPDR_Element
with Component_Size => 2, Size => 32;
-- GPIO port pull-up/pull-down register
type PUPDR_Register
(As_Array : Boolean := False)
is record
case As_Array is
when False =>
-- PUPDR as a value
Val : Interfaces.STM32.UInt32;
when True =>
-- PUPDR as an array
Arr : PUPDR_Field_Array;
end case;
end record
with Unchecked_Union, Size => 32, Volatile_Full_Access, Object_Size => 32,
Bit_Order => System.Low_Order_First;
for PUPDR_Register use record
Val at 0 range 0 .. 31;
Arr at 0 range 0 .. 31;
end record;
-- IDR array element
subtype IDR_Element is Interfaces.STM32.Bit;
-- IDR array
type IDR_Field_Array is array (0 .. 15) of IDR_Element
with Component_Size => 1, Size => 16;
-- Type definition for IDR
type IDR_Field
(As_Array : Boolean := False)
is record
case As_Array is
when False =>
-- IDR as a value
Val : Interfaces.STM32.UInt16;
when True =>
-- IDR as an array
Arr : IDR_Field_Array;
end case;
end record
with Unchecked_Union, Size => 16;
for IDR_Field use record
Val at 0 range 0 .. 15;
Arr at 0 range 0 .. 15;
end record;
-- GPIO port input data register
type IDR_Register is record
-- Read-only. Port input data (y = 0..15)
IDR : IDR_Field;
-- unspecified
Reserved_16_31 : Interfaces.STM32.UInt16;
end record
with Volatile_Full_Access, Object_Size => 32,
Bit_Order => System.Low_Order_First;
for IDR_Register use record
IDR at 0 range 0 .. 15;
Reserved_16_31 at 0 range 16 .. 31;
end record;
-- ODR array element
subtype ODR_Element is Interfaces.STM32.Bit;
-- ODR array
type ODR_Field_Array is array (0 .. 15) of ODR_Element
with Component_Size => 1, Size => 16;
-- Type definition for ODR
type ODR_Field
(As_Array : Boolean := False)
is record
case As_Array is
when False =>
-- ODR as a value
Val : Interfaces.STM32.UInt16;
when True =>
-- ODR as an array
Arr : ODR_Field_Array;
end case;
end record
with Unchecked_Union, Size => 16;
for ODR_Field use record
Val at 0 range 0 .. 15;
Arr at 0 range 0 .. 15;
end record;
-- GPIO port output data register
type ODR_Register is record
-- Port output data (y = 0..15)
ODR : ODR_Field := (As_Array => False, Val => 16#0#);
-- unspecified
Reserved_16_31 : Interfaces.STM32.UInt16 := 16#0#;
end record
with Volatile_Full_Access, Object_Size => 32,
Bit_Order => System.Low_Order_First;
for ODR_Register use record
ODR at 0 range 0 .. 15;
Reserved_16_31 at 0 range 16 .. 31;
end record;
-- BSRR_BS array element
subtype BSRR_BS_Element is Interfaces.STM32.Bit;
-- BSRR_BS array
type BSRR_BS_Field_Array is array (0 .. 15) of BSRR_BS_Element
with Component_Size => 1, Size => 16;
-- Type definition for BSRR_BS
type BSRR_BS_Field
(As_Array : Boolean := False)
is record
case As_Array is
when False =>
-- BS as a value
Val : Interfaces.STM32.UInt16;
when True =>
-- BS as an array
Arr : BSRR_BS_Field_Array;
end case;
end record
with Unchecked_Union, Size => 16;
for BSRR_BS_Field use record
Val at 0 range 0 .. 15;
Arr at 0 range 0 .. 15;
end record;
-- BSRR_BR array element
subtype BSRR_BR_Element is Interfaces.STM32.Bit;
-- BSRR_BR array
type BSRR_BR_Field_Array is array (0 .. 15) of BSRR_BR_Element
with Component_Size => 1, Size => 16;
-- Type definition for BSRR_BR
type BSRR_BR_Field
(As_Array : Boolean := False)
is record
case As_Array is
when False =>
-- BR as a value
Val : Interfaces.STM32.UInt16;
when True =>
-- BR as an array
Arr : BSRR_BR_Field_Array;
end case;
end record
with Unchecked_Union, Size => 16;
for BSRR_BR_Field use record
Val at 0 range 0 .. 15;
Arr at 0 range 0 .. 15;
end record;
-- GPIO port bit set/reset register
type BSRR_Register is record
-- Write-only. Port x set bit y (y= 0..15)
BS : BSRR_BS_Field := (As_Array => False, Val => 16#0#);
-- Write-only. Port x set bit y (y= 0..15)
BR : BSRR_BR_Field := (As_Array => False, Val => 16#0#);
end record
with Volatile_Full_Access, Object_Size => 32,
Bit_Order => System.Low_Order_First;
for BSRR_Register use record
BS at 0 range 0 .. 15;
BR at 0 range 16 .. 31;
end record;
-- LCKR_LCK array element
subtype LCKR_LCK_Element is Interfaces.STM32.Bit;
-- LCKR_LCK array
type LCKR_LCK_Field_Array is array (0 .. 15) of LCKR_LCK_Element
with Component_Size => 1, Size => 16;
-- Type definition for LCKR_LCK
type LCKR_LCK_Field
(As_Array : Boolean := False)
is record
case As_Array is
when False =>
-- LCK as a value
Val : Interfaces.STM32.UInt16;
when True =>
-- LCK as an array
Arr : LCKR_LCK_Field_Array;
end case;
end record
with Unchecked_Union, Size => 16;
for LCKR_LCK_Field use record
Val at 0 range 0 .. 15;
Arr at 0 range 0 .. 15;
end record;
subtype LCKR_LCKK_Field is Interfaces.STM32.Bit;
-- GPIO port configuration lock register
type LCKR_Register is record
-- Port x lock bit y (y= 0..15)
LCK : LCKR_LCK_Field := (As_Array => False, Val => 16#0#);
-- Lok Key
LCKK : LCKR_LCKK_Field := 16#0#;
-- unspecified
Reserved_17_31 : Interfaces.STM32.UInt15 := 16#0#;
end record
with Volatile_Full_Access, Object_Size => 32,
Bit_Order => System.Low_Order_First;
for LCKR_Register use record
LCK at 0 range 0 .. 15;
LCKK at 0 range 16 .. 16;
Reserved_17_31 at 0 range 17 .. 31;
end record;
-- AFRL array element
subtype AFRL_Element is Interfaces.STM32.UInt4;
-- AFRL array
type AFRL_Field_Array is array (0 .. 7) of AFRL_Element
with Component_Size => 4, Size => 32;
-- GPIO alternate function low register
type AFRL_Register
(As_Array : Boolean := False)
is record
case As_Array is
when False =>
-- AFRL as a value
Val : Interfaces.STM32.UInt32;
when True =>
-- AFRL as an array
Arr : AFRL_Field_Array;
end case;
end record
with Unchecked_Union, Size => 32, Volatile_Full_Access, Object_Size => 32,
Bit_Order => System.Low_Order_First;
for AFRL_Register use record
Val at 0 range 0 .. 31;
Arr at 0 range 0 .. 31;
end record;
-- AFRH array element
subtype AFRH_Element is Interfaces.STM32.UInt4;
-- AFRH array
type AFRH_Field_Array is array (8 .. 15) of AFRH_Element
with Component_Size => 4, Size => 32;
-- GPIO alternate function high register
type AFRH_Register
(As_Array : Boolean := False)
is record
case As_Array is
when False =>
-- AFRH as a value
Val : Interfaces.STM32.UInt32;
when True =>
-- AFRH as an array
Arr : AFRH_Field_Array;
end case;
end record
with Unchecked_Union, Size => 32, Volatile_Full_Access, Object_Size => 32,
Bit_Order => System.Low_Order_First;
for AFRH_Register use record
Val at 0 range 0 .. 31;
Arr at 0 range 0 .. 31;
end record;
-- BRR_BR array element
subtype BRR_BR_Element is Interfaces.STM32.Bit;
-- BRR_BR array
type BRR_BR_Field_Array is array (0 .. 15) of BRR_BR_Element
with Component_Size => 1, Size => 16;
-- Type definition for BRR_BR
type BRR_BR_Field
(As_Array : Boolean := False)
is record
case As_Array is
when False =>
-- BR as a value
Val : Interfaces.STM32.UInt16;
when True =>
-- BR as an array
Arr : BRR_BR_Field_Array;
end case;
end record
with Unchecked_Union, Size => 16;
for BRR_BR_Field use record
Val at 0 range 0 .. 15;
Arr at 0 range 0 .. 15;
end record;
-- Port bit reset register
type BRR_Register is record
-- Write-only. Port x Reset bit y
BR : BRR_BR_Field := (As_Array => False, Val => 16#0#);
-- unspecified
Reserved_16_31 : Interfaces.STM32.UInt16 := 16#0#;
end record
with Volatile_Full_Access, Object_Size => 32,
Bit_Order => System.Low_Order_First;
for BRR_Register use record
BR at 0 range 0 .. 15;
Reserved_16_31 at 0 range 16 .. 31;
end record;
-----------------
-- Peripherals --
-----------------
-- General-purpose I/Os
type GPIO_Peripheral is record
-- GPIO port mode register
MODER : aliased MODER_Register;
-- GPIO port output type register
OTYPER : aliased OTYPER_Register;
-- GPIO port output speed register
OSPEEDR : aliased OSPEEDR_Register;
-- GPIO port pull-up/pull-down register
PUPDR : aliased PUPDR_Register;
-- GPIO port input data register
IDR : aliased IDR_Register;
-- GPIO port output data register
ODR : aliased ODR_Register;
-- GPIO port bit set/reset register
BSRR : aliased BSRR_Register;
-- GPIO port configuration lock register
LCKR : aliased LCKR_Register;
-- GPIO alternate function low register
AFRL : aliased AFRL_Register;
-- GPIO alternate function high register
AFRH : aliased AFRH_Register;
-- Port bit reset register
BRR : aliased BRR_Register;
end record
with Volatile;
for GPIO_Peripheral use record
MODER at 16#0# range 0 .. 31;
OTYPER at 16#4# range 0 .. 31;
OSPEEDR at 16#8# range 0 .. 31;
PUPDR at 16#C# range 0 .. 31;
IDR at 16#10# range 0 .. 31;
ODR at 16#14# range 0 .. 31;
BSRR at 16#18# range 0 .. 31;
LCKR at 16#1C# range 0 .. 31;
AFRL at 16#20# range 0 .. 31;
AFRH at 16#24# range 0 .. 31;
BRR at 16#28# range 0 .. 31;
end record;
-- General-purpose I/Os
GPIOA_Periph : aliased GPIO_Peripheral
with Import, Address => GPIOA_Base;
-- General-purpose I/Os
GPIOB_Periph : aliased GPIO_Peripheral
with Import, Address => GPIOB_Base;
-- General-purpose I/Os
GPIOC_Periph : aliased GPIO_Peripheral
with Import, Address => GPIOC_Base;
-- General-purpose I/Os
GPIOD_Periph : aliased GPIO_Peripheral
with Import, Address => GPIOD_Base;
-- General-purpose I/Os
GPIOF_Periph : aliased GPIO_Peripheral
with Import, Address => GPIOF_Base;
end Interfaces.STM32.GPIO;
| 28.421569 | 79 | 0.598068 |
19607d703cf640489b2da3dca1e5bb814f428c64 | 1,606 | ads | Ada | regtests/util-properties-tests.ads | My-Colaborations/ada-util | 039b219f8247e541e281bba73b61f683c52db579 | [
"Apache-2.0"
] | null | null | null | regtests/util-properties-tests.ads | My-Colaborations/ada-util | 039b219f8247e541e281bba73b61f683c52db579 | [
"Apache-2.0"
] | null | null | null | regtests/util-properties-tests.ads | My-Colaborations/ada-util | 039b219f8247e541e281bba73b61f683c52db579 | [
"Apache-2.0"
] | null | null | null | -----------------------------------------------------------------------
-- Util -- Utilities
-- Copyright (C) 2009, 2010, 2011, 2014, 2017, 2020 Stephane Carrez
-- Written by Stephane Carrez ([email protected])
--
-- Licensed under the Apache License, Version 2.0 (the "License");
-- you may not use this file except in compliance with the License.
-- You may obtain a copy of the License at
--
-- http://www.apache.org/licenses/LICENSE-2.0
--
-- Unless required by applicable law or agreed to in writing, software
-- distributed under the License is distributed on an "AS IS" BASIS,
-- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-- See the License for the specific language governing permissions and
-- limitations under the License.
-----------------------------------------------------------------------
with Util.Tests;
package Util.Properties.Tests is
procedure Add_Tests (Suite : in Util.Tests.Access_Test_Suite);
type Test is new Util.Tests.Test with null record;
procedure Test_Property (T : in out Test);
procedure Test_Integer_Property (T : in out Test);
procedure Test_Load_Property (T : in out Test);
procedure Test_Load_Strip_Property (T : in out Test);
procedure Test_Copy_Property (T : in out Test);
procedure Test_Set_Preserve_Original (T : in out Test);
procedure Test_Remove_Preserve_Original (T : in out Test);
procedure Test_Missing_Property (T : in out Test);
procedure Test_Load_Ini_Property (T : in out Test);
procedure Test_Save_Properties (T : in out Test);
end Util.Properties.Tests;
| 41.179487 | 76 | 0.671233 |
5ebc92275c376c035fd0bcd6e6700ecef55d43a8 | 4,327 | adb | Ada | source/nodes/program-nodes-formal_ordinary_fixed_point_definitions.adb | optikos/oasis | 9f64d46d26d964790d69f9db681c874cfb3bf96d | [
"MIT"
] | null | null | null | source/nodes/program-nodes-formal_ordinary_fixed_point_definitions.adb | optikos/oasis | 9f64d46d26d964790d69f9db681c874cfb3bf96d | [
"MIT"
] | null | null | null | source/nodes/program-nodes-formal_ordinary_fixed_point_definitions.adb | optikos/oasis | 9f64d46d26d964790d69f9db681c874cfb3bf96d | [
"MIT"
] | 2 | 2019-09-14T23:18:50.000Z | 2019-10-02T10:11:40.000Z | -- Copyright (c) 2019 Maxim Reznik <[email protected]>
--
-- SPDX-License-Identifier: MIT
-- License-Filename: LICENSE
-------------------------------------------------------------
package body Program.Nodes.Formal_Ordinary_Fixed_Point_Definitions is
function Create
(Delta_Token : not null Program.Lexical_Elements.Lexical_Element_Access;
Box_Token : not null Program.Lexical_Elements.Lexical_Element_Access)
return Formal_Ordinary_Fixed_Point_Definition is
begin
return Result : Formal_Ordinary_Fixed_Point_Definition :=
(Delta_Token => Delta_Token, Box_Token => Box_Token,
Enclosing_Element => null)
do
Initialize (Result);
end return;
end Create;
function Create
(Is_Part_Of_Implicit : Boolean := False;
Is_Part_Of_Inherited : Boolean := False;
Is_Part_Of_Instance : Boolean := False)
return Implicit_Formal_Ordinary_Fixed_Point_Definition is
begin
return Result : Implicit_Formal_Ordinary_Fixed_Point_Definition :=
(Is_Part_Of_Implicit => Is_Part_Of_Implicit,
Is_Part_Of_Inherited => Is_Part_Of_Inherited,
Is_Part_Of_Instance => Is_Part_Of_Instance, Enclosing_Element => null)
do
Initialize (Result);
end return;
end Create;
overriding function Delta_Token
(Self : Formal_Ordinary_Fixed_Point_Definition)
return not null Program.Lexical_Elements.Lexical_Element_Access is
begin
return Self.Delta_Token;
end Delta_Token;
overriding function Box_Token
(Self : Formal_Ordinary_Fixed_Point_Definition)
return not null Program.Lexical_Elements.Lexical_Element_Access is
begin
return Self.Box_Token;
end Box_Token;
overriding function Is_Part_Of_Implicit
(Self : Implicit_Formal_Ordinary_Fixed_Point_Definition)
return Boolean is
begin
return Self.Is_Part_Of_Implicit;
end Is_Part_Of_Implicit;
overriding function Is_Part_Of_Inherited
(Self : Implicit_Formal_Ordinary_Fixed_Point_Definition)
return Boolean is
begin
return Self.Is_Part_Of_Inherited;
end Is_Part_Of_Inherited;
overriding function Is_Part_Of_Instance
(Self : Implicit_Formal_Ordinary_Fixed_Point_Definition)
return Boolean is
begin
return Self.Is_Part_Of_Instance;
end Is_Part_Of_Instance;
procedure Initialize
(Self : aliased in out Base_Formal_Ordinary_Fixed_Point_Definition'Class)
is
begin
null;
end Initialize;
overriding function Is_Formal_Ordinary_Fixed_Point_Definition_Element
(Self : Base_Formal_Ordinary_Fixed_Point_Definition)
return Boolean is
pragma Unreferenced (Self);
begin
return True;
end Is_Formal_Ordinary_Fixed_Point_Definition_Element;
overriding function Is_Formal_Type_Definition_Element
(Self : Base_Formal_Ordinary_Fixed_Point_Definition)
return Boolean is
pragma Unreferenced (Self);
begin
return True;
end Is_Formal_Type_Definition_Element;
overriding function Is_Definition_Element
(Self : Base_Formal_Ordinary_Fixed_Point_Definition)
return Boolean is
pragma Unreferenced (Self);
begin
return True;
end Is_Definition_Element;
overriding procedure Visit
(Self : not null access Base_Formal_Ordinary_Fixed_Point_Definition;
Visitor : in out Program.Element_Visitors.Element_Visitor'Class) is
begin
Visitor.Formal_Ordinary_Fixed_Point_Definition (Self);
end Visit;
overriding function To_Formal_Ordinary_Fixed_Point_Definition_Text
(Self : aliased in out Formal_Ordinary_Fixed_Point_Definition)
return Program.Elements.Formal_Ordinary_Fixed_Point_Definitions
.Formal_Ordinary_Fixed_Point_Definition_Text_Access is
begin
return Self'Unchecked_Access;
end To_Formal_Ordinary_Fixed_Point_Definition_Text;
overriding function To_Formal_Ordinary_Fixed_Point_Definition_Text
(Self : aliased in out Implicit_Formal_Ordinary_Fixed_Point_Definition)
return Program.Elements.Formal_Ordinary_Fixed_Point_Definitions
.Formal_Ordinary_Fixed_Point_Definition_Text_Access is
pragma Unreferenced (Self);
begin
return null;
end To_Formal_Ordinary_Fixed_Point_Definition_Text;
end Program.Nodes.Formal_Ordinary_Fixed_Point_Definitions;
| 33.804688 | 79 | 0.755258 |
5ed3a776f7ad29db985fb7a8cc81c60bbfbfb478 | 11,549 | adb | Ada | .build/ada/asis-gela-elements-clause-rep.adb | faelys/gela-asis | 48a3bee90eda9f0c9d958b4e3c80a5a9b1c65253 | [
"BSD-3-Clause"
] | 4 | 2016-02-05T15:51:56.000Z | 2022-03-25T20:38:32.000Z | .build/ada/asis-gela-elements-clause-rep.adb | faelys/gela-asis | 48a3bee90eda9f0c9d958b4e3c80a5a9b1c65253 | [
"BSD-3-Clause"
] | null | null | null | .build/ada/asis-gela-elements-clause-rep.adb | faelys/gela-asis | 48a3bee90eda9f0c9d958b4e3c80a5a9b1c65253 | [
"BSD-3-Clause"
] | null | null | null |
------------------------------------------------------------------------------
-- Copyright (c) 2006-2013, Maxim Reznik
-- All rights reserved.
--
-- Redistribution and use in source and binary forms, with or without
-- modification, are permitted provided that the following conditions are met:
--
-- * Redistributions of source code must retain the above copyright notice,
-- this list of conditions and the following disclaimer.
-- * Redistributions in binary form must reproduce the above copyright
-- notice, this list of conditions and the following disclaimer in the
-- documentation and/or other materials provided with the distribution.
-- * Neither the name of the Maxim Reznik, IE nor the names of its
-- contributors may be used to endorse or promote products derived from
-- this software without specific prior written permission.
--
-- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
-- AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-- IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
-- ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
-- LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
-- CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
-- SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
-- INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
-- CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
-- ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
-- POSSIBILITY OF SUCH DAMAGE.
------------------------------------------------------------------------------
package body Asis.Gela.Elements.Clause.Rep is
function Mod_Clause_Expression
(Element : Record_Representation_Clause_Node) return Asis.Expression is
begin
return Element.Mod_Clause_Expression;
end Mod_Clause_Expression;
procedure Set_Mod_Clause_Expression
(Element : in out Record_Representation_Clause_Node;
Value : in Asis.Expression) is
begin
Element.Mod_Clause_Expression := Value;
end Set_Mod_Clause_Expression;
function Component_Clauses
(Element : Record_Representation_Clause_Node;
Include_Pragmas : in Boolean := False) return Asis.Element_List is
begin
return Primary_Clause_Lists.To_Element_List
(Element.Component_Clauses, Include_Pragmas);
end Component_Clauses;
procedure Set_Component_Clauses
(Element : in out Record_Representation_Clause_Node;
Value : in Asis.Element) is
begin
Element.Component_Clauses := Primary_Clause_Lists.List (Value);
end Set_Component_Clauses;
function Component_Clauses_List
(Element : Record_Representation_Clause_Node) return Asis.Element is
begin
return Asis.Element (Element.Component_Clauses);
end Component_Clauses_List;
function New_Record_Representation_Clause_Node
(The_Context : ASIS.Context)
return Record_Representation_Clause_Ptr
is
Result : Record_Representation_Clause_Ptr :=
new Record_Representation_Clause_Node;
begin
Set_Enclosing_Compilation_Unit
(Result.all, Current_Unit (The_Context.all));
return Result;
end New_Record_Representation_Clause_Node;
function Representation_Clause_Kind (Element : Record_Representation_Clause_Node)
return Asis.Representation_Clause_Kinds is
begin
return A_Record_Representation_Clause;
end;
function Children (Element : access Record_Representation_Clause_Node)
return Traverse_List is
begin
return ((False, Element.Representation_Clause_Name'Access),
(False, Element.Mod_Clause_Expression'Access),
(True, Asis.Element (Element.Component_Clauses)));
end Children;
function Clone
(Element : Record_Representation_Clause_Node;
Parent : Asis.Element)
return Asis.Element
is
Result : constant Record_Representation_Clause_Ptr := new Record_Representation_Clause_Node;
begin
Result.Enclosing_Element := Parent;
Result.Is_Part_Of_Implicit := Element.Is_Part_Of_Implicit;
Result.Is_Part_Of_Inherited := Element.Is_Part_Of_Inherited;
Result.Is_Part_Of_Instance := Element.Is_Part_Of_Instance;
Result.Start_Position := Element.Start_Position;
Result.End_Position := Element.End_Position;
Result.Enclosing_Compilation_Unit :=
Enclosing_Compilation_Unit (Parent.all);
Result.Hash := Element.Hash;
Result.Place := Element.Place;
return Asis.Element (Result);
end Clone;
procedure Copy
(Source : in Asis.Element;
Target : access Record_Representation_Clause_Node;
Cloner : in Cloner_Class;
Parent : in Asis.Element)
is
begin
Target.Representation_Clause_Name :=
Copy (Cloner, Representation_Clause_Name (Source.all), Asis.Element (Target));
Target.Mod_Clause_Expression :=
Copy (Cloner, Mod_Clause_Expression (Source.all), Asis.Element (Target));
Set_Component_Clauses
(Target.all,
Primary_Clause_Lists.Deep_Copy
(Component_Clauses (Source.all), Cloner, Asis.Element (Target)));
end Copy;
function Representation_Clause_Expression
(Element : At_Clause_Node) return Asis.Expression is
begin
return Element.Representation_Clause_Expression;
end Representation_Clause_Expression;
procedure Set_Representation_Clause_Expression
(Element : in out At_Clause_Node;
Value : in Asis.Expression) is
begin
Element.Representation_Clause_Expression := Value;
end Set_Representation_Clause_Expression;
function New_At_Clause_Node
(The_Context : ASIS.Context)
return At_Clause_Ptr
is
Result : At_Clause_Ptr :=
new At_Clause_Node;
begin
Set_Enclosing_Compilation_Unit
(Result.all, Current_Unit (The_Context.all));
return Result;
end New_At_Clause_Node;
function Representation_Clause_Kind (Element : At_Clause_Node)
return Asis.Representation_Clause_Kinds is
begin
return An_At_Clause;
end;
function Children (Element : access At_Clause_Node)
return Traverse_List is
begin
return ((False, Element.Representation_Clause_Name'Access),
(False, Element.Representation_Clause_Expression'Access));
end Children;
function Clone
(Element : At_Clause_Node;
Parent : Asis.Element)
return Asis.Element
is
Result : constant At_Clause_Ptr := new At_Clause_Node;
begin
Result.Enclosing_Element := Parent;
Result.Is_Part_Of_Implicit := Element.Is_Part_Of_Implicit;
Result.Is_Part_Of_Inherited := Element.Is_Part_Of_Inherited;
Result.Is_Part_Of_Instance := Element.Is_Part_Of_Instance;
Result.Start_Position := Element.Start_Position;
Result.End_Position := Element.End_Position;
Result.Enclosing_Compilation_Unit :=
Enclosing_Compilation_Unit (Parent.all);
Result.Hash := Element.Hash;
Result.Place := Element.Place;
return Asis.Element (Result);
end Clone;
procedure Copy
(Source : in Asis.Element;
Target : access At_Clause_Node;
Cloner : in Cloner_Class;
Parent : in Asis.Element)
is
begin
Target.Representation_Clause_Name :=
Copy (Cloner, Representation_Clause_Name (Source.all), Asis.Element (Target));
Target.Representation_Clause_Expression :=
Copy (Cloner, Representation_Clause_Expression (Source.all), Asis.Element (Target));
end Copy;
function New_Attribute_Definition_Clause_Node
(The_Context : ASIS.Context)
return Attribute_Definition_Clause_Ptr
is
Result : Attribute_Definition_Clause_Ptr :=
new Attribute_Definition_Clause_Node;
begin
Set_Enclosing_Compilation_Unit
(Result.all, Current_Unit (The_Context.all));
return Result;
end New_Attribute_Definition_Clause_Node;
function Representation_Clause_Kind (Element : Attribute_Definition_Clause_Node)
return Asis.Representation_Clause_Kinds is
begin
return An_Attribute_Definition_Clause;
end;
function Clone
(Element : Attribute_Definition_Clause_Node;
Parent : Asis.Element)
return Asis.Element
is
Result : constant Attribute_Definition_Clause_Ptr := new Attribute_Definition_Clause_Node;
begin
Result.Enclosing_Element := Parent;
Result.Is_Part_Of_Implicit := Element.Is_Part_Of_Implicit;
Result.Is_Part_Of_Inherited := Element.Is_Part_Of_Inherited;
Result.Is_Part_Of_Instance := Element.Is_Part_Of_Instance;
Result.Start_Position := Element.Start_Position;
Result.End_Position := Element.End_Position;
Result.Enclosing_Compilation_Unit :=
Enclosing_Compilation_Unit (Parent.all);
Result.Hash := Element.Hash;
Result.Place := Element.Place;
return Asis.Element (Result);
end Clone;
procedure Copy
(Source : in Asis.Element;
Target : access Attribute_Definition_Clause_Node;
Cloner : in Cloner_Class;
Parent : in Asis.Element)
is
begin
Target.Representation_Clause_Name :=
Copy (Cloner, Representation_Clause_Name (Source.all), Asis.Element (Target));
Target.Representation_Clause_Expression :=
Copy (Cloner, Representation_Clause_Expression (Source.all), Asis.Element (Target));
end Copy;
function New_Enumeration_Representation_Clause_Node
(The_Context : ASIS.Context)
return Enumeration_Representation_Clause_Ptr
is
Result : Enumeration_Representation_Clause_Ptr :=
new Enumeration_Representation_Clause_Node;
begin
Set_Enclosing_Compilation_Unit
(Result.all, Current_Unit (The_Context.all));
return Result;
end New_Enumeration_Representation_Clause_Node;
function Representation_Clause_Kind (Element : Enumeration_Representation_Clause_Node)
return Asis.Representation_Clause_Kinds is
begin
return An_Enumeration_Representation_Clause;
end;
function Clone
(Element : Enumeration_Representation_Clause_Node;
Parent : Asis.Element)
return Asis.Element
is
Result : constant Enumeration_Representation_Clause_Ptr := new Enumeration_Representation_Clause_Node;
begin
Result.Enclosing_Element := Parent;
Result.Is_Part_Of_Implicit := Element.Is_Part_Of_Implicit;
Result.Is_Part_Of_Inherited := Element.Is_Part_Of_Inherited;
Result.Is_Part_Of_Instance := Element.Is_Part_Of_Instance;
Result.Start_Position := Element.Start_Position;
Result.End_Position := Element.End_Position;
Result.Enclosing_Compilation_Unit :=
Enclosing_Compilation_Unit (Parent.all);
Result.Hash := Element.Hash;
Result.Place := Element.Place;
return Asis.Element (Result);
end Clone;
procedure Copy
(Source : in Asis.Element;
Target : access Enumeration_Representation_Clause_Node;
Cloner : in Cloner_Class;
Parent : in Asis.Element)
is
begin
Target.Representation_Clause_Name :=
Copy (Cloner, Representation_Clause_Name (Source.all), Asis.Element (Target));
Target.Representation_Clause_Expression :=
Copy (Cloner, Representation_Clause_Expression (Source.all), Asis.Element (Target));
end Copy;
end Asis.Gela.Elements.Clause.Rep;
| 37.016026 | 108 | 0.720322 |
306ff2454d6074f445cd18a05875b48238cdab62 | 959 | adb | Ada | kv-avm-warrants.adb | davidkristola/vole | aa8e19d9deff2efe98fcd4dc0028c2895d624693 | [
"Unlicense"
] | 4 | 2015-02-02T12:11:41.000Z | 2020-12-19T02:14:21.000Z | kv-avm-warrants.adb | davidkristola/vole | aa8e19d9deff2efe98fcd4dc0028c2895d624693 | [
"Unlicense"
] | null | null | null | kv-avm-warrants.adb | davidkristola/vole | aa8e19d9deff2efe98fcd4dc0028c2895d624693 | [
"Unlicense"
] | 3 | 2017-02-22T10:44:02.000Z | 2021-05-16T09:34:39.000Z | with kv.avm.Instances;
package body kv.avm.Warrants is
-----------------------------------------------------------------------------
procedure Initialize (Self : in out Warrant_Type) is
begin
null;
end Initialize;
-----------------------------------------------------------------------------
procedure Adjust (Self : in out Warrant_Type) is
begin
null;
end Adjust;
-----------------------------------------------------------------------------
procedure Finalize (Self : in out Warrant_Type) is
begin
null;
end Finalize;
-----------------------------------------------------------------------------
procedure Initialize
(Self : in out Warrant_Type;
Machine : in kv.avm.Control.Control_Access;
Instance : access kv.avm.Instances.Instance_Type) is
begin
Self.Machine := Machine;
Self.Instance := Instance;
end Initialize;
end kv.avm.Warrants;
| 28.205882 | 80 | 0.4317 |
1e6c95c6a92a3d47d4cfac8e8d43aeae73238dab | 980 | ads | Ada | regtests/openapi-testsuite.ads | mgrojo/swagger-ada | ba592a8c9cd76304bef8f1d48738069b8c73b4a6 | [
"Apache-2.0"
] | null | null | null | regtests/openapi-testsuite.ads | mgrojo/swagger-ada | ba592a8c9cd76304bef8f1d48738069b8c73b4a6 | [
"Apache-2.0"
] | null | null | null | regtests/openapi-testsuite.ads | mgrojo/swagger-ada | ba592a8c9cd76304bef8f1d48738069b8c73b4a6 | [
"Apache-2.0"
] | null | null | null | -----------------------------------------------------------------------
-- openapi-testsuite - Swagger Test suite
-- Copyright (C) 2017 Stephane Carrez
-- Written by Stephane Carrez ([email protected])
--
-- Licensed under the Apache License, Version 2.0 (the "License");
-- you may not use this file except in compliance with the License.
-- You may obtain a copy of the License at
--
-- http://www.apache.org/licenses/LICENSE-2.0
--
-- Unless required by applicable law or agreed to in writing, software
-- distributed under the License is distributed on an "AS IS" BASIS,
-- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-- See the License for the specific language governing permissions and
-- limitations under the License.
-----------------------------------------------------------------------
with Util.Tests;
package OpenAPI.Testsuite is
function Suite return Util.Tests.Access_Test_Suite;
end OpenAPI.Testsuite;
| 37.692308 | 76 | 0.635714 |
8b5c114d6d45848fe5f3fc16d1af0c4ef5eb88c6 | 33,015 | ads | Ada | tools-src/gnu/gcc/gcc/ada/types.ads | modern-tomato/tomato | 96f09fab4929c6ddde5c9113f1b2476ad37133c4 | [
"FSFAP"
] | 80 | 2015-01-02T10:14:04.000Z | 2021-06-07T06:29:49.000Z | tools-src/gnu/gcc/gcc/ada/types.ads | modern-tomato/tomato | 96f09fab4929c6ddde5c9113f1b2476ad37133c4 | [
"FSFAP"
] | 9 | 2015-05-14T11:03:12.000Z | 2018-01-04T07:12:58.000Z | tools-src/gnu/gcc/gcc/ada/types.ads | modern-tomato/tomato | 96f09fab4929c6ddde5c9113f1b2476ad37133c4 | [
"FSFAP"
] | 69 | 2015-01-02T10:45:56.000Z | 2021-09-06T07:52:13.000Z | ------------------------------------------------------------------------------
-- --
-- GNAT COMPILER COMPONENTS --
-- --
-- T Y P E S --
-- --
-- S p e c --
-- --
-- $Revision$
-- --
-- Copyright (C) 1992-2001 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. --
-- --
------------------------------------------------------------------------------
with Unchecked_Deallocation;
package Types is
pragma Preelaborate (Types);
-- This package contains host independent type definitions which are used
-- in more than one unit in the compiler. They are gathered here for easy
-- reference, though in some cases the full description is found in the
-- relevant module which implements the definition. The main reason that
-- they are not in their "natural" specs is that this would cause a lot of
-- inter-spec dependencies, and in particular some awkward circular
-- dependencies would have to be dealt with.
-- WARNING: There is a C version of this package. Any changes to this
-- source file must be properly reflected in the C header file a-types.h
-- Note: the declarations in this package reflect an expectation that the
-- host machine has an efficient integer base type with a range at least
-- 32 bits 2s-complement. If there are any machines for which this is not
-- a correct assumption, a significant number of changes will be required!
-------------------------------
-- General Use Integer Types --
-------------------------------
type Int is range -2 ** 31 .. +2 ** 31 - 1;
-- Signed 32-bit integer
type Dint is range -2 ** 63 .. +2 ** 63 - 1;
-- Double length (64-bit) integer
subtype Nat is Int range 0 .. Int'Last;
-- Non-negative Int values
subtype Pos is Int range 1 .. Int'Last;
-- Positive Int values
type Word is mod 2 ** 32;
-- Unsigned 32-bit integer
type Short is range -32768 .. +32767;
for Short'Size use 16;
-- 16-bit signed integer
type Byte is mod 2 ** 8;
for Byte'Size use 8;
-- 8-bit unsigned integer
type size_t is mod 2 ** Standard'Address_Size;
-- Memory size value, for use in calls to C routines
--------------------------------------
-- 8-Bit Character and String Types --
--------------------------------------
-- We use Standard.Character and Standard.String freely, since we are
-- compiling ourselves, and we properly implement the required 8-bit
-- character code as required in Ada 95. This section defines a few
-- general use constants and subtypes.
EOF : constant Character := ASCII.SUB;
-- The character SUB (16#1A#) is used in DOS and other systems derived
-- from DOS (OS/2, NT etc) to signal the end of a text file. Internally
-- all source files are ended by an EOF character, even on Unix systems.
-- An EOF character acts as the end of file only as the last character
-- of a source buffer, in any other position, it is treated as a blank
-- if it appears between tokens, and as an illegal character otherwise.
-- This makes life easier dealing with files that originated from DOS,
-- including concatenated files with interspersed EOF characters.
subtype Graphic_Character is Character range ' ' .. '~';
-- Graphic characters, as defined in ARM
subtype Line_Terminator is Character range ASCII.LF .. ASCII.CR;
-- Line terminator characters (LF, VT, FF, CR)
subtype Upper_Half_Character is
Character range Character'Val (16#80#) .. Character'Val (16#FF#);
-- Characters with the upper bit set
type Character_Ptr is access all Character;
type String_Ptr is access all String;
-- Standard character and string pointers
procedure Free is new Unchecked_Deallocation (String, String_Ptr);
-- Procedure for freeing dynamically allocated String values
subtype Word_Hex_String is String (1 .. 8);
-- Type used to represent Word value as 8 hex digits, with lower case
-- letters for the alphabetic cases.
function Get_Hex_String (W : Word) return Word_Hex_String;
-- Convert word value to 8-character hex string
-----------------------------------------
-- Types Used for Text Buffer Handling --
-----------------------------------------
-- We can't use type String for text buffers, since we must use the
-- standard 32-bit integer as an index value, since we count on all
-- index values being the same size.
type Text_Ptr is new Int;
-- Type used for subscripts in text buffer
type Text_Buffer is array (Text_Ptr range <>) of Character;
-- Text buffer used to hold source file or library information file
type Text_Buffer_Ptr is access all Text_Buffer;
-- Text buffers for input files are allocated dynamically and this type
-- is used to reference these text buffers.
procedure Free is new Unchecked_Deallocation (Text_Buffer, Text_Buffer_Ptr);
-- Procedure for freeing dynamically allocated text buffers
------------------------------------------
-- Types Used for Source Input Handling --
------------------------------------------
type Logical_Line_Number is range 0 .. Int'Last;
for Logical_Line_Number'Size use 32;
-- Line number type, used for storing logical line numbers (i.e. line
-- numbers that include effects of any Source_Reference pragmas in the
-- source file). The value zero indicates a line containing a source
-- reference pragma.
No_Line_Number : constant Logical_Line_Number := 0;
-- Special value used to indicate no line number
type Physical_Line_Number is range 1 .. Int'Last;
for Physical_Line_Number'Size use 32;
-- Line number type, used for storing physical line numbers (i.e.
-- line numbers in the physical file being compiled, unaffected by
-- the presence of source reference pragmas.
type Column_Number is range 0 .. 32767;
for Column_Number'Size use 16;
-- Column number (assume that 2**15 is large enough, see declaration
-- of Hostparm.Max_Line_Length)
No_Column_Number : constant Column_Number := 0;
-- Special value used to indicate no column number
subtype Source_Buffer is Text_Buffer;
-- Type used to store text of a source file . The buffer for the main
-- source (the source specified on the command line) has a lower bound
-- starting at zero. Subsequent subsidiary sources have lower bounds
-- which are one greater than the previous upper bound.
subtype Big_Source_Buffer is Text_Buffer (0 .. Text_Ptr'Last);
-- This is a virtual type used as the designated type of the access
-- type Source_Buffer_Ptr, see Osint.Read_Source_File for details.
type Source_Buffer_Ptr is access all Big_Source_Buffer;
-- Pointer to source buffer. We use virtual origin addressing for
-- source buffers, with thin pointers. The pointer points to a virtual
-- instance of type Big_Source_Buffer, where the actual type is in fact
-- of type Source_Buffer. The address is adjusted so that the virtual
-- origin addressing works correctly. See Osint.Read_Source_Buffer for
-- further details.
subtype Source_Ptr is Text_Ptr;
-- Type used to represent a source location, which is a subscript of a
-- character in the source buffer. As noted above, diffferent source
-- buffers have different ranges, so it is possible to tell from a
-- Source_Ptr value which source it refers to. Note that negative numbers
-- are allowed to accommodate the following special values.
No_Location : constant Source_Ptr := -1;
-- Value used to indicate no source position set in a node
Standard_Location : constant Source_Ptr := -2;
-- Used for all nodes in the representation of package Standard other
-- than nodes representing the contents of Standard.ASCII. Note that
-- testing for <= Standard_Location tests for both Standard_Location
-- and for Standard_ASCII_Location.
Standard_ASCII_Location : constant Source_Ptr := -3;
-- Used for all nodes in the presentation of package Standard.ASCII
First_Source_Ptr : constant Source_Ptr := 0;
-- Starting source pointer index value for first source program
-------------------------------------
-- Range Definitions for Tree Data --
-------------------------------------
-- The tree has fields that can hold any of the following types:
-- Pointers to other tree nodes (type Node_Id)
-- List pointers (type List_Id)
-- Element list pointers (type Elist_Id)
-- Names (type Name_Id)
-- Strings (type String_Id)
-- Universal integers (type Uint)
-- Universal reals (type Ureal)
-- Character codes (type Char_Code stored with a bias)
-- In most contexts, the strongly typed interface determines which of
-- these types is present. However, there are some situations (involving
-- untyped traversals of the tree), where it is convenient to be easily
-- able to distinguish these values. The underlying representation in all
-- cases is an integer type Union_Id, and we ensure that the range of
-- the various possible values for each of the above types is disjoint
-- so that this distinction is possible.
type Union_Id is new Int;
-- The type in the tree for a union of possible ID values
-- Note: it is also helpful for debugging purposes to make these ranges
-- distinct. If a bug leads to misidentification of a value, then it will
-- typically result in an out of range value and a Constraint_Error.
List_Low_Bound : constant := -100_000_000;
-- The List_Id values are subscripts into an array of list headers which
-- has List_Low_Bound as its lower bound. This value is chosen so that all
-- List_Id values are negative, and the value zero is in the range of both
-- List_Id and Node_Id values (see further description below).
List_High_Bound : constant := 0;
-- Maximum List_Id subscript value. This allows up to 100 million list
-- Id values, which is in practice infinite, and there is no need to
-- check the range. The range overlaps the node range by one element
-- (with value zero), which is used both for the Empty node, and for
-- indicating no list. The fact that the same value is used is convenient
-- because it means that the default value of Empty applies to both nodes
-- and lists, and also is more efficient to test for.
Node_Low_Bound : constant := 0;
-- The tree Id values start at zero, because we use zero for Empty (to
-- allow a zero test for Empty). Actual tree node subscripts start at 0
-- since Empty is a legitimate node value.
Node_High_Bound : constant := 099_999_999;
-- Maximum number of nodes that can be allocated is 100 million, which
-- is in practice infinite, and there is no need to check the range.
Elist_Low_Bound : constant := 100_000_000;
-- The Elist_Id values are subscripts into an array of elist headers which
-- has Elist_Low_Bound as its lower bound.
Elist_High_Bound : constant := 199_999_999;
-- Maximum Elist_Id subscript value. This allows up to 100 million Elists,
-- which is in practice infinite and there is no need to check the range.
Elmt_Low_Bound : constant := 200_000_000;
-- Low bound of element Id values. The use of these values is internal to
-- the Elists package, but the definition of the range is included here
-- since it must be disjoint from other Id values. The Elmt_Id values are
-- subscripts into an array of list elements which has this as lower bound.
Elmt_High_Bound : constant := 299_999_999;
-- Upper bound of Elmt_Id values. This allows up to 100 million element
-- list members, which is in practice infinite (no range check needed).
Names_Low_Bound : constant := 300_000_000;
-- Low bound for name Id values
Names_High_Bound : constant := 399_999_999;
-- Maximum number of names that can be allocated is 100 million, which is
-- in practice infinite and there is no need to check the range.
Strings_Low_Bound : constant := 400_000_000;
-- Low bound for string Id values
Strings_High_Bound : constant := 499_999_999;
-- Maximum number of strings that can be allocated is 100 million, which
-- is in practice infinite and there is no need to check the range.
Ureal_Low_Bound : constant := 500_000_000;
-- Low bound for Ureal values.
Ureal_High_Bound : constant := 599_999_999;
-- Maximum number of Ureal values stored is 100_000_000 which is in
-- practice infinite so that no check is required.
Uint_Low_Bound : constant := 600_000_000;
-- Low bound for Uint values.
Uint_Table_Start : constant := 2_000_000_000;
-- Location where table entries for universal integers start (see
-- Uintp spec for details of the representation of Uint values).
Uint_High_Bound : constant := 2_099_999_999;
-- The range of Uint values is very large, since a substantial part
-- of this range is used to store direct values, see Uintp for details.
Char_Code_Bias : constant := 2_100_000_000;
-- A bias value added to character code values stored in the tree which
-- ensures that they have different values from any of the above types.
-- The following subtype definitions are used to provide convenient names
-- for membership tests on Int values to see what data type range they
-- lie in. Such tests appear only in the lowest level packages.
subtype List_Range is Union_Id
range List_Low_Bound .. List_High_Bound;
subtype Node_Range is Union_Id
range Node_Low_Bound .. Node_High_Bound;
subtype Elist_Range is Union_Id
range Elist_Low_Bound .. Elist_High_Bound;
subtype Elmt_Range is Union_Id
range Elmt_Low_Bound .. Elmt_High_Bound;
subtype Names_Range is Union_Id
range Names_Low_Bound .. Names_High_Bound;
subtype Strings_Range is Union_Id
range Strings_Low_Bound .. Strings_High_Bound;
subtype Uint_Range is Union_Id
range Uint_Low_Bound .. Uint_High_Bound;
subtype Ureal_Range is Union_Id
range Ureal_Low_Bound .. Ureal_High_Bound;
subtype Char_Code_Range is Union_Id
range Char_Code_Bias .. Char_Code_Bias + 2**16 - 1;
-----------------------------
-- Types for Namet Package --
-----------------------------
-- Name_Id values are used to identify entries in the names table. Except
-- for the special values No_Name, and Error_Name, they are subscript
-- values for the Names table defined in package Namet.
-- Note that with only a few exceptions, which are clearly documented, the
-- type Name_Id should be regarded as a private type. In particular it is
-- never appropriate to perform arithmetic operations using this type.
type Name_Id is range Names_Low_Bound .. Names_High_Bound;
for Name_Id'Size use 32;
-- Type used to identify entries in the names table
No_Name : constant Name_Id := Names_Low_Bound;
-- The special Name_Id value No_Name is used in the parser to indicate
-- a situation where no name is present (e.g. on a loop or block).
Error_Name : constant Name_Id := Names_Low_Bound + 1;
-- The special Name_Id value Error_Name is used in the parser to
-- indicate that some kind of error was encountered in scanning out
-- the relevant name, so it does not have a representable label.
First_Name_Id : constant Name_Id := Names_Low_Bound + 2;
-- Subscript of first entry in names table
----------------------------
-- Types for Atree Package --
----------------------------
-- Node_Id values are used to identify nodes in the tree. They are
-- subscripts into the Node table declared in package Tree. Note that
-- the special values Empty and Error are subscripts into this table,
-- See package Atree for further details.
type Node_Id is range Node_Low_Bound .. Node_High_Bound;
-- Type used to identify nodes in the tree
subtype Entity_Id is Node_Id;
-- A synonym for node types, used in the entity package to refer to
-- nodes that are entities (i.e. nodes with an Nkind of N_Defining_xxx)
-- All such nodes are extended nodes and these are the only extended
-- nodes, so that in practice entity and extended nodes are synonymous.
subtype Node_Or_Entity_Id is Node_Id;
-- A synonym for node types, used in cases where a given value may be used
-- to represent either a node or an entity. We like to minimize such uses
-- for obvious reasons of logical type consistency, but where such uses
-- occur, they should be documented by use of this type.
Empty : constant Node_Id := Node_Low_Bound;
-- Used to indicate null node. A node is actually allocated with this
-- Id value, so that Nkind (Empty) = N_Empty. Note that Node_Low_Bound
-- is zero, so Empty = No_List = zero.
Empty_List_Or_Node : constant := 0;
-- This constant is used in situations (e.g. initializing empty fields)
-- where the value set will be used to represent either an empty node
-- or a non-existent list, depending on the context.
Error : constant Node_Id := Node_Low_Bound + 1;
-- Used to indicate that there was an error in the source program. A node
-- is actually allocated at this address, so that Nkind (Error) = N_Error.
Empty_Or_Error : constant Node_Id := Error;
-- Since Empty and Error are the first two Node_Id values, the test for
-- N <= Empty_Or_Error tests to see if N is Empty or Error. This definition
-- provides convenient self-documentation for such tests.
First_Node_Id : constant Node_Id := Node_Low_Bound;
-- Subscript of first allocated node. Note that Empty and Error are both
-- allocated nodes, whose Nkind fields can be accessed without error.
------------------------------
-- Types for Nlists Package --
------------------------------
-- List_Id values are used to identify node lists in the tree. They are
-- subscripts into the Lists table declared in package Tree. Note that
-- the special value Error_List is a subscript in this table, but the
-- value No_List is *not* a valid subscript, and any attempt to apply
-- list operations to No_List will cause a (detected) error.
type List_Id is range List_Low_Bound .. List_High_Bound;
-- Type used to identify a node list
No_List : constant List_Id := List_High_Bound;
-- Used to indicate absence of a list. Note that the value is zero, which
-- is the same as Empty, which is helpful in initializing nodes where a
-- value of zero can represent either an empty node or an empty list.
Error_List : constant List_Id := List_Low_Bound;
-- Used to indicate that there was an error in the source program in a
-- context which would normally require a list. This node appears to be
-- an empty list to the list operations (a null list is actually allocated
-- which has this Id value).
First_List_Id : constant List_Id := Error_List;
-- Subscript of first allocated list header
------------------------------
-- Types for Elists Package --
------------------------------
-- Element list Id values are used to identify element lists stored in
-- the tree (see package Tree for further details). They are formed by
-- adding a bias (Element_List_Bias) to subscript values in the same
-- array that is used for node list headers.
type Elist_Id is range Elist_Low_Bound .. Elist_High_Bound;
-- Type used to identify an element list (Elist header table subscript)
No_Elist : constant Elist_Id := Elist_Low_Bound;
-- Used to indicate absense of an element list. Note that this is not
-- an actual Elist header, so element list operations on this value
-- are not valid.
First_Elist_Id : constant Elist_Id := No_Elist + 1;
-- Subscript of first allocated Elist header.
-- Element Id values are used to identify individual elements of an
-- element list (see package Elists for further details).
type Elmt_Id is range Elmt_Low_Bound .. Elmt_High_Bound;
-- Type used to identify an element list
No_Elmt : constant Elmt_Id := Elmt_Low_Bound;
-- Used to represent empty element
First_Elmt_Id : constant Elmt_Id := No_Elmt + 1;
-- Subscript of first allocated Elmt table entry
-------------------------------
-- Types for Stringt Package --
-------------------------------
-- String_Id values are used to identify entries in the strings table.
-- They are subscripts into the strings table defined in package Strings.
-- Note that with only a few exceptions, which are clearly documented, the
-- type String_Id should be regarded as a private type. In particular it is
-- never appropriate to perform arithmetic operations using this type.
type String_Id is range Strings_Low_Bound .. Strings_High_Bound;
-- Type used to identify entries in the strings table
No_String : constant String_Id := Strings_Low_Bound;
-- Used to indicate missing string Id. Note that the value zero is used
-- to indicate a missing data value for all the Int types in this section.
First_String_Id : constant String_Id := No_String + 1;
-- First subscript allocated in string table
-------------------------
-- Character Code Type --
-------------------------
-- The type Char is used for character data internally in the compiler,
-- but character codes in the source are represented by the Char_Code
-- type. Each character literal in the source is interpreted as being one
-- of the 2**16 possible Wide_Character codes, and a unique integer value
-- is assigned, corresponding to the POS value in the Wide_Character type.
-- String literals are similarly interpreted as a sequence of such codes.
-- Note: when character code values are stored in the tree, they are stored
-- by adding a bias value (Char_Code_Bias) that results in values that can
-- be distinguished from other types of values stored in the tree.
type Char_Code is mod 2 ** 16;
for Char_Code'Size use 16;
function Get_Char_Code (C : Character) return Char_Code;
pragma Inline (Get_Char_Code);
-- Function to obtain internal character code from source character. For
-- the moment, the internal character code is simply the Pos value of the
-- input source character, but we provide this interface for possible
-- later support of alternative character sets.
function In_Character_Range (C : Char_Code) return Boolean;
pragma Inline (In_Character_Range);
-- Determines if the given character code is in range of type Character,
-- and if so, returns True. If not, returns False.
function Get_Character (C : Char_Code) return Character;
pragma Inline (Get_Character);
-- For a character C that is in character range (see above function), this
-- function returns the corresponding Character value. It is an error to
-- call Get_Character if C is not in character range
---------------------------------------
-- Types used for Library Management --
---------------------------------------
type Unit_Number_Type is new Int;
-- Unit number. The main source is unit 0, and subsidiary sources have
-- non-zero numbers starting with 1. Unit numbers are used to index the
-- file table in Lib.
Main_Unit : constant Unit_Number_Type := 0;
-- Unit number value for main unit
No_Unit : constant Unit_Number_Type := -1;
-- Special value used to signal no unit
type Source_File_Index is new Nat;
-- Type used to index the source file table (see package Sinput)
No_Source_File : constant Source_File_Index := 0;
-- Value used to indicate no source file present
System_Source_File_Index : constant Source_File_Index := 1;
-- Value used for source file table entry for system.ads, which is
-- always the first source file read (see unit Targparm for details).
subtype File_Name_Type is Name_Id;
-- File names are stored in the names table and this synonym is used to
-- indicate that a Name_Id value is being used to hold a simple file
-- name (which does not include any directory information).
No_File : constant File_Name_Type := File_Name_Type (No_Name);
-- Constant used to indicate no file found
subtype Unit_Name_Type is Name_Id;
-- Unit names are stored in the names table and this synonym is used to
-- indicate that a Name_Id value is being used to hold a unit name.
-----------------------------------
-- Representation of Time Stamps --
-----------------------------------
-- All compiled units are marked with a time stamp which is derived from
-- the source file (we assume that the host system has the concept of a
-- file time stamp which is modified when a file is modified). These
-- time stamps are used to ensure consistency of the set of units that
-- constitutes a library. Time stamps are 12 character strings with
-- with the following format:
-- YYYYMMDDHHMMSS
-- YYYY year
-- MM month (2 digits 01-12)
-- DD day (2 digits 01-31)
-- HH hour (2 digits 00-23)
-- MM minutes (2 digits 00-59)
-- SS seconds (2 digits 00-59)
-- In the case of Unix systems (and other systems which keep the time in
-- GMT), the time stamp is the GMT time of the file, not the local time.
-- This solves problems in using libraries across networks with clients
-- spread across multiple time-zones.
Time_Stamp_Length : constant := 14;
-- Length of time stamp value
subtype Time_Stamp_Index is Natural range 1 .. Time_Stamp_Length;
type Time_Stamp_Type is new String (Time_Stamp_Index);
-- Type used to represent time stamp
Empty_Time_Stamp : constant Time_Stamp_Type := (others => ' ');
-- Type used to represent an empty or missing time stamp. Looks less
-- than any real time stamp if two time stamps are compared. Note that
-- although this is not a private type, clients should not rely on the
-- exact way in which this string is represented, and instead should
-- use the subprograms below.
Dummy_Time_Stamp : constant Time_Stamp_Type := (others => '0');
-- This is used for dummy time stamp values used in the D lines for
-- non-existant files, and is intended to be an impossible value.
function "=" (Left, Right : Time_Stamp_Type) return Boolean;
function "<=" (Left, Right : Time_Stamp_Type) return Boolean;
function ">=" (Left, Right : Time_Stamp_Type) return Boolean;
function "<" (Left, Right : Time_Stamp_Type) return Boolean;
function ">" (Left, Right : Time_Stamp_Type) return Boolean;
-- Comparison functions on time stamps. Note that two time stamps
-- are defined as being equal if they have the same day/month/year
-- and the hour/minutes/seconds values are within 2 seconds of one
-- another. This deals with rounding effects in library file time
-- stamps caused by copying operations during installation. We have
-- particularly noticed that WinNT seems susceptible to such changes.
-- Note: the Empty_Time_Stamp value looks equal to itself, and less
-- than any non-empty time stamp value.
procedure Split_Time_Stamp
(TS : Time_Stamp_Type;
Year : out Nat;
Month : out Nat;
Day : out Nat;
Hour : out Nat;
Minutes : out Nat;
Seconds : out Nat);
-- Given a time stamp, decompose it into its components
procedure Make_Time_Stamp
(Year : Nat;
Month : Nat;
Day : Nat;
Hour : Nat;
Minutes : Nat;
Seconds : Nat;
TS : out Time_Stamp_Type);
-- Given the components of a time stamp, initialize the value
-----------------------------------------------
-- Types used for Pragma Suppress Management --
-----------------------------------------------
-- The following record contains an entry for each recognized check name
-- for pragma Suppress. It is used to represent current settings of scope
-- based suppress actions from pragma Suppress or command line settings.
type Suppress_Record is record
Access_Checks : Boolean;
Accessibility_Checks : Boolean;
Discriminant_Checks : Boolean;
Division_Checks : Boolean;
Elaboration_Checks : Boolean;
Index_Checks : Boolean;
Length_Checks : Boolean;
Overflow_Checks : Boolean;
Range_Checks : Boolean;
Storage_Checks : Boolean;
Tag_Checks : Boolean;
end record;
-- To add a new check type to GNAT, the following steps are required:
-- 1. Add an appropriate entry to the above record type
-- 2. Add an entry to Snames spec and body for the new name
-- 3. Add an entry to the definition of Check_Id in the Snames spec
-- 4. Add a new entity flag definition in Einfo for the check
-- 5. Add a new function to Sem.Util to handle the new check test
-- 6. Add appropriate processing for pragma Suppress in Sem.Prag
-- 7. Add a branch to the case statement in Sem.Ch8.Pop_Scope
-- 8. Add a new Do_xxx_Check flag to Sinfo (if required)
-- 9. Add appropriate checks for the new test
-----------------------------------
-- Global Exception Declarations --
-----------------------------------
-- This section contains declarations of exceptions that are used
-- throughout the compiler.
Unrecoverable_Error : exception;
-- This exception is raised to immediately terminate the compilation
-- of the current source program. Used in situations where things are
-- bad enough that it doesn't seem worth continuing (e.g. max errors
-- reached, or a required file is not found). Also raised when the
-- compiler finds itself in trouble after an error (see Comperr).
---------------------------------
-- Parameter Mechanism Control --
---------------------------------
-- Function and parameter entities have a field that records the
-- passing mechanism. See specification of Sem_Mech for full details.
-- The following subtype is used to represent values of this type:
subtype Mechanism_Type is Int range -10 .. Int'Last;
-- Type used to represent a mechanism value. This is a subtype rather
-- than a type to avoid some annoying processing problems with certain
-- routines in Einfo (processing them to create the corresponding C).
end Types;
| 45.537931 | 79 | 0.658246 |
19f32e2c8055ce4387fc16d13c33731d97448bed | 1,532 | ads | Ada | tier-1/xcb/source/thin/xcb-xcb_query_pointer_request_t.ads | charlie5/cBound | 741be08197a61ad9c72553e3302f3b669902216d | [
"0BSD"
] | 2 | 2015-11-12T11:16:20.000Z | 2021-08-24T22:32:04.000Z | tier-1/xcb/source/thin/xcb-xcb_query_pointer_request_t.ads | charlie5/cBound | 741be08197a61ad9c72553e3302f3b669902216d | [
"0BSD"
] | 1 | 2018-06-05T05:19:35.000Z | 2021-11-20T01:13:23.000Z | tier-1/xcb/source/thin/xcb-xcb_query_pointer_request_t.ads | charlie5/cBound | 741be08197a61ad9c72553e3302f3b669902216d | [
"0BSD"
] | null | null | null | -- This file is generated by SWIG. Please do not modify by hand.
--
with Interfaces;
with Interfaces.C;
with Interfaces.C.Pointers;
package xcb.xcb_query_pointer_request_t is
-- Item
--
type Item is record
major_opcode : aliased Interfaces.Unsigned_8;
pad0 : aliased Interfaces.Unsigned_8;
length : aliased Interfaces.Unsigned_16;
window : aliased xcb.xcb_window_t;
end record;
-- Item_Array
--
type Item_Array is
array
(Interfaces.C
.size_t range <>) of aliased xcb.xcb_query_pointer_request_t
.Item;
-- Pointer
--
package C_Pointers is new Interfaces.C.Pointers
(Index => Interfaces.C.size_t,
Element => xcb.xcb_query_pointer_request_t.Item,
Element_Array => xcb.xcb_query_pointer_request_t.Item_Array,
Default_Terminator => (others => <>));
subtype Pointer is C_Pointers.Pointer;
-- Pointer_Array
--
type Pointer_Array is
array
(Interfaces.C
.size_t range <>) of aliased xcb.xcb_query_pointer_request_t
.Pointer;
-- Pointer_Pointer
--
package C_Pointer_Pointers is new Interfaces.C.Pointers
(Index => Interfaces.C.size_t,
Element => xcb.xcb_query_pointer_request_t.Pointer,
Element_Array => xcb.xcb_query_pointer_request_t.Pointer_Array,
Default_Terminator => null);
subtype Pointer_Pointer is C_Pointer_Pointers.Pointer;
end xcb.xcb_query_pointer_request_t;
| 27.357143 | 74 | 0.660574 |
03bfc0c3acf2b61f6333f470b35fb5f929691d68 | 3,506 | ads | Ada | llvm-gcc-4.2-2.9/gcc/ada/s-gloloc.ads | vidkidz/crossbridge | ba0bf94aee0ce6cf7eb5be882382e52bc57ba396 | [
"MIT"
] | 1 | 2016-04-09T02:58:13.000Z | 2016-04-09T02:58:13.000Z | llvm-gcc-4.2-2.9/gcc/ada/s-gloloc.ads | vidkidz/crossbridge | ba0bf94aee0ce6cf7eb5be882382e52bc57ba396 | [
"MIT"
] | null | null | null | llvm-gcc-4.2-2.9/gcc/ada/s-gloloc.ads | vidkidz/crossbridge | ba0bf94aee0ce6cf7eb5be882382e52bc57ba396 | [
"MIT"
] | null | null | null | ------------------------------------------------------------------------------
-- --
-- GNAT COMPILER COMPONENTS --
-- --
-- S Y S T E M . G L O B A L _ L O C K S --
-- --
-- S p e c --
-- --
-- Copyright (C) 1999-2006, 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. --
-- --
------------------------------------------------------------------------------
-- This package contains the necessary routines to provide
-- reliable system wide locking capability.
package System.Global_Locks is
Lock_Error : exception;
-- Exception raised if a request cannot be executed on a lock
type Lock_Type is private;
-- Such a lock is a global lock between partitions. This lock is
-- uniquely defined between the partitions because of its name.
Null_Lock : constant Lock_Type;
-- This needs comments ???
procedure Create_Lock (Lock : out Lock_Type; Name : String);
-- Create or retrieve a global lock for the current partition using
-- its Name.
procedure Acquire_Lock (Lock : in out Lock_Type);
-- If the lock cannot be acquired because someone already owns it, this
-- procedure is supposed to wait and retry forever.
procedure Release_Lock (Lock : in out Lock_Type);
private
type Lock_Type is new Natural;
Null_Lock : constant Lock_Type := 0;
end System.Global_Locks;
| 53.121212 | 78 | 0.496292 |
30ce327bbca6fdac802839a77251668faecebfa9 | 162 | ads | Ada | transmitter/configuration.ads | damaki/dw1000-rssi-tester | fef559e58e9a4d1df908e9d4827e96ccce4c6136 | [
"MIT"
] | 2 | 2019-05-15T02:23:01.000Z | 2021-03-05T08:10:26.000Z | transmitter/configuration.ads | damaki/dw1000-rssi-tester | fef559e58e9a4d1df908e9d4827e96ccce4c6136 | [
"MIT"
] | null | null | null | transmitter/configuration.ads | damaki/dw1000-rssi-tester | fef559e58e9a4d1df908e9d4827e96ccce4c6136 | [
"MIT"
] | 1 | 2020-02-11T15:59:51.000Z | 2020-02-11T15:59:51.000Z | with DecaDriver;
package Configurations
is
procedure Get_Switches_Configuration
(Config : out DecaDriver.Core.Configuration_Type);
end Configurations;
| 16.2 | 55 | 0.802469 |
9ac1943e0c0565d08cc50880a68622646c9b2486 | 125 | ads | Ada | source/tabula-users-load.ads | ytomino/vampire | 2ff6c93af53e55c89cab70fedb63accba83bcd92 | [
"OpenSSL",
"Unlicense"
] | 1 | 2016-12-19T13:25:14.000Z | 2016-12-19T13:25:14.000Z | source/tabula-users-load.ads | ytomino/vampire | 2ff6c93af53e55c89cab70fedb63accba83bcd92 | [
"OpenSSL",
"Unlicense"
] | null | null | null | source/tabula-users-load.ads | ytomino/vampire | 2ff6c93af53e55c89cab70fedb63accba83bcd92 | [
"OpenSSL",
"Unlicense"
] | null | null | null | -- The Village of Vampire by YT, このソースコードはNYSLです
procedure Tabula.Users.Load (
Name : in String;
Info : in out User_Info);
| 25 | 48 | 0.736 |
190c6092eda4ffbb3b9ce282e8d4848ad5fe1f5e | 4,996 | adb | Ada | llvm-gcc-4.2-2.9/gcc/ada/s-pack57.adb | vidkidz/crossbridge | ba0bf94aee0ce6cf7eb5be882382e52bc57ba396 | [
"MIT"
] | 1 | 2016-04-09T02:58:13.000Z | 2016-04-09T02:58:13.000Z | llvm-gcc-4.2-2.9/gcc/ada/s-pack57.adb | vidkidz/crossbridge | ba0bf94aee0ce6cf7eb5be882382e52bc57ba396 | [
"MIT"
] | null | null | null | llvm-gcc-4.2-2.9/gcc/ada/s-pack57.adb | vidkidz/crossbridge | ba0bf94aee0ce6cf7eb5be882382e52bc57ba396 | [
"MIT"
] | null | null | null | ------------------------------------------------------------------------------
-- --
-- GNAT RUN-TIME COMPONENTS --
-- --
-- S Y S T E M . P A C K _ 5 7 --
-- --
-- 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 System.Storage_Elements;
with System.Unsigned_Types;
with Unchecked_Conversion;
package body System.Pack_57 is
subtype Ofs is System.Storage_Elements.Storage_Offset;
subtype Uns is System.Unsigned_Types.Unsigned;
subtype N07 is System.Unsigned_Types.Unsigned range 0 .. 7;
use type System.Storage_Elements.Storage_Offset;
use type System.Unsigned_Types.Unsigned;
type Cluster is record
E0, E1, E2, E3, E4, E5, E6, E7 : Bits_57;
end record;
for Cluster use record
E0 at 0 range 0 * Bits .. 0 * Bits + Bits - 1;
E1 at 0 range 1 * Bits .. 1 * Bits + Bits - 1;
E2 at 0 range 2 * Bits .. 2 * Bits + Bits - 1;
E3 at 0 range 3 * Bits .. 3 * Bits + Bits - 1;
E4 at 0 range 4 * Bits .. 4 * Bits + Bits - 1;
E5 at 0 range 5 * Bits .. 5 * Bits + Bits - 1;
E6 at 0 range 6 * Bits .. 6 * Bits + Bits - 1;
E7 at 0 range 7 * Bits .. 7 * Bits + Bits - 1;
end record;
for Cluster'Size use Bits * 8;
for Cluster'Alignment use Integer'Min (Standard'Maximum_Alignment,
1 +
1 * Boolean'Pos (Bits mod 2 = 0) +
2 * Boolean'Pos (Bits mod 4 = 0));
-- Use maximum possible alignment, given the bit field size, since this
-- will result in the most efficient code possible for the field.
type Cluster_Ref is access Cluster;
function To_Ref is new
Unchecked_Conversion (System.Address, Cluster_Ref);
------------
-- Get_57 --
------------
function Get_57 (Arr : System.Address; N : Natural) return Bits_57 is
C : constant Cluster_Ref := To_Ref (Arr + Bits * Ofs (Uns (N) / 8));
begin
case N07 (Uns (N) mod 8) is
when 0 => return C.E0;
when 1 => return C.E1;
when 2 => return C.E2;
when 3 => return C.E3;
when 4 => return C.E4;
when 5 => return C.E5;
when 6 => return C.E6;
when 7 => return C.E7;
end case;
end Get_57;
------------
-- Set_57 --
------------
procedure Set_57 (Arr : System.Address; N : Natural; E : Bits_57) is
C : constant Cluster_Ref := To_Ref (Arr + Bits * Ofs (Uns (N) / 8));
begin
case N07 (Uns (N) mod 8) is
when 0 => C.E0 := E;
when 1 => C.E1 := E;
when 2 => C.E2 := E;
when 3 => C.E3 := E;
when 4 => C.E4 := E;
when 5 => C.E5 := E;
when 6 => C.E6 := E;
when 7 => C.E7 := E;
end case;
end Set_57;
end System.Pack_57;
| 43.443478 | 78 | 0.483387 |
1921e0dc9f369b0d0685d3cc046419ec970e7eda | 2,130 | ads | Ada | tier-1/xcb/source/thin/xcb-xcb_screen_t.ads | charlie5/cBound | 741be08197a61ad9c72553e3302f3b669902216d | [
"0BSD"
] | 2 | 2015-11-12T11:16:20.000Z | 2021-08-24T22:32:04.000Z | tier-1/xcb/source/thin/xcb-xcb_screen_t.ads | charlie5/cBound | 741be08197a61ad9c72553e3302f3b669902216d | [
"0BSD"
] | 1 | 2018-06-05T05:19:35.000Z | 2021-11-20T01:13:23.000Z | tier-1/xcb/source/thin/xcb-xcb_screen_t.ads | charlie5/cBound | 741be08197a61ad9c72553e3302f3b669902216d | [
"0BSD"
] | null | null | null | -- This file is generated by SWIG. Please do not modify by hand.
--
with Interfaces;
with Interfaces.C;
with Interfaces.C.Pointers;
package xcb.xcb_screen_t is
-- Item
--
type Item is record
root : aliased xcb.xcb_window_t;
default_colormap : aliased xcb.xcb_colormap_t;
white_pixel : aliased Interfaces.Unsigned_32;
black_pixel : aliased Interfaces.Unsigned_32;
current_input_masks : aliased Interfaces.Unsigned_32;
width_in_pixels : aliased Interfaces.Unsigned_16;
height_in_pixels : aliased Interfaces.Unsigned_16;
width_in_millimeters : aliased Interfaces.Unsigned_16;
height_in_millimeters : aliased Interfaces.Unsigned_16;
min_installed_maps : aliased Interfaces.Unsigned_16;
max_installed_maps : aliased Interfaces.Unsigned_16;
root_visual : aliased xcb.xcb_visualid_t;
backing_stores : aliased Interfaces.Unsigned_8;
save_unders : aliased Interfaces.Unsigned_8;
root_depth : aliased Interfaces.Unsigned_8;
allowed_depths_len : aliased Interfaces.Unsigned_8;
end record;
-- Item_Array
--
type Item_Array is
array (Interfaces.C.size_t range <>) of aliased xcb.xcb_screen_t.Item;
-- Pointer
--
package C_Pointers is new Interfaces.C.Pointers
(Index => Interfaces.C.size_t,
Element => xcb.xcb_screen_t.Item,
Element_Array => xcb.xcb_screen_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_screen_t.Pointer;
-- Pointer_Pointer
--
package C_Pointer_Pointers is new Interfaces.C.Pointers
(Index => Interfaces.C.size_t,
Element => xcb.xcb_screen_t.Pointer,
Element_Array => xcb.xcb_screen_t.Pointer_Array,
Default_Terminator => null);
subtype Pointer_Pointer is C_Pointer_Pointers.Pointer;
end xcb.xcb_screen_t;
| 34.354839 | 78 | 0.668075 |
30bf911e28c68ddde3b90fbfb5ee5d0216fdb4ec | 5,118 | adb | Ada | tools-src/gnu/gcc/gcc/ada/s-pack27.adb | modern-tomato/tomato | 96f09fab4929c6ddde5c9113f1b2476ad37133c4 | [
"FSFAP"
] | 80 | 2015-01-02T10:14:04.000Z | 2021-06-07T06:29:49.000Z | tools-src/gnu/gcc/gcc/ada/s-pack27.adb | modern-tomato/tomato | 96f09fab4929c6ddde5c9113f1b2476ad37133c4 | [
"FSFAP"
] | 9 | 2015-05-14T11:03:12.000Z | 2018-01-04T07:12:58.000Z | tools-src/gnu/gcc/gcc/ada/s-pack27.adb | modern-tomato/tomato | 96f09fab4929c6ddde5c9113f1b2476ad37133c4 | [
"FSFAP"
] | 69 | 2015-01-02T10:45:56.000Z | 2021-09-06T07:52:13.000Z | ------------------------------------------------------------------------------
-- --
-- GNAT RUNTIME COMPONENTS --
-- --
-- S Y S T E M . P A C K _ 2 7 --
-- --
-- B o d y --
-- --
-- $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. --
-- --
------------------------------------------------------------------------------
with System.Storage_Elements;
with System.Unsigned_Types;
with Unchecked_Conversion;
package body System.Pack_27 is
subtype Ofs is System.Storage_Elements.Storage_Offset;
subtype Uns is System.Unsigned_Types.Unsigned;
subtype N07 is System.Unsigned_Types.Unsigned range 0 .. 7;
use type System.Storage_Elements.Storage_Offset;
use type System.Unsigned_Types.Unsigned;
type Cluster is record
E0, E1, E2, E3, E4, E5, E6, E7 : Bits_27;
end record;
for Cluster use record
E0 at 0 range 0 * Bits .. 0 * Bits + Bits - 1;
E1 at 0 range 1 * Bits .. 1 * Bits + Bits - 1;
E2 at 0 range 2 * Bits .. 2 * Bits + Bits - 1;
E3 at 0 range 3 * Bits .. 3 * Bits + Bits - 1;
E4 at 0 range 4 * Bits .. 4 * Bits + Bits - 1;
E5 at 0 range 5 * Bits .. 5 * Bits + Bits - 1;
E6 at 0 range 6 * Bits .. 6 * Bits + Bits - 1;
E7 at 0 range 7 * Bits .. 7 * Bits + Bits - 1;
end record;
for Cluster'Size use Bits * 8;
for Cluster'Alignment use Integer'Min (Standard'Maximum_Alignment,
1 +
1 * Boolean'Pos (Bits mod 2 = 0) +
2 * Boolean'Pos (Bits mod 4 = 0));
-- Use maximum possible alignment, given the bit field size, since this
-- will result in the most efficient code possible for the field.
type Cluster_Ref is access Cluster;
function To_Ref is new
Unchecked_Conversion (System.Address, Cluster_Ref);
------------
-- Get_27 --
------------
function Get_27 (Arr : System.Address; N : Natural) return Bits_27 is
C : constant Cluster_Ref := To_Ref (Arr + Bits * Ofs (Uns (N) / 8));
begin
case N07 (Uns (N) mod 8) is
when 0 => return C.E0;
when 1 => return C.E1;
when 2 => return C.E2;
when 3 => return C.E3;
when 4 => return C.E4;
when 5 => return C.E5;
when 6 => return C.E6;
when 7 => return C.E7;
end case;
end Get_27;
------------
-- Set_27 --
------------
procedure Set_27 (Arr : System.Address; N : Natural; E : Bits_27) is
C : constant Cluster_Ref := To_Ref (Arr + Bits * Ofs (Uns (N) / 8));
begin
case N07 (Uns (N) mod 8) is
when 0 => C.E0 := E;
when 1 => C.E1 := E;
when 2 => C.E2 := E;
when 3 => C.E3 := E;
when 4 => C.E4 := E;
when 5 => C.E5 := E;
when 6 => C.E6 := E;
when 7 => C.E7 := E;
end case;
end Set_27;
end System.Pack_27;
| 43.008403 | 78 | 0.47245 |
30e8535c572cc76132a35dbe34fefcdb35a743f9 | 9,863 | ads | Ada | arch/ARM/STM32/svd/stm32wb55x/stm32_svd-syscfg2.ads | morbos/Ada_Drivers_Library | a4ab26799be60997c38735f4056160c4af597ef7 | [
"BSD-3-Clause"
] | 2 | 2018-05-16T03:56:39.000Z | 2019-07-31T13:53:56.000Z | arch/ARM/STM32/svd/stm32wb55x/stm32_svd-syscfg2.ads | morbos/Ada_Drivers_Library | a4ab26799be60997c38735f4056160c4af597ef7 | [
"BSD-3-Clause"
] | null | null | null | arch/ARM/STM32/svd/stm32wb55x/stm32_svd-syscfg2.ads | morbos/Ada_Drivers_Library | a4ab26799be60997c38735f4056160c4af597ef7 | [
"BSD-3-Clause"
] | null | null | null | -- This spec has been automatically generated from STM32WB55x.svd
pragma Restrictions (No_Elaboration_Code);
pragma Ada_2012;
pragma Style_Checks (Off);
with HAL;
with System;
package STM32_SVD.SYSCFG2 is
pragma Preelaborate;
---------------
-- Registers --
---------------
type IMR1_Register is record
-- unspecified
Reserved_0_12 : HAL.UInt13 := 16#0#;
TIM1IM : Boolean := False;
TIM16IM : Boolean := False;
TIM17IM : Boolean := False;
-- unspecified
Reserved_16_20 : HAL.UInt5 := 16#0#;
EXTI5IM : Boolean := False;
EXTI6IM : Boolean := False;
EXTI7IM : Boolean := False;
EXTI8IM : Boolean := False;
EXTI9IM : Boolean := False;
EXTI10IM : Boolean := False;
EXTI11IM : Boolean := False;
EXTI12IM : Boolean := False;
EXTI13IM : Boolean := False;
EXTI14IM : Boolean := False;
EXTI15IM : Boolean := False;
end record
with Volatile_Full_Access, Size => 32,
Bit_Order => System.Low_Order_First;
for IMR1_Register use record
Reserved_0_12 at 0 range 0 .. 12;
TIM1IM at 0 range 13 .. 13;
TIM16IM at 0 range 14 .. 14;
TIM17IM at 0 range 15 .. 15;
Reserved_16_20 at 0 range 16 .. 20;
EXTI5IM at 0 range 21 .. 21;
EXTI6IM at 0 range 22 .. 22;
EXTI7IM at 0 range 23 .. 23;
EXTI8IM at 0 range 24 .. 24;
EXTI9IM at 0 range 25 .. 25;
EXTI10IM at 0 range 26 .. 26;
EXTI11IM at 0 range 27 .. 27;
EXTI12IM at 0 range 28 .. 28;
EXTI13IM at 0 range 29 .. 29;
EXTI14IM at 0 range 30 .. 30;
EXTI15IM at 0 range 31 .. 31;
end record;
type IMR2_Register is record
-- unspecified
Reserved_0_15 : HAL.UInt16 := 16#0#;
PVM1IM : Boolean := False;
-- unspecified
Reserved_17_17 : HAL.Bit := 16#0#;
PVM3IM : Boolean := False;
-- unspecified
Reserved_19_19 : HAL.Bit := 16#0#;
PVDIM : Boolean := False;
-- unspecified
Reserved_21_31 : HAL.UInt11 := 16#0#;
end record
with Volatile_Full_Access, Size => 32,
Bit_Order => System.Low_Order_First;
for IMR2_Register use record
Reserved_0_15 at 0 range 0 .. 15;
PVM1IM at 0 range 16 .. 16;
Reserved_17_17 at 0 range 17 .. 17;
PVM3IM at 0 range 18 .. 18;
Reserved_19_19 at 0 range 19 .. 19;
PVDIM at 0 range 20 .. 20;
Reserved_21_31 at 0 range 21 .. 31;
end record;
type C2IMR1_Register is record
RTCSTAMPTAMPLSECSSIM : Boolean := False;
-- unspecified
Reserved_1_2 : HAL.UInt2 := 16#0#;
RTCWKUPIM : Boolean := False;
RTCALARMIM : Boolean := False;
RCCIM : Boolean := False;
FLASHIM : Boolean := False;
-- unspecified
Reserved_7_7 : HAL.Bit := 16#0#;
PKAIM : Boolean := False;
RNGIM : Boolean := False;
AES1IM : Boolean := False;
COMPIM : Boolean := False;
ADCIM : Boolean := False;
-- unspecified
Reserved_13_15 : HAL.UInt3 := 16#0#;
EXTI0IM : Boolean := False;
EXTI1IM : Boolean := False;
EXTI2IM : Boolean := False;
EXTI3IM : Boolean := False;
EXTI4IM : Boolean := False;
EXTI5IM : Boolean := False;
EXTI6IM : Boolean := False;
EXTI7IM : Boolean := False;
EXTI8IM : Boolean := False;
EXTI9IM : Boolean := False;
EXTI10IM : Boolean := False;
EXTI11IM : Boolean := False;
EXTI12IM : Boolean := False;
EXTI13IM : Boolean := False;
EXTI14IM : Boolean := False;
EXTI15IM : Boolean := False;
end record
with Volatile_Full_Access, Size => 32,
Bit_Order => System.Low_Order_First;
for C2IMR1_Register use record
RTCSTAMPTAMPLSECSSIM at 0 range 0 .. 0;
Reserved_1_2 at 0 range 1 .. 2;
RTCWKUPIM at 0 range 3 .. 3;
RTCALARMIM at 0 range 4 .. 4;
RCCIM at 0 range 5 .. 5;
FLASHIM at 0 range 6 .. 6;
Reserved_7_7 at 0 range 7 .. 7;
PKAIM at 0 range 8 .. 8;
RNGIM at 0 range 9 .. 9;
AES1IM at 0 range 10 .. 10;
COMPIM at 0 range 11 .. 11;
ADCIM at 0 range 12 .. 12;
Reserved_13_15 at 0 range 13 .. 15;
EXTI0IM at 0 range 16 .. 16;
EXTI1IM at 0 range 17 .. 17;
EXTI2IM at 0 range 18 .. 18;
EXTI3IM at 0 range 19 .. 19;
EXTI4IM at 0 range 20 .. 20;
EXTI5IM at 0 range 21 .. 21;
EXTI6IM at 0 range 22 .. 22;
EXTI7IM at 0 range 23 .. 23;
EXTI8IM at 0 range 24 .. 24;
EXTI9IM at 0 range 25 .. 25;
EXTI10IM at 0 range 26 .. 26;
EXTI11IM at 0 range 27 .. 27;
EXTI12IM at 0 range 28 .. 28;
EXTI13IM at 0 range 29 .. 29;
EXTI14IM at 0 range 30 .. 30;
EXTI15IM at 0 range 31 .. 31;
end record;
type C2IMR2_Register is record
DMA1CH1IM : Boolean := False;
DMA1CH2IM : Boolean := False;
DMA1CH3IM : Boolean := False;
DMA1CH4IM : Boolean := False;
DMA1CH5IM : Boolean := False;
DMA1CH6IM : Boolean := False;
DMA1CH7IM : Boolean := False;
-- unspecified
Reserved_7_7 : HAL.Bit := 16#0#;
DMA2CH1IM : Boolean := False;
DMA2CH2IM : Boolean := False;
DMA2CH3IM : Boolean := False;
DMA2CH4IM : Boolean := False;
DMA2CH5IM : Boolean := False;
DMA2CH6IM : Boolean := False;
DMA2CH7IM : Boolean := False;
DMAMUX1IM : Boolean := False;
PVM1IM : Boolean := False;
-- unspecified
Reserved_17_17 : HAL.Bit := 16#0#;
PVM3IM : Boolean := False;
-- unspecified
Reserved_19_19 : HAL.Bit := 16#0#;
PVDIM : Boolean := False;
TSCIM : Boolean := False;
LCDIM : Boolean := False;
-- unspecified
Reserved_23_31 : HAL.UInt9 := 16#0#;
end record
with Volatile_Full_Access, Size => 32,
Bit_Order => System.Low_Order_First;
for C2IMR2_Register use record
DMA1CH1IM at 0 range 0 .. 0;
DMA1CH2IM at 0 range 1 .. 1;
DMA1CH3IM at 0 range 2 .. 2;
DMA1CH4IM at 0 range 3 .. 3;
DMA1CH5IM at 0 range 4 .. 4;
DMA1CH6IM at 0 range 5 .. 5;
DMA1CH7IM at 0 range 6 .. 6;
Reserved_7_7 at 0 range 7 .. 7;
DMA2CH1IM at 0 range 8 .. 8;
DMA2CH2IM at 0 range 9 .. 9;
DMA2CH3IM at 0 range 10 .. 10;
DMA2CH4IM at 0 range 11 .. 11;
DMA2CH5IM at 0 range 12 .. 12;
DMA2CH6IM at 0 range 13 .. 13;
DMA2CH7IM at 0 range 14 .. 14;
DMAMUX1IM at 0 range 15 .. 15;
PVM1IM at 0 range 16 .. 16;
Reserved_17_17 at 0 range 17 .. 17;
PVM3IM at 0 range 18 .. 18;
Reserved_19_19 at 0 range 19 .. 19;
PVDIM at 0 range 20 .. 20;
TSCIM at 0 range 21 .. 21;
LCDIM at 0 range 22 .. 22;
Reserved_23_31 at 0 range 23 .. 31;
end record;
-- SIPCR_SAES array
type SIPCR_SAES_Field_Array is array (1 .. 2) of Boolean
with Component_Size => 1, Size => 2;
-- Type definition for SIPCR_SAES
type SIPCR_SAES_Field
(As_Array : Boolean := False)
is record
case As_Array is
when False =>
-- SAES as a value
Val : HAL.UInt2;
when True =>
-- SAES as an array
Arr : SIPCR_SAES_Field_Array;
end case;
end record
with Unchecked_Union, Size => 2;
for SIPCR_SAES_Field use record
Val at 0 range 0 .. 1;
Arr at 0 range 0 .. 1;
end record;
type SIPCR_Register is record
SAES : SIPCR_SAES_Field := (As_Array => False, Val => 16#0#);
SPKA : Boolean := False;
SRNG : Boolean := False;
-- unspecified
Reserved_4_31 : HAL.UInt28 := 16#0#;
end record
with Volatile_Full_Access, Size => 32,
Bit_Order => System.Low_Order_First;
for SIPCR_Register use record
SAES at 0 range 0 .. 1;
SPKA at 0 range 2 .. 2;
SRNG at 0 range 3 .. 3;
Reserved_4_31 at 0 range 4 .. 31;
end record;
-----------------
-- Peripherals --
-----------------
type SYSCFG2_Peripheral is record
IMR1 : aliased IMR1_Register;
IMR2 : aliased IMR2_Register;
C2IMR1 : aliased C2IMR1_Register;
C2IMR2 : aliased C2IMR2_Register;
SIPCR : aliased SIPCR_Register;
end record
with Volatile;
for SYSCFG2_Peripheral use record
IMR1 at 16#100# range 0 .. 31;
IMR2 at 16#104# range 0 .. 31;
C2IMR1 at 16#108# range 0 .. 31;
C2IMR2 at 16#10C# range 0 .. 31;
SIPCR at 16#110# range 0 .. 31;
end record;
SYSCFG2_Periph : aliased SYSCFG2_Peripheral
with Import, Address => System'To_Address (16#40010000#);
end STM32_SVD.SYSCFG2;
| 35.225 | 76 | 0.508162 |
5e3b55dd6af6a458e864ac30e840768dc2e99c98 | 5,981 | ads | Ada | Validation/pyFrame3DD-master/gcc-master/gcc/ada/libgnarl/s-linux__x32.ads | djamal2727/Main-Bearing-Analytical-Model | 2f00c2219c71be0175c6f4f8f1d4cca231d97096 | [
"Apache-2.0"
] | null | null | null | Validation/pyFrame3DD-master/gcc-master/gcc/ada/libgnarl/s-linux__x32.ads | djamal2727/Main-Bearing-Analytical-Model | 2f00c2219c71be0175c6f4f8f1d4cca231d97096 | [
"Apache-2.0"
] | null | null | null | Validation/pyFrame3DD-master/gcc-master/gcc/ada/libgnarl/s-linux__x32.ads | djamal2727/Main-Bearing-Analytical-Model | 2f00c2219c71be0175c6f4f8f1d4cca231d97096 | [
"Apache-2.0"
] | null | null | null | ------------------------------------------------------------------------------
-- --
-- GNU ADA RUN-TIME LIBRARY (GNARL) COMPONENTS --
-- --
-- S Y S T E M . L I N U X --
-- --
-- S p e c --
-- --
-- Copyright (C) 2013-2020, Free Software Foundation, Inc. --
--
-- --
-- GNARL is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
-- ware Foundation; either version 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 is the x32 version of this package
-- This package encapsulates cpu specific differences between implementations
-- of GNU/Linux, in order to share s-osinte-linux.ads.
-- PLEASE DO NOT add any with-clauses to this package or remove the pragma
-- Preelaborate. This package is designed to be a bottom-level (leaf) package
with Interfaces.C;
package System.Linux is
pragma Preelaborate;
----------
-- Time --
----------
subtype suseconds_t is Long_Long_Integer;
subtype time_t is Long_Long_Integer;
subtype clockid_t is Interfaces.C.int;
type timespec is record
tv_sec : time_t;
tv_nsec : Long_Long_Integer;
end record;
pragma Convention (C, timespec);
type timeval is record
tv_sec : time_t;
tv_usec : suseconds_t;
end record;
pragma Convention (C, timeval);
-----------
-- Errno --
-----------
EAGAIN : constant := 11;
EINTR : constant := 4;
EINVAL : constant := 22;
ENOMEM : constant := 12;
EPERM : constant := 1;
ETIMEDOUT : constant := 110;
-------------
-- Signals --
-------------
SIGHUP : constant := 1; -- hangup
SIGINT : constant := 2; -- interrupt (rubout)
SIGQUIT : constant := 3; -- quit (ASCD FS)
SIGILL : constant := 4; -- illegal instruction (not reset)
SIGTRAP : constant := 5; -- trace trap (not reset)
SIGIOT : constant := 6; -- IOT instruction
SIGABRT : constant := 6; -- used by abort, replace SIGIOT in the future
SIGFPE : constant := 8; -- floating point exception
SIGKILL : constant := 9; -- kill (cannot be caught or ignored)
SIGBUS : constant := 7; -- bus error
SIGUSR1 : constant := 10; -- user defined signal 1
SIGSEGV : constant := 11; -- segmentation violation
SIGUSR2 : constant := 12; -- user defined signal 2
SIGPIPE : constant := 13; -- write on a pipe with no one to read it
SIGALRM : constant := 14; -- alarm clock
SIGTERM : constant := 15; -- software termination signal from kill
SIGSTKFLT : constant := 16; -- coprocessor stack fault (Linux)
SIGCLD : constant := 17; -- alias for SIGCHLD
SIGCHLD : constant := 17; -- child status change
SIGSTOP : constant := 19; -- stop (cannot be caught or ignored)
SIGTSTP : constant := 20; -- user stop requested from tty
SIGCONT : constant := 18; -- stopped process has been continued
SIGTTIN : constant := 21; -- background tty read attempted
SIGTTOU : constant := 22; -- background tty write attempted
SIGURG : constant := 23; -- urgent condition on IO channel
SIGXCPU : constant := 24; -- CPU time limit exceeded
SIGXFSZ : constant := 25; -- filesize limit exceeded
SIGVTALRM : constant := 26; -- virtual timer expired
SIGPROF : constant := 27; -- profiling timer expired
SIGWINCH : constant := 28; -- window size change
SIGPOLL : constant := 29; -- pollable event occurred
SIGIO : constant := 29; -- I/O now possible (4.2 BSD)
SIGLOST : constant := 29; -- File lock lost
SIGPWR : constant := 30; -- power-fail restart
SIGSYS : constant := 31; -- bad system call
SIGUNUSED : constant := 31; -- unused signal (mapped to SIGSYS)
SIG32 : constant := 32; -- glibc internal signal
SIG33 : constant := 33; -- glibc internal signal
SIG34 : constant := 34; -- glibc internal signal
-- struct_sigaction offsets
sa_handler_pos : constant := 0;
sa_mask_pos : constant := Standard'Address_Size / 8;
sa_flags_pos : constant := 128 + sa_mask_pos;
SA_SIGINFO : constant := 16#04#;
SA_ONSTACK : constant := 16#08000000#;
end System.Linux;
| 46.364341 | 78 | 0.512958 |
19717acd4671d62bc60d0474b5d123cc6c5a7d41 | 53,234 | ada | Ada | snapshot/Ada/server-skeleton-body.ada | daemonl/openapi-codegen | 7dec48c1768ca6e23e6bf136df5fc7863af88c1d | [
"Apache-2.0"
] | null | null | null | snapshot/Ada/server-skeleton-body.ada | daemonl/openapi-codegen | 7dec48c1768ca6e23e6bf136df5fc7863af88c1d | [
"Apache-2.0"
] | null | null | null | snapshot/Ada/server-skeleton-body.ada | daemonl/openapi-codegen | 7dec48c1768ca6e23e6bf136df5fc7863af88c1d | [
"Apache-2.0"
] | null | null | null | -- Swagger Petstore
-- This is a sample server Petstore server. You can find out more about Swagger at [http://swagger.io](http://swagger.io) or on [irc.freenode.net, #swagger](http://swagger.io/irc/). For this sample, you can use the api key `special-key` to test the authorization filters.
--
-- OpenAPI spec version: 1.0.0
-- Contact: [email protected]
--
-- NOTE: This package is auto generated by the swagger code generator 1.5.0.
-- https://github.com/swagger-api/swagger-codegen.git
-- Do not edit the class manually.with Swagger.Streams;
with Swagger.Servers.Operation;
package body IO.OpenAPI.Api.Skeletons is
package body Skeleton is
package API_addPet is
new Swagger.Servers.Operation (Handler => addPet,
Method => Swagger.Servers.POST,
URI => "/pet");
-- Add a new pet to the store
procedure addPet
(Req : in out Swagger.Servers.Request'Class;
Reply : in out Swagger.Servers.Response'Class;
Stream : in out Swagger.Servers.Output_Stream'Class;
Context : in out Swagger.Servers.Context_Type) is
Input : Swagger.Value_Type;
Impl : Implementation_Type;
body : object;
begin
if not Context.Is_Authenticated then
Context.Set_Error (401, "Not authenticated");
return;
end if;
if not Context.Has_Permission (ACL_.Permission) then
Context.Set_Error (403, "Permission denied");
return;
end if;
if not Context.Has_Permission (ACL_.Permission) then
Context.Set_Error (403, "Permission denied");
return;
end if;
Swagger.Servers.Read (Req, Input);
Deserialize (Input, "body", body);
Impl.addPet
(body, Context);
end addPet;
package API_updatePet is
new Swagger.Servers.Operation (Handler => updatePet,
Method => Swagger.Servers.PUT,
URI => "/pet");
-- Update an existing pet
procedure updatePet
(Req : in out Swagger.Servers.Request'Class;
Reply : in out Swagger.Servers.Response'Class;
Stream : in out Swagger.Servers.Output_Stream'Class;
Context : in out Swagger.Servers.Context_Type) is
Input : Swagger.Value_Type;
Impl : Implementation_Type;
body : object;
begin
if not Context.Is_Authenticated then
Context.Set_Error (401, "Not authenticated");
return;
end if;
if not Context.Has_Permission (ACL_.Permission) then
Context.Set_Error (403, "Permission denied");
return;
end if;
if not Context.Has_Permission (ACL_.Permission) then
Context.Set_Error (403, "Permission denied");
return;
end if;
Swagger.Servers.Read (Req, Input);
Deserialize (Input, "body", body);
Impl.updatePet
(body, Context);
end updatePet;
package API_findPetsByStatus is
new Swagger.Servers.Operation (Handler => findPetsByStatus,
Method => Swagger.Servers.GET,
URI => "/pet/findByStatus");
-- Finds Pets by status
procedure findPetsByStatus
(Req : in out Swagger.Servers.Request'Class;
Reply : in out Swagger.Servers.Response'Class;
Stream : in out Swagger.Servers.Output_Stream'Class;
Context : in out Swagger.Servers.Context_Type) is
Impl : Implementation_Type;
status : array;
Result : array;
begin
if not Context.Is_Authenticated then
Context.Set_Error (401, "Not authenticated");
return;
end if;
if not Context.Has_Permission (ACL_.Permission) then
Context.Set_Error (403, "Permission denied");
return;
end if;
if not Context.Has_Permission (ACL_.Permission) then
Context.Set_Error (403, "Permission denied");
return;
end if;
Swagger.Servers.Get_Query_Parameter (Req, "status", status);
Impl.findPetsByStatus
(status, Result, Context);
if Context.Get_Status = 200 then
Stream.Start_Document;
Swagger.Streams.Serialize (Stream, "", Result);
Stream.End_Document;
end if;
end findPetsByStatus;
package API_findPetsByTags is
new Swagger.Servers.Operation (Handler => findPetsByTags,
Method => Swagger.Servers.GET,
URI => "/pet/findByTags");
-- Finds Pets by tags
procedure findPetsByTags
(Req : in out Swagger.Servers.Request'Class;
Reply : in out Swagger.Servers.Response'Class;
Stream : in out Swagger.Servers.Output_Stream'Class;
Context : in out Swagger.Servers.Context_Type) is
Impl : Implementation_Type;
tags : array;
Result : array;
begin
if not Context.Is_Authenticated then
Context.Set_Error (401, "Not authenticated");
return;
end if;
if not Context.Has_Permission (ACL_.Permission) then
Context.Set_Error (403, "Permission denied");
return;
end if;
if not Context.Has_Permission (ACL_.Permission) then
Context.Set_Error (403, "Permission denied");
return;
end if;
Swagger.Servers.Get_Query_Parameter (Req, "tags", tags);
Impl.findPetsByTags
(tags, Result, Context);
if Context.Get_Status = 200 then
Stream.Start_Document;
Swagger.Streams.Serialize (Stream, "", Result);
Stream.End_Document;
end if;
end findPetsByTags;
package API_getPetById is
new Swagger.Servers.Operation (Handler => getPetById,
Method => Swagger.Servers.GET,
URI => "/pet/{petId}");
-- Find pet by ID
procedure getPetById
(Req : in out Swagger.Servers.Request'Class;
Reply : in out Swagger.Servers.Response'Class;
Stream : in out Swagger.Servers.Output_Stream'Class;
Context : in out Swagger.Servers.Context_Type) is
Impl : Implementation_Type;
petId : integer;
Result : Pet;
begin
if not Context.Is_Authenticated then
Context.Set_Error (401, "Not authenticated");
return;
end if;
Swagger.Servers.Get_Path_Parameter (Req, , petId);
Impl.getPetById
(petId, Result, Context);
if Context.Get_Status = 200 then
Stream.Start_Document;
IO.OpenAPI.Api.Models.Serialize (Stream, "", Result);
Stream.End_Document;
end if;
end getPetById;
package API_updatePetWithForm is
new Swagger.Servers.Operation (Handler => updatePetWithForm,
Method => Swagger.Servers.POST,
URI => "/pet/{petId}");
-- Updates a pet in the store with form data
procedure updatePetWithForm
(Req : in out Swagger.Servers.Request'Class;
Reply : in out Swagger.Servers.Response'Class;
Stream : in out Swagger.Servers.Output_Stream'Class;
Context : in out Swagger.Servers.Context_Type) is
Input : Swagger.Value_Type;
Impl : Implementation_Type;
petId : integer;
body : object;
begin
if not Context.Is_Authenticated then
Context.Set_Error (401, "Not authenticated");
return;
end if;
if not Context.Has_Permission (ACL_.Permission) then
Context.Set_Error (403, "Permission denied");
return;
end if;
if not Context.Has_Permission (ACL_.Permission) then
Context.Set_Error (403, "Permission denied");
return;
end if;
Swagger.Servers.Get_Path_Parameter (Req, , petId);
Swagger.Servers.Read (Req, Input);
Deserialize (Input, "body", body);
Impl.updatePetWithForm
(petId,
body, Context);
end updatePetWithForm;
package API_deletePet is
new Swagger.Servers.Operation (Handler => deletePet,
Method => Swagger.Servers.DELETE,
URI => "/pet/{petId}");
-- Deletes a pet
procedure deletePet
(Req : in out Swagger.Servers.Request'Class;
Reply : in out Swagger.Servers.Response'Class;
Stream : in out Swagger.Servers.Output_Stream'Class;
Context : in out Swagger.Servers.Context_Type) is
Impl : Implementation_Type;
petId : integer;
api_key : string;
begin
if not Context.Is_Authenticated then
Context.Set_Error (401, "Not authenticated");
return;
end if;
if not Context.Has_Permission (ACL_.Permission) then
Context.Set_Error (403, "Permission denied");
return;
end if;
if not Context.Has_Permission (ACL_.Permission) then
Context.Set_Error (403, "Permission denied");
return;
end if;
Swagger.Servers.Get_Path_Parameter (Req, , petId);
Impl.deletePet
(petId,
api_key, Context);
end deletePet;
package API_uploadFile is
new Swagger.Servers.Operation (Handler => uploadFile,
Method => Swagger.Servers.POST,
URI => "/pet/{petId}/uploadImage");
-- uploads an image
procedure uploadFile
(Req : in out Swagger.Servers.Request'Class;
Reply : in out Swagger.Servers.Response'Class;
Stream : in out Swagger.Servers.Output_Stream'Class;
Context : in out Swagger.Servers.Context_Type) is
Input : Swagger.Value_Type;
Impl : Implementation_Type;
petId : integer;
body : string;
Result : ApiResponse;
begin
if not Context.Is_Authenticated then
Context.Set_Error (401, "Not authenticated");
return;
end if;
if not Context.Has_Permission (ACL_.Permission) then
Context.Set_Error (403, "Permission denied");
return;
end if;
if not Context.Has_Permission (ACL_.Permission) then
Context.Set_Error (403, "Permission denied");
return;
end if;
Swagger.Servers.Get_Path_Parameter (Req, , petId);
Swagger.Servers.Read (Req, Input);
Deserialize (Input, "body", body);
Impl.uploadFile
(petId,
body, Result, Context);
if Context.Get_Status = 200 then
Stream.Start_Document;
IO.OpenAPI.Api.Models.Serialize (Stream, "", Result);
Stream.End_Document;
end if;
end uploadFile;
package API_getInventory is
new Swagger.Servers.Operation (Handler => getInventory,
Method => Swagger.Servers.GET,
URI => "/store/inventory");
-- Returns pet inventories by status
procedure getInventory
(Req : in out Swagger.Servers.Request'Class;
Reply : in out Swagger.Servers.Response'Class;
Stream : in out Swagger.Servers.Output_Stream'Class;
Context : in out Swagger.Servers.Context_Type) is
Impl : Implementation_Type;
Result : object;
begin
if not Context.Is_Authenticated then
Context.Set_Error (401, "Not authenticated");
return;
end if;
Impl.getInventory (Result, Context);
if Context.Get_Status = 200 then
Stream.Start_Document;
Swagger.Streams.Serialize (Stream, "", Result);
Stream.End_Document;
end if;
end getInventory;
package API_placeOrder is
new Swagger.Servers.Operation (Handler => placeOrder,
Method => Swagger.Servers.POST,
URI => "/store/order");
-- Place an order for a pet
procedure placeOrder
(Req : in out Swagger.Servers.Request'Class;
Reply : in out Swagger.Servers.Response'Class;
Stream : in out Swagger.Servers.Output_Stream'Class;
Context : in out Swagger.Servers.Context_Type) is
Input : Swagger.Value_Type;
Impl : Implementation_Type;
body : object;
Result : Order;
begin
Swagger.Servers.Read (Req, Input);
Deserialize (Input, "body", body);
Impl.placeOrder
(body, Result, Context);
if Context.Get_Status = 200 then
Stream.Start_Document;
IO.OpenAPI.Api.Models.Serialize (Stream, "", Result);
Stream.End_Document;
end if;
end placeOrder;
package API_getOrderById is
new Swagger.Servers.Operation (Handler => getOrderById,
Method => Swagger.Servers.GET,
URI => "/store/order/{orderId}");
-- Find purchase order by ID
procedure getOrderById
(Req : in out Swagger.Servers.Request'Class;
Reply : in out Swagger.Servers.Response'Class;
Stream : in out Swagger.Servers.Output_Stream'Class;
Context : in out Swagger.Servers.Context_Type) is
Impl : Implementation_Type;
orderId : integer;
Result : Order;
begin
Swagger.Servers.Get_Path_Parameter (Req, , orderId);
Impl.getOrderById
(orderId, Result, Context);
if Context.Get_Status = 200 then
Stream.Start_Document;
IO.OpenAPI.Api.Models.Serialize (Stream, "", Result);
Stream.End_Document;
end if;
end getOrderById;
package API_deleteOrder is
new Swagger.Servers.Operation (Handler => deleteOrder,
Method => Swagger.Servers.DELETE,
URI => "/store/order/{orderId}");
-- Delete purchase order by ID
procedure deleteOrder
(Req : in out Swagger.Servers.Request'Class;
Reply : in out Swagger.Servers.Response'Class;
Stream : in out Swagger.Servers.Output_Stream'Class;
Context : in out Swagger.Servers.Context_Type) is
Impl : Implementation_Type;
orderId : integer;
begin
Swagger.Servers.Get_Path_Parameter (Req, , orderId);
Impl.deleteOrder
(orderId, Context);
end deleteOrder;
package API_createUser is
new Swagger.Servers.Operation (Handler => createUser,
Method => Swagger.Servers.POST,
URI => "/user");
-- Create user
procedure createUser
(Req : in out Swagger.Servers.Request'Class;
Reply : in out Swagger.Servers.Response'Class;
Stream : in out Swagger.Servers.Output_Stream'Class;
Context : in out Swagger.Servers.Context_Type) is
Input : Swagger.Value_Type;
Impl : Implementation_Type;
body : object;
begin
Swagger.Servers.Read (Req, Input);
Deserialize (Input, "body", body);
Impl.createUser
(body, Context);
end createUser;
package API_createUsersWithArrayInput is
new Swagger.Servers.Operation (Handler => createUsersWithArrayInput,
Method => Swagger.Servers.POST,
URI => "/user/createWithArray");
-- Creates list of users with given input array
procedure createUsersWithArrayInput
(Req : in out Swagger.Servers.Request'Class;
Reply : in out Swagger.Servers.Response'Class;
Stream : in out Swagger.Servers.Output_Stream'Class;
Context : in out Swagger.Servers.Context_Type) is
Input : Swagger.Value_Type;
Impl : Implementation_Type;
body : array;
begin
Swagger.Servers.Read (Req, Input);
Deserialize (Input, "body", body);
Impl.createUsersWithArrayInput
(body, Context);
end createUsersWithArrayInput;
package API_createUsersWithListInput is
new Swagger.Servers.Operation (Handler => createUsersWithListInput,
Method => Swagger.Servers.POST,
URI => "/user/createWithList");
-- Creates list of users with given input array
procedure createUsersWithListInput
(Req : in out Swagger.Servers.Request'Class;
Reply : in out Swagger.Servers.Response'Class;
Stream : in out Swagger.Servers.Output_Stream'Class;
Context : in out Swagger.Servers.Context_Type) is
Input : Swagger.Value_Type;
Impl : Implementation_Type;
body : array;
begin
Swagger.Servers.Read (Req, Input);
Deserialize (Input, "body", body);
Impl.createUsersWithListInput
(body, Context);
end createUsersWithListInput;
package API_loginUser is
new Swagger.Servers.Operation (Handler => loginUser,
Method => Swagger.Servers.GET,
URI => "/user/login");
-- Logs user into the system
procedure loginUser
(Req : in out Swagger.Servers.Request'Class;
Reply : in out Swagger.Servers.Response'Class;
Stream : in out Swagger.Servers.Output_Stream'Class;
Context : in out Swagger.Servers.Context_Type) is
Impl : Implementation_Type;
username : string;
password : string;
Result : string;
begin
Swagger.Servers.Get_Query_Parameter (Req, "username", username);
Swagger.Servers.Get_Query_Parameter (Req, "password", password);
Impl.loginUser
(username,
password, Result, Context);
if Context.Get_Status = 200 then
Stream.Start_Document;
Swagger.Streams.Serialize (Stream, "", Result);
Stream.End_Document;
end if;
end loginUser;
package API_logoutUser is
new Swagger.Servers.Operation (Handler => logoutUser,
Method => Swagger.Servers.GET,
URI => "/user/logout");
-- Logs out current logged in user session
procedure logoutUser
(Req : in out Swagger.Servers.Request'Class;
Reply : in out Swagger.Servers.Response'Class;
Stream : in out Swagger.Servers.Output_Stream'Class;
Context : in out Swagger.Servers.Context_Type) is
Impl : Implementation_Type;
begin
Impl.logoutUser (Context);
end logoutUser;
package API_getUserByName is
new Swagger.Servers.Operation (Handler => getUserByName,
Method => Swagger.Servers.GET,
URI => "/user/{username}");
-- Get user by user name
procedure getUserByName
(Req : in out Swagger.Servers.Request'Class;
Reply : in out Swagger.Servers.Response'Class;
Stream : in out Swagger.Servers.Output_Stream'Class;
Context : in out Swagger.Servers.Context_Type) is
Impl : Implementation_Type;
username : string;
Result : User;
begin
Swagger.Servers.Get_Path_Parameter (Req, , username);
Impl.getUserByName
(username, Result, Context);
if Context.Get_Status = 200 then
Stream.Start_Document;
IO.OpenAPI.Api.Models.Serialize (Stream, "", Result);
Stream.End_Document;
end if;
end getUserByName;
package API_updateUser is
new Swagger.Servers.Operation (Handler => updateUser,
Method => Swagger.Servers.PUT,
URI => "/user/{username}");
-- Updated user
procedure updateUser
(Req : in out Swagger.Servers.Request'Class;
Reply : in out Swagger.Servers.Response'Class;
Stream : in out Swagger.Servers.Output_Stream'Class;
Context : in out Swagger.Servers.Context_Type) is
Input : Swagger.Value_Type;
Impl : Implementation_Type;
username : string;
body : object;
begin
Swagger.Servers.Get_Path_Parameter (Req, , username);
Swagger.Servers.Read (Req, Input);
Deserialize (Input, "body", body);
Impl.updateUser
(username,
body, Context);
end updateUser;
package API_deleteUser is
new Swagger.Servers.Operation (Handler => deleteUser,
Method => Swagger.Servers.DELETE,
URI => "/user/{username}");
-- Delete user
procedure deleteUser
(Req : in out Swagger.Servers.Request'Class;
Reply : in out Swagger.Servers.Response'Class;
Stream : in out Swagger.Servers.Output_Stream'Class;
Context : in out Swagger.Servers.Context_Type) is
Impl : Implementation_Type;
username : string;
begin
Swagger.Servers.Get_Path_Parameter (Req, , username);
Impl.deleteUser
(username, Context);
end deleteUser;
procedure Register (Server : in out Swagger.Servers.Application_Type'Class) is
begin
Swagger.Servers.Register (Server, API_addPet.Definition);
Swagger.Servers.Register (Server, API_updatePet.Definition);
Swagger.Servers.Register (Server, API_findPetsByStatus.Definition);
Swagger.Servers.Register (Server, API_findPetsByTags.Definition);
Swagger.Servers.Register (Server, API_getPetById.Definition);
Swagger.Servers.Register (Server, API_updatePetWithForm.Definition);
Swagger.Servers.Register (Server, API_deletePet.Definition);
Swagger.Servers.Register (Server, API_uploadFile.Definition);
Swagger.Servers.Register (Server, API_getInventory.Definition);
Swagger.Servers.Register (Server, API_placeOrder.Definition);
Swagger.Servers.Register (Server, API_getOrderById.Definition);
Swagger.Servers.Register (Server, API_deleteOrder.Definition);
Swagger.Servers.Register (Server, API_createUser.Definition);
Swagger.Servers.Register (Server, API_createUsersWithArrayInput.Definition);
Swagger.Servers.Register (Server, API_createUsersWithListInput.Definition);
Swagger.Servers.Register (Server, API_loginUser.Definition);
Swagger.Servers.Register (Server, API_logoutUser.Definition);
Swagger.Servers.Register (Server, API_getUserByName.Definition);
Swagger.Servers.Register (Server, API_updateUser.Definition);
Swagger.Servers.Register (Server, API_deleteUser.Definition);
end Register;
end Skeleton;
package body Shared_Instance is
-- Add a new pet to the store
procedure addPet
(Req : in out Swagger.Servers.Request'Class;
Reply : in out Swagger.Servers.Response'Class;
Stream : in out Swagger.Servers.Output_Stream'Class;
Context : in out Swagger.Servers.Context_Type) is
Input : Swagger.Value_Type;
body : object;
begin
if not Context.Is_Authenticated then
Context.Set_Error (401, "Not authenticated");
return;
end if;
if not Context.Has_Permission (ACL_.Permission) then
Context.Set_Error (403, "Permission denied");
return;
end if;
if not Context.Has_Permission (ACL_.Permission) then
Context.Set_Error (403, "Permission denied");
return;
end if;
Swagger.Servers.Read (Req, Input);
Deserialize (Input, "body", body);
Server.addPet
(body, Context);
end addPet;
package API_addPet is
new Swagger.Servers.Operation (Handler => addPet,
Method => Swagger.Servers.POST,
URI => "/pet");
-- Update an existing pet
procedure updatePet
(Req : in out Swagger.Servers.Request'Class;
Reply : in out Swagger.Servers.Response'Class;
Stream : in out Swagger.Servers.Output_Stream'Class;
Context : in out Swagger.Servers.Context_Type) is
Input : Swagger.Value_Type;
body : object;
begin
if not Context.Is_Authenticated then
Context.Set_Error (401, "Not authenticated");
return;
end if;
if not Context.Has_Permission (ACL_.Permission) then
Context.Set_Error (403, "Permission denied");
return;
end if;
if not Context.Has_Permission (ACL_.Permission) then
Context.Set_Error (403, "Permission denied");
return;
end if;
Swagger.Servers.Read (Req, Input);
Deserialize (Input, "body", body);
Server.updatePet
(body, Context);
end updatePet;
package API_updatePet is
new Swagger.Servers.Operation (Handler => updatePet,
Method => Swagger.Servers.PUT,
URI => "/pet");
-- Finds Pets by status
procedure findPetsByStatus
(Req : in out Swagger.Servers.Request'Class;
Reply : in out Swagger.Servers.Response'Class;
Stream : in out Swagger.Servers.Output_Stream'Class;
Context : in out Swagger.Servers.Context_Type) is
status : array;
Result : array;
begin
if not Context.Is_Authenticated then
Context.Set_Error (401, "Not authenticated");
return;
end if;
if not Context.Has_Permission (ACL_.Permission) then
Context.Set_Error (403, "Permission denied");
return;
end if;
if not Context.Has_Permission (ACL_.Permission) then
Context.Set_Error (403, "Permission denied");
return;
end if;
Swagger.Servers.Get_Query_Parameter (Req, "status", status);
Server.findPetsByStatus
(status, Result, Context);
if Context.Get_Status = 200 then
Stream.Start_Document;
Swagger.Streams.Serialize (Stream, "", Result);
Stream.End_Document;
end if;
end findPetsByStatus;
package API_findPetsByStatus is
new Swagger.Servers.Operation (Handler => findPetsByStatus,
Method => Swagger.Servers.GET,
URI => "/pet/findByStatus");
-- Finds Pets by tags
procedure findPetsByTags
(Req : in out Swagger.Servers.Request'Class;
Reply : in out Swagger.Servers.Response'Class;
Stream : in out Swagger.Servers.Output_Stream'Class;
Context : in out Swagger.Servers.Context_Type) is
tags : array;
Result : array;
begin
if not Context.Is_Authenticated then
Context.Set_Error (401, "Not authenticated");
return;
end if;
if not Context.Has_Permission (ACL_.Permission) then
Context.Set_Error (403, "Permission denied");
return;
end if;
if not Context.Has_Permission (ACL_.Permission) then
Context.Set_Error (403, "Permission denied");
return;
end if;
Swagger.Servers.Get_Query_Parameter (Req, "tags", tags);
Server.findPetsByTags
(tags, Result, Context);
if Context.Get_Status = 200 then
Stream.Start_Document;
Swagger.Streams.Serialize (Stream, "", Result);
Stream.End_Document;
end if;
end findPetsByTags;
package API_findPetsByTags is
new Swagger.Servers.Operation (Handler => findPetsByTags,
Method => Swagger.Servers.GET,
URI => "/pet/findByTags");
-- Find pet by ID
procedure getPetById
(Req : in out Swagger.Servers.Request'Class;
Reply : in out Swagger.Servers.Response'Class;
Stream : in out Swagger.Servers.Output_Stream'Class;
Context : in out Swagger.Servers.Context_Type) is
petId : integer;
Result : Pet;
begin
if not Context.Is_Authenticated then
Context.Set_Error (401, "Not authenticated");
return;
end if;
Swagger.Servers.Get_Path_Parameter (Req, , petId);
Server.getPetById
(petId, Result, Context);
if Context.Get_Status = 200 then
Stream.Start_Document;
IO.OpenAPI.Api.Models.Serialize (Stream, "", Result);
Stream.End_Document;
end if;
end getPetById;
package API_getPetById is
new Swagger.Servers.Operation (Handler => getPetById,
Method => Swagger.Servers.GET,
URI => "/pet/{petId}");
-- Updates a pet in the store with form data
procedure updatePetWithForm
(Req : in out Swagger.Servers.Request'Class;
Reply : in out Swagger.Servers.Response'Class;
Stream : in out Swagger.Servers.Output_Stream'Class;
Context : in out Swagger.Servers.Context_Type) is
Input : Swagger.Value_Type;
petId : integer;
body : object;
begin
if not Context.Is_Authenticated then
Context.Set_Error (401, "Not authenticated");
return;
end if;
if not Context.Has_Permission (ACL_.Permission) then
Context.Set_Error (403, "Permission denied");
return;
end if;
if not Context.Has_Permission (ACL_.Permission) then
Context.Set_Error (403, "Permission denied");
return;
end if;
Swagger.Servers.Get_Path_Parameter (Req, , petId);
Swagger.Servers.Read (Req, Input);
Deserialize (Input, "body", body);
Server.updatePetWithForm
(petId,
body, Context);
end updatePetWithForm;
package API_updatePetWithForm is
new Swagger.Servers.Operation (Handler => updatePetWithForm,
Method => Swagger.Servers.POST,
URI => "/pet/{petId}");
-- Deletes a pet
procedure deletePet
(Req : in out Swagger.Servers.Request'Class;
Reply : in out Swagger.Servers.Response'Class;
Stream : in out Swagger.Servers.Output_Stream'Class;
Context : in out Swagger.Servers.Context_Type) is
petId : integer;
api_key : string;
begin
if not Context.Is_Authenticated then
Context.Set_Error (401, "Not authenticated");
return;
end if;
if not Context.Has_Permission (ACL_.Permission) then
Context.Set_Error (403, "Permission denied");
return;
end if;
if not Context.Has_Permission (ACL_.Permission) then
Context.Set_Error (403, "Permission denied");
return;
end if;
Swagger.Servers.Get_Path_Parameter (Req, , petId);
Server.deletePet
(petId,
api_key, Context);
end deletePet;
package API_deletePet is
new Swagger.Servers.Operation (Handler => deletePet,
Method => Swagger.Servers.DELETE,
URI => "/pet/{petId}");
-- uploads an image
procedure uploadFile
(Req : in out Swagger.Servers.Request'Class;
Reply : in out Swagger.Servers.Response'Class;
Stream : in out Swagger.Servers.Output_Stream'Class;
Context : in out Swagger.Servers.Context_Type) is
Input : Swagger.Value_Type;
petId : integer;
body : string;
Result : ApiResponse;
begin
if not Context.Is_Authenticated then
Context.Set_Error (401, "Not authenticated");
return;
end if;
if not Context.Has_Permission (ACL_.Permission) then
Context.Set_Error (403, "Permission denied");
return;
end if;
if not Context.Has_Permission (ACL_.Permission) then
Context.Set_Error (403, "Permission denied");
return;
end if;
Swagger.Servers.Get_Path_Parameter (Req, , petId);
Swagger.Servers.Read (Req, Input);
Deserialize (Input, "body", body);
Server.uploadFile
(petId,
body, Result, Context);
if Context.Get_Status = 200 then
Stream.Start_Document;
IO.OpenAPI.Api.Models.Serialize (Stream, "", Result);
Stream.End_Document;
end if;
end uploadFile;
package API_uploadFile is
new Swagger.Servers.Operation (Handler => uploadFile,
Method => Swagger.Servers.POST,
URI => "/pet/{petId}/uploadImage");
-- Returns pet inventories by status
procedure getInventory
(Req : in out Swagger.Servers.Request'Class;
Reply : in out Swagger.Servers.Response'Class;
Stream : in out Swagger.Servers.Output_Stream'Class;
Context : in out Swagger.Servers.Context_Type) is
Result : object;
begin
if not Context.Is_Authenticated then
Context.Set_Error (401, "Not authenticated");
return;
end if;
Server.getInventory (Result, Context);
if Context.Get_Status = 200 then
Stream.Start_Document;
Swagger.Streams.Serialize (Stream, "", Result);
Stream.End_Document;
end if;
end getInventory;
package API_getInventory is
new Swagger.Servers.Operation (Handler => getInventory,
Method => Swagger.Servers.GET,
URI => "/store/inventory");
-- Place an order for a pet
procedure placeOrder
(Req : in out Swagger.Servers.Request'Class;
Reply : in out Swagger.Servers.Response'Class;
Stream : in out Swagger.Servers.Output_Stream'Class;
Context : in out Swagger.Servers.Context_Type) is
Input : Swagger.Value_Type;
body : object;
Result : Order;
begin
Swagger.Servers.Read (Req, Input);
Deserialize (Input, "body", body);
Server.placeOrder
(body, Result, Context);
if Context.Get_Status = 200 then
Stream.Start_Document;
IO.OpenAPI.Api.Models.Serialize (Stream, "", Result);
Stream.End_Document;
end if;
end placeOrder;
package API_placeOrder is
new Swagger.Servers.Operation (Handler => placeOrder,
Method => Swagger.Servers.POST,
URI => "/store/order");
-- Find purchase order by ID
procedure getOrderById
(Req : in out Swagger.Servers.Request'Class;
Reply : in out Swagger.Servers.Response'Class;
Stream : in out Swagger.Servers.Output_Stream'Class;
Context : in out Swagger.Servers.Context_Type) is
orderId : integer;
Result : Order;
begin
Swagger.Servers.Get_Path_Parameter (Req, , orderId);
Server.getOrderById
(orderId, Result, Context);
if Context.Get_Status = 200 then
Stream.Start_Document;
IO.OpenAPI.Api.Models.Serialize (Stream, "", Result);
Stream.End_Document;
end if;
end getOrderById;
package API_getOrderById is
new Swagger.Servers.Operation (Handler => getOrderById,
Method => Swagger.Servers.GET,
URI => "/store/order/{orderId}");
-- Delete purchase order by ID
procedure deleteOrder
(Req : in out Swagger.Servers.Request'Class;
Reply : in out Swagger.Servers.Response'Class;
Stream : in out Swagger.Servers.Output_Stream'Class;
Context : in out Swagger.Servers.Context_Type) is
orderId : integer;
begin
Swagger.Servers.Get_Path_Parameter (Req, , orderId);
Server.deleteOrder
(orderId, Context);
end deleteOrder;
package API_deleteOrder is
new Swagger.Servers.Operation (Handler => deleteOrder,
Method => Swagger.Servers.DELETE,
URI => "/store/order/{orderId}");
-- Create user
procedure createUser
(Req : in out Swagger.Servers.Request'Class;
Reply : in out Swagger.Servers.Response'Class;
Stream : in out Swagger.Servers.Output_Stream'Class;
Context : in out Swagger.Servers.Context_Type) is
Input : Swagger.Value_Type;
body : object;
begin
Swagger.Servers.Read (Req, Input);
Deserialize (Input, "body", body);
Server.createUser
(body, Context);
end createUser;
package API_createUser is
new Swagger.Servers.Operation (Handler => createUser,
Method => Swagger.Servers.POST,
URI => "/user");
-- Creates list of users with given input array
procedure createUsersWithArrayInput
(Req : in out Swagger.Servers.Request'Class;
Reply : in out Swagger.Servers.Response'Class;
Stream : in out Swagger.Servers.Output_Stream'Class;
Context : in out Swagger.Servers.Context_Type) is
Input : Swagger.Value_Type;
body : array;
begin
Swagger.Servers.Read (Req, Input);
Deserialize (Input, "body", body);
Server.createUsersWithArrayInput
(body, Context);
end createUsersWithArrayInput;
package API_createUsersWithArrayInput is
new Swagger.Servers.Operation (Handler => createUsersWithArrayInput,
Method => Swagger.Servers.POST,
URI => "/user/createWithArray");
-- Creates list of users with given input array
procedure createUsersWithListInput
(Req : in out Swagger.Servers.Request'Class;
Reply : in out Swagger.Servers.Response'Class;
Stream : in out Swagger.Servers.Output_Stream'Class;
Context : in out Swagger.Servers.Context_Type) is
Input : Swagger.Value_Type;
body : array;
begin
Swagger.Servers.Read (Req, Input);
Deserialize (Input, "body", body);
Server.createUsersWithListInput
(body, Context);
end createUsersWithListInput;
package API_createUsersWithListInput is
new Swagger.Servers.Operation (Handler => createUsersWithListInput,
Method => Swagger.Servers.POST,
URI => "/user/createWithList");
-- Logs user into the system
procedure loginUser
(Req : in out Swagger.Servers.Request'Class;
Reply : in out Swagger.Servers.Response'Class;
Stream : in out Swagger.Servers.Output_Stream'Class;
Context : in out Swagger.Servers.Context_Type) is
username : string;
password : string;
Result : string;
begin
Swagger.Servers.Get_Query_Parameter (Req, "username", username);
Swagger.Servers.Get_Query_Parameter (Req, "password", password);
Server.loginUser
(username,
password, Result, Context);
if Context.Get_Status = 200 then
Stream.Start_Document;
Swagger.Streams.Serialize (Stream, "", Result);
Stream.End_Document;
end if;
end loginUser;
package API_loginUser is
new Swagger.Servers.Operation (Handler => loginUser,
Method => Swagger.Servers.GET,
URI => "/user/login");
-- Logs out current logged in user session
procedure logoutUser
(Req : in out Swagger.Servers.Request'Class;
Reply : in out Swagger.Servers.Response'Class;
Stream : in out Swagger.Servers.Output_Stream'Class;
Context : in out Swagger.Servers.Context_Type) is
begin
Server.logoutUser (Context);
end logoutUser;
package API_logoutUser is
new Swagger.Servers.Operation (Handler => logoutUser,
Method => Swagger.Servers.GET,
URI => "/user/logout");
-- Get user by user name
procedure getUserByName
(Req : in out Swagger.Servers.Request'Class;
Reply : in out Swagger.Servers.Response'Class;
Stream : in out Swagger.Servers.Output_Stream'Class;
Context : in out Swagger.Servers.Context_Type) is
username : string;
Result : User;
begin
Swagger.Servers.Get_Path_Parameter (Req, , username);
Server.getUserByName
(username, Result, Context);
if Context.Get_Status = 200 then
Stream.Start_Document;
IO.OpenAPI.Api.Models.Serialize (Stream, "", Result);
Stream.End_Document;
end if;
end getUserByName;
package API_getUserByName is
new Swagger.Servers.Operation (Handler => getUserByName,
Method => Swagger.Servers.GET,
URI => "/user/{username}");
-- Updated user
procedure updateUser
(Req : in out Swagger.Servers.Request'Class;
Reply : in out Swagger.Servers.Response'Class;
Stream : in out Swagger.Servers.Output_Stream'Class;
Context : in out Swagger.Servers.Context_Type) is
Input : Swagger.Value_Type;
username : string;
body : object;
begin
Swagger.Servers.Get_Path_Parameter (Req, , username);
Swagger.Servers.Read (Req, Input);
Deserialize (Input, "body", body);
Server.updateUser
(username,
body, Context);
end updateUser;
package API_updateUser is
new Swagger.Servers.Operation (Handler => updateUser,
Method => Swagger.Servers.PUT,
URI => "/user/{username}");
-- Delete user
procedure deleteUser
(Req : in out Swagger.Servers.Request'Class;
Reply : in out Swagger.Servers.Response'Class;
Stream : in out Swagger.Servers.Output_Stream'Class;
Context : in out Swagger.Servers.Context_Type) is
username : string;
begin
Swagger.Servers.Get_Path_Parameter (Req, , username);
Server.deleteUser
(username, Context);
end deleteUser;
package API_deleteUser is
new Swagger.Servers.Operation (Handler => deleteUser,
Method => Swagger.Servers.DELETE,
URI => "/user/{username}");
procedure Register (Server : in out Swagger.Servers.Application_Type'Class) is
begin
Swagger.Servers.Register (Server, API_addPet.Definition);
Swagger.Servers.Register (Server, API_updatePet.Definition);
Swagger.Servers.Register (Server, API_findPetsByStatus.Definition);
Swagger.Servers.Register (Server, API_findPetsByTags.Definition);
Swagger.Servers.Register (Server, API_getPetById.Definition);
Swagger.Servers.Register (Server, API_updatePetWithForm.Definition);
Swagger.Servers.Register (Server, API_deletePet.Definition);
Swagger.Servers.Register (Server, API_uploadFile.Definition);
Swagger.Servers.Register (Server, API_getInventory.Definition);
Swagger.Servers.Register (Server, API_placeOrder.Definition);
Swagger.Servers.Register (Server, API_getOrderById.Definition);
Swagger.Servers.Register (Server, API_deleteOrder.Definition);
Swagger.Servers.Register (Server, API_createUser.Definition);
Swagger.Servers.Register (Server, API_createUsersWithArrayInput.Definition);
Swagger.Servers.Register (Server, API_createUsersWithListInput.Definition);
Swagger.Servers.Register (Server, API_loginUser.Definition);
Swagger.Servers.Register (Server, API_logoutUser.Definition);
Swagger.Servers.Register (Server, API_getUserByName.Definition);
Swagger.Servers.Register (Server, API_updateUser.Definition);
Swagger.Servers.Register (Server, API_deleteUser.Definition);
end Register;
protected body Server is
-- Add a new pet to the store
procedure addPet
(body : in object;
Context : in out Swagger.Servers.Context_Type) is
begin
Impl.addPet
(body,
Context);
end addPet;
-- Update an existing pet
procedure updatePet
(body : in object;
Context : in out Swagger.Servers.Context_Type) is
begin
Impl.updatePet
(body,
Context);
end updatePet;
-- Finds Pets by status
procedure findPetsByStatus
(status : in array;
Result : out array;
Context : in out Swagger.Servers.Context_Type) is
begin
Impl.findPetsByStatus
(status,
Result,
Context);
end findPetsByStatus;
-- Finds Pets by tags
procedure findPetsByTags
(tags : in array;
Result : out array;
Context : in out Swagger.Servers.Context_Type) is
begin
Impl.findPetsByTags
(tags,
Result,
Context);
end findPetsByTags;
-- Find pet by ID
procedure getPetById
(petId : in integer;
Result : out Pet;
Context : in out Swagger.Servers.Context_Type) is
begin
Impl.getPetById
(petId,
Result,
Context);
end getPetById;
-- Updates a pet in the store with form data
procedure updatePetWithForm
(petId : in integer;
body : in object;
Context : in out Swagger.Servers.Context_Type) is
begin
Impl.updatePetWithForm
(petId,
body,
Context);
end updatePetWithForm;
-- Deletes a pet
procedure deletePet
(petId : in integer;
api_key : in string;
Context : in out Swagger.Servers.Context_Type) is
begin
Impl.deletePet
(petId,
api_key,
Context);
end deletePet;
-- uploads an image
procedure uploadFile
(petId : in integer;
body : in string;
Result : out ApiResponse;
Context : in out Swagger.Servers.Context_Type) is
begin
Impl.uploadFile
(petId,
body,
Result,
Context);
end uploadFile;
-- Returns pet inventories by status
procedure getInventory (Result : out object;
Context : in out Swagger.Servers.Context_Type) is
begin
Impl.getInventory (Result, Context);
end getInventory;
-- Place an order for a pet
procedure placeOrder
(body : in object;
Result : out Order;
Context : in out Swagger.Servers.Context_Type) is
begin
Impl.placeOrder
(body,
Result,
Context);
end placeOrder;
-- Find purchase order by ID
procedure getOrderById
(orderId : in integer;
Result : out Order;
Context : in out Swagger.Servers.Context_Type) is
begin
Impl.getOrderById
(orderId,
Result,
Context);
end getOrderById;
-- Delete purchase order by ID
procedure deleteOrder
(orderId : in integer;
Context : in out Swagger.Servers.Context_Type) is
begin
Impl.deleteOrder
(orderId,
Context);
end deleteOrder;
-- Create user
procedure createUser
(body : in object;
Context : in out Swagger.Servers.Context_Type) is
begin
Impl.createUser
(body,
Context);
end createUser;
-- Creates list of users with given input array
procedure createUsersWithArrayInput
(body : in array;
Context : in out Swagger.Servers.Context_Type) is
begin
Impl.createUsersWithArrayInput
(body,
Context);
end createUsersWithArrayInput;
-- Creates list of users with given input array
procedure createUsersWithListInput
(body : in array;
Context : in out Swagger.Servers.Context_Type) is
begin
Impl.createUsersWithListInput
(body,
Context);
end createUsersWithListInput;
-- Logs user into the system
procedure loginUser
(username : in string;
password : in string;
Result : out string;
Context : in out Swagger.Servers.Context_Type) is
begin
Impl.loginUser
(username,
password,
Result,
Context);
end loginUser;
-- Logs out current logged in user session
procedure logoutUser (Context : in out Swagger.Servers.Context_Type) is
begin
Impl.logoutUser (Context);
end logoutUser;
-- Get user by user name
procedure getUserByName
(username : in string;
Result : out User;
Context : in out Swagger.Servers.Context_Type) is
begin
Impl.getUserByName
(username,
Result,
Context);
end getUserByName;
-- Updated user
procedure updateUser
(username : in string;
body : in object;
Context : in out Swagger.Servers.Context_Type) is
begin
Impl.updateUser
(username,
body,
Context);
end updateUser;
-- Delete user
procedure deleteUser
(username : in string;
Context : in out Swagger.Servers.Context_Type) is
begin
Impl.deleteUser
(username,
Context);
end deleteUser;
end Server;
end Shared_Instance;
end IO.OpenAPI.Api.Skeletons;
| 37.541608 | 274 | 0.561277 |
9a45d8f03f9320a684560530b2723dcd69d51f0d | 10,037 | ads | Ada | include/sf-audio-soundrecorder.ads | Fabien-Chouteau/ASFML | 52a013554bcfb6150e0d6391871356c1443a6b93 | [
"Zlib"
] | null | null | null | include/sf-audio-soundrecorder.ads | Fabien-Chouteau/ASFML | 52a013554bcfb6150e0d6391871356c1443a6b93 | [
"Zlib"
] | null | null | null | include/sf-audio-soundrecorder.ads | Fabien-Chouteau/ASFML | 52a013554bcfb6150e0d6391871356c1443a6b93 | [
"Zlib"
] | null | null | null | --//////////////////////////////////////////////////////////
-- SFML - Simple and Fast Multimedia Library
-- Copyright (C) 2007-2015 Laurent Gomila ([email protected])
-- This software is provided 'as-is', without any express or implied warranty.
-- In no event will the authors be held liable for any damages arising from the use of this software.
-- Permission is granted to anyone to use this software for any purpose,
-- including commercial applications, and to alter it and redistribute it freely,
-- subject to the following restrictions:
-- 1. The origin of this software must not be misrepresented;
-- you must not claim that you wrote the original software.
-- If you use this software in a product, an acknowledgment
-- in the product documentation would be appreciated but is not required.
-- 2. Altered source versions must be plainly marked as such,
-- and must not be misrepresented as being the original software.
-- 3. This notice may not be removed or altered from any source distribution.
--//////////////////////////////////////////////////////////
with Sf.System.Time;
package Sf.Audio.SoundRecorder is
--/< Type of the callback used when starting a capture
type sfSoundRecorderStartCallback is access function
(userData : Standard.System.Address) return sfBool;
--/< Type of the callback used to process audio data
type sfSoundRecorderProcessCallback is access function
(arg1 : access sfInt16;
arg2 : sfSize_t;
userData : Standard.System.Address) return sfBool;
--/< Type of the callback used when stopping a capture
type sfSoundRecorderStopCallback is access procedure (userData : Standard.System.Address);
--//////////////////////////////////////////////////////////
--/ @brief Construct a new sound recorder from callback functions
--/
--/ @param onStart Callback function which will be called when a new capture starts (can be NULL)
--/ @param onProcess Callback function which will be called each time there's audio data to process
--/ @param onStop Callback function which will be called when the current capture stops (can be NULL)
--/ @param userData Data to pass to the callback function (can be NULL)
--/
--/ @return A new sfSoundRecorder object (NULL if failed)
--/
--//////////////////////////////////////////////////////////
function create
(onStart : sfSoundRecorderStartCallback;
onProcess : sfSoundRecorderProcessCallback;
onStop : sfSoundRecorderStopCallback;
userData : Standard.System.Address) return sfSoundRecorder_Ptr;
--//////////////////////////////////////////////////////////
--/ @brief Destroy a sound recorder
--/
--/ @param soundRecorder Sound recorder to destroy
--/
--//////////////////////////////////////////////////////////
procedure destroy (soundRecorder : sfSoundRecorder_Ptr);
--//////////////////////////////////////////////////////////
--/ @brief Start the capture of a sound recorder
--/
--/ The @a sampleRate parameter defines the number of audio samples
--/ captured per second. The higher, the better the quality
--/ (for example, 44100 samples/sec is CD quality).
--/ This function uses its own thread so that it doesn't block
--/ the rest of the program while the capture runs.
--/ Please note that only one capture can happen at the same time.
--/
--/ @param soundRecorder Sound recorder object
--/ @param sampleRate Desired capture rate, in number of samples per second
--/
--/ @return True, if start of capture was successful
--/
--//////////////////////////////////////////////////////////
function start (soundRecorder : sfSoundRecorder_Ptr; sampleRate : sfUint32) return sfBool;
--//////////////////////////////////////////////////////////
--/ @brief Stop the capture of a sound recorder
--/
--/ @param soundRecorder Sound recorder object
--/
--//////////////////////////////////////////////////////////
procedure stop (soundRecorder : sfSoundRecorder_Ptr);
--//////////////////////////////////////////////////////////
--/ @brief Get the sample rate of a sound recorder
--/
--/ The sample rate defines the number of audio samples
--/ captured per second. The higher, the better the quality
--/ (for example, 44100 samples/sec is CD quality).
--/
--/ @param soundRecorder Sound recorder object
--/
--/ @return Sample rate, in samples per second
--/
--//////////////////////////////////////////////////////////
function getSampleRate (soundRecorder : sfSoundRecorder_Ptr) return sfUint32;
--//////////////////////////////////////////////////////////
--/ @brief Check if the system supports audio capture
--/
--/ This function should always be called before using
--/ the audio capture features. If it returns false, then
--/ any attempt to use sfSoundRecorder will fail.
--/
--/ @return sfTrue if audio capture is supported, sfFalse otherwise
--/
--//////////////////////////////////////////////////////////
function isAvailable return sfBool;
--//////////////////////////////////////////////////////////
--/ @brief Set the processing interval
--/
--/ The processing interval controls the period
--/ between calls to the onProcessSamples function. You may
--/ want to use a small interval if you want to process the
--/ recorded data in real time, for example.
--/
--/ Note: this is only a hint, the actual period may vary.
--/ So don't rely on this parameter to implement precise timing.
--/
--/ The default processing interval is 100 ms.
--/
--/ @param soundRecorder Sound recorder object
--/ @param interval Processing interval
--/
--//////////////////////////////////////////////////////////
procedure setProcessingInterval (soundRecorder : sfSoundRecorder_Ptr; interval : Sf.System.Time.sfTime);
--//////////////////////////////////////////////////////////
--/ @brief Get a list of the names of all availabe audio capture devices
--/
--/ This function returns an array of strings
--/ containing the names of all availabe audio capture devices.
--/ If no devices are available then an empty array is returned.
--/
--/ @return An array of strings containing the names
--/
--//////////////////////////////////////////////////////////
function getAvailableDevices return sfArrayOfStrings;
--//////////////////////////////////////////////////////////
--/ @brief Get the name of the default audio capture device
--/
--/ This function returns the name of the default audio
--/ capture device. If none is available, NULL is returned.
--/
--/ @return The name of the default audio capture device (null terminated)
--/
--//////////////////////////////////////////////////////////
function getDefaultDevice return String;
--//////////////////////////////////////////////////////////
--/ @brief Set the audio capture device
--/
--/ This function sets the audio capture device to the device
--/ with the given name. It can be called on the fly (i.e:
--/ while recording). If you do so while recording and
--/ opening the device fails, it stops the recording.
--/
--/ @param soundRecorder Sound recorder object
--/ @param name The name of the audio capture device
--/
--/ @return sfTrue, if it was able to set the requested device
--/
--//////////////////////////////////////////////////////////
function setDevice (soundRecorder : sfSoundRecorder_Ptr; name : String) return sfBool;
--//////////////////////////////////////////////////////////
--/ @brief Get the name of the current audio capture device
--/
--/ @param soundRecorder Sound recorder object
--/
--/ @return The name of the current audio capture device
--/
--//////////////////////////////////////////////////////////
function getDevice (soundRecorder : sfSoundRecorder_Ptr) return String;
--//////////////////////////////////////////////////////////
--/ @brief Set the channel count of the audio capture device
--/
--/ This method allows you to specify the number of channels
--/ used for recording. Currently only 16-bit mono and
--/ 16-bit stereo are supported.
--/
--/ @param soundRecorder Sound recorder object
--/ @param channelCount Number of channels. Currently only
--/ mono (1) and stereo (2) are supported.
--/
--/ @see sfSoundRecorder_getChannelCount
--/
--//////////////////////////////////////////////////////////
procedure setChannelCount
(soundRecorder : sfSoundRecorder_Ptr; channelCount : sfUint32);
--//////////////////////////////////////////////////////////
--/ @brief Get the number of channels used by this recorder
--/
--/ Currently only mono and stereo are supported, so the
--/ value is either 1 (for mono) or 2 (for stereo).
--/
--/ @return Number of channels
--/
--/ @see sfSoundRecorder_setChannelCount
--/
--//////////////////////////////////////////////////////////
function getChannelCount
(soundRecorder : sfSoundRecorder_Ptr) return sfUint32;
private
pragma Convention (C, sfSoundRecorderStartCallback);
pragma Convention (C, sfSoundRecorderProcessCallback);
pragma Convention (C, sfSoundRecorderStopCallback);
pragma Import (C, create, "sfSoundRecorder_create");
pragma Import (C, destroy, "sfSoundRecorder_destroy");
pragma Import (C, start, "sfSoundRecorder_start");
pragma Import (C, stop, "sfSoundRecorder_stop");
pragma Import (C, getSampleRate, "sfSoundRecorder_getSampleRate");
pragma Import (C, isAvailable, "sfSoundRecorder_isAvailable");
pragma Import (C, setProcessingInterval, "sfSoundRecorder_setProcessingInterval");
pragma Import (C, setChannelCount, "sfSoundRecorder_setChannelCount");
pragma Import (C, getChannelCount, "sfSoundRecorder_getChannelCount");
end Sf.Audio.SoundRecorder;
| 43.829694 | 107 | 0.580751 |
5e0cb4d55268dbfd46c5b3a780c27221826e560b | 2,838 | ads | Ada | gcc-gcc-7_3_0-release/gcc/ada/g-deutst.ads | best08618/asylo | 5a520a9f5c461ede0f32acc284017b737a43898c | [
"Apache-2.0"
] | 7 | 2020-05-02T17:34:05.000Z | 2021-10-17T10:15:18.000Z | gcc-gcc-7_3_0-release/gcc/ada/g-deutst.ads | best08618/asylo | 5a520a9f5c461ede0f32acc284017b737a43898c | [
"Apache-2.0"
] | null | null | null | gcc-gcc-7_3_0-release/gcc/ada/g-deutst.ads | best08618/asylo | 5a520a9f5c461ede0f32acc284017b737a43898c | [
"Apache-2.0"
] | 2 | 2020-07-27T00:22:36.000Z | 2021-04-01T09:41:02.000Z | ------------------------------------------------------------------------------
-- --
-- GNAT RUN-TIME COMPONENTS --
-- --
-- G N A T . D E C O D E _ U T F 8 _ S T R I N G --
-- --
-- S p e c --
-- --
-- Copyright (C) 2007-2010, 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. --
-- --
------------------------------------------------------------------------------
-- This package provides a pre-instantiation of GNAT.Decode_String for the
-- common case of UTF-8 encoding. As noted in the documentation of that
-- package, this UTF-8 instantiation is efficient and specialized so that
-- it has only the code for the UTF-8 case. See g-decstr.ads for full
-- documentation on this package.
with GNAT.Decode_String;
with System.WCh_Con;
package GNAT.Decode_UTF8_String is
new GNAT.Decode_String (System.WCh_Con.WCEM_UTF8);
| 64.5 | 78 | 0.428823 |
8b4c3b13f9c2b322775836915ef0ff10b169f83a | 11,002 | adb | Ada | source/network-managers-tcp_v4_out.adb | reznikmm/network | d94878500ab8d87310eef5b9c88784e1eb53ba38 | [
"MIT"
] | 1 | 2021-01-14T20:52:45.000Z | 2021-01-14T20:52:45.000Z | source/network-managers-tcp_v4_out.adb | reznikmm/network | d94878500ab8d87310eef5b9c88784e1eb53ba38 | [
"MIT"
] | null | null | null | source/network-managers-tcp_v4_out.adb | reznikmm/network | d94878500ab8d87310eef5b9c88784e1eb53ba38 | [
"MIT"
] | null | null | null | -- SPDX-FileCopyrightText: 2021 Max Reznik <[email protected]>
--
-- SPDX-License-Identifier: MIT
-------------------------------------------------------------
with Interfaces.C;
with Ada.Exceptions;
package body Network.Managers.TCP_V4_Out is
procedure Change_Watch
(Self : in out Out_Socket'Class;
Set : Network.Polls.Event_Set);
use type Network.Polls.Event_Set;
Write_Event : constant Network.Polls.Event_Set :=
(Network.Polls.Output => True, others => False);
Read_Event : constant Network.Polls.Event_Set :=
(Network.Polls.Input => True, others => False);
------------------
-- Change_Watch --
------------------
procedure Change_Watch
(Self : in out Out_Socket'Class;
Set : Network.Polls.Event_Set)
is
begin
Self.Poll.Change_Watch
(Set,
Interfaces.C.int (GNAT.Sockets.To_C (Self.Internal)),
Self'Unchecked_Access);
Self.Events := Set;
end Change_Watch;
-----------
-- Close --
-----------
overriding procedure Close (Self : in out Out_Socket) is
begin
if not Self.Is_Closed then
Self.Change_Watch ((others => False));
GNAT.Sockets.Close_Socket (Self.Internal);
Self.Is_Closed := True;
end if;
end Close;
------------------
-- Has_Listener --
------------------
overriding function Has_Listener (Self : Out_Socket) return Boolean is
begin
return Self.Listener.Assigned;
end Has_Listener;
---------------
-- Is_Closed --
---------------
overriding function Is_Closed (Self : Out_Socket) return Boolean is
begin
return Self.Is_Closed;
end Is_Closed;
--------------
-- On_Event --
--------------
overriding procedure On_Event
(Self : in out Out_Socket;
Events : Network.Polls.Event_Set)
is
use type Network.Connections.Listener_Access;
function Get_Error return League.Strings.Universal_String;
procedure Disconnect (Error : League.Strings.Universal_String);
----------------
-- Disconnect --
----------------
procedure Disconnect (Error : League.Strings.Universal_String) is
begin
Self.Change_Watch ((others => False));
GNAT.Sockets.Close_Socket (Self.Internal);
Self.Is_Closed := True;
if Self.Listener.Assigned then
Self.Listener.Closed (Error);
end if;
end Disconnect;
---------------
-- Get_Error --
---------------
function Get_Error return League.Strings.Universal_String is
use type GNAT.Sockets.Error_Type;
Option : constant GNAT.Sockets.Option_Type :=
GNAT.Sockets.Get_Socket_Option
(Self.Internal,
GNAT.Sockets.Socket_Level,
GNAT.Sockets.Error);
begin
if Option.Error = GNAT.Sockets.Success then
return League.Strings.Empty_Universal_String;
else
return League.Strings.To_Universal_String
(GNAT.Sockets.Error_Type'Wide_Wide_Image (Option.Error));
end if;
end Get_Error;
Prev : constant Network.Polls.Event_Set := Self.Events;
-- Active poll events
Input : constant Network.Polls.Event := Network.Polls.Input;
Output : constant Network.Polls.Event := Network.Polls.Output;
Listener : array (Input .. Output) of Network.Connections.Listener_Access
:= (others => Self.Listener);
Again : Boolean := True;
begin
Self.In_Event := True;
if Self.Promise.Is_Pending then
Self.Error := Get_Error;
if Self.Error.Is_Empty then
Self.Events := (others => False); -- no events before listener
Self.Promise.Resolve (Self'Unchecked_Access);
-- Usually it changes Listener
if Self.Listener.Assigned then
if not Self.Events (Polls.Output) then
Self.Events := not Write_Event; -- We can write now
Self.Listener.Can_Write;
else
Self.Events := (others => True);
end if;
end if;
if Self.Events /= Prev then
Self.Change_Watch (Self.Events);
end if;
else
Disconnect (Self.Error);
Self.Promise.Reject (Self.Error);
end if;
elsif Self.Is_Closed then
-- Connection has been closed, but some events arrive after that.
null;
else
pragma Assert (Self.Listener.Assigned);
pragma Assert (Self.Error.Is_Empty);
Self.Events := Self.Events and not Events;
-- Report read event to current listener
if Events (Input) then -- Have something to read
Self.Listener.Can_Read;
-- This can change Self.Events, Self.Listener or close
end if;
-- Report write event to current listener
if Events (Output)
and not Self.Events (Output) -- Have space to write
and Self.Listener = Listener (Output)
and not Self.Is_Closed
then
Self.Listener.Can_Write;
-- This can change Self.Events, Self.Listener or close
end if;
-- Now report to changed listener if any
while Again loop
Again := False;
if not Self.Events (Input) -- Can read
and Self.Listener /= Listener (Input)
and not Self.Is_Closed
then
Listener (Input) := Self.Listener;
Self.Listener.Can_Read;
Again := True;
end if;
if not Self.Events (Output) -- Can write
and Self.Listener /= Listener (Output)
and not Self.Is_Closed
then
Listener (Output) := Self.Listener;
Self.Listener.Can_Write;
Again := True;
end if;
end loop;
if Self.Is_Closed then
Disconnect (League.Strings.Empty_Universal_String);
elsif not Self.Error.Is_Empty then
Disconnect (Self.Error);
elsif Events (Network.Polls.Error) then
Disconnect (Get_Error);
elsif Events (Network.Polls.Close) then
Disconnect (League.Strings.Empty_Universal_String);
elsif Self.Events /= Prev then
Self.Change_Watch (Self.Events);
end if;
end if;
Self.In_Event := False;
end On_Event;
----------
-- Read --
----------
overriding procedure Read
(Self : in out Out_Socket;
Data : out Ada.Streams.Stream_Element_Array;
Last : out Ada.Streams.Stream_Element_Offset)
is
use type Ada.Streams.Stream_Element_Offset;
use type GNAT.Sockets.Error_Type;
Kind : GNAT.Sockets.Error_Type;
begin
GNAT.Sockets.Receive_Socket (Self.Internal, Data, Last);
if Last < Data'First then -- End of stream
Self.Is_Closed := True;
if not Self.In_Event then
raise Program_Error with "Unimplemented";
end if;
end if;
exception
when E : GNAT.Sockets.Socket_Error =>
Last := Data'First - 1;
Kind := GNAT.Sockets.Resolve_Exception (E);
if Kind /= GNAT.Sockets.Resource_Temporarily_Unavailable then
Self.Is_Closed := True;
Self.Error := League.Strings.From_UTF_8_String
(Ada.Exceptions.Exception_Message (E));
if not Self.In_Event then
raise Program_Error with "Unimplemented";
end if;
elsif Self.In_Event then
Self.Events := Self.Events or Read_Event;
else
Self.Change_Watch (Self.Events or Read_Event);
end if;
end Read;
------------
-- Remote --
------------
overriding function Remote (Self : Out_Socket)
return Network.Addresses.Address
is
Result : League.Strings.Universal_String;
Value : GNAT.Sockets.Sock_Addr_Type;
begin
Value := GNAT.Sockets.Get_Peer_Name (Self.Internal);
Result.Append ("/ip4/");
Result.Append
(League.Strings.From_UTF_8_String (GNAT.Sockets.Image (Value.Addr)));
Result.Append ("/tcp/");
declare
Port : constant Wide_Wide_String := Value.Port'Wide_Wide_Image;
begin
Result.Append (Port (2 .. Port'Last));
return Network.Addresses.To_Address (Result);
end;
exception
when GNAT.Sockets.Socket_Error =>
return Network.Addresses.To_Address
(League.Strings.Empty_Universal_String);
end Remote;
------------------------
-- Set_Input_Listener --
------------------------
overriding procedure Set_Input_Listener
(Self : in out Out_Socket;
Value : Network.Streams.Input_Listener_Access)
is
begin
pragma Assert (not Self.Promise.Is_Pending);
Self.Listener := Network.Connections.Listener_Access (Value);
if Self.Error.Is_Empty then
if not Self.In_Event then
raise Program_Error with "Not implemented";
end if;
else
Self.Listener.Closed (Self.Error);
end if;
end Set_Input_Listener;
-------------------------
-- Set_Output_Listener --
-------------------------
overriding procedure Set_Output_Listener
(Self : in out Out_Socket;
Value : Network.Streams.Output_Listener_Access)
is
use type Network.Connections.Listener_Access;
begin
pragma Assert
(Self.Listener = Network.Connections.Listener_Access (Value));
end Set_Output_Listener;
-----------
-- Write --
-----------
overriding procedure Write
(Self : in out Out_Socket; Data : Ada.Streams.Stream_Element_Array;
Last : out Ada.Streams.Stream_Element_Offset)
is
use type Ada.Streams.Stream_Element_Offset;
use type GNAT.Sockets.Error_Type;
Kind : GNAT.Sockets.Error_Type;
begin
GNAT.Sockets.Send_Socket (Self.Internal, Data, Last);
if Last < Data'First then -- End of stream
Self.Is_Closed := True;
if not Self.In_Event then
raise Program_Error with "Unimplemented";
end if;
end if;
exception
when E : GNAT.Sockets.Socket_Error =>
Last := Data'First - 1;
Kind := GNAT.Sockets.Resolve_Exception (E);
if Kind /= GNAT.Sockets.Resource_Temporarily_Unavailable then
Self.Is_Closed := True;
Self.Error := League.Strings.From_UTF_8_String
(Ada.Exceptions.Exception_Message (E));
if not Self.In_Event then
raise Program_Error with "Unimplemented";
end if;
elsif Self.In_Event then
Self.Events := Self.Events or Write_Event;
else
Self.Change_Watch (Self.Events or Write_Event);
end if;
end Write;
end Network.Managers.TCP_V4_Out;
| 29.029024 | 79 | 0.579258 |
a0ebab6f4185afb564954d51f5c54c5dfe029ba2 | 3,437 | adb | Ada | src/core/concurrent/asm-intrinsic/util-concurrent-counters.adb | yrashk/ada-util | 2aaa1d87e92a7137e1c63dce90f0722c549dfafd | [
"Apache-2.0"
] | 60 | 2015-01-18T23:05:34.000Z | 2022-03-20T18:56:30.000Z | src/core/concurrent/asm-intrinsic/util-concurrent-counters.adb | yrashk/ada-util | 2aaa1d87e92a7137e1c63dce90f0722c549dfafd | [
"Apache-2.0"
] | 20 | 2016-09-15T16:41:30.000Z | 2022-03-29T22:02:32.000Z | src/core/concurrent/asm-intrinsic/util-concurrent-counters.adb | yrashk/ada-util | 2aaa1d87e92a7137e1c63dce90f0722c549dfafd | [
"Apache-2.0"
] | 10 | 2015-02-13T04:00:45.000Z | 2022-03-20T18:57:54.000Z | -----------------------------------------------------------------------
-- util-concurrent -- Concurrent Counters
-- Copyright (C) 2009, 2010, 2015, 2017 Stephane Carrez
-- Written by Stephane Carrez ([email protected])
--
-- Licensed under the Apache License, Version 2.0 (the "License");
-- you may not use this file except in compliance with the License.
-- You may obtain a copy of the License at
--
-- http://www.apache.org/licenses/LICENSE-2.0
--
-- Unless required by applicable law or agreed to in writing, software
-- distributed under the License is distributed on an "AS IS" BASIS,
-- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-- See the License for the specific language governing permissions and
-- limitations under the License.
-----------------------------------------------------------------------
package body Util.Concurrent.Counters is
function Sync_Sub_And_Fetch (Ptr : access Interfaces.Unsigned_32;
Value : in Interfaces.Unsigned_32) return Interfaces.Unsigned_32;
pragma Import (Intrinsic, Sync_Sub_And_Fetch,
External_Name => "__sync_sub_and_fetch_4");
function Sync_Fetch_And_Add (Ptr : access Interfaces.Unsigned_32;
Value : in Interfaces.Unsigned_32) return Interfaces.Unsigned_32;
pragma Import (Intrinsic, Sync_Fetch_And_Add,
External_Name => "__sync_fetch_and_add_4");
procedure Sync_Add (Ptr : access Interfaces.Unsigned_32;
Value : in Interfaces.Unsigned_32);
pragma Import (Intrinsic, Sync_Add,
External_Name => "__sync_add_and_fetch_4");
procedure Sync_Sub (Ptr : access Interfaces.Unsigned_32;
Value : in Interfaces.Unsigned_32);
pragma Import (Intrinsic, Sync_Sub,
External_Name => "__sync_sub_and_fetch_4");
-- ------------------------------
-- Increment the counter atomically.
-- ------------------------------
procedure Increment (C : in out Counter) is
begin
Sync_Add (C.Value'Unrestricted_Access, 1);
end Increment;
-- ------------------------------
-- Increment the counter atomically and return the value before increment.
-- ------------------------------
procedure Increment (C : in out Counter;
Value : out Integer) is
begin
Value := Integer (Sync_Fetch_And_Add (C.Value'Unrestricted_Access, 1));
end Increment;
-- ------------------------------
-- Decrement the counter atomically.
-- ------------------------------
procedure Decrement (C : in out Counter) is
begin
Sync_Sub (C.Value'Unrestricted_Access, 1);
end Decrement;
-- ------------------------------
-- Decrement the counter atomically and return a status.
-- ------------------------------
procedure Decrement (C : in out Counter;
Is_Zero : out Boolean) is
use type Interfaces.Unsigned_32;
Value : Interfaces.Unsigned_32;
begin
Value := Sync_Sub_And_Fetch (C.Value'Unrestricted_Access, 1);
Is_Zero := Value = 0;
end Decrement;
-- ------------------------------
-- Get the counter value
-- ------------------------------
function Value (C : in Counter) return Integer is
begin
return Integer (C.Value);
end Value;
end Util.Concurrent.Counters;
| 39.056818 | 97 | 0.57172 |
30a65555f0a60882c5f411d85c5e208ba90c9452 | 3,955 | adb | Ada | support/MinGW/lib/gcc/mingw32/9.2.0/adainclude/a-stwibo.adb | orb-zhuchen/Orb | 6da2404b949ac28bde786e08bf4debe4a27cd3a0 | [
"CNRI-Python-GPL-Compatible",
"MIT"
] | null | null | null | support/MinGW/lib/gcc/mingw32/9.2.0/adainclude/a-stwibo.adb | orb-zhuchen/Orb | 6da2404b949ac28bde786e08bf4debe4a27cd3a0 | [
"CNRI-Python-GPL-Compatible",
"MIT"
] | null | null | null | support/MinGW/lib/gcc/mingw32/9.2.0/adainclude/a-stwibo.adb | orb-zhuchen/Orb | 6da2404b949ac28bde786e08bf4debe4a27cd3a0 | [
"CNRI-Python-GPL-Compatible",
"MIT"
] | null | null | null | ------------------------------------------------------------------------------
-- --
-- GNAT RUN-TIME COMPONENTS --
-- --
-- A D A . S T R I N G S . W I D E _ B O U N D E D --
-- --
-- B o d y --
-- --
-- Copyright (C) 1992-2019, Free Software Foundation, Inc. --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
-- ware Foundation; either version 3, or (at your option) any later ver- --
-- sion. GNAT is distributed in the hope that it will be useful, but WITH- --
-- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY --
-- or FITNESS FOR A PARTICULAR PURPOSE. --
-- --
-- As a special exception under Section 7 of GPL version 3, you are granted --
-- additional permissions described in the GCC Runtime Library Exception, --
-- version 3.1, as published by the Free Software Foundation. --
-- --
-- You should have received a copy of the GNU General Public License and --
-- a copy of the GCC Runtime Library Exception along with this program; --
-- see the files COPYING3 and COPYING.RUNTIME respectively. If not, see --
-- <http://www.gnu.org/licenses/>. --
-- --
-- GNAT was originally developed by the GNAT team at New York University. --
-- Extensive contributions were provided by Ada Core Technologies Inc. --
-- --
------------------------------------------------------------------------------
package body Ada.Strings.Wide_Bounded is
package body Generic_Bounded_Length is
---------
-- "*" --
---------
function "*"
(Left : Natural;
Right : Wide_Character) return Bounded_Wide_String
is
begin
return Times (Left, Right, Max_Length);
end "*";
function "*"
(Left : Natural;
Right : Wide_String) return Bounded_Wide_String
is
begin
return Times (Left, Right, Max_Length);
end "*";
---------------
-- Replicate --
---------------
function Replicate
(Count : Natural;
Item : Wide_Character;
Drop : Strings.Truncation := Strings.Error)
return Bounded_Wide_String
is
begin
return Super_Replicate (Count, Item, Drop, Max_Length);
end Replicate;
function Replicate
(Count : Natural;
Item : Wide_String;
Drop : Strings.Truncation := Strings.Error)
return Bounded_Wide_String
is
begin
return Super_Replicate (Count, Item, Drop, Max_Length);
end Replicate;
----------------------------
-- To_Bounded_Wide_String --
----------------------------
function To_Bounded_Wide_String
(Source : Wide_String;
Drop : Strings.Truncation := Strings.Error)
return Bounded_Wide_String
is
begin
return To_Super_String (Source, Max_Length, Drop);
end To_Bounded_Wide_String;
end Generic_Bounded_Length;
end Ada.Strings.Wide_Bounded;
| 41.631579 | 78 | 0.439444 |
199855f57fc8a52dea871bba68acda64bbfae900 | 188 | adb | Ada | gcc-gcc-7_3_0-release/gcc/testsuite/gnat.dg/discr9.adb | best08618/asylo | 5a520a9f5c461ede0f32acc284017b737a43898c | [
"Apache-2.0"
] | 7 | 2020-05-02T17:34:05.000Z | 2021-10-17T10:15:18.000Z | gcc-gcc-7_3_0-release/gcc/testsuite/gnat.dg/discr9.adb | best08618/asylo | 5a520a9f5c461ede0f32acc284017b737a43898c | [
"Apache-2.0"
] | null | null | null | gcc-gcc-7_3_0-release/gcc/testsuite/gnat.dg/discr9.adb | best08618/asylo | 5a520a9f5c461ede0f32acc284017b737a43898c | [
"Apache-2.0"
] | 2 | 2020-07-27T00:22:36.000Z | 2021-04-01T09:41:02.000Z | -- { dg-do compile }
package body Discr9 is
procedure Proc (From : in R; To : out R) is
begin
To := R'(D1 => False, D2 => From.D2, Field => From.Field);
end;
end Discr9;
| 17.090909 | 64 | 0.569149 |
03949ced0bf938d1a6ae0beb2b9a8015a0b4c225 | 16,666 | ads | Ada | gcc-gcc-7_3_0-release/gcc/ada/xr_tabls.ads | best08618/asylo | 5a520a9f5c461ede0f32acc284017b737a43898c | [
"Apache-2.0"
] | 7 | 2020-05-02T17:34:05.000Z | 2021-10-17T10:15:18.000Z | gcc-gcc-7_3_0-release/gcc/ada/xr_tabls.ads | best08618/asylo | 5a520a9f5c461ede0f32acc284017b737a43898c | [
"Apache-2.0"
] | null | null | null | gcc-gcc-7_3_0-release/gcc/ada/xr_tabls.ads | best08618/asylo | 5a520a9f5c461ede0f32acc284017b737a43898c | [
"Apache-2.0"
] | 2 | 2020-07-27T00:22:36.000Z | 2021-04-01T09:41:02.000Z | ------------------------------------------------------------------------------
-- --
-- GNAT COMPILER COMPONENTS --
-- --
-- X R _ T A B L S --
-- --
-- S p e c --
-- --
-- Copyright (C) 1998-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. See the GNU General Public License --
-- for more details. You should have received a copy of the GNU General --
-- Public License distributed with GNAT; see file COPYING3. If not, go to --
-- http://www.gnu.org/licenses for a complete copy of the license. --
-- --
-- GNAT was originally developed by the GNAT team at New York University. --
-- Extensive contributions were provided by Ada Core Technologies Inc. --
-- --
------------------------------------------------------------------------------
-- We need comment here saying what this package is???
with GNAT.OS_Lib;
package Xr_Tabls is
-------------------
-- Project files --
-------------------
function ALI_File_Name (Ada_File_Name : String) return String;
-- Returns the ali file name corresponding to Ada_File_Name
procedure Create_Project_File (Name : String);
-- Open and parse a new project file. If the file Name could not be
-- opened or is not a valid project file, then a project file associated
-- with the standard default directories is returned
function Next_Obj_Dir return String;
-- Returns the next directory to visit to find related ali files
-- If there are no more such directories, returns a null string.
function Current_Obj_Dir return String;
-- Returns the obj_dir which was returned by the last Next_Obj_Dir call
procedure Reset_Obj_Dir;
-- Reset the iterator for Obj_Dir
------------
-- Tables --
------------
type Declaration_Reference is private;
Empty_Declaration : constant Declaration_Reference;
type Declaration_Array is array (Natural range <>) of Declaration_Reference;
type Declaration_Array_Access is access Declaration_Array;
type File_Reference is private;
Empty_File : constant File_Reference;
type Reference is private;
Empty_Reference : constant Reference;
type Reference_Array is array (Natural range <>) of Reference;
type Reference_Array_Access is access Reference_Array;
procedure Free (Arr : in out Reference_Array_Access);
function Add_Declaration
(File_Ref : File_Reference;
Symbol : String;
Line : Natural;
Column : Natural;
Decl_Type : Character;
Is_Parameter : Boolean := False;
Remove_Only : Boolean := False;
Symbol_Match : Boolean := True)
return Declaration_Reference;
-- Add a new declaration in the table and return the index to it. Decl_Type
-- is the type of the entity Any previous instance of this entity in the
-- htable is removed. If Remove_Only is True, then any previous instance is
-- removed, but the new entity is never inserted. Symbol_Match should be
-- set to False if the name of the symbol doesn't match the pattern from
-- the command line. In that case, the entity will not be output by
-- gnatfind. If Symbol_Match is True, the entity will only be output if
-- the file name itself matches. Is_Parameter should be set to True if
-- the entity is known to be a subprogram parameter.
procedure Add_Parent
(Declaration : in out Declaration_Reference;
Symbol : String;
Line : Natural;
Column : Natural;
File_Ref : File_Reference);
-- The parent declaration (Symbol in file File_Ref at position Line and
-- Column) information is added to Declaration.
function Add_To_Xref_File
(File_Name : String;
Visited : Boolean := True;
Emit_Warning : Boolean := False;
Gnatchop_File : String := "";
Gnatchop_Offset : Integer := 0)
return File_Reference;
-- Add a new reference to a file in the table. Ref is used to return the
-- index in the table where this file is stored. Visited is the value which
-- will be used in the table (if True, the file will not be returned by
-- Next_Unvisited_File). If Emit_Warning is True and the ali file does
-- not exist or does not have cross-referencing information, then a
-- warning will be emitted. Gnatchop_File is the name of the file that
-- File_Name was extracted from through a call to "gnatchop -r" (using
-- pragma Source_Reference). Gnatchop_Offset should be the index of the
-- first line of File_Name within the Gnatchop_File.
procedure Add_Line
(File : File_Reference;
Line : Natural;
Column : Natural);
-- Add a new reference in a file, which the user has provided on the
-- command line. This is used for an optimized matching algorithm.
procedure Add_Reference
(Declaration : Declaration_Reference;
File_Ref : File_Reference;
Line : Natural;
Column : Natural;
Ref_Type : Character;
Labels_As_Ref : Boolean);
-- Add a new reference (Ref_Type = 'r'), body (Ref_Type = 'b') or
-- modification (Ref_Type = 'm') to an entity. If Labels_As_Ref is True,
-- then the references to the entity after the end statements ("end Foo")
-- are counted as actual references. This means that the entity will never
-- be reported as unreferenced (for instance in the case of gnatxref -u).
function Get_Declarations
(Sorted : Boolean := True)
return Declaration_Array_Access;
-- Return a sorted list of all the declarations in the application.
-- Freeing this array is the responsibility of the caller, however it
-- shouldn't free the actual contents of the array, which are pointers
-- to internal data
function References_Count
(Decl : Declaration_Reference;
Get_Reads : Boolean := False;
Get_Writes : Boolean := False;
Get_Bodies : Boolean := False)
return Natural;
-- Return the number of references in Decl for the categories specified
-- by the Get_* parameters (read-only accesses, write accesses and bodies)
function Get_References
(Decl : Declaration_Reference;
Get_Reads : Boolean := False;
Get_Writes : Boolean := False;
Get_Bodies : Boolean := False)
return Reference_Array_Access;
-- Return a sorted list of all references to the entity in decl. The
-- parameters Get_* are used to specify what kind of references should be
-- merged and returned (read-only accesses, write accesses and bodies).
function Get_Column (Decl : Declaration_Reference) return String;
function Get_Column (Ref : Reference) return String;
function Get_Declaration
(File_Ref : File_Reference;
Line : Natural;
Column : Natural)
return Declaration_Reference;
-- Returns reference to the declaration found in file File_Ref at the
-- given Line and Column
function Get_Parent
(Decl : Declaration_Reference)
return Declaration_Reference;
-- Returns reference to Decl's parent declaration
function Get_Emit_Warning (File : File_Reference) return Boolean;
-- Returns the Emit_Warning field of the structure
function Get_Gnatchop_File
(File : File_Reference;
With_Dir : Boolean := False)
return String;
function Get_Gnatchop_File
(Ref : Reference;
With_Dir : Boolean := False)
return String;
function Get_Gnatchop_File
(Decl : Declaration_Reference;
With_Dir : Boolean := False)
return String;
-- Return the name of the file that File was extracted from through a
-- call to "gnatchop -r". The file name for File is returned if File
-- was not extracted from such a file. The directory will be given only
-- if With_Dir is True.
function Get_File
(Decl : Declaration_Reference;
With_Dir : Boolean := False) return String;
pragma Inline (Get_File);
-- Extract column number or file name from reference
function Get_File
(Ref : Reference;
With_Dir : Boolean := False) return String;
pragma Inline (Get_File);
function Get_File
(File : File_Reference;
With_Dir : Boolean := False;
Strip : Natural := 0) return String;
-- Returns the file name (and its directory if With_Dir is True or the user
-- has used the -f switch on the command line. If Strip is not 0, then the
-- last Strip-th "-..." substrings are removed first. For instance, with
-- Strip=2, a file name "parent-child1-child2-child3.ali" would be returned
-- as "parent-child1.ali". This is used when looking for the ALI file to
-- use for a package, since for separates with have to use the parent's
-- ALI. The null string is returned if there is no such parent unit.
--
-- Note that this version of Get_File is not inlined
function Get_File_Ref (Ref : Reference) return File_Reference;
function Get_Line (Decl : Declaration_Reference) return String;
function Get_Line (Ref : Reference) return String;
function Get_Symbol (Decl : Declaration_Reference) return String;
function Get_Type (Decl : Declaration_Reference) return Character;
function Is_Parameter (Decl : Declaration_Reference) return Boolean;
-- Functions that return the contents of a declaration
function Get_Source_Line (Ref : Reference) return String;
function Get_Source_Line (Decl : Declaration_Reference) return String;
-- Return the source line associated with the reference
procedure Grep_Source_Files;
-- Parse all the source files which have at least one reference, and grep
-- the appropriate source lines so that we'll be able to display them. This
-- function should be called once all the .ali files have been parsed, and
-- only if the appropriate user switch
-- has been used (gnatfind -s).
--
-- Note: To save memory, the strings for the source lines are shared. Thus
-- it is no longer possible to free the references, or we would free the
-- same chunk multiple times. It doesn't matter, though, since this is only
-- called once, prior to exiting gnatfind.
function Longest_File_Name return Natural;
-- Returns the longest file name found
function Match (Decl : Declaration_Reference) return Boolean;
-- Return True if the declaration matches
function Match
(File : File_Reference;
Line : Natural;
Column : Natural)
return Boolean;
-- Returns True if File:Line:Column was given on the command line
-- by the user
function Next_Unvisited_File return File_Reference;
-- Returns the next unvisited library file in the list If there is no more
-- unvisited file, return Empty_File. Two calls to this subprogram will
-- return different files.
procedure Set_Default_Match (Value : Boolean);
-- Set the default value for match in declarations.
-- This is used so that if no file was provided in the
-- command line, then every file match
procedure Reset_Directory (File : File_Reference);
-- Reset the cached directory for file. Next time Get_File is called, the
-- directory will be recomputed.
procedure Set_Unvisited (File_Ref : File_Reference);
-- Set File_Ref as unvisited. So Next_Unvisited_File will return it
procedure Read_File
(File_Name : String;
Contents : out GNAT.OS_Lib.String_Access);
-- Reads File_Name into the newly allocated string Contents. Types.EOF
-- character will be added to the returned Contents to simplify parsing.
-- Name_Error is raised if the file was not found. End_Error is raised if
-- the file could not be read correctly. For most systems correct reading
-- means that the number of bytes read is equal to the file size.
private
type Project_File (Src_Dir_Length, Obj_Dir_Length : Natural) is record
Src_Dir : String (1 .. Src_Dir_Length);
Src_Dir_Index : Integer;
Obj_Dir : String (1 .. Obj_Dir_Length);
Obj_Dir_Index : Integer;
Last_Obj_Dir_Start : Natural;
end record;
type Project_File_Ptr is access all Project_File;
-- This is actually a list of all the directories to be searched,
-- either for source files or for library files
type Ref_In_File;
type Ref_In_File_Ptr is access all Ref_In_File;
type Ref_In_File is record
Line : Natural;
Column : Natural;
Next : Ref_In_File_Ptr := null;
end record;
type File_Record;
type File_Reference is access all File_Record;
Empty_File : constant File_Reference := null;
type Cst_String_Access is access constant String;
procedure Free (Str : in out Cst_String_Access);
type File_Record is record
File : Cst_String_Access;
Dir : GNAT.OS_Lib.String_Access;
Lines : Ref_In_File_Ptr := null;
Visited : Boolean := False;
Emit_Warning : Boolean := False;
Gnatchop_File : GNAT.OS_Lib.String_Access := null;
Gnatchop_Offset : Integer := 0;
Next : File_Reference := null;
end record;
-- Holds a reference to a source file, that was referenced in at least one
-- ALI file. Gnatchop_File will contain the name of the file that File was
-- extracted From. Gnatchop_Offset contains the index of the first line of
-- File within Gnatchop_File. These two fields are used to properly support
-- gnatchop files and pragma Source_Reference.
--
-- Lines is used for files that were given on the command line, to
-- memorize the lines and columns that the user specified.
type Reference_Record;
type Reference is access all Reference_Record;
Empty_Reference : constant Reference := null;
type Reference_Record is record
File : File_Reference;
Line : Natural;
Column : Natural;
Source_Line : Cst_String_Access;
Next : Reference := null;
end record;
-- File is a reference to the Ada source file
-- Source_Line is the Line as it appears in the source file. This
-- field is only used when the switch is set on the command line of
-- gnatfind.
type Declaration_Record;
type Declaration_Reference is access all Declaration_Record;
Empty_Declaration : constant Declaration_Reference := null;
type Declaration_Record (Symbol_Length : Natural) is record
Key : Cst_String_Access;
Symbol : String (1 .. Symbol_Length);
Decl : Reference;
Is_Parameter : Boolean := False; -- True if entity is subprog param
Decl_Type : Character;
Body_Ref : Reference := null;
Ref_Ref : Reference := null;
Modif_Ref : Reference := null;
Match : Boolean := False;
Par_Symbol : Declaration_Reference := null;
Next : Declaration_Reference := null;
end record;
-- The lists of referenced (Body_Ref, Ref_Ref and Modif_Ref) are
-- kept unsorted until the results needs to be printed. This saves
-- lots of time while the internal tables are created.
pragma Inline (Get_Column);
pragma Inline (Get_Emit_Warning);
pragma Inline (Get_File_Ref);
pragma Inline (Get_Line);
pragma Inline (Get_Symbol);
pragma Inline (Get_Type);
pragma Inline (Longest_File_Name);
end Xr_Tabls;
| 42.733333 | 79 | 0.645266 |
2e2e95daa956f1ff5d281b2eeba0b60a644ecf83 | 33,060 | ads | Ada | src/gnat/namet.ads | jquorning/dynamo | 10d68571476c270b8e45a9c5ef585fa9139b0d05 | [
"Apache-2.0"
] | 15 | 2015-01-18T23:04:19.000Z | 2022-03-01T20:27:08.000Z | src/gnat/namet.ads | jquorning/dynamo | 10d68571476c270b8e45a9c5ef585fa9139b0d05 | [
"Apache-2.0"
] | 16 | 2018-06-10T07:09:30.000Z | 2022-03-26T18:28:40.000Z | src/gnat/namet.ads | jquorning/dynamo | 10d68571476c270b8e45a9c5ef585fa9139b0d05 | [
"Apache-2.0"
] | 3 | 2015-11-11T18:00:14.000Z | 2022-01-30T23:08:45.000Z | ------------------------------------------------------------------------------
-- --
-- GNAT COMPILER COMPONENTS --
-- --
-- N A M E T --
-- --
-- S p e c --
-- --
-- Copyright (C) 1992-2015, Free Software Foundation, Inc. --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
-- ware Foundation; either version 3, or (at your option) any later ver- --
-- sion. GNAT is distributed in the hope that it will be useful, but WITH- --
-- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY --
-- or FITNESS FOR A PARTICULAR PURPOSE. --
-- --
-- As a special exception under Section 7 of GPL version 3, you are granted --
-- additional permissions described in the GCC Runtime Library Exception, --
-- version 3.1, as published by the Free Software Foundation. --
-- --
-- You should have received a copy of the GNU General Public License and --
-- a copy of the GCC Runtime Library Exception along with this program; --
-- see the files COPYING3 and COPYING.RUNTIME respectively. If not, see --
-- <http://www.gnu.org/licenses/>. --
-- --
-- GNAT was originally developed by the GNAT team at New York University. --
-- Extensive contributions were provided by Ada Core Technologies Inc. --
-- --
------------------------------------------------------------------------------
with Alloc;
with Table;
with Hostparm; use Hostparm;
with System; use System;
with Types; use Types;
package Namet is
-- WARNING: There is a C version of this package. Any changes to this
-- source file must be properly reflected in the C header file namet.h
-- which is created manually from namet.ads and namet.adb.
-- This package contains routines for handling the names table. The table
-- is used to store character strings for identifiers and operator symbols,
-- as well as other string values such as unit names and file names.
-- The forms of the entries are as follows:
-- Identifiers Stored with upper case letters folded to lower case.
-- Upper half (16#80# bit set) and wide characters are
-- stored in an encoded form (Uhh for upper half char,
-- Whhhh for wide characters, WWhhhhhhhh as provided by
-- the routine Store_Encoded_Character, where hh are hex
-- digits for the character code using lower case a-f).
-- Normally the use of U or W in other internal names is
-- avoided, but these letters may be used in internal
-- names (without this special meaning), if they appear
-- as the last character of the name, or they are
-- followed by an upper case letter (other than the WW
-- sequence), or an underscore.
-- Operator symbols Stored with an initial letter O, and the remainder
-- of the name is the lower case characters XXX where
-- the name is Name_Op_XXX, see Snames spec for a full
-- list of the operator names. Normally the use of O
-- in other internal names is avoided, but it may be
-- used in internal names (without this special meaning)
-- if it is the last character of the name, or if it is
-- followed by an upper case letter or an underscore.
-- Character literals Character literals have names that are used only for
-- debugging and error message purposes. The form is an
-- upper case Q followed by a single lower case letter,
-- or by a Uxx/Wxxxx/WWxxxxxxx encoding as described for
-- identifiers. The Set_Character_Literal_Name procedure
-- should be used to construct these encodings. Normally
-- the use of O in other internal names is avoided, but
-- it may be used in internal names (without this special
-- meaning) if it is the last character of the name, or
-- if it is followed by an upper case letter or an
-- underscore.
-- Unit names Stored with upper case letters folded to lower case,
-- using Uhh/Whhhh/WWhhhhhhhh encoding as described for
-- identifiers, and a %s or %b suffix for specs/bodies.
-- See package Uname for further details.
-- File names Are stored in the form provided by Osint. Typically
-- they may include wide character escape sequences and
-- upper case characters (in non-encoded form). Casing
-- is also derived from the external environment. Note
-- that file names provided by Osint must generally be
-- consistent with the names from Fname.Get_File_Name.
-- Other strings The names table is also used as a convenient storage
-- location for other variable length strings such as
-- error messages etc. There are no restrictions on what
-- characters may appear for such entries.
-- Note: the encodings Uhh (upper half characters), Whhhh (wide characters),
-- WWhhhhhhhh (wide wide characters) and Qx (character literal names) are
-- described in the spec, since they are visible throughout the system (e.g.
-- in debugging output). However, no code should depend on these particular
-- encodings, so it should be possible to change the encodings by making
-- changes only to the Namet specification (to change these comments) and the
-- body (which actually implements the encodings).
-- The names are hashed so that a given name appears only once in the table,
-- except that names entered with Name_Enter as opposed to Name_Find are
-- omitted from the hash table.
-- The first 26 entries in the names table (with Name_Id values in the range
-- First_Name_Id .. First_Name_Id + 25) represent names which are the one
-- character lower case letters in the range a-z, and these names are created
-- and initialized by the Initialize procedure.
-- Five values, one of type Int, one of type Byte, and three of type Boolean,
-- are stored with each names table entry and subprograms are provided for
-- setting and retrieving these associated values. The usage of these values
-- is up to the client:
-- In the compiler we have the following uses:
-- The Int field is used to point to a chain of potentially visible
-- entities (see Sem.Ch8 for details).
-- The Byte field is used to hold the Token_Type value for reserved words
-- (see Sem for details).
-- The Boolean1 field is used to mark address clauses to optimize the
-- performance of the Exp_Util.Following_Address_Clause function.
-- The Boolean2 field is used to mark simple names that appear in
-- Restriction[_Warning]s pragmas for No_Use_Of_Entity. This avoids most
-- unnecessary searches of the No_Use_Of_Entity table.
-- The Boolean3 field is not used
-- In the binder, we have the following uses:
-- The Int field is used in various ways depending on the name involved,
-- see binder documentation for details.
-- The Byte and Boolean fields are unused.
-- Note that the value of the Int and Byte fields are initialized to zero,
-- and the Boolean field is initialized to False, when a new Name table entry
-- is created.
Name_Buffer : String (1 .. 4 * Max_Line_Length);
-- This buffer is used to set the name to be stored in the table for the
-- Name_Find call, and to retrieve the name for the Get_Name_String call.
-- The limit here is intended to be an infinite value that ensures that we
-- never overflow the buffer (names this long are too absurd to worry).
Name_Len : Natural := 0;
-- Length of name stored in Name_Buffer. Used as an input parameter for
-- Name_Find, and as an output value by Get_Name_String, or Write_Name.
-- Note: in normal usage, all users of Name_Buffer/Name_Len are expected
-- to initialize Name_Len appropriately. The reason we preinitialize to
-- zero here is that some circuitry (e.g. Osint.Write_Program_Name) does
-- a save/restore on Name_Len and Name_Buffer (1 .. Name_Len), and we do
-- not want some arbitrary junk value to result in saving an arbitrarily
-- long slice which would waste time and blow the stack.
-----------------------------
-- Types for Namet Package --
-----------------------------
-- Name_Id values are used to identify entries in the names table. Except
-- for the special values No_Name and Error_Name, they are subscript values
-- for the Names table defined in this package.
-- Note that with only a few exceptions, which are clearly documented, the
-- type Name_Id should be regarded as a private type. In particular it is
-- never appropriate to perform arithmetic operations using this type.
type Name_Id is range Names_Low_Bound .. Names_High_Bound;
for Name_Id'Size use 32;
-- Type used to identify entries in the names table
No_Name : constant Name_Id := Names_Low_Bound;
-- The special Name_Id value No_Name is used in the parser to indicate
-- a situation where no name is present (e.g. on a loop or block).
Error_Name : constant Name_Id := Names_Low_Bound + 1;
-- The special Name_Id value Error_Name is used in the parser to
-- indicate that some kind of error was encountered in scanning out
-- the relevant name, so it does not have a representable label.
subtype Error_Name_Or_No_Name is Name_Id range No_Name .. Error_Name;
-- Used to test for either error name or no name
First_Name_Id : constant Name_Id := Names_Low_Bound + 2;
-- Subscript of first entry in names table
------------------------------
-- Name_Id Membership Tests --
------------------------------
-- The following functions allow a convenient notation for testing whether
-- a Name_Id value matches any one of a list of possible values. In each
-- case True is returned if the given T argument is equal to any of the V
-- arguments. These essentially duplicate the Ada 2012 membership tests,
-- but we cannot use the latter (yet) in the compiler front end, because
-- of bootstrap considerations
function Nam_In
(T : Name_Id;
V1 : Name_Id;
V2 : Name_Id) return Boolean;
function Nam_In
(T : Name_Id;
V1 : Name_Id;
V2 : Name_Id;
V3 : Name_Id) return Boolean;
function Nam_In
(T : Name_Id;
V1 : Name_Id;
V2 : Name_Id;
V3 : Name_Id;
V4 : Name_Id) return Boolean;
function Nam_In
(T : Name_Id;
V1 : Name_Id;
V2 : Name_Id;
V3 : Name_Id;
V4 : Name_Id;
V5 : Name_Id) return Boolean;
function Nam_In
(T : Name_Id;
V1 : Name_Id;
V2 : Name_Id;
V3 : Name_Id;
V4 : Name_Id;
V5 : Name_Id;
V6 : Name_Id) return Boolean;
function Nam_In
(T : Name_Id;
V1 : Name_Id;
V2 : Name_Id;
V3 : Name_Id;
V4 : Name_Id;
V5 : Name_Id;
V6 : Name_Id;
V7 : Name_Id) return Boolean;
function Nam_In
(T : Name_Id;
V1 : Name_Id;
V2 : Name_Id;
V3 : Name_Id;
V4 : Name_Id;
V5 : Name_Id;
V6 : Name_Id;
V7 : Name_Id;
V8 : Name_Id) return Boolean;
function Nam_In
(T : Name_Id;
V1 : Name_Id;
V2 : Name_Id;
V3 : Name_Id;
V4 : Name_Id;
V5 : Name_Id;
V6 : Name_Id;
V7 : Name_Id;
V8 : Name_Id;
V9 : Name_Id) return Boolean;
function Nam_In
(T : Name_Id;
V1 : Name_Id;
V2 : Name_Id;
V3 : Name_Id;
V4 : Name_Id;
V5 : Name_Id;
V6 : Name_Id;
V7 : Name_Id;
V8 : Name_Id;
V9 : Name_Id;
V10 : Name_Id) return Boolean;
function Nam_In
(T : Name_Id;
V1 : Name_Id;
V2 : Name_Id;
V3 : Name_Id;
V4 : Name_Id;
V5 : Name_Id;
V6 : Name_Id;
V7 : Name_Id;
V8 : Name_Id;
V9 : Name_Id;
V10 : Name_Id;
V11 : Name_Id) return Boolean;
pragma Inline (Nam_In);
-- Inline all above functions
-----------------
-- Subprograms --
-----------------
procedure Finalize;
-- Called at the end of a use of the Namet package (before a subsequent
-- call to Initialize). Currently this routine is only used to generate
-- debugging output.
procedure Get_Name_String (Id : Name_Id);
-- Get_Name_String is used to retrieve the string associated with an entry
-- in the names table. The resulting string is stored in Name_Buffer and
-- Name_Len is set. It is an error to call Get_Name_String with one of the
-- special name Id values (No_Name or Error_Name).
function Get_Name_String (Id : Name_Id) return String;
-- This functional form returns the result as a string without affecting
-- the contents of either Name_Buffer or Name_Len. The lower bound is 1.
procedure Get_Unqualified_Name_String (Id : Name_Id);
-- Similar to the above except that qualification (as defined in unit
-- Exp_Dbug) is removed (including both preceding __ delimited names, and
-- also the suffixes used to indicate package body entities and to
-- distinguish between overloaded entities). Note that names are not
-- qualified until just before the call to gigi, so this routine is only
-- needed by processing that occurs after gigi has been called. This
-- includes all ASIS processing, since ASIS works on the tree written
-- after gigi has been called.
procedure Get_Name_String_And_Append (Id : Name_Id);
-- Like Get_Name_String but the resulting characters are appended to the
-- current contents of the entry stored in Name_Buffer, and Name_Len is
-- incremented to include the added characters.
procedure Get_Decoded_Name_String (Id : Name_Id);
-- Same calling sequence an interface as Get_Name_String, except that the
-- result is decoded, so that upper half characters and wide characters
-- appear as originally found in the source program text, operators have
-- their source forms (special characters and enclosed in quotes), and
-- character literals appear surrounded by apostrophes.
procedure Get_Unqualified_Decoded_Name_String (Id : Name_Id);
-- Similar to the above except that qualification (as defined in unit
-- Exp_Dbug) is removed (including both preceding __ delimited names, and
-- also the suffix used to indicate package body entities). Note that
-- names are not qualified until just before the call to gigi, so this
-- routine is only needed by processing that occurs after gigi has been
-- called. This includes all ASIS processing, since ASIS works on the tree
-- written after gigi has been called.
procedure Get_Decoded_Name_String_With_Brackets (Id : Name_Id);
-- This routine is similar to Decoded_Name, except that the brackets
-- notation (Uhh replaced by ["hh"], Whhhh replaced by ["hhhh"],
-- WWhhhhhhhh replaced by ["hhhhhhhh"]) is used for all non-lower half
-- characters, regardless of how Opt.Wide_Character_Encoding_Method is
-- set, and also in that characters in the range 16#80# .. 16#FF# are
-- converted to brackets notation in all cases. This routine can be used
-- when there is a requirement for a canonical representation not affected
-- by the character set options (e.g. in the binder generation of
-- symbols).
function Get_Name_Table_Byte (Id : Name_Id) return Byte;
pragma Inline (Get_Name_Table_Byte);
-- Fetches the Byte value associated with the given name
function Get_Name_Table_Int (Id : Name_Id) return Int;
pragma Inline (Get_Name_Table_Int);
-- Fetches the Int value associated with the given name
function Get_Name_Table_Boolean1 (Id : Name_Id) return Boolean;
function Get_Name_Table_Boolean2 (Id : Name_Id) return Boolean;
function Get_Name_Table_Boolean3 (Id : Name_Id) return Boolean;
-- Fetches the Boolean values associated with the given name
function Is_Operator_Name (Id : Name_Id) return Boolean;
-- Returns True if name given is of the form of an operator (that
-- is, it starts with an upper case O).
procedure Initialize;
-- This is a dummy procedure. It is retained for easy compatibility with
-- clients who used to call Initialize when this call was required. Now
-- initialization is performed automatically during package elaboration.
-- Note that this change fixes problems which existed prior to the change
-- of Initialize being called more than once. See also Reinitialize which
-- allows reinitialization of the tables.
procedure Lock;
-- Lock name tables before calling back end. We reserve some extra space
-- before locking to avoid unnecessary inefficiencies when we unlock.
procedure Reinitialize;
-- Clears the name tables and removes all existing entries from the table.
procedure Unlock;
-- Unlocks the name table to allow use of the extra space reserved by the
-- call to Lock. See gnat1drv for details of the need for this.
function Length_Of_Name (Id : Name_Id) return Nat;
pragma Inline (Length_Of_Name);
-- Returns length of given name in characters. This is the length of the
-- encoded name, as stored in the names table, the result is equivalent to
-- calling Get_Name_String and reading Name_Len, except that a call to
-- Length_Of_Name does not affect the contents of Name_Len and Name_Buffer.
function Name_Chars_Address return System.Address;
-- Return starting address of name characters table (used in Back_End call
-- to Gigi).
function Name_Find return Name_Id;
-- Name_Find is called with a string stored in Name_Buffer whose length is
-- in Name_Len (i.e. the characters of the name are in subscript positions
-- 1 to Name_Len in Name_Buffer). It searches the names table to see if the
-- string has already been stored. If so the Id of the existing entry is
-- returned. Otherwise a new entry is created with its Name_Table_Int
-- fields set to zero/false. The contents of Name_Buffer and Name_Len are
-- not modified by this call. Note that it is permissible for Name_Len to
-- be set to zero to lookup the null name string.
function Name_Find_Str (S : String) return Name_Id;
-- Similar to Name_Find, except that the string is provided as an argument.
-- This call destroys the contents of Name_Buffer and Name_Len (by storing
-- the given string there.
function Name_Enter return Name_Id;
-- Name_Enter has the same calling interface as Name_Find. The difference
-- is that it does not search the table for an existing match, and also
-- subsequent Name_Find calls using the same name will not locate the
-- entry created by this call. Thus multiple calls to Name_Enter with the
-- same name will create multiple entries in the name table with different
-- Name_Id values. This is useful in the case of created names, which are
-- never expected to be looked up. Note: Name_Enter should never be used
-- for one character names, since these are efficiently located without
-- hashing by Name_Find in any case.
function Name_Entries_Address return System.Address;
-- Return starting address of Names table (used in Back_End call to Gigi)
function Name_Entries_Count return Nat;
-- Return current number of entries in the names table
function Is_OK_Internal_Letter (C : Character) return Boolean;
pragma Inline (Is_OK_Internal_Letter);
-- Returns true if C is a suitable character for using as a prefix or a
-- suffix of an internally generated name, i.e. it is an upper case letter
-- other than one of the ones used for encoding source names (currently
-- the set of reserved letters is O, Q, U, W) and also returns False for
-- the letter X, which is reserved for debug output (see Exp_Dbug).
function Is_Internal_Name (Id : Name_Id) return Boolean;
-- Returns True if the name is an internal name (i.e. contains a character
-- for which Is_OK_Internal_Letter is true, or if the name starts or ends
-- with an underscore. This call destroys the value of Name_Len and
-- Name_Buffer (it loads these as for Get_Name_String).
--
-- Note: if the name is qualified (has a double underscore), then only the
-- final entity name is considered, not the qualifying names. Consider for
-- example that the name:
--
-- pkg__B_1__xyz
--
-- is not an internal name, because the B comes from the internal name of
-- a qualifying block, but the xyz means that this was indeed a declared
-- identifier called "xyz" within this block and there is nothing internal
-- about that name.
function Is_Internal_Name return Boolean;
-- Like the form with an Id argument, except that the name to be tested is
-- passed in Name_Buffer and Name_Len (which are not affected by the call).
-- Name_Buffer (it loads these as for Get_Name_String).
function Is_Valid_Name (Id : Name_Id) return Boolean;
-- True if Id is a valid name -- points to a valid entry in the
-- Name_Entries table.
procedure Reset_Name_Table;
-- This procedure is used when there are multiple source files to reset
-- the name table info entries associated with current entries in the
-- names table. There is no harm in keeping the names entries themselves
-- from one compilation to another, but we can't keep the entity info,
-- since this refers to tree nodes, which are destroyed between each main
-- source file.
procedure Add_Char_To_Name_Buffer (C : Character);
pragma Inline (Add_Char_To_Name_Buffer);
-- Add given character to the end of the string currently stored in the
-- Name_Buffer, incrementing Name_Len.
procedure Add_Nat_To_Name_Buffer (V : Nat);
-- Add decimal representation of given value to the end of the string
-- currently stored in Name_Buffer, incrementing Name_Len as required.
procedure Add_Str_To_Name_Buffer (S : String);
-- Add characters of string S to the end of the string currently stored
-- in the Name_Buffer, incrementing Name_Len by the length of the string.
procedure Insert_Str_In_Name_Buffer (S : String; Index : Positive);
-- Inserts given string in name buffer, starting at Index. Any existing
-- characters at or past this location get moved beyond the inserted string
-- and Name_Len is incremented by the length of the string.
procedure Set_Character_Literal_Name (C : Char_Code);
-- This procedure sets the proper encoded name for the character literal
-- for the given character code. On return Name_Buffer and Name_Len are
-- set to reflect the stored name.
procedure Set_Name_Table_Int (Id : Name_Id; Val : Int);
pragma Inline (Set_Name_Table_Int);
-- Sets the Int value associated with the given name
procedure Set_Name_Table_Byte (Id : Name_Id; Val : Byte);
pragma Inline (Set_Name_Table_Byte);
-- Sets the Byte value associated with the given name
procedure Set_Name_Table_Boolean1 (Id : Name_Id; Val : Boolean);
procedure Set_Name_Table_Boolean2 (Id : Name_Id; Val : Boolean);
procedure Set_Name_Table_Boolean3 (Id : Name_Id; Val : Boolean);
-- Sets the Boolean value associated with the given name
procedure Store_Encoded_Character (C : Char_Code);
-- Stores given character code at the end of Name_Buffer, updating the
-- value in Name_Len appropriately. Lower case letters and digits are
-- stored unchanged. Other 8-bit characters are stored using the Uhh
-- encoding (hh = hex code), other 16-bit wide character values are stored
-- using the Whhhh (hhhh = hex code) encoding, and other 32-bit wide wide
-- character values are stored using the WWhhhhhhhh (hhhhhhhh = hex code).
-- Note that this procedure does not fold upper case letters (they are
-- stored using the Uhh encoding). If folding is required, it must be done
-- by the caller prior to the call.
procedure Tree_Read;
-- Initializes internal tables from current tree file using the relevant
-- Table.Tree_Read routines. Note that Initialize should not be called if
-- Tree_Read is used. Tree_Read includes all necessary initialization.
procedure Tree_Write;
-- Writes out internal tables to current tree file using the relevant
-- Table.Tree_Write routines.
procedure Get_Last_Two_Chars (N : Name_Id; C1, C2 : out Character);
-- Obtains last two characters of a name. C1 is last but one character
-- and C2 is last character. If name is less than two characters long,
-- then both C1 and C2 are set to ASCII.NUL on return.
procedure Write_Name (Id : Name_Id);
-- Write_Name writes the characters of the specified name using the
-- standard output procedures in package Output. No end of line is
-- written, just the characters of the name. On return Name_Buffer and
-- Name_Len are set as for a call to Get_Name_String. The name is written
-- in encoded form (i.e. including Uhh, Whhh, Qx, _op as they appear in
-- the name table). If Id is Error_Name, or No_Name, no text is output.
procedure Write_Name_Decoded (Id : Name_Id);
-- Like Write_Name, except that the name written is the decoded name, as
-- described for Get_Decoded_Name_String, and the resulting value stored
-- in Name_Len and Name_Buffer is the decoded name.
------------------------------
-- File and Unit Name Types --
------------------------------
-- These are defined here in Namet rather than Fname and Uname to avoid
-- problems with dependencies, and to avoid dragging in Fname and Uname
-- into many more files, but it would be cleaner to move to Fname/Uname.
type File_Name_Type is new Name_Id;
-- File names are stored in the names table and this type is used to
-- indicate that a Name_Id value is being used to hold a simple file name
-- (which does not include any directory information).
No_File : constant File_Name_Type := File_Name_Type (No_Name);
-- Constant used to indicate no file is present (this is used for example
-- when a search for a file indicates that no file of the name exists).
Error_File_Name : constant File_Name_Type := File_Name_Type (Error_Name);
-- The special File_Name_Type value Error_File_Name is used to indicate
-- a unit name where some previous processing has found an error.
subtype Error_File_Name_Or_No_File is
File_Name_Type range No_File .. Error_File_Name;
-- Used to test for either error file name or no file
type Path_Name_Type is new Name_Id;
-- Path names are stored in the names table and this type is used to
-- indicate that a Name_Id value is being used to hold a path name (that
-- may contain directory information).
No_Path : constant Path_Name_Type := Path_Name_Type (No_Name);
-- Constant used to indicate no path name is present
type Unit_Name_Type is new Name_Id;
-- Unit names are stored in the names table and this type is used to
-- indicate that a Name_Id value is being used to hold a unit name, which
-- terminates in %b for a body or %s for a spec.
No_Unit_Name : constant Unit_Name_Type := Unit_Name_Type (No_Name);
-- Constant used to indicate no file name present
Error_Unit_Name : constant Unit_Name_Type := Unit_Name_Type (Error_Name);
-- The special Unit_Name_Type value Error_Unit_Name is used to indicate
-- a unit name where some previous processing has found an error.
subtype Error_Unit_Name_Or_No_Unit_Name is
Unit_Name_Type range No_Unit_Name .. Error_Unit_Name;
------------------------
-- Debugging Routines --
------------------------
procedure wn (Id : Name_Id);
pragma Export (Ada, wn);
-- This routine is intended for debugging use only (i.e. it is intended to
-- be called from the debugger). It writes the characters of the specified
-- name using the standard output procedures in package Output, followed by
-- a new line. The name is written in encoded form (i.e. including Uhh,
-- Whhh, Qx, _op as they appear in the name table). If Id is Error_Name,
-- No_Name, or invalid an appropriate string is written (<Error_Name>,
-- <No_Name>, <invalid name>). Unlike Write_Name, this call does not affect
-- the contents of Name_Buffer or Name_Len.
---------------------------
-- Table Data Structures --
---------------------------
-- The following declarations define the data structures used to store
-- names. The definitions are in the private part of the package spec,
-- rather than the body, since they are referenced directly by gigi.
private
-- This table stores the actual string names. Although logically there is
-- no need for a terminating character (since the length is stored in the
-- name entry table), we still store a NUL character at the end of every
-- name (for convenience in interfacing to the C world).
package Name_Chars is new Table.Table (
Table_Component_Type => Character,
Table_Index_Type => Int,
Table_Low_Bound => 0,
Table_Initial => Alloc.Name_Chars_Initial,
Table_Increment => Alloc.Name_Chars_Increment,
Table_Name => "Name_Chars");
type Name_Entry is record
Name_Chars_Index : Int;
-- Starting location of characters in the Name_Chars table minus one
-- (i.e. pointer to character just before first character). The reason
-- for the bias of one is that indexes in Name_Buffer are one's origin,
-- so this avoids unnecessary adds and subtracts of 1.
Name_Len : Short;
-- Length of this name in characters
Byte_Info : Byte;
-- Byte value associated with this name
Boolean1_Info : Boolean;
Boolean2_Info : Boolean;
Boolean3_Info : Boolean;
-- Boolean values associated with the name
Name_Has_No_Encodings : Boolean;
-- This flag is set True if the name entry is known not to contain any
-- special character encodings. This is used to speed up repeated calls
-- to Get_Decoded_Name_String. A value of False means that it is not
-- known whether the name contains any such encodings.
Hash_Link : Name_Id;
-- Link to next entry in names table for same hash code
Int_Info : Int;
-- Int Value associated with this name
end record;
for Name_Entry use record
Name_Chars_Index at 0 range 0 .. 31;
Name_Len at 4 range 0 .. 15;
Byte_Info at 6 range 0 .. 7;
Boolean1_Info at 7 range 0 .. 0;
Boolean2_Info at 7 range 1 .. 1;
Boolean3_Info at 7 range 2 .. 2;
Name_Has_No_Encodings at 7 range 3 .. 7;
Hash_Link at 8 range 0 .. 31;
Int_Info at 12 range 0 .. 31;
end record;
for Name_Entry'Size use 16 * 8;
-- This ensures that we did not leave out any fields
-- This is the table that is referenced by Name_Id entries.
-- It contains one entry for each unique name in the table.
package Name_Entries is new Table.Table (
Table_Component_Type => Name_Entry,
Table_Index_Type => Name_Id'Base,
Table_Low_Bound => First_Name_Id,
Table_Initial => Alloc.Names_Initial,
Table_Increment => Alloc.Names_Increment,
Table_Name => "Name_Entries");
end Namet;
| 46.694915 | 79 | 0.657018 |
19999afb3f3cf2b188578ebd265720da5c0c21d1 | 9,381 | ads | Ada | support/MinGW/lib/gcc/mingw32/9.2.0/adainclude/g-calend.ads | orb-zhuchen/Orb | 6da2404b949ac28bde786e08bf4debe4a27cd3a0 | [
"CNRI-Python-GPL-Compatible",
"MIT"
] | null | null | null | support/MinGW/lib/gcc/mingw32/9.2.0/adainclude/g-calend.ads | orb-zhuchen/Orb | 6da2404b949ac28bde786e08bf4debe4a27cd3a0 | [
"CNRI-Python-GPL-Compatible",
"MIT"
] | null | null | null | support/MinGW/lib/gcc/mingw32/9.2.0/adainclude/g-calend.ads | orb-zhuchen/Orb | 6da2404b949ac28bde786e08bf4debe4a27cd3a0 | [
"CNRI-Python-GPL-Compatible",
"MIT"
] | null | null | null | ------------------------------------------------------------------------------
-- --
-- GNAT RUN-TIME COMPONENTS --
-- --
-- G N A T . C A L E N D A R --
-- --
-- S p e c --
-- --
-- Copyright (C) 1999-2019, Free Software Foundation, Inc. --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
-- ware Foundation; either version 3, or (at your option) any later ver- --
-- sion. GNAT is distributed in the hope that it will be useful, but WITH- --
-- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY --
-- or FITNESS FOR A PARTICULAR PURPOSE. --
-- --
-- As a special exception under Section 7 of GPL version 3, you are granted --
-- additional permissions described in the GCC Runtime Library Exception, --
-- version 3.1, as published by the Free Software Foundation. --
-- --
-- You should have received a copy of the GNU General Public License and --
-- a copy of the GCC Runtime Library Exception along with this program; --
-- see the files COPYING3 and COPYING.RUNTIME respectively. If not, see --
-- <http://www.gnu.org/licenses/>. --
-- --
-- GNAT was originally developed by the GNAT team at New York University. --
-- Extensive contributions were provided by Ada Core Technologies Inc. --
-- --
------------------------------------------------------------------------------
-- This package extends Ada.Calendar to handle Hour, Minute, Second,
-- Second_Duration and Day_Of_Week and Day_In_Year from Calendar.Time.
-- Second_Duration precision depends on the target clock precision.
--
-- GNAT.Calendar provides the same kind of abstraction found in Ada.Calendar.
-- It provides Split and Time_Of to build and split a Time data. And it
-- provides accessor functions to get only one of Hour, Minute, Second,
-- Second_Duration. Other functions are to access more advanced values like
-- Day_Of_Week, Day_In_Year and Week_In_Year.
with Ada.Calendar.Formatting;
with Interfaces.C;
package GNAT.Calendar is
type Day_Name is
(Monday, Tuesday, Wednesday, Thursday, Friday, Saturday, Sunday);
pragma Ordered (Day_Name);
subtype Hour_Number is Natural range 0 .. 23;
subtype Minute_Number is Natural range 0 .. 59;
subtype Second_Number is Natural range 0 .. 59;
subtype Second_Duration is Ada.Calendar.Day_Duration range 0.0 .. 1.0;
subtype Day_In_Year_Number is Positive range 1 .. 366;
subtype Week_In_Year_Number is Positive range 1 .. 53;
No_Time : constant Ada.Calendar.Time;
-- A constant set to the first date that can be represented by the type
-- Time. It can be used to indicate an uninitialized date.
function Hour (Date : Ada.Calendar.Time) return Hour_Number;
function Minute (Date : Ada.Calendar.Time) return Minute_Number;
function Second (Date : Ada.Calendar.Time) return Second_Number;
function Sub_Second (Date : Ada.Calendar.Time) return Second_Duration;
-- Hour, Minute, Second and Sub_Second returns the complete time data for
-- the Date (H:M:S.SS). See Ada.Calendar for Year, Month, Day accessors.
-- Second_Duration precision depends on the target clock precision.
function Day_Of_Week (Date : Ada.Calendar.Time) return Day_Name;
-- Return the day name
function Day_In_Year (Date : Ada.Calendar.Time) return Day_In_Year_Number;
-- Return the day number in the year. (1st January is day 1 and 31st
-- December is day 365 or 366 for leap year).
procedure Split
(Date : Ada.Calendar.Time;
Year : out Ada.Calendar.Year_Number;
Month : out Ada.Calendar.Month_Number;
Day : out Ada.Calendar.Day_Number;
Hour : out Hour_Number;
Minute : out Minute_Number;
Second : out Second_Number;
Sub_Second : out Second_Duration);
-- Split a standard Ada.Calendar.Time value in date data (Year, Month, Day)
-- and Time data (Hour, Minute, Second, Sub_Second).
procedure Split_At_Locale
(Date : Ada.Calendar.Time;
Year : out Ada.Calendar.Year_Number;
Month : out Ada.Calendar.Month_Number;
Day : out Ada.Calendar.Day_Number;
Hour : out Hour_Number;
Minute : out Minute_Number;
Second : out Second_Number;
Sub_Second : out Second_Duration);
-- Split a standard Ada.Calendar.Time value in date data (Year, Month, Day)
-- and Time data (Hour, Minute, Second, Sub_Second). This version of Split
-- utilizes the time zone and DST bias of the locale (equivalent to Clock).
-- Due to this simplified behavior, the implementation does not require
-- expensive system calls on targets such as Windows.
-- WARNING: Split_At_Locale is no longer aware of historic events and may
-- produce inaccurate results over DST changes which occurred in the past.
function Time_Of
(Year : Ada.Calendar.Year_Number;
Month : Ada.Calendar.Month_Number;
Day : Ada.Calendar.Day_Number;
Hour : Hour_Number;
Minute : Minute_Number;
Second : Second_Number;
Sub_Second : Second_Duration := 0.0) return Ada.Calendar.Time;
-- Return an Ada.Calendar.Time data built from the date and time values
function Time_Of_At_Locale
(Year : Ada.Calendar.Year_Number;
Month : Ada.Calendar.Month_Number;
Day : Ada.Calendar.Day_Number;
Hour : Hour_Number;
Minute : Minute_Number;
Second : Second_Number;
Sub_Second : Second_Duration := 0.0) return Ada.Calendar.Time;
-- Return an Ada.Calendar.Time data built from the date and time values.
-- This version of Time_Of utilizes the time zone and DST bias of the
-- locale (equivalent to Clock). Due to this simplified behavior, the
-- implementation does not require expensive system calls on targets such
-- as Windows.
-- WARNING: Split_At_Locale is no longer aware of historic events and may
-- produce inaccurate results over DST changes which occurred in the past.
function Week_In_Year (Date : Ada.Calendar.Time) return Week_In_Year_Number;
-- Return the week number as defined in ISO 8601. A week always starts on
-- a Monday and the first week of a particular year is the one containing
-- the first Thursday. A year may have 53 weeks when January 1st is a
-- Wednesday and the year is leap or January 1st is a Thursday. Note that
-- the last days of December may belong to the first week on the next year
-- and conversely, the first days of January may belong to the last week
-- of the last year.
procedure Year_Week_In_Year
(Date : Ada.Calendar.Time;
Year : out Ada.Calendar.Year_Number;
Week : out Week_In_Year_Number);
-- Return the week number as defined in ISO 8601 along with the year in
-- which the week occurs.
-- C timeval conversion
-- C timeval represent a duration (used in Select for example). This
-- structure is composed of a number of seconds and a number of micro
-- seconds. The timeval structure is not exposed here because its
-- definition is target dependent. Interface to C programs is done via a
-- pointer to timeval structure.
type timeval is private;
function To_Duration (T : not null access timeval) return Duration;
function To_Timeval (D : Duration) return timeval;
private
-- This is a dummy declaration that should be the largest possible timeval
-- structure of all supported targets.
type timeval is array (1 .. 3) of Interfaces.C.long;
function Julian_Day
(Year : Ada.Calendar.Year_Number;
Month : Ada.Calendar.Month_Number;
Day : Ada.Calendar.Day_Number) return Integer;
-- Compute Julian day number
--
-- The code of this function is a modified version of algorithm 199 from
-- the Collected Algorithms of the ACM. The author of algorithm 199 is
-- Robert G. Tantzen.
No_Time : constant Ada.Calendar.Time :=
Ada.Calendar.Formatting.Time_Of
(Ada.Calendar.Year_Number'First,
Ada.Calendar.Month_Number'First,
Ada.Calendar.Day_Number'First,
Time_Zone => 0);
-- Use Time_Zone => 0 to be the same binary representation in any timezone
end GNAT.Calendar;
| 50.435484 | 79 | 0.607505 |
38646748713f60b2cce9d7d871950cfa56fe2def | 14,838 | adb | Ada | Ada95/samples/sample-menu_demo.adb | mvaisakh/android_external_libncurses | d44c8a16d7f1ed276d0de0b3f6f1a5596c5f556f | [
"DOC",
"Unlicense"
] | 35 | 2015-03-07T13:26:22.000Z | 2021-11-06T16:18:59.000Z | Ada95/samples/sample-menu_demo.adb | mvaisakh/android_external_libncurses | d44c8a16d7f1ed276d0de0b3f6f1a5596c5f556f | [
"DOC",
"Unlicense"
] | 3 | 2017-04-07T21:02:48.000Z | 2017-04-08T17:59:35.000Z | Ada95/samples/sample-menu_demo.adb | mvaisakh/android_external_libncurses | d44c8a16d7f1ed276d0de0b3f6f1a5596c5f556f | [
"DOC",
"Unlicense"
] | 19 | 2015-06-16T06:13:44.000Z | 2021-07-24T02:37:45.000Z | ------------------------------------------------------------------------------
-- --
-- GNAT ncurses Binding Samples --
-- --
-- Sample.Menu_Demo --
-- --
-- B O D Y --
-- --
------------------------------------------------------------------------------
-- Copyright (c) 1998-2004,2008 Free Software Foundation, Inc. --
-- --
-- Permission is hereby granted, free of charge, to any person obtaining a --
-- copy of this software and associated documentation files (the --
-- "Software"), to deal in the Software without restriction, including --
-- without limitation the rights to use, copy, modify, merge, publish, --
-- distribute, distribute with modifications, sublicense, and/or sell --
-- copies of the Software, and to permit persons to whom the Software is --
-- furnished to do so, subject to the following conditions: --
-- --
-- The above copyright notice and this permission notice shall be included --
-- in all copies or substantial portions of the Software. --
-- --
-- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS --
-- OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF --
-- MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. --
-- IN NO EVENT SHALL THE ABOVE COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, --
-- DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR --
-- OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR --
-- THE USE OR OTHER DEALINGS IN THE SOFTWARE. --
-- --
-- Except as contained in this notice, the name(s) of the above copyright --
-- holders shall not be used in advertising or otherwise to promote the --
-- sale, use or other dealings in this Software without prior written --
-- authorization. --
------------------------------------------------------------------------------
-- Author: Juergen Pfeifer, 1996
-- Version Control
-- $Revision: 1.18 $
-- $Date: 2008/07/26 18:48:30 $
-- Binding Version 01.00
------------------------------------------------------------------------------
with Terminal_Interface.Curses; use Terminal_Interface.Curses;
with Terminal_Interface.Curses.Panels; use Terminal_Interface.Curses.Panels;
with Terminal_Interface.Curses.Menus; use Terminal_Interface.Curses.Menus;
with Terminal_Interface.Curses.Menus.Menu_User_Data;
with Terminal_Interface.Curses.Menus.Item_User_Data;
with Sample.Manifest; use Sample.Manifest;
with Sample.Function_Key_Setting; use Sample.Function_Key_Setting;
with Sample.Menu_Demo.Handler;
with Sample.Helpers; use Sample.Helpers;
with Sample.Explanation; use Sample.Explanation;
package body Sample.Menu_Demo is
package Spacing_Demo is
procedure Spacing_Test;
end Spacing_Demo;
package body Spacing_Demo is
procedure Spacing_Test
is
function My_Driver (M : Menu;
K : Key_Code;
P : Panel) return Boolean;
procedure Set_Option_Key;
procedure Set_Select_Key;
procedure Set_Description_Key;
procedure Set_Hide_Key;
package Mh is new Sample.Menu_Demo.Handler (My_Driver);
I : Item_Array_Access := new Item_Array'
(New_Item ("January", "31 Days"),
New_Item ("February", "28/29 Days"),
New_Item ("March", "31 Days"),
New_Item ("April", "30 Days"),
New_Item ("May", "31 Days"),
New_Item ("June", "30 Days"),
New_Item ("July", "31 Days"),
New_Item ("August", "31 Days"),
New_Item ("September", "30 Days"),
New_Item ("October", "31 Days"),
New_Item ("November", "30 Days"),
New_Item ("December", "31 Days"),
Null_Item);
M : Menu := New_Menu (I);
Flip_State : Boolean := True;
Hide_Long : Boolean := False;
type Format_Code is (Four_By_1, Four_By_2, Four_By_3);
type Operations is (Flip, Reorder, Reformat, Reselect, Describe);
type Change is array (Operations) of Boolean;
pragma Pack (Change);
No_Change : constant Change := Change'(others => False);
Current_Format : Format_Code := Four_By_1;
To_Change : Change := No_Change;
function My_Driver (M : Menu;
K : Key_Code;
P : Panel) return Boolean
is
begin
if M = Null_Menu then
raise Menu_Exception;
end if;
if P = Null_Panel then
raise Panel_Exception;
end if;
To_Change := No_Change;
if K in User_Key_Code'Range then
if K = QUIT then
return True;
end if;
end if;
if K in Special_Key_Code'Range then
case K is
when Key_F4 =>
To_Change (Flip) := True;
return True;
when Key_F5 =>
To_Change (Reformat) := True;
Current_Format := Four_By_1;
return True;
when Key_F6 =>
To_Change (Reformat) := True;
Current_Format := Four_By_2;
return True;
when Key_F7 =>
To_Change (Reformat) := True;
Current_Format := Four_By_3;
return True;
when Key_F8 =>
To_Change (Reorder) := True;
return True;
when Key_F9 =>
To_Change (Reselect) := True;
return True;
when Key_F10 =>
if Current_Format /= Four_By_3 then
To_Change (Describe) := True;
return True;
else
return False;
end if;
when Key_F11 =>
Hide_Long := not Hide_Long;
declare
O : Item_Option_Set;
begin
for J in I'Range loop
Get_Options (I (J), O);
O.Selectable := True;
if Hide_Long then
case J is
when 1 | 3 | 5 | 7 | 8 | 10 | 12 =>
O.Selectable := False;
when others => null;
end case;
end if;
Set_Options (I (J), O);
end loop;
end;
return False;
when others => null;
end case;
end if;
return False;
end My_Driver;
procedure Set_Option_Key
is
O : Menu_Option_Set;
begin
if Current_Format = Four_By_1 then
Set_Soft_Label_Key (8, "");
else
Get_Options (M, O);
if O.Row_Major_Order then
Set_Soft_Label_Key (8, "O-Col");
else
Set_Soft_Label_Key (8, "O-Row");
end if;
end if;
Refresh_Soft_Label_Keys_Without_Update;
end Set_Option_Key;
procedure Set_Select_Key
is
O : Menu_Option_Set;
begin
Get_Options (M, O);
if O.One_Valued then
Set_Soft_Label_Key (9, "Multi");
else
Set_Soft_Label_Key (9, "Singl");
end if;
Refresh_Soft_Label_Keys_Without_Update;
end Set_Select_Key;
procedure Set_Description_Key
is
O : Menu_Option_Set;
begin
if Current_Format = Four_By_3 then
Set_Soft_Label_Key (10, "");
else
Get_Options (M, O);
if O.Show_Descriptions then
Set_Soft_Label_Key (10, "-Desc");
else
Set_Soft_Label_Key (10, "+Desc");
end if;
end if;
Refresh_Soft_Label_Keys_Without_Update;
end Set_Description_Key;
procedure Set_Hide_Key
is
begin
if Hide_Long then
Set_Soft_Label_Key (11, "Enab");
else
Set_Soft_Label_Key (11, "Disab");
end if;
Refresh_Soft_Label_Keys_Without_Update;
end Set_Hide_Key;
begin
Push_Environment ("MENU01");
Notepad ("MENU-PAD01");
Default_Labels;
Set_Soft_Label_Key (4, "Flip");
Set_Soft_Label_Key (5, "4x1");
Set_Soft_Label_Key (6, "4x2");
Set_Soft_Label_Key (7, "4x3");
Set_Option_Key;
Set_Select_Key;
Set_Description_Key;
Set_Hide_Key;
Set_Format (M, 4, 1);
loop
Mh.Drive_Me (M);
exit when To_Change = No_Change;
if To_Change (Flip) then
if Flip_State then
Flip_State := False;
Set_Spacing (M, 3, 2, 0);
else
Flip_State := True;
Set_Spacing (M);
end if;
elsif To_Change (Reformat) then
case Current_Format is
when Four_By_1 => Set_Format (M, 4, 1);
when Four_By_2 => Set_Format (M, 4, 2);
when Four_By_3 =>
declare
O : Menu_Option_Set;
begin
Get_Options (M, O);
O.Show_Descriptions := False;
Set_Options (M, O);
Set_Format (M, 4, 3);
end;
end case;
Set_Option_Key;
Set_Description_Key;
elsif To_Change (Reorder) then
declare
O : Menu_Option_Set;
begin
Get_Options (M, O);
O.Row_Major_Order := not O.Row_Major_Order;
Set_Options (M, O);
Set_Option_Key;
end;
elsif To_Change (Reselect) then
declare
O : Menu_Option_Set;
begin
Get_Options (M, O);
O.One_Valued := not O.One_Valued;
Set_Options (M, O);
Set_Select_Key;
end;
elsif To_Change (Describe) then
declare
O : Menu_Option_Set;
begin
Get_Options (M, O);
O.Show_Descriptions := not O.Show_Descriptions;
Set_Options (M, O);
Set_Description_Key;
end;
else
null;
end if;
end loop;
Set_Spacing (M);
Pop_Environment;
pragma Assert (Get_Index (Items (M, 1)) = Get_Index (I (1)));
Delete (M);
Free (I, True);
end Spacing_Test;
end Spacing_Demo;
procedure Demo
is
-- We use this datatype only to test the instantiation of
-- the Menu_User_Data generic package. No functionality
-- behind it.
type User_Data is new Integer;
type User_Data_Access is access User_Data;
-- Those packages are only instantiated to test the usability.
-- No real functionality is shown in the demo.
package MUD is new Menu_User_Data (User_Data, User_Data_Access);
package IUD is new Item_User_Data (User_Data, User_Data_Access);
function My_Driver (M : Menu;
K : Key_Code;
P : Panel) return Boolean;
package Mh is new Sample.Menu_Demo.Handler (My_Driver);
Itm : Item_Array_Access := new Item_Array'
(New_Item ("Menu Layout Options"),
New_Item ("Demo of Hook functions"),
Null_Item);
M : Menu := New_Menu (Itm);
U1 : constant User_Data_Access := new User_Data'(4711);
U2 : User_Data_Access;
U3 : constant User_Data_Access := new User_Data'(4712);
U4 : User_Data_Access;
function My_Driver (M : Menu;
K : Key_Code;
P : Panel) return Boolean
is
Idx : constant Positive := Get_Index (Current (M));
begin
if K in User_Key_Code'Range then
if K = QUIT then
return True;
elsif K = SELECT_ITEM then
if Idx in Itm'Range then
Hide (P);
Update_Panels;
end if;
case Idx is
when 1 => Spacing_Demo.Spacing_Test;
when others => Not_Implemented;
end case;
if Idx in Itm'Range then
Top (P);
Show (P);
Update_Panels;
Update_Screen;
end if;
end if;
end if;
return False;
end My_Driver;
begin
Push_Environment ("MENU00");
Notepad ("MENU-PAD00");
Default_Labels;
Refresh_Soft_Label_Keys_Without_Update;
Set_Pad_Character (M, '|');
MUD.Set_User_Data (M, U1);
IUD.Set_User_Data (Itm (1), U3);
Mh.Drive_Me (M);
MUD.Get_User_Data (M, U2);
pragma Assert (U1 = U2 and U1.all = 4711);
IUD.Get_User_Data (Itm (1), U4);
pragma Assert (U3 = U4 and U3.all = 4712);
Pop_Environment;
Delete (M);
Free (Itm, True);
end Demo;
end Sample.Menu_Demo;
| 37.375315 | 78 | 0.463 |
031b809485d50d02beb1b3c9577fcabec757eef3 | 55,172 | ads | Ada | bb-runtimes/arm/sam/sam4s/svd/i-sam-sysc.ads | JCGobbi/Nucleo-STM32F334R8 | 2a0b1b4b2664c92773703ac5e95dcb71979d051c | [
"BSD-3-Clause"
] | null | null | null | bb-runtimes/arm/sam/sam4s/svd/i-sam-sysc.ads | JCGobbi/Nucleo-STM32F334R8 | 2a0b1b4b2664c92773703ac5e95dcb71979d051c | [
"BSD-3-Clause"
] | null | null | null | bb-runtimes/arm/sam/sam4s/svd/i-sam-sysc.ads | JCGobbi/Nucleo-STM32F334R8 | 2a0b1b4b2664c92773703ac5e95dcb71979d051c | [
"BSD-3-Clause"
] | null | null | null | --
-- Copyright (C) 2017, AdaCore
--
-- This spec has been automatically generated from ATSAM4SD32C.svd
pragma Ada_2012;
pragma Style_Checks (Off);
with System;
package Interfaces.SAM.SYSC is
pragma Preelaborate;
pragma No_Elaboration_Code_All;
---------------
-- Registers --
---------------
-- General Purpose Backup Register
-- General Purpose Backup Register
type GPBR_GPBR_Registers is array (0 .. 7) of Interfaces.SAM.UInt32
with Volatile;
subtype RSTC_CR_KEY_Field is Interfaces.SAM.Byte;
-- Control Register
type RSTC_CR_Register is record
-- Write-only. Processor Reset
PROCRST : Boolean := False;
-- unspecified
Reserved_1_1 : Interfaces.SAM.Bit := 16#0#;
-- Write-only. Peripheral Reset
PERRST : Boolean := False;
-- Write-only. External Reset
EXTRST : Boolean := False;
-- unspecified
Reserved_4_23 : Interfaces.SAM.UInt20 := 16#0#;
-- Write-only. System Reset Key
KEY : RSTC_CR_KEY_Field := 16#0#;
end record
with Volatile_Full_Access, Size => 32,
Bit_Order => System.Low_Order_First;
for RSTC_CR_Register use record
PROCRST at 0 range 0 .. 0;
Reserved_1_1 at 0 range 1 .. 1;
PERRST at 0 range 2 .. 2;
EXTRST at 0 range 3 .. 3;
Reserved_4_23 at 0 range 4 .. 23;
KEY at 0 range 24 .. 31;
end record;
subtype RSTC_SR_RSTTYP_Field is Interfaces.SAM.UInt3;
-- Status Register
type RSTC_SR_Register is record
-- Read-only. User Reset Status
URSTS : Boolean;
-- unspecified
Reserved_1_7 : Interfaces.SAM.UInt7;
-- Read-only. Reset Type
RSTTYP : RSTC_SR_RSTTYP_Field;
-- unspecified
Reserved_11_15 : Interfaces.SAM.UInt5;
-- Read-only. NRST Pin Level
NRSTL : Boolean;
-- Read-only. Software Reset Command in Progress
SRCMP : Boolean;
-- unspecified
Reserved_18_31 : Interfaces.SAM.UInt14;
end record
with Volatile_Full_Access, Size => 32,
Bit_Order => System.Low_Order_First;
for RSTC_SR_Register use record
URSTS at 0 range 0 .. 0;
Reserved_1_7 at 0 range 1 .. 7;
RSTTYP at 0 range 8 .. 10;
Reserved_11_15 at 0 range 11 .. 15;
NRSTL at 0 range 16 .. 16;
SRCMP at 0 range 17 .. 17;
Reserved_18_31 at 0 range 18 .. 31;
end record;
subtype RSTC_MR_ERSTL_Field is Interfaces.SAM.UInt4;
subtype RSTC_MR_KEY_Field is Interfaces.SAM.Byte;
-- Mode Register
type RSTC_MR_Register is record
-- User Reset Enable
URSTEN : Boolean := True;
-- unspecified
Reserved_1_3 : Interfaces.SAM.UInt3 := 16#0#;
-- User Reset Interrupt Enable
URSTIEN : Boolean := False;
-- unspecified
Reserved_5_7 : Interfaces.SAM.UInt3 := 16#0#;
-- External Reset Length
ERSTL : RSTC_MR_ERSTL_Field := 16#0#;
-- unspecified
Reserved_12_23 : Interfaces.SAM.UInt12 := 16#0#;
-- Password
KEY : RSTC_MR_KEY_Field := 16#0#;
end record
with Volatile_Full_Access, Size => 32,
Bit_Order => System.Low_Order_First;
for RSTC_MR_Register use record
URSTEN at 0 range 0 .. 0;
Reserved_1_3 at 0 range 1 .. 3;
URSTIEN at 0 range 4 .. 4;
Reserved_5_7 at 0 range 5 .. 7;
ERSTL at 0 range 8 .. 11;
Reserved_12_23 at 0 range 12 .. 23;
KEY at 0 range 24 .. 31;
end record;
-- Time Event Selection
type CR_TIMEVSEL_Field is
(
-- Minute change
Minute,
-- Hour change
Hour,
-- Every day at midnight
Midnight,
-- Every day at noon
Noon)
with Size => 2;
for CR_TIMEVSEL_Field use
(Minute => 0,
Hour => 1,
Midnight => 2,
Noon => 3);
-- Calendar Event Selection
type CR_CALEVSEL_Field is
(
-- Week change (every Monday at time 00:00:00)
Week,
-- Month change (every 01 of each month at time 00:00:00)
Month,
-- Year change (every January 1 at time 00:00:00)
Year)
with Size => 2;
for CR_CALEVSEL_Field use
(Week => 0,
Month => 1,
Year => 2);
-- Control Register
type RTC_CR_Register is record
-- Update Request Time Register
UPDTIM : Boolean := False;
-- Update Request Calendar Register
UPDCAL : Boolean := False;
-- unspecified
Reserved_2_7 : Interfaces.SAM.UInt6 := 16#0#;
-- Time Event Selection
TIMEVSEL : CR_TIMEVSEL_Field := Interfaces.SAM.SYSC.Minute;
-- unspecified
Reserved_10_15 : Interfaces.SAM.UInt6 := 16#0#;
-- Calendar Event Selection
CALEVSEL : CR_CALEVSEL_Field := Interfaces.SAM.SYSC.Week;
-- unspecified
Reserved_18_31 : Interfaces.SAM.UInt14 := 16#0#;
end record
with Volatile_Full_Access, Size => 32,
Bit_Order => System.Low_Order_First;
for RTC_CR_Register use record
UPDTIM at 0 range 0 .. 0;
UPDCAL at 0 range 1 .. 1;
Reserved_2_7 at 0 range 2 .. 7;
TIMEVSEL at 0 range 8 .. 9;
Reserved_10_15 at 0 range 10 .. 15;
CALEVSEL at 0 range 16 .. 17;
Reserved_18_31 at 0 range 18 .. 31;
end record;
subtype RTC_MR_CORRECTION_Field is Interfaces.SAM.UInt7;
-- RTCOUT0 Output Source Selection
type MR_OUT0_Field is
(
-- no waveform, stuck at '0'
No_Wave,
-- 1 Hz square wave
Freq1Hz,
-- 32 Hz square wave
Freq32Hz,
-- 64 Hz square wave
Freq64Hz,
-- 512 Hz square wave
Freq512Hz,
-- output toggles when alarm flag rises
Alarm_Toggle,
-- output is a copy of the alarm flag
Alarm_Flag,
-- duty cycle programmable pulse
Prog_Pulse)
with Size => 3;
for MR_OUT0_Field use
(No_Wave => 0,
Freq1Hz => 1,
Freq32Hz => 2,
Freq64Hz => 3,
Freq512Hz => 4,
Alarm_Toggle => 5,
Alarm_Flag => 6,
Prog_Pulse => 7);
-- RTCOUT1 Output Source Selection
type MR_OUT1_Field is
(
-- no waveform, stuck at '0'
No_Wave,
-- 1 Hz square wave
Freq1Hz,
-- 32 Hz square wave
Freq32Hz,
-- 64 Hz square wave
Freq64Hz,
-- 512 Hz square wave
Freq512Hz,
-- output toggles when alarm flag rises
Alarm_Toggle,
-- output is a copy of the alarm flag
Alarm_Flag,
-- duty cycle programmable pulse
Prog_Pulse)
with Size => 3;
for MR_OUT1_Field use
(No_Wave => 0,
Freq1Hz => 1,
Freq32Hz => 2,
Freq64Hz => 3,
Freq512Hz => 4,
Alarm_Toggle => 5,
Alarm_Flag => 6,
Prog_Pulse => 7);
-- High Duration of the Output Pulse
type MR_THIGH_Field is
(
-- 31.2 ms
H_31Ms,
-- 15.6 ms
H_16Ms,
-- 3.91 Lms
H_4Ms,
-- 976 us
H_976Us,
-- 488 us
H_488Us,
-- 122 us
H_122Us,
-- 30.5 us
H_30Us,
-- 15.2 us
H_15Us)
with Size => 3;
for MR_THIGH_Field use
(H_31Ms => 0,
H_16Ms => 1,
H_4Ms => 2,
H_976Us => 3,
H_488Us => 4,
H_122Us => 5,
H_30Us => 6,
H_15Us => 7);
-- Period of the Output Pulse
type MR_TPERIOD_Field is
(
-- 1 second
P_1S,
-- 500 ms
P_500Ms,
-- 250 ms
P_250Ms,
-- 125 ms
P_125Ms)
with Size => 2;
for MR_TPERIOD_Field use
(P_1S => 0,
P_500Ms => 1,
P_250Ms => 2,
P_125Ms => 3);
-- Mode Register
type RTC_MR_Register is record
-- 12-/24-hour Mode
HRMOD : Boolean := False;
-- PERSIAN Calendar
PERSIAN : Boolean := False;
-- unspecified
Reserved_2_3 : Interfaces.SAM.UInt2 := 16#0#;
-- NEGative PPM Correction
NEGPPM : Boolean := False;
-- unspecified
Reserved_5_7 : Interfaces.SAM.UInt3 := 16#0#;
-- Slow Clock Correction
CORRECTION : RTC_MR_CORRECTION_Field := 16#0#;
-- HIGH PPM Correction
HIGHPPM : Boolean := False;
-- RTCOUT0 Output Source Selection
OUT0 : MR_OUT0_Field := Interfaces.SAM.SYSC.No_Wave;
-- unspecified
Reserved_19_19 : Interfaces.SAM.Bit := 16#0#;
-- RTCOUT1 Output Source Selection
OUT1 : MR_OUT1_Field := Interfaces.SAM.SYSC.No_Wave;
-- unspecified
Reserved_23_23 : Interfaces.SAM.Bit := 16#0#;
-- High Duration of the Output Pulse
THIGH : MR_THIGH_Field := Interfaces.SAM.SYSC.H_31Ms;
-- unspecified
Reserved_27_27 : Interfaces.SAM.Bit := 16#0#;
-- Period of the Output Pulse
TPERIOD : MR_TPERIOD_Field := Interfaces.SAM.SYSC.P_1S;
-- unspecified
Reserved_30_31 : Interfaces.SAM.UInt2 := 16#0#;
end record
with Volatile_Full_Access, Size => 32,
Bit_Order => System.Low_Order_First;
for RTC_MR_Register use record
HRMOD at 0 range 0 .. 0;
PERSIAN at 0 range 1 .. 1;
Reserved_2_3 at 0 range 2 .. 3;
NEGPPM at 0 range 4 .. 4;
Reserved_5_7 at 0 range 5 .. 7;
CORRECTION at 0 range 8 .. 14;
HIGHPPM at 0 range 15 .. 15;
OUT0 at 0 range 16 .. 18;
Reserved_19_19 at 0 range 19 .. 19;
OUT1 at 0 range 20 .. 22;
Reserved_23_23 at 0 range 23 .. 23;
THIGH at 0 range 24 .. 26;
Reserved_27_27 at 0 range 27 .. 27;
TPERIOD at 0 range 28 .. 29;
Reserved_30_31 at 0 range 30 .. 31;
end record;
subtype RTC_TIMR_SEC_Field is Interfaces.SAM.UInt7;
subtype RTC_TIMR_MIN_Field is Interfaces.SAM.UInt7;
subtype RTC_TIMR_HOUR_Field is Interfaces.SAM.UInt6;
-- Time Register
type RTC_TIMR_Register is record
-- Current Second
SEC : RTC_TIMR_SEC_Field := 16#0#;
-- unspecified
Reserved_7_7 : Interfaces.SAM.Bit := 16#0#;
-- Current Minute
MIN : RTC_TIMR_MIN_Field := 16#0#;
-- unspecified
Reserved_15_15 : Interfaces.SAM.Bit := 16#0#;
-- Current Hour
HOUR : RTC_TIMR_HOUR_Field := 16#0#;
-- Ante Meridiem Post Meridiem Indicator
AMPM : Boolean := False;
-- unspecified
Reserved_23_31 : Interfaces.SAM.UInt9 := 16#0#;
end record
with Volatile_Full_Access, Size => 32,
Bit_Order => System.Low_Order_First;
for RTC_TIMR_Register use record
SEC at 0 range 0 .. 6;
Reserved_7_7 at 0 range 7 .. 7;
MIN at 0 range 8 .. 14;
Reserved_15_15 at 0 range 15 .. 15;
HOUR at 0 range 16 .. 21;
AMPM at 0 range 22 .. 22;
Reserved_23_31 at 0 range 23 .. 31;
end record;
subtype RTC_CALR_CENT_Field is Interfaces.SAM.UInt7;
subtype RTC_CALR_YEAR_Field is Interfaces.SAM.Byte;
subtype RTC_CALR_MONTH_Field is Interfaces.SAM.UInt5;
subtype RTC_CALR_DAY_Field is Interfaces.SAM.UInt3;
subtype RTC_CALR_DATE_Field is Interfaces.SAM.UInt6;
-- Calendar Register
type RTC_CALR_Register is record
-- Current Century
CENT : RTC_CALR_CENT_Field := 16#20#;
-- unspecified
Reserved_7_7 : Interfaces.SAM.Bit := 16#0#;
-- Current Year
YEAR : RTC_CALR_YEAR_Field := 16#10#;
-- Current Month
MONTH : RTC_CALR_MONTH_Field := 16#1#;
-- Current Day in Current Week
DAY : RTC_CALR_DAY_Field := 16#5#;
-- Current Day in Current Month
DATE : RTC_CALR_DATE_Field := 16#1#;
-- unspecified
Reserved_30_31 : Interfaces.SAM.UInt2 := 16#0#;
end record
with Volatile_Full_Access, Size => 32,
Bit_Order => System.Low_Order_First;
for RTC_CALR_Register use record
CENT at 0 range 0 .. 6;
Reserved_7_7 at 0 range 7 .. 7;
YEAR at 0 range 8 .. 15;
MONTH at 0 range 16 .. 20;
DAY at 0 range 21 .. 23;
DATE at 0 range 24 .. 29;
Reserved_30_31 at 0 range 30 .. 31;
end record;
subtype RTC_TIMALR_SEC_Field is Interfaces.SAM.UInt7;
subtype RTC_TIMALR_MIN_Field is Interfaces.SAM.UInt7;
subtype RTC_TIMALR_HOUR_Field is Interfaces.SAM.UInt6;
-- Time Alarm Register
type RTC_TIMALR_Register is record
-- Second Alarm
SEC : RTC_TIMALR_SEC_Field := 16#0#;
-- Second Alarm Enable
SECEN : Boolean := False;
-- Minute Alarm
MIN : RTC_TIMALR_MIN_Field := 16#0#;
-- Minute Alarm Enable
MINEN : Boolean := False;
-- Hour Alarm
HOUR : RTC_TIMALR_HOUR_Field := 16#0#;
-- AM/PM Indicator
AMPM : Boolean := False;
-- Hour Alarm Enable
HOUREN : Boolean := False;
-- unspecified
Reserved_24_31 : Interfaces.SAM.Byte := 16#0#;
end record
with Volatile_Full_Access, Size => 32,
Bit_Order => System.Low_Order_First;
for RTC_TIMALR_Register use record
SEC at 0 range 0 .. 6;
SECEN at 0 range 7 .. 7;
MIN at 0 range 8 .. 14;
MINEN at 0 range 15 .. 15;
HOUR at 0 range 16 .. 21;
AMPM at 0 range 22 .. 22;
HOUREN at 0 range 23 .. 23;
Reserved_24_31 at 0 range 24 .. 31;
end record;
subtype RTC_CALALR_MONTH_Field is Interfaces.SAM.UInt5;
subtype RTC_CALALR_DATE_Field is Interfaces.SAM.UInt6;
-- Calendar Alarm Register
type RTC_CALALR_Register is record
-- unspecified
Reserved_0_15 : Interfaces.SAM.UInt16 := 16#0#;
-- Month Alarm
MONTH : RTC_CALALR_MONTH_Field := 16#1#;
-- unspecified
Reserved_21_22 : Interfaces.SAM.UInt2 := 16#0#;
-- Month Alarm Enable
MTHEN : Boolean := False;
-- Date Alarm
DATE : RTC_CALALR_DATE_Field := 16#1#;
-- unspecified
Reserved_30_30 : Interfaces.SAM.Bit := 16#0#;
-- Date Alarm Enable
DATEEN : Boolean := False;
end record
with Volatile_Full_Access, Size => 32,
Bit_Order => System.Low_Order_First;
for RTC_CALALR_Register use record
Reserved_0_15 at 0 range 0 .. 15;
MONTH at 0 range 16 .. 20;
Reserved_21_22 at 0 range 21 .. 22;
MTHEN at 0 range 23 .. 23;
DATE at 0 range 24 .. 29;
Reserved_30_30 at 0 range 30 .. 30;
DATEEN at 0 range 31 .. 31;
end record;
-- Acknowledge for Update
type SR_ACKUPD_Field is
(
-- Time and calendar registers cannot be updated.
Freerun,
-- Time and calendar registers can be updated.
Update)
with Size => 1;
for SR_ACKUPD_Field use
(Freerun => 0,
Update => 1);
-- Alarm Flag
type SR_ALARM_Field is
(
-- No alarm matching condition occurred.
No_Alarmevent,
-- An alarm matching condition has occurred.
Alarmevent)
with Size => 1;
for SR_ALARM_Field use
(No_Alarmevent => 0,
Alarmevent => 1);
-- Second Event
type SR_SEC_Field is
(
-- No second event has occurred since the last clear.
No_Secevent,
-- At least one second event has occurred since the last clear.
Secevent)
with Size => 1;
for SR_SEC_Field use
(No_Secevent => 0,
Secevent => 1);
-- Time Event
type SR_TIMEV_Field is
(
-- No time event has occurred since the last clear.
No_Timevent,
-- At least one time event has occurred since the last clear.
Timevent)
with Size => 1;
for SR_TIMEV_Field use
(No_Timevent => 0,
Timevent => 1);
-- Calendar Event
type SR_CALEV_Field is
(
-- No calendar event has occurred since the last clear.
No_Calevent,
-- At least one calendar event has occurred since the last clear.
Calevent)
with Size => 1;
for SR_CALEV_Field use
(No_Calevent => 0,
Calevent => 1);
-- Time and/or Date Free Running Error
type SR_TDERR_Field is
(
-- The internal free running counters are carrying valid values since
-- the last read of RTC_SR.
Correct,
-- The internal free running counters have been corrupted (invalid date
-- or time, non-BCD values) since the last read and/or they are still
-- invalid.
Err_Timedate)
with Size => 1;
for SR_TDERR_Field use
(Correct => 0,
Err_Timedate => 1);
-- Status Register
type RTC_SR_Register is record
-- Read-only. Acknowledge for Update
ACKUPD : SR_ACKUPD_Field;
-- Read-only. Alarm Flag
ALARM : SR_ALARM_Field;
-- Read-only. Second Event
SEC : SR_SEC_Field;
-- Read-only. Time Event
TIMEV : SR_TIMEV_Field;
-- Read-only. Calendar Event
CALEV : SR_CALEV_Field;
-- Read-only. Time and/or Date Free Running Error
TDERR : SR_TDERR_Field;
-- unspecified
Reserved_6_31 : Interfaces.SAM.UInt26;
end record
with Volatile_Full_Access, Size => 32,
Bit_Order => System.Low_Order_First;
for RTC_SR_Register use record
ACKUPD at 0 range 0 .. 0;
ALARM at 0 range 1 .. 1;
SEC at 0 range 2 .. 2;
TIMEV at 0 range 3 .. 3;
CALEV at 0 range 4 .. 4;
TDERR at 0 range 5 .. 5;
Reserved_6_31 at 0 range 6 .. 31;
end record;
-- Status Clear Command Register
type RTC_SCCR_Register is record
-- Write-only. Acknowledge Clear
ACKCLR : Boolean := False;
-- Write-only. Alarm Clear
ALRCLR : Boolean := False;
-- Write-only. Second Clear
SECCLR : Boolean := False;
-- Write-only. Time Clear
TIMCLR : Boolean := False;
-- Write-only. Calendar Clear
CALCLR : Boolean := False;
-- Write-only. Time and/or Date Free Running Error Clear
TDERRCLR : Boolean := False;
-- unspecified
Reserved_6_31 : Interfaces.SAM.UInt26 := 16#0#;
end record
with Volatile_Full_Access, Size => 32,
Bit_Order => System.Low_Order_First;
for RTC_SCCR_Register use record
ACKCLR at 0 range 0 .. 0;
ALRCLR at 0 range 1 .. 1;
SECCLR at 0 range 2 .. 2;
TIMCLR at 0 range 3 .. 3;
CALCLR at 0 range 4 .. 4;
TDERRCLR at 0 range 5 .. 5;
Reserved_6_31 at 0 range 6 .. 31;
end record;
-- Interrupt Enable Register
type RTC_IER_Register is record
-- Write-only. Acknowledge Update Interrupt Enable
ACKEN : Boolean := False;
-- Write-only. Alarm Interrupt Enable
ALREN : Boolean := False;
-- Write-only. Second Event Interrupt Enable
SECEN : Boolean := False;
-- Write-only. Time Event Interrupt Enable
TIMEN : Boolean := False;
-- Write-only. Calendar Event Interrupt Enable
CALEN : Boolean := False;
-- Write-only. Time and/or Date Error Interrupt Enable
TDERREN : Boolean := False;
-- unspecified
Reserved_6_31 : Interfaces.SAM.UInt26 := 16#0#;
end record
with Volatile_Full_Access, Size => 32,
Bit_Order => System.Low_Order_First;
for RTC_IER_Register use record
ACKEN at 0 range 0 .. 0;
ALREN at 0 range 1 .. 1;
SECEN at 0 range 2 .. 2;
TIMEN at 0 range 3 .. 3;
CALEN at 0 range 4 .. 4;
TDERREN at 0 range 5 .. 5;
Reserved_6_31 at 0 range 6 .. 31;
end record;
-- Interrupt Disable Register
type RTC_IDR_Register is record
-- Write-only. Acknowledge Update Interrupt Disable
ACKDIS : Boolean := False;
-- Write-only. Alarm Interrupt Disable
ALRDIS : Boolean := False;
-- Write-only. Second Event Interrupt Disable
SECDIS : Boolean := False;
-- Write-only. Time Event Interrupt Disable
TIMDIS : Boolean := False;
-- Write-only. Calendar Event Interrupt Disable
CALDIS : Boolean := False;
-- Write-only. Time and/or Date Error Interrupt Disable
TDERRDIS : Boolean := False;
-- unspecified
Reserved_6_31 : Interfaces.SAM.UInt26 := 16#0#;
end record
with Volatile_Full_Access, Size => 32,
Bit_Order => System.Low_Order_First;
for RTC_IDR_Register use record
ACKDIS at 0 range 0 .. 0;
ALRDIS at 0 range 1 .. 1;
SECDIS at 0 range 2 .. 2;
TIMDIS at 0 range 3 .. 3;
CALDIS at 0 range 4 .. 4;
TDERRDIS at 0 range 5 .. 5;
Reserved_6_31 at 0 range 6 .. 31;
end record;
-- Interrupt Mask Register
type RTC_IMR_Register is record
-- Read-only. Acknowledge Update Interrupt Mask
ACK : Boolean;
-- Read-only. Alarm Interrupt Mask
ALR : Boolean;
-- Read-only. Second Event Interrupt Mask
SEC : Boolean;
-- Read-only. Time Event Interrupt Mask
TIM : Boolean;
-- Read-only. Calendar Event Interrupt Mask
CAL : Boolean;
-- unspecified
Reserved_5_31 : Interfaces.SAM.UInt27;
end record
with Volatile_Full_Access, Size => 32,
Bit_Order => System.Low_Order_First;
for RTC_IMR_Register use record
ACK at 0 range 0 .. 0;
ALR at 0 range 1 .. 1;
SEC at 0 range 2 .. 2;
TIM at 0 range 3 .. 3;
CAL at 0 range 4 .. 4;
Reserved_5_31 at 0 range 5 .. 31;
end record;
-- Valid Entry Register
type RTC_VER_Register is record
-- Read-only. Non-valid Time
NVTIM : Boolean;
-- Read-only. Non-valid Calendar
NVCAL : Boolean;
-- Read-only. Non-valid Time Alarm
NVTIMALR : Boolean;
-- Read-only. Non-valid Calendar Alarm
NVCALALR : Boolean;
-- unspecified
Reserved_4_31 : Interfaces.SAM.UInt28;
end record
with Volatile_Full_Access, Size => 32,
Bit_Order => System.Low_Order_First;
for RTC_VER_Register use record
NVTIM at 0 range 0 .. 0;
NVCAL at 0 range 1 .. 1;
NVTIMALR at 0 range 2 .. 2;
NVCALALR at 0 range 3 .. 3;
Reserved_4_31 at 0 range 4 .. 31;
end record;
subtype RTT_MR_RTPRES_Field is Interfaces.SAM.UInt16;
-- Mode Register
type RTT_MR_Register is record
-- Real-time Timer Prescaler Value
RTPRES : RTT_MR_RTPRES_Field := 16#8000#;
-- Alarm Interrupt Enable
ALMIEN : Boolean := False;
-- Real-time Timer Increment Interrupt Enable
RTTINCIEN : Boolean := False;
-- Real-time Timer Restart
RTTRST : Boolean := False;
-- unspecified
Reserved_19_19 : Interfaces.SAM.Bit := 16#0#;
-- Real-time Timer Disable
RTTDIS : Boolean := False;
-- unspecified
Reserved_21_23 : Interfaces.SAM.UInt3 := 16#0#;
-- Real-Time Clock 1Hz Clock Selection
RTC1HZ : Boolean := False;
-- unspecified
Reserved_25_31 : Interfaces.SAM.UInt7 := 16#0#;
end record
with Volatile_Full_Access, Size => 32,
Bit_Order => System.Low_Order_First;
for RTT_MR_Register use record
RTPRES at 0 range 0 .. 15;
ALMIEN at 0 range 16 .. 16;
RTTINCIEN at 0 range 17 .. 17;
RTTRST at 0 range 18 .. 18;
Reserved_19_19 at 0 range 19 .. 19;
RTTDIS at 0 range 20 .. 20;
Reserved_21_23 at 0 range 21 .. 23;
RTC1HZ at 0 range 24 .. 24;
Reserved_25_31 at 0 range 25 .. 31;
end record;
-- Status Register
type RTT_SR_Register is record
-- Read-only. Real-time Alarm Status
ALMS : Boolean;
-- Read-only. Real-time Timer Increment
RTTINC : Boolean;
-- unspecified
Reserved_2_31 : Interfaces.SAM.UInt30;
end record
with Volatile_Full_Access, Size => 32,
Bit_Order => System.Low_Order_First;
for RTT_SR_Register use record
ALMS at 0 range 0 .. 0;
RTTINC at 0 range 1 .. 1;
Reserved_2_31 at 0 range 2 .. 31;
end record;
-- Voltage Regulator Off
type CR_VROFF_Field is
(
-- no effect.
No_Effect,
-- if KEY is correct, asserts vddcore_nreset and stops the voltage
-- regulator.
Stop_Vreg)
with Size => 1;
for CR_VROFF_Field use
(No_Effect => 0,
Stop_Vreg => 1);
-- Crystal Oscillator Select
type CR_XTALSEL_Field is
(
-- no effect.
No_Effect,
-- if KEY is correct, switches the slow clock on the crystal oscillator
-- output.
Crystal_Sel)
with Size => 1;
for CR_XTALSEL_Field use
(No_Effect => 0,
Crystal_Sel => 1);
subtype SUPC_CR_KEY_Field is Interfaces.SAM.Byte;
-- Supply Controller Control Register
type SUPC_CR_Register is record
-- unspecified
Reserved_0_1 : Interfaces.SAM.UInt2 := 16#0#;
-- Write-only. Voltage Regulator Off
VROFF : CR_VROFF_Field := Interfaces.SAM.SYSC.No_Effect;
-- Write-only. Crystal Oscillator Select
XTALSEL : CR_XTALSEL_Field := Interfaces.SAM.SYSC.No_Effect;
-- unspecified
Reserved_4_23 : Interfaces.SAM.UInt20 := 16#0#;
-- Write-only. Password
KEY : SUPC_CR_KEY_Field := 16#0#;
end record
with Volatile_Full_Access, Size => 32,
Bit_Order => System.Low_Order_First;
for SUPC_CR_Register use record
Reserved_0_1 at 0 range 0 .. 1;
VROFF at 0 range 2 .. 2;
XTALSEL at 0 range 3 .. 3;
Reserved_4_23 at 0 range 4 .. 23;
KEY at 0 range 24 .. 31;
end record;
subtype SUPC_SMMR_SMTH_Field is Interfaces.SAM.UInt4;
-- Supply Monitor Sampling Period
type SMMR_SMSMPL_Field is
(
-- Supply Monitor disabled
Smd,
-- Continuous Supply Monitor
Csm,
-- Supply Monitor enabled one SLCK period every 32 SLCK periods
SMMR_SMSMPL_Field_32Slck,
-- Supply Monitor enabled one SLCK period every 256 SLCK periods
SMMR_SMSMPL_Field_256Slck,
-- Supply Monitor enabled one SLCK period every 2,048 SLCK periods
SMMR_SMSMPL_Field_2048Slck)
with Size => 3;
for SMMR_SMSMPL_Field use
(Smd => 0,
Csm => 1,
SMMR_SMSMPL_Field_32Slck => 2,
SMMR_SMSMPL_Field_256Slck => 3,
SMMR_SMSMPL_Field_2048Slck => 4);
-- Supply Monitor Reset Enable
type SMMR_SMRSTEN_Field is
(
-- the core reset signal "vddcore_nreset" is not affected when a supply
-- monitor detection occurs.
Not_Enable,
-- the core reset signal, vddcore_nreset is asserted when a supply
-- monitor detection occurs.
Enable)
with Size => 1;
for SMMR_SMRSTEN_Field use
(Not_Enable => 0,
Enable => 1);
-- Supply Monitor Interrupt Enable
type SMMR_SMIEN_Field is
(
-- the SUPC interrupt signal is not affected when a supply monitor
-- detection occurs.
Not_Enable,
-- the SUPC interrupt signal is asserted when a supply monitor detection
-- occurs.
Enable)
with Size => 1;
for SMMR_SMIEN_Field use
(Not_Enable => 0,
Enable => 1);
-- Supply Controller Supply Monitor Mode Register
type SUPC_SMMR_Register is record
-- Supply Monitor Threshold
SMTH : SUPC_SMMR_SMTH_Field := 16#0#;
-- unspecified
Reserved_4_7 : Interfaces.SAM.UInt4 := 16#0#;
-- Supply Monitor Sampling Period
SMSMPL : SMMR_SMSMPL_Field := Interfaces.SAM.SYSC.Smd;
-- unspecified
Reserved_11_11 : Interfaces.SAM.Bit := 16#0#;
-- Supply Monitor Reset Enable
SMRSTEN : SMMR_SMRSTEN_Field := Interfaces.SAM.SYSC.Not_Enable;
-- Supply Monitor Interrupt Enable
SMIEN : SMMR_SMIEN_Field := Interfaces.SAM.SYSC.Not_Enable;
-- unspecified
Reserved_14_31 : Interfaces.SAM.UInt18 := 16#0#;
end record
with Volatile_Full_Access, Size => 32,
Bit_Order => System.Low_Order_First;
for SUPC_SMMR_Register use record
SMTH at 0 range 0 .. 3;
Reserved_4_7 at 0 range 4 .. 7;
SMSMPL at 0 range 8 .. 10;
Reserved_11_11 at 0 range 11 .. 11;
SMRSTEN at 0 range 12 .. 12;
SMIEN at 0 range 13 .. 13;
Reserved_14_31 at 0 range 14 .. 31;
end record;
-- Brownout Detector Reset Enable
type MR_BODRSTEN_Field is
(
-- the core reset signal "vddcore_nreset" is not affected when a
-- brownout detection occurs.
Not_Enable,
-- the core reset signal, vddcore_nreset is asserted when a brownout
-- detection occurs.
Enable)
with Size => 1;
for MR_BODRSTEN_Field use
(Not_Enable => 0,
Enable => 1);
-- Brownout Detector Disable
type MR_BODDIS_Field is
(
-- the core brownout detector is enabled.
Enable,
-- the core brownout detector is disabled.
Disable)
with Size => 1;
for MR_BODDIS_Field use
(Enable => 0,
Disable => 1);
-- Voltage Regulator enable
type MR_ONREG_Field is
(
-- Internal voltage regulator is not used (external power supply is
-- used)
Onreg_Unused,
-- internal voltage regulator is used
Onreg_Used)
with Size => 1;
for MR_ONREG_Field use
(Onreg_Unused => 0,
Onreg_Used => 1);
-- Oscillator Bypass
type MR_OSCBYPASS_Field is
(
-- no effect. Clock selection depends on XTALSEL value.
No_Effect,
-- the 32-KHz XTAL oscillator is selected and is put in bypass mode.
Bypass)
with Size => 1;
for MR_OSCBYPASS_Field use
(No_Effect => 0,
Bypass => 1);
subtype SUPC_MR_KEY_Field is Interfaces.SAM.Byte;
-- Supply Controller Mode Register
type SUPC_MR_Register is record
-- unspecified
Reserved_0_11 : Interfaces.SAM.UInt12 := 16#A00#;
-- Brownout Detector Reset Enable
BODRSTEN : MR_BODRSTEN_Field := Interfaces.SAM.SYSC.Enable;
-- Brownout Detector Disable
BODDIS : MR_BODDIS_Field := Interfaces.SAM.SYSC.Enable;
-- Voltage Regulator enable
ONREG : MR_ONREG_Field := Interfaces.SAM.SYSC.Onreg_Used;
-- unspecified
Reserved_15_19 : Interfaces.SAM.UInt5 := 16#0#;
-- Oscillator Bypass
OSCBYPASS : MR_OSCBYPASS_Field := Interfaces.SAM.SYSC.No_Effect;
-- unspecified
Reserved_21_23 : Interfaces.SAM.UInt3 := 16#0#;
-- Password Key
KEY : SUPC_MR_KEY_Field := 16#0#;
end record
with Volatile_Full_Access, Size => 32,
Bit_Order => System.Low_Order_First;
for SUPC_MR_Register use record
Reserved_0_11 at 0 range 0 .. 11;
BODRSTEN at 0 range 12 .. 12;
BODDIS at 0 range 13 .. 13;
ONREG at 0 range 14 .. 14;
Reserved_15_19 at 0 range 15 .. 19;
OSCBYPASS at 0 range 20 .. 20;
Reserved_21_23 at 0 range 21 .. 23;
KEY at 0 range 24 .. 31;
end record;
-- Supply Monitor Wake Up Enable
type WUMR_SMEN_Field is
(
-- the supply monitor detection has no wake up effect.
Not_Enable,
-- the supply monitor detection forces the wake up of the core power
-- supply.
Enable)
with Size => 1;
for WUMR_SMEN_Field use
(Not_Enable => 0,
Enable => 1);
-- Real Time Timer Wake Up Enable
type WUMR_RTTEN_Field is
(
-- the RTT alarm signal has no wake up effect.
Not_Enable,
-- the RTT alarm signal forces the wake up of the core power supply.
Enable)
with Size => 1;
for WUMR_RTTEN_Field use
(Not_Enable => 0,
Enable => 1);
-- Real Time Clock Wake Up Enable
type WUMR_RTCEN_Field is
(
-- the RTC alarm signal has no wake up effect.
Not_Enable,
-- the RTC alarm signal forces the wake up of the core power supply.
Enable)
with Size => 1;
for WUMR_RTCEN_Field use
(Not_Enable => 0,
Enable => 1);
-- Low power Debouncer ENable WKUP0
type WUMR_LPDBCEN0_Field is
(
-- the WKUP0 input pin is not connected with low power debouncer.
Not_Enable,
-- the WKUP0 input pin is connected with low power debouncer and can
-- force a core wake up.
Enable)
with Size => 1;
for WUMR_LPDBCEN0_Field use
(Not_Enable => 0,
Enable => 1);
-- Low power Debouncer ENable WKUP1
type WUMR_LPDBCEN1_Field is
(
-- the WKUP1input pin is not connected with low power debouncer.
Not_Enable,
-- the WKUP1 input pin is connected with low power debouncer and can
-- force a core wake up.
Enable)
with Size => 1;
for WUMR_LPDBCEN1_Field use
(Not_Enable => 0,
Enable => 1);
-- Low power Debouncer Clear
type WUMR_LPDBCCLR_Field is
(
-- a low power debounce event does not create an immediate clear on
-- first half GPBR registers.
Not_Enable,
-- a low power debounce event on WKUP0 or WKUP1 generates an immediate
-- clear on first half GPBR registers.
Enable)
with Size => 1;
for WUMR_LPDBCCLR_Field use
(Not_Enable => 0,
Enable => 1);
-- Wake Up Inputs Debouncer Period
type WUMR_WKUPDBC_Field is
(
-- Immediate, no debouncing, detected active at least on one Slow Clock
-- edge.
Immediate,
-- WKUPx shall be in its active state for at least 3 SLCK periods
WUMR_WKUPDBC_Field_3_Sclk,
-- WKUPx shall be in its active state for at least 32 SLCK periods
WUMR_WKUPDBC_Field_32_Sclk,
-- WKUPx shall be in its active state for at least 512 SLCK periods
WUMR_WKUPDBC_Field_512_Sclk,
-- WKUPx shall be in its active state for at least 4,096 SLCK periods
WUMR_WKUPDBC_Field_4096_Sclk,
-- WKUPx shall be in its active state for at least 32,768 SLCK periods
WUMR_WKUPDBC_Field_32768_Sclk)
with Size => 3;
for WUMR_WKUPDBC_Field use
(Immediate => 0,
WUMR_WKUPDBC_Field_3_Sclk => 1,
WUMR_WKUPDBC_Field_32_Sclk => 2,
WUMR_WKUPDBC_Field_512_Sclk => 3,
WUMR_WKUPDBC_Field_4096_Sclk => 4,
WUMR_WKUPDBC_Field_32768_Sclk => 5);
-- Low Power DeBounCer Period
type WUMR_LPDBC_Field is
(
-- Disable the low power debouncer.
Disable,
-- WKUP0/1 in its active state for at least 2 RTCOUT0 periods
WUMR_LPDBC_Field_2_Rtcout0,
-- WKUP0/1 in its active state for at least 3 RTCOUT0 periods
WUMR_LPDBC_Field_3_Rtcout0,
-- WKUP0/1 in its active state for at least 4 RTCOUT0 periods
WUMR_LPDBC_Field_4_Rtcout0,
-- WKUP0/1 in its active state for at least 5 RTCOUT0 periods
WUMR_LPDBC_Field_5_Rtcout0,
-- WKUP0/1 in its active state for at least 6 RTCOUT0 periods
WUMR_LPDBC_Field_6_Rtcout0,
-- WKUP0/1 in its active state for at least 7 RTCOUT0 periods
WUMR_LPDBC_Field_7_Rtcout0,
-- WKUP0/1 in its active state for at least 8 RTCOUT0 periods
WUMR_LPDBC_Field_8_Rtcout0)
with Size => 3;
for WUMR_LPDBC_Field use
(Disable => 0,
WUMR_LPDBC_Field_2_Rtcout0 => 1,
WUMR_LPDBC_Field_3_Rtcout0 => 2,
WUMR_LPDBC_Field_4_Rtcout0 => 3,
WUMR_LPDBC_Field_5_Rtcout0 => 4,
WUMR_LPDBC_Field_6_Rtcout0 => 5,
WUMR_LPDBC_Field_7_Rtcout0 => 6,
WUMR_LPDBC_Field_8_Rtcout0 => 7);
-- Supply Controller Wake Up Mode Register
type SUPC_WUMR_Register is record
-- unspecified
Reserved_0_0 : Interfaces.SAM.Bit := 16#0#;
-- Supply Monitor Wake Up Enable
SMEN : WUMR_SMEN_Field := Interfaces.SAM.SYSC.Not_Enable;
-- Real Time Timer Wake Up Enable
RTTEN : WUMR_RTTEN_Field := Interfaces.SAM.SYSC.Not_Enable;
-- Real Time Clock Wake Up Enable
RTCEN : WUMR_RTCEN_Field := Interfaces.SAM.SYSC.Not_Enable;
-- unspecified
Reserved_4_4 : Interfaces.SAM.Bit := 16#0#;
-- Low power Debouncer ENable WKUP0
LPDBCEN0 : WUMR_LPDBCEN0_Field := Interfaces.SAM.SYSC.Not_Enable;
-- Low power Debouncer ENable WKUP1
LPDBCEN1 : WUMR_LPDBCEN1_Field := Interfaces.SAM.SYSC.Not_Enable;
-- Low power Debouncer Clear
LPDBCCLR : WUMR_LPDBCCLR_Field := Interfaces.SAM.SYSC.Not_Enable;
-- unspecified
Reserved_8_11 : Interfaces.SAM.UInt4 := 16#0#;
-- Wake Up Inputs Debouncer Period
WKUPDBC : WUMR_WKUPDBC_Field := Interfaces.SAM.SYSC.Immediate;
-- unspecified
Reserved_15_15 : Interfaces.SAM.Bit := 16#0#;
-- Low Power DeBounCer Period
LPDBC : WUMR_LPDBC_Field := Interfaces.SAM.SYSC.Disable;
-- unspecified
Reserved_19_31 : Interfaces.SAM.UInt13 := 16#0#;
end record
with Volatile_Full_Access, Size => 32,
Bit_Order => System.Low_Order_First;
for SUPC_WUMR_Register use record
Reserved_0_0 at 0 range 0 .. 0;
SMEN at 0 range 1 .. 1;
RTTEN at 0 range 2 .. 2;
RTCEN at 0 range 3 .. 3;
Reserved_4_4 at 0 range 4 .. 4;
LPDBCEN0 at 0 range 5 .. 5;
LPDBCEN1 at 0 range 6 .. 6;
LPDBCCLR at 0 range 7 .. 7;
Reserved_8_11 at 0 range 8 .. 11;
WKUPDBC at 0 range 12 .. 14;
Reserved_15_15 at 0 range 15 .. 15;
LPDBC at 0 range 16 .. 18;
Reserved_19_31 at 0 range 19 .. 31;
end record;
-- Wake Up Input Enable 0
type WUIR_WKUPEN0_Field is
(
-- the corresponding wake-up input has no wake up effect.
Disable,
-- the corresponding wake-up input forces the wake up of the core power
-- supply.
Enable)
with Size => 1;
for WUIR_WKUPEN0_Field use
(Disable => 0,
Enable => 1);
-- SUPC_WUIR_WKUPEN array
type SUPC_WUIR_WKUPEN_Field_Array is array (0 .. 15) of WUIR_WKUPEN0_Field
with Component_Size => 1, Size => 16;
-- Type definition for SUPC_WUIR_WKUPEN
type SUPC_WUIR_WKUPEN_Field
(As_Array : Boolean := False)
is record
case As_Array is
when False =>
-- WKUPEN as a value
Val : Interfaces.SAM.UInt16;
when True =>
-- WKUPEN as an array
Arr : SUPC_WUIR_WKUPEN_Field_Array;
end case;
end record
with Unchecked_Union, Size => 16;
for SUPC_WUIR_WKUPEN_Field use record
Val at 0 range 0 .. 15;
Arr at 0 range 0 .. 15;
end record;
-- Wake Up Input Type 0
type WUIR_WKUPT0_Field is
(
-- a low level for a period defined by WKUPDBC on the corresponding
-- wake-up input forces the wake up of the core power supply.
Low,
-- a high level for a period defined by WKUPDBC on the correspond-ing
-- wake-up input forces the wake up of the core power supply.
High)
with Size => 1;
for WUIR_WKUPT0_Field use
(Low => 0,
High => 1);
-- SUPC_WUIR_WKUPT array
type SUPC_WUIR_WKUPT_Field_Array is array (0 .. 15) of WUIR_WKUPT0_Field
with Component_Size => 1, Size => 16;
-- Type definition for SUPC_WUIR_WKUPT
type SUPC_WUIR_WKUPT_Field
(As_Array : Boolean := False)
is record
case As_Array is
when False =>
-- WKUPT as a value
Val : Interfaces.SAM.UInt16;
when True =>
-- WKUPT as an array
Arr : SUPC_WUIR_WKUPT_Field_Array;
end case;
end record
with Unchecked_Union, Size => 16;
for SUPC_WUIR_WKUPT_Field use record
Val at 0 range 0 .. 15;
Arr at 0 range 0 .. 15;
end record;
-- Supply Controller Wake Up Inputs Register
type SUPC_WUIR_Register is record
-- Wake Up Input Enable 0
WKUPEN : SUPC_WUIR_WKUPEN_Field := (As_Array => False, Val => 16#0#);
-- Wake Up Input Type 0
WKUPT : SUPC_WUIR_WKUPT_Field := (As_Array => False, Val => 16#0#);
end record
with Volatile_Full_Access, Size => 32,
Bit_Order => System.Low_Order_First;
for SUPC_WUIR_Register use record
WKUPEN at 0 range 0 .. 15;
WKUPT at 0 range 16 .. 31;
end record;
-- WKUP Wake Up Status
type SR_WKUPS_Field is
(
-- no wake up due to the assertion of the WKUP pins has occurred since
-- the last read of SUPC_SR.
No,
-- at least one wake up due to the assertion of the WKUP pins has
-- occurred since the last read of SUPC_SR.
Present)
with Size => 1;
for SR_WKUPS_Field use
(No => 0,
Present => 1);
-- Supply Monitor Detection Wake Up Status
type SR_SMWS_Field is
(
-- no wake up due to a supply monitor detection has occurred since the
-- last read of SUPC_SR.
No,
-- at least one wake up due to a supply monitor detection has occurred
-- since the last read of SUPC_SR.
Present)
with Size => 1;
for SR_SMWS_Field use
(No => 0,
Present => 1);
-- Brownout Detector Reset Status
type SR_BODRSTS_Field is
(
-- no core brownout rising edge event has been detected since the last
-- read of the SUPC_SR.
No,
-- at least one brownout output rising edge event has been detected
-- since the last read of the SUPC_SR.
Present)
with Size => 1;
for SR_BODRSTS_Field use
(No => 0,
Present => 1);
-- Supply Monitor Reset Status
type SR_SMRSTS_Field is
(
-- no supply monitor detection has generated a core reset since the last
-- read of the SUPC_SR.
No,
-- at least one supply monitor detection has generated a core reset
-- since the last read of the SUPC_SR.
Present)
with Size => 1;
for SR_SMRSTS_Field use
(No => 0,
Present => 1);
-- Supply Monitor Status
type SR_SMS_Field is
(
-- no supply monitor detection since the last read of SUPC_SR.
No,
-- at least one supply monitor detection since the last read of SUPC_SR.
Present)
with Size => 1;
for SR_SMS_Field use
(No => 0,
Present => 1);
-- Supply Monitor Output Status
type SR_SMOS_Field is
(
-- the supply monitor detected VDDIO higher than its threshold at its
-- last measurement.
High,
-- the supply monitor detected VDDIO lower than its threshold at its
-- last measurement.
Low)
with Size => 1;
for SR_SMOS_Field use
(High => 0,
Low => 1);
-- 32-kHz Oscillator Selection Status
type SR_OSCSEL_Field is
(
-- the slow clock, SLCK is generated by the embedded 32-kHz RC
-- oscillator.
Rc,
-- the slow clock, SLCK is generated by the 32-kHz crystal oscillator.
Cryst)
with Size => 1;
for SR_OSCSEL_Field use
(Rc => 0,
Cryst => 1);
-- Low Power Debouncer Wake Up Status on WKUP0
type SR_LPDBCS0_Field is
(
-- no wake up due to the assertion of the WKUP0 pin has occurred since
-- the last read of SUPC_SR.
No,
-- at least one wake up due to the assertion of the WKUP0 pin has
-- occurred since the last read of SUPC_SR.
Present)
with Size => 1;
for SR_LPDBCS0_Field use
(No => 0,
Present => 1);
-- Low Power Debouncer Wake Up Status on WKUP1
type SR_LPDBCS1_Field is
(
-- no wake up due to the assertion of the WKUP1 pin has occurred since
-- the last read of SUPC_SR.
No,
-- at least one wake up due to the assertion of the WKUP1 pin has
-- occurred since the last read of SUPC_SR.
Present)
with Size => 1;
for SR_LPDBCS1_Field use
(No => 0,
Present => 1);
-- WKUP Input Status 0
type SR_WKUPIS0_Field is
(
-- the corresponding wake-up input is disabled, or was inactive at the
-- time the debouncer triggered a wake up event.
Dis,
-- the corresponding wake-up input was active at the time the debouncer
-- triggered a wake up event.
En)
with Size => 1;
for SR_WKUPIS0_Field use
(Dis => 0,
En => 1);
-- SUPC_SR_WKUPIS array
type SUPC_SR_WKUPIS_Field_Array is array (0 .. 15) of SR_WKUPIS0_Field
with Component_Size => 1, Size => 16;
-- Type definition for SUPC_SR_WKUPIS
type SUPC_SR_WKUPIS_Field
(As_Array : Boolean := False)
is record
case As_Array is
when False =>
-- WKUPIS as a value
Val : Interfaces.SAM.UInt16;
when True =>
-- WKUPIS as an array
Arr : SUPC_SR_WKUPIS_Field_Array;
end case;
end record
with Unchecked_Union, Size => 16;
for SUPC_SR_WKUPIS_Field use record
Val at 0 range 0 .. 15;
Arr at 0 range 0 .. 15;
end record;
-- Supply Controller Status Register
type SUPC_SR_Register is record
-- unspecified
Reserved_0_0 : Interfaces.SAM.Bit;
-- Read-only. WKUP Wake Up Status
WKUPS : SR_WKUPS_Field;
-- Read-only. Supply Monitor Detection Wake Up Status
SMWS : SR_SMWS_Field;
-- Read-only. Brownout Detector Reset Status
BODRSTS : SR_BODRSTS_Field;
-- Read-only. Supply Monitor Reset Status
SMRSTS : SR_SMRSTS_Field;
-- Read-only. Supply Monitor Status
SMS : SR_SMS_Field;
-- Read-only. Supply Monitor Output Status
SMOS : SR_SMOS_Field;
-- Read-only. 32-kHz Oscillator Selection Status
OSCSEL : SR_OSCSEL_Field;
-- unspecified
Reserved_8_12 : Interfaces.SAM.UInt5;
-- Read-only. Low Power Debouncer Wake Up Status on WKUP0
LPDBCS0 : SR_LPDBCS0_Field;
-- Read-only. Low Power Debouncer Wake Up Status on WKUP1
LPDBCS1 : SR_LPDBCS1_Field;
-- unspecified
Reserved_15_15 : Interfaces.SAM.Bit;
-- Read-only. WKUP Input Status 0
WKUPIS : SUPC_SR_WKUPIS_Field;
end record
with Volatile_Full_Access, Size => 32,
Bit_Order => System.Low_Order_First;
for SUPC_SR_Register use record
Reserved_0_0 at 0 range 0 .. 0;
WKUPS at 0 range 1 .. 1;
SMWS at 0 range 2 .. 2;
BODRSTS at 0 range 3 .. 3;
SMRSTS at 0 range 4 .. 4;
SMS at 0 range 5 .. 5;
SMOS at 0 range 6 .. 6;
OSCSEL at 0 range 7 .. 7;
Reserved_8_12 at 0 range 8 .. 12;
LPDBCS0 at 0 range 13 .. 13;
LPDBCS1 at 0 range 14 .. 14;
Reserved_15_15 at 0 range 15 .. 15;
WKUPIS at 0 range 16 .. 31;
end record;
subtype WDT_CR_KEY_Field is Interfaces.SAM.Byte;
-- Control Register
type WDT_CR_Register is record
-- Write-only. Watchdog Restart
WDRSTT : Boolean := False;
-- unspecified
Reserved_1_23 : Interfaces.SAM.UInt23 := 16#0#;
-- Write-only. Password
KEY : WDT_CR_KEY_Field := 16#0#;
end record
with Volatile_Full_Access, Size => 32,
Bit_Order => System.Low_Order_First;
for WDT_CR_Register use record
WDRSTT at 0 range 0 .. 0;
Reserved_1_23 at 0 range 1 .. 23;
KEY at 0 range 24 .. 31;
end record;
subtype WDT_MR_WDV_Field is Interfaces.SAM.UInt12;
subtype WDT_MR_WDD_Field is Interfaces.SAM.UInt12;
-- Mode Register
type WDT_MR_Register is record
-- Watchdog Counter Value
WDV : WDT_MR_WDV_Field := 16#FFF#;
-- Watchdog Fault Interrupt Enable
WDFIEN : Boolean := False;
-- Watchdog Reset Enable
WDRSTEN : Boolean := True;
-- Watchdog Reset Processor
WDRPROC : Boolean := False;
-- Watchdog Disable
WDDIS : Boolean := False;
-- Watchdog Delta Value
WDD : WDT_MR_WDD_Field := 16#FFF#;
-- Watchdog Debug Halt
WDDBGHLT : Boolean := True;
-- Watchdog Idle Halt
WDIDLEHLT : Boolean := True;
-- unspecified
Reserved_30_31 : Interfaces.SAM.UInt2 := 16#0#;
end record
with Volatile_Full_Access, Size => 32,
Bit_Order => System.Low_Order_First;
for WDT_MR_Register use record
WDV at 0 range 0 .. 11;
WDFIEN at 0 range 12 .. 12;
WDRSTEN at 0 range 13 .. 13;
WDRPROC at 0 range 14 .. 14;
WDDIS at 0 range 15 .. 15;
WDD at 0 range 16 .. 27;
WDDBGHLT at 0 range 28 .. 28;
WDIDLEHLT at 0 range 29 .. 29;
Reserved_30_31 at 0 range 30 .. 31;
end record;
-- Status Register
type WDT_SR_Register is record
-- Read-only. Watchdog Underflow
WDUNF : Boolean;
-- Read-only. Watchdog Error
WDERR : Boolean;
-- unspecified
Reserved_2_31 : Interfaces.SAM.UInt30;
end record
with Volatile_Full_Access, Size => 32,
Bit_Order => System.Low_Order_First;
for WDT_SR_Register use record
WDUNF at 0 range 0 .. 0;
WDERR at 0 range 1 .. 1;
Reserved_2_31 at 0 range 2 .. 31;
end record;
-----------------
-- Peripherals --
-----------------
-- General Purpose Backup Register
type GPBR_Peripheral is record
-- General Purpose Backup Register
GPBR : aliased GPBR_GPBR_Registers;
end record
with Volatile;
for GPBR_Peripheral use record
GPBR at 0 range 0 .. 255;
end record;
-- General Purpose Backup Register
GPBR_Periph : aliased GPBR_Peripheral
with Import, Address => System'To_Address (16#400E1490#);
-- Reset Controller
type RSTC_Peripheral is record
-- Control Register
CR : aliased RSTC_CR_Register;
-- Status Register
SR : aliased RSTC_SR_Register;
-- Mode Register
MR : aliased RSTC_MR_Register;
end record
with Volatile;
for RSTC_Peripheral use record
CR at 16#0# range 0 .. 31;
SR at 16#4# range 0 .. 31;
MR at 16#8# range 0 .. 31;
end record;
-- Reset Controller
RSTC_Periph : aliased RSTC_Peripheral
with Import, Address => System'To_Address (16#400E1400#);
-- Real-time Clock
type RTC_Peripheral is record
-- Control Register
CR : aliased RTC_CR_Register;
-- Mode Register
MR : aliased RTC_MR_Register;
-- Time Register
TIMR : aliased RTC_TIMR_Register;
-- Calendar Register
CALR : aliased RTC_CALR_Register;
-- Time Alarm Register
TIMALR : aliased RTC_TIMALR_Register;
-- Calendar Alarm Register
CALALR : aliased RTC_CALALR_Register;
-- Status Register
SR : aliased RTC_SR_Register;
-- Status Clear Command Register
SCCR : aliased RTC_SCCR_Register;
-- Interrupt Enable Register
IER : aliased RTC_IER_Register;
-- Interrupt Disable Register
IDR : aliased RTC_IDR_Register;
-- Interrupt Mask Register
IMR : aliased RTC_IMR_Register;
-- Valid Entry Register
VER : aliased RTC_VER_Register;
end record
with Volatile;
for RTC_Peripheral use record
CR at 16#0# range 0 .. 31;
MR at 16#4# range 0 .. 31;
TIMR at 16#8# range 0 .. 31;
CALR at 16#C# range 0 .. 31;
TIMALR at 16#10# range 0 .. 31;
CALALR at 16#14# range 0 .. 31;
SR at 16#18# range 0 .. 31;
SCCR at 16#1C# range 0 .. 31;
IER at 16#20# range 0 .. 31;
IDR at 16#24# range 0 .. 31;
IMR at 16#28# range 0 .. 31;
VER at 16#2C# range 0 .. 31;
end record;
-- Real-time Clock
RTC_Periph : aliased RTC_Peripheral
with Import, Address => System'To_Address (16#400E1460#);
-- Real-time Timer
type RTT_Peripheral is record
-- Mode Register
MR : aliased RTT_MR_Register;
-- Alarm Register
AR : aliased Interfaces.SAM.UInt32;
-- Value Register
VR : aliased Interfaces.SAM.UInt32;
-- Status Register
SR : aliased RTT_SR_Register;
end record
with Volatile;
for RTT_Peripheral use record
MR at 16#0# range 0 .. 31;
AR at 16#4# range 0 .. 31;
VR at 16#8# range 0 .. 31;
SR at 16#C# range 0 .. 31;
end record;
-- Real-time Timer
RTT_Periph : aliased RTT_Peripheral
with Import, Address => System'To_Address (16#400E1430#);
-- Supply Controller
type SUPC_Peripheral is record
-- Supply Controller Control Register
CR : aliased SUPC_CR_Register;
-- Supply Controller Supply Monitor Mode Register
SMMR : aliased SUPC_SMMR_Register;
-- Supply Controller Mode Register
MR : aliased SUPC_MR_Register;
-- Supply Controller Wake Up Mode Register
WUMR : aliased SUPC_WUMR_Register;
-- Supply Controller Wake Up Inputs Register
WUIR : aliased SUPC_WUIR_Register;
-- Supply Controller Status Register
SR : aliased SUPC_SR_Register;
end record
with Volatile;
for SUPC_Peripheral use record
CR at 16#0# range 0 .. 31;
SMMR at 16#4# range 0 .. 31;
MR at 16#8# range 0 .. 31;
WUMR at 16#C# range 0 .. 31;
WUIR at 16#10# range 0 .. 31;
SR at 16#14# range 0 .. 31;
end record;
-- Supply Controller
SUPC_Periph : aliased SUPC_Peripheral
with Import, Address => System'To_Address (16#400E1410#);
-- Watchdog Timer
type WDT_Peripheral is record
-- Control Register
CR : aliased WDT_CR_Register;
-- Mode Register
MR : aliased WDT_MR_Register;
-- Status Register
SR : aliased WDT_SR_Register;
end record
with Volatile;
for WDT_Peripheral use record
CR at 16#0# range 0 .. 31;
MR at 16#4# range 0 .. 31;
SR at 16#8# range 0 .. 31;
end record;
-- Watchdog Timer
WDT_Periph : aliased WDT_Peripheral
with Import, Address => System'To_Address (16#400E1450#);
end Interfaces.SAM.SYSC;
| 31.928241 | 79 | 0.592058 |
5e36b84e660b5c0605e153caa53de3ad217cfad9 | 16,082 | ads | Ada | source/amf/utp/amf-internals-tables-utp_attributes.ads | svn2github/matreshka | 9d222b3ad9da508855fb1f5adbe5e8a4fad4c530 | [
"BSD-3-Clause"
] | 24 | 2016-11-29T06:59:41.000Z | 2021-08-30T11:55:16.000Z | source/amf/utp/amf-internals-tables-utp_attributes.ads | svn2github/matreshka | 9d222b3ad9da508855fb1f5adbe5e8a4fad4c530 | [
"BSD-3-Clause"
] | 2 | 2019-01-16T05:15:20.000Z | 2019-02-03T10:03:32.000Z | source/amf/utp/amf-internals-tables-utp_attributes.ads | svn2github/matreshka | 9d222b3ad9da508855fb1f5adbe5e8a4fad4c530 | [
"BSD-3-Clause"
] | 4 | 2017-07-18T07:11:05.000Z | 2020-06-21T03:02:25.000Z | ------------------------------------------------------------------------------
-- --
-- Matreshka Project --
-- --
-- Ada Modeling Framework --
-- --
-- Runtime Library Component --
-- --
------------------------------------------------------------------------------
-- --
-- Copyright © 2012, Vadim Godunko <[email protected]> --
-- All rights reserved. --
-- --
-- Redistribution and use in source and binary forms, with or without --
-- modification, are permitted provided that the following conditions --
-- are met: --
-- --
-- * Redistributions of source code must retain the above copyright --
-- notice, this list of conditions and the following disclaimer. --
-- --
-- * Redistributions in binary form must reproduce the above copyright --
-- notice, this list of conditions and the following disclaimer in the --
-- documentation and/or other materials provided with the distribution. --
-- --
-- * Neither the name of the Vadim Godunko, IE nor the names of its --
-- contributors may be used to endorse or promote products derived from --
-- this software without specific prior written permission. --
-- --
-- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS --
-- "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT --
-- LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR --
-- A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT --
-- HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, --
-- SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED --
-- TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR --
-- PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF --
-- LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING --
-- NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS --
-- SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. --
-- --
------------------------------------------------------------------------------
-- $Revision$ $Date$
------------------------------------------------------------------------------
-- This file is generated, don't edit it.
------------------------------------------------------------------------------
with AMF.Utp;
with Matreshka.Internals.Strings;
package AMF.Internals.Tables.UTP_Attributes is
function Internal_Get_Base_Accept_Event_Action
(Self : AMF.Internals.AMF_Element)
return AMF.Internals.AMF_Element;
procedure Internal_Set_Base_Accept_Event_Action
(Self : AMF.Internals.AMF_Element;
To : AMF.Internals.AMF_Element);
-- TimeOutAction => TimeOutAction::base_AcceptEventAction
function Internal_Get_Base_Behavior
(Self : AMF.Internals.AMF_Element)
return AMF.Internals.AMF_Element;
procedure Internal_Set_Base_Behavior
(Self : AMF.Internals.AMF_Element;
To : AMF.Internals.AMF_Element);
-- Default => Default::base_Behavior
-- TestCase => TestCase::base_Behavior
-- TestLog => TestLog::base_Behavior
-- TestSuite => TestSuite::base_Behavior
function Internal_Get_Base_Behaviored_Classifier
(Self : AMF.Internals.AMF_Element)
return AMF.Internals.AMF_Element;
procedure Internal_Set_Base_Behaviored_Classifier
(Self : AMF.Internals.AMF_Element;
To : AMF.Internals.AMF_Element);
-- TestContext => TestContext::base_BehavioredClassifier
function Internal_Get_Base_Call_Operation_Action
(Self : AMF.Internals.AMF_Element)
return AMF.Internals.AMF_Element;
procedure Internal_Set_Base_Call_Operation_Action
(Self : AMF.Internals.AMF_Element;
To : AMF.Internals.AMF_Element);
-- ReadTimerAction => ReadTimerAction::base_CallOperationAction
-- StartTimerAction => StartTimerAction::base_CallOperationAction
-- StopTimerAction => StopTimerAction::base_CallOperationAction
-- ValidationAction => ValidationAction::base_CallOperationAction
function Internal_Get_Base_Classifier
(Self : AMF.Internals.AMF_Element)
return AMF.Internals.AMF_Element;
procedure Internal_Set_Base_Classifier
(Self : AMF.Internals.AMF_Element;
To : AMF.Internals.AMF_Element);
-- DataPartition => DataPartition::base_Classifier
-- DataPool => DataPool::base_Classifier
function Internal_Get_Base_Combined_Fragment
(Self : AMF.Internals.AMF_Element)
return AMF.Internals.AMF_Element;
procedure Internal_Set_Base_Combined_Fragment
(Self : AMF.Internals.AMF_Element;
To : AMF.Internals.AMF_Element);
-- DetermAlt => DetermAlt::base_CombinedFragment
function Internal_Get_Base_Dependency
(Self : AMF.Internals.AMF_Element)
return AMF.Internals.AMF_Element;
procedure Internal_Set_Base_Dependency
(Self : AMF.Internals.AMF_Element;
To : AMF.Internals.AMF_Element);
-- DefaultApplication => DefaultApplication::base_Dependency
-- TestLogApplication => TestLogApplication::base_Dependency
-- TestObjective => TestObjective::base_Dependency
function Internal_Get_Base_Element
(Self : AMF.Internals.AMF_Element)
return AMF.Internals.AMF_Element;
procedure Internal_Set_Base_Element
(Self : AMF.Internals.AMF_Element;
To : AMF.Internals.AMF_Element);
-- ManagedElement => ManagedElement::base_Element
function Internal_Get_Base_Invocation_Action
(Self : AMF.Internals.AMF_Element)
return AMF.Internals.AMF_Element;
procedure Internal_Set_Base_Invocation_Action
(Self : AMF.Internals.AMF_Element;
To : AMF.Internals.AMF_Element);
-- FinishAction => FinishAction::base_InvocationAction
function Internal_Get_Base_Literal_Specification
(Self : AMF.Internals.AMF_Element)
return AMF.Internals.AMF_Element;
procedure Internal_Set_Base_Literal_Specification
(Self : AMF.Internals.AMF_Element;
To : AMF.Internals.AMF_Element);
-- LiteralAny => LiteralAny::base_LiteralSpecification
-- LiteralAnyOrNull => LiteralAnyOrNull::base_LiteralSpecification
function Internal_Get_Base_Message
(Self : AMF.Internals.AMF_Element)
return AMF.Internals.AMF_Element;
procedure Internal_Set_Base_Message
(Self : AMF.Internals.AMF_Element;
To : AMF.Internals.AMF_Element);
-- TimeOutMessage => TimeOutMessage::base_Message
function Internal_Get_Base_Namespace
(Self : AMF.Internals.AMF_Element)
return AMF.Internals.AMF_Element;
procedure Internal_Set_Base_Namespace
(Self : AMF.Internals.AMF_Element;
To : AMF.Internals.AMF_Element);
-- CodingRule => CodingRule::base_Namespace
function Internal_Get_Base_Opaque_Action
(Self : AMF.Internals.AMF_Element)
return AMF.Internals.AMF_Element;
procedure Internal_Set_Base_Opaque_Action
(Self : AMF.Internals.AMF_Element;
To : AMF.Internals.AMF_Element);
-- FinishAction => FinishAction::base_OpaqueAction
function Internal_Get_Base_Operation
(Self : AMF.Internals.AMF_Element)
return AMF.Internals.AMF_Element;
procedure Internal_Set_Base_Operation
(Self : AMF.Internals.AMF_Element;
To : AMF.Internals.AMF_Element);
-- DataSelector => DataSelector::base_Operation
-- TestCase => TestCase::base_Operation
function Internal_Get_Base_Property
(Self : AMF.Internals.AMF_Element)
return AMF.Internals.AMF_Element;
procedure Internal_Set_Base_Property
(Self : AMF.Internals.AMF_Element;
To : AMF.Internals.AMF_Element);
-- CodingRule => CodingRule::base_Property
-- DataPool => DataPool::base_Property
-- SUT => SUT::base_Property
function Internal_Get_Base_Read_Structural_Feature_Action
(Self : AMF.Internals.AMF_Element)
return AMF.Internals.AMF_Element;
procedure Internal_Set_Base_Read_Structural_Feature_Action
(Self : AMF.Internals.AMF_Element;
To : AMF.Internals.AMF_Element);
-- GetTimezoneAction => GetTimezoneAction::base_ReadStructuralFeatureAction
-- TimerRunningAction => TimerRunningAction::base_ReadStructuralFeatureAction
function Internal_Get_Base_Send_Object_Action
(Self : AMF.Internals.AMF_Element)
return AMF.Internals.AMF_Element;
procedure Internal_Set_Base_Send_Object_Action
(Self : AMF.Internals.AMF_Element;
To : AMF.Internals.AMF_Element);
-- LogAction => LogAction::base_SendObjectAction
function Internal_Get_Base_Structured_Classifier
(Self : AMF.Internals.AMF_Element)
return AMF.Internals.AMF_Element;
procedure Internal_Set_Base_Structured_Classifier
(Self : AMF.Internals.AMF_Element;
To : AMF.Internals.AMF_Element);
-- TestComponent => TestComponent::base_StructuredClassifier
-- TestContext => TestContext::base_StructuredClassifier
function Internal_Get_Base_Time_Event
(Self : AMF.Internals.AMF_Element)
return AMF.Internals.AMF_Element;
procedure Internal_Set_Base_Time_Event
(Self : AMF.Internals.AMF_Element;
To : AMF.Internals.AMF_Element);
-- TimeOut => TimeOut::base_TimeEvent
function Internal_Get_Base_Value_Specification
(Self : AMF.Internals.AMF_Element)
return AMF.Internals.AMF_Element;
procedure Internal_Set_Base_Value_Specification
(Self : AMF.Internals.AMF_Element;
To : AMF.Internals.AMF_Element);
-- CodingRule => CodingRule::base_ValueSpecification
function Internal_Get_Base_Write_Structural_Feature_Action
(Self : AMF.Internals.AMF_Element)
return AMF.Internals.AMF_Element;
procedure Internal_Set_Base_Write_Structural_Feature_Action
(Self : AMF.Internals.AMF_Element;
To : AMF.Internals.AMF_Element);
-- SetTimezoneAction => SetTimezoneAction::base_WriteStructuralFeatureAction
function Internal_Get_Coding
(Self : AMF.Internals.AMF_Element)
return Matreshka.Internals.Strings.Shared_String_Access;
procedure Internal_Set_Coding
(Self : AMF.Internals.AMF_Element;
To : Matreshka.Internals.Strings.Shared_String_Access);
-- CodingRule => CodingRule::coding
function Internal_Get_Compatible_SUT_Variant
(Self : AMF.Internals.AMF_Element)
return AMF.Internals.AMF_Collection_Of_String;
-- TestCase => TestCase::compatibleSUTVariant
-- TestComponent => TestComponent::compatibleSUTVariant
-- TestContext => TestContext::compatibleSUTVariant
function Internal_Get_Compatible_SUT_Version
(Self : AMF.Internals.AMF_Element)
return AMF.Internals.AMF_Collection_Of_String;
-- TestCase => TestCase::compatibleSUTVersion
-- TestComponent => TestComponent::compatibleSUTVersion
-- TestContext => TestContext::compatibleSUTVersion
function Internal_Get_Criticality
(Self : AMF.Internals.AMF_Element)
return Matreshka.Internals.Strings.Shared_String_Access;
procedure Internal_Set_Criticality
(Self : AMF.Internals.AMF_Element;
To : Matreshka.Internals.Strings.Shared_String_Access);
-- ManagedElement => ManagedElement::criticality
function Internal_Get_Description
(Self : AMF.Internals.AMF_Element)
return Matreshka.Internals.Strings.Shared_String_Access;
procedure Internal_Set_Description
(Self : AMF.Internals.AMF_Element;
To : Matreshka.Internals.Strings.Shared_String_Access);
-- ManagedElement => ManagedElement::description
function Internal_Get_Duration
(Self : AMF.Internals.AMF_Element)
return Matreshka.Internals.Strings.Shared_String_Access;
procedure Internal_Set_Duration
(Self : AMF.Internals.AMF_Element;
To : Matreshka.Internals.Strings.Shared_String_Access);
-- TestLog => TestLog::duration
function Internal_Get_Executed_At
(Self : AMF.Internals.AMF_Element)
return Matreshka.Internals.Strings.Shared_String_Access;
procedure Internal_Set_Executed_At
(Self : AMF.Internals.AMF_Element;
To : Matreshka.Internals.Strings.Shared_String_Access);
-- TestLog => TestLog::executedAt
function Internal_Get_Owner
(Self : AMF.Internals.AMF_Element)
return Matreshka.Internals.Strings.Shared_String_Access;
procedure Internal_Set_Owner
(Self : AMF.Internals.AMF_Element;
To : Matreshka.Internals.Strings.Shared_String_Access);
-- ManagedElement => ManagedElement::owner
function Internal_Get_Priority
(Self : AMF.Internals.AMF_Element)
return Matreshka.Internals.Strings.Shared_String_Access;
procedure Internal_Set_Priority
(Self : AMF.Internals.AMF_Element;
To : Matreshka.Internals.Strings.Shared_String_Access);
-- TestCase => TestCase::priority
-- TestObjective => TestObjective::priority
-- TestSuite => TestSuite::priority
function Internal_Get_Repetition
(Self : AMF.Internals.AMF_Element)
return AMF.Unlimited_Natural;
procedure Internal_Set_Repetition
(Self : AMF.Internals.AMF_Element;
To : AMF.Unlimited_Natural);
-- DefaultApplication => DefaultApplication::repetition
function Internal_Get_Sut_Version
(Self : AMF.Internals.AMF_Element)
return Matreshka.Internals.Strings.Shared_String_Access;
procedure Internal_Set_Sut_Version
(Self : AMF.Internals.AMF_Element;
To : Matreshka.Internals.Strings.Shared_String_Access);
-- TestLog => TestLog::sutVersion
function Internal_Get_Test_Case
(Self : AMF.Internals.AMF_Element)
return AMF.Internals.AMF_Collection_Of_Element;
-- TestSuite => TestSuite::testCase
function Internal_Get_Test_Level
(Self : AMF.Internals.AMF_Element)
return Matreshka.Internals.Strings.Shared_String_Access;
procedure Internal_Set_Test_Level
(Self : AMF.Internals.AMF_Element;
To : Matreshka.Internals.Strings.Shared_String_Access);
-- TestContext => TestContext::testLevel
function Internal_Get_Tester
(Self : AMF.Internals.AMF_Element)
return AMF.Internals.AMF_Collection_Of_String;
-- TestLog => TestLog::tester
function Internal_Get_Verdict
(Self : AMF.Internals.AMF_Element)
return AMF.Utp.Utp_Verdict;
procedure Internal_Set_Verdict
(Self : AMF.Internals.AMF_Element;
To : AMF.Utp.Utp_Verdict);
-- TestLog => TestLog::verdict
function Internal_Get_Verdict_Reason
(Self : AMF.Internals.AMF_Element)
return Matreshka.Internals.Strings.Shared_String_Access;
procedure Internal_Set_Verdict_Reason
(Self : AMF.Internals.AMF_Element;
To : Matreshka.Internals.Strings.Shared_String_Access);
-- TestLog => TestLog::verdictReason
function Internal_Get_Version
(Self : AMF.Internals.AMF_Element)
return Matreshka.Internals.Strings.Shared_String_Access;
procedure Internal_Set_Version
(Self : AMF.Internals.AMF_Element;
To : Matreshka.Internals.Strings.Shared_String_Access);
-- ManagedElement => ManagedElement::version
end AMF.Internals.Tables.UTP_Attributes;
| 44.060274 | 81 | 0.674481 |
1e84074f7ce9bc0d13fb73f9964c382911c12a19 | 976 | adb | Ada | src/gdb/gdb-7.11/gdb/testsuite/gdb.ada/O2_float_param/caller.adb | alrooney/unum-sdk | bbccb10b0cd3500feccbbef22e27ea111c3d18eb | [
"Apache-2.0"
] | 31 | 2018-08-01T21:25:24.000Z | 2022-02-14T07:52:34.000Z | src/gdb/gdb-7.11/gdb/testsuite/gdb.ada/O2_float_param/caller.adb | alrooney/unum-sdk | bbccb10b0cd3500feccbbef22e27ea111c3d18eb | [
"Apache-2.0"
] | 40 | 2018-12-03T19:48:52.000Z | 2021-03-10T06:34:26.000Z | src/gdb/gdb-7.11/gdb/testsuite/gdb.ada/O2_float_param/caller.adb | alrooney/unum-sdk | bbccb10b0cd3500feccbbef22e27ea111c3d18eb | [
"Apache-2.0"
] | 20 | 2018-11-16T21:19:22.000Z | 2021-10-18T23:08:24.000Z | -- Copyright 2013-2016 Free Software Foundation, Inc.
--
-- This program is free software; you can redistribute it and/or modify
-- it under the terms of the GNU General Public License as published by
-- the Free Software Foundation; either version 3 of the License, or
-- (at your option) any later version.
--
-- This program is distributed in the hope that it will be useful,
-- but WITHOUT ANY WARRANTY; without even the implied warranty of
-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-- GNU General Public License for more details.
--
-- You should have received a copy of the GNU General Public License
-- along with this program. If not, see <http://www.gnu.org/licenses/>.
with IO; use IO;
with Callee; use Callee;
package body Caller is
procedure Verbose_Increment (Val : in out Float; Msg : String) is
begin
Put_Line ("DEBUG: " & Msg);
Increment (Val, "Verbose_Increment");
end Verbose_Increment;
end Caller;
| 36.148148 | 73 | 0.723361 |
5e9950e0ad8ea397913b5f119b0e1276837e86ea | 2,479 | adb | Ada | source/adam-raw_source.adb | charlie5/aIDE | fab406dbcd9b72a4cb215ffebb05166c788d6365 | [
"MIT"
] | 3 | 2017-04-29T14:25:22.000Z | 2017-09-29T10:15:28.000Z | source/adam-raw_source.adb | charlie5/aIDE | fab406dbcd9b72a4cb215ffebb05166c788d6365 | [
"MIT"
] | null | null | null | source/adam-raw_source.adb | charlie5/aIDE | fab406dbcd9b72a4cb215ffebb05166c788d6365 | [
"MIT"
] | null | null | null | with
AdaM.Factory;
package body AdaM.raw_source
is
-- Storage Pool
--
record_Version : constant := 1;
max_Sources : constant := 5_000;
package Pool is new AdaM.Factory.Pools (".adam-store",
"raw_Source",
max_Sources,
record_Version,
raw_Source.item,
raw_Source.view);
-- Forge
--
procedure define (Self : in out Item)
is
begin
null;
end define;
procedure destruct (Self : in out Item)
is
begin
null;
end destruct;
function new_Source return View
is
new_View : constant raw_Source.view := Pool.new_Item;
begin
define (raw_Source.item (new_View.all));
return new_View;
end new_Source;
procedure free (Self : in out raw_Source.view)
is
begin
destruct (raw_Source.item (Self.all));
Pool.free (Self);
end free;
-- Attributes
--
overriding
function Name (Self : in Item) return Identifier
is
pragma Unreferenced (Self);
begin
return "raw_Source";
end Name;
function Lines (Self : in Item) return text_Lines
is
begin
return Self.Lines;
end Lines;
procedure Lines_are (Self : in out Item; Now : in text_Lines)
is
begin
Self.Lines := Now;
end Lines_are;
overriding
function Id (Self : access Item) return AdaM.Id
is
begin
return Pool.to_Id (Self);
end Id;
overriding
function to_Source (Self : in Item) return text_Vectors.Vector
is
the_Source : text_Vectors.Vector;
begin
for i in 1 .. Self.Lines.Length
loop
declare
the_Line : Text renames Self.Lines.Element (Integer (i));
begin
the_Source.append (the_Line);
end;
end loop;
return the_Source;
end to_Source;
-- Streams
--
procedure View_write (Stream : not null access Ada.Streams.Root_Stream_Type'Class;
Self : in View)
renames Pool.View_write;
procedure View_read (Stream : not null access Ada.Streams.Root_Stream_Type'Class;
Self : out View)
renames Pool.View_read;
end AdaM.raw_source;
| 19.674603 | 85 | 0.536507 |
a08337a3d0b97de43f69dd9cfa854a7585872b68 | 3,525 | ads | Ada | TP1/workspace.ads | Kzel/Antenna_Design | bf4c71da79be27e16d497114855b172ccfffa621 | [
"MIT"
] | null | null | null | TP1/workspace.ads | Kzel/Antenna_Design | bf4c71da79be27e16d497114855b172ccfffa621 | [
"MIT"
] | null | null | null | TP1/workspace.ads | Kzel/Antenna_Design | bf4c71da79be27e16d497114855b172ccfffa621 | [
"MIT"
] | null | null | null | <ADSWorkspace Revision="10" Version="100">
<Workspace Name="">
<LibraryDefs Name="lib.defs" />
<Library Name="ads_standard_layers_ic" />
<Library Name="ads_schematic_layers_ic" />
<Library Name="ads_schematic_ports_ic" />
<Library Name="ads_sources" />
<Library Name="ads_tlines" />
<Library Name="ads_bondwires" />
<Library Name="ads_behavioral" />
<Library Name="ads_textfonts" />
<Library Name="ads_common_cmps" />
<Library Name="ads_designs" />
<Library Name="ads_pelib" />
<Library Name="ads_standard_layers" />
<Library Name="ads_schematic_layers" />
<Library Name="empro_standard_layers" />
<Library Name="ads_builtin" />
<Library Name="ads_rflib" />
<Library Name="ads_simulation" />
<Library Name="ads_datacmps" />
<Library Name="1xEV" />
<Library Name="3GPPFDD" />
<Library Name="3GPPFDD_10_99" />
<Library Name="Antennas_and_Propagation" />
<Library Name="CDMA" />
<Library Name="cdma2000" />
<Library Name="Circuit_Cosimulation" />
<Library Name="CMMB" />
<Library Name="Controllers" />
<Library Name="DTMB" />
<Library Name="DTV" />
<Library Name="EDGE" />
<Library Name="GSM" />
<Library Name="HDL_Blocks" />
<Library Name="HSDPA" />
<Library Name="HSUPA" />
<Library Name="Instruments" />
<Library Name="Interactive_Controls_and_Displays" />
<Library Name="LTE" />
<Library Name="Numeric" />
<Library Name="Obsolete" />
<Library Name="Signal_Converters" />
<Library Name="Simulation_Sequencing" />
<Library Name="Sinks" />
<Library Name="SystemVue_Cosimulation" />
<Library Name="TDSCDMA" />
<Library Name="Timed" />
<Library Name="UMB" />
<Library Name="UWB" />
<Library Name="WLAN" />
<Library Name="WLAN_11n" />
<Library Name="WMAN" />
<Library Name="WMAN_16e" />
<ConfigFile Name="de_sim.cfg" />
<ConfigFile Name="hpeesofsim.cfg" />
<Preferences Name="layout.prf" />
<Preferences Name="schematic.prf" />
<Library Name="MyLibrary1_lib" />
<Substrate Name="MyLibrary1_lib:tech.subst" />
<Log Name="netlist.log" />
<Dataset Name="cell_1.ds" />
<Data_Files Name="cell_1.ds" />
<Data_Files Name="cell_1_data\logFile.txt" />
<ConfigFile Name="dds.cfg" />
<Dataset Name="cell_2.ds" />
<Data_Files Name="cell_2.ds" />
<Data_Files Name="cell_2_data\logFile.txt" />
<Log Name="search_history.log" />
<Dataset Name="cell_3.ds" />
<Data_Files Name="cell_3.ds" />
<Data_Files Name="cell_3_data\logFile.txt" />
<Cell Name="MyLibrary1_lib:Total" />
<Data_Display Name="Total.dds" />
<Cell Name="MyLibrary1_lib:Entree" />
<Dataset Name="Total.ds" />
<Data_Files Name="Total.ds" />
<Data_Files Name="Total_data\logFile.txt" />
<Dataset Name="Sorite.ds" />
<Data_Files Name="Sorite.ds" />
<Data_Files Name="Sorite_data\logFile.txt" />
<Cell Name="MyLibrary1_lib:Sortie" />
<Dataset Name="Sortie.ds" />
<Data_Files Name="Sortie.ds" />
<Data_Files Name="Sortie_data\logFile.txt" />
<Data_Display Name="Sortie.dds" />
</Workspace>
</ADSWorkspace>
| 39.606742 | 60 | 0.574184 |
03c997bb224ca3a023834db844dbb168f9e7e7e3 | 36,367 | ads | Ada | arch/ARM/NXP/svd/lpc55s6x/nxp_svd-anactrl.ads | morbos/Ada_Drivers_Library | a4ab26799be60997c38735f4056160c4af597ef7 | [
"BSD-3-Clause"
] | 2 | 2018-05-16T03:56:39.000Z | 2019-07-31T13:53:56.000Z | arch/ARM/NXP/svd/lpc55s6x/nxp_svd-anactrl.ads | morbos/Ada_Drivers_Library | a4ab26799be60997c38735f4056160c4af597ef7 | [
"BSD-3-Clause"
] | null | null | null | arch/ARM/NXP/svd/lpc55s6x/nxp_svd-anactrl.ads | morbos/Ada_Drivers_Library | a4ab26799be60997c38735f4056160c4af597ef7 | [
"BSD-3-Clause"
] | null | null | null | -- 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.ANACTRL is
pragma Preelaborate;
---------------
-- Registers --
---------------
-- Flash Power Down status.
type ANALOG_CTRL_STATUS_FLASH_PWRDWN_Field is
(
-- Flash is not in power down mode.
Pwrup,
-- Flash is in power down mode.
Pwrdwn)
with Size => 1;
for ANALOG_CTRL_STATUS_FLASH_PWRDWN_Field use
(Pwrup => 0,
Pwrdwn => 1);
-- Flash initialization error status.
type ANALOG_CTRL_STATUS_FLASH_INIT_ERROR_Field is
(
-- No error.
Noerror,
-- At least one error occured during flash initialization..
Error)
with Size => 1;
for ANALOG_CTRL_STATUS_FLASH_INIT_ERROR_Field use
(Noerror => 0,
Error => 1);
-- Analog Macroblock Identity registers, Flash Status registers
type ANALOG_CTRL_STATUS_Register is record
-- unspecified
Reserved_0_11 : HAL.UInt12;
-- Read-only. Flash Power Down status.
FLASH_PWRDWN : ANALOG_CTRL_STATUS_FLASH_PWRDWN_Field;
-- Read-only. Flash initialization error status.
FLASH_INIT_ERROR : ANALOG_CTRL_STATUS_FLASH_INIT_ERROR_Field;
-- unspecified
Reserved_14_31 : HAL.UInt18;
end record
with Volatile_Full_Access, Size => 32,
Bit_Order => System.Low_Order_First;
for ANALOG_CTRL_STATUS_Register use record
Reserved_0_11 at 0 range 0 .. 11;
FLASH_PWRDWN at 0 range 12 .. 12;
FLASH_INIT_ERROR at 0 range 13 .. 13;
Reserved_14_31 at 0 range 14 .. 31;
end record;
subtype FREQ_ME_CTRL_CAPVAL_SCALE_Field is HAL.UInt31;
-- Frequency Measure function control register
type FREQ_ME_CTRL_Register is record
-- Frequency measure result /Frequency measur scale
CAPVAL_SCALE : FREQ_ME_CTRL_CAPVAL_SCALE_Field := 16#0#;
-- Set this bit to one to initiate a frequency measurement cycle.
-- Hardware clears this bit when the measurement cycle has completed and
-- there is valid capture data in the CAPVAL field (bits 30:0).
PROG : Boolean := False;
end record
with Volatile_Full_Access, Size => 32,
Bit_Order => System.Low_Order_First;
for FREQ_ME_CTRL_Register use record
CAPVAL_SCALE at 0 range 0 .. 30;
PROG at 0 range 31 .. 31;
end record;
-- 12 MHz clock control.
type FRO192M_CTRL_ENA_12MHZCLK_Field is
(
-- 12 MHz clock is disabled.
Disable,
-- 12 MHz clock is enabled.
Enable)
with Size => 1;
for FRO192M_CTRL_ENA_12MHZCLK_Field use
(Disable => 0,
Enable => 1);
-- 48 MHz clock control.
type FRO192M_CTRL_ENA_48MHZCLK_Field is
(
-- 48 MHz clock is enabled.
Enable)
with Size => 1;
for FRO192M_CTRL_ENA_48MHZCLK_Field use
(Enable => 1);
subtype FRO192M_CTRL_DAC_TRIM_Field is HAL.UInt8;
-- 96 MHz clock control.
type FRO192M_CTRL_ENA_96MHZCLK_Field is
(
-- 96 MHz clock is disabled.
Disable,
-- 96 MHz clock is enabled.
Enable)
with Size => 1;
for FRO192M_CTRL_ENA_96MHZCLK_Field use
(Disable => 0,
Enable => 1);
-- 192MHz Free Running OScillator (FRO) Control register
type FRO192M_CTRL_Register is record
-- unspecified
Reserved_0_13 : HAL.UInt14 := 16#101A#;
-- 12 MHz clock control.
ENA_12MHZCLK : FRO192M_CTRL_ENA_12MHZCLK_Field :=
NXP_SVD.ANACTRL.Enable;
-- 48 MHz clock control.
ENA_48MHZCLK : FRO192M_CTRL_ENA_48MHZCLK_Field :=
NXP_SVD.ANACTRL.Enable;
-- Frequency trim.
DAC_TRIM : FRO192M_CTRL_DAC_TRIM_Field := 16#80#;
-- If this bit is set and the USB peripheral is enabled into full speed
-- device mode, the USB block will provide FRO clock adjustments to lock
-- it to the host clock using the SOF packets.
USBCLKADJ : Boolean := False;
-- Read-only. If it reads as 1 when reading the DAC_TRIM field and
-- USBCLKADJ=1, it should be re-read until it is 0.
USBMODCHG : Boolean := False;
-- unspecified
Reserved_26_29 : HAL.UInt4 := 16#0#;
-- 96 MHz clock control.
ENA_96MHZCLK : FRO192M_CTRL_ENA_96MHZCLK_Field :=
NXP_SVD.ANACTRL.Disable;
-- unspecified
Reserved_31_31 : HAL.Bit := 16#0#;
end record
with Volatile_Full_Access, Size => 32,
Bit_Order => System.Low_Order_First;
for FRO192M_CTRL_Register use record
Reserved_0_13 at 0 range 0 .. 13;
ENA_12MHZCLK at 0 range 14 .. 14;
ENA_48MHZCLK at 0 range 15 .. 15;
DAC_TRIM at 0 range 16 .. 23;
USBCLKADJ at 0 range 24 .. 24;
USBMODCHG at 0 range 25 .. 25;
Reserved_26_29 at 0 range 26 .. 29;
ENA_96MHZCLK at 0 range 30 .. 30;
Reserved_31_31 at 0 range 31 .. 31;
end record;
-- Output clock valid signal. Indicates that CCO clock has settled.
type FRO192M_STATUS_CLK_VALID_Field is
(
-- No output clock present (None of 12 MHz, 48 MHz or 96 MHz clock is
-- available).
Noclkout,
-- Clock is present (12 MHz, 48 MHz or 96 MHz can be output if they are
-- enable respectively by
-- FRO192M_CTRL.ENA_12MHZCLK/ENA_48MHZCLK/ENA_96MHZCLK).
Clkout)
with Size => 1;
for FRO192M_STATUS_CLK_VALID_Field use
(Noclkout => 0,
Clkout => 1);
-- 192MHz Free Running OScillator (FRO) Status register
type FRO192M_STATUS_Register is record
-- Read-only. Output clock valid signal. Indicates that CCO clock has
-- settled.
CLK_VALID : FRO192M_STATUS_CLK_VALID_Field;
-- Read-only. CCO threshold voltage detector output (signal vcco_ok).
-- Once the CCO voltage crosses the threshold voltage of a SLVT
-- transistor, this output signal will go high. It is also possible to
-- observe the clk_valid signal.
ATB_VCTRL : Boolean;
-- unspecified
Reserved_2_31 : HAL.UInt30;
end record
with Volatile_Full_Access, Size => 32,
Bit_Order => System.Low_Order_First;
for FRO192M_STATUS_Register use record
CLK_VALID at 0 range 0 .. 0;
ATB_VCTRL at 0 range 1 .. 1;
Reserved_2_31 at 0 range 2 .. 31;
end record;
-- Bypass enable of XO AC buffer enable in pll and top level.
type XO32M_CTRL_ACBUF_PASS_ENABLE_Field is
(
-- XO AC buffer bypass is disabled.
Disable,
-- XO AC buffer bypass is enabled.
Enable)
with Size => 1;
for XO32M_CTRL_ACBUF_PASS_ENABLE_Field use
(Disable => 0,
Enable => 1);
-- Enable High speed Crystal oscillator output to USB HS PLL.
type XO32M_CTRL_ENABLE_PLL_USB_OUT_Field is
(
-- High speed Crystal oscillator output to USB HS PLL is disabled.
Disable,
-- High speed Crystal oscillator output to USB HS PLL is enabled.
Enable)
with Size => 1;
for XO32M_CTRL_ENABLE_PLL_USB_OUT_Field use
(Disable => 0,
Enable => 1);
-- Enable XO 32 MHz output to CPU system.
type XO32M_CTRL_ENABLE_SYSTEM_CLK_OUT_Field is
(
-- High speed Crystal oscillator output to CPU system is disabled.
Disable,
-- High speed Crystal oscillator output to CPU system is enabled.
Enable)
with Size => 1;
for XO32M_CTRL_ENABLE_SYSTEM_CLK_OUT_Field use
(Disable => 0,
Enable => 1);
-- High speed Crystal Oscillator Control register
type XO32M_CTRL_Register is record
-- unspecified
Reserved_0_21 : HAL.UInt22 := 16#21428A#;
-- Bypass enable of XO AC buffer enable in pll and top level.
ACBUF_PASS_ENABLE : XO32M_CTRL_ACBUF_PASS_ENABLE_Field :=
NXP_SVD.ANACTRL.Disable;
-- Enable High speed Crystal oscillator output to USB HS PLL.
ENABLE_PLL_USB_OUT : XO32M_CTRL_ENABLE_PLL_USB_OUT_Field :=
NXP_SVD.ANACTRL.Disable;
-- Enable XO 32 MHz output to CPU system.
ENABLE_SYSTEM_CLK_OUT : XO32M_CTRL_ENABLE_SYSTEM_CLK_OUT_Field :=
NXP_SVD.ANACTRL.Disable;
-- unspecified
Reserved_25_31 : HAL.UInt7 := 16#0#;
end record
with Volatile_Full_Access, Size => 32,
Bit_Order => System.Low_Order_First;
for XO32M_CTRL_Register use record
Reserved_0_21 at 0 range 0 .. 21;
ACBUF_PASS_ENABLE at 0 range 22 .. 22;
ENABLE_PLL_USB_OUT at 0 range 23 .. 23;
ENABLE_SYSTEM_CLK_OUT at 0 range 24 .. 24;
Reserved_25_31 at 0 range 25 .. 31;
end record;
-- Indicates XO out frequency statibilty.
type XO32M_STATUS_XO_READY_Field is
(
-- XO output frequency is not yet stable.
Not_Stable,
-- XO output frequency is stable.
Stable)
with Size => 1;
for XO32M_STATUS_XO_READY_Field use
(Not_Stable => 0,
Stable => 1);
-- High speed Crystal Oscillator Status register
type XO32M_STATUS_Register is record
-- Read-only. Indicates XO out frequency statibilty.
XO_READY : XO32M_STATUS_XO_READY_Field;
-- unspecified
Reserved_1_31 : HAL.UInt31;
end record
with Volatile_Full_Access, Size => 32,
Bit_Order => System.Low_Order_First;
for XO32M_STATUS_Register use record
XO_READY at 0 range 0 .. 0;
Reserved_1_31 at 0 range 1 .. 31;
end record;
-- BOD VBAT interrupt control.
type BOD_DCDC_INT_CTRL_BODVBAT_INT_ENABLE_Field is
(
-- BOD VBAT interrupt is disabled.
Disable,
-- BOD VBAT interrupt is enabled.
Enable)
with Size => 1;
for BOD_DCDC_INT_CTRL_BODVBAT_INT_ENABLE_Field use
(Disable => 0,
Enable => 1);
-- BOD CORE interrupt control.
type BOD_DCDC_INT_CTRL_BODCORE_INT_ENABLE_Field is
(
-- BOD CORE interrupt is disabled.
Disable,
-- BOD CORE interrupt is enabled.
Enable)
with Size => 1;
for BOD_DCDC_INT_CTRL_BODCORE_INT_ENABLE_Field use
(Disable => 0,
Enable => 1);
-- DCDC interrupt control.
type BOD_DCDC_INT_CTRL_DCDC_INT_ENABLE_Field is
(
-- DCDC interrupt is disabled.
Disable,
-- DCDC interrupt is enabled.
Enable)
with Size => 1;
for BOD_DCDC_INT_CTRL_DCDC_INT_ENABLE_Field use
(Disable => 0,
Enable => 1);
-- Brown Out Detectors (BoDs) & DCDC interrupts generation control register
type BOD_DCDC_INT_CTRL_Register is record
-- BOD VBAT interrupt control.
BODVBAT_INT_ENABLE : BOD_DCDC_INT_CTRL_BODVBAT_INT_ENABLE_Field :=
NXP_SVD.ANACTRL.Disable;
-- BOD VBAT interrupt clear.1: Clear the interrupt. Self-cleared bit.
BODVBAT_INT_CLEAR : Boolean := False;
-- BOD CORE interrupt control.
BODCORE_INT_ENABLE : BOD_DCDC_INT_CTRL_BODCORE_INT_ENABLE_Field :=
NXP_SVD.ANACTRL.Disable;
-- BOD CORE interrupt clear.1: Clear the interrupt. Self-cleared bit.
BODCORE_INT_CLEAR : Boolean := False;
-- DCDC interrupt control.
DCDC_INT_ENABLE : BOD_DCDC_INT_CTRL_DCDC_INT_ENABLE_Field :=
NXP_SVD.ANACTRL.Disable;
-- DCDC interrupt clear.1: Clear the interrupt. Self-cleared bit.
DCDC_INT_CLEAR : Boolean := False;
-- unspecified
Reserved_6_31 : HAL.UInt26 := 16#0#;
end record
with Volatile_Full_Access, Size => 32,
Bit_Order => System.Low_Order_First;
for BOD_DCDC_INT_CTRL_Register use record
BODVBAT_INT_ENABLE at 0 range 0 .. 0;
BODVBAT_INT_CLEAR at 0 range 1 .. 1;
BODCORE_INT_ENABLE at 0 range 2 .. 2;
BODCORE_INT_CLEAR at 0 range 3 .. 3;
DCDC_INT_ENABLE at 0 range 4 .. 4;
DCDC_INT_CLEAR at 0 range 5 .. 5;
Reserved_6_31 at 0 range 6 .. 31;
end record;
-- BOD VBAT Interrupt status before Interrupt Enable.
type BOD_DCDC_INT_STATUS_BODVBAT_STATUS_Field is
(
-- No interrupt pending..
Not_Pending,
-- Interrupt pending..
Pending)
with Size => 1;
for BOD_DCDC_INT_STATUS_BODVBAT_STATUS_Field use
(Not_Pending => 0,
Pending => 1);
-- BOD VBAT Interrupt status after Interrupt Enable.
type BOD_DCDC_INT_STATUS_BODVBAT_INT_STATUS_Field is
(
-- No interrupt pending..
Not_Pending,
-- Interrupt pending..
Pending)
with Size => 1;
for BOD_DCDC_INT_STATUS_BODVBAT_INT_STATUS_Field use
(Not_Pending => 0,
Pending => 1);
-- Current value of BOD VBAT power status output.
type BOD_DCDC_INT_STATUS_BODVBAT_VAL_Field is
(
-- VBAT voltage level is below the threshold.
Not_Ok,
-- VBAT voltage level is above the threshold.
Ok)
with Size => 1;
for BOD_DCDC_INT_STATUS_BODVBAT_VAL_Field use
(Not_Ok => 0,
Ok => 1);
-- BOD CORE Interrupt status before Interrupt Enable.
type BOD_DCDC_INT_STATUS_BODCORE_STATUS_Field is
(
-- No interrupt pending..
Not_Pending,
-- Interrupt pending..
Pending)
with Size => 1;
for BOD_DCDC_INT_STATUS_BODCORE_STATUS_Field use
(Not_Pending => 0,
Pending => 1);
-- BOD CORE Interrupt status after Interrupt Enable.
type BOD_DCDC_INT_STATUS_BODCORE_INT_STATUS_Field is
(
-- No interrupt pending..
Not_Pending,
-- Interrupt pending..
Pending)
with Size => 1;
for BOD_DCDC_INT_STATUS_BODCORE_INT_STATUS_Field use
(Not_Pending => 0,
Pending => 1);
-- Current value of BOD CORE power status output.
type BOD_DCDC_INT_STATUS_BODCORE_VAL_Field is
(
-- CORE voltage level is below the threshold.
Not_Ok,
-- CORE voltage level is above the threshold.
Ok)
with Size => 1;
for BOD_DCDC_INT_STATUS_BODCORE_VAL_Field use
(Not_Ok => 0,
Ok => 1);
-- DCDC Interrupt status before Interrupt Enable.
type BOD_DCDC_INT_STATUS_DCDC_STATUS_Field is
(
-- No interrupt pending..
Not_Pending,
-- Interrupt pending..
Pending)
with Size => 1;
for BOD_DCDC_INT_STATUS_DCDC_STATUS_Field use
(Not_Pending => 0,
Pending => 1);
-- DCDC Interrupt status after Interrupt Enable.
type BOD_DCDC_INT_STATUS_DCDC_INT_STATUS_Field is
(
-- No interrupt pending..
Not_Pending,
-- Interrupt pending..
Pending)
with Size => 1;
for BOD_DCDC_INT_STATUS_DCDC_INT_STATUS_Field use
(Not_Pending => 0,
Pending => 1);
-- Current value of DCDC power status output.
type BOD_DCDC_INT_STATUS_DCDC_VAL_Field is
(
-- DCDC output Voltage is below the targeted regulation level.
Not_Ok,
-- DCDC output Voltage is above the targeted regulation level.
Ok)
with Size => 1;
for BOD_DCDC_INT_STATUS_DCDC_VAL_Field use
(Not_Ok => 0,
Ok => 1);
-- BoDs & DCDC interrupts status register
type BOD_DCDC_INT_STATUS_Register is record
-- Read-only. BOD VBAT Interrupt status before Interrupt Enable.
BODVBAT_STATUS : BOD_DCDC_INT_STATUS_BODVBAT_STATUS_Field;
-- Read-only. BOD VBAT Interrupt status after Interrupt Enable.
BODVBAT_INT_STATUS : BOD_DCDC_INT_STATUS_BODVBAT_INT_STATUS_Field;
-- Read-only. Current value of BOD VBAT power status output.
BODVBAT_VAL : BOD_DCDC_INT_STATUS_BODVBAT_VAL_Field;
-- Read-only. BOD CORE Interrupt status before Interrupt Enable.
BODCORE_STATUS : BOD_DCDC_INT_STATUS_BODCORE_STATUS_Field;
-- Read-only. BOD CORE Interrupt status after Interrupt Enable.
BODCORE_INT_STATUS : BOD_DCDC_INT_STATUS_BODCORE_INT_STATUS_Field;
-- Read-only. Current value of BOD CORE power status output.
BODCORE_VAL : BOD_DCDC_INT_STATUS_BODCORE_VAL_Field;
-- Read-only. DCDC Interrupt status before Interrupt Enable.
DCDC_STATUS : BOD_DCDC_INT_STATUS_DCDC_STATUS_Field;
-- Read-only. DCDC Interrupt status after Interrupt Enable.
DCDC_INT_STATUS : BOD_DCDC_INT_STATUS_DCDC_INT_STATUS_Field;
-- Read-only. Current value of DCDC power status output.
DCDC_VAL : BOD_DCDC_INT_STATUS_DCDC_VAL_Field;
-- unspecified
Reserved_9_31 : HAL.UInt23;
end record
with Volatile_Full_Access, Size => 32,
Bit_Order => System.Low_Order_First;
for BOD_DCDC_INT_STATUS_Register use record
BODVBAT_STATUS at 0 range 0 .. 0;
BODVBAT_INT_STATUS at 0 range 1 .. 1;
BODVBAT_VAL at 0 range 2 .. 2;
BODCORE_STATUS at 0 range 3 .. 3;
BODCORE_INT_STATUS at 0 range 4 .. 4;
BODCORE_VAL at 0 range 5 .. 5;
DCDC_STATUS at 0 range 6 .. 6;
DCDC_INT_STATUS at 0 range 7 .. 7;
DCDC_VAL at 0 range 8 .. 8;
Reserved_9_31 at 0 range 9 .. 31;
end record;
-- Select short or long ringo (for all ringos types).
type RINGO0_CTRL_SL_Field is
(
-- Select short ringo (few elements).
Short,
-- Select long ringo (many elements).
Long)
with Size => 1;
for RINGO0_CTRL_SL_Field use
(Short => 0,
Long => 1);
-- Ringo frequency output divider.
type RINGO0_CTRL_FS_Field is
(
-- High frequency output (frequency lower than 100 MHz).
Fast,
-- Low frequency output (frequency lower than 10 MHz).
Slow)
with Size => 1;
for RINGO0_CTRL_FS_Field use
(Fast => 0,
Slow => 1);
-- PN-Ringos (P-Transistor and N-Transistor processing) control.
type RINGO0_CTRL_SWN_SWP_Field is
(
-- Normal mode.
Normal,
-- P-Monitor mode. Measure with weak P transistor.
P_Monitor,
-- P-Monitor mode. Measure with weak N transistor.
N_Monitor,
-- Don't use.
Forbidden)
with Size => 2;
for RINGO0_CTRL_SWN_SWP_Field use
(Normal => 0,
P_Monitor => 1,
N_Monitor => 2,
Forbidden => 3);
-- Ringo module Power control.
type RINGO0_CTRL_PD_Field is
(
-- The Ringo module is enabled.
Powered_On,
-- The Ringo module is disabled.
Powered_Down)
with Size => 1;
for RINGO0_CTRL_PD_Field use
(Powered_On => 0,
Powered_Down => 1);
-- First NAND2-based ringo control.
type RINGO0_CTRL_E_ND0_Field is
(
-- First NAND2-based ringo is disabled.
Disable,
-- First NAND2-based ringo is enabled.
Enable)
with Size => 1;
for RINGO0_CTRL_E_ND0_Field use
(Disable => 0,
Enable => 1);
-- Second NAND2-based ringo control.
type RINGO0_CTRL_E_ND1_Field is
(
-- Second NAND2-based ringo is disabled.
Disable,
-- Second NAND2-based ringo is enabled.
Enable)
with Size => 1;
for RINGO0_CTRL_E_ND1_Field use
(Disable => 0,
Enable => 1);
-- First NOR2-based ringo control.
type RINGO0_CTRL_E_NR0_Field is
(
-- First NOR2-based ringo is disabled.
Disable,
-- First NOR2-based ringo is enabled.
Enable)
with Size => 1;
for RINGO0_CTRL_E_NR0_Field use
(Disable => 0,
Enable => 1);
-- Second NOR2-based ringo control.
type RINGO0_CTRL_E_NR1_Field is
(
-- Second NORD2-based ringo is disabled.
Disable,
-- Second NORD2-based ringo is enabled.
Enable)
with Size => 1;
for RINGO0_CTRL_E_NR1_Field use
(Disable => 0,
Enable => 1);
-- First Inverter-based ringo control.
type RINGO0_CTRL_E_IV0_Field is
(
-- First INV-based ringo is disabled.
Disable,
-- First INV-based ringo is enabled.
Enable)
with Size => 1;
for RINGO0_CTRL_E_IV0_Field use
(Disable => 0,
Enable => 1);
-- Second Inverter-based ringo control.
type RINGO0_CTRL_E_IV1_Field is
(
-- Second INV-based ringo is disabled.
Disable,
-- Second INV-based ringo is enabled.
Enable)
with Size => 1;
for RINGO0_CTRL_E_IV1_Field use
(Disable => 0,
Enable => 1);
-- First PN (P-Transistor and N-Transistor processing) monitor control.
type RINGO0_CTRL_E_PN0_Field is
(
-- First PN-based ringo is disabled.
Disable,
-- First PN-based ringo is enabled.
Enable)
with Size => 1;
for RINGO0_CTRL_E_PN0_Field use
(Disable => 0,
Enable => 1);
-- Second PN (P-Transistor and N-Transistor processing) monitor control.
type RINGO0_CTRL_E_PN1_Field is
(
-- Second PN-based ringo is disabled.
Disable,
-- Second PN-based ringo is enabled.
Enable)
with Size => 1;
for RINGO0_CTRL_E_PN1_Field use
(Disable => 0,
Enable => 1);
subtype RINGO0_CTRL_DIVISOR_Field is HAL.UInt4;
-- First Ring Oscillator module control register.
type RINGO0_CTRL_Register is record
-- Select short or long ringo (for all ringos types).
SL : RINGO0_CTRL_SL_Field := NXP_SVD.ANACTRL.Short;
-- Ringo frequency output divider.
FS : RINGO0_CTRL_FS_Field := NXP_SVD.ANACTRL.Fast;
-- PN-Ringos (P-Transistor and N-Transistor processing) control.
SWN_SWP : RINGO0_CTRL_SWN_SWP_Field := NXP_SVD.ANACTRL.Normal;
-- Ringo module Power control.
PD : RINGO0_CTRL_PD_Field := NXP_SVD.ANACTRL.Powered_On;
-- First NAND2-based ringo control.
E_ND0 : RINGO0_CTRL_E_ND0_Field := NXP_SVD.ANACTRL.Disable;
-- Second NAND2-based ringo control.
E_ND1 : RINGO0_CTRL_E_ND1_Field := NXP_SVD.ANACTRL.Enable;
-- First NOR2-based ringo control.
E_NR0 : RINGO0_CTRL_E_NR0_Field := NXP_SVD.ANACTRL.Disable;
-- Second NOR2-based ringo control.
E_NR1 : RINGO0_CTRL_E_NR1_Field := NXP_SVD.ANACTRL.Disable;
-- First Inverter-based ringo control.
E_IV0 : RINGO0_CTRL_E_IV0_Field := NXP_SVD.ANACTRL.Disable;
-- Second Inverter-based ringo control.
E_IV1 : RINGO0_CTRL_E_IV1_Field := NXP_SVD.ANACTRL.Disable;
-- First PN (P-Transistor and N-Transistor processing) monitor control.
E_PN0 : RINGO0_CTRL_E_PN0_Field := NXP_SVD.ANACTRL.Disable;
-- Second PN (P-Transistor and N-Transistor processing) monitor control.
E_PN1 : RINGO0_CTRL_E_PN1_Field := NXP_SVD.ANACTRL.Disable;
-- unspecified
Reserved_13_15 : HAL.UInt3 := 16#0#;
-- Ringo out Clock divider value. Frequency Output = Frequency input /
-- (DIViSOR+1). (minimum = Frequency input / 16)
DIVISOR : RINGO0_CTRL_DIVISOR_Field := 16#0#;
-- unspecified
Reserved_20_30 : HAL.UInt11 := 16#0#;
-- Read-only. Ringo clock out Divider status flag. Set when a change is
-- made to the divider value, cleared when the change is complete.
DIV_UPDATE_REQ : Boolean := False;
end record
with Volatile_Full_Access, Size => 32,
Bit_Order => System.Low_Order_First;
for RINGO0_CTRL_Register use record
SL at 0 range 0 .. 0;
FS at 0 range 1 .. 1;
SWN_SWP at 0 range 2 .. 3;
PD at 0 range 4 .. 4;
E_ND0 at 0 range 5 .. 5;
E_ND1 at 0 range 6 .. 6;
E_NR0 at 0 range 7 .. 7;
E_NR1 at 0 range 8 .. 8;
E_IV0 at 0 range 9 .. 9;
E_IV1 at 0 range 10 .. 10;
E_PN0 at 0 range 11 .. 11;
E_PN1 at 0 range 12 .. 12;
Reserved_13_15 at 0 range 13 .. 15;
DIVISOR at 0 range 16 .. 19;
Reserved_20_30 at 0 range 20 .. 30;
DIV_UPDATE_REQ at 0 range 31 .. 31;
end record;
-- Select short or long ringo (for all ringos types).
type RINGO1_CTRL_S_Field is
(
-- Select short ringo (few elements).
Short,
-- Select long ringo (many elements).
Long)
with Size => 1;
for RINGO1_CTRL_S_Field use
(Short => 0,
Long => 1);
-- Ringo frequency output divider.
type RINGO1_CTRL_FS_Field is
(
-- High frequency output (frequency lower than 100 MHz).
Fast,
-- Low frequency output (frequency lower than 10 MHz).
Slow)
with Size => 1;
for RINGO1_CTRL_FS_Field use
(Fast => 0,
Slow => 1);
-- Ringo module Power control.
type RINGO1_CTRL_PD_Field is
(
-- The Ringo module is enabled.
Powered_On,
-- The Ringo module is disabled.
Powered_Down)
with Size => 1;
for RINGO1_CTRL_PD_Field use
(Powered_On => 0,
Powered_Down => 1);
-- .
type RINGO1_CTRL_E_R24_Field is
(
-- Ringo is disabled.
Disable,
-- Ringo is enabled.
Enable)
with Size => 1;
for RINGO1_CTRL_E_R24_Field use
(Disable => 0,
Enable => 1);
-- RINGO1_CTRL_E_R array
type RINGO1_CTRL_E_R_Field_Array is array (24 .. 25)
of RINGO1_CTRL_E_R24_Field
with Component_Size => 1, Size => 2;
-- Type definition for RINGO1_CTRL_E_R
type RINGO1_CTRL_E_R_Field
(As_Array : Boolean := False)
is record
case As_Array is
when False =>
-- E_R as a value
Val : HAL.UInt2;
when True =>
-- E_R as an array
Arr : RINGO1_CTRL_E_R_Field_Array;
end case;
end record
with Unchecked_Union, Size => 2;
for RINGO1_CTRL_E_R_Field use record
Val at 0 range 0 .. 1;
Arr at 0 range 0 .. 1;
end record;
-- Metal 2 (M2) monitor control.
type RINGO1_CTRL_E_M2_Field is
(
-- Ringo is disabled.
Disable,
-- Ringo is enabled.
Enable)
with Size => 1;
for RINGO1_CTRL_E_M2_Field use
(Disable => 0,
Enable => 1);
-- RINGO1_CTRL_E_M array
type RINGO1_CTRL_E_M_Field_Array is array (2 .. 5)
of RINGO1_CTRL_E_M2_Field
with Component_Size => 1, Size => 4;
-- Type definition for RINGO1_CTRL_E_M
type RINGO1_CTRL_E_M_Field
(As_Array : Boolean := False)
is record
case As_Array is
when False =>
-- E_M as a value
Val : HAL.UInt4;
when True =>
-- E_M as an array
Arr : RINGO1_CTRL_E_M_Field_Array;
end case;
end record
with Unchecked_Union, Size => 4;
for RINGO1_CTRL_E_M_Field use record
Val at 0 range 0 .. 3;
Arr at 0 range 0 .. 3;
end record;
subtype RINGO1_CTRL_DIVISOR_Field is HAL.UInt4;
-- Second Ring Oscillator module control register.
type RINGO1_CTRL_Register is record
-- Select short or long ringo (for all ringos types).
S : RINGO1_CTRL_S_Field := NXP_SVD.ANACTRL.Short;
-- Ringo frequency output divider.
FS : RINGO1_CTRL_FS_Field := NXP_SVD.ANACTRL.Fast;
-- Ringo module Power control.
PD : RINGO1_CTRL_PD_Field := NXP_SVD.ANACTRL.Powered_On;
-- .
E_R : RINGO1_CTRL_E_R_Field :=
(As_Array => False, Val => 16#0#);
-- Metal 2 (M2) monitor control.
E_M : RINGO1_CTRL_E_M_Field :=
(As_Array => False, Val => 16#0#);
-- unspecified
Reserved_9_15 : HAL.UInt7 := 16#0#;
-- Ringo out Clock divider value. Frequency Output = Frequency input /
-- (DIViSOR+1). (minimum = Frequency input / 16)
DIVISOR : RINGO1_CTRL_DIVISOR_Field := 16#0#;
-- unspecified
Reserved_20_30 : HAL.UInt11 := 16#0#;
-- Read-only. Ringo clock out Divider status flag. Set when a change is
-- made to the divider value, cleared when the change is complete.
DIV_UPDATE_REQ : Boolean := False;
end record
with Volatile_Full_Access, Size => 32,
Bit_Order => System.Low_Order_First;
for RINGO1_CTRL_Register use record
S at 0 range 0 .. 0;
FS at 0 range 1 .. 1;
PD at 0 range 2 .. 2;
E_R at 0 range 3 .. 4;
E_M at 0 range 5 .. 8;
Reserved_9_15 at 0 range 9 .. 15;
DIVISOR at 0 range 16 .. 19;
Reserved_20_30 at 0 range 20 .. 30;
DIV_UPDATE_REQ at 0 range 31 .. 31;
end record;
-- Select short or long ringo (for all ringos types).
type RINGO2_CTRL_S_Field is
(
-- Select short ringo (few elements).
Short,
-- Select long ringo (many elements).
Long)
with Size => 1;
for RINGO2_CTRL_S_Field use
(Short => 0,
Long => 1);
-- Ringo frequency output divider.
type RINGO2_CTRL_FS_Field is
(
-- High frequency output (frequency lower than 100 MHz).
Fast,
-- Low frequency output (frequency lower than 10 MHz).
Slow)
with Size => 1;
for RINGO2_CTRL_FS_Field use
(Fast => 0,
Slow => 1);
-- Ringo module Power control.
type RINGO2_CTRL_PD_Field is
(
-- The Ringo module is enabled.
Powered_On,
-- The Ringo module is disabled.
Powered_Down)
with Size => 1;
for RINGO2_CTRL_PD_Field use
(Powered_On => 0,
Powered_Down => 1);
-- .
type RINGO2_CTRL_E_R24_Field is
(
-- Ringo is disabled.
Disable,
-- Ringo is enabled.
Enable)
with Size => 1;
for RINGO2_CTRL_E_R24_Field use
(Disable => 0,
Enable => 1);
-- RINGO2_CTRL_E_R array
type RINGO2_CTRL_E_R_Field_Array is array (24 .. 25)
of RINGO2_CTRL_E_R24_Field
with Component_Size => 1, Size => 2;
-- Type definition for RINGO2_CTRL_E_R
type RINGO2_CTRL_E_R_Field
(As_Array : Boolean := False)
is record
case As_Array is
when False =>
-- E_R as a value
Val : HAL.UInt2;
when True =>
-- E_R as an array
Arr : RINGO2_CTRL_E_R_Field_Array;
end case;
end record
with Unchecked_Union, Size => 2;
for RINGO2_CTRL_E_R_Field use record
Val at 0 range 0 .. 1;
Arr at 0 range 0 .. 1;
end record;
-- Metal 2 (M2) monitor control.
type RINGO2_CTRL_E_M2_Field is
(
-- Ringo is disabled.
Disable,
-- Ringo is enabled.
Enable)
with Size => 1;
for RINGO2_CTRL_E_M2_Field use
(Disable => 0,
Enable => 1);
-- RINGO2_CTRL_E_M array
type RINGO2_CTRL_E_M_Field_Array is array (2 .. 5)
of RINGO2_CTRL_E_M2_Field
with Component_Size => 1, Size => 4;
-- Type definition for RINGO2_CTRL_E_M
type RINGO2_CTRL_E_M_Field
(As_Array : Boolean := False)
is record
case As_Array is
when False =>
-- E_M as a value
Val : HAL.UInt4;
when True =>
-- E_M as an array
Arr : RINGO2_CTRL_E_M_Field_Array;
end case;
end record
with Unchecked_Union, Size => 4;
for RINGO2_CTRL_E_M_Field use record
Val at 0 range 0 .. 3;
Arr at 0 range 0 .. 3;
end record;
subtype RINGO2_CTRL_DIVISOR_Field is HAL.UInt4;
-- Third Ring Oscillator module control register.
type RINGO2_CTRL_Register is record
-- Select short or long ringo (for all ringos types).
S : RINGO2_CTRL_S_Field := NXP_SVD.ANACTRL.Short;
-- Ringo frequency output divider.
FS : RINGO2_CTRL_FS_Field := NXP_SVD.ANACTRL.Fast;
-- Ringo module Power control.
PD : RINGO2_CTRL_PD_Field := NXP_SVD.ANACTRL.Powered_On;
-- .
E_R : RINGO2_CTRL_E_R_Field :=
(As_Array => False, Val => 16#0#);
-- Metal 2 (M2) monitor control.
E_M : RINGO2_CTRL_E_M_Field :=
(As_Array => False, Val => 16#0#);
-- unspecified
Reserved_9_15 : HAL.UInt7 := 16#0#;
-- Ringo out Clock divider value. Frequency Output = Frequency input /
-- (DIViSOR+1). (minimum = Frequency input / 16)
DIVISOR : RINGO2_CTRL_DIVISOR_Field := 16#0#;
-- unspecified
Reserved_20_30 : HAL.UInt11 := 16#0#;
-- Read-only. Ringo clock out Divider status flag. Set when a change is
-- made to the divider value, cleared when the change is complete.
DIV_UPDATE_REQ : Boolean := False;
end record
with Volatile_Full_Access, Size => 32,
Bit_Order => System.Low_Order_First;
for RINGO2_CTRL_Register use record
S at 0 range 0 .. 0;
FS at 0 range 1 .. 1;
PD at 0 range 2 .. 2;
E_R at 0 range 3 .. 4;
E_M at 0 range 5 .. 8;
Reserved_9_15 at 0 range 9 .. 15;
DIVISOR at 0 range 16 .. 19;
Reserved_20_30 at 0 range 20 .. 30;
DIV_UPDATE_REQ at 0 range 31 .. 31;
end record;
-- USB High Speed Phy Control
type USBHS_PHY_CTRL_Register is record
-- Override value for Vbus if using external detectors.
usb_vbusvalid_ext : Boolean := False;
-- Override value for ID if using external detectors.
usb_id_ext : Boolean := False;
-- unspecified
Reserved_2_31 : HAL.UInt30 := 16#2#;
end record
with Volatile_Full_Access, Size => 32,
Bit_Order => System.Low_Order_First;
for USBHS_PHY_CTRL_Register use record
usb_vbusvalid_ext at 0 range 0 .. 0;
usb_id_ext at 0 range 1 .. 1;
Reserved_2_31 at 0 range 2 .. 31;
end record;
-----------------
-- Peripherals --
-----------------
-- ANALOGCTRL
type ANACTRL_Peripheral is record
-- Analog Macroblock Identity registers, Flash Status registers
ANALOG_CTRL_STATUS : aliased ANALOG_CTRL_STATUS_Register;
-- Frequency Measure function control register
FREQ_ME_CTRL : aliased FREQ_ME_CTRL_Register;
-- 192MHz Free Running OScillator (FRO) Control register
FRO192M_CTRL : aliased FRO192M_CTRL_Register;
-- 192MHz Free Running OScillator (FRO) Status register
FRO192M_STATUS : aliased FRO192M_STATUS_Register;
-- High speed Crystal Oscillator Control register
XO32M_CTRL : aliased XO32M_CTRL_Register;
-- High speed Crystal Oscillator Status register
XO32M_STATUS : aliased XO32M_STATUS_Register;
-- Brown Out Detectors (BoDs) & DCDC interrupts generation control
-- register
BOD_DCDC_INT_CTRL : aliased BOD_DCDC_INT_CTRL_Register;
-- BoDs & DCDC interrupts status register
BOD_DCDC_INT_STATUS : aliased BOD_DCDC_INT_STATUS_Register;
-- First Ring Oscillator module control register.
RINGO0_CTRL : aliased RINGO0_CTRL_Register;
-- Second Ring Oscillator module control register.
RINGO1_CTRL : aliased RINGO1_CTRL_Register;
-- Third Ring Oscillator module control register.
RINGO2_CTRL : aliased RINGO2_CTRL_Register;
-- USB High Speed Phy Control
USBHS_PHY_CTRL : aliased USBHS_PHY_CTRL_Register;
end record
with Volatile;
for ANACTRL_Peripheral use record
ANALOG_CTRL_STATUS at 16#4# range 0 .. 31;
FREQ_ME_CTRL at 16#C# range 0 .. 31;
FRO192M_CTRL at 16#10# range 0 .. 31;
FRO192M_STATUS at 16#14# range 0 .. 31;
XO32M_CTRL at 16#20# range 0 .. 31;
XO32M_STATUS at 16#24# range 0 .. 31;
BOD_DCDC_INT_CTRL at 16#30# range 0 .. 31;
BOD_DCDC_INT_STATUS at 16#34# range 0 .. 31;
RINGO0_CTRL at 16#40# range 0 .. 31;
RINGO1_CTRL at 16#44# range 0 .. 31;
RINGO2_CTRL at 16#48# range 0 .. 31;
USBHS_PHY_CTRL at 16#100# range 0 .. 31;
end record;
-- ANALOGCTRL
ANACTRL_Periph : aliased ANACTRL_Peripheral
with Import, Address => System'To_Address (16#40013000#);
end NXP_SVD.ANACTRL;
| 33.303114 | 79 | 0.620755 |
30da8f0488d80126000527509a5346bf8df81370 | 3,818 | ads | Ada | awa/plugins/awa-mail/src/awa-mail-modules.ads | fuzzysloth/ada-awa | f9b921eeea29841667a028f2fc4528e4385d247a | [
"Apache-2.0"
] | null | null | null | awa/plugins/awa-mail/src/awa-mail-modules.ads | fuzzysloth/ada-awa | f9b921eeea29841667a028f2fc4528e4385d247a | [
"Apache-2.0"
] | null | null | null | awa/plugins/awa-mail/src/awa-mail-modules.ads | fuzzysloth/ada-awa | f9b921eeea29841667a028f2fc4528e4385d247a | [
"Apache-2.0"
] | null | null | null | -----------------------------------------------------------------------
-- awa-mail -- Mail module
-- Copyright (C) 2011, 2012, 2017 Stephane Carrez
-- Written by Stephane Carrez ([email protected])
--
-- Licensed under the Apache License, Version 2.0 (the "License");
-- you may not use this file except in compliance with the License.
-- You may obtain a copy of the License at
--
-- http://www.apache.org/licenses/LICENSE-2.0
--
-- Unless required by applicable law or agreed to in writing, software
-- distributed under the License is distributed on an "AS IS" BASIS,
-- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-- See the License for the specific language governing permissions and
-- limitations under the License.
-----------------------------------------------------------------------
with Util.Beans.Objects.Maps;
with ASF.Applications;
with AWA.Modules;
with AWA.Events;
with AWA.Mail.Clients;
-- == Documentation ==
-- The *mail* module allows an application to format and send a mail
-- to users. This module does not define any web interface. It provides
-- a set of services and methods to send a mail when an event is
-- received. All this is done through configuration. The module
-- defines a set of specific ASF components to format and prepare the
-- email.
--
-- == Configuration ==
-- The *mail* module needs some properties to configure the SMTP
-- server.
--
-- ||mail.smtp.host||localhost||Defines the SMTP server host name||
-- ||mail.smtp.port||25||Defines the SMTP connection port||
-- ||mail.smtp.enable||1|||Defines whether sending email is enabled or not||
--
-- == Sending an email ==
-- Sending an email when an event is posted can be done by using
-- an XML configuration. Basically, the *mail* module uses the event
-- framework provided by AWA. The XML definition looks like:
--
-- <on-event name="user-register">
-- <action>#{userMail.send}</action>
-- <property name="template">/mail/register-user-message.xhtml</property>
-- </on-event>
--
-- With this definition, the mail template `/mail/register-user-message.xhtml`
-- is formatted by using the event and application context when the
-- `user-register` event is posted.
--
-- @include awa-mail-components.ads
-- @include awa-mail-components-recipients.ads
-- @include awa-mail-components-messages.ads
--
-- == Ada Beans ==
-- @include mail.xml
--
package AWA.Mail.Modules is
NAME : constant String := "mail";
type Mail_Module is new AWA.Modules.Module with private;
type Mail_Module_Access is access all Mail_Module'Class;
-- Initialize the mail module.
overriding
procedure Initialize (Plugin : in out Mail_Module;
App : in AWA.Modules.Application_Access;
Props : in ASF.Applications.Config);
-- Configures the module after its initialization and after having read its XML configuration.
overriding
procedure Configure (Plugin : in out Mail_Module;
Props : in ASF.Applications.Config);
-- Create a new mail message.
function Create_Message (Plugin : in Mail_Module)
return AWA.Mail.Clients.Mail_Message_Access;
-- Format and send an email.
procedure Send_Mail (Plugin : in Mail_Module;
Template : in String;
Props : in Util.Beans.Objects.Maps.Map;
Content : in AWA.Events.Module_Event'Class);
-- Get the mail module instance associated with the current application.
function Get_Mail_Module return Mail_Module_Access;
private
type Mail_Module is new AWA.Modules.Module with record
Mailer : AWA.Mail.Clients.Mail_Manager_Access;
end record;
end AWA.Mail.Modules;
| 37.431373 | 98 | 0.660817 |
19fad4ada8ddc2d6088af1e86b74ffaab1a9b10a | 479 | adb | Ada | examples/server_test.adb | reznikmm/coroutines | 52dd5d483f09d69cdc133910e49d13664cf05d80 | [
"MIT"
] | 3 | 2019-11-11T06:35:21.000Z | 2019-11-13T13:34:56.000Z | examples/server_test.adb | reznikmm/coroutines | 52dd5d483f09d69cdc133910e49d13664cf05d80 | [
"MIT"
] | null | null | null | examples/server_test.adb | reznikmm/coroutines | 52dd5d483f09d69cdc133910e49d13664cf05d80 | [
"MIT"
] | null | null | null | -- Copyright (c) 2019 Maxim Reznik <[email protected]>
--
-- SPDX-License-Identifier: MIT
-- License-Filename: LICENSE
-------------------------------------------------------------
with Server_Test_Proc;
with Coroutines.Timeouts;
with TCP_Servers;
procedure Server_Test is
begin
Coroutines.Initialize;
Coroutines.Timeouts.Initialize;
TCP_Servers.Listen_Port
(Port => 12345,
Run => Server_Test_Proc'Access,
Stack => 40_960);
end Server_Test;
| 20.826087 | 61 | 0.626305 |
9a7e1f7d9c2bcbdb19f298b0120163ceb3364642 | 3,584 | ads | Ada | source/amf/mofext/amf-mof-tags-hash.ads | svn2github/matreshka | 9d222b3ad9da508855fb1f5adbe5e8a4fad4c530 | [
"BSD-3-Clause"
] | 24 | 2016-11-29T06:59:41.000Z | 2021-08-30T11:55:16.000Z | source/amf/mofext/amf-mof-tags-hash.ads | svn2github/matreshka | 9d222b3ad9da508855fb1f5adbe5e8a4fad4c530 | [
"BSD-3-Clause"
] | 2 | 2019-01-16T05:15:20.000Z | 2019-02-03T10:03:32.000Z | source/amf/mofext/amf-mof-tags-hash.ads | svn2github/matreshka | 9d222b3ad9da508855fb1f5adbe5e8a4fad4c530 | [
"BSD-3-Clause"
] | 4 | 2017-07-18T07:11:05.000Z | 2020-06-21T03:02:25.000Z | ------------------------------------------------------------------------------
-- --
-- Matreshka Project --
-- --
-- Ada Modeling Framework --
-- --
-- Runtime Library Component --
-- --
------------------------------------------------------------------------------
-- --
-- Copyright © 2012, Vadim Godunko <[email protected]> --
-- All rights reserved. --
-- --
-- Redistribution and use in source and binary forms, with or without --
-- modification, are permitted provided that the following conditions --
-- are met: --
-- --
-- * Redistributions of source code must retain the above copyright --
-- notice, this list of conditions and the following disclaimer. --
-- --
-- * Redistributions in binary form must reproduce the above copyright --
-- notice, this list of conditions and the following disclaimer in the --
-- documentation and/or other materials provided with the distribution. --
-- --
-- * Neither the name of the Vadim Godunko, IE nor the names of its --
-- contributors may be used to endorse or promote products derived from --
-- this software without specific prior written permission. --
-- --
-- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS --
-- "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT --
-- LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR --
-- A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT --
-- HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, --
-- SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED --
-- TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR --
-- PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF --
-- LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING --
-- NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS --
-- SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. --
-- --
------------------------------------------------------------------------------
-- $Revision$ $Date$
------------------------------------------------------------------------------
-- This file is generated, don't edit it.
------------------------------------------------------------------------------
with AMF.Elements.Generic_Hash;
function AMF.MOF.Tags.Hash is
new AMF.Elements.Generic_Hash (MOF_Tag, MOF_Tag_Access);
| 71.68 | 78 | 0.396763 |
1eff220daa6a88e2ee9832ee8dbf7747587d3059 | 11,502 | adb | Ada | examples/ucd_normalization.adb | ytomino/drake | 4e4bdcd8b8e23a11a29b31d3a8861fdf60090ea2 | [
"MIT"
] | 33 | 2015-04-04T09:19:36.000Z | 2021-11-10T05:33:34.000Z | examples/ucd_normalization.adb | ytomino/drake | 4e4bdcd8b8e23a11a29b31d3a8861fdf60090ea2 | [
"MIT"
] | 8 | 2017-11-14T13:05:07.000Z | 2018-08-09T15:28:49.000Z | examples/ucd_normalization.adb | ytomino/drake | 4e4bdcd8b8e23a11a29b31d3a8861fdf60090ea2 | [
"MIT"
] | 9 | 2015-02-03T17:09:53.000Z | 2021-11-12T01:16:05.000Z | -- convert UCD/UnicodeData.txt, UCD/CompositionExclusions.txt
-- bin/ucd_normalization -r $UCD/UnicodeData.txt $UCD/CompositionExclusions.txt > ../source/strings/a-ucdnor.ads
-- bin/ucd_normalization -u $UCD/UnicodeData.txt $UCD/CompositionExclusions.txt > ../source/strings/a-ucnoun.ads
with Ada.Command_Line; use Ada.Command_Line;
with Ada.Containers.Ordered_Maps;
with Ada.Containers.Ordered_Sets;
with Ada.Integer_Text_IO; use Ada.Integer_Text_IO;
with Ada.Strings; use Ada.Strings;
with Ada.Strings.Fixed; use Ada.Strings.Fixed;
with Ada.Strings.Maps.Constants; use Ada.Strings.Maps.Constants;
with Ada.Strings.Wide_Wide_Unbounded; use Ada.Strings.Wide_Wide_Unbounded;
with Ada.Text_IO; use Ada.Text_IO;
procedure ucd_normalization is
function Value (S : String) return Wide_Wide_Character is
Img : constant String := "Hex_" & (1 .. 8 - S'Length => '0') & S;
begin
return Wide_Wide_Character'Value (Img);
end Value;
procedure Put_16 (Item : Integer) is
begin
if Item >= 16#10000# then
Put (Item, Width => 1, Base => 16);
else
declare
S : String (1 .. 8); -- "16#XXXX#"
begin
Put (S, Item, Base => 16);
S (1) := '1';
S (2) := '6';
S (3) := '#';
for I in reverse 4 .. 6 loop
if S (I) = '#' then
S (4 .. I) := (others => '0');
exit;
end if;
end loop;
Put (S);
end;
end if;
end Put_16;
function NFS_Exclusion (C : Wide_Wide_Character) return Boolean is
begin
case Wide_Wide_Character'Pos (C) is
when 16#2000# .. 16#2FFF#
| 16#F900# .. 16#FAFF#
| 16#2F800# .. 16#2FAFF# =>
return True;
when others =>
return False;
end case;
end NFS_Exclusion;
package Decomposite_Maps is new Ada.Containers.Ordered_Maps (
Wide_Wide_Character,
Ada.Strings.Wide_Wide_Unbounded.Unbounded_Wide_Wide_String);
use Decomposite_Maps;
package WWC_Sets is new Ada.Containers.Ordered_Sets (
Wide_Wide_Character);
use WWC_Sets;
NFD : Decomposite_Maps.Map;
Exclusions : WWC_Sets.Set;
type Kind_Type is (Decomposition, Excluded, Singleton);
type Bit is (In_16, In_32);
function Get_Bit (C : Wide_Wide_Character) return Bit is
begin
if C > Wide_Wide_Character'Val (16#FFFF#) then
return In_32;
else
return In_16;
end if;
end Get_Bit;
function Get_Bit (S : Ada.Strings.Wide_Wide_Unbounded.Unbounded_Wide_Wide_String) return Bit is
begin
for I in 1 .. Length (S) loop
if Get_Bit (Element (S, I)) = In_32 then
return In_32;
end if;
end loop;
return In_16;
end Get_Bit;
type Normalization is (D, C);
Total_Num : array (Boolean, Normalization) of Natural;
Num : array (Boolean, Kind_Type, Bit) of Natural;
type Output_Kind is (Reversible, Unreversible);
Output : Output_Kind;
begin
if Argument (1) = "-r" then
Output := Reversible;
elsif Argument (1) = "-u" then
Output := Unreversible;
else
raise Data_Error with "-r or -u";
end if;
declare
File : Ada.Text_IO.File_Type;
begin
Open (File, In_File, Argument (2));
while not End_Of_File (File) loop
declare
Line : constant String := Get_Line (File);
type Range_Type is record
First : Positive;
Last : Natural;
end record;
Fields : array (1 .. 14) of Range_Type;
P : Positive := Line'First;
N : Natural;
Token_First : Positive;
Token_Last : Natural;
Code : Wide_Wide_Character;
Alt : Ada.Strings.Wide_Wide_Unbounded.Unbounded_Wide_Wide_String;
begin
for I in Fields'Range loop
N := P;
while N <= Line'Last and then Line (N) /= ';' loop
N := N + 1;
end loop;
if (N <= Line'Last) /= (I < Field'Last) then
raise Data_Error with Line & " -- 2A";
end if;
Fields (I).First := P;
Fields (I).Last := N - 1;
P := N + 1; -- skip ';'
end loop;
Code := Value (Line (Fields (1).First .. Fields (1).Last));
if Fields (6).First <= Fields (6).Last then -- normalization
if Line (Fields (6).First) = '<' then
null; -- skip NFKD
else -- NFD
Alt := Null_Unbounded_Wide_Wide_String;
P := Fields (6).First;
while P <= Fields (6).Last loop
Find_Token (
Line (P .. Fields (6).Last),
Hexadecimal_Digit_Set,
Inside,
Token_First,
Token_Last);
if Token_First /= P then
raise Data_Error with Line & " -- 2B";
end if;
Append (Alt, Value (Line (Token_First .. Token_Last)));
P := Token_Last + 1;
exit when P > Fields (6).Last;
N := Index_Non_Blank (Line (P .. Fields (6).Last));
if N = 0 then
raise Data_Error with Line & " -- 2C";
end if;
P := N;
end loop;
Insert (NFD, Code, Alt);
end if;
end if;
end;
end loop;
Close (File);
end;
declare
I : Decomposite_Maps.Cursor := First (NFD);
begin
while Has_Element (I) loop
if not NFS_Exclusion (Key (I)) then
declare
J : Decomposite_Maps.Cursor := Next (I);
begin
while Has_Element (J) loop
if Element (I) = Element (J) then
raise Data_Error with "dup";
end if;
J := Next (J);
end loop;
end;
end if;
I := Next (I);
end loop;
end;
declare
File : Ada.Text_IO.File_Type;
begin
Open (File, In_File, Argument (3));
while not End_Of_File (File) loop
declare
Line : constant String := Get_Line (File);
P : Positive := Line'First;
Token_First : Positive;
Token_Last : Natural;
First : Wide_Wide_Character;
begin
if Line'Length = 0 or else Line (P) = '#' then
null; -- comment
else
Find_Token (
Line (P .. Line'Last),
Hexadecimal_Digit_Set,
Inside,
Token_First,
Token_Last);
if Token_First /= P then
raise Data_Error with Line & " -- 3A";
end if;
First := Value (Line (Token_First .. Token_Last));
P := Token_Last + 1;
if Line (P) = '.' then
raise Data_Error with Line & " -- 3B";
end if;
if not Contains (NFD, First) then
raise Data_Error with Line & " -- 3C";
end if;
Insert (Exclusions, First);
end if;
end;
end loop;
Close (File);
end;
-- # (4) Non-Starter Decompositions
-- # 0344 COMBINING GREEK DIALYTIKA TONOS
-- # 0F73 TIBETAN VOWEL SIGN II
-- # 0F75 TIBETAN VOWEL SIGN UU
-- # 0F81 TIBETAN VOWEL SIGN REVERSED II
Insert (Exclusions, Wide_Wide_Character'Val (16#0344#));
Insert (Exclusions, Wide_Wide_Character'Val (16#0F73#));
Insert (Exclusions, Wide_Wide_Character'Val (16#0F75#));
Insert (Exclusions, Wide_Wide_Character'Val (16#0F81#));
-- count
for NFSE in Boolean loop
for K in Kind_Type loop
for B in Bit loop
Num (NFSE, K, B) := 0;
end loop;
end loop;
for N in Normalization loop
Total_Num (NFSE, N) := 0;
end loop;
end loop;
declare
I : Decomposite_Maps.Cursor := First (NFD);
begin
while Has_Element (I) loop
declare
NFSE : Boolean := NFS_Exclusion (Key (I));
B : Bit := Bit'Max (Get_Bit (Key (I)), Get_Bit (Element (I)));
K : Kind_Type;
begin
if Contains (Exclusions, Key (I)) then
K := Excluded;
elsif Length (Element (I)) > 1 then
K := Decomposition;
Total_Num (NFSE, C) := Total_Num (NFSE, C) + 1;
else
K := Singleton;
end if;
Num (NFSE, K, B) := Num (NFSE, K, B) + 1;
Total_Num (NFSE, D) := Total_Num (NFSE, D) + 1;
end;
I := Next (I);
end loop;
end;
-- output the Ada spec
case Output is
when Reversible =>
Put_Line ("pragma License (Unrestricted);");
Put_Line ("-- implementation unit,");
Put_Line ("-- translated from UnicodeData.txt (6), CompositionExclusions.txt");
Put_Line ("package Ada.UCD.Normalization is");
Put_Line (" pragma Pure;");
New_Line;
Put_Line (" -- excluding U+2000..U+2FFF, U+F900..U+FAFF, and U+2F800..U+2FAFF");
New_Line;
Put (" NFD_Total : constant := ");
Put (Total_Num (False, D), Width => 1);
Put (";");
New_Line;
Put (" NFC_Total : constant := ");
Put (Total_Num (False, C), Width => 1);
Put (";");
New_Line;
New_Line;
when Unreversible =>
Put_Line ("pragma License (Unrestricted);");
Put_Line ("-- implementation unit,");
Put_Line ("-- translated from UnicodeData.txt (6), CompositionExclusions.txt");
Put_Line ("package Ada.UCD.Normalization.Unreversible is");
Put_Line (" pragma Pure;");
New_Line;
Put_Line (" -- including U+2000..U+2FFF, U+F900..U+FAFF, and U+2F800..U+2FAFF");
New_Line;
Put (" NFD_Unreversible_Total : constant := ");
Put (Total_Num (True, D), Width => 1);
Put (";");
New_Line;
Put (" NFC_Unreversible_Total : constant := ");
Put (Total_Num (True, C), Width => 1);
Put (";");
New_Line;
New_Line;
end case;
declare
NFSE : constant Boolean := Output = Unreversible;
begin
for K in Kind_Type loop
for B in Bit loop
if Num (NFSE, K, B) /= 0 then
Put (" NFD_");
if NFSE then
Put ("Unreversible_");
end if;
case K is
when Decomposition => Put ("D_");
when Excluded => Put ("E_");
when Singleton => Put ("S_");
end case;
Put ("Table_");
case B is
when In_16 => Put ("XXXX");
when In_32 => Put ("XXXXXXXX");
end case;
Put (" : constant Map_");
case B is
when In_16 => Put ("16");
when In_32 => Put ("32");
end case;
Put ("x");
case K is
when Decomposition | Excluded => Put ("2");
when Singleton => Put ("1");
end case;
Put ("_Type (1 .. ");
Put (Num (NFSE, K, B), Width => 1);
Put (") := (");
New_Line;
declare
I : Decomposite_Maps.Cursor := First (NFD);
Second : Boolean := False;
begin
while Has_Element (I) loop
declare
Item_NFSE : Boolean := NFS_Exclusion (Key (I));
Item_B : Bit := Bit'Max (Get_Bit (Key (I)), Get_Bit (Element (I)));
Item_K : Kind_Type;
begin
if Contains (Exclusions, Key (I)) then
Item_K := Excluded;
elsif Length (Element (I)) > 1 then
Item_K := Decomposition;
else
Item_K := Singleton;
end if;
if Item_NFSE = NFSE
and then Item_K = K
and then Item_B = B
then
if Second then
Put (",");
New_Line;
end if;
Put (" ");
if Num (NFSE, K, B) = 1 then
Put ("1 => ");
end if;
Put ("(");
Put_16 (Wide_Wide_Character'Pos (Key (I)));
Put (", ");
if K = Singleton then
Put_16 (
Wide_Wide_Character'Pos (
Element (Element (I), 1)));
else
declare
E : Ada.Strings.Wide_Wide_Unbounded.Unbounded_Wide_Wide_String
renames Element (I);
begin
Put ("(");
for EI in 1 .. Length (E) loop
if EI > 1 then
Put (", ");
end if;
Put_16 (
Wide_Wide_Character'Pos (
Element (E, EI)));
end loop;
Put (")");
end;
end if;
Put (")");
Second := True;
end if;
end;
I := Next (I);
end loop;
Put (");");
New_Line;
end;
New_Line;
end if;
end loop;
end loop;
end;
case Output is
when Reversible =>
Put_Line ("end Ada.UCD.Normalization;");
when Unreversible =>
Put_Line ("end Ada.UCD.Normalization.Unreversible;");
end case;
end ucd_normalization;
| 28.470297 | 112 | 0.585463 |
031a738982c5f27c0229248f24b5b7e7d64e0a13 | 267 | adb | Ada | 1A/S5/PIM/tps/tp4/exemple_dates.adb | MOUDDENEHamza/ENSEEIHT | a90b1dee0c8d18a9578153a357278d99405bb534 | [
"Apache-2.0"
] | 4 | 2020-05-02T12:32:32.000Z | 2022-01-12T20:20:35.000Z | PIM/TP6_Modules/exemple_dates.adb | Hathoute/ENSEEIHT | d42f0b0dedb269e6df3b1c006d4d45e52fc518b8 | [
"MIT"
] | 2 | 2021-01-14T20:03:26.000Z | 2022-01-30T01:10:00.000Z | PIM/TP6_Modules/exemple_dates.adb | Hathoute/ENSEEIHT | d42f0b0dedb269e6df3b1c006d4d45e52fc518b8 | [
"MIT"
] | 13 | 2020-11-11T21:28:11.000Z | 2022-02-19T13:54:22.000Z | with Ada.Text_IO;
use Ada.Text_IO;
with Dates;
use Dates;
procedure Exemple_Dates is
Une_Date : T_Date;
begin
-- Initialiser une date
Initialiser (Une_Date, 1, OCTOBRE, 2018);
-- L'afficher
Afficher (Une_Date);
New_Line;
end Exemple_Dates;
| 16.6875 | 45 | 0.692884 |
d148c670432606a475999cba68a9944da55ec376 | 14,093 | adb | Ada | .emacs.d/elpa/wisi-3.0.1/wisitoken-generate-lr-lr1_generate.adb | caqg/linux-home | eed631aae6f5e59e4f46e14f1dff443abca5fa28 | [
"Linux-OpenIB"
] | null | null | null | .emacs.d/elpa/wisi-3.0.1/wisitoken-generate-lr-lr1_generate.adb | caqg/linux-home | eed631aae6f5e59e4f46e14f1dff443abca5fa28 | [
"Linux-OpenIB"
] | null | null | null | .emacs.d/elpa/wisi-3.0.1/wisitoken-generate-lr-lr1_generate.adb | caqg/linux-home | eed631aae6f5e59e4f46e14f1dff443abca5fa28 | [
"Linux-OpenIB"
] | null | null | null | -- Abstract :
--
-- See spec.
--
-- Copyright (C) 2017 - 2019 Free Software Foundation, Inc.
--
-- This file is part of the WisiToken package.
--
-- The WisiToken package 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.Text_IO;
with WisiToken.Generate;
package body WisiToken.Generate.LR.LR1_Generate is
function LR1_Goto_Transitions
(Set : in LR1_Items.Item_Set;
Symbol : in Token_ID;
Has_Empty_Production : in Token_ID_Set;
First_Terminal_Sequence : in Token_Sequence_Arrays.Vector;
Grammar : in WisiToken.Productions.Prod_Arrays.Vector;
Descriptor : in WisiToken.Descriptor)
return LR1_Items.Item_Set
is
use all type Ada.Containers.Count_Type;
use Token_ID_Arrays;
use LR1_Items;
Goto_Set : Item_Set;
begin
for Item of Set.Set loop
if Item.Dot /= No_Element then
if Element (Item.Dot) = Symbol and
-- We don't need a state with dot after EOI in the
-- accept production. EOI should only appear in the
-- accept production.
Symbol /= Descriptor.EOI_ID
then
Goto_Set.Set.Insert ((Item.Prod, Next (Item.Dot), new Token_ID_Set'(Item.Lookaheads.all)));
end if;
end if;
end loop;
if Goto_Set.Set.Length > 0 then
return Closure (Goto_Set, Has_Empty_Production, First_Terminal_Sequence, Grammar, Descriptor);
else
return Goto_Set;
end if;
end LR1_Goto_Transitions;
function LR1_Item_Sets
(Has_Empty_Production : in Token_ID_Set;
First_Terminal_Sequence : in Token_Sequence_Arrays.Vector;
Grammar : in WisiToken.Productions.Prod_Arrays.Vector;
Descriptor : in WisiToken.Descriptor)
return LR1_Items.Item_Set_List
is
use all type Ada.Containers.Count_Type;
-- [dragon] algorithm 4.9 pg 231; figure 4.38 pg 232; procedure
-- "items", with some optimizations.
use LR1_Items;
First_State_Index : constant State_Index := 0;
C : LR1_Items.Item_Set_List; -- result
C_Tree : LR1_Items.Item_Set_Trees.Tree; -- for fast find
States_To_Check : State_Index_Queues.Queue;
-- [dragon] specifies 'until no more items can be added', but we use
-- a queue to avoid checking unecessary states. Ada LR1 has over
-- 100,000 states, so this is a significant gain (reduced time from
-- 600 seconds to 40).
I : State_Index;
Dot_IDs : Token_ID_Arrays.Vector;
New_Item_Set : Item_Set := Closure
((Set => Item_Lists.To_List
((Prod => (Grammar.First_Index, 0),
Dot => Grammar (Grammar.First_Index).RHSs (0).Tokens.First,
Lookaheads => new Token_ID_Set'(To_Lookahead (Descriptor.EOI_ID, Descriptor)))),
Goto_List => <>,
Dot_IDs => <>,
State => First_State_Index),
Has_Empty_Production, First_Terminal_Sequence, Grammar, Descriptor);
Found_State : Unknown_State_Index;
begin
C.Set_First_Last (First_State_Index, First_State_Index - 1);
Add (New_Item_Set, C, C_Tree, Descriptor, Include_Lookaheads => True);
States_To_Check.Put (First_State_Index);
loop
exit when States_To_Check.Is_Empty;
I := States_To_Check.Get;
if Trace_Generate > Outline then
Ada.Text_IO.Put ("Checking ");
Put (Grammar, Descriptor, C (I), Show_Lookaheads => True, Show_Goto_List => True);
end if;
Dot_IDs := C (I).Dot_IDs;
-- We can't iterate on C (I).Dot_IDs when the loop adds items to C;
-- it might be reallocated to grow.
for Symbol of Dot_IDs loop
-- [dragon] has 'for each grammar symbol X', but LR1_Goto_Transitions
-- rejects Symbol that is not in Dot_IDs, so we iterate over that.
New_Item_Set := LR1_Goto_Transitions
(C (I), Symbol, Has_Empty_Production, First_Terminal_Sequence, Grammar, Descriptor);
if New_Item_Set.Set.Length > 0 then -- 'goto (I, X) not empty'
Found_State := Find (New_Item_Set, C_Tree, Match_Lookaheads => True); -- 'not in C'
if Found_State = Unknown_State then
New_Item_Set.State := C.Last_Index + 1;
States_To_Check.Put (New_Item_Set.State);
Add (New_Item_Set, C, C_Tree, Descriptor, Include_Lookaheads => True);
if Trace_Generate > Outline then
Ada.Text_IO.Put_Line
(" adding state" & Unknown_State_Index'Image (C.Last_Index) & ": from state" &
Unknown_State_Index'Image (I) & " on " & Image (Symbol, Descriptor));
Put (Grammar, Descriptor, New_Item_Set, Show_Lookaheads => True);
end if;
C (I).Goto_List.Insert ((Symbol, C.Last_Index));
else
-- If there's not already a goto entry between these two sets, create one.
if not Is_In ((Symbol, Found_State), Goto_List => C (I).Goto_List) then
if Trace_Generate > Outline then
Ada.Text_IO.Put_Line
(" adding goto on " & Image (Symbol, Descriptor) & " to state" &
Unknown_State_Index'Image (Found_State));
end if;
C (I).Goto_List.Insert ((Symbol, Found_State));
end if;
end if;
end if;
end loop;
end loop;
if Trace_Generate > Outline then
Ada.Text_IO.New_Line;
end if;
return C;
end LR1_Item_Sets;
procedure Add_Actions
(Item_Sets : in LR1_Items.Item_Set_List;
Grammar : in WisiToken.Productions.Prod_Arrays.Vector;
Has_Empty_Production : in Token_ID_Set;
First_Nonterm_Set : in Token_Array_Token_Set;
Conflict_Counts : out Conflict_Count_Lists.List;
Conflicts : out Conflict_Lists.List;
Table : in out Parse_Table;
Descriptor : in WisiToken.Descriptor)
is
-- Add actions for all Item_Sets to Table.
begin
for Item_Set of Item_Sets loop
Add_Actions
(Item_Set, Table, Grammar, Has_Empty_Production, First_Nonterm_Set, Conflict_Counts, Conflicts, Descriptor);
end loop;
if Trace_Generate > Outline then
Ada.Text_IO.New_Line;
end if;
end Add_Actions;
function Generate
(Grammar : in WisiToken.Productions.Prod_Arrays.Vector;
Descriptor : in WisiToken.Descriptor;
Known_Conflicts : in Conflict_Lists.List := Conflict_Lists.Empty_List;
McKenzie_Param : in McKenzie_Param_Type := Default_McKenzie_Param;
Put_Parse_Table : in Boolean := False;
Include_Extra : in Boolean := False;
Ignore_Conflicts : in Boolean := False;
Partial_Recursion : in Boolean := True)
return Parse_Table_Ptr
is
use type Ada.Containers.Count_Type;
Ignore_Unused_Tokens : constant Boolean := WisiToken.Trace_Generate > Detail;
Ignore_Unknown_Conflicts : constant Boolean := Ignore_Conflicts or WisiToken.Trace_Generate > Detail;
Unused_Tokens : constant Boolean := WisiToken.Generate.Check_Unused_Tokens (Descriptor, Grammar);
Table : Parse_Table_Ptr;
Has_Empty_Production : constant Token_ID_Set := WisiToken.Generate.Has_Empty_Production (Grammar);
Recursions : constant WisiToken.Generate.Recursions :=
(if Partial_Recursion
then WisiToken.Generate.Compute_Partial_Recursion (Grammar)
else WisiToken.Generate.Compute_Full_Recursion (Grammar));
Minimal_Terminal_Sequences : constant Minimal_Sequence_Array :=
Compute_Minimal_Terminal_Sequences (Descriptor, Grammar, Recursions);
Minimal_Terminal_First : constant Token_Array_Token_ID :=
Compute_Minimal_Terminal_First (Descriptor, Minimal_Terminal_Sequences);
First_Nonterm_Set : constant Token_Array_Token_Set := WisiToken.Generate.First
(Grammar, Has_Empty_Production, Descriptor.First_Terminal);
First_Terminal_Sequence : constant Token_Sequence_Arrays.Vector :=
WisiToken.Generate.To_Terminal_Sequence_Array (First_Nonterm_Set, Descriptor);
Item_Sets : constant LR1_Items.Item_Set_List := LR1_Item_Sets
(Has_Empty_Production, First_Terminal_Sequence, Grammar, Descriptor);
Conflict_Counts : Conflict_Count_Lists.List;
Unknown_Conflicts : Conflict_Lists.List;
Known_Conflicts_Edit : Conflict_Lists.List := Known_Conflicts;
begin
if Trace_Generate > Outline then
Ada.Text_IO.New_Line;
Ada.Text_IO.Put_Line ("LR(1) Item_Sets:");
LR1_Items.Put (Grammar, Descriptor, Item_Sets);
end if;
Table := new Parse_Table
(State_First => Item_Sets.First_Index,
State_Last => Item_Sets.Last_Index,
First_Terminal => Descriptor.First_Terminal,
Last_Terminal => Descriptor.Last_Terminal,
First_Nonterminal => Descriptor.First_Nonterminal,
Last_Nonterminal => Descriptor.Last_Nonterminal);
if McKenzie_Param = Default_McKenzie_Param then
-- Descriminants in Default are wrong
Table.McKenzie_Param :=
(First_Terminal => Descriptor.First_Terminal,
Last_Terminal => Descriptor.Last_Terminal,
First_Nonterminal => Descriptor.First_Nonterminal,
Last_Nonterminal => Descriptor.Last_Nonterminal,
Insert => (others => 0),
Delete => (others => 0),
Push_Back => (others => 0),
Undo_Reduce => (others => 0),
Minimal_Complete_Cost_Delta => Default_McKenzie_Param.Minimal_Complete_Cost_Delta,
Fast_Forward => Default_McKenzie_Param.Fast_Forward,
Matching_Begin => Default_McKenzie_Param.Matching_Begin,
Ignore_Check_Fail => Default_McKenzie_Param.Ignore_Check_Fail,
Task_Count => Default_McKenzie_Param.Task_Count,
Check_Limit => Default_McKenzie_Param.Check_Limit,
Check_Delta_Limit => Default_McKenzie_Param.Check_Delta_Limit,
Enqueue_Limit => Default_McKenzie_Param.Enqueue_Limit);
else
Table.McKenzie_Param := McKenzie_Param;
end if;
Add_Actions
(Item_Sets, Grammar, Has_Empty_Production, First_Nonterm_Set,
Conflict_Counts, Unknown_Conflicts, Table.all, Descriptor);
for State in Table.States'Range loop
if Trace_Generate > Extra then
Ada.Text_IO.Put_Line ("Set_Minimal_Complete_Actions:" & State_Index'Image (State));
end if;
WisiToken.Generate.LR.Set_Minimal_Complete_Actions
(Table.States (State),
LR1_Items.Filter (Item_Sets (State), Grammar, Descriptor, LR1_Items.In_Kernel'Access),
Descriptor, Grammar, Minimal_Terminal_Sequences, Minimal_Terminal_First);
end loop;
if Put_Parse_Table then
WisiToken.Generate.LR.Put_Parse_Table
(Table, "LR1", Grammar, Recursions, Minimal_Terminal_Sequences, Item_Sets, Conflict_Counts, Descriptor,
Include_Extra);
end if;
if Trace_Generate > Outline then
Ada.Text_IO.New_Line;
Ada.Text_IO.Put_Line ("Has_Empty_Production: " & Image (Has_Empty_Production, Descriptor));
Ada.Text_IO.New_Line;
Ada.Text_IO.Put_Line ("Minimal_Terminal_First:");
for ID in Minimal_Terminal_First'Range loop
Ada.Text_IO.Put_Line
(Image (ID, Descriptor) & " =>" &
(if Minimal_Terminal_First (ID) = Invalid_Token_ID
then ""
else ' ' & Image (Minimal_Terminal_First (ID), Descriptor)));
end loop;
end if;
Delete_Known (Unknown_Conflicts, Known_Conflicts_Edit);
if Unknown_Conflicts.Length > 0 then
Ada.Text_IO.Put_Line (Ada.Text_IO.Current_Error, "unknown conflicts:");
Put (Unknown_Conflicts, Ada.Text_IO.Current_Error, Descriptor);
Ada.Text_IO.New_Line (Ada.Text_IO.Current_Error);
WisiToken.Generate.Error := WisiToken.Generate.Error or not Ignore_Unknown_Conflicts;
end if;
if Known_Conflicts_Edit.Length > 0 then
Ada.Text_IO.Put_Line (Ada.Text_IO.Current_Error, "excess known conflicts:");
Put (Known_Conflicts_Edit, Ada.Text_IO.Current_Error, Descriptor);
Ada.Text_IO.New_Line (Ada.Text_IO.Current_Error);
WisiToken.Generate.Error := WisiToken.Generate.Error or not Ignore_Unknown_Conflicts;
end if;
WisiToken.Generate.Error := WisiToken.Generate.Error or (Unused_Tokens and not Ignore_Unused_Tokens);
return Table;
end Generate;
end WisiToken.Generate.LR.LR1_Generate;
| 42.448795 | 119 | 0.630171 |
d1ab264ebd07b157daa1e8a99e581cbc92c35693 | 18,597 | ads | Ada | source/context/webidl-simple_factories.ads | reznikmm/webidl | 744bbdc9e3dfbe690d37b6dc5d7d82233b919cd4 | [
"MIT"
] | null | null | null | source/context/webidl-simple_factories.ads | reznikmm/webidl | 744bbdc9e3dfbe690d37b6dc5d7d82233b919cd4 | [
"MIT"
] | null | null | null | source/context/webidl-simple_factories.ads | reznikmm/webidl | 744bbdc9e3dfbe690d37b6dc5d7d82233b919cd4 | [
"MIT"
] | null | null | null | -- SPDX-FileCopyrightText: 2021 Max Reznik <[email protected]>
--
-- SPDX-License-Identifier: MIT
-------------------------------------------------------------
with Ada.Containers.Vectors;
with Ada.Containers.Hashed_Maps;
with League.String_Vectors;
with League.Strings;
with League.Strings.Hash;
with WebIDL.Arguments;
with WebIDL.Constructors;
with WebIDL.Enumerations;
with WebIDL.Factories;
with WebIDL.Interface_Members;
with WebIDL.Interfaces;
with WebIDL.Types;
package WebIDL.Simple_Factories is
pragma Preelaborate;
type Factory is limited new WebIDL.Factories.Factory with private;
private
package Type_Maps is new Ada.Containers.Hashed_Maps
(Key_Type => League.Strings.Universal_String,
Element_Type => WebIDL.Types.Type_Access,
Hash => League.Strings.Hash,
Equivalent_Keys => League.Strings."=",
"=" => WebIDL.Types."=");
type Factory is limited new WebIDL.Factories.Factory with record
Sequences : Type_Maps.Map;
Buffers : Type_Maps.Map;
Arrays : Type_Maps.Map;
Observables : Type_Maps.Map;
Records : Type_Maps.Map;
Nullables : Type_Maps.Map;
Promises : Type_Maps.Map;
end record;
overriding function Enumeration
(Self : in out Factory;
Name : League.Strings.Universal_String;
Values : League.String_Vectors.Universal_String_Vector)
return not null WebIDL.Enumerations.Enumeration_Access;
overriding function Interface_Members (Self : in out Factory)
return not null WebIDL.Factories.Interface_Member_Vector_Access;
overriding function New_Interface
(Self : in out Factory;
Name : League.Strings.Universal_String;
Parent : League.Strings.Universal_String;
Members : not null WebIDL.Factories.Interface_Member_Vector_Access)
return not null WebIDL.Interfaces.Interface_Access;
overriding function Arguments (Self : in out Factory)
return not null WebIDL.Factories.Argument_Vector_Access;
overriding function Constructor
(Self : in out Factory;
Args : not null WebIDL.Factories.Argument_Vector_Access)
return not null WebIDL.Constructors.Constructor_Access;
overriding function Argument
(Self : in out Factory;
Type_Def : WebIDL.Types.Type_Access;
Name : League.Strings.Universal_String;
Is_Optional : Boolean;
Has_Ellipsis : Boolean)
return not null WebIDL.Arguments.Argument_Access;
overriding function Any (Self : in out Factory)
return not null WebIDL.Types.Type_Access;
overriding function Object (Self : in out Factory)
return not null WebIDL.Types.Type_Access;
overriding function Symbol (Self : in out Factory)
return not null WebIDL.Types.Type_Access;
overriding function Undefined (Self : in out Factory)
return not null WebIDL.Types.Type_Access;
overriding function Bool (Self : in out Factory)
return not null WebIDL.Types.Type_Access;
overriding function Byte (Self : in out Factory)
return not null WebIDL.Types.Type_Access;
overriding function Octet (Self : in out Factory)
return not null WebIDL.Types.Type_Access;
overriding function BigInt (Self : in out Factory)
return not null WebIDL.Types.Type_Access;
overriding function Integer
(Self : in out Factory;
Is_Unsigned : Boolean;
Long : Natural)
return not null WebIDL.Types.Type_Access;
overriding function Float
(Self : in out Factory;
Restricted : Boolean;
Double : Boolean)
return not null WebIDL.Types.Type_Access;
overriding function DOMString (Self : in out Factory)
return not null WebIDL.Types.Type_Access;
overriding function ByteString (Self : in out Factory)
return not null WebIDL.Types.Type_Access;
overriding function USVString (Self : in out Factory)
return not null WebIDL.Types.Type_Access;
overriding function Sequence
(Self : in out Factory;
T : not null WebIDL.Types.Type_Access)
return not null WebIDL.Types.Type_Access;
overriding function Buffer_Related_Type
(Self : in out Factory;
Name : League.Strings.Universal_String)
return not null WebIDL.Types.Type_Access;
overriding function Frozen_Array
(Self : in out Factory;
T : not null WebIDL.Types.Type_Access)
return not null WebIDL.Types.Type_Access;
overriding function Observable_Array
(Self : in out Factory;
T : not null WebIDL.Types.Type_Access)
return not null WebIDL.Types.Type_Access;
overriding function Record_Type
(Self : in out Factory;
Key : not null WebIDL.Types.Type_Access;
Value : not null WebIDL.Types.Type_Access)
return not null WebIDL.Types.Type_Access;
overriding function Nullable
(Self : in out Factory;
T : not null WebIDL.Types.Type_Access)
return not null WebIDL.Types.Type_Access;
overriding function Promise
(Self : in out Factory;
T : not null WebIDL.Types.Type_Access)
return not null WebIDL.Types.Type_Access;
overriding function Union_Members (Self : in out Factory)
return not null WebIDL.Factories.Union_Member_Vector_Access;
overriding function Union
(Self : in out Factory;
T : not null WebIDL.Factories.Union_Member_Vector_Access)
return not null WebIDL.Types.Type_Access;
package Nodes is
type Enumeration is new WebIDL.Enumerations.Enumeration with record
Name : League.Strings.Universal_String;
Values : League.String_Vectors.Universal_String_Vector;
end record;
type Enumeration_Access is access all Enumeration;
overriding function Name (Self : Enumeration)
return League.Strings.Universal_String is (Self.Name);
overriding function Values (Self : Enumeration)
return League.String_Vectors.Universal_String_Vector is (Self.Values);
package Member_Vectors is new Ada.Containers.Vectors
(Positive,
WebIDL.Interface_Members.Interface_Member_Access,
WebIDL.Interface_Members."=");
type Member_Vector is limited
new WebIDL.Factories.Interface_Member_Vector
and WebIDL.Interface_Members.Iterators.Forward_Iterator with
record
Vector : Member_Vectors.Vector;
end record;
type Member_Vector_Access is access all Member_Vector;
overriding function First (Self : Member_Vector)
return WebIDL.Interface_Members.Cursor;
overriding function Next
(Self : Member_Vector;
Position : WebIDL.Interface_Members.Cursor)
return WebIDL.Interface_Members.Cursor;
overriding procedure Append
(Self : in out Member_Vector;
Item : not null WebIDL.Interface_Members.Interface_Member_Access);
package Argument_Vectors is new Ada.Containers.Vectors
(Positive,
WebIDL.Arguments.Argument_Access,
WebIDL.Arguments."=");
type Argument_Vector is limited
new WebIDL.Factories.Argument_Vector
and WebIDL.Arguments.Iterators.Forward_Iterator with
record
Vector : Argument_Vectors.Vector;
end record;
type Argument_Vector_Access is access all Argument_Vector;
overriding function First (Self : Argument_Vector)
return WebIDL.Arguments.Cursor;
overriding function Next
(Self : Argument_Vector;
Position : WebIDL.Arguments.Cursor)
return WebIDL.Arguments.Cursor;
overriding procedure Append
(Self : in out Argument_Vector;
Item : not null WebIDL.Arguments.Argument_Access);
package Type_Vectors is new Ada.Containers.Vectors
(Positive,
WebIDL.Types.Type_Access,
WebIDL.Types."=");
type Union_Member_Vector is limited
new WebIDL.Factories.Union_Member_Vector
and WebIDL.Types.Iterators.Forward_Iterator with
record
Vector : Type_Vectors.Vector;
end record;
type Union_Member_Vector_Access is access all Union_Member_Vector;
overriding function First (Self : Union_Member_Vector)
return WebIDL.Types.Cursor;
overriding function Next
(Self : Union_Member_Vector;
Position : WebIDL.Types.Cursor)
return WebIDL.Types.Cursor;
overriding procedure Append
(Self : in out Union_Member_Vector;
Item : not null WebIDL.Types.Type_Access);
type Interfase is limited new WebIDL.Interfaces.An_Interface with record
Name : League.Strings.Universal_String;
Parent : League.Strings.Universal_String;
Members : aliased Member_Vector;
end record;
type Interface_Access is access all Interfase;
overriding function Name (Self : Interfase)
return League.Strings.Universal_String is (Self.Name);
overriding function Members (Self : Interfase)
return WebIDL.Interface_Members.Interface_Member_Iterator_Access;
type Constructor is limited new WebIDL.Constructors.Constructor with
record
Arguments : aliased Argument_Vector;
end record;
type Constructor_Access is access all Constructor;
overriding function Arguments (Self : Constructor)
return not null WebIDL.Arguments.Argument_Iterator_Access;
type Argument is new WebIDL.Arguments.Argument with record
Name : League.Strings.Universal_String;
Type_Def : WebIDL.Types.Type_Access;
Is_Optional : Boolean;
Has_Ellipsis : Boolean;
end record;
type Argument_Access is access all Argument;
overriding function Name (Self : Argument)
return League.Strings.Universal_String is (Self.Name);
overriding function Get_Type (Self : Argument)
return not null WebIDL.Types.Type_Access is (Self.Type_Def);
overriding function Is_Optional (Self : Argument) return Boolean is
(Self.Is_Optional);
overriding function Has_Ellipsis (Self : Argument) return Boolean is
(Self.Has_Ellipsis);
end Nodes;
package Types is
use type League.Strings.Universal_String;
function "+" (Text : Wide_Wide_String)
return League.Strings.Universal_String
renames League.Strings.To_Universal_String;
type Base is abstract limited new WebIDL.Types.Type_Definition with
null record;
overriding function Is_Integer (Self : Base) return Boolean is (False);
overriding function Is_Numeric (Self : Base) return Boolean is (False);
overriding function Is_Primiteive (Self : Base) return Boolean
is (False);
type Any_Type is new Base with null record;
overriding function Name (Self : Any_Type)
return League.Strings.Universal_String is (+"Any");
Any : aliased Any_Type;
type Object_Type is new Base with null record;
overriding function Name (Self : Object_Type)
return League.Strings.Universal_String is (+"Object");
Object : aliased Object_Type;
type Symbol_Type is new Base with null record;
overriding function Name (Self : Symbol_Type)
return League.Strings.Universal_String is (+"Symbol");
Symbol : aliased Symbol_Type;
type Undefined_Type is new Base with null record;
overriding function Name (Self : Undefined_Type)
return League.Strings.Universal_String is (+"Undefined");
Undefined : aliased Undefined_Type;
type Short_Type is new Base with null record;
overriding function Name (Self : Short_Type)
return League.Strings.Universal_String is (+"Short");
Short : aliased Short_Type;
type Long_Type is new Base with null record;
overriding function Name (Self : Long_Type)
return League.Strings.Universal_String is (+"Long");
Long : aliased Long_Type;
type Long_Long_Type is new Base with null record;
overriding function Name (Self : Long_Long_Type)
return League.Strings.Universal_String is (+"LongLong");
Long_Long : aliased Long_Long_Type;
type Unsigned_Short_Type is new Base with null record;
overriding function Name (Self : Unsigned_Short_Type)
return League.Strings.Universal_String is (+"UnsignedShort");
Unsigned_Short : aliased Unsigned_Short_Type;
type Unsigned_Long_Type is new Base with null record;
overriding function Name (Self : Unsigned_Long_Type)
return League.Strings.Universal_String is (+"UnsignedLong");
Unsigned_Long : aliased Unsigned_Long_Type;
type Unsigned_Long_Long_Type is new Base with null record;
overriding function Name (Self : Unsigned_Long_Long_Type)
return League.Strings.Universal_String is (+"UnsignedLongLong");
Unsigned_Long_Long : aliased Unsigned_Long_Long_Type;
type Float_Type is new Base with null record;
overriding function Name (Self : Float_Type)
return League.Strings.Universal_String is (+"Float");
Float : aliased Float_Type;
type Double_Type is new Base with null record;
overriding function Name (Self : Double_Type)
return League.Strings.Universal_String is (+"Double");
Double : aliased Double_Type;
type Bool_Type is new Base with null record;
overriding function Name (Self : Bool_Type)
return League.Strings.Universal_String is (+"Boolean");
Bool : aliased Bool_Type;
type Byte_Type is new Base with null record;
overriding function Name (Self : Byte_Type)
return League.Strings.Universal_String is (+"Byte");
Byte : aliased Byte_Type;
type Octet_Type is new Base with null record;
overriding function Name (Self : Octet_Type)
return League.Strings.Universal_String is (+"Octet");
Octet : aliased Octet_Type;
type BigInt_Type is new Base with null record;
overriding function Name (Self : BigInt_Type)
return League.Strings.Universal_String is (+"BigInt");
BigInt : aliased BigInt_Type;
type DOMString_Type is new Base with null record;
overriding function Name (Self : DOMString_Type)
return League.Strings.Universal_String is (+"DOMString");
DOMString : aliased DOMString_Type;
type ByteString_Type is new Base with null record;
overriding function Name (Self : ByteString_Type)
return League.Strings.Universal_String is (+"ByteString");
ByteString : aliased ByteString_Type;
type USVString_Type is new Base with null record;
overriding function Name (Self : USVString_Type)
return League.Strings.Universal_String is (+"USVString");
USVString : aliased USVString_Type;
type Sequence is new Base and WebIDL.Types.Parameterized_Type with record
Element : WebIDL.Types.Type_Access;
end record;
type Sequence_Access is access all Sequence;
overriding function Name (Self : Sequence)
return League.Strings.Universal_String is
(Self.Element.Name & "Sequence");
overriding function Parameter (Self : Sequence)
return not null WebIDL.Types.Type_Access is (Self.Element);
type Frozen_Array is new Base and WebIDL.Types.Parameterized_Type with
record
Element : WebIDL.Types.Type_Access;
end record;
type Frozen_Array_Access is access all Frozen_Array;
overriding function Name (Self : Frozen_Array)
return League.Strings.Universal_String is
(Self.Element.Name & "Array");
overriding function Parameter (Self : Frozen_Array)
return not null WebIDL.Types.Type_Access is (Self.Element);
type Observable_Array is new Base and WebIDL.Types.Parameterized_Type
with record
Element : WebIDL.Types.Type_Access;
end record;
type Observable_Array_Access is access all Observable_Array;
overriding function Name (Self : Observable_Array)
return League.Strings.Universal_String is
(Self.Element.Name & "ObservableArray");
overriding function Parameter (Self : Observable_Array)
return not null WebIDL.Types.Type_Access is (Self.Element);
type Record_Type is new Base and WebIDL.Types.Record_Type with record
Key : WebIDL.Types.Type_Access;
Value : WebIDL.Types.Type_Access;
end record;
type Record_Type_Access is access all Record_Type;
overriding function Name (Self : Record_Type)
return League.Strings.Universal_String is
(Self.Key.Name & Self.Value.Name & "Record");
overriding function Key_Type (Self : Record_Type)
return not null WebIDL.Types.Type_Access is (Self.Key);
overriding function Value_Type (Self : Record_Type)
return not null WebIDL.Types.Type_Access is (Self.Value);
type Nullable is new Base and WebIDL.Types.Nullable
with record
Inner : WebIDL.Types.Type_Access;
end record;
type Nullable_Access is access all Nullable;
overriding function Name (Self : Nullable)
return League.Strings.Universal_String is
(Self.Inner.Name & "OrNull");
overriding function Inner_Type (Self : Nullable)
return not null WebIDL.Types.Type_Access is (Self.Inner);
type Promise is new Base and WebIDL.Types.Parameterized_Type with record
Element : WebIDL.Types.Type_Access;
end record;
type Promise_Access is access all Promise;
overriding function Name (Self : Promise)
return League.Strings.Universal_String is
(Self.Element.Name & "Promise");
overriding function Parameter (Self : Promise)
return not null WebIDL.Types.Type_Access is (Self.Element);
type Buffer_Type is new Base with record
Name : League.Strings.Universal_String;
end record;
type Buffer_Type_Access is access all Buffer_Type;
overriding function Name (Self : Buffer_Type)
return League.Strings.Universal_String is (Self.Name);
type Union is new Base and WebIDL.Types.Union with record
Member : aliased Nodes.Union_Member_Vector;
end record;
type Union_Access is access all Union;
overriding function Name (Self : Union)
return League.Strings.Universal_String;
overriding function Members (Self : Union)
return not null WebIDL.Types.Type_Iterator_Access;
end Types;
end WebIDL.Simple_Factories;
| 33.090747 | 79 | 0.694574 |
5ed5e00bfcbf8ee6c8ca1022ddbf5ad6a0057aa5 | 14,152 | adb | Ada | Validation/pyFrame3DD-master/gcc-master/gcc/ada/libgnat/a-ststio.adb | djamal2727/Main-Bearing-Analytical-Model | 2f00c2219c71be0175c6f4f8f1d4cca231d97096 | [
"Apache-2.0"
] | null | null | null | Validation/pyFrame3DD-master/gcc-master/gcc/ada/libgnat/a-ststio.adb | djamal2727/Main-Bearing-Analytical-Model | 2f00c2219c71be0175c6f4f8f1d4cca231d97096 | [
"Apache-2.0"
] | null | null | null | Validation/pyFrame3DD-master/gcc-master/gcc/ada/libgnat/a-ststio.adb | djamal2727/Main-Bearing-Analytical-Model | 2f00c2219c71be0175c6f4f8f1d4cca231d97096 | [
"Apache-2.0"
] | null | null | null | ------------------------------------------------------------------------------
-- --
-- GNAT RUN-TIME COMPONENTS --
-- --
-- A D A . S T R E A M S . S T R E A M _ I O --
-- --
-- B o d y --
-- --
-- Copyright (C) 1992-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 Interfaces.C_Streams; use Interfaces.C_Streams;
with System; use System;
with System.Communication; use System.Communication;
with System.File_IO;
with System.Soft_Links;
with System.CRTL;
with Ada.Unchecked_Conversion;
with Ada.Unchecked_Deallocation;
package body Ada.Streams.Stream_IO is
package FIO renames System.File_IO;
package SSL renames System.Soft_Links;
subtype AP is FCB.AFCB_Ptr;
function To_FCB is new Ada.Unchecked_Conversion (File_Mode, FCB.File_Mode);
function To_SIO is new Ada.Unchecked_Conversion (FCB.File_Mode, File_Mode);
use type FCB.File_Mode;
use type FCB.Shared_Status_Type;
-----------------------
-- Local Subprograms --
-----------------------
procedure Set_Position (File : File_Type);
-- Sets file position pointer according to value of current index
-------------------
-- AFCB_Allocate --
-------------------
function AFCB_Allocate (Control_Block : Stream_AFCB) return FCB.AFCB_Ptr is
pragma Warnings (Off, Control_Block);
begin
return new Stream_AFCB;
end AFCB_Allocate;
----------------
-- AFCB_Close --
----------------
-- No special processing required for closing Stream_IO file
procedure AFCB_Close (File : not null access Stream_AFCB) is
pragma Warnings (Off, File);
begin
null;
end AFCB_Close;
---------------
-- AFCB_Free --
---------------
procedure AFCB_Free (File : not null access Stream_AFCB) is
type FCB_Ptr is access all Stream_AFCB;
FT : FCB_Ptr := FCB_Ptr (File);
procedure Free is new Ada.Unchecked_Deallocation (Stream_AFCB, FCB_Ptr);
begin
Free (FT);
end AFCB_Free;
-----------
-- Close --
-----------
procedure Close (File : in out File_Type) is
begin
FIO.Close (AP (File)'Unrestricted_Access);
end Close;
------------
-- Create --
------------
procedure Create
(File : in out File_Type;
Mode : File_Mode := Out_File;
Name : String := "";
Form : String := "")
is
Dummy_File_Control_Block : Stream_AFCB;
pragma Warnings (Off, Dummy_File_Control_Block);
-- Yes, we know this is never assigned a value, only the tag
-- is used for dispatching purposes, so that's expected.
begin
FIO.Open (File_Ptr => AP (File),
Dummy_FCB => Dummy_File_Control_Block,
Mode => To_FCB (Mode),
Name => Name,
Form => Form,
Amethod => 'S',
Creat => True,
Text => False);
File.Last_Op := Op_Write;
end Create;
------------
-- Delete --
------------
procedure Delete (File : in out File_Type) is
begin
FIO.Delete (AP (File)'Unrestricted_Access);
end Delete;
-----------------
-- End_Of_File --
-----------------
function End_Of_File (File : File_Type) return Boolean is
begin
FIO.Check_Read_Status (AP (File));
return File.Index > Size (File);
end End_Of_File;
-----------
-- Flush --
-----------
procedure Flush (File : File_Type) is
begin
FIO.Flush (AP (File));
end Flush;
----------
-- Form --
----------
function Form (File : File_Type) return String is
begin
return FIO.Form (AP (File));
end Form;
-----------
-- Index --
-----------
function Index (File : File_Type) return Positive_Count is
begin
FIO.Check_File_Open (AP (File));
return File.Index;
end Index;
-------------
-- Is_Open --
-------------
function Is_Open (File : File_Type) return Boolean is
begin
return FIO.Is_Open (AP (File));
end Is_Open;
----------
-- Mode --
----------
function Mode (File : File_Type) return File_Mode is
begin
return To_SIO (FIO.Mode (AP (File)));
end Mode;
----------
-- Name --
----------
function Name (File : File_Type) return String is
begin
return FIO.Name (AP (File));
end Name;
----------
-- Open --
----------
procedure Open
(File : in out File_Type;
Mode : File_Mode;
Name : String;
Form : String := "")
is
Dummy_File_Control_Block : Stream_AFCB;
pragma Warnings (Off, Dummy_File_Control_Block);
-- Yes, we know this is never assigned a value, only the tag
-- is used for dispatching purposes, so that's expected.
begin
FIO.Open (File_Ptr => AP (File),
Dummy_FCB => Dummy_File_Control_Block,
Mode => To_FCB (Mode),
Name => Name,
Form => Form,
Amethod => 'S',
Creat => False,
Text => False);
-- Ensure that the stream index is set properly (e.g., for Append_File)
Reset (File, Mode);
-- Set last operation. The purpose here is to ensure proper handling
-- of the initial operation. In general, a write after a read requires
-- resetting and doing a seek, so we set the last operation as Read
-- for an In_Out file, but for an Out file we set the last operation
-- to Op_Write, since in this case it is not necessary to do a seek
-- (and furthermore there are situations (such as the case of writing
-- a sequential Posix FIFO file) where the lseek would cause problems.
File.Last_Op := (if Mode = Out_File then Op_Write else Op_Read);
end Open;
----------
-- Read --
----------
procedure Read
(File : File_Type;
Item : out Stream_Element_Array;
Last : out Stream_Element_Offset;
From : Positive_Count)
is
begin
Set_Index (File, From);
Read (File, Item, Last);
end Read;
procedure Read
(File : File_Type;
Item : out Stream_Element_Array;
Last : out Stream_Element_Offset)
is
Nread : size_t;
begin
FIO.Check_Read_Status (AP (File));
-- If last operation was not a read, or if in file sharing mode,
-- then reset the physical pointer of the file to match the index
-- We lock out task access over the two operations in this case.
if File.Last_Op /= Op_Read
or else File.Shared_Status = FCB.Yes
then
Locked_Processing : begin
SSL.Lock_Task.all;
Set_Position (File);
FIO.Read_Buf (AP (File), Item'Address, Item'Length, Nread);
SSL.Unlock_Task.all;
exception
when others =>
SSL.Unlock_Task.all;
raise;
end Locked_Processing;
else
FIO.Read_Buf (AP (File), Item'Address, Item'Length, Nread);
end if;
File.Index := File.Index + Count (Nread);
File.Last_Op := Op_Read;
Last := Last_Index (Item'First, Nread);
end Read;
-- This version of Read is the primitive operation on the underlying
-- Stream type, used when a Stream_IO file is treated as a Stream
procedure Read
(File : in out Stream_AFCB;
Item : out Ada.Streams.Stream_Element_Array;
Last : out Ada.Streams.Stream_Element_Offset)
is
begin
Read (File'Unchecked_Access, Item, Last);
end Read;
-----------
-- Reset --
-----------
procedure Reset (File : in out File_Type; Mode : File_Mode) is
begin
FIO.Check_File_Open (AP (File));
-- Reset file index to start of file for read/write cases. For
-- the append case, the Set_Mode call repositions the index.
File.Index := 1;
Set_Mode (File, Mode);
end Reset;
procedure Reset (File : in out File_Type) is
begin
Reset (File, To_SIO (File.Mode));
end Reset;
---------------
-- Set_Index --
---------------
procedure Set_Index (File : File_Type; To : Positive_Count) is
begin
FIO.Check_File_Open (AP (File));
File.Index := Count (To);
File.Last_Op := Op_Other;
end Set_Index;
--------------
-- Set_Mode --
--------------
procedure Set_Mode (File : in out File_Type; Mode : File_Mode) is
begin
FIO.Check_File_Open (AP (File));
-- If we are switching from read to write, or vice versa, and
-- we are not already open in update mode, then reopen in update
-- mode now. Note that we can use Inout_File as the mode for the
-- call since File_IO handles all modes for all file types.
if ((File.Mode = FCB.In_File) /= (Mode = In_File))
and then not File.Update_Mode
then
FIO.Reset (AP (File)'Unrestricted_Access, FCB.Inout_File);
File.Update_Mode := True;
end if;
-- Set required mode and position to end of file if append mode
File.Mode := To_FCB (Mode);
FIO.Append_Set (AP (File));
if File.Mode = FCB.Append_File then
if Standard'Address_Size = 64 then
File.Index := Count (ftell64 (File.Stream)) + 1;
else
File.Index := Count (ftell (File.Stream)) + 1;
end if;
end if;
File.Last_Op := Op_Other;
end Set_Mode;
------------------
-- Set_Position --
------------------
procedure Set_Position (File : File_Type) is
use type System.CRTL.int64;
R : int;
begin
R := fseek64 (File.Stream, System.CRTL.int64 (File.Index) - 1, SEEK_SET);
if R /= 0 then
raise Use_Error;
end if;
end Set_Position;
----------
-- Size --
----------
function Size (File : File_Type) return Count is
begin
FIO.Check_File_Open (AP (File));
if File.File_Size = -1 then
File.Last_Op := Op_Other;
if fseek64 (File.Stream, 0, SEEK_END) /= 0 then
raise Device_Error;
end if;
File.File_Size := Stream_Element_Offset (ftell64 (File.Stream));
if File.File_Size = -1 then
raise Use_Error;
end if;
end if;
return Count (File.File_Size);
end Size;
------------
-- Stream --
------------
function Stream (File : File_Type) return Stream_Access is
begin
FIO.Check_File_Open (AP (File));
return Stream_Access (File);
end Stream;
-----------
-- Write --
-----------
procedure Write
(File : File_Type;
Item : Stream_Element_Array;
To : Positive_Count)
is
begin
Set_Index (File, To);
Write (File, Item);
end Write;
procedure Write
(File : File_Type;
Item : Stream_Element_Array)
is
begin
FIO.Check_Write_Status (AP (File));
-- If last operation was not a write, or if in file sharing mode,
-- then reset the physical pointer of the file to match the index
-- We lock out task access over the two operations in this case.
if File.Last_Op /= Op_Write
or else File.Shared_Status = FCB.Yes
then
Locked_Processing : begin
SSL.Lock_Task.all;
Set_Position (File);
FIO.Write_Buf (AP (File), Item'Address, Item'Length);
SSL.Unlock_Task.all;
exception
when others =>
SSL.Unlock_Task.all;
raise;
end Locked_Processing;
else
FIO.Write_Buf (AP (File), Item'Address, Item'Length);
end if;
File.Index := File.Index + Item'Length;
File.Last_Op := Op_Write;
File.File_Size := -1;
end Write;
-- This version of Write is the primitive operation on the underlying
-- Stream type, used when a Stream_IO file is treated as a Stream
procedure Write
(File : in out Stream_AFCB;
Item : Ada.Streams.Stream_Element_Array)
is
begin
Write (File'Unchecked_Access, Item);
end Write;
end Ada.Streams.Stream_IO;
| 28.822811 | 79 | 0.536885 |
305b2cfba012d1ad37fab5e963786f0d1a7949b7 | 3,308 | adb | Ada | tools-src/gnu/gcc/gcc/ada/s-atacco.adb | modern-tomato/tomato | 96f09fab4929c6ddde5c9113f1b2476ad37133c4 | [
"FSFAP"
] | 80 | 2015-01-02T10:14:04.000Z | 2021-06-07T06:29:49.000Z | tools-src/gnu/gcc/gcc/ada/s-atacco.adb | modern-tomato/tomato | 96f09fab4929c6ddde5c9113f1b2476ad37133c4 | [
"FSFAP"
] | 9 | 2015-05-14T11:03:12.000Z | 2018-01-04T07:12:58.000Z | tools-src/gnu/gcc/gcc/ada/s-atacco.adb | modern-tomato/tomato | 96f09fab4929c6ddde5c9113f1b2476ad37133c4 | [
"FSFAP"
] | 69 | 2015-01-02T10:45:56.000Z | 2021-09-06T07:52:13.000Z | ------------------------------------------------------------------------------
-- --
-- GNAT COMPILER COMPONENTS --
-- --
-- S Y S T E M . A D D R E S S _ T O _ A C C E S S _ C O N V E R S I O N S --
-- --
-- B o d y --
-- --
-- $Revision$
-- --
-- Copyright (C) 1992,1993,1994 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. --
-- --
------------------------------------------------------------------------------
with Unchecked_Conversion;
package body System.Address_To_Access_Conversions is
----------------
-- To_Address --
----------------
function To_Address (Value : Object_Pointer) return Address is
begin
if Value = null then
return Null_Address;
else
return Value.all'Address;
end if;
end To_Address;
----------------
-- To_Pointer --
----------------
function To_Pointer (Value : Address) return Object_Pointer is
function A_To_P is new Unchecked_Conversion (Address, Object_Pointer);
begin
return A_To_P (Value);
end To_Pointer;
end System.Address_To_Access_Conversions;
| 51.6875 | 78 | 0.44468 |
22093c825bc707eda6fa16439618ffba45815fb1 | 244 | ads | Ada | src/q_gen_shuffle.ads | jfuica/bingada | 9e048ad6b347f0093553705cfacbc5b9473efca1 | [
"MIT"
] | 4 | 2020-05-29T19:46:05.000Z | 2022-01-13T20:51:20.000Z | src/q_gen_shuffle.ads | jfuica/bingada | 9e048ad6b347f0093553705cfacbc5b9473efca1 | [
"MIT"
] | 5 | 2020-05-05T20:29:39.000Z | 2020-09-15T19:49:50.000Z | src/q_gen_shuffle.ads | jfuica/bingada | 9e048ad6b347f0093553705cfacbc5b9473efca1 | [
"MIT"
] | 1 | 2020-04-27T19:22:44.000Z | 2020-04-27T19:22:44.000Z | generic
type Element_Type is private;
C_Max_Number : Positive;
package Q_Gen_Shuffle is
type Array_Type is array (Positive range 1 .. C_Max_Number) of Element_Type;
procedure P_Shuffle (List : in out Array_Type);
end Q_Gen_Shuffle;
| 20.333333 | 78 | 0.770492 |
3042c1de3523ae358ae169c4ee12cb6b2d849efd | 5,622 | adb | Ada | tools-src/gnu/gcc/gcc/ada/a-taside.adb | modern-tomato/tomato | 96f09fab4929c6ddde5c9113f1b2476ad37133c4 | [
"FSFAP"
] | 80 | 2015-01-02T10:14:04.000Z | 2021-06-07T06:29:49.000Z | tools-src/gnu/gcc/gcc/ada/a-taside.adb | modern-tomato/tomato | 96f09fab4929c6ddde5c9113f1b2476ad37133c4 | [
"FSFAP"
] | 9 | 2015-05-14T11:03:12.000Z | 2018-01-04T07:12:58.000Z | tools-src/gnu/gcc/gcc/ada/a-taside.adb | modern-tomato/tomato | 96f09fab4929c6ddde5c9113f1b2476ad37133c4 | [
"FSFAP"
] | 69 | 2015-01-02T10:45:56.000Z | 2021-09-06T07:52:13.000Z | ------------------------------------------------------------------------------
-- --
-- GNAT RUN-TIME COMPONENTS --
-- --
-- A D A . T A S K _ I D E N T I F I C A T I O N --
-- --
-- B o d y --
-- --
-- $Revision$
-- --
-- Copyright (C) 1992-2001 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. --
-- --
------------------------------------------------------------------------------
with System.Address_Image;
-- used for the function itself
with System.Tasking;
-- used for Task_List
with System.Tasking.Stages;
-- used for Terminated
-- Abort_Tasks
with System.Tasking.Rendezvous;
-- used for Callable
with System.Task_Primitives.Operations;
-- used for Self
with System.Task_Info;
use type System.Task_Info.Task_Image_Type;
with Unchecked_Conversion;
package body Ada.Task_Identification is
-----------------------
-- Local Subprograms --
-----------------------
function Convert_Ids (T : Task_Id) return System.Tasking.Task_ID;
function Convert_Ids (T : System.Tasking.Task_ID) return Task_Id;
pragma Inline (Convert_Ids);
-- Conversion functions between different forms of Task_Id
---------
-- "=" --
---------
function "=" (Left, Right : Task_Id) return Boolean is
begin
return System.Tasking."=" (Convert_Ids (Left), Convert_Ids (Right));
end "=";
-----------------
-- Abort_Task --
----------------
procedure Abort_Task (T : Task_Id) is
begin
if T = Null_Task_Id then
raise Program_Error;
else
System.Tasking.Stages.Abort_Tasks
(System.Tasking.Task_List'(1 => Convert_Ids (T)));
end if;
end Abort_Task;
-----------------
-- Convert_Ids --
-----------------
function Convert_Ids (T : Task_Id) return System.Tasking.Task_ID is
begin
return System.Tasking.Task_ID (T);
end Convert_Ids;
function Convert_Ids (T : System.Tasking.Task_ID) return Task_Id is
begin
return Task_Id (T);
end Convert_Ids;
------------------
-- Current_Task --
------------------
function Current_Task return Task_Id is
begin
return Convert_Ids (System.Task_Primitives.Operations.Self);
end Current_Task;
-----------
-- Image --
-----------
function Image (T : Task_Id) return String is
use System.Task_Info;
function To_Address is new
Unchecked_Conversion (Task_Id, System.Address);
begin
if T = Null_Task_Id then
return "";
elsif T.Common.Task_Image = null then
return System.Address_Image (To_Address (T));
else
return T.Common.Task_Image.all
& "_" & System.Address_Image (To_Address (T));
end if;
end Image;
-----------------
-- Is_Callable --
-----------------
function Is_Callable (T : Task_Id) return Boolean is
begin
if T = Null_Task_Id then
raise Program_Error;
else
return System.Tasking.Rendezvous.Callable (Convert_Ids (T));
end if;
end Is_Callable;
-------------------
-- Is_Terminated --
-------------------
function Is_Terminated (T : Task_Id) return Boolean is
begin
if T = Null_Task_Id then
raise Program_Error;
else
return System.Tasking.Stages.Terminated (Convert_Ids (T));
end if;
end Is_Terminated;
end Ada.Task_Identification;
| 34.490798 | 78 | 0.499644 |
13995b11eaf85b008ed78ae20d46f7cb05db2822 | 1,432 | ads | Ada | regtests/util-properties-tests.ads | Letractively/ada-util | e4c63b93635dc07c46e95f12ba02d18903b307b3 | [
"Apache-2.0"
] | null | null | null | regtests/util-properties-tests.ads | Letractively/ada-util | e4c63b93635dc07c46e95f12ba02d18903b307b3 | [
"Apache-2.0"
] | null | null | null | regtests/util-properties-tests.ads | Letractively/ada-util | e4c63b93635dc07c46e95f12ba02d18903b307b3 | [
"Apache-2.0"
] | null | null | null | -----------------------------------------------------------------------
-- Util -- Utilities
-- Copyright (C) 2009, 2010, 2011, 2014 Stephane Carrez
-- Written by Stephane Carrez ([email protected])
--
-- Licensed under the Apache License, Version 2.0 (the "License");
-- you may not use this file except in compliance with the License.
-- You may obtain a copy of the License at
--
-- http://www.apache.org/licenses/LICENSE-2.0
--
-- Unless required by applicable law or agreed to in writing, software
-- distributed under the License is distributed on an "AS IS" BASIS,
-- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-- See the License for the specific language governing permissions and
-- limitations under the License.
-----------------------------------------------------------------------
with Util.Tests;
package Util.Properties.Tests is
procedure Add_Tests (Suite : in Util.Tests.Access_Test_Suite);
type Test is new Util.Tests.Test with null record;
procedure Test_Property (T : in out Test);
procedure Test_Integer_Property (T : in out Test);
procedure Test_Load_Property (T : in out Test);
procedure Test_Load_Strip_Property (T : in out Test);
procedure Test_Copy_Property (T : in out Test);
procedure Test_Set_Preserve_Original (T : in out Test);
procedure Test_Remove_Preserve_Original (T : in out Test);
end Util.Properties.Tests;
| 39.777778 | 76 | 0.663408 |
d167ec196ed2cb35c1e1ba49151e1a42a8adf0cf | 5,030 | ads | Ada | source/amf/mof/cmof/amf-cmof-associations-collections.ads | svn2github/matreshka | 9d222b3ad9da508855fb1f5adbe5e8a4fad4c530 | [
"BSD-3-Clause"
] | 24 | 2016-11-29T06:59:41.000Z | 2021-08-30T11:55:16.000Z | source/amf/mof/cmof/amf-cmof-associations-collections.ads | svn2github/matreshka | 9d222b3ad9da508855fb1f5adbe5e8a4fad4c530 | [
"BSD-3-Clause"
] | 2 | 2019-01-16T05:15:20.000Z | 2019-02-03T10:03:32.000Z | source/amf/mof/cmof/amf-cmof-associations-collections.ads | svn2github/matreshka | 9d222b3ad9da508855fb1f5adbe5e8a4fad4c530 | [
"BSD-3-Clause"
] | 4 | 2017-07-18T07:11:05.000Z | 2020-06-21T03:02:25.000Z | ------------------------------------------------------------------------------
-- --
-- Matreshka Project --
-- --
-- Ada Modeling Framework --
-- --
-- Runtime Library Component --
-- --
------------------------------------------------------------------------------
-- --
-- Copyright © 2011-2012, Vadim Godunko <[email protected]> --
-- All rights reserved. --
-- --
-- Redistribution and use in source and binary forms, with or without --
-- modification, are permitted provided that the following conditions --
-- are met: --
-- --
-- * Redistributions of source code must retain the above copyright --
-- notice, this list of conditions and the following disclaimer. --
-- --
-- * Redistributions in binary form must reproduce the above copyright --
-- notice, this list of conditions and the following disclaimer in the --
-- documentation and/or other materials provided with the distribution. --
-- --
-- * Neither the name of the Vadim Godunko, IE nor the names of its --
-- contributors may be used to endorse or promote products derived from --
-- this software without specific prior written permission. --
-- --
-- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS --
-- "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT --
-- LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR --
-- A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT --
-- HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, --
-- SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED --
-- TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR --
-- PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF --
-- LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING --
-- NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS --
-- SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. --
-- --
------------------------------------------------------------------------------
-- $Revision$ $Date$
------------------------------------------------------------------------------
-- This file is generated, don't edit it.
------------------------------------------------------------------------------
with AMF.Generic_Collections;
package AMF.CMOF.Associations.Collections is
pragma Preelaborate;
package CMOF_Association_Collections is
new AMF.Generic_Collections
(CMOF_Association,
CMOF_Association_Access);
type Set_Of_CMOF_Association is
new CMOF_Association_Collections.Set with null record;
Empty_Set_Of_CMOF_Association : constant Set_Of_CMOF_Association;
type Ordered_Set_Of_CMOF_Association is
new CMOF_Association_Collections.Ordered_Set with null record;
Empty_Ordered_Set_Of_CMOF_Association : constant Ordered_Set_Of_CMOF_Association;
type Bag_Of_CMOF_Association is
new CMOF_Association_Collections.Bag with null record;
Empty_Bag_Of_CMOF_Association : constant Bag_Of_CMOF_Association;
type Sequence_Of_CMOF_Association is
new CMOF_Association_Collections.Sequence with null record;
Empty_Sequence_Of_CMOF_Association : constant Sequence_Of_CMOF_Association;
private
Empty_Set_Of_CMOF_Association : constant Set_Of_CMOF_Association
:= (CMOF_Association_Collections.Set with null record);
Empty_Ordered_Set_Of_CMOF_Association : constant Ordered_Set_Of_CMOF_Association
:= (CMOF_Association_Collections.Ordered_Set with null record);
Empty_Bag_Of_CMOF_Association : constant Bag_Of_CMOF_Association
:= (CMOF_Association_Collections.Bag with null record);
Empty_Sequence_Of_CMOF_Association : constant Sequence_Of_CMOF_Association
:= (CMOF_Association_Collections.Sequence with null record);
end AMF.CMOF.Associations.Collections;
| 54.673913 | 84 | 0.519085 |
03e02d635477794e403171e14946143e34c04b7d | 1,626 | ads | Ada | tools/scitools/conf/understand/ada/ada12/a-dynpri.ads | brucegua/moocos | 575c161cfa35e220f10d042e2e5ca18773691695 | [
"Apache-2.0"
] | 1 | 2020-01-20T21:26:46.000Z | 2020-01-20T21:26:46.000Z | tools/scitools/conf/understand/ada/ada12/a-dynpri.ads | brucegua/moocos | 575c161cfa35e220f10d042e2e5ca18773691695 | [
"Apache-2.0"
] | null | null | null | tools/scitools/conf/understand/ada/ada12/a-dynpri.ads | brucegua/moocos | 575c161cfa35e220f10d042e2e5ca18773691695 | [
"Apache-2.0"
] | null | null | null | ------------------------------------------------------------------------------
-- --
-- GNAT RUN-TIME COMPONENTS --
-- --
-- A D A . D Y N A M I C _ P R I O R I T I E S --
-- --
-- S p e c --
-- --
-- This specification is derived from the Ada Reference Manual for use with --
-- GNAT. In accordance with the copyright of that document, you can freely --
-- copy and modify this specification, provided that if you redistribute a --
-- modified version, any changes that you have made are clearly indicated. --
-- --
------------------------------------------------------------------------------
with System;
with Ada.Task_Identification;
package Ada.Dynamic_Priorities is
pragma Preelaborate_05;
-- In accordance with Ada 2005 AI-362
procedure Set_Priority
(Priority : System.Any_Priority;
T : Ada.Task_Identification.Task_Id :=
Ada.Task_Identification.Current_Task);
function Get_Priority
(T : Ada.Task_Identification.Task_Id :=
Ada.Task_Identification.Current_Task)
return System.Any_Priority;
end Ada.Dynamic_Priorities;
| 47.823529 | 78 | 0.394834 |
1925e0fdf11dba2b32357027eca6508a6629ca4e | 6,582 | adb | Ada | support/MinGW/lib/gcc/mingw32/9.2.0/adainclude/a-taster.adb | orb-zhuchen/Orb | 6da2404b949ac28bde786e08bf4debe4a27cd3a0 | [
"CNRI-Python-GPL-Compatible",
"MIT"
] | null | null | null | support/MinGW/lib/gcc/mingw32/9.2.0/adainclude/a-taster.adb | orb-zhuchen/Orb | 6da2404b949ac28bde786e08bf4debe4a27cd3a0 | [
"CNRI-Python-GPL-Compatible",
"MIT"
] | null | null | null | support/MinGW/lib/gcc/mingw32/9.2.0/adainclude/a-taster.adb | orb-zhuchen/Orb | 6da2404b949ac28bde786e08bf4debe4a27cd3a0 | [
"CNRI-Python-GPL-Compatible",
"MIT"
] | null | null | null | ------------------------------------------------------------------------------
-- --
-- GNAT RUN-TIME COMPONENTS --
-- --
-- A D A . T A S K _ T E R M I N A T I O N --
-- --
-- B o d y --
-- --
-- Copyright (C) 2005-2019, Free Software Foundation, Inc. --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
-- ware Foundation; either version 3, or (at your option) any later ver- --
-- sion. GNAT is distributed in the hope that it will be useful, but WITH- --
-- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY --
-- or FITNESS FOR A PARTICULAR PURPOSE. --
-- --
-- As a special exception under Section 7 of GPL version 3, you are granted --
-- additional permissions described in the GCC Runtime Library Exception, --
-- version 3.1, as published by the Free Software Foundation. --
-- --
-- You should have received a copy of the GNU General Public License and --
-- a copy of the GCC Runtime Library Exception along with this program; --
-- see the files COPYING3 and COPYING.RUNTIME respectively. If not, see --
-- <http://www.gnu.org/licenses/>. --
-- --
-- GNAT was originally developed by the GNAT team at New York University. --
-- Extensive contributions were provided by Ada Core Technologies Inc. --
-- --
------------------------------------------------------------------------------
with System.Tasking;
with System.Task_Primitives.Operations;
with System.Parameters;
with System.Soft_Links;
with Ada.Unchecked_Conversion;
package body Ada.Task_Termination is
use type Ada.Task_Identification.Task_Id;
package STPO renames System.Task_Primitives.Operations;
package SSL renames System.Soft_Links;
use System.Parameters;
-----------------------
-- Local subprograms --
-----------------------
function To_TT is new Ada.Unchecked_Conversion
(System.Tasking.Termination_Handler, Termination_Handler);
function To_ST is new Ada.Unchecked_Conversion
(Termination_Handler, System.Tasking.Termination_Handler);
function To_Task_Id is new Ada.Unchecked_Conversion
(Ada.Task_Identification.Task_Id, System.Tasking.Task_Id);
-----------------------------------
-- Current_Task_Fallback_Handler --
-----------------------------------
function Current_Task_Fallback_Handler return Termination_Handler is
begin
-- There is no need for explicit protection against race conditions
-- for this function because this function can only be executed by
-- Self, and the Fall_Back_Handler can only be modified by Self.
return To_TT (STPO.Self.Common.Fall_Back_Handler);
end Current_Task_Fallback_Handler;
-------------------------------------
-- Set_Dependents_Fallback_Handler --
-------------------------------------
procedure Set_Dependents_Fallback_Handler
(Handler : Termination_Handler)
is
Self : constant System.Tasking.Task_Id := STPO.Self;
begin
SSL.Abort_Defer.all;
if Single_Lock then
STPO.Lock_RTS;
end if;
STPO.Write_Lock (Self);
Self.Common.Fall_Back_Handler := To_ST (Handler);
STPO.Unlock (Self);
if Single_Lock then
STPO.Unlock_RTS;
end if;
SSL.Abort_Undefer.all;
end Set_Dependents_Fallback_Handler;
--------------------------
-- Set_Specific_Handler --
--------------------------
procedure Set_Specific_Handler
(T : Ada.Task_Identification.Task_Id;
Handler : Termination_Handler)
is
begin
-- Tasking_Error is raised if the task identified by T has already
-- terminated. Program_Error is raised if the value of T is
-- Null_Task_Id.
if T = Ada.Task_Identification.Null_Task_Id then
raise Program_Error;
elsif Ada.Task_Identification.Is_Terminated (T) then
raise Tasking_Error;
else
declare
Target : constant System.Tasking.Task_Id := To_Task_Id (T);
begin
SSL.Abort_Defer.all;
if Single_Lock then
STPO.Lock_RTS;
end if;
STPO.Write_Lock (Target);
Target.Common.Specific_Handler := To_ST (Handler);
STPO.Unlock (Target);
if Single_Lock then
STPO.Unlock_RTS;
end if;
SSL.Abort_Undefer.all;
end;
end if;
end Set_Specific_Handler;
----------------------
-- Specific_Handler --
----------------------
function Specific_Handler
(T : Ada.Task_Identification.Task_Id) return Termination_Handler
is
begin
-- Tasking_Error is raised if the task identified by T has already
-- terminated. Program_Error is raised if the value of T is
-- Null_Task_Id.
if T = Ada.Task_Identification.Null_Task_Id then
raise Program_Error;
elsif Ada.Task_Identification.Is_Terminated (T) then
raise Tasking_Error;
else
declare
Target : constant System.Tasking.Task_Id := To_Task_Id (T);
TH : Termination_Handler;
begin
SSL.Abort_Defer.all;
if Single_Lock then
STPO.Lock_RTS;
end if;
STPO.Write_Lock (Target);
TH := To_TT (Target.Common.Specific_Handler);
STPO.Unlock (Target);
if Single_Lock then
STPO.Unlock_RTS;
end if;
SSL.Abort_Undefer.all;
return TH;
end;
end if;
end Specific_Handler;
end Ada.Task_Termination;
| 34.28125 | 78 | 0.517776 |
3093492ef7c652c4a05b09d0a69c70ea2d366e2b | 7,629 | ads | Ada | arch/ARM/STM32/svd/stm32l151/stm32_svd-opamp.ads | morbos/Ada_Drivers_Library | a4ab26799be60997c38735f4056160c4af597ef7 | [
"BSD-3-Clause"
] | 2 | 2018-05-16T03:56:39.000Z | 2019-07-31T13:53:56.000Z | arch/ARM/STM32/svd/stm32l151/stm32_svd-opamp.ads | morbos/Ada_Drivers_Library | a4ab26799be60997c38735f4056160c4af597ef7 | [
"BSD-3-Clause"
] | null | null | null | arch/ARM/STM32/svd/stm32l151/stm32_svd-opamp.ads | morbos/Ada_Drivers_Library | a4ab26799be60997c38735f4056160c4af597ef7 | [
"BSD-3-Clause"
] | null | null | null | -- This spec has been automatically generated from STM32L151.svd
pragma Restrictions (No_Elaboration_Code);
pragma Ada_2012;
pragma Style_Checks (Off);
with HAL;
with System;
package STM32_SVD.OPAMP is
pragma Preelaborate;
---------------
-- Registers --
---------------
-- CSR_ANAWSEL array
type CSR_ANAWSEL_Field_Array is array (1 .. 3) of Boolean
with Component_Size => 1, Size => 3;
-- Type definition for CSR_ANAWSEL
type CSR_ANAWSEL_Field
(As_Array : Boolean := False)
is record
case As_Array is
when False =>
-- ANAWSEL as a value
Val : HAL.UInt3;
when True =>
-- ANAWSEL as an array
Arr : CSR_ANAWSEL_Field_Array;
end case;
end record
with Unchecked_Union, Size => 3;
for CSR_ANAWSEL_Field use record
Val at 0 range 0 .. 2;
Arr at 0 range 0 .. 2;
end record;
-- control/status register
type CSR_Register is record
-- OPAMP1 power down
OPA1PD : Boolean := True;
-- Switch 3 for OPAMP1 enable
S3SEL1 : Boolean := False;
-- Switch 4 for OPAMP1 enable
S4SEL1 : Boolean := False;
-- Switch 5 for OPAMP1 enable
S5SEL1 : Boolean := False;
-- Switch 6 for OPAMP1 enable
S6SEL1 : Boolean := False;
-- OPAMP1 offset calibration for P differential pair
OPA1CAL_L : Boolean := False;
-- OPAMP1 offset calibration for N differential pair
OPA1CAL_H : Boolean := False;
-- OPAMP1 low power mode
OPA1LPM : Boolean := False;
-- OPAMP2 power down
OPA2PD : Boolean := True;
-- Switch 3 for OPAMP2 enable
S3SEL2 : Boolean := False;
-- Switch 4 for OPAMP2 enable
S4SEL2 : Boolean := False;
-- Switch 5 for OPAMP2 enable
S5SEL2 : Boolean := False;
-- Switch 6 for OPAMP2 enable
S6SEL2 : Boolean := False;
-- OPAMP2 offset Calibration for P differential pair
OPA2CAL_L : Boolean := False;
-- OPAMP2 offset calibration for N differential pair
OPA2CAL_H : Boolean := False;
-- OPAMP2 low power mode
OPA2LPM : Boolean := False;
-- OPAMP3 power down
OPA3PD : Boolean := True;
-- Switch 3 for OPAMP3 Enable
S3SEL3 : Boolean := False;
-- Switch 4 for OPAMP3 enable
S4SEL3 : Boolean := False;
-- Switch 5 for OPAMP3 enable
S5SEL3 : Boolean := False;
-- Switch 6 for OPAMP3 enable
S6SEL3 : Boolean := False;
-- OPAMP3 offset Calibration for P differential pair
OPA3CAL_L : Boolean := False;
-- OPAMP3 offset calibration for N differential pair
OPA3CAL_H : Boolean := False;
-- OPAMP3 low power mode
OPA3LPM : Boolean := False;
-- Switch SanA enable for OPAMP1
ANAWSEL : CSR_ANAWSEL_Field := (As_Array => False, Val => 16#0#);
-- Switch 7 for OPAMP2 enable
S7SEL2 : Boolean := False;
-- Power range selection
AOP_RANGE : Boolean := False;
-- OPAMP1 calibration output
OPA1CALOUT : Boolean := False;
-- OPAMP2 calibration output
OPA2CALOUT : Boolean := False;
-- OPAMP3 calibration output
OPA3CALOUT : Boolean := False;
end record
with Volatile_Full_Access, Size => 32,
Bit_Order => System.Low_Order_First;
for CSR_Register use record
OPA1PD at 0 range 0 .. 0;
S3SEL1 at 0 range 1 .. 1;
S4SEL1 at 0 range 2 .. 2;
S5SEL1 at 0 range 3 .. 3;
S6SEL1 at 0 range 4 .. 4;
OPA1CAL_L at 0 range 5 .. 5;
OPA1CAL_H at 0 range 6 .. 6;
OPA1LPM at 0 range 7 .. 7;
OPA2PD at 0 range 8 .. 8;
S3SEL2 at 0 range 9 .. 9;
S4SEL2 at 0 range 10 .. 10;
S5SEL2 at 0 range 11 .. 11;
S6SEL2 at 0 range 12 .. 12;
OPA2CAL_L at 0 range 13 .. 13;
OPA2CAL_H at 0 range 14 .. 14;
OPA2LPM at 0 range 15 .. 15;
OPA3PD at 0 range 16 .. 16;
S3SEL3 at 0 range 17 .. 17;
S4SEL3 at 0 range 18 .. 18;
S5SEL3 at 0 range 19 .. 19;
S6SEL3 at 0 range 20 .. 20;
OPA3CAL_L at 0 range 21 .. 21;
OPA3CAL_H at 0 range 22 .. 22;
OPA3LPM at 0 range 23 .. 23;
ANAWSEL at 0 range 24 .. 26;
S7SEL2 at 0 range 27 .. 27;
AOP_RANGE at 0 range 28 .. 28;
OPA1CALOUT at 0 range 29 .. 29;
OPA2CALOUT at 0 range 30 .. 30;
OPA3CALOUT at 0 range 31 .. 31;
end record;
subtype OTR_AO1_OPT_OFFSET_TRIM_Field is HAL.UInt10;
subtype OTR_AO2_OPT_OFFSET_TRIM_Field is HAL.UInt10;
subtype OTR_AO3_OPT_OFFSET_TRIM_Field is HAL.UInt10;
-- offset trimming register for normal mode
type OTR_Register is record
-- OPAMP1, 10-bit offset trim value for normal mode
AO1_OPT_OFFSET_TRIM : OTR_AO1_OPT_OFFSET_TRIM_Field := 16#0#;
-- OPAMP2, 10-bit offset trim value for normal mode
AO2_OPT_OFFSET_TRIM : OTR_AO2_OPT_OFFSET_TRIM_Field := 16#0#;
-- OPAMP3, 10-bit offset trim value for normal mode
AO3_OPT_OFFSET_TRIM : OTR_AO3_OPT_OFFSET_TRIM_Field := 16#0#;
-- unspecified
Reserved_30_30 : HAL.Bit := 16#0#;
-- Select user or factory trimming value
OT_USER : Boolean := False;
end record
with Volatile_Full_Access, Size => 32,
Bit_Order => System.Low_Order_First;
for OTR_Register use record
AO1_OPT_OFFSET_TRIM at 0 range 0 .. 9;
AO2_OPT_OFFSET_TRIM at 0 range 10 .. 19;
AO3_OPT_OFFSET_TRIM at 0 range 20 .. 29;
Reserved_30_30 at 0 range 30 .. 30;
OT_USER at 0 range 31 .. 31;
end record;
subtype LPOTR_AO1_OPT_OFFSET_TRIM_LP_Field is HAL.UInt10;
subtype LPOTR_AO2_OPT_OFFSET_TRIM_LP_Field is HAL.UInt10;
subtype LPOTR_AO3_OPT_OFFSET_TRIM_LP_Field is HAL.UInt10;
-- OPAMP offset trimming register for low power mode
type LPOTR_Register is record
-- OPAMP1, 10-bit offset trim value for low power mode
AO1_OPT_OFFSET_TRIM_LP : LPOTR_AO1_OPT_OFFSET_TRIM_LP_Field := 16#0#;
-- OPAMP2, 10-bit offset trim value for low power mode
AO2_OPT_OFFSET_TRIM_LP : LPOTR_AO2_OPT_OFFSET_TRIM_LP_Field := 16#0#;
-- OPAMP3, 10-bit offset trim value for low power mode
AO3_OPT_OFFSET_TRIM_LP : LPOTR_AO3_OPT_OFFSET_TRIM_LP_Field := 16#0#;
-- unspecified
Reserved_30_31 : HAL.UInt2 := 16#0#;
end record
with Volatile_Full_Access, Size => 32,
Bit_Order => System.Low_Order_First;
for LPOTR_Register use record
AO1_OPT_OFFSET_TRIM_LP at 0 range 0 .. 9;
AO2_OPT_OFFSET_TRIM_LP at 0 range 10 .. 19;
AO3_OPT_OFFSET_TRIM_LP at 0 range 20 .. 29;
Reserved_30_31 at 0 range 30 .. 31;
end record;
-----------------
-- Peripherals --
-----------------
-- Operational amplifiers
type OPAMP_Peripheral is record
-- control/status register
CSR : aliased CSR_Register;
-- offset trimming register for normal mode
OTR : aliased OTR_Register;
-- OPAMP offset trimming register for low power mode
LPOTR : aliased LPOTR_Register;
end record
with Volatile;
for OPAMP_Peripheral use record
CSR at 16#0# range 0 .. 31;
OTR at 16#4# range 0 .. 31;
LPOTR at 16#8# range 0 .. 31;
end record;
-- Operational amplifiers
OPAMP_Periph : aliased OPAMP_Peripheral
with Import, Address => System'To_Address (16#40007C5C#);
end STM32_SVD.OPAMP;
| 34.835616 | 75 | 0.609516 |
9ad296fe090b2e8d2a4448fa62eb689155f5c8d1 | 5,458 | ads | Ada | gcc-gcc-7_3_0-release/gcc/ada/a-rbtgso.ads | best08618/asylo | 5a520a9f5c461ede0f32acc284017b737a43898c | [
"Apache-2.0"
] | 7 | 2020-05-02T17:34:05.000Z | 2021-10-17T10:15:18.000Z | gcc-gcc-7_3_0-release/gcc/ada/a-rbtgso.ads | best08618/asylo | 5a520a9f5c461ede0f32acc284017b737a43898c | [
"Apache-2.0"
] | null | null | null | gcc-gcc-7_3_0-release/gcc/ada/a-rbtgso.ads | best08618/asylo | 5a520a9f5c461ede0f32acc284017b737a43898c | [
"Apache-2.0"
] | 2 | 2020-07-27T00:22:36.000Z | 2021-04-01T09:41:02.000Z | ------------------------------------------------------------------------------
-- --
-- GNAT LIBRARY COMPONENTS --
-- --
-- ADA.CONTAINERS.RED_BLACK_TREES.GENERIC_SET_OPERATIONS --
-- --
-- S p e c --
-- --
-- Copyright (C) 2004-2015, Free Software Foundation, Inc. --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
-- ware Foundation; either version 3, or (at your option) any later ver- --
-- sion. GNAT is distributed in the hope that it will be useful, but WITH- --
-- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY --
-- or FITNESS FOR A PARTICULAR PURPOSE. --
-- --
-- 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. --
------------------------------------------------------------------------------
-- Tree_Type is used to implement ordered containers. This package declares
-- set-based tree operations.
with Ada.Containers.Red_Black_Trees.Generic_Operations;
generic
with package Tree_Operations is new Generic_Operations (<>);
use Tree_Operations.Tree_Types, Tree_Operations.Tree_Types.Implementation;
with procedure Insert_With_Hint
(Dst_Tree : in out Tree_Type;
Dst_Hint : Node_Access;
Src_Node : Node_Access;
Dst_Node : out Node_Access);
with function Copy_Tree (Source_Root : Node_Access)
return Node_Access;
with procedure Delete_Tree (X : in out Node_Access);
with function Is_Less (Left, Right : Node_Access) return Boolean;
with procedure Free (X : in out Node_Access);
package Ada.Containers.Red_Black_Trees.Generic_Set_Operations is
pragma Pure;
procedure Union (Target : in out Tree_Type; Source : Tree_Type);
-- Attempts to insert each element of Source in Target. If Target is
-- busy then Program_Error is raised. We say "attempts" here because
-- if these are unique-element sets, then the insertion should fail
-- (not insert a new item) when the insertion item from Source is
-- equivalent to an item already in Target. If these are multisets
-- then of course the attempt should always succeed.
function Union (Left, Right : Tree_Type) return Tree_Type;
-- Makes a copy of Left, and attempts to insert each element of
-- Right into the copy, then returns the copy.
procedure Intersection (Target : in out Tree_Type; Source : Tree_Type);
-- Removes elements from Target that are not equivalent to items in
-- Source. If Target is busy then Program_Error is raised.
function Intersection (Left, Right : Tree_Type) return Tree_Type;
-- Returns a set comprising all the items in Left equivalent to items in
-- Right.
procedure Difference (Target : in out Tree_Type; Source : Tree_Type);
-- Removes elements from Target that are equivalent to items in Source. If
-- Target is busy then Program_Error is raised.
function Difference (Left, Right : Tree_Type) return Tree_Type;
-- Returns a set comprising all the items in Left not equivalent to items
-- in Right.
procedure Symmetric_Difference
(Target : in out Tree_Type;
Source : Tree_Type);
-- Removes from Target elements that are equivalent to items in Source, and
-- inserts into Target items from Source not equivalent elements in
-- Target. If Target is busy then Program_Error is raised.
function Symmetric_Difference (Left, Right : Tree_Type) return Tree_Type;
-- Returns a set comprising the union of the elements in Left not
-- equivalent to items in Right, and the elements in Right not equivalent
-- to items in Left.
function Is_Subset (Subset : Tree_Type; Of_Set : Tree_Type) return Boolean;
-- Returns False if Subset contains at least one element not equivalent to
-- any item in Of_Set; returns True otherwise.
function Overlap (Left, Right : Tree_Type) return Boolean;
-- Returns True if at least one element of Left is equivalent to an item in
-- Right; returns False otherwise.
end Ada.Containers.Red_Black_Trees.Generic_Set_Operations;
| 51.009346 | 79 | 0.58886 |
036f088532ef7b019922561163558ad9b53afc60 | 1,907 | adb | Ada | ibv_message_passing_ada_project/source/coverage_for_ada_task/coverage_for_ada_task.adb | Chester-Gillon/ibv_message_parsing | 5b3649a4b754749a33917f43300613d4a718c960 | [
"MIT"
] | null | null | null | ibv_message_passing_ada_project/source/coverage_for_ada_task/coverage_for_ada_task.adb | Chester-Gillon/ibv_message_parsing | 5b3649a4b754749a33917f43300613d4a718c960 | [
"MIT"
] | null | null | null | ibv_message_passing_ada_project/source/coverage_for_ada_task/coverage_for_ada_task.adb | Chester-Gillon/ibv_message_parsing | 5b3649a4b754749a33917f43300613d4a718c960 | [
"MIT"
] | null | null | null | -- @file coverage_for_ada_task.adb
-- @date 28 May 2022
-- @author Chester Gillon
-- @brief Example program to test getting coverage for an Ada task
with Ada.Text_IO;
with Ada.Command_Line;
procedure Coverage_For_Ada_Task is
generic
Name : String;
package Generic_Name is
procedure Display_Name;
end Generic_Name;
package body Generic_Name is
procedure Display_Name is
begin
Ada.Text_IO.Put_Line ("My name is " & Name);
end Display_Name;
end Generic_Name;
task Print_Task is
entry Print;
entry Finish;
end Print_Task;
task body Print_Task is
Finished : Boolean := False;
begin
while not Finished
loop
select
accept Print do
Ada.Text_IO.Put_Line ("In task Print_Task");
end Print;
or
accept Finish do
Finished := True;
end Finish;
or
terminate;
end select;
end loop;
end Print_Task;
package Package_A is new Generic_Name ("A");
package Package_B is new Generic_Name ("B");
package Package_C is new Generic_Name ("C");
begin
Package_A.Display_Name;
if Ada.Command_Line.Argument_Count > 0 then
-- If any command line arguments are passed call the generic function 'B'. This is to test getting coverage
-- from only certain generic packages.
Package_B.Display_Name;
end if;
for index in 1..3
loop
Print_Task.Print;
end loop;
Package_C.Display_Name;
Ada.Text_IO.Put_Line ("In main");
-- If any command line arguments are passed cause the task to execute the Finish entry point, otherwise leave to the
-- terminate alternate. This is to demonstrate getting coverage on only certain task entry points.
if Ada.Command_Line.Argument_Count > 0 then
Print_Task.Finish;
end if;
end Coverage_For_Ada_Task;
| 26.859155 | 119 | 0.659675 |
d1ad7012bf4f13b90614ddb126a158388a920b4f | 2,727 | ads | Ada | support/MinGW/lib/gcc/mingw32/9.2.0/adainclude/s-tadeca.ads | orb-zhuchen/Orb | 6da2404b949ac28bde786e08bf4debe4a27cd3a0 | [
"CNRI-Python-GPL-Compatible",
"MIT"
] | null | null | null | support/MinGW/lib/gcc/mingw32/9.2.0/adainclude/s-tadeca.ads | orb-zhuchen/Orb | 6da2404b949ac28bde786e08bf4debe4a27cd3a0 | [
"CNRI-Python-GPL-Compatible",
"MIT"
] | null | null | null | support/MinGW/lib/gcc/mingw32/9.2.0/adainclude/s-tadeca.ads | orb-zhuchen/Orb | 6da2404b949ac28bde786e08bf4debe4a27cd3a0 | [
"CNRI-Python-GPL-Compatible",
"MIT"
] | null | null | null | ------------------------------------------------------------------------------
-- --
-- GNAT RUN-TIME LIBRARY (GNARL) COMPONENTS --
-- --
-- SYSTEM.TASKING.ASYNC_DELAYS.ENQUEUE_CALENDAR --
-- --
-- S p e c --
-- --
-- Copyright (C) 1998-2019, Free Software Foundation, Inc. --
-- --
-- GNARL is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
-- ware Foundation; either version 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/>. --
-- --
-- GNARL was developed by the GNARL team at Florida State University. --
-- Extensive contributions were provided by Ada Core Technologies, Inc. --
-- --
------------------------------------------------------------------------------
-- Note: the compiler generates direct calls to this interface, via Rtsfind.
-- Any changes to this interface may require corresponding compiler changes.
-- See comments in package System.Tasking.Async_Delays
with Ada.Calendar;
function System.Tasking.Async_Delays.Enqueue_Calendar
(T : Ada.Calendar.Time;
D : Delay_Block_Access) return Boolean;
| 66.512195 | 78 | 0.433443 |
d1d6b4246473258d3c39c167f9165ec3f152a879 | 739 | ads | Ada | orka_simd/src/x86/gnat/orka-simd-sse3-doubles.ads | onox/orka | 9edf99559a16ffa96dfdb208322f4d18efbcbac6 | [
"Apache-2.0"
] | 52 | 2016-07-30T23:00:28.000Z | 2022-02-05T11:54:55.000Z | orka_simd/src/x86/gnat/orka-simd-sse3-doubles.ads | onox/orka | 9edf99559a16ffa96dfdb208322f4d18efbcbac6 | [
"Apache-2.0"
] | 79 | 2016-08-01T18:36:48.000Z | 2022-02-27T12:14:20.000Z | orka_simd/src/x86/gnat/orka-simd-sse3-doubles.ads | onox/orka | 9edf99559a16ffa96dfdb208322f4d18efbcbac6 | [
"Apache-2.0"
] | 4 | 2018-04-28T22:36:26.000Z | 2020-11-14T23:00:29.000Z | -- SPDX-License-Identifier: Apache-2.0
--
-- Copyright (c) 2016 onox <[email protected]>
--
-- Licensed under the Apache License, Version 2.0 (the "License");
-- you may not use this file except in compliance with the License.
-- You may obtain a copy of the License at
--
-- http://www.apache.org/licenses/LICENSE-2.0
--
-- Unless required by applicable law or agreed to in writing, software
-- distributed under the License is distributed on an "AS IS" BASIS,
-- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-- See the License for the specific language governing permissions and
-- limitations under the License.
package Orka.SIMD.SSE3.Doubles is
pragma Pure;
end Orka.SIMD.SSE3.Doubles;
| 36.95 | 76 | 0.730717 |
5e55df7dfe1f18a7a1043c27d7fa4830344595c7 | 4,647 | ads | Ada | bb-runtimes/runtimes/ravenscar-full-stm32f3x4/gnat/a-stunau.ads | JCGobbi/Nucleo-STM32F334R8 | 2a0b1b4b2664c92773703ac5e95dcb71979d051c | [
"BSD-3-Clause"
] | null | null | null | bb-runtimes/runtimes/ravenscar-full-stm32f3x4/gnat/a-stunau.ads | JCGobbi/Nucleo-STM32F334R8 | 2a0b1b4b2664c92773703ac5e95dcb71979d051c | [
"BSD-3-Clause"
] | null | null | null | bb-runtimes/runtimes/ravenscar-full-stm32f3x4/gnat/a-stunau.ads | JCGobbi/Nucleo-STM32F334R8 | 2a0b1b4b2664c92773703ac5e95dcb71979d051c | [
"BSD-3-Clause"
] | null | null | null | ------------------------------------------------------------------------------
-- --
-- GNAT RUN-TIME COMPONENTS --
-- --
-- A D A . S T R I N G S . U N B O U N D E D . A U X --
-- --
-- S p e c --
-- --
-- Copyright (C) 1992-2021, 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 child package of Ada.Strings.Unbounded provides some specialized
-- access functions which are intended to allow more efficient use of the
-- facilities of Ada.Strings.Unbounded, particularly by other layered
-- utilities (such as GNAT.SPITBOL.Patterns).
package Ada.Strings.Unbounded.Aux is
pragma Preelaborate;
subtype Big_String is String (1 .. Positive'Last);
pragma Suppress_Initialization (Big_String);
-- Type used to obtain string access to given address. Initialization is
-- suppressed, since we never want to have variables of this type, and
-- we never want to attempt initialiazation of virtual variables of this
-- type (e.g. when pragma Normalize_Scalars is used).
type Big_String_Access is access all Big_String;
for Big_String_Access'Storage_Size use 0;
-- We use this access type to pass a pointer to an area of storage to be
-- accessed as a string. Of course when this pointer is used, it is the
-- responsibility of the accessor to ensure proper bounds. The storage
-- size clause ensures we do not allocate variables of this type.
procedure Get_String
(U : Unbounded_String;
S : out Big_String_Access;
L : out Natural);
pragma Inline (Get_String);
-- Return the internal string pointer used in the representation of an
-- unbounded string as well as the actual current length (which may be less
-- than S.all'Length because in general there can be extra space assigned).
-- The characters of this string may be not be modified via the returned
-- pointer, and are valid only as long as the original unbounded string is
-- not accessed or modified.
--
-- This procedure is much more efficient than the use of To_String
-- since it avoids the need to copy the string. The lower bound of the
-- referenced string returned by this call is always one, so the actual
-- string data is always accessible as S (1 .. L).
procedure Set_String
(U : out Unbounded_String;
Length : Positive;
Set : not null access procedure (S : out String));
pragma Inline (Set_String);
-- Create an unbounded string U with the given Length, using Set to fill
-- the contents of U.
end Ada.Strings.Unbounded.Aux;
| 58.0875 | 79 | 0.504842 |
8b9d878e89fecc67165d139e3bfc68515aa6e295 | 710 | ads | Ada | tests/tk-labelframe-label_frame_options_test_data-label_frame_options_tests.ads | thindil/tashy2 | 43fcbadb33c0062b2c8d6138a8238441dec5fd80 | [
"Apache-2.0"
] | 2 | 2020-12-09T07:27:07.000Z | 2021-10-19T13:31:54.000Z | tests/tk-labelframe-label_frame_options_test_data-label_frame_options_tests.ads | thindil/tashy2 | 43fcbadb33c0062b2c8d6138a8238441dec5fd80 | [
"Apache-2.0"
] | null | null | null | tests/tk-labelframe-label_frame_options_test_data-label_frame_options_tests.ads | thindil/tashy2 | 43fcbadb33c0062b2c8d6138a8238441dec5fd80 | [
"Apache-2.0"
] | null | null | null | -- This package has been generated automatically by GNATtest.
-- Do not edit any part of it, see GNATtest documentation for more details.
-- begin read only
with GNATtest_Generated;
package Tk.Labelframe.Label_Frame_Options_Test_Data.Label_Frame_Options_Tests
is
type Test_Label_Frame_Options is new GNATtest_Generated.GNATtest_Standard.Tk
.Labelframe
.Label_Frame_Options_Test_Data
.Test_Label_Frame_Options with
null record;
procedure Test_Configure_0076be_d66704
(Gnattest_T: in out Test_Label_Frame_Options);
-- tk-labelframe.ads:90:4:Configure:Test_Configure_Label_Frame
end Tk.Labelframe.Label_Frame_Options_Test_Data.Label_Frame_Options_Tests;
-- end read only
| 32.272727 | 79 | 0.808451 |
5e601dddc23b7f075606fe2000f77be4eb0922d6 | 2,356 | adb | Ada | src/ada/i686/lsc-internal-byteswap32.adb | Componolit/libsparkcrypto | 8531a07b6e9f5eb33eae0fa32759b4cbd3509d95 | [
"OpenSSL",
"Unlicense"
] | 30 | 2018-05-18T09:11:50.000Z | 2021-05-18T16:29:14.000Z | src/ada/x86_64/lsc-internal-byteswap32.adb | Componolit/libsparkcrypto | 8531a07b6e9f5eb33eae0fa32759b4cbd3509d95 | [
"OpenSSL",
"Unlicense"
] | 15 | 2018-12-13T07:53:36.000Z | 2019-09-24T19:43:35.000Z | src/ada/x86_64/lsc-internal-byteswap32.adb | Componolit/libsparkcrypto | 8531a07b6e9f5eb33eae0fa32759b4cbd3509d95 | [
"OpenSSL",
"Unlicense"
] | 3 | 2019-04-04T17:41:29.000Z | 2021-05-07T22:28:46.000Z | -------------------------------------------------------------------------------
-- This file is part of libsparkcrypto.
--
-- Copyright (C) 2010, Alexander Senier
-- Copyright (C) 2010, secunet Security Networks AG
-- All rights reserved.
--
-- Redistribution and use in source and binary forms, with or without
-- modification, are permitted provided that the following conditions are met:
--
-- * Redistributions of source code must retain the above copyright notice,
-- this list of conditions and the following disclaimer.
--
-- * Redistributions in binary form must reproduce the above copyright
-- notice, this list of conditions and the following disclaimer in the
-- documentation and/or other materials provided with the distribution.
--
-- * Neither the name of the nor the names of its contributors may be used
-- to endorse or promote products derived from this software without
-- specific prior written permission.
--
-- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
-- AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-- IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
-- ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS
-- BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
-- CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
-- SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
-- INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
-- CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
-- ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
-- POSSIBILITY OF SUCH DAMAGE.
-------------------------------------------------------------------------------
with System.Machine_Code;
package body LSC.Internal.Byteswap32
with SPARK_Mode => Off
is
function Swap (Value : Types.Word32) return Types.Word32
is
Result : Types.Word32;
begin
System.Machine_Code.Asm
("bswap %0",
Inputs => (Types.Word32'Asm_Input ("0", Value)),
Outputs => (Types.Word32'Asm_Output ("=r", Result)),
Volatile => True);
return Result;
end Swap;
end LSC.Internal.Byteswap32;
| 43.62963 | 79 | 0.66129 |
5ea120dbc3077ea32f15c1cf8d4624b9cc857b2b | 15,177 | adb | Ada | llvm-gcc-4.2-2.9/gcc/ada/s-tratas-default.adb | vidkidz/crossbridge | ba0bf94aee0ce6cf7eb5be882382e52bc57ba396 | [
"MIT"
] | 1 | 2016-04-09T02:58:13.000Z | 2016-04-09T02:58:13.000Z | llvm-gcc-4.2-2.9/gcc/ada/s-tratas-default.adb | vidkidz/crossbridge | ba0bf94aee0ce6cf7eb5be882382e52bc57ba396 | [
"MIT"
] | null | null | null | llvm-gcc-4.2-2.9/gcc/ada/s-tratas-default.adb | vidkidz/crossbridge | ba0bf94aee0ce6cf7eb5be882382e52bc57ba396 | [
"MIT"
] | null | null | null | ------------------------------------------------------------------------------
-- --
-- GNAT RUN-TIME LIBRARY (GNARL) COMPONENTS --
-- --
-- S Y S T E M . T R A C E S . T A S K I N G --
-- --
-- B o d y --
-- --
-- Copyright (C) 2001-2005 Free Software Foundation, Inc. --
-- --
-- GNARL is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
-- ware Foundation; either version 2, or (at your option) any later ver- --
-- sion. GNARL is distributed in the hope that it will be useful, but WITH- --
-- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY --
-- or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License --
-- for more details. You should have received a copy of the GNU General --
-- Public License distributed with GNARL; see file COPYING. If not, write --
-- to the Free Software Foundation, 51 Franklin Street, Fifth Floor, --
-- Boston, MA 02110-1301, USA. --
-- --
-- As a special exception, if other files instantiate generics from this --
-- unit, or you link this unit with other files to produce an executable, --
-- this unit does not by itself cause the resulting executable to be --
-- covered by the GNU General Public License. This exception does not --
-- however invalidate any other reasons why the executable file might be --
-- covered by the GNU Public License. --
-- --
-- GNAT was originally developed by the GNAT team at New York University. --
-- Extensive contributions were provided by Ada Core Technologies Inc. --
-- --
------------------------------------------------------------------------------
with System.Tasking; use System.Tasking;
with System.Soft_Links;
with System.Parameters;
with System.Traces.Format; use System.Traces.Format;
with System.Traces; use System.Traces;
package body System.Traces.Tasking is
use System.Traces;
package SSL renames System.Soft_Links;
function Extract_Accepts (Task_Name : Task_Id) return String_Trace;
-- This function is used to extract data joined with
-- W_Select, WT_Select, W_Accept events
---------------------
-- Send_Trace_Info --
---------------------
procedure Send_Trace_Info (Id : Trace_T; Task_Name2 : Task_Id) is
Task_S : constant String := SSL.Task_Name.all;
Task2_S : constant String :=
Task_Name2.Common.Task_Image
(1 .. Task_Name2.Common.Task_Image_Len);
Trace_S : String (1 .. 6 + Task_S'Length + Task2_S'Length);
L0 : constant Integer := Task_S'Length;
L1 : constant Integer := Task2_S'Length;
begin
if Parameters.Runtime_Traces then
case Id is
when M_RDV_Complete | PO_Done =>
Trace_S (1 .. 3) := "/N:";
Trace_S (4 .. 3 + L0) := Task_S;
Trace_S (4 + L0 .. 6 + L0) := "/C:";
Trace_S (7 + L0 .. Trace_S'Last) := Task2_S;
Send_Trace (Id, Trace_S);
when E_Missed =>
Trace_S (1 .. 3) := "/N:";
Trace_S (4 .. 3 + L0) := Task_S;
Trace_S (4 + L0 .. 6 + L0) := "/A:";
Trace_S (7 + L0 .. Trace_S'Last) := Task2_S;
Send_Trace (Id, Trace_S);
when E_Kill =>
Trace_S (1 .. 3) := "/N:";
Trace_S (4 .. 3 + L1) := Task2_S;
Trace_S (4 + L1 .. Trace_S'Last) := (others => ' ');
Send_Trace (Id, Trace_S);
when T_Create =>
Trace_S (1 .. 3) := "/N:";
Trace_S (4 .. 3 + L1) := Task2_S;
Trace_S (4 + L1 .. Trace_S'Last) := (others => ' ');
Send_Trace (Id, Trace_S);
when others =>
null;
-- should raise an exception ???
end case;
end if;
end Send_Trace_Info;
procedure Send_Trace_Info
(Id : Trace_T;
Task_Name2 : Task_Id;
Entry_Number : Entry_Index)
is
Task_S : constant String := SSL.Task_Name.all;
Task2_S : constant String :=
Task_Name2.Common.Task_Image
(1 .. Task_Name2.Common.Task_Image_Len);
Entry_S : constant String := Integer'Image (Integer (Entry_Number));
Trace_S : String (1 .. 9 + Task_S'Length
+ Task2_S'Length + Entry_S'Length);
L0 : constant Integer := Task_S'Length;
L1 : constant Integer := Task_S'Length + Entry_S'Length;
L2 : constant Integer := Task_S'Length + Task2_S'Length;
begin
if Parameters.Runtime_Traces then
case Id is
when M_Accept_Complete =>
Trace_S (1 .. 3) := "/N:";
Trace_S (4 .. 3 + L0) := Task_S;
Trace_S (4 + L0 .. 6 + L0) := "/E:";
Trace_S (7 + L0 .. 6 + L1) := Entry_S;
Trace_S (7 + L1 .. 9 + L1) := "/C:";
Trace_S (10 + L1 .. Trace_S'Last) := Task2_S;
Send_Trace (Id, Trace_S);
when W_Call =>
Trace_S (1 .. 3) := "/N:";
Trace_S (4 .. 3 + L0) := Task_S;
Trace_S (4 + L0 .. 6 + L0) := "/A:";
Trace_S (7 + L0 .. 6 + L2) := Task2_S;
Trace_S (7 + L2 .. 9 + L2) := "/C:";
Trace_S (10 + L2 .. Trace_S'Last) := Entry_S;
Send_Trace (Id, Trace_S);
when others =>
null;
-- should raise an exception ???
end case;
end if;
end Send_Trace_Info;
procedure Send_Trace_Info
(Id : Trace_T;
Task_Name : Task_Id;
Task_Name2 : Task_Id;
Entry_Number : Entry_Index)
is
Task_S : constant String :=
Task_Name.Common.Task_Image
(1 .. Task_Name.Common.Task_Image_Len);
Task2_S : constant String :=
Task_Name2.Common.Task_Image
(1 .. Task_Name2.Common.Task_Image_Len);
Entry_S : constant String := Integer'Image (Integer (Entry_Number));
Trace_S : String (1 .. 9 + Task_S'Length
+ Task2_S'Length + Entry_S'Length);
L0 : constant Integer := Task_S'Length;
L1 : constant Integer := Task_S'Length + Entry_S'Length;
begin
if Parameters.Runtime_Traces then
case Id is
when PO_Run =>
Trace_S (1 .. 3) := "/N:";
Trace_S (4 .. 3 + L0) := Task_S;
Trace_S (4 + L0 .. 6 + L0) := "/E:";
Trace_S (7 + L0 .. 6 + L1) := Entry_S;
Trace_S (7 + L1 .. 9 + L1) := "/C:";
Trace_S (10 + L1 .. Trace_S'Last) := Task2_S;
Send_Trace (Id, Trace_S);
when others =>
null;
-- should raise an exception ???
end case;
end if;
end Send_Trace_Info;
procedure Send_Trace_Info (Id : Trace_T; Entry_Number : Entry_Index) is
Task_S : constant String := SSL.Task_Name.all;
Entry_S : constant String := Integer'Image (Integer (Entry_Number));
Trace_S : String (1 .. 6 + Task_S'Length + Entry_S'Length);
L0 : constant Integer := Task_S'Length;
begin
if Parameters.Runtime_Traces then
Trace_S (1 .. 3) := "/N:";
Trace_S (4 .. 3 + L0) := Task_S;
Trace_S (4 + L0 .. 6 + L0) := "/E:";
Trace_S (7 + L0 .. Trace_S'Last) := Entry_S;
Send_Trace (Id, Trace_S);
end if;
end Send_Trace_Info;
procedure Send_Trace_Info
(Id : Trace_T;
Task_Name : Task_Id;
Task_Name2 : Task_Id)
is
Task_S : constant String :=
Task_Name.Common.Task_Image
(1 .. Task_Name.Common.Task_Image_Len);
Task2_S : constant String :=
Task_Name2.Common.Task_Image
(1 .. Task_Name2.Common.Task_Image_Len);
Trace_S : String (1 .. 6 + Task_S'Length + Task2_S'Length);
L0 : constant Integer := Task2_S'Length;
begin
if Parameters.Runtime_Traces then
Trace_S (1 .. 3) := "/N:";
Trace_S (4 .. 3 + L0) := Task2_S;
Trace_S (4 + L0 .. 6 + L0) := "/P:";
Trace_S (7 + L0 .. Trace_S'Last) := Task_S;
Send_Trace (Id, Trace_S);
end if;
end Send_Trace_Info;
procedure Send_Trace_Info
(Id : Trace_T;
Acceptor : Task_Id;
Entry_Number : Entry_Index;
Timeout : Duration)
is
Task_S : constant String := SSL.Task_Name.all;
Acceptor_S : constant String :=
Acceptor.Common.Task_Image
(1 .. Acceptor.Common.Task_Image_Len);
Entry_S : constant String := Integer'Image (Integer (Entry_Number));
Timeout_S : constant String := Duration'Image (Timeout);
Trace_S : String (1 .. 12 + Task_S'Length + Acceptor_S'Length
+ Entry_S'Length + Timeout_S'Length);
L0 : constant Integer := Task_S'Length;
L1 : constant Integer := Task_S'Length + Acceptor_S'Length;
L2 : constant Integer :=
Task_S'Length + Acceptor_S'Length + Entry_S'Length;
begin
if Parameters.Runtime_Traces then
Trace_S (1 .. 3) := "/N:";
Trace_S (4 .. 3 + L0) := Task_S;
Trace_S (4 + L0 .. 6 + L0) := "/A:";
Trace_S (7 + L0 .. 6 + L1) := Acceptor_S;
Trace_S (7 + L1 .. 9 + L1) := "/E:";
Trace_S (10 + L1 .. 9 + L2) := Entry_S;
Trace_S (10 + L2 .. 12 + L2) := "/T:";
Trace_S (13 + L2 .. Trace_S'Last) := Timeout_S;
Send_Trace (Id, Trace_S);
end if;
end Send_Trace_Info;
procedure Send_Trace_Info
(Id : Trace_T;
Entry_Number : Entry_Index;
Timeout : Duration)
is
Task_S : constant String := SSL.Task_Name.all;
Entry_S : constant String := Integer'Image (Integer (Entry_Number));
Timeout_S : constant String := Duration'Image (Timeout);
Trace_S : String (1 .. 9 + Task_S'Length
+ Entry_S'Length + Timeout_S'Length);
L0 : constant Integer := Task_S'Length;
L1 : constant Integer := Task_S'Length + Entry_S'Length;
begin
if Parameters.Runtime_Traces then
Trace_S (1 .. 3) := "/N:";
Trace_S (4 .. 3 + L0) := Task_S;
Trace_S (4 + L0 .. 6 + L0) := "/E:";
Trace_S (7 + L0 .. 6 + L1) := Entry_S;
Trace_S (7 + L1 .. 9 + L1) := "/T:";
Trace_S (10 + L1 .. Trace_S'Last) := Timeout_S;
Send_Trace (Id, Trace_S);
end if;
end Send_Trace_Info;
procedure Send_Trace_Info
(Id : Trace_T;
Task_Name : Task_Id;
Number : Integer)
is
Task_S : constant String := SSL.Task_Name.all;
Number_S : constant String := Integer'Image (Number);
Accepts_S : constant String := Extract_Accepts (Task_Name);
Trace_S : String (1 .. 9 + Task_S'Length
+ Number_S'Length + Accepts_S'Length);
L0 : constant Integer := Task_S'Length;
L1 : constant Integer := Task_S'Length + Number_S'Length;
begin
if Parameters.Runtime_Traces then
Trace_S (1 .. 3) := "/N:";
Trace_S (4 .. 3 + L0) := Task_S;
Trace_S (4 + L0 .. 6 + L0) := "/#:";
Trace_S (7 + L0 .. 6 + L1) := Number_S;
Trace_S (7 + L1 .. 9 + L1) := "/E:";
Trace_S (10 + L1 .. Trace_S'Last) := Accepts_S;
Send_Trace (Id, Trace_S);
end if;
end Send_Trace_Info;
procedure Send_Trace_Info
(Id : Trace_T;
Task_Name : Task_Id;
Number : Integer;
Timeout : Duration)
is
Task_S : constant String := SSL.Task_Name.all;
Timeout_S : constant String := Duration'Image (Timeout);
Number_S : constant String := Integer'Image (Number);
Accepts_S : constant String := Extract_Accepts (Task_Name);
Trace_S : String (1 .. 12 + Task_S'Length + Timeout_S'Length
+ Number_S'Length + Accepts_S'Length);
L0 : constant Integer := Task_S'Length;
L1 : constant Integer := Task_S'Length + Timeout_S'Length;
L2 : constant Integer :=
Task_S'Length + Timeout_S'Length + Number_S'Length;
begin
if Parameters.Runtime_Traces then
Trace_S (1 .. 3) := "/N:";
Trace_S (4 .. 3 + L0) := Task_S;
Trace_S (4 + L0 .. 6 + L0) := "/T:";
Trace_S (7 + L0 .. 6 + L1) := Timeout_S;
Trace_S (7 + L1 .. 9 + L1) := "/#:";
Trace_S (10 + L1 .. 9 + L2) := Number_S;
Trace_S (10 + L2 .. 12 + L2) := "/E:";
Trace_S (13 + L2 .. Trace_S'Last) := Accepts_S;
Send_Trace (Id, Trace_S);
end if;
end Send_Trace_Info;
---------------------
-- Extract_Accepts --
---------------------
-- This function returns a string in which all opened
-- Accepts or Selects are given, separated by semi-colons.
function Extract_Accepts (Task_Name : Task_Id) return String_Trace is
Info_Annex : String_Trace := (ASCII.NUL, others => ' ');
begin
for J in Task_Name.Open_Accepts'First ..
Task_Name.Open_Accepts'Last - 1
loop
Info_Annex := Append (Info_Annex, Integer'Image
(Integer (Task_Name.Open_Accepts (J).S)) & ",");
end loop;
Info_Annex := Append (Info_Annex,
Integer'Image (Integer
(Task_Name.Open_Accepts
(Task_Name.Open_Accepts'Last).S)));
return Info_Annex;
end Extract_Accepts;
end System.Traces.Tasking;
| 41.241848 | 79 | 0.482111 |
19920f92ad5d708d7f5741267c37dec6dce60082 | 39,283 | ads | Ada | arch/ARM/STM32/svd/stm32l0x3/stm32_svd-usb.ads | morbos/Ada_Drivers_Library | a4ab26799be60997c38735f4056160c4af597ef7 | [
"BSD-3-Clause"
] | 2 | 2018-05-16T03:56:39.000Z | 2019-07-31T13:53:56.000Z | arch/ARM/STM32/svd/stm32l0x3/stm32_svd-usb.ads | morbos/Ada_Drivers_Library | a4ab26799be60997c38735f4056160c4af597ef7 | [
"BSD-3-Clause"
] | null | null | null | arch/ARM/STM32/svd/stm32l0x3/stm32_svd-usb.ads | morbos/Ada_Drivers_Library | a4ab26799be60997c38735f4056160c4af597ef7 | [
"BSD-3-Clause"
] | null | null | null | -- This spec has been automatically generated from STM32L0x3.svd
pragma Restrictions (No_Elaboration_Code);
pragma Ada_2012;
pragma Style_Checks (Off);
with HAL;
with System;
package STM32_SVD.USB is
pragma Preelaborate;
---------------
-- Registers --
---------------
subtype EP0R_EA_Field is HAL.UInt4;
subtype EP0R_STAT_TX_Field is HAL.UInt2;
subtype EP0R_EPTYPE_Field is HAL.UInt2;
subtype EP0R_STAT_RX_Field is HAL.UInt2;
-- endpoint register
type EP0R_Register is record
-- EA
EA : EP0R_EA_Field := 16#0#;
-- STAT_TX
STAT_TX : EP0R_STAT_TX_Field := 16#0#;
-- DTOG_TX
DTOG_TX : Boolean := False;
-- CTR_TX
CTR_TX : Boolean := False;
-- EP_KIND
EP_KIND : Boolean := False;
-- EPTYPE
EPTYPE : EP0R_EPTYPE_Field := 16#0#;
-- SETUP
SETUP : Boolean := False;
-- STAT_RX
STAT_RX : EP0R_STAT_RX_Field := 16#0#;
-- DTOG_RX
DTOG_RX : Boolean := False;
-- CTR_RX
CTR_RX : Boolean := False;
-- unspecified
Reserved_16_31 : HAL.UInt16 := 16#0#;
end record
with Volatile_Full_Access, Size => 32,
Bit_Order => System.Low_Order_First;
for EP0R_Register use record
EA at 0 range 0 .. 3;
STAT_TX at 0 range 4 .. 5;
DTOG_TX at 0 range 6 .. 6;
CTR_TX at 0 range 7 .. 7;
EP_KIND at 0 range 8 .. 8;
EPTYPE at 0 range 9 .. 10;
SETUP at 0 range 11 .. 11;
STAT_RX at 0 range 12 .. 13;
DTOG_RX at 0 range 14 .. 14;
CTR_RX at 0 range 15 .. 15;
Reserved_16_31 at 0 range 16 .. 31;
end record;
subtype EP1R_EA_Field is HAL.UInt4;
subtype EP1R_STAT_TX_Field is HAL.UInt2;
subtype EP1R_EPTYPE_Field is HAL.UInt2;
subtype EP1R_STAT_RX_Field is HAL.UInt2;
-- endpoint register
type EP1R_Register is record
-- EA
EA : EP1R_EA_Field := 16#0#;
-- STAT_TX
STAT_TX : EP1R_STAT_TX_Field := 16#0#;
-- DTOG_TX
DTOG_TX : Boolean := False;
-- CTR_TX
CTR_TX : Boolean := False;
-- EP_KIND
EP_KIND : Boolean := False;
-- EPTYPE
EPTYPE : EP1R_EPTYPE_Field := 16#0#;
-- SETUP
SETUP : Boolean := False;
-- STAT_RX
STAT_RX : EP1R_STAT_RX_Field := 16#0#;
-- DTOG_RX
DTOG_RX : Boolean := False;
-- CTR_RX
CTR_RX : Boolean := False;
-- unspecified
Reserved_16_31 : HAL.UInt16 := 16#0#;
end record
with Volatile_Full_Access, Size => 32,
Bit_Order => System.Low_Order_First;
for EP1R_Register use record
EA at 0 range 0 .. 3;
STAT_TX at 0 range 4 .. 5;
DTOG_TX at 0 range 6 .. 6;
CTR_TX at 0 range 7 .. 7;
EP_KIND at 0 range 8 .. 8;
EPTYPE at 0 range 9 .. 10;
SETUP at 0 range 11 .. 11;
STAT_RX at 0 range 12 .. 13;
DTOG_RX at 0 range 14 .. 14;
CTR_RX at 0 range 15 .. 15;
Reserved_16_31 at 0 range 16 .. 31;
end record;
subtype EP2R_EA_Field is HAL.UInt4;
subtype EP2R_STAT_TX_Field is HAL.UInt2;
subtype EP2R_EPTYPE_Field is HAL.UInt2;
subtype EP2R_STAT_RX_Field is HAL.UInt2;
-- endpoint register
type EP2R_Register is record
-- EA
EA : EP2R_EA_Field := 16#0#;
-- STAT_TX
STAT_TX : EP2R_STAT_TX_Field := 16#0#;
-- DTOG_TX
DTOG_TX : Boolean := False;
-- CTR_TX
CTR_TX : Boolean := False;
-- EP_KIND
EP_KIND : Boolean := False;
-- EPTYPE
EPTYPE : EP2R_EPTYPE_Field := 16#0#;
-- SETUP
SETUP : Boolean := False;
-- STAT_RX
STAT_RX : EP2R_STAT_RX_Field := 16#0#;
-- DTOG_RX
DTOG_RX : Boolean := False;
-- CTR_RX
CTR_RX : Boolean := False;
-- unspecified
Reserved_16_31 : HAL.UInt16 := 16#0#;
end record
with Volatile_Full_Access, Size => 32,
Bit_Order => System.Low_Order_First;
for EP2R_Register use record
EA at 0 range 0 .. 3;
STAT_TX at 0 range 4 .. 5;
DTOG_TX at 0 range 6 .. 6;
CTR_TX at 0 range 7 .. 7;
EP_KIND at 0 range 8 .. 8;
EPTYPE at 0 range 9 .. 10;
SETUP at 0 range 11 .. 11;
STAT_RX at 0 range 12 .. 13;
DTOG_RX at 0 range 14 .. 14;
CTR_RX at 0 range 15 .. 15;
Reserved_16_31 at 0 range 16 .. 31;
end record;
subtype EP3R_EA_Field is HAL.UInt4;
subtype EP3R_STAT_TX_Field is HAL.UInt2;
subtype EP3R_EPTYPE_Field is HAL.UInt2;
subtype EP3R_STAT_RX_Field is HAL.UInt2;
-- endpoint register
type EP3R_Register is record
-- EA
EA : EP3R_EA_Field := 16#0#;
-- STAT_TX
STAT_TX : EP3R_STAT_TX_Field := 16#0#;
-- DTOG_TX
DTOG_TX : Boolean := False;
-- CTR_TX
CTR_TX : Boolean := False;
-- EP_KIND
EP_KIND : Boolean := False;
-- EPTYPE
EPTYPE : EP3R_EPTYPE_Field := 16#0#;
-- SETUP
SETUP : Boolean := False;
-- STAT_RX
STAT_RX : EP3R_STAT_RX_Field := 16#0#;
-- DTOG_RX
DTOG_RX : Boolean := False;
-- CTR_RX
CTR_RX : Boolean := False;
-- unspecified
Reserved_16_31 : HAL.UInt16 := 16#0#;
end record
with Volatile_Full_Access, Size => 32,
Bit_Order => System.Low_Order_First;
for EP3R_Register use record
EA at 0 range 0 .. 3;
STAT_TX at 0 range 4 .. 5;
DTOG_TX at 0 range 6 .. 6;
CTR_TX at 0 range 7 .. 7;
EP_KIND at 0 range 8 .. 8;
EPTYPE at 0 range 9 .. 10;
SETUP at 0 range 11 .. 11;
STAT_RX at 0 range 12 .. 13;
DTOG_RX at 0 range 14 .. 14;
CTR_RX at 0 range 15 .. 15;
Reserved_16_31 at 0 range 16 .. 31;
end record;
subtype EP4R_EA_Field is HAL.UInt4;
subtype EP4R_STAT_TX_Field is HAL.UInt2;
subtype EP4R_EPTYPE_Field is HAL.UInt2;
subtype EP4R_STAT_RX_Field is HAL.UInt2;
-- endpoint register
type EP4R_Register is record
-- EA
EA : EP4R_EA_Field := 16#0#;
-- STAT_TX
STAT_TX : EP4R_STAT_TX_Field := 16#0#;
-- DTOG_TX
DTOG_TX : Boolean := False;
-- CTR_TX
CTR_TX : Boolean := False;
-- EP_KIND
EP_KIND : Boolean := False;
-- EPTYPE
EPTYPE : EP4R_EPTYPE_Field := 16#0#;
-- SETUP
SETUP : Boolean := False;
-- STAT_RX
STAT_RX : EP4R_STAT_RX_Field := 16#0#;
-- DTOG_RX
DTOG_RX : Boolean := False;
-- CTR_RX
CTR_RX : Boolean := False;
-- unspecified
Reserved_16_31 : HAL.UInt16 := 16#0#;
end record
with Volatile_Full_Access, Size => 32,
Bit_Order => System.Low_Order_First;
for EP4R_Register use record
EA at 0 range 0 .. 3;
STAT_TX at 0 range 4 .. 5;
DTOG_TX at 0 range 6 .. 6;
CTR_TX at 0 range 7 .. 7;
EP_KIND at 0 range 8 .. 8;
EPTYPE at 0 range 9 .. 10;
SETUP at 0 range 11 .. 11;
STAT_RX at 0 range 12 .. 13;
DTOG_RX at 0 range 14 .. 14;
CTR_RX at 0 range 15 .. 15;
Reserved_16_31 at 0 range 16 .. 31;
end record;
subtype EP5R_EA_Field is HAL.UInt4;
subtype EP5R_STAT_TX_Field is HAL.UInt2;
subtype EP5R_EPTYPE_Field is HAL.UInt2;
subtype EP5R_STAT_RX_Field is HAL.UInt2;
-- endpoint register
type EP5R_Register is record
-- EA
EA : EP5R_EA_Field := 16#0#;
-- STAT_TX
STAT_TX : EP5R_STAT_TX_Field := 16#0#;
-- DTOG_TX
DTOG_TX : Boolean := False;
-- CTR_TX
CTR_TX : Boolean := False;
-- EP_KIND
EP_KIND : Boolean := False;
-- EPTYPE
EPTYPE : EP5R_EPTYPE_Field := 16#0#;
-- SETUP
SETUP : Boolean := False;
-- STAT_RX
STAT_RX : EP5R_STAT_RX_Field := 16#0#;
-- DTOG_RX
DTOG_RX : Boolean := False;
-- CTR_RX
CTR_RX : Boolean := False;
-- unspecified
Reserved_16_31 : HAL.UInt16 := 16#0#;
end record
with Volatile_Full_Access, Size => 32,
Bit_Order => System.Low_Order_First;
for EP5R_Register use record
EA at 0 range 0 .. 3;
STAT_TX at 0 range 4 .. 5;
DTOG_TX at 0 range 6 .. 6;
CTR_TX at 0 range 7 .. 7;
EP_KIND at 0 range 8 .. 8;
EPTYPE at 0 range 9 .. 10;
SETUP at 0 range 11 .. 11;
STAT_RX at 0 range 12 .. 13;
DTOG_RX at 0 range 14 .. 14;
CTR_RX at 0 range 15 .. 15;
Reserved_16_31 at 0 range 16 .. 31;
end record;
subtype EP6R_EA_Field is HAL.UInt4;
subtype EP6R_STAT_TX_Field is HAL.UInt2;
subtype EP6R_EPTYPE_Field is HAL.UInt2;
subtype EP6R_STAT_RX_Field is HAL.UInt2;
-- endpoint register
type EP6R_Register is record
-- EA
EA : EP6R_EA_Field := 16#0#;
-- STAT_TX
STAT_TX : EP6R_STAT_TX_Field := 16#0#;
-- DTOG_TX
DTOG_TX : Boolean := False;
-- CTR_TX
CTR_TX : Boolean := False;
-- EP_KIND
EP_KIND : Boolean := False;
-- EPTYPE
EPTYPE : EP6R_EPTYPE_Field := 16#0#;
-- SETUP
SETUP : Boolean := False;
-- STAT_RX
STAT_RX : EP6R_STAT_RX_Field := 16#0#;
-- DTOG_RX
DTOG_RX : Boolean := False;
-- CTR_RX
CTR_RX : Boolean := False;
-- unspecified
Reserved_16_31 : HAL.UInt16 := 16#0#;
end record
with Volatile_Full_Access, Size => 32,
Bit_Order => System.Low_Order_First;
for EP6R_Register use record
EA at 0 range 0 .. 3;
STAT_TX at 0 range 4 .. 5;
DTOG_TX at 0 range 6 .. 6;
CTR_TX at 0 range 7 .. 7;
EP_KIND at 0 range 8 .. 8;
EPTYPE at 0 range 9 .. 10;
SETUP at 0 range 11 .. 11;
STAT_RX at 0 range 12 .. 13;
DTOG_RX at 0 range 14 .. 14;
CTR_RX at 0 range 15 .. 15;
Reserved_16_31 at 0 range 16 .. 31;
end record;
subtype EP7R_EA_Field is HAL.UInt4;
subtype EP7R_STAT_TX_Field is HAL.UInt2;
subtype EP7R_EPTYPE_Field is HAL.UInt2;
subtype EP7R_STAT_RX_Field is HAL.UInt2;
-- endpoint register
type EP7R_Register is record
-- EA
EA : EP7R_EA_Field := 16#0#;
-- STAT_TX
STAT_TX : EP7R_STAT_TX_Field := 16#0#;
-- DTOG_TX
DTOG_TX : Boolean := False;
-- CTR_TX
CTR_TX : Boolean := False;
-- EP_KIND
EP_KIND : Boolean := False;
-- EPTYPE
EPTYPE : EP7R_EPTYPE_Field := 16#0#;
-- SETUP
SETUP : Boolean := False;
-- STAT_RX
STAT_RX : EP7R_STAT_RX_Field := 16#0#;
-- DTOG_RX
DTOG_RX : Boolean := False;
-- CTR_RX
CTR_RX : Boolean := False;
-- unspecified
Reserved_16_31 : HAL.UInt16 := 16#0#;
end record
with Volatile_Full_Access, Size => 32,
Bit_Order => System.Low_Order_First;
for EP7R_Register use record
EA at 0 range 0 .. 3;
STAT_TX at 0 range 4 .. 5;
DTOG_TX at 0 range 6 .. 6;
CTR_TX at 0 range 7 .. 7;
EP_KIND at 0 range 8 .. 8;
EPTYPE at 0 range 9 .. 10;
SETUP at 0 range 11 .. 11;
STAT_RX at 0 range 12 .. 13;
DTOG_RX at 0 range 14 .. 14;
CTR_RX at 0 range 15 .. 15;
Reserved_16_31 at 0 range 16 .. 31;
end record;
-- control register
type CNTR_Register is record
-- FRES
FRES : Boolean := False;
-- PDWN
PDWN : Boolean := False;
-- LPMODE
LPMODE : Boolean := False;
-- FSUSP
FSUSP : Boolean := False;
-- RESUME
RESUME : Boolean := False;
-- L1RESUME
L1RESUME : Boolean := False;
-- unspecified
Reserved_6_6 : HAL.Bit := 16#0#;
-- L1REQM
L1REQM : Boolean := False;
-- ESOFM
ESOFM : Boolean := False;
-- SOFM
SOFM : Boolean := False;
-- RESETM
RESETM : Boolean := False;
-- SUSPM
SUSPM : Boolean := False;
-- WKUPM
WKUPM : Boolean := False;
-- ERRM
ERRM : Boolean := False;
-- PMAOVRM
PMAOVRM : Boolean := False;
-- CTRM
CTRM : Boolean := False;
-- unspecified
Reserved_16_31 : HAL.UInt16 := 16#0#;
end record
with Volatile_Full_Access, Size => 32,
Bit_Order => System.Low_Order_First;
for CNTR_Register use record
FRES at 0 range 0 .. 0;
PDWN at 0 range 1 .. 1;
LPMODE at 0 range 2 .. 2;
FSUSP at 0 range 3 .. 3;
RESUME at 0 range 4 .. 4;
L1RESUME at 0 range 5 .. 5;
Reserved_6_6 at 0 range 6 .. 6;
L1REQM at 0 range 7 .. 7;
ESOFM at 0 range 8 .. 8;
SOFM at 0 range 9 .. 9;
RESETM at 0 range 10 .. 10;
SUSPM at 0 range 11 .. 11;
WKUPM at 0 range 12 .. 12;
ERRM at 0 range 13 .. 13;
PMAOVRM at 0 range 14 .. 14;
CTRM at 0 range 15 .. 15;
Reserved_16_31 at 0 range 16 .. 31;
end record;
subtype ISTR_EP_ID_Field is HAL.UInt4;
-- interrupt status register
type ISTR_Register is record
-- EP_ID
EP_ID : ISTR_EP_ID_Field := 16#0#;
-- DIR
DIR : Boolean := False;
-- unspecified
Reserved_5_6 : HAL.UInt2 := 16#0#;
-- L1REQ
L1REQ : Boolean := False;
-- ESOF
ESOF : Boolean := False;
-- SOF
SOF : Boolean := False;
-- RESET
RESET : Boolean := False;
-- SUSP
SUSP : Boolean := False;
-- WKUP
WKUP : Boolean := False;
-- ERR
ERR : Boolean := False;
-- PMAOVR
PMAOVR : Boolean := False;
-- CTR
CTR : Boolean := False;
-- unspecified
Reserved_16_31 : HAL.UInt16 := 16#0#;
end record
with Volatile_Full_Access, Size => 32,
Bit_Order => System.Low_Order_First;
for ISTR_Register use record
EP_ID at 0 range 0 .. 3;
DIR at 0 range 4 .. 4;
Reserved_5_6 at 0 range 5 .. 6;
L1REQ at 0 range 7 .. 7;
ESOF at 0 range 8 .. 8;
SOF at 0 range 9 .. 9;
RESET at 0 range 10 .. 10;
SUSP at 0 range 11 .. 11;
WKUP at 0 range 12 .. 12;
ERR at 0 range 13 .. 13;
PMAOVR at 0 range 14 .. 14;
CTR at 0 range 15 .. 15;
Reserved_16_31 at 0 range 16 .. 31;
end record;
subtype FNR_FN_Field is HAL.UInt11;
subtype FNR_LSOF_Field is HAL.UInt2;
-- frame number register
type FNR_Register is record
-- Read-only. FN
FN : FNR_FN_Field;
-- Read-only. LSOF
LSOF : FNR_LSOF_Field;
-- Read-only. LCK
LCK : Boolean;
-- Read-only. RXDM
RXDM : Boolean;
-- Read-only. RXDP
RXDP : Boolean;
-- unspecified
Reserved_16_31 : HAL.UInt16;
end record
with Volatile_Full_Access, Size => 32,
Bit_Order => System.Low_Order_First;
for FNR_Register use record
FN at 0 range 0 .. 10;
LSOF at 0 range 11 .. 12;
LCK at 0 range 13 .. 13;
RXDM at 0 range 14 .. 14;
RXDP at 0 range 15 .. 15;
Reserved_16_31 at 0 range 16 .. 31;
end record;
subtype DADDR_ADD_Field is HAL.UInt7;
-- device address
type DADDR_Register is record
-- ADD
ADD : DADDR_ADD_Field := 16#0#;
-- EF
EF : Boolean := False;
-- unspecified
Reserved_8_31 : HAL.UInt24 := 16#0#;
end record
with Volatile_Full_Access, Size => 32,
Bit_Order => System.Low_Order_First;
for DADDR_Register use record
ADD at 0 range 0 .. 6;
EF at 0 range 7 .. 7;
Reserved_8_31 at 0 range 8 .. 31;
end record;
subtype BTABLE_BTABLE_Field is HAL.UInt13;
-- Buffer table address
type BTABLE_Register is record
-- unspecified
Reserved_0_2 : HAL.UInt3 := 16#0#;
-- BTABLE
BTABLE : BTABLE_BTABLE_Field := 16#0#;
-- unspecified
Reserved_16_31 : HAL.UInt16 := 16#0#;
end record
with Volatile_Full_Access, Size => 32,
Bit_Order => System.Low_Order_First;
for BTABLE_Register use record
Reserved_0_2 at 0 range 0 .. 2;
BTABLE at 0 range 3 .. 15;
Reserved_16_31 at 0 range 16 .. 31;
end record;
subtype LPMCSR_BESL_Field is HAL.UInt4;
-- LPM control and status register
type LPMCSR_Register is record
-- LPMEN
LPMEN : Boolean := False;
-- LPMACK
LPMACK : Boolean := False;
-- unspecified
Reserved_2_2 : HAL.Bit := 16#0#;
-- Read-only. REMWAKE
REMWAKE : Boolean := False;
-- Read-only. BESL
BESL : LPMCSR_BESL_Field := 16#0#;
-- unspecified
Reserved_8_31 : HAL.UInt24 := 16#0#;
end record
with Volatile_Full_Access, Size => 32,
Bit_Order => System.Low_Order_First;
for LPMCSR_Register use record
LPMEN at 0 range 0 .. 0;
LPMACK at 0 range 1 .. 1;
Reserved_2_2 at 0 range 2 .. 2;
REMWAKE at 0 range 3 .. 3;
BESL at 0 range 4 .. 7;
Reserved_8_31 at 0 range 8 .. 31;
end record;
-- Battery charging detector
type BCDR_Register is record
-- BCDEN
BCDEN : Boolean := False;
-- DCDEN
DCDEN : Boolean := False;
-- PDEN
PDEN : Boolean := False;
-- SDEN
SDEN : Boolean := False;
-- Read-only. DCDET
DCDET : Boolean := False;
-- Read-only. PDET
PDET : Boolean := False;
-- Read-only. SDET
SDET : Boolean := False;
-- Read-only. PS2DET
PS2DET : Boolean := False;
-- unspecified
Reserved_8_14 : HAL.UInt7 := 16#0#;
-- DPPU
DPPU : Boolean := False;
-- unspecified
Reserved_16_31 : HAL.UInt16 := 16#0#;
end record
with Volatile_Full_Access, Size => 32,
Bit_Order => System.Low_Order_First;
for BCDR_Register use record
BCDEN at 0 range 0 .. 0;
DCDEN at 0 range 1 .. 1;
PDEN at 0 range 2 .. 2;
SDEN at 0 range 3 .. 3;
DCDET at 0 range 4 .. 4;
PDET at 0 range 5 .. 5;
SDET at 0 range 6 .. 6;
PS2DET at 0 range 7 .. 7;
Reserved_8_14 at 0 range 8 .. 14;
DPPU at 0 range 15 .. 15;
Reserved_16_31 at 0 range 16 .. 31;
end record;
subtype EP0R_EP_TYPE_Field is HAL.UInt2;
-- endpoint 0 register
type EP0R_Register_1 is record
-- Endpoint address
EA : EP0R_EA_Field := 16#0#;
-- Status bits, for transmission transfers
STAT_TX : EP0R_STAT_TX_Field := 16#0#;
-- Data Toggle, for transmission transfers
DTOG_TX : Boolean := False;
-- Correct Transfer for transmission
CTR_TX : Boolean := False;
-- Endpoint kind
EP_KIND : Boolean := False;
-- Endpoint type
EP_TYPE : EP0R_EP_TYPE_Field := 16#0#;
-- Setup transaction completed
SETUP : Boolean := False;
-- Status bits, for reception transfers
STAT_RX : EP0R_STAT_RX_Field := 16#0#;
-- Data Toggle, for reception transfers
DTOG_RX : Boolean := False;
-- Correct transfer for reception
CTR_RX : Boolean := False;
-- unspecified
Reserved_16_31 : HAL.UInt16 := 16#0#;
end record
with Volatile_Full_Access, Size => 32,
Bit_Order => System.Low_Order_First;
for EP0R_Register_1 use record
EA at 0 range 0 .. 3;
STAT_TX at 0 range 4 .. 5;
DTOG_TX at 0 range 6 .. 6;
CTR_TX at 0 range 7 .. 7;
EP_KIND at 0 range 8 .. 8;
EP_TYPE at 0 range 9 .. 10;
SETUP at 0 range 11 .. 11;
STAT_RX at 0 range 12 .. 13;
DTOG_RX at 0 range 14 .. 14;
CTR_RX at 0 range 15 .. 15;
Reserved_16_31 at 0 range 16 .. 31;
end record;
subtype EP1R_EP_TYPE_Field is HAL.UInt2;
-- endpoint 1 register
type EP1R_Register_1 is record
-- Endpoint address
EA : EP1R_EA_Field := 16#0#;
-- Status bits, for transmission transfers
STAT_TX : EP1R_STAT_TX_Field := 16#0#;
-- Data Toggle, for transmission transfers
DTOG_TX : Boolean := False;
-- Correct Transfer for transmission
CTR_TX : Boolean := False;
-- Endpoint kind
EP_KIND : Boolean := False;
-- Endpoint type
EP_TYPE : EP1R_EP_TYPE_Field := 16#0#;
-- Setup transaction completed
SETUP : Boolean := False;
-- Status bits, for reception transfers
STAT_RX : EP1R_STAT_RX_Field := 16#0#;
-- Data Toggle, for reception transfers
DTOG_RX : Boolean := False;
-- Correct transfer for reception
CTR_RX : Boolean := False;
-- unspecified
Reserved_16_31 : HAL.UInt16 := 16#0#;
end record
with Volatile_Full_Access, Size => 32,
Bit_Order => System.Low_Order_First;
for EP1R_Register_1 use record
EA at 0 range 0 .. 3;
STAT_TX at 0 range 4 .. 5;
DTOG_TX at 0 range 6 .. 6;
CTR_TX at 0 range 7 .. 7;
EP_KIND at 0 range 8 .. 8;
EP_TYPE at 0 range 9 .. 10;
SETUP at 0 range 11 .. 11;
STAT_RX at 0 range 12 .. 13;
DTOG_RX at 0 range 14 .. 14;
CTR_RX at 0 range 15 .. 15;
Reserved_16_31 at 0 range 16 .. 31;
end record;
subtype EP2R_EP_TYPE_Field is HAL.UInt2;
-- endpoint 2 register
type EP2R_Register_1 is record
-- Endpoint address
EA : EP2R_EA_Field := 16#0#;
-- Status bits, for transmission transfers
STAT_TX : EP2R_STAT_TX_Field := 16#0#;
-- Data Toggle, for transmission transfers
DTOG_TX : Boolean := False;
-- Correct Transfer for transmission
CTR_TX : Boolean := False;
-- Endpoint kind
EP_KIND : Boolean := False;
-- Endpoint type
EP_TYPE : EP2R_EP_TYPE_Field := 16#0#;
-- Setup transaction completed
SETUP : Boolean := False;
-- Status bits, for reception transfers
STAT_RX : EP2R_STAT_RX_Field := 16#0#;
-- Data Toggle, for reception transfers
DTOG_RX : Boolean := False;
-- Correct transfer for reception
CTR_RX : Boolean := False;
-- unspecified
Reserved_16_31 : HAL.UInt16 := 16#0#;
end record
with Volatile_Full_Access, Size => 32,
Bit_Order => System.Low_Order_First;
for EP2R_Register_1 use record
EA at 0 range 0 .. 3;
STAT_TX at 0 range 4 .. 5;
DTOG_TX at 0 range 6 .. 6;
CTR_TX at 0 range 7 .. 7;
EP_KIND at 0 range 8 .. 8;
EP_TYPE at 0 range 9 .. 10;
SETUP at 0 range 11 .. 11;
STAT_RX at 0 range 12 .. 13;
DTOG_RX at 0 range 14 .. 14;
CTR_RX at 0 range 15 .. 15;
Reserved_16_31 at 0 range 16 .. 31;
end record;
subtype EP3R_EP_TYPE_Field is HAL.UInt2;
-- endpoint 3 register
type EP3R_Register_1 is record
-- Endpoint address
EA : EP3R_EA_Field := 16#0#;
-- Status bits, for transmission transfers
STAT_TX : EP3R_STAT_TX_Field := 16#0#;
-- Data Toggle, for transmission transfers
DTOG_TX : Boolean := False;
-- Correct Transfer for transmission
CTR_TX : Boolean := False;
-- Endpoint kind
EP_KIND : Boolean := False;
-- Endpoint type
EP_TYPE : EP3R_EP_TYPE_Field := 16#0#;
-- Setup transaction completed
SETUP : Boolean := False;
-- Status bits, for reception transfers
STAT_RX : EP3R_STAT_RX_Field := 16#0#;
-- Data Toggle, for reception transfers
DTOG_RX : Boolean := False;
-- Correct transfer for reception
CTR_RX : Boolean := False;
-- unspecified
Reserved_16_31 : HAL.UInt16 := 16#0#;
end record
with Volatile_Full_Access, Size => 32,
Bit_Order => System.Low_Order_First;
for EP3R_Register_1 use record
EA at 0 range 0 .. 3;
STAT_TX at 0 range 4 .. 5;
DTOG_TX at 0 range 6 .. 6;
CTR_TX at 0 range 7 .. 7;
EP_KIND at 0 range 8 .. 8;
EP_TYPE at 0 range 9 .. 10;
SETUP at 0 range 11 .. 11;
STAT_RX at 0 range 12 .. 13;
DTOG_RX at 0 range 14 .. 14;
CTR_RX at 0 range 15 .. 15;
Reserved_16_31 at 0 range 16 .. 31;
end record;
subtype EP4R_EP_TYPE_Field is HAL.UInt2;
-- endpoint 4 register
type EP4R_Register_1 is record
-- Endpoint address
EA : EP4R_EA_Field := 16#0#;
-- Status bits, for transmission transfers
STAT_TX : EP4R_STAT_TX_Field := 16#0#;
-- Data Toggle, for transmission transfers
DTOG_TX : Boolean := False;
-- Correct Transfer for transmission
CTR_TX : Boolean := False;
-- Endpoint kind
EP_KIND : Boolean := False;
-- Endpoint type
EP_TYPE : EP4R_EP_TYPE_Field := 16#0#;
-- Setup transaction completed
SETUP : Boolean := False;
-- Status bits, for reception transfers
STAT_RX : EP4R_STAT_RX_Field := 16#0#;
-- Data Toggle, for reception transfers
DTOG_RX : Boolean := False;
-- Correct transfer for reception
CTR_RX : Boolean := False;
-- unspecified
Reserved_16_31 : HAL.UInt16 := 16#0#;
end record
with Volatile_Full_Access, Size => 32,
Bit_Order => System.Low_Order_First;
for EP4R_Register_1 use record
EA at 0 range 0 .. 3;
STAT_TX at 0 range 4 .. 5;
DTOG_TX at 0 range 6 .. 6;
CTR_TX at 0 range 7 .. 7;
EP_KIND at 0 range 8 .. 8;
EP_TYPE at 0 range 9 .. 10;
SETUP at 0 range 11 .. 11;
STAT_RX at 0 range 12 .. 13;
DTOG_RX at 0 range 14 .. 14;
CTR_RX at 0 range 15 .. 15;
Reserved_16_31 at 0 range 16 .. 31;
end record;
subtype EP5R_EP_TYPE_Field is HAL.UInt2;
-- endpoint 5 register
type EP5R_Register_1 is record
-- Endpoint address
EA : EP5R_EA_Field := 16#0#;
-- Status bits, for transmission transfers
STAT_TX : EP5R_STAT_TX_Field := 16#0#;
-- Data Toggle, for transmission transfers
DTOG_TX : Boolean := False;
-- Correct Transfer for transmission
CTR_TX : Boolean := False;
-- Endpoint kind
EP_KIND : Boolean := False;
-- Endpoint type
EP_TYPE : EP5R_EP_TYPE_Field := 16#0#;
-- Setup transaction completed
SETUP : Boolean := False;
-- Status bits, for reception transfers
STAT_RX : EP5R_STAT_RX_Field := 16#0#;
-- Data Toggle, for reception transfers
DTOG_RX : Boolean := False;
-- Correct transfer for reception
CTR_RX : Boolean := False;
-- unspecified
Reserved_16_31 : HAL.UInt16 := 16#0#;
end record
with Volatile_Full_Access, Size => 32,
Bit_Order => System.Low_Order_First;
for EP5R_Register_1 use record
EA at 0 range 0 .. 3;
STAT_TX at 0 range 4 .. 5;
DTOG_TX at 0 range 6 .. 6;
CTR_TX at 0 range 7 .. 7;
EP_KIND at 0 range 8 .. 8;
EP_TYPE at 0 range 9 .. 10;
SETUP at 0 range 11 .. 11;
STAT_RX at 0 range 12 .. 13;
DTOG_RX at 0 range 14 .. 14;
CTR_RX at 0 range 15 .. 15;
Reserved_16_31 at 0 range 16 .. 31;
end record;
subtype EP6R_EP_TYPE_Field is HAL.UInt2;
-- endpoint 6 register
type EP6R_Register_1 is record
-- Endpoint address
EA : EP6R_EA_Field := 16#0#;
-- Status bits, for transmission transfers
STAT_TX : EP6R_STAT_TX_Field := 16#0#;
-- Data Toggle, for transmission transfers
DTOG_TX : Boolean := False;
-- Correct Transfer for transmission
CTR_TX : Boolean := False;
-- Endpoint kind
EP_KIND : Boolean := False;
-- Endpoint type
EP_TYPE : EP6R_EP_TYPE_Field := 16#0#;
-- Setup transaction completed
SETUP : Boolean := False;
-- Status bits, for reception transfers
STAT_RX : EP6R_STAT_RX_Field := 16#0#;
-- Data Toggle, for reception transfers
DTOG_RX : Boolean := False;
-- Correct transfer for reception
CTR_RX : Boolean := False;
-- unspecified
Reserved_16_31 : HAL.UInt16 := 16#0#;
end record
with Volatile_Full_Access, Size => 32,
Bit_Order => System.Low_Order_First;
for EP6R_Register_1 use record
EA at 0 range 0 .. 3;
STAT_TX at 0 range 4 .. 5;
DTOG_TX at 0 range 6 .. 6;
CTR_TX at 0 range 7 .. 7;
EP_KIND at 0 range 8 .. 8;
EP_TYPE at 0 range 9 .. 10;
SETUP at 0 range 11 .. 11;
STAT_RX at 0 range 12 .. 13;
DTOG_RX at 0 range 14 .. 14;
CTR_RX at 0 range 15 .. 15;
Reserved_16_31 at 0 range 16 .. 31;
end record;
subtype EP7R_EP_TYPE_Field is HAL.UInt2;
-- endpoint 7 register
type EP7R_Register_1 is record
-- Endpoint address
EA : EP7R_EA_Field := 16#0#;
-- Status bits, for transmission transfers
STAT_TX : EP7R_STAT_TX_Field := 16#0#;
-- Data Toggle, for transmission transfers
DTOG_TX : Boolean := False;
-- Correct Transfer for transmission
CTR_TX : Boolean := False;
-- Endpoint kind
EP_KIND : Boolean := False;
-- Endpoint type
EP_TYPE : EP7R_EP_TYPE_Field := 16#0#;
-- Setup transaction completed
SETUP : Boolean := False;
-- Status bits, for reception transfers
STAT_RX : EP7R_STAT_RX_Field := 16#0#;
-- Data Toggle, for reception transfers
DTOG_RX : Boolean := False;
-- Correct transfer for reception
CTR_RX : Boolean := False;
-- unspecified
Reserved_16_31 : HAL.UInt16 := 16#0#;
end record
with Volatile_Full_Access, Size => 32,
Bit_Order => System.Low_Order_First;
for EP7R_Register_1 use record
EA at 0 range 0 .. 3;
STAT_TX at 0 range 4 .. 5;
DTOG_TX at 0 range 6 .. 6;
CTR_TX at 0 range 7 .. 7;
EP_KIND at 0 range 8 .. 8;
EP_TYPE at 0 range 9 .. 10;
SETUP at 0 range 11 .. 11;
STAT_RX at 0 range 12 .. 13;
DTOG_RX at 0 range 14 .. 14;
CTR_RX at 0 range 15 .. 15;
Reserved_16_31 at 0 range 16 .. 31;
end record;
-- control register
type CNTR_Register_1 is record
-- Force USB Reset
FRES : Boolean := True;
-- Power down
PDWN : Boolean := True;
-- Low-power mode
LPMODE : Boolean := False;
-- Force suspend
FSUSP : Boolean := False;
-- Resume request
RESUME : Boolean := False;
-- LPM L1 Resume request
L1RESUME : Boolean := False;
-- unspecified
Reserved_6_6 : HAL.Bit := 16#0#;
-- LPM L1 state request interrupt mask
L1REQM : Boolean := False;
-- Expected start of frame interrupt mask
ESOFM : Boolean := False;
-- Start of frame interrupt mask
SOFM : Boolean := False;
-- USB reset interrupt mask
RESETM : Boolean := False;
-- Suspend mode interrupt mask
SUSPM : Boolean := False;
-- Wakeup interrupt mask
WKUPM : Boolean := False;
-- Error interrupt mask
ERRM : Boolean := False;
-- Packet memory area over / underrun interrupt mask
PMAOVRM : Boolean := False;
-- Correct transfer interrupt mask
CTRM : Boolean := False;
-- unspecified
Reserved_16_31 : HAL.UInt16 := 16#0#;
end record
with Volatile_Full_Access, Size => 32,
Bit_Order => System.Low_Order_First;
for CNTR_Register_1 use record
FRES at 0 range 0 .. 0;
PDWN at 0 range 1 .. 1;
LPMODE at 0 range 2 .. 2;
FSUSP at 0 range 3 .. 3;
RESUME at 0 range 4 .. 4;
L1RESUME at 0 range 5 .. 5;
Reserved_6_6 at 0 range 6 .. 6;
L1REQM at 0 range 7 .. 7;
ESOFM at 0 range 8 .. 8;
SOFM at 0 range 9 .. 9;
RESETM at 0 range 10 .. 10;
SUSPM at 0 range 11 .. 11;
WKUPM at 0 range 12 .. 12;
ERRM at 0 range 13 .. 13;
PMAOVRM at 0 range 14 .. 14;
CTRM at 0 range 15 .. 15;
Reserved_16_31 at 0 range 16 .. 31;
end record;
-----------------
-- Peripherals --
-----------------
-- Universal serial bus full-speed device interface
type USB_FS_Peripheral is record
-- endpoint register
EP0R : aliased EP0R_Register;
-- endpoint register
EP1R : aliased EP1R_Register;
-- endpoint register
EP2R : aliased EP2R_Register;
-- endpoint register
EP3R : aliased EP3R_Register;
-- endpoint register
EP4R : aliased EP4R_Register;
-- endpoint register
EP5R : aliased EP5R_Register;
-- endpoint register
EP6R : aliased EP6R_Register;
-- endpoint register
EP7R : aliased EP7R_Register;
-- control register
CNTR : aliased CNTR_Register;
-- interrupt status register
ISTR : aliased ISTR_Register;
-- frame number register
FNR : aliased FNR_Register;
-- device address
DADDR : aliased DADDR_Register;
-- Buffer table address
BTABLE : aliased BTABLE_Register;
-- LPM control and status register
LPMCSR : aliased LPMCSR_Register;
-- Battery charging detector
BCDR : aliased BCDR_Register;
end record
with Volatile;
for USB_FS_Peripheral use record
EP0R at 16#0# range 0 .. 31;
EP1R at 16#4# range 0 .. 31;
EP2R at 16#8# range 0 .. 31;
EP3R at 16#C# range 0 .. 31;
EP4R at 16#10# range 0 .. 31;
EP5R at 16#14# range 0 .. 31;
EP6R at 16#18# range 0 .. 31;
EP7R at 16#1C# range 0 .. 31;
CNTR at 16#40# range 0 .. 31;
ISTR at 16#44# range 0 .. 31;
FNR at 16#48# range 0 .. 31;
DADDR at 16#4C# range 0 .. 31;
BTABLE at 16#50# range 0 .. 31;
LPMCSR at 16#54# range 0 .. 31;
BCDR at 16#58# range 0 .. 31;
end record;
-- Universal serial bus full-speed device interface
USB_FS_Periph : aliased USB_FS_Peripheral
with Import, Address => System'To_Address (16#40005C00#);
-- Universal serial bus full-speed device interface
type USB_SRAM_Peripheral is record
-- endpoint 0 register
EP0R : aliased EP0R_Register_1;
-- endpoint 1 register
EP1R : aliased EP1R_Register_1;
-- endpoint 2 register
EP2R : aliased EP2R_Register_1;
-- endpoint 3 register
EP3R : aliased EP3R_Register_1;
-- endpoint 4 register
EP4R : aliased EP4R_Register_1;
-- endpoint 5 register
EP5R : aliased EP5R_Register_1;
-- endpoint 6 register
EP6R : aliased EP6R_Register_1;
-- endpoint 7 register
EP7R : aliased EP7R_Register_1;
-- control register
CNTR : aliased CNTR_Register_1;
-- interrupt status register
ISTR : aliased ISTR_Register;
-- frame number register
FNR : aliased FNR_Register;
-- device address
DADDR : aliased DADDR_Register;
-- Buffer table address
BTABLE : aliased BTABLE_Register;
-- LPM control and status register
LPMCSR : aliased LPMCSR_Register;
-- Battery charging detector
BCDR : aliased BCDR_Register;
end record
with Volatile;
for USB_SRAM_Peripheral use record
EP0R at 16#0# range 0 .. 31;
EP1R at 16#4# range 0 .. 31;
EP2R at 16#8# range 0 .. 31;
EP3R at 16#C# range 0 .. 31;
EP4R at 16#10# range 0 .. 31;
EP5R at 16#14# range 0 .. 31;
EP6R at 16#18# range 0 .. 31;
EP7R at 16#1C# range 0 .. 31;
CNTR at 16#40# range 0 .. 31;
ISTR at 16#44# range 0 .. 31;
FNR at 16#48# range 0 .. 31;
DADDR at 16#4C# range 0 .. 31;
BTABLE at 16#50# range 0 .. 31;
LPMCSR at 16#54# range 0 .. 31;
BCDR at 16#58# range 0 .. 31;
end record;
-- Universal serial bus full-speed device interface
USB_SRAM_Periph : aliased USB_SRAM_Peripheral
with Import, Address => System'To_Address (16#40006000#);
end STM32_SVD.USB;
| 33.43234 | 65 | 0.526716 |
1e32bba7b8c9b25f88926d1a66a693b344d75465 | 4,413 | adb | Ada | tests/tdgesvd.adb | leo-brewin/ada-lapack | defd2051452480998b59cfdbe94d3219ae786746 | [
"MIT"
] | 5 | 2021-01-07T17:32:57.000Z | 2022-02-24T18:48:56.000Z | tests/tdgesvd.adb | leo-brewin/ada-lapack | defd2051452480998b59cfdbe94d3219ae786746 | [
"MIT"
] | null | null | null | tests/tdgesvd.adb | leo-brewin/ada-lapack | defd2051452480998b59cfdbe94d3219ae786746 | [
"MIT"
] | null | null | null | with Ada.Text_IO;
with Ada.Text_IO.Complex_IO;
with Ada.Numerics.Generic_Real_Arrays;
with Ada.Numerics.Generic_Complex_Types;
with Ada.Numerics.Generic_Complex_Arrays;
with Ada.Numerics.Generic_Elementary_Functions;
with Ada.Numerics.Generic_Complex_Elementary_Functions;
with Ada_Lapack;
use Ada.Text_IO;
procedure tdgesvd is
type Real is digits 18;
package Real_Arrays is new Ada.Numerics.Generic_Real_Arrays (Real);
package Complex_Types is new Ada.Numerics.Generic_Complex_Types (Real);
package Complex_Arrays is new Ada.Numerics.Generic_Complex_Arrays (Real_Arrays, Complex_Types);
package Real_Maths is new Ada.Numerics.Generic_Elementary_Functions (Real);
package Complex_Maths is new Ada.Numerics.Generic_Complex_Elementary_Functions (Complex_Types);
package Real_IO is new Ada.Text_IO.Float_IO (Real);
package Integer_IO is new Ada.Text_IO.Integer_IO (Integer);
package Complex_IO is new Ada.Text_IO.Complex_IO (Complex_Types);
package Lapack is new Ada_Lapack(Real, Complex_Types, Real_Arrays, Complex_Arrays);
use Lapack;
use Real_Arrays;
use Complex_Types;
use Complex_Arrays;
use Real_IO;
use Integer_IO;
use Complex_IO;
use Real_Maths;
use Complex_Maths;
function min(left,right : Integer) return Integer is
begin
if left < right
then return left;
else return right;
end if;
end min;
one : constant Real := 1.0e0;
zero : constant Real := 0.0e0;
matrix : Real_Matrix (1..6,1..5);
matrix_rows : Integer := Matrix'Length (1);
matrix_cols : Integer := Matrix'Length (2);
num_singular : Integer;
singular_values : Real_Vector (1..min(matrix_rows,matrix_cols));
u_rows : Integer := matrix_rows;
u_cols : Integer := matrix_rows;
u_matrix : Real_Matrix (1..u_rows,1..u_cols);
v_rows : Integer := matrix_cols;
v_cols : Integer := matrix_cols;
v_transpose : Real_Matrix (1..v_rows,1..v_cols);
short_vector : Real_Vector (1..1);
return_code : Integer;
begin
matrix :=( ( 8.79, 9.93, 9.83, 5.45, 3.16),
( 6.11, 6.91, 5.04, -0.27, 7.98),
( -9.15, -7.93, 4.86, 4.85, 3.01),
( 9.57, 1.64, 8.83, 0.74, 5.80),
( -3.49, 4.02, 9.80, 10.00, 4.27),
( 9.84, 0.15, -8.99, -6.02, -5.31) );
GESVD ( JOBU => 'S',
JOBVT => 'S',
M => matrix_rows,
N => matrix_cols,
A => matrix,
LDA => matrix_rows,
S => singular_values,
U => u_matrix,
LDU => u_rows,
VT => v_transpose,
LDVT => v_rows,
WORK => short_vector,
LWORK => -1,
INFO => return_code );
declare
work_vector_rows : Integer := Integer( short_vector(1) );
work_vector : Real_Vector (1 .. work_vector_rows);
begin
GESVD ( JOBU => 'S',
JOBVT => 'S',
M => matrix_rows,
N => matrix_cols,
A => matrix,
LDA => matrix_rows,
S => singular_values,
U => u_matrix,
LDU => u_rows,
VT => v_transpose,
LDVT => v_rows,
WORK => work_vector,
LWORK => work_vector_rows,
INFO => return_code );
end;
if return_code > 0 then
Put ("DGESVD failed, the return code was : ");
Put ( return_code );
New_line;
else
num_singular := min(matrix_rows,matrix_cols);
put_line("Singular values");
for i in 1..num_singular loop
put(singular_values(i),3,4,0);
end loop;
new_line;
new_line;
put_line("Matrix U");
for i in 1..matrix_rows loop
for j in 1..num_singular loop
put(u_matrix(i,j),3,4,0);
end loop;
new_line;
end loop;
new_line;
put_line("Matrix V transpose");
for i in 1..num_singular loop
for j in 1..matrix_cols loop
put(v_transpose(i,j),3,4,0);
end loop;
new_line;
end loop;
end if;
end tdgesvd;
| 28.655844 | 100 | 0.553818 |
5e5e46ecdf1255e3600e7fcbca8b27cd4e6730c6 | 2,505 | ads | Ada | tier-1/xcb/source/thin/xcb-xcb_setup_t.ads | charlie5/cBound | 741be08197a61ad9c72553e3302f3b669902216d | [
"0BSD"
] | 2 | 2015-11-12T11:16:20.000Z | 2021-08-24T22:32:04.000Z | tier-1/xcb/source/thin/xcb-xcb_setup_t.ads | charlie5/cBound | 741be08197a61ad9c72553e3302f3b669902216d | [
"0BSD"
] | 1 | 2018-06-05T05:19:35.000Z | 2021-11-20T01:13:23.000Z | tier-1/xcb/source/thin/xcb-xcb_setup_t.ads | charlie5/cBound | 741be08197a61ad9c72553e3302f3b669902216d | [
"0BSD"
] | null | null | null | -- This file is generated by SWIG. Please do not modify by hand.
--
with Interfaces;
with swig;
with Interfaces.C;
with Interfaces.C.Pointers;
package xcb.xcb_setup_t is
-- Item
--
type Item is record
status : aliased Interfaces.Unsigned_8;
pad0 : aliased Interfaces.Unsigned_8;
protocol_major_version : aliased Interfaces.Unsigned_16;
protocol_minor_version : aliased Interfaces.Unsigned_16;
length : aliased Interfaces.Unsigned_16;
release_number : aliased Interfaces.Unsigned_32;
resource_id_base : aliased Interfaces.Unsigned_32;
resource_id_mask : aliased Interfaces.Unsigned_32;
motion_buffer_size : aliased Interfaces.Unsigned_32;
vendor_len : aliased Interfaces.Unsigned_16;
maximum_request_length : aliased Interfaces.Unsigned_16;
roots_len : aliased Interfaces.Unsigned_8;
pixmap_formats_len : aliased Interfaces.Unsigned_8;
image_byte_order : aliased Interfaces.Unsigned_8;
bitmap_format_bit_order : aliased Interfaces.Unsigned_8;
bitmap_format_scanline_unit : aliased Interfaces.Unsigned_8;
bitmap_format_scanline_pad : aliased Interfaces.Unsigned_8;
min_keycode : aliased xcb.xcb_keycode_t;
max_keycode : aliased xcb.xcb_keycode_t;
pad1 : aliased swig.int8_t_Array (0 .. 3);
end record;
-- Item_Array
--
type Item_Array is
array (Interfaces.C.size_t range <>) of aliased xcb.xcb_setup_t.Item;
-- Pointer
--
package C_Pointers is new Interfaces.C.Pointers
(Index => Interfaces.C.size_t,
Element => xcb.xcb_setup_t.Item,
Element_Array => xcb.xcb_setup_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_setup_t.Pointer;
-- Pointer_Pointer
--
package C_Pointer_Pointers is new Interfaces.C.Pointers
(Index => Interfaces.C.size_t,
Element => xcb.xcb_setup_t.Pointer,
Element_Array => xcb.xcb_setup_t.Pointer_Array,
Default_Terminator => null);
subtype Pointer_Pointer is C_Pointer_Pointers.Pointer;
end xcb.xcb_setup_t;
| 37.38806 | 77 | 0.638723 |
30e6870ca957f09f86c26197e855f62ff29aabf1 | 4,526 | ads | Ada | tools-src/gnu/gcc/gcc/ada/s-scaval.ads | modern-tomato/tomato | 96f09fab4929c6ddde5c9113f1b2476ad37133c4 | [
"FSFAP"
] | 80 | 2015-01-02T10:14:04.000Z | 2021-06-07T06:29:49.000Z | tools-src/gnu/gcc/gcc/ada/s-scaval.ads | modern-tomato/tomato | 96f09fab4929c6ddde5c9113f1b2476ad37133c4 | [
"FSFAP"
] | 9 | 2015-05-14T11:03:12.000Z | 2018-01-04T07:12:58.000Z | tools-src/gnu/gcc/gcc/ada/s-scaval.ads | modern-tomato/tomato | 96f09fab4929c6ddde5c9113f1b2476ad37133c4 | [
"FSFAP"
] | 69 | 2015-01-02T10:45:56.000Z | 2021-09-06T07:52:13.000Z | ------------------------------------------------------------------------------
-- --
-- GNAT RUNTIME COMPONENTS --
-- --
-- S Y S T E M . S C A L A R _ V A L U E S --
-- S p e c --
-- --
-- $Revision$
-- --
-- Copyright (C) 2001 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. --
-- --
------------------------------------------------------------------------------
-- This package defines the constants used for initializing scalar values
-- when pragma Initialize_Scalars is used. The actual values are defined
-- in the binder generated file. This package contains the Ada names that
-- are used by the generated code, which are linked to the actual values
-- by the use of pragma Import.
package System.Scalar_Values is
pragma Pure (Scalar_Values);
type Byte1 is mod 2 ** 8;
type Byte2 is mod 2 ** 16;
type Byte4 is mod 2 ** 32;
type Byte8 is mod 2 ** 64;
IS_Is1 : constant Byte1; -- Initialize 1 byte signed value
IS_Is2 : constant Byte2; -- Initialize 2 byte signed value
IS_Is4 : constant Byte4; -- Initialize 4 byte signed value
IS_Is8 : constant Byte8; -- Initialize 8 byte signed value
IS_Iu1 : constant Byte1; -- Initialize 1 byte unsigned value
IS_Iu2 : constant Byte2; -- Initialize 2 byte unsigned value
IS_Iu4 : constant Byte4; -- Initialize 4 byte unsigned value
IS_Iu8 : constant Byte8; -- Initialize 8 byte unsigned value
IS_Isf : constant Short_Float; -- Initialize short float value
IS_Ifl : constant Float; -- Initialize float value
IS_Ilf : constant Long_Float; -- Initialize long float value
IS_Ill : constant Long_Long_Float; -- Initialize long long float value
pragma Import (Ada, IS_Is1, "__gnat_Is1");
pragma Import (Ada, IS_Is2, "__gnat_Is2");
pragma Import (Ada, IS_Is4, "__gnat_Is4");
pragma Import (Ada, IS_Is8, "__gnat_Is8");
pragma Import (Ada, IS_Iu1, "__gnat_Iu1");
pragma Import (Ada, IS_Iu2, "__gnat_Iu2");
pragma Import (Ada, IS_Iu4, "__gnat_Iu4");
pragma Import (Ada, IS_Iu8, "__gnat_Iu8");
pragma Import (Ada, IS_Isf, "__gnat_Isf");
pragma Import (Ada, IS_Ifl, "__gnat_Ifl");
pragma Import (Ada, IS_Ilf, "__gnat_Ilf");
pragma Import (Ada, IS_Ill, "__gnat_Ill");
end System.Scalar_Values;
| 59.552632 | 78 | 0.522757 |
4b117434131a63cbb44ac13e50306d0938917196 | 1,622 | ads | Ada | src/semantica-declsc3a.ads | alvaromb/Compilemon | de5f88f084705868d38e301d95bb4a19a46a1156 | [
"MIT"
] | 1 | 2018-08-11T01:51:27.000Z | 2018-08-11T01:51:27.000Z | src/semantica-declsc3a.ads | alvaromb/Compilemon | de5f88f084705868d38e301d95bb4a19a46a1156 | [
"MIT"
] | null | null | null | src/semantica-declsc3a.ads | alvaromb/Compilemon | de5f88f084705868d38e301d95bb4a19a46a1156 | [
"MIT"
] | null | null | null | with Decls.Dgenerals,
Semantica,
Decls.Dtdesc,
Ada.Sequential_Io,
Ada.Text_Io,
Decls.D_Taula_De_Noms,
Semantica.Ctipus,
Ada.Strings,
Ada.Strings.Fixed,
Ada.Strings.Maps;
use Decls.Dgenerals,
Semantica,
Decls.Dtdesc,
Decls.D_Taula_De_Noms,
Semantica.Ctipus,
Ada.Strings,
Ada.Strings.Fixed,
Ada.Strings.Maps;
package Semantica.Declsc3a is
--taula procediments
procedure Nouproc
(Tp : in out T_Procs;
Idp : out num_proc);
function Consulta
(Tp : in T_Procs;
Idp : in num_proc) return Info_Proc;
function Consulta
(Tv : in T_Vars;
Idv : in num_var) return Info_Var;
procedure Modif_Descripcio
(Tv : in out T_Vars;
Idv : in num_var;
Iv : in Info_Var);
procedure Novavar
(Tv : in out T_Vars;
Idpr : in num_proc;
Idv : out num_var);
procedure Novaconst
(Tv : in out T_Vars;
Vc : in Valor;
Tsub : in tipussubjacent;
Idpr : in num_proc;
Idc : out num_var);
--Taula d'etiquetes
function Nova_Etiq return num_Etiq;
function Etiqueta
(Ipr : in Info_Proc) return String;
--Fitxers
procedure Crea_Fitxer
(Nom_Fitxer : in String);
procedure Obrir_Fitxer
(Nom_Fitxer : in String);
procedure Tanca_Fitxer;
procedure Llegir_Fitxer
(Instruccio : out c3a);
procedure Escriure_Fitxer
(Instruccio : in c3a);
function Fi_Fitxer return Boolean;
private
package Fitxer_Seq is new Ada.Sequential_Io(c3a);
use Fitxer_Seq;
F3as : Fitxer_Seq.File_Type;
F3at : Ada.Text_Io.File_Type;
end Semantica.Declsc3a;
| 20.794872 | 52 | 0.662762 |
5e3b7e14b9b58d26b19d67d2dd457bfa1898de53 | 2,391 | ads | Ada | extern/gnat_sdl/gnat_sdl2/src/sdl_clipboard_h.ads | AdaCore/training_material | 6651eb2c53f8c39649b8e0b3c757bc8ff963025a | [
"CC-BY-4.0"
] | 15 | 2020-10-07T08:56:45.000Z | 2022-02-08T23:13:22.000Z | extern/gnat_sdl/gnat_sdl2/src/sdl_clipboard_h.ads | AdaCore/training_material | 6651eb2c53f8c39649b8e0b3c757bc8ff963025a | [
"CC-BY-4.0"
] | 20 | 2020-11-05T14:35:20.000Z | 2022-01-13T15:59:33.000Z | extern/gnat_sdl/gnat_sdl2/src/sdl_clipboard_h.ads | AdaCore/training_material | 6651eb2c53f8c39649b8e0b3c757bc8ff963025a | [
"CC-BY-4.0"
] | 6 | 2020-10-08T15:57:06.000Z | 2021-08-31T12:03:08.000Z | pragma Ada_2005;
pragma Style_Checks (Off);
with Interfaces.C; use Interfaces.C;
with Interfaces.C.Strings;
with SDL_stdinc_h;
package SDL_clipboard_h is
-- Simple DirectMedia Layer
-- Copyright (C) 1997-2018 Sam Lantinga <[email protected]>
-- 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.
--
--*
-- * \file SDL_clipboard.h
-- *
-- * Include file for SDL clipboard handling
--
-- Set up for C function definitions, even when using C++
-- Function prototypes
--*
-- * \brief Put UTF-8 text into the clipboard
-- *
-- * \sa SDL_GetClipboardText()
--
function SDL_SetClipboardText (text : Interfaces.C.Strings.chars_ptr) return int; -- ..\SDL2_tmp\SDL_clipboard.h:46
pragma Import (C, SDL_SetClipboardText, "SDL_SetClipboardText");
--*
-- * \brief Get UTF-8 text from the clipboard, which must be freed with SDL_free()
-- *
-- * \sa SDL_SetClipboardText()
--
function SDL_GetClipboardText return Interfaces.C.Strings.chars_ptr; -- ..\SDL2_tmp\SDL_clipboard.h:53
pragma Import (C, SDL_GetClipboardText, "SDL_GetClipboardText");
--*
-- * \brief Returns a flag indicating whether the clipboard exists and contains a text string that is non-empty
-- *
-- * \sa SDL_GetClipboardText()
--
function SDL_HasClipboardText return SDL_stdinc_h.SDL_bool; -- ..\SDL2_tmp\SDL_clipboard.h:60
pragma Import (C, SDL_HasClipboardText, "SDL_HasClipboardText");
-- Ends C function definitions when using C++
-- vi: set ts=4 sw=4 expandtab:
end SDL_clipboard_h;
| 36.784615 | 119 | 0.706399 |
38e2f8c69c9ee65b555f28eece8326b3cd02611a | 819 | adb | Ada | tlsf/src/proof/relation/tlsf-proof-relation.adb | vasil-sd/ada-tlsf | c30cfaf5f0b87ebb6e4dd479e50b3f9b11381ddd | [
"MIT"
] | 3 | 2020-02-21T15:42:14.000Z | 2020-04-08T09:42:32.000Z | tlsf/src/proof/relation/tlsf-proof-relation.adb | vasil-sd/ada-tlsf | c30cfaf5f0b87ebb6e4dd479e50b3f9b11381ddd | [
"MIT"
] | null | null | null | tlsf/src/proof/relation/tlsf-proof-relation.adb | vasil-sd/ada-tlsf | c30cfaf5f0b87ebb6e4dd479e50b3f9b11381ddd | [
"MIT"
] | 1 | 2020-02-21T15:29:26.000Z | 2020-02-21T15:29:26.000Z | pragma Ada_2012;
package body TLSF.Proof.Relation is
function Relate(Container : R;
From, To : Element_Type)
return R
is
Len : constant Count_Type := Length(Container);
A : constant Arrow := (From, To);
begin
if Contains(Container, A) then
return Container;
else
pragma Assert (not Contains(Container, A));
declare
New_Container : constant R := Add(Container, A);
New_Len : constant Count_Type := Length(New_Container);
begin
pragma Assert (Contains(Container => Container,
Item => A));
pragma Assert (New_Len > Len);
return New_Container;
end;
end if;
end Relate;
end TLSF.Proof.Relation;
| 29.25 | 67 | 0.542125 |
d1a3d3c3f0746c065c81e23fcd030fba22085038 | 6,455 | ads | Ada | src/shared/generic/lsc-internal-aes.ads | Componolit/libsparkcrypto | 8531a07b6e9f5eb33eae0fa32759b4cbd3509d95 | [
"OpenSSL",
"Unlicense"
] | 30 | 2018-05-18T09:11:50.000Z | 2021-05-18T16:29:14.000Z | src/shared/generic/lsc-internal-aes.ads | Componolit/libsparkcrypto | 8531a07b6e9f5eb33eae0fa32759b4cbd3509d95 | [
"OpenSSL",
"Unlicense"
] | 15 | 2018-12-13T07:53:36.000Z | 2019-09-24T19:43:35.000Z | src/shared/generic/lsc-internal-aes.ads | Componolit/libsparkcrypto | 8531a07b6e9f5eb33eae0fa32759b4cbd3509d95 | [
"OpenSSL",
"Unlicense"
] | 3 | 2019-04-04T17:41:29.000Z | 2021-05-07T22:28:46.000Z | -------------------------------------------------------------------------------
-- This file is part of libsparkcrypto.
--
-- Copyright (C) 2010, Alexander Senier
-- Copyright (C) 2010, secunet Security Networks AG
-- All rights reserved.
--
-- Redistribution and use in source and binary forms, with or without
-- modification, are permitted provided that the following conditions are met:
--
-- * Redistributions of source code must retain the above copyright notice,
-- this list of conditions and the following disclaimer.
--
-- * Redistributions in binary form must reproduce the above copyright
-- notice, this list of conditions and the following disclaimer in the
-- documentation and/or other materials provided with the distribution.
--
-- * Neither the name of the nor the names of its contributors may be used
-- to endorse or promote products derived from this software without
-- specific prior written permission.
--
-- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
-- AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-- IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
-- ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS
-- BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
-- CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
-- SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
-- INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
-- CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
-- ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
-- POSSIBILITY OF SUCH DAMAGE.
-------------------------------------------------------------------------------
with LSC.Internal.Types;
use type LSC.Internal.Types.Word32;
use type LSC.Internal.Types.Index;
-------------------------------------------------------------------------------
-- The AES algorithm
--
-- <ul>
-- <li>
-- <a href="http://csrc.nist.gov/publications/fips/fips197/fips-197.pdf">
-- FIPS PUB 197, Advanced Encryption Standard (AES), National Institute of
-- Standards and Technology, U.S. Department of Commerce, November 2001. </a>
-- </li>
--
-- <li>
-- <a href="http://csrc.nist.gov/archive/aes/rijndael/Rijndael-ammended.pdf">
-- Joan Daemen and Vincent Rijmen, AES submission document on Rijndael,
-- Version 2, September 1999.</a>
-- </li>
-- </ul>
-------------------------------------------------------------------------------
package LSC.Internal.AES is
pragma Pure;
-- AES encryption context
type AES_Enc_Context is private;
-- AES decryption context
type AES_Dec_Context is private;
-- Index of AES key
subtype Key_Index is Types.Index range 0 .. 7;
-- AES key
type Key_Type is array (Key_Index range <>) of Types.Word32;
-- Index of AES-128 key
subtype AES128_Key_Index is Types.Index range 0 .. 3;
-- AES-128 key
subtype AES128_Key_Type is Key_Type (AES128_Key_Index);
-- Index of AES-192 key
subtype AES192_Key_Index is Types.Index range 0 .. 5;
-- AES-192 key
subtype AES192_Key_Type is Key_Type (AES192_Key_Index);
-- Index of AES-256 key
subtype AES256_Key_Index is Types.Index range 0 .. 7;
-- AES-256 key
subtype AES256_Key_Type is Key_Type (AES256_Key_Index);
-- Index of AES block
subtype Block_Index is Types.Index range 0 .. 3;
-- AES block
subtype Block_Type is Types.Word32_Array_Type (Block_Index);
-- Index of AES message
subtype Message_Index is Natural;
-- AES message (unconstrained array of AES blocks)
type Message_Type is array (Message_Index range <>) of Block_Type;
-- Create AES-128 encryption context from AES-128 @Key@
function Create_AES128_Enc_Context (Key : AES128_Key_Type) return AES_Enc_Context;
-- Create AES-192 encryption context from AES-192 @Key@
function Create_AES192_Enc_Context (Key : AES192_Key_Type) return AES_Enc_Context;
-- Create AES-256 encryption context from AES-256 @Key@
function Create_AES256_Enc_Context (Key : AES256_Key_Type) return AES_Enc_Context;
-- Encrypt one @Plaintext@ block using given @Context@, return one block of
-- ciphertext
function Encrypt (Context : AES_Enc_Context;
Plaintext : Block_Type) return Block_Type
with Global => null;
-- Create AES-128 decryption context from AES-128 @Key@
function Create_AES128_Dec_Context (Key : AES128_Key_Type) return AES_Dec_Context;
-- Create AES-192 decryption context from AES-192 @Key@
function Create_AES192_Dec_Context (Key : AES192_Key_Type) return AES_Dec_Context;
-- Create AES-256 decryption context from AES-256 @Key@
function Create_AES256_Dec_Context (Key : AES256_Key_Type) return AES_Dec_Context;
-- Decrypt one @Ciphertext@ block using given @Context@, return one block of
-- plaintext
function Decrypt (Context : AES_Dec_Context;
Ciphertext : Block_Type) return Block_Type
with Global => null;
-- Empty AES block
Null_Block : constant Block_Type;
-- Empty AES-128 key
Null_AES128_Key : constant AES128_Key_Type;
-- Empty AES-192 key
Null_AES192_Key : constant AES192_Key_Type;
-- Empty AES-256 key
Null_AES256_Key : constant AES256_Key_Type;
private
Nb : constant Types.Index := 4;
subtype Schedule_Index is Types.Index range 0 .. 15 * Nb - 1;
subtype Schedule_Type is Types.Word32_Array_Type (Schedule_Index);
Null_Schedule : constant Schedule_Type :=
Schedule_Type'(Schedule_Index => 0);
subtype Nr_Type is Types.Index range 10 .. 14;
subtype Nk_Type is Types.Index range 4 .. 8;
type AES_Enc_Context is
record
Schedule : Schedule_Type;
Nr : Nr_Type;
end record;
type AES_Dec_Context is
record
Schedule : Schedule_Type;
Nr : Nr_Type;
end record;
Null_Block : constant Block_Type :=
Block_Type'(Block_Index => 0);
Null_AES128_Key : constant AES128_Key_Type :=
AES128_Key_Type'(AES128_Key_Index => 0);
Null_AES192_Key : constant AES192_Key_Type :=
AES192_Key_Type'(AES192_Key_Index => 0);
Null_AES256_Key : constant AES256_Key_Type :=
AES256_Key_Type'(AES256_Key_Index => 0);
end LSC.Internal.AES;
| 35.467033 | 85 | 0.674826 |
5e189b0625702e8996d864b51a52d6053cc7114a | 120 | adb | Ada | gcc-gcc-7_3_0-release/gcc/testsuite/ada/acats/support/impbit.adb | best08618/asylo | 5a520a9f5c461ede0f32acc284017b737a43898c | [
"Apache-2.0"
] | 7 | 2020-05-02T17:34:05.000Z | 2021-10-17T10:15:18.000Z | gcc-gcc-7_3_0-release/gcc/testsuite/ada/acats/support/impbit.adb | best08618/asylo | 5a520a9f5c461ede0f32acc284017b737a43898c | [
"Apache-2.0"
] | null | null | null | gcc-gcc-7_3_0-release/gcc/testsuite/ada/acats/support/impbit.adb | best08618/asylo | 5a520a9f5c461ede0f32acc284017b737a43898c | [
"Apache-2.0"
] | 2 | 2020-07-27T00:22:36.000Z | 2021-04-01T09:41:02.000Z | with System;
with Ada.Text_IO;
procedure Impbit is
begin
Ada.Text_IO.Put_Line (System.Address'Size'Img);
end Impbit;
| 17.142857 | 50 | 0.775 |
30132cae75d12104aefb8eb9fcd0ef1aa0414cac | 4,441 | ads | Ada | source/amf/utp/amf-utp-get_timezone_actions.ads | svn2github/matreshka | 9d222b3ad9da508855fb1f5adbe5e8a4fad4c530 | [
"BSD-3-Clause"
] | 24 | 2016-11-29T06:59:41.000Z | 2021-08-30T11:55:16.000Z | source/amf/utp/amf-utp-get_timezone_actions.ads | svn2github/matreshka | 9d222b3ad9da508855fb1f5adbe5e8a4fad4c530 | [
"BSD-3-Clause"
] | 2 | 2019-01-16T05:15:20.000Z | 2019-02-03T10:03:32.000Z | source/amf/utp/amf-utp-get_timezone_actions.ads | svn2github/matreshka | 9d222b3ad9da508855fb1f5adbe5e8a4fad4c530 | [
"BSD-3-Clause"
] | 4 | 2017-07-18T07:11:05.000Z | 2020-06-21T03:02:25.000Z | ------------------------------------------------------------------------------
-- --
-- Matreshka Project --
-- --
-- Ada Modeling Framework --
-- --
-- Runtime Library Component --
-- --
------------------------------------------------------------------------------
-- --
-- Copyright © 2012, Vadim Godunko <[email protected]> --
-- All rights reserved. --
-- --
-- Redistribution and use in source and binary forms, with or without --
-- modification, are permitted provided that the following conditions --
-- are met: --
-- --
-- * Redistributions of source code must retain the above copyright --
-- notice, this list of conditions and the following disclaimer. --
-- --
-- * Redistributions in binary form must reproduce the above copyright --
-- notice, this list of conditions and the following disclaimer in the --
-- documentation and/or other materials provided with the distribution. --
-- --
-- * Neither the name of the Vadim Godunko, IE nor the names of its --
-- contributors may be used to endorse or promote products derived from --
-- this software without specific prior written permission. --
-- --
-- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS --
-- "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT --
-- LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR --
-- A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT --
-- HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, --
-- SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED --
-- TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR --
-- PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF --
-- LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING --
-- NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS --
-- SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. --
-- --
------------------------------------------------------------------------------
-- $Revision$ $Date$
------------------------------------------------------------------------------
-- This file is generated, don't edit it.
------------------------------------------------------------------------------
limited with AMF.UML.Read_Structural_Feature_Actions;
package AMF.Utp.Get_Timezone_Actions is
pragma Preelaborate;
type Utp_Get_Timezone_Action is limited interface;
type Utp_Get_Timezone_Action_Access is
access all Utp_Get_Timezone_Action'Class;
for Utp_Get_Timezone_Action_Access'Storage_Size use 0;
not overriding function Get_Base_Read_Structural_Feature_Action
(Self : not null access constant Utp_Get_Timezone_Action)
return AMF.UML.Read_Structural_Feature_Actions.UML_Read_Structural_Feature_Action_Access is abstract;
-- Getter of GetTimezoneAction::base_ReadStructuralFeatureAction.
--
not overriding procedure Set_Base_Read_Structural_Feature_Action
(Self : not null access Utp_Get_Timezone_Action;
To : AMF.UML.Read_Structural_Feature_Actions.UML_Read_Structural_Feature_Action_Access) is abstract;
-- Setter of GetTimezoneAction::base_ReadStructuralFeatureAction.
--
end AMF.Utp.Get_Timezone_Actions;
| 62.549296 | 108 | 0.479171 |
d1158fd4c2131b47925267588b84e58300fee1fc | 3,605 | ads | Ada | source/amf/uml/amf-umldi-uml_edges-hash.ads | svn2github/matreshka | 9d222b3ad9da508855fb1f5adbe5e8a4fad4c530 | [
"BSD-3-Clause"
] | 24 | 2016-11-29T06:59:41.000Z | 2021-08-30T11:55:16.000Z | source/amf/uml/amf-umldi-uml_edges-hash.ads | svn2github/matreshka | 9d222b3ad9da508855fb1f5adbe5e8a4fad4c530 | [
"BSD-3-Clause"
] | 2 | 2019-01-16T05:15:20.000Z | 2019-02-03T10:03:32.000Z | source/amf/uml/amf-umldi-uml_edges-hash.ads | svn2github/matreshka | 9d222b3ad9da508855fb1f5adbe5e8a4fad4c530 | [
"BSD-3-Clause"
] | 4 | 2017-07-18T07:11:05.000Z | 2020-06-21T03:02:25.000Z | ------------------------------------------------------------------------------
-- --
-- Matreshka Project --
-- --
-- Ada Modeling Framework --
-- --
-- Runtime Library Component --
-- --
------------------------------------------------------------------------------
-- --
-- Copyright © 2011-2012, Vadim Godunko <[email protected]> --
-- All rights reserved. --
-- --
-- Redistribution and use in source and binary forms, with or without --
-- modification, are permitted provided that the following conditions --
-- are met: --
-- --
-- * Redistributions of source code must retain the above copyright --
-- notice, this list of conditions and the following disclaimer. --
-- --
-- * Redistributions in binary form must reproduce the above copyright --
-- notice, this list of conditions and the following disclaimer in the --
-- documentation and/or other materials provided with the distribution. --
-- --
-- * Neither the name of the Vadim Godunko, IE nor the names of its --
-- contributors may be used to endorse or promote products derived from --
-- this software without specific prior written permission. --
-- --
-- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS --
-- "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT --
-- LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR --
-- A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT --
-- HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, --
-- SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED --
-- TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR --
-- PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF --
-- LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING --
-- NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS --
-- SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. --
-- --
------------------------------------------------------------------------------
-- $Revision$ $Date$
------------------------------------------------------------------------------
-- This file is generated, don't edit it.
------------------------------------------------------------------------------
with AMF.Elements.Generic_Hash;
function AMF.UMLDI.UML_Edges.Hash is
new AMF.Elements.Generic_Hash (UMLDI_UML_Edge, UMLDI_UML_Edge_Access);
| 72.1 | 78 | 0.401387 |
194ad2728347d80d61ada5c4e66e5dad1e47579e | 2,570 | ads | Ada | Validation/pyFrame3DD-master/gcc-master/gcc/ada/gnatkr.ads | djamal2727/Main-Bearing-Analytical-Model | 2f00c2219c71be0175c6f4f8f1d4cca231d97096 | [
"Apache-2.0"
] | null | null | null | Validation/pyFrame3DD-master/gcc-master/gcc/ada/gnatkr.ads | djamal2727/Main-Bearing-Analytical-Model | 2f00c2219c71be0175c6f4f8f1d4cca231d97096 | [
"Apache-2.0"
] | null | null | null | Validation/pyFrame3DD-master/gcc-master/gcc/ada/gnatkr.ads | djamal2727/Main-Bearing-Analytical-Model | 2f00c2219c71be0175c6f4f8f1d4cca231d97096 | [
"Apache-2.0"
] | null | null | null | ------------------------------------------------------------------------------
-- --
-- GNAT COMPILER COMPONENTS --
-- --
-- G N A T K R --
-- --
-- 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. See the GNU General Public License --
-- for more details. You should have received a copy of the GNU General --
-- Public License distributed with GNAT; see file COPYING3. If not, go to --
-- http://www.gnu.org/licenses for a complete copy of the license. --
-- --
-- GNAT was originally developed by the GNAT team at New York University. --
-- Extensive contributions were provided by Ada Core Technologies Inc. --
-- --
------------------------------------------------------------------------------
-- This is a small utility program that incorporates the file krunching
-- algorithm used by the GNAT compiler (when the -gnatk switch is used)
-- gnatkr filename length
-- where length is a decimal value, outputs to standard output the krunched
-- name, followed by the original input file name. The file name has an
-- optional extension, which, if present, is copied unchanged to the output.
-- The length argument is optional and defaults to the system default if
-- there is one, otherwise to 8.
procedure Gnatkr;
-- Execute above described command. This is an Ada main program which
-- sets an exit status (set to Success or Failure as appropriate)
| 64.25 | 78 | 0.46537 |
5ebf951f5a40450ae553e4c99e3078b55369dca0 | 51,826 | adb | Ada | bb-runtimes/runtimes/ravenscar-full-stm32f3x4/gnat/a-cforse.adb | JCGobbi/Nucleo-STM32F334R8 | 2a0b1b4b2664c92773703ac5e95dcb71979d051c | [
"BSD-3-Clause"
] | null | null | null | bb-runtimes/runtimes/ravenscar-full-stm32f3x4/gnat/a-cforse.adb | JCGobbi/Nucleo-STM32F334R8 | 2a0b1b4b2664c92773703ac5e95dcb71979d051c | [
"BSD-3-Clause"
] | null | null | null | bb-runtimes/runtimes/ravenscar-full-stm32f3x4/gnat/a-cforse.adb | JCGobbi/Nucleo-STM32F334R8 | 2a0b1b4b2664c92773703ac5e95dcb71979d051c | [
"BSD-3-Clause"
] | null | null | null | ------------------------------------------------------------------------------
-- --
-- GNAT LIBRARY COMPONENTS --
-- --
-- A D A . C O N T A I N E R S . F O R M A L _ O R D E R E D _ S E T S --
-- --
-- B o d y --
-- --
-- Copyright (C) 2010-2021, 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/>. --
------------------------------------------------------------------------------
with Ada.Containers.Red_Black_Trees.Generic_Bounded_Operations;
pragma Elaborate_All
(Ada.Containers.Red_Black_Trees.Generic_Bounded_Operations);
with Ada.Containers.Red_Black_Trees.Generic_Bounded_Keys;
pragma Elaborate_All (Ada.Containers.Red_Black_Trees.Generic_Bounded_Keys);
with Ada.Containers.Red_Black_Trees.Generic_Bounded_Set_Operations;
pragma Elaborate_All
(Ada.Containers.Red_Black_Trees.Generic_Bounded_Set_Operations);
with System; use type System.Address;
package body Ada.Containers.Formal_Ordered_Sets with
SPARK_Mode => Off
is
------------------------------
-- Access to Fields of Node --
------------------------------
-- These subprograms provide functional notation for access to fields
-- of a node, and procedural notation for modifiying these fields.
function Color (Node : Node_Type) return Red_Black_Trees.Color_Type;
pragma Inline (Color);
function Left_Son (Node : Node_Type) return Count_Type;
pragma Inline (Left_Son);
function Parent (Node : Node_Type) return Count_Type;
pragma Inline (Parent);
function Right_Son (Node : Node_Type) return Count_Type;
pragma Inline (Right_Son);
procedure Set_Color
(Node : in out Node_Type;
Color : Red_Black_Trees.Color_Type);
pragma Inline (Set_Color);
procedure Set_Left (Node : in out Node_Type; Left : Count_Type);
pragma Inline (Set_Left);
procedure Set_Right (Node : in out Node_Type; Right : Count_Type);
pragma Inline (Set_Right);
procedure Set_Parent (Node : in out Node_Type; Parent : Count_Type);
pragma Inline (Set_Parent);
-----------------------
-- Local Subprograms --
-----------------------
-- Comments needed???
procedure Assign
(Target : in out Tree_Types.Tree_Type;
Source : Tree_Types.Tree_Type);
generic
with procedure Set_Element (Node : in out Node_Type);
procedure Generic_Allocate
(Tree : in out Tree_Types.Tree_Type'Class;
Node : out Count_Type);
procedure Free (Tree : in out Set; X : Count_Type);
procedure Insert_Sans_Hint
(Container : in out Tree_Types.Tree_Type;
New_Item : Element_Type;
Node : out Count_Type;
Inserted : out Boolean);
procedure Insert_With_Hint
(Dst_Set : in out Tree_Types.Tree_Type;
Dst_Hint : Count_Type;
Src_Node : Node_Type;
Dst_Node : out Count_Type);
function Is_Greater_Element_Node
(Left : Element_Type;
Right : Node_Type) return Boolean;
pragma Inline (Is_Greater_Element_Node);
function Is_Less_Element_Node
(Left : Element_Type;
Right : Node_Type) return Boolean;
pragma Inline (Is_Less_Element_Node);
function Is_Less_Node_Node (L, R : Node_Type) return Boolean;
pragma Inline (Is_Less_Node_Node);
procedure Replace_Element
(Tree : in out Set;
Node : Count_Type;
Item : Element_Type);
--------------------------
-- Local Instantiations --
--------------------------
package Tree_Operations is
new Red_Black_Trees.Generic_Bounded_Operations
(Tree_Types,
Left => Left_Son,
Right => Right_Son);
use Tree_Operations;
package Element_Keys is
new Red_Black_Trees.Generic_Bounded_Keys
(Tree_Operations => Tree_Operations,
Key_Type => Element_Type,
Is_Less_Key_Node => Is_Less_Element_Node,
Is_Greater_Key_Node => Is_Greater_Element_Node);
package Set_Ops is
new Red_Black_Trees.Generic_Bounded_Set_Operations
(Tree_Operations => Tree_Operations,
Set_Type => Tree_Types.Tree_Type,
Assign => Assign,
Insert_With_Hint => Insert_With_Hint,
Is_Less => Is_Less_Node_Node);
---------
-- "=" --
---------
function "=" (Left, Right : Set) return Boolean is
Lst : Count_Type;
Node : Count_Type;
ENode : Count_Type;
begin
if Length (Left) /= Length (Right) then
return False;
end if;
if Is_Empty (Left) then
return True;
end if;
Lst := Next (Left.Content, Last (Left).Node);
Node := First (Left).Node;
while Node /= Lst loop
ENode := Find (Right, Left.Content.Nodes (Node).Element).Node;
if ENode = 0
or else Left.Content.Nodes (Node).Element /=
Right.Content.Nodes (ENode).Element
then
return False;
end if;
Node := Next (Left.Content, Node);
end loop;
return True;
end "=";
------------
-- Assign --
------------
procedure Assign
(Target : in out Tree_Types.Tree_Type;
Source : Tree_Types.Tree_Type)
is
procedure Append_Element (Source_Node : Count_Type);
procedure Append_Elements is
new Tree_Operations.Generic_Iteration (Append_Element);
--------------------
-- Append_Element --
--------------------
procedure Append_Element (Source_Node : Count_Type) is
SN : Node_Type renames Source.Nodes (Source_Node);
procedure Set_Element (Node : in out Node_Type);
pragma Inline (Set_Element);
function New_Node return Count_Type;
pragma Inline (New_Node);
procedure Insert_Post is
new Element_Keys.Generic_Insert_Post (New_Node);
procedure Unconditional_Insert_Sans_Hint is
new Element_Keys.Generic_Unconditional_Insert (Insert_Post);
procedure Unconditional_Insert_Avec_Hint is
new Element_Keys.Generic_Unconditional_Insert_With_Hint
(Insert_Post,
Unconditional_Insert_Sans_Hint);
procedure Allocate is new Generic_Allocate (Set_Element);
--------------
-- New_Node --
--------------
function New_Node return Count_Type is
Result : Count_Type;
begin
Allocate (Target, Result);
return Result;
end New_Node;
-----------------
-- Set_Element --
-----------------
procedure Set_Element (Node : in out Node_Type) is
begin
Node.Element := SN.Element;
end Set_Element;
-- Local variables
Target_Node : Count_Type;
-- Start of processing for Append_Element
begin
Unconditional_Insert_Avec_Hint
(Tree => Target,
Hint => 0,
Key => SN.Element,
Node => Target_Node);
end Append_Element;
-- Start of processing for Assign
begin
if Target'Address = Source'Address then
return;
end if;
if Target.Capacity < Source.Length then
raise Constraint_Error
with "Target capacity is less than Source length";
end if;
Tree_Operations.Clear_Tree (Target);
Append_Elements (Source);
end Assign;
procedure Assign (Target : in out Set; Source : Set) is
begin
Assign (Target.Content, Source.Content);
end Assign;
-------------
-- Ceiling --
-------------
function Ceiling (Container : Set; Item : Element_Type) return Cursor is
Node : constant Count_Type :=
Element_Keys.Ceiling (Container.Content, Item);
begin
if Node = 0 then
return No_Element;
end if;
return (Node => Node);
end Ceiling;
-----------
-- Clear --
-----------
procedure Clear (Container : in out Set) is
begin
Tree_Operations.Clear_Tree (Container.Content);
end Clear;
-----------
-- Color --
-----------
function Color (Node : Node_Type) return Red_Black_Trees.Color_Type is
begin
return Node.Color;
end Color;
------------------------
-- Constant_Reference --
------------------------
function Constant_Reference
(Container : aliased Set;
Position : Cursor) return not null access constant Element_Type
is
begin
if not Has_Element (Container, Position) then
raise Constraint_Error with "Position cursor has no element";
end if;
pragma Assert (Vet (Container.Content, Position.Node),
"bad cursor in Element");
return Container.Content.Nodes (Position.Node).Element'Access;
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) return Set is
Node : Count_Type;
N : Count_Type;
Target : Set (Count_Type'Max (Source.Capacity, Capacity));
begin
if 0 < Capacity and then Capacity < Source.Capacity then
raise Capacity_Error;
end if;
if Length (Source) > 0 then
Target.Content.Length := Source.Content.Length;
Target.Content.Root := Source.Content.Root;
Target.Content.First := Source.Content.First;
Target.Content.Last := Source.Content.Last;
Target.Content.Free := Source.Content.Free;
Node := 1;
while Node <= Source.Capacity loop
Target.Content.Nodes (Node).Element :=
Source.Content.Nodes (Node).Element;
Target.Content.Nodes (Node).Parent :=
Source.Content.Nodes (Node).Parent;
Target.Content.Nodes (Node).Left :=
Source.Content.Nodes (Node).Left;
Target.Content.Nodes (Node).Right :=
Source.Content.Nodes (Node).Right;
Target.Content.Nodes (Node).Color :=
Source.Content.Nodes (Node).Color;
Target.Content.Nodes (Node).Has_Element :=
Source.Content.Nodes (Node).Has_Element;
Node := Node + 1;
end loop;
while Node <= Target.Capacity loop
N := Node;
Free (Tree => Target, X => N);
Node := Node + 1;
end loop;
end if;
return Target;
end Copy;
------------
-- Delete --
------------
procedure Delete (Container : in out Set; Position : in out Cursor) is
begin
if not Has_Element (Container, Position) then
raise Constraint_Error with "Position cursor has no element";
end if;
pragma Assert (Vet (Container.Content, Position.Node),
"bad cursor in Delete");
Tree_Operations.Delete_Node_Sans_Free (Container.Content,
Position.Node);
Free (Container, Position.Node);
Position := No_Element;
end Delete;
procedure Delete (Container : in out Set; Item : Element_Type) is
X : constant Count_Type := Element_Keys.Find (Container.Content, Item);
begin
if X = 0 then
raise Constraint_Error with "attempt to delete element not in set";
end if;
Tree_Operations.Delete_Node_Sans_Free (Container.Content, X);
Free (Container, X);
end Delete;
------------------
-- Delete_First --
------------------
procedure Delete_First (Container : in out Set) is
X : constant Count_Type := Container.Content.First;
begin
if X /= 0 then
Tree_Operations.Delete_Node_Sans_Free (Container.Content, X);
Free (Container, X);
end if;
end Delete_First;
-----------------
-- Delete_Last --
-----------------
procedure Delete_Last (Container : in out Set) is
X : constant Count_Type := Container.Content.Last;
begin
if X /= 0 then
Tree_Operations.Delete_Node_Sans_Free (Container.Content, X);
Free (Container, X);
end if;
end Delete_Last;
----------------
-- Difference --
----------------
procedure Difference (Target : in out Set; Source : Set) is
begin
Set_Ops.Set_Difference (Target.Content, Source.Content);
end Difference;
function Difference (Left, Right : Set) return Set is
begin
if Left'Address = Right'Address then
return Empty_Set;
end if;
if Length (Left) = 0 then
return Empty_Set;
end if;
if Length (Right) = 0 then
return Copy (Left);
end if;
return S : Set (Length (Left)) do
Assign
(S.Content, Set_Ops.Set_Difference (Left.Content, Right.Content));
end return;
end Difference;
-------------
-- Element --
-------------
function Element (Container : Set; Position : Cursor) return Element_Type is
begin
if not Has_Element (Container, Position) then
raise Constraint_Error with "Position cursor has no element";
end if;
pragma Assert (Vet (Container.Content, Position.Node),
"bad cursor in Element");
return Container.Content.Nodes (Position.Node).Element;
end Element;
-------------------------
-- Equivalent_Elements --
-------------------------
function Equivalent_Elements (Left, Right : Element_Type) return Boolean is
begin
if Left < Right
or else Right < Left
then
return False;
else
return True;
end if;
end Equivalent_Elements;
---------------------
-- Equivalent_Sets --
---------------------
function Equivalent_Sets (Left, Right : Set) return Boolean is
function Is_Equivalent_Node_Node
(L, R : Node_Type) return Boolean;
pragma Inline (Is_Equivalent_Node_Node);
function Is_Equivalent is
new Tree_Operations.Generic_Equal (Is_Equivalent_Node_Node);
-----------------------------
-- Is_Equivalent_Node_Node --
-----------------------------
function Is_Equivalent_Node_Node (L, R : Node_Type) return Boolean is
begin
if L.Element < R.Element then
return False;
elsif R.Element < L.Element then
return False;
else
return True;
end if;
end Is_Equivalent_Node_Node;
-- Start of processing for Equivalent_Sets
begin
return Is_Equivalent (Left.Content, Right.Content);
end Equivalent_Sets;
-------------
-- Exclude --
-------------
procedure Exclude (Container : in out Set; Item : Element_Type) is
X : constant Count_Type := Element_Keys.Find (Container.Content, Item);
begin
if X /= 0 then
Tree_Operations.Delete_Node_Sans_Free (Container.Content, X);
Free (Container, X);
end if;
end Exclude;
----------
-- Find --
----------
function Find (Container : Set; Item : Element_Type) return Cursor is
Node : constant Count_Type :=
Element_Keys.Find (Container.Content, Item);
begin
if Node = 0 then
return No_Element;
end if;
return (Node => Node);
end Find;
-----------
-- First --
-----------
function First (Container : Set) return Cursor is
begin
if Length (Container) = 0 then
return No_Element;
end if;
return (Node => Container.Content.First);
end First;
-------------------
-- First_Element --
-------------------
function First_Element (Container : Set) return Element_Type is
Fst : constant Count_Type := First (Container).Node;
begin
if Fst = 0 then
raise Constraint_Error with "set is empty";
end if;
declare
N : Tree_Types.Nodes_Type renames Container.Content.Nodes;
begin
return N (Fst).Element;
end;
end First_Element;
-----------
-- Floor --
-----------
function Floor (Container : Set; Item : Element_Type) return Cursor is
begin
declare
Node : constant Count_Type :=
Element_Keys.Floor (Container.Content, Item);
begin
if Node = 0 then
return No_Element;
end if;
return (Node => Node);
end;
end Floor;
------------------
-- Formal_Model --
------------------
package body Formal_Model is
-------------------------
-- E_Bigger_Than_Range --
-------------------------
function E_Bigger_Than_Range
(Container : E.Sequence;
Fst : Positive_Count_Type;
Lst : Count_Type;
Item : Element_Type) return Boolean
is
begin
for I in Fst .. Lst loop
if not (E.Get (Container, I) < Item) then
return False;
end if;
end loop;
return True;
end E_Bigger_Than_Range;
-------------------------
-- E_Elements_Included --
-------------------------
function E_Elements_Included
(Left : E.Sequence;
Right : E.Sequence) return Boolean
is
begin
for I in 1 .. E.Length (Left) loop
if not E.Contains (Right, 1, E.Length (Right), E.Get (Left, I))
then
return False;
end if;
end loop;
return True;
end E_Elements_Included;
function E_Elements_Included
(Left : E.Sequence;
Model : M.Set;
Right : E.Sequence) return Boolean
is
begin
for I in 1 .. E.Length (Left) loop
declare
Item : constant Element_Type := E.Get (Left, I);
begin
if M.Contains (Model, Item) then
if not E.Contains (Right, 1, E.Length (Right), Item) then
return False;
end if;
end if;
end;
end loop;
return True;
end E_Elements_Included;
function E_Elements_Included
(Container : E.Sequence;
Model : M.Set;
Left : E.Sequence;
Right : E.Sequence) return Boolean
is
begin
for I in 1 .. E.Length (Container) loop
declare
Item : constant Element_Type := E.Get (Container, I);
begin
if M.Contains (Model, Item) then
if not E.Contains (Left, 1, E.Length (Left), Item) then
return False;
end if;
else
if not E.Contains (Right, 1, E.Length (Right), Item) then
return False;
end if;
end if;
end;
end loop;
return True;
end E_Elements_Included;
---------------
-- E_Is_Find --
---------------
function E_Is_Find
(Container : E.Sequence;
Item : Element_Type;
Position : Count_Type) return Boolean
is
begin
for I in 1 .. Position - 1 loop
if Item < E.Get (Container, I) then
return False;
end if;
end loop;
if Position < E.Length (Container) then
for I in Position + 1 .. E.Length (Container) loop
if E.Get (Container, I) < Item then
return False;
end if;
end loop;
end if;
return True;
end E_Is_Find;
--------------------------
-- E_Smaller_Than_Range --
--------------------------
function E_Smaller_Than_Range
(Container : E.Sequence;
Fst : Positive_Count_Type;
Lst : Count_Type;
Item : Element_Type) return Boolean
is
begin
for I in Fst .. Lst loop
if not (Item < E.Get (Container, I)) then
return False;
end if;
end loop;
return True;
end E_Smaller_Than_Range;
----------
-- Find --
----------
function Find
(Container : E.Sequence;
Item : Element_Type) return Count_Type
is
begin
for I in 1 .. E.Length (Container) loop
if Equivalent_Elements (Item, E.Get (Container, I)) then
return I;
end if;
end loop;
return 0;
end Find;
--------------
-- Elements --
--------------
function Elements (Container : Set) return E.Sequence is
Position : Count_Type := Container.Content.First;
R : E.Sequence;
begin
-- Can't use First, Next or Element here, since they depend on models
-- for their postconditions.
while Position /= 0 loop
R := E.Add (R, Container.Content.Nodes (Position).Element);
Position := Tree_Operations.Next (Container.Content, Position);
end loop;
return R;
end Elements;
----------------------------
-- Lift_Abstraction_Level --
----------------------------
procedure Lift_Abstraction_Level (Container : Set) is null;
-----------------------
-- Mapping_Preserved --
-----------------------
function Mapping_Preserved
(E_Left : E.Sequence;
E_Right : E.Sequence;
P_Left : P.Map;
P_Right : P.Map) return Boolean
is
begin
for C of P_Left loop
if not P.Has_Key (P_Right, C)
or else P.Get (P_Left, C) > E.Length (E_Left)
or else P.Get (P_Right, C) > E.Length (E_Right)
or else E.Get (E_Left, P.Get (P_Left, C)) /=
E.Get (E_Right, P.Get (P_Right, C))
then
return False;
end if;
end loop;
return True;
end Mapping_Preserved;
------------------------------
-- Mapping_Preserved_Except --
------------------------------
function Mapping_Preserved_Except
(E_Left : E.Sequence;
E_Right : E.Sequence;
P_Left : P.Map;
P_Right : P.Map;
Position : Cursor) return Boolean
is
begin
for C of P_Left loop
if C /= Position
and (not P.Has_Key (P_Right, C)
or else P.Get (P_Left, C) > E.Length (E_Left)
or else P.Get (P_Right, C) > E.Length (E_Right)
or else E.Get (E_Left, P.Get (P_Left, C)) /=
E.Get (E_Right, P.Get (P_Right, C)))
then
return False;
end if;
end loop;
return True;
end Mapping_Preserved_Except;
-------------------------
-- P_Positions_Shifted --
-------------------------
function P_Positions_Shifted
(Small : P.Map;
Big : P.Map;
Cut : Positive_Count_Type;
Count : Count_Type := 1) return Boolean
is
begin
for Cu of Small loop
if not P.Has_Key (Big, Cu) then
return False;
end if;
end loop;
for Cu of Big loop
declare
Pos : constant Positive_Count_Type := P.Get (Big, Cu);
begin
if Pos < Cut then
if not P.Has_Key (Small, Cu)
or else Pos /= P.Get (Small, Cu)
then
return False;
end if;
elsif Pos >= Cut + Count then
if not P.Has_Key (Small, Cu)
or else Pos /= P.Get (Small, Cu) + Count
then
return False;
end if;
else
if P.Has_Key (Small, Cu) then
return False;
end if;
end if;
end;
end loop;
return True;
end P_Positions_Shifted;
-----------
-- Model --
-----------
function Model (Container : Set) return M.Set is
Position : Count_Type := Container.Content.First;
R : M.Set;
begin
-- Can't use First, Next or Element here, since they depend on models
-- for their postconditions.
while Position /= 0 loop
R :=
M.Add
(Container => R,
Item => Container.Content.Nodes (Position).Element);
Position := Tree_Operations.Next (Container.Content, Position);
end loop;
return R;
end Model;
---------------
-- Positions --
---------------
function Positions (Container : Set) return P.Map is
I : Count_Type := 1;
Position : Count_Type := Container.Content.First;
R : P.Map;
begin
-- Can't use First, Next or Element here, since they depend on models
-- for their postconditions.
while Position /= 0 loop
R := P.Add (R, (Node => Position), I);
pragma Assert (P.Length (R) = I);
Position := Tree_Operations.Next (Container.Content, Position);
I := I + 1;
end loop;
return R;
end Positions;
end Formal_Model;
----------
-- Free --
----------
procedure Free (Tree : in out Set; X : Count_Type) is
begin
Tree.Content.Nodes (X).Has_Element := False;
Tree_Operations.Free (Tree.Content, X);
end Free;
----------------------
-- Generic_Allocate --
----------------------
procedure Generic_Allocate
(Tree : in out Tree_Types.Tree_Type'Class;
Node : out Count_Type)
is
procedure Allocate is
new Tree_Operations.Generic_Allocate (Set_Element);
begin
Allocate (Tree, Node);
Tree.Nodes (Node).Has_Element := True;
end Generic_Allocate;
------------------
-- Generic_Keys --
------------------
package body Generic_Keys with SPARK_Mode => Off is
-----------------------
-- Local Subprograms --
-----------------------
function Is_Greater_Key_Node
(Left : Key_Type;
Right : Node_Type) return Boolean;
pragma Inline (Is_Greater_Key_Node);
function Is_Less_Key_Node
(Left : Key_Type;
Right : Node_Type) return Boolean;
pragma Inline (Is_Less_Key_Node);
--------------------------
-- Local Instantiations --
--------------------------
package Key_Keys is
new Red_Black_Trees.Generic_Bounded_Keys
(Tree_Operations => Tree_Operations,
Key_Type => Key_Type,
Is_Less_Key_Node => Is_Less_Key_Node,
Is_Greater_Key_Node => Is_Greater_Key_Node);
-------------
-- Ceiling --
-------------
function Ceiling (Container : Set; Key : Key_Type) return Cursor is
Node : constant Count_Type :=
Key_Keys.Ceiling (Container.Content, Key);
begin
if Node = 0 then
return No_Element;
end if;
return (Node => Node);
end Ceiling;
--------------
-- 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 : constant Count_Type := Key_Keys.Find (Container.Content, Key);
begin
if X = 0 then
raise Constraint_Error with "attempt to delete key not in set";
end if;
Delete_Node_Sans_Free (Container.Content, X);
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.Content, Key);
begin
if Node = 0 then
raise Constraint_Error with "key not in set";
end if;
declare
N : Tree_Types.Nodes_Type renames Container.Content.Nodes;
begin
return N (Node).Element;
end;
end Element;
---------------------
-- Equivalent_Keys --
---------------------
function Equivalent_Keys (Left, Right : Key_Type) return Boolean is
begin
if Left < Right
or else Right < Left
then
return False;
else
return True;
end if;
end Equivalent_Keys;
-------------
-- Exclude --
-------------
procedure Exclude (Container : in out Set; Key : Key_Type) is
X : constant Count_Type := Key_Keys.Find (Container.Content, Key);
begin
if X /= 0 then
Delete_Node_Sans_Free (Container.Content, X);
Free (Container, X);
end if;
end Exclude;
----------
-- Find --
----------
function Find (Container : Set; Key : Key_Type) return Cursor is
Node : constant Count_Type := Key_Keys.Find (Container.Content, Key);
begin
return (if Node = 0 then No_Element else (Node => Node));
end Find;
-----------
-- Floor --
-----------
function Floor (Container : Set; Key : Key_Type) return Cursor is
Node : constant Count_Type := Key_Keys.Floor (Container.Content, Key);
begin
return (if Node = 0 then No_Element else (Node => Node));
end Floor;
------------------
-- Formal_Model --
------------------
package body Formal_Model is
-------------------------
-- E_Bigger_Than_Range --
-------------------------
function E_Bigger_Than_Range
(Container : E.Sequence;
Fst : Positive_Count_Type;
Lst : Count_Type;
Key : Key_Type) return Boolean
is
begin
for I in Fst .. Lst loop
if not (Generic_Keys.Key (E.Get (Container, I)) < Key) then
return False;
end if;
end loop;
return True;
end E_Bigger_Than_Range;
---------------
-- E_Is_Find --
---------------
function E_Is_Find
(Container : E.Sequence;
Key : Key_Type;
Position : Count_Type) return Boolean
is
begin
for I in 1 .. Position - 1 loop
if Key < Generic_Keys.Key (E.Get (Container, I)) then
return False;
end if;
end loop;
if Position < E.Length (Container) then
for I in Position + 1 .. E.Length (Container) loop
if Generic_Keys.Key (E.Get (Container, I)) < Key then
return False;
end if;
end loop;
end if;
return True;
end E_Is_Find;
--------------------------
-- E_Smaller_Than_Range --
--------------------------
function E_Smaller_Than_Range
(Container : E.Sequence;
Fst : Positive_Count_Type;
Lst : Count_Type;
Key : Key_Type) return Boolean
is
begin
for I in Fst .. Lst loop
if not (Key < Generic_Keys.Key (E.Get (Container, I))) then
return False;
end if;
end loop;
return True;
end E_Smaller_Than_Range;
----------
-- Find --
----------
function Find
(Container : E.Sequence;
Key : Key_Type) return Count_Type
is
begin
for I in 1 .. E.Length (Container) loop
if Equivalent_Keys
(Key, Generic_Keys.Key (E.Get (Container, I)))
then
return I;
end if;
end loop;
return 0;
end Find;
-----------------------
-- M_Included_Except --
-----------------------
function M_Included_Except
(Left : M.Set;
Right : M.Set;
Key : Key_Type) return Boolean
is
begin
for E of Left loop
if not Contains (Right, E)
and not Equivalent_Keys (Generic_Keys.Key (E), Key)
then
return False;
end if;
end loop;
return True;
end M_Included_Except;
end Formal_Model;
-------------------------
-- Is_Greater_Key_Node --
-------------------------
function Is_Greater_Key_Node
(Left : Key_Type;
Right : Node_Type) return Boolean
is
begin
return Key (Right.Element) < Left;
end Is_Greater_Key_Node;
----------------------
-- Is_Less_Key_Node --
----------------------
function Is_Less_Key_Node
(Left : Key_Type;
Right : Node_Type) return Boolean
is
begin
return Left < Key (Right.Element);
end Is_Less_Key_Node;
---------
-- Key --
---------
function Key (Container : Set; Position : Cursor) return Key_Type is
begin
if not Has_Element (Container, Position) then
raise Constraint_Error with
"Position cursor has no element";
end if;
pragma Assert (Vet (Container.Content, Position.Node),
"bad cursor in Key");
declare
N : Tree_Types.Nodes_Type renames Container.Content.Nodes;
begin
return Key (N (Position.Node).Element);
end;
end Key;
-------------
-- Replace --
-------------
procedure Replace
(Container : in out Set;
Key : Key_Type;
New_Item : Element_Type)
is
Node : constant Count_Type := Key_Keys.Find (Container.Content, Key);
begin
if not Has_Element (Container, (Node => Node)) then
raise Constraint_Error with
"attempt to replace key not in set";
else
Replace_Element (Container, Node, New_Item);
end if;
end Replace;
end Generic_Keys;
-----------------
-- Has_Element --
-----------------
function Has_Element (Container : Set; Position : Cursor) return Boolean is
begin
if Position.Node = 0 then
return False;
else
return Container.Content.Nodes (Position.Node).Has_Element;
end if;
end Has_Element;
-------------
-- 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
declare
N : Tree_Types.Nodes_Type renames Container.Content.Nodes;
begin
N (Position.Node).Element := New_Item;
end;
end if;
end Include;
------------
-- Insert --
------------
procedure Insert
(Container : in out Set;
New_Item : Element_Type;
Position : out Cursor;
Inserted : out Boolean)
is
begin
Insert_Sans_Hint (Container.Content, New_Item, Position.Node, Inserted);
end Insert;
procedure Insert
(Container : in out Set;
New_Item : Element_Type)
is
Position : Cursor;
Inserted : Boolean;
begin
Insert (Container, New_Item, Position, Inserted);
if not Inserted then
raise Constraint_Error with
"attempt to insert element already in set";
end if;
end Insert;
----------------------
-- Insert_Sans_Hint --
----------------------
procedure Insert_Sans_Hint
(Container : in out Tree_Types.Tree_Type;
New_Item : Element_Type;
Node : out Count_Type;
Inserted : out Boolean)
is
procedure Set_Element (Node : in out Node_Type);
function New_Node return Count_Type;
pragma Inline (New_Node);
procedure Insert_Post is
new Element_Keys.Generic_Insert_Post (New_Node);
procedure Conditional_Insert_Sans_Hint is
new Element_Keys.Generic_Conditional_Insert (Insert_Post);
procedure Allocate is new Generic_Allocate (Set_Element);
--------------
-- New_Node --
--------------
function New_Node return Count_Type is
Result : Count_Type;
begin
Allocate (Container, Result);
return Result;
end New_Node;
-----------------
-- Set_Element --
-----------------
procedure Set_Element (Node : in out Node_Type) is
begin
Node.Element := New_Item;
end Set_Element;
-- Start of processing for Insert_Sans_Hint
begin
Conditional_Insert_Sans_Hint
(Container,
New_Item,
Node,
Inserted);
end Insert_Sans_Hint;
----------------------
-- Insert_With_Hint --
----------------------
procedure Insert_With_Hint
(Dst_Set : in out Tree_Types.Tree_Type;
Dst_Hint : Count_Type;
Src_Node : Node_Type;
Dst_Node : out Count_Type)
is
Success : Boolean;
pragma Unreferenced (Success);
procedure Set_Element (Node : in out Node_Type);
function New_Node return Count_Type;
pragma Inline (New_Node);
procedure Insert_Post is
new Element_Keys.Generic_Insert_Post (New_Node);
procedure Insert_Sans_Hint is
new Element_Keys.Generic_Conditional_Insert (Insert_Post);
procedure Local_Insert_With_Hint is
new Element_Keys.Generic_Conditional_Insert_With_Hint
(Insert_Post, Insert_Sans_Hint);
procedure Allocate is new Generic_Allocate (Set_Element);
--------------
-- New_Node --
--------------
function New_Node return Count_Type is
Result : Count_Type;
begin
Allocate (Dst_Set, Result);
return Result;
end New_Node;
-----------------
-- Set_Element --
-----------------
procedure Set_Element (Node : in out Node_Type) is
begin
Node.Element := Src_Node.Element;
end Set_Element;
-- Start of processing for Insert_With_Hint
begin
Local_Insert_With_Hint
(Dst_Set,
Dst_Hint,
Src_Node.Element,
Dst_Node,
Success);
end Insert_With_Hint;
------------------
-- Intersection --
------------------
procedure Intersection (Target : in out Set; Source : Set) is
begin
Set_Ops.Set_Intersection (Target.Content, Source.Content);
end Intersection;
function Intersection (Left, Right : Set) return Set is
begin
if Left'Address = Right'Address then
return Copy (Left);
end if;
return S : Set (Count_Type'Min (Length (Left), Length (Right))) do
Assign (S.Content,
Set_Ops.Set_Intersection (Left.Content, Right.Content));
end return;
end Intersection;
--------------
-- Is_Empty --
--------------
function Is_Empty (Container : Set) return Boolean is
begin
return Length (Container) = 0;
end Is_Empty;
-----------------------------
-- Is_Greater_Element_Node --
-----------------------------
function Is_Greater_Element_Node
(Left : Element_Type;
Right : Node_Type) return Boolean
is
begin
-- Compute e > node same as node < e
return Right.Element < Left;
end Is_Greater_Element_Node;
--------------------------
-- Is_Less_Element_Node --
--------------------------
function Is_Less_Element_Node
(Left : Element_Type;
Right : Node_Type) return Boolean
is
begin
return Left < Right.Element;
end Is_Less_Element_Node;
-----------------------
-- Is_Less_Node_Node --
-----------------------
function Is_Less_Node_Node (L, R : Node_Type) return Boolean is
begin
return L.Element < R.Element;
end Is_Less_Node_Node;
---------------
-- Is_Subset --
---------------
function Is_Subset (Subset : Set; Of_Set : Set) return Boolean is
begin
return Set_Ops.Set_Subset (Subset.Content, Of_Set => Of_Set.Content);
end Is_Subset;
----------
-- Last --
----------
function Last (Container : Set) return Cursor is
begin
return (if Length (Container) = 0
then No_Element
else (Node => Container.Content.Last));
end Last;
------------------
-- Last_Element --
------------------
function Last_Element (Container : Set) return Element_Type is
begin
if Last (Container).Node = 0 then
raise Constraint_Error with "set is empty";
end if;
declare
N : Tree_Types.Nodes_Type renames Container.Content.Nodes;
begin
return N (Last (Container).Node).Element;
end;
end Last_Element;
--------------
-- Left_Son --
--------------
function Left_Son (Node : Node_Type) return Count_Type is
begin
return Node.Left;
end Left_Son;
------------
-- Length --
------------
function Length (Container : Set) return Count_Type is
begin
return Container.Content.Length;
end Length;
----------
-- Move --
----------
procedure Move (Target : in out Set; Source : in out Set) is
N : Tree_Types.Nodes_Type renames Source.Content.Nodes;
X : Count_Type;
begin
if Target'Address = Source'Address then
return;
end if;
if Target.Capacity < Length (Source) then
raise Constraint_Error with -- ???
"Source length exceeds Target capacity";
end if;
Clear (Target);
loop
X := Source.Content.First;
exit when X = 0;
Insert (Target, N (X).Element); -- optimize???
Tree_Operations.Delete_Node_Sans_Free (Source.Content, X);
Free (Source, X);
end loop;
end Move;
----------
-- Next --
----------
function Next (Container : Set; Position : Cursor) return Cursor is
begin
if Position = No_Element then
return No_Element;
end if;
if not Has_Element (Container, Position) then
raise Constraint_Error;
end if;
pragma Assert (Vet (Container.Content, Position.Node),
"bad cursor in Next");
return (Node => Tree_Operations.Next (Container.Content, Position.Node));
end Next;
procedure Next (Container : Set; Position : in out Cursor) is
begin
Position := Next (Container, Position);
end Next;
-------------
-- Overlap --
-------------
function Overlap (Left, Right : Set) return Boolean is
begin
return Set_Ops.Set_Overlap (Left.Content, Right.Content);
end Overlap;
------------
-- Parent --
------------
function Parent (Node : Node_Type) return Count_Type is
begin
return Node.Parent;
end Parent;
--------------
-- Previous --
--------------
function Previous (Container : Set; Position : Cursor) return Cursor is
begin
if Position = No_Element then
return No_Element;
end if;
if not Has_Element (Container, Position) then
raise Constraint_Error;
end if;
pragma Assert (Vet (Container.Content, Position.Node),
"bad cursor in Previous");
declare
Node : constant Count_Type :=
Tree_Operations.Previous (Container.Content, Position.Node);
begin
return (if Node = 0 then No_Element else (Node => Node));
end;
end Previous;
procedure Previous (Container : Set; Position : in out Cursor) is
begin
Position := Previous (Container, Position);
end Previous;
-------------
-- Replace --
-------------
procedure Replace (Container : in out Set; New_Item : Element_Type) is
Node : constant Count_Type :=
Element_Keys.Find (Container.Content, New_Item);
begin
if Node = 0 then
raise Constraint_Error with
"attempt to replace element not in set";
end if;
Container.Content.Nodes (Node).Element := New_Item;
end Replace;
---------------------
-- Replace_Element --
---------------------
procedure Replace_Element
(Tree : in out Set;
Node : Count_Type;
Item : Element_Type)
is
pragma Assert (Node /= 0);
function New_Node return Count_Type;
pragma Inline (New_Node);
procedure Local_Insert_Post is
new Element_Keys.Generic_Insert_Post (New_Node);
procedure Local_Insert_Sans_Hint is
new Element_Keys.Generic_Conditional_Insert (Local_Insert_Post);
procedure Local_Insert_With_Hint is
new Element_Keys.Generic_Conditional_Insert_With_Hint
(Local_Insert_Post,
Local_Insert_Sans_Hint);
NN : Tree_Types.Nodes_Type renames Tree.Content.Nodes;
--------------
-- New_Node --
--------------
function New_Node return Count_Type is
N : Node_Type renames NN (Node);
begin
N.Element := Item;
N.Color := Red;
N.Parent := 0;
N.Right := 0;
N.Left := 0;
return Node;
end New_Node;
Hint : Count_Type;
Result : Count_Type;
Inserted : Boolean;
-- Start of processing for Insert
begin
if Item < NN (Node).Element
or else NN (Node).Element < Item
then
null;
else
NN (Node).Element := Item;
return;
end if;
Hint := Element_Keys.Ceiling (Tree.Content, Item);
if Hint = 0 then
null;
elsif Item < NN (Hint).Element then
if Hint = Node then
NN (Node).Element := Item;
return;
end if;
else
pragma Assert (not (NN (Hint).Element < Item));
raise Program_Error with "attempt to replace existing element";
end if;
Tree_Operations.Delete_Node_Sans_Free (Tree.Content, Node);
Local_Insert_With_Hint
(Tree => Tree.Content,
Position => Hint,
Key => Item,
Node => Result,
Inserted => Inserted);
pragma Assert (Inserted);
pragma Assert (Result = Node);
end Replace_Element;
procedure Replace_Element
(Container : in out Set;
Position : Cursor;
New_Item : Element_Type)
is
begin
if not Has_Element (Container, Position) then
raise Constraint_Error with
"Position cursor has no element";
end if;
pragma Assert (Vet (Container.Content, Position.Node),
"bad cursor in Replace_Element");
Replace_Element (Container, Position.Node, New_Item);
end Replace_Element;
---------------
-- Right_Son --
---------------
function Right_Son (Node : Node_Type) return Count_Type is
begin
return Node.Right;
end Right_Son;
---------------
-- Set_Color --
---------------
procedure Set_Color
(Node : in out Node_Type;
Color : Red_Black_Trees.Color_Type)
is
begin
Node.Color := Color;
end Set_Color;
--------------
-- Set_Left --
--------------
procedure Set_Left (Node : in out Node_Type; Left : Count_Type) is
begin
Node.Left := Left;
end Set_Left;
----------------
-- Set_Parent --
----------------
procedure Set_Parent (Node : in out Node_Type; Parent : Count_Type) is
begin
Node.Parent := Parent;
end Set_Parent;
---------------
-- Set_Right --
---------------
procedure Set_Right (Node : in out Node_Type; Right : Count_Type) is
begin
Node.Right := Right;
end Set_Right;
--------------------------
-- Symmetric_Difference --
--------------------------
procedure Symmetric_Difference (Target : in out Set; Source : Set) is
begin
Set_Ops.Set_Symmetric_Difference (Target.Content, Source.Content);
end Symmetric_Difference;
function Symmetric_Difference (Left, Right : Set) return Set is
begin
if Left'Address = Right'Address then
return Empty_Set;
end if;
if Length (Right) = 0 then
return Copy (Left);
end if;
if Length (Left) = 0 then
return Copy (Right);
end if;
return S : Set (Length (Left) + Length (Right)) do
Assign
(S.Content,
Set_Ops.Set_Symmetric_Difference (Left.Content, Right.Content));
end return;
end Symmetric_Difference;
------------
-- To_Set --
------------
function To_Set (New_Item : Element_Type) return Set is
Node : Count_Type;
Inserted : Boolean;
begin
return S : Set (Capacity => 1) do
Insert_Sans_Hint (S.Content, New_Item, Node, Inserted);
pragma Assert (Inserted);
end return;
end To_Set;
-----------
-- Union --
-----------
procedure Union (Target : in out Set; Source : Set) is
begin
Set_Ops.Set_Union (Target.Content, Source.Content);
end Union;
function Union (Left, Right : Set) return Set is
begin
if Left'Address = Right'Address then
return Copy (Left);
end if;
if Length (Left) = 0 then
return Copy (Right);
end if;
if Length (Right) = 0 then
return Copy (Left);
end if;
return S : Set (Length (Left) + Length (Right)) do
Assign (S, Source => Left);
Union (S, Right);
end return;
end Union;
end Ada.Containers.Formal_Ordered_Sets;
| 26.714433 | 79 | 0.522672 |
8bdfd26f60f6f857788006de42164bb37e3619f7 | 2,084 | adb | Ada | src/support_utils/support_utils-char_utils.adb | Alex-Vasile/whitakers-words | 9fa16606d97842746fea0379839f40c959c53d56 | [
"FTL"
] | 204 | 2015-06-12T21:22:55.000Z | 2022-03-28T10:50:16.000Z | src/support_utils/support_utils-char_utils.adb | Alex-Vasile/whitakers-words | 9fa16606d97842746fea0379839f40c959c53d56 | [
"FTL"
] | 98 | 2015-06-15T22:17:04.000Z | 2021-10-01T18:17:55.000Z | src/support_utils/support_utils-char_utils.adb | Alex-Vasile/whitakers-words | 9fa16606d97842746fea0379839f40c959c53d56 | [
"FTL"
] | 50 | 2015-06-16T22:42:24.000Z | 2021-12-29T16:53:08.000Z | -- 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.
package body Support_Utils.Char_Utils is
---------------------------------------------------------------------------
function Is_Punctuation (C : Character) return Boolean
is
begin
case C is
when ' ' | ',' | '-' | ';' | ':' | '.' | '(' | '[' | '{' | '<' | ')' |
']' | '}' | '>' => return True;
when others => return False;
end case;
end Is_Punctuation;
---------------------------------------------------------------------------
function Is_Alpha_Etc (C : Character) return Boolean
is
begin
case C is
when 'A' .. 'Z' | 'a' .. 'z' | '-' | '.' => return True;
when others => return False;
end case;
end Is_Alpha_Etc;
---------------------------------------------------------------------------
function V_To_U_And_J_To_I (C : Character) return Character
is
begin
case C is
when 'V' => return 'U';
when 'v' => return 'u';
when 'J' => return 'I';
when 'j' => return 'i';
when others => return C;
end case;
end V_To_U_And_J_To_I;
procedure V_To_U_And_J_To_I (C : in out Character)
is
begin
C := V_To_U_And_J_To_I (C);
end V_To_U_And_J_To_I;
---------------------------------------------------------------------------
end Support_Utils.Char_Utils;
| 32.061538 | 79 | 0.521593 |
30db388d094a223edb6a26ef8f8b567e44f74017 | 355 | adb | Ada | src/002/moving_thing.adb | xeenta/learning-ada | bd3edf0c9e8b8eff814ffd89b040f488b80a7d5b | [
"MIT"
] | null | null | null | src/002/moving_thing.adb | xeenta/learning-ada | bd3edf0c9e8b8eff814ffd89b040f488b80a7d5b | [
"MIT"
] | null | null | null | src/002/moving_thing.adb | xeenta/learning-ada | bd3edf0c9e8b8eff814ffd89b040f488b80a7d5b | [
"MIT"
] | null | null | null | package body Moving_Thing is
procedure Faster (T : in out Thing;
D : in Direction;
M : in Float) is
begin
null; -- null statement
end Faster;
procedure Stop (T : in out Thing) is
begin
T.Spd.Vx := 0.0;
T.Spd.Vy := 0.0;
T.Spd.Vz := 0.0;
end;
end Moving_Thing;
| 18.684211 | 42 | 0.498592 |
5e7dd23b2f4d7e47fc2b97956c163c72a409be73 | 1,269 | adb | Ada | Lab6/ftest.adb | albinjal/ada_basic | 2ee5963f18496870ee9efc2e6466917c87482ddc | [
"MIT"
] | 3 | 2020-01-27T10:04:20.000Z | 2022-02-11T23:17:00.000Z | Lab6/ftest.adb | albinjal/ada_basic | 2ee5963f18496870ee9efc2e6466917c87482ddc | [
"MIT"
] | null | null | null | Lab6/ftest.adb | albinjal/ada_basic | 2ee5963f18496870ee9efc2e6466917c87482ddc | [
"MIT"
] | null | null | null | with Ada.Strings.Unbounded; use Ada.Strings.Unbounded;
with Text_IO.Unbounded_IO; use Text_IO.Unbounded_IO;
with Ada.Integer_Text_IO; use Ada.Integer_Text_IO;
with Ada.Text_IO; use Ada.Text_IO;
with Ada.Sequential_IO;
procedure ftest is
--type Lines is array (1..10000) of Unbounded_String;
package Integer_IO is new Ada.Sequential_IO(Integer);
use Integer_IO;
Input: Integer_IO.File_Type;
I: Integer;
CNUM: Integer;
tstr: String(1..16);
tstr2: Unbounded_String;
tstr3: Unbounded_String;
--Lines_Arr: Lines;
begin
Open(Input, In_File, "REG.BIN");
--Lines_Arr(1):= To_Unbounded_String(Get_Line(Input));
while not End_Of_File(Input) loop
--while not End_Of_Line(Input) loop
Read(Input, I);
Put(I);
Put(" >> ");
Put(To => tstr, Item => I, Base => 16);
--CNUM:= Integer'Value( tstr );
Put(tstr);
tstr3:= To_Unbounded_String(tstr);
Put(" >> ");
Put(tstr3);
New_Line;
--Ada.Integer_Text_IO.Put(String, 16, I);
New_Line;
--end loop;
--Skip_Line(Input);
--New_Line(Copy);
end loop;
New_Line;
New_Line;
-- Put(CNUM);
-- Read(File => Input, Item => Item, Last => I);
-- Item:= Input;
-- Close(Input);
-- Put("FFS!");
-- Put(Lines_Arr(1));
end ftest; | 16.92 | 56 | 0.642238 |
5e346e85080b6b8bf1bfcd485971780d0ed10c42 | 9,318 | ads | Ada | .emacs.d/elpa/wisi-3.0.1/wisitoken_grammar_actions.ads | caqg/linux-home | eed631aae6f5e59e4f46e14f1dff443abca5fa28 | [
"Linux-OpenIB"
] | null | null | null | .emacs.d/elpa/wisi-3.0.1/wisitoken_grammar_actions.ads | caqg/linux-home | eed631aae6f5e59e4f46e14f1dff443abca5fa28 | [
"Linux-OpenIB"
] | null | null | null | .emacs.d/elpa/wisi-3.0.1/wisitoken_grammar_actions.ads | caqg/linux-home | eed631aae6f5e59e4f46e14f1dff443abca5fa28 | [
"Linux-OpenIB"
] | null | null | null | -- generated parser support file.
-- command line: wisitoken-bnf-generate.exe --generate LALR Ada re2c PROCESS wisitoken_grammar.wy
--
-- Copyright (C) 2017 - 2019 Free Software Foundation, Inc.
--
-- Author: Stephen Leake <[email protected]>
--
-- This file is part of GNU Emacs.
--
-- GNU Emacs 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.
--
-- GNU Emacs 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 GNU Emacs. If not, see <http://www.gnu.org/licenses/>.
with WisiToken.Syntax_Trees;
package Wisitoken_Grammar_Actions is
Descriptor : aliased WisiToken.Descriptor :=
(First_Terminal => 3,
Last_Terminal => 36,
First_Nonterminal => 37,
Last_Nonterminal => 56,
EOI_ID => 36,
Accept_ID => 37,
Case_Insensitive => False,
New_Line_ID => 1,
String_1_ID => 35,
String_2_ID => 34,
Image =>
(new String'("WHITESPACE"),
new String'("NEW_LINE"),
new String'("COMMENT"),
new String'("CODE"),
new String'("END"),
new String'("IF"),
new String'("KEYWORD"),
new String'("NON_GRAMMAR"),
new String'("TOKEN"),
new String'("RAW_CODE"),
new String'("REGEXP"),
new String'("ACTION"),
new String'("BAR"),
new String'("COLON"),
new String'("COLON_COLON_EQUAL"),
new String'("COMMA"),
new String'("EQUAL"),
new String'("GREATER"),
new String'("LEFT_BRACE"),
new String'("LEFT_BRACKET"),
new String'("LEFT_PAREN"),
new String'("LESS"),
new String'("MINUS"),
new String'("PERCENT"),
new String'("PLUS"),
new String'("QUESTION"),
new String'("RIGHT_BRACE"),
new String'("RIGHT_BRACKET"),
new String'("RIGHT_PAREN"),
new String'("SEMICOLON"),
new String'("SLASH"),
new String'("STAR"),
new String'("NUMERIC_LITERAL"),
new String'("IDENTIFIER"),
new String'("STRING_LITERAL_1"),
new String'("STRING_LITERAL_2"),
new String'("Wisi_EOI"),
new String'("wisitoken_accept"),
new String'("declaration"),
new String'("token_keyword_non_grammar"),
new String'("identifier_list"),
new String'("declaration_item_list"),
new String'("declaration_item"),
new String'("nonterminal"),
new String'("semicolon_opt"),
new String'("rhs_list"),
new String'("rhs"),
new String'("rhs_attribute"),
new String'("rhs_element"),
new String'("rhs_item_list"),
new String'("rhs_item"),
new String'("rhs_group_item"),
new String'("rhs_optional_item"),
new String'("rhs_multiple_item"),
new String'("rhs_alternative_list"),
new String'("compilation_unit"),
new String'("compilation_unit_list")),
Terminal_Image_Width => 17,
Image_Width => 25,
Last_Lookahead => 37);
type Token_Enum_ID is
(WHITESPACE_ID,
NEW_LINE_ID,
COMMENT_ID,
CODE_ID,
END_ID,
IF_ID,
KEYWORD_ID,
NON_GRAMMAR_ID,
TOKEN_ID,
RAW_CODE_ID,
REGEXP_ID,
ACTION_ID,
BAR_ID,
COLON_ID,
COLON_COLON_EQUAL_ID,
COMMA_ID,
EQUAL_ID,
GREATER_ID,
LEFT_BRACE_ID,
LEFT_BRACKET_ID,
LEFT_PAREN_ID,
LESS_ID,
MINUS_ID,
PERCENT_ID,
PLUS_ID,
QUESTION_ID,
RIGHT_BRACE_ID,
RIGHT_BRACKET_ID,
RIGHT_PAREN_ID,
SEMICOLON_ID,
SLASH_ID,
STAR_ID,
NUMERIC_LITERAL_ID,
IDENTIFIER_ID,
STRING_LITERAL_1_ID,
STRING_LITERAL_2_ID,
Wisi_EOI_ID,
wisitoken_accept_ID,
declaration_ID,
token_keyword_non_grammar_ID,
identifier_list_ID,
declaration_item_list_ID,
declaration_item_ID,
nonterminal_ID,
semicolon_opt_ID,
rhs_list_ID,
rhs_ID,
rhs_attribute_ID,
rhs_element_ID,
rhs_item_list_ID,
rhs_item_ID,
rhs_group_item_ID,
rhs_optional_item_ID,
rhs_multiple_item_ID,
rhs_alternative_list_ID,
compilation_unit_ID,
compilation_unit_list_ID);
type Token_Enum_ID_Array is array (Positive range <>) of Token_Enum_ID;
use all type WisiToken.Token_ID;
function "+" (Item : in Token_Enum_ID) return WisiToken.Token_ID
is (WisiToken.Token_ID'First + Token_Enum_ID'Pos (Item));
function To_Token_Enum (Item : in WisiToken.Token_ID) return Token_Enum_ID
is (Token_Enum_ID'Val (Item - WisiToken.Token_ID'First));
function "-" (Item : in WisiToken.Token_ID) return Token_Enum_ID renames To_Token_Enum;
procedure declaration_0
(User_Data : in out WisiToken.Syntax_Trees.User_Data_Type'Class;
Tree : in out WisiToken.Syntax_Trees.Tree;
Nonterm : in WisiToken.Syntax_Trees.Valid_Node_Index;
Tokens : in WisiToken.Syntax_Trees.Valid_Node_Index_Array);
procedure declaration_1
(User_Data : in out WisiToken.Syntax_Trees.User_Data_Type'Class;
Tree : in out WisiToken.Syntax_Trees.Tree;
Nonterm : in WisiToken.Syntax_Trees.Valid_Node_Index;
Tokens : in WisiToken.Syntax_Trees.Valid_Node_Index_Array);
procedure declaration_2
(User_Data : in out WisiToken.Syntax_Trees.User_Data_Type'Class;
Tree : in out WisiToken.Syntax_Trees.Tree;
Nonterm : in WisiToken.Syntax_Trees.Valid_Node_Index;
Tokens : in WisiToken.Syntax_Trees.Valid_Node_Index_Array);
procedure declaration_3
(User_Data : in out WisiToken.Syntax_Trees.User_Data_Type'Class;
Tree : in out WisiToken.Syntax_Trees.Tree;
Nonterm : in WisiToken.Syntax_Trees.Valid_Node_Index;
Tokens : in WisiToken.Syntax_Trees.Valid_Node_Index_Array);
procedure declaration_4
(User_Data : in out WisiToken.Syntax_Trees.User_Data_Type'Class;
Tree : in out WisiToken.Syntax_Trees.Tree;
Nonterm : in WisiToken.Syntax_Trees.Valid_Node_Index;
Tokens : in WisiToken.Syntax_Trees.Valid_Node_Index_Array);
procedure declaration_5
(User_Data : in out WisiToken.Syntax_Trees.User_Data_Type'Class;
Tree : in out WisiToken.Syntax_Trees.Tree;
Nonterm : in WisiToken.Syntax_Trees.Valid_Node_Index;
Tokens : in WisiToken.Syntax_Trees.Valid_Node_Index_Array);
procedure nonterminal_0
(User_Data : in out WisiToken.Syntax_Trees.User_Data_Type'Class;
Tree : in out WisiToken.Syntax_Trees.Tree;
Nonterm : in WisiToken.Syntax_Trees.Valid_Node_Index;
Tokens : in WisiToken.Syntax_Trees.Valid_Node_Index_Array);
procedure nonterminal_1
(User_Data : in out WisiToken.Syntax_Trees.User_Data_Type'Class;
Tree : in out WisiToken.Syntax_Trees.Tree;
Nonterm : in WisiToken.Syntax_Trees.Valid_Node_Index;
Tokens : in WisiToken.Syntax_Trees.Valid_Node_Index_Array);
procedure rhs_item_1
(User_Data : in out WisiToken.Syntax_Trees.User_Data_Type'Class;
Tree : in out WisiToken.Syntax_Trees.Tree;
Nonterm : in WisiToken.Syntax_Trees.Valid_Node_Index;
Tokens : in WisiToken.Syntax_Trees.Valid_Node_Index_Array);
procedure rhs_item_2
(User_Data : in out WisiToken.Syntax_Trees.User_Data_Type'Class;
Tree : in out WisiToken.Syntax_Trees.Tree;
Nonterm : in WisiToken.Syntax_Trees.Valid_Node_Index;
Tokens : in WisiToken.Syntax_Trees.Valid_Node_Index_Array);
procedure rhs_item_3
(User_Data : in out WisiToken.Syntax_Trees.User_Data_Type'Class;
Tree : in out WisiToken.Syntax_Trees.Tree;
Nonterm : in WisiToken.Syntax_Trees.Valid_Node_Index;
Tokens : in WisiToken.Syntax_Trees.Valid_Node_Index_Array);
procedure rhs_item_4
(User_Data : in out WisiToken.Syntax_Trees.User_Data_Type'Class;
Tree : in out WisiToken.Syntax_Trees.Tree;
Nonterm : in WisiToken.Syntax_Trees.Valid_Node_Index;
Tokens : in WisiToken.Syntax_Trees.Valid_Node_Index_Array);
procedure rhs_item_5
(User_Data : in out WisiToken.Syntax_Trees.User_Data_Type'Class;
Tree : in out WisiToken.Syntax_Trees.Tree;
Nonterm : in WisiToken.Syntax_Trees.Valid_Node_Index;
Tokens : in WisiToken.Syntax_Trees.Valid_Node_Index_Array);
procedure rhs_optional_item_3
(User_Data : in out WisiToken.Syntax_Trees.User_Data_Type'Class;
Tree : in out WisiToken.Syntax_Trees.Tree;
Nonterm : in WisiToken.Syntax_Trees.Valid_Node_Index;
Tokens : in WisiToken.Syntax_Trees.Valid_Node_Index_Array);
end Wisitoken_Grammar_Actions;
| 39.151261 | 99 | 0.65851 |
5e1763097f9d36fb4cedd444b79837d5215f03ba | 3,588 | ads | Ada | source/league/league-json-streams-float_stream_operations.ads | svn2github/matreshka | 9d222b3ad9da508855fb1f5adbe5e8a4fad4c530 | [
"BSD-3-Clause"
] | 24 | 2016-11-29T06:59:41.000Z | 2021-08-30T11:55:16.000Z | source/league/league-json-streams-float_stream_operations.ads | svn2github/matreshka | 9d222b3ad9da508855fb1f5adbe5e8a4fad4c530 | [
"BSD-3-Clause"
] | 2 | 2019-01-16T05:15:20.000Z | 2019-02-03T10:03:32.000Z | source/league/league-json-streams-float_stream_operations.ads | svn2github/matreshka | 9d222b3ad9da508855fb1f5adbe5e8a4fad4c530 | [
"BSD-3-Clause"
] | 4 | 2017-07-18T07:11:05.000Z | 2020-06-21T03:02:25.000Z | ------------------------------------------------------------------------------
-- --
-- Matreshka Project --
-- --
-- Localization, Internationalization, Globalization for Ada --
-- --
-- Runtime Library Component --
-- --
------------------------------------------------------------------------------
-- --
-- Copyright © 2014, Vadim Godunko <[email protected]> --
-- All rights reserved. --
-- --
-- Redistribution and use in source and binary forms, with or without --
-- modification, are permitted provided that the following conditions --
-- are met: --
-- --
-- * Redistributions of source code must retain the above copyright --
-- notice, this list of conditions and the following disclaimer. --
-- --
-- * Redistributions in binary form must reproduce the above copyright --
-- notice, this list of conditions and the following disclaimer in the --
-- documentation and/or other materials provided with the distribution. --
-- --
-- * Neither the name of the Vadim Godunko, IE nor the names of its --
-- contributors may be used to endorse or promote products derived from --
-- this software without specific prior written permission. --
-- --
-- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS --
-- "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT --
-- LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR --
-- A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT --
-- HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, --
-- SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED --
-- TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR --
-- PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF --
-- LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING --
-- NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS --
-- SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. --
-- --
------------------------------------------------------------------------------
-- $Revision$ $Date$
------------------------------------------------------------------------------
with League.JSON.Streams.Generic_Float_Stream_Operations;
package League.JSON.Streams.Float_Stream_Operations is
new League.JSON.Streams.Generic_Float_Stream_Operations (Float);
pragma Preelaborate (League.JSON.Streams.Float_Stream_Operations);
| 73.22449 | 78 | 0.429487 |
042c7e4f5d7a0112bb9815be83ab8d1995a37c78 | 93,639 | adb | Ada | src/asis/asis-statements.adb | jquorning/dynamo | 10d68571476c270b8e45a9c5ef585fa9139b0d05 | [
"Apache-2.0"
] | 15 | 2015-01-18T23:04:19.000Z | 2022-03-01T20:27:08.000Z | src/asis/asis-statements.adb | jquorning/dynamo | 10d68571476c270b8e45a9c5ef585fa9139b0d05 | [
"Apache-2.0"
] | 16 | 2018-06-10T07:09:30.000Z | 2022-03-26T18:28:40.000Z | src/asis/asis-statements.adb | jquorning/dynamo | 10d68571476c270b8e45a9c5ef585fa9139b0d05 | [
"Apache-2.0"
] | 3 | 2015-11-11T18:00:14.000Z | 2022-01-30T23:08:45.000Z | ------------------------------------------------------------------------------
-- --
-- ASIS-for-GNAT IMPLEMENTATION COMPONENTS --
-- --
-- A S I S . S T A T E M E N T S --
-- --
-- B o d y --
-- --
-- Copyright (C) 1995-2011, Free Software Foundation, Inc. --
-- --
-- ASIS-for-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 --
-- Software Foundation; either version 2, or (at your option) any later --
-- version. ASIS-for-GNAT is distributed in the hope that it will be use- --
-- ful, but WITHOUT ANY WARRANTY; without even the implied warranty of MER- --
-- CHANTABILITY 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 ASIS-for-GNAT; see file --
-- COPYING. If not, write to the Free Software Foundation, 51 Franklin --
-- Street, Fifth Floor, Boston, MA 02110-1301, USA. --
-- --
-- --
-- --
-- --
-- --
-- --
-- --
-- --
-- ASIS-for-GNAT was originally developed by the ASIS-for-GNAT team at the --
-- Software Engineering Laboratory of the Swiss Federal Institute of --
-- Technology (LGL-EPFL) in Lausanne, Switzerland, in cooperation with the --
-- Scientific Research Computer Center of Moscow State University (SRCC --
-- MSU), Russia, with funding partially provided by grants from the Swiss --
-- National Science Foundation and the Swiss Academy of Engineering --
-- Sciences. ASIS-for-GNAT is now maintained by AdaCore --
-- (http://www.adacore.com). --
-- --
------------------------------------------------------------------------------
with Asis.Declarations; use Asis.Declarations;
with Asis.Elements; use Asis.Elements;
with Asis.Errors; use Asis.Errors;
with Asis.Exceptions; use Asis.Exceptions;
with Asis.Expressions; use Asis.Expressions;
with Asis.Extensions; use Asis.Extensions;
with Asis.Set_Get; use Asis.Set_Get;
with A4G.A_Sem; use A4G.A_Sem;
with A4G.A_Sinput; use A4G.A_Sinput;
with A4G.Contt.UT; use A4G.Contt.UT;
with A4G.Mapping; use A4G.Mapping;
with A4G.Norm; use A4G.Norm;
with A4G.Vcheck; use A4G.Vcheck;
with A4G.Span_End; use A4G.Span_End;
with Atree; use Atree;
with Nlists; use Nlists;
with Sinfo; use Sinfo;
with Sinput; use Sinput;
package body Asis.Statements is
Package_Name : constant String := "Asis.Statements.";
---------------------------
-- ASIS 2005 Draft stuff --
---------------------------
------------------------
-- Associated_Message --
------------------------
function Associated_Message
(Statement : Asis.Statement)
return Asis.Expression
is
Arg_Kind : constant Internal_Element_Kinds := Int_Kind (Statement);
begin
Check_Validity (Statement, Package_Name & "Associated_Message");
if not (Arg_Kind = A_Raise_Statement) then
Raise_ASIS_Inappropriate_Element
(Diagnosis => Package_Name & "Associated_Message",
Wrong_Kind => Arg_Kind);
end if;
return Node_To_Element_New
(Node => Sinfo.Expression (Node (Statement)),
Starting_Element => Statement);
exception
when ASIS_Inappropriate_Element =>
raise;
when ASIS_Failed =>
if Status_Indicator = Unhandled_Exception_Error then
Add_Call_Information
(Argument => Statement,
Outer_Call => Package_Name & "Associated_Message");
end if;
raise;
when Ex : others =>
Report_ASIS_Bug
(Query_Name => Package_Name & "Associated_Message",
Ex => Ex,
Arg_Element => Statement);
end Associated_Message;
----------------------------------------
-- Extended_Return_Exception_Handlers --
----------------------------------------
function Extended_Return_Exception_Handlers
(Statement : Asis.Statement;
Include_Pragmas : Boolean := False)
return Asis.Exception_Handler_List
is
Arg_Kind : constant Internal_Element_Kinds := Int_Kind (Statement);
Resilt_List : List_Id := No_List;
begin
Check_Validity
(Statement, Package_Name & "Extended_Return_Exception_Handlers");
if not (Arg_Kind = An_Extended_Return_Statement) then
Raise_ASIS_Inappropriate_Element
(Diagnosis => Package_Name & "Extended_Return_Exception_Handlers",
Wrong_Kind => Arg_Kind);
end if;
if Present (Handled_Statement_Sequence (Node (Statement))) then
Resilt_List :=
Exception_Handlers (Handled_Statement_Sequence (Node (Statement)));
end if;
return N_To_E_List_New
(List => Resilt_List,
Include_Pragmas => Include_Pragmas,
Starting_Element => Statement);
exception
when ASIS_Inappropriate_Element =>
raise;
when ASIS_Failed =>
if Status_Indicator = Unhandled_Exception_Error then
Add_Call_Information
(Argument => Statement,
Outer_Call => Package_Name &
"Extended_Return_Exception_Handlers");
end if;
raise;
when Ex : others =>
Report_ASIS_Bug
(Query_Name => Package_Name & "Extended_Return_Exception_Handlers",
Ex => Ex,
Arg_Element => Statement);
end Extended_Return_Exception_Handlers;
--------------------------------
-- Extended_Return_Statements --
--------------------------------
function Extended_Return_Statements
(Statement : Asis.Statement;
Include_Pragmas : Boolean := False)
return Asis.Statement_List
is
Arg_Kind : constant Internal_Element_Kinds := Int_Kind (Statement);
Result_List : List_Id := No_List;
begin
Check_Validity (Statement, Package_Name & "Extended_Return_Statements");
if not (Arg_Kind = An_Extended_Return_Statement) then
Raise_ASIS_Inappropriate_Element
(Diagnosis => Package_Name & "Extended_Return_Statements",
Wrong_Kind => Arg_Kind);
end if;
if Present (Handled_Statement_Sequence (Node (Statement))) then
Result_List :=
Sinfo.Statements (Handled_Statement_Sequence (Node (Statement)));
end if;
return N_To_E_List_New (List => Result_List,
Include_Pragmas => Include_Pragmas,
Starting_Element => Statement);
exception
when ASIS_Inappropriate_Element =>
raise;
when ASIS_Failed =>
if Status_Indicator = Unhandled_Exception_Error then
Add_Call_Information
(Argument => Statement,
Outer_Call => Package_Name & "Extended_Return_Statements");
end if;
raise;
when Ex : others =>
Report_ASIS_Bug
(Query_Name => Package_Name & "Extended_Return_Statements",
Ex => Ex,
Arg_Element => Statement);
end Extended_Return_Statements;
-------------------------------
-- Return_Object_Declaration --
-------------------------------
function Return_Object_Declaration
(Statement : Asis.Statement)
return Asis.Declaration
is
Arg_Kind : constant Internal_Element_Kinds := Int_Kind (Statement);
Result_Node : Node_Id;
begin
Check_Validity (Statement, Package_Name & "Return_Object_Declaration");
if not (Arg_Kind = An_Extended_Return_Statement) then
Raise_ASIS_Inappropriate_Element
(Diagnosis => Package_Name & "Return_Object_Declaration",
Wrong_Kind => Arg_Kind);
end if;
Result_Node := First (Return_Object_Declarations (Node (Statement)));
while Nkind (Result_Node) /= N_Object_Declaration loop
-- It may be some internal subtypes here
Result_Node := Next (Result_Node);
end loop;
return Node_To_Element_New (Node => Result_Node,
Starting_Element => Statement);
exception
when ASIS_Inappropriate_Element =>
raise;
when ASIS_Failed =>
if Status_Indicator = Unhandled_Exception_Error then
Add_Call_Information
(Argument => Statement,
Outer_Call => Package_Name & "Return_Object_Declaration");
end if;
raise;
when Ex : others =>
Report_ASIS_Bug
(Query_Name => Package_Name & "Return_Object_Declaration",
Ex => Ex,
Arg_Element => Statement);
end Return_Object_Declaration;
------------------------------------------------------------------------------
-------------------
-- Aborted_Tasks --
-------------------
function Aborted_Tasks
(Statement : Asis.Statement)
return Asis.Expression_List
is
Arg_Kind : constant Internal_Element_Kinds := Int_Kind (Statement);
Arg_Node : Node_Id;
begin
Check_Validity (Statement, Package_Name & "Aborted_Tasks");
if not (Arg_Kind = An_Abort_Statement) then
Raise_ASIS_Inappropriate_Element
(Package_Name & "Aborted_Tasks",
Wrong_Kind => Arg_Kind);
end if;
Arg_Node := Node (Statement);
return N_To_E_List_New
(List => Names (Arg_Node),
Starting_Element => Statement);
exception
when ASIS_Inappropriate_Element =>
raise;
when ASIS_Failed =>
if Status_Indicator = Unhandled_Exception_Error then
Add_Call_Information
(Argument => Statement,
Outer_Call => Package_Name & "Aborted_Tasks");
end if;
raise;
when Ex : others =>
Report_ASIS_Bug
(Query_Name => Package_Name & "Aborted_Tasks",
Ex => Ex,
Arg_Element => Statement);
end Aborted_Tasks;
------------------------------------
-- Accept_Body_Exception_Handlers --
------------------------------------
function Accept_Body_Exception_Handlers
(Statement : Asis.Statement;
Include_Pragmas : Boolean := False)
return Asis.Exception_Handler_List
is
Arg_Kind : constant Internal_Element_Kinds := Int_Kind (Statement);
Arg_Node : Node_Id;
Resilt_List : List_Id := No_List;
begin
Check_Validity (Statement,
Package_Name & "Accept_Body_Exception_Handlers");
if not (Arg_Kind = An_Accept_Statement) then
Raise_ASIS_Inappropriate_Element
(Package_Name & "Accept_Body_Exception_Handlers",
Wrong_Kind => Arg_Kind);
end if;
Arg_Node := Node (Statement);
if Present (Handled_Statement_Sequence (Arg_Node)) then
Resilt_List :=
Exception_Handlers (Handled_Statement_Sequence (Arg_Node));
end if;
return N_To_E_List_New (List => Resilt_List,
Include_Pragmas => Include_Pragmas,
Starting_Element => Statement);
exception
when ASIS_Inappropriate_Element =>
raise;
when ASIS_Failed =>
if Status_Indicator = Unhandled_Exception_Error then
Add_Call_Information
(Argument => Statement,
Bool_Par => Include_Pragmas,
Outer_Call => Package_Name & "Accept_Body_Exception_Handlers");
end if;
raise;
when Ex : others =>
Report_ASIS_Bug
(Query_Name => Package_Name & "Accept_Body_Exception_Handlers",
Ex => Ex,
Arg_Element => Statement,
Bool_Par_ON => Include_Pragmas);
end Accept_Body_Exception_Handlers;
----------------------------
-- Accept_Body_Statements --
----------------------------
function Accept_Body_Statements
(Statement : Asis.Statement;
Include_Pragmas : Boolean := False)
return Asis.Statement_List
is
Arg_Kind : constant Internal_Element_Kinds := Int_Kind (Statement);
Arg_Node : Node_Id;
Resilt_List : List_Id := No_List;
begin
Check_Validity (Statement, Package_Name & "Accept_Body_Statements");
if not (Arg_Kind = An_Accept_Statement) then
Raise_ASIS_Inappropriate_Element
(Package_Name & "Accept_Body_Statements",
Wrong_Kind => Arg_Kind);
end if;
Arg_Node := Node (Statement);
if Present (Handled_Statement_Sequence (Arg_Node)) then
Resilt_List :=
Sinfo.Statements (Handled_Statement_Sequence (Arg_Node));
end if;
return N_To_E_List_New
(List => Resilt_List,
Include_Pragmas => Include_Pragmas,
Starting_Element => Statement);
exception
when ASIS_Inappropriate_Element =>
raise;
when ASIS_Failed =>
if Status_Indicator = Unhandled_Exception_Error then
Add_Call_Information
(Argument => Statement,
Bool_Par => Include_Pragmas,
Outer_Call => Package_Name & "Accept_Body_Statements");
end if;
raise;
when Ex : others =>
Report_ASIS_Bug
(Query_Name => Package_Name & "Accept_Body_Statements",
Ex => Ex,
Arg_Element => Statement,
Bool_Par_ON => Include_Pragmas);
end Accept_Body_Statements;
------------------------------
-- Accept_Entry_Direct_Name --
------------------------------
function Accept_Entry_Direct_Name
(Statement : Asis.Statement)
return Asis.Name
is
Arg_Kind : constant Internal_Element_Kinds := Int_Kind (Statement);
Arg_Node : Node_Id;
begin
Check_Validity (Statement, Package_Name & "Accept_Entry_Direct_Name");
if not (Arg_Kind = An_Accept_Statement) then
Raise_ASIS_Inappropriate_Element
(Package_Name & "Accept_Entry_Direct_Name",
Wrong_Kind => Arg_Kind);
end if;
Arg_Node := Node (Statement);
return Node_To_Element_New (
Node => Entry_Direct_Name (Arg_Node),
Internal_Kind => An_Identifier,
Starting_Element => Statement);
exception
when ASIS_Inappropriate_Element =>
raise;
when ASIS_Failed =>
if Status_Indicator = Unhandled_Exception_Error then
Add_Call_Information
(Argument => Statement,
Outer_Call => Package_Name & "Accept_Entry_Direct_Name");
end if;
raise;
when Ex : others =>
Report_ASIS_Bug
(Query_Name => Package_Name & "Accept_Entry_Direct_Name",
Ex => Ex,
Arg_Element => Statement);
end Accept_Entry_Direct_Name;
------------------------
-- Accept_Entry_Index --
------------------------
function Accept_Entry_Index
(Statement : Asis.Statement)
return Asis.Expression
is
Arg_Kind : constant Internal_Element_Kinds := Int_Kind (Statement);
Arg_Node : Node_Id;
Result_Node : Node_Id;
begin
Check_Validity (Statement, Package_Name & "Accept_Entry_Index");
if not (Arg_Kind = An_Accept_Statement) then
Raise_ASIS_Inappropriate_Element
(Package_Name & "Accept_Entry_Index",
Wrong_Kind => Arg_Kind);
end if;
Arg_Node := Node (Statement);
Result_Node := Entry_Index (Arg_Node);
if No (Result_Node) then
return Nil_Element;
else
return Node_To_Element_New (Node => Result_Node,
Starting_Element => Statement);
end if;
exception
when ASIS_Inappropriate_Element =>
raise;
when ASIS_Failed =>
if Status_Indicator = Unhandled_Exception_Error then
Add_Call_Information
(Argument => Statement,
Outer_Call => Package_Name & "Accept_Entry_Index");
end if;
raise;
when Ex : others =>
Report_ASIS_Bug
(Query_Name => Package_Name & "Accept_Entry_Index",
Ex => Ex,
Arg_Element => Statement);
end Accept_Entry_Index;
-----------------------
-- Accept_Parameters --
-----------------------
function Accept_Parameters
(Statement : Asis.Statement)
return Asis.Parameter_Specification_List
is
Arg_Kind : constant Internal_Element_Kinds := Int_Kind (Statement);
Arg_Node : Node_Id;
begin
Check_Validity (Statement, Package_Name & "Accept_Parameters");
if not (Arg_Kind = An_Accept_Statement) then
Raise_ASIS_Inappropriate_Element
(Package_Name & "Accept_Parameters",
Wrong_Kind => Arg_Kind);
end if;
Arg_Node := Node (Statement);
return N_To_E_List_New
(List => Parameter_Specifications (Arg_Node),
Starting_Element => Statement,
Internal_Kind => A_Parameter_Specification);
exception
when ASIS_Inappropriate_Element =>
raise;
when ASIS_Failed =>
if Status_Indicator = Unhandled_Exception_Error then
Add_Call_Information
(Argument => Statement,
Outer_Call => Package_Name & "Accept_Parameters");
end if;
raise;
when Ex : others =>
Report_ASIS_Bug
(Query_Name => Package_Name & "Accept_Parameters",
Ex => Ex,
Arg_Element => Statement);
end Accept_Parameters;
---------------------------
-- Assignment_Expression --
---------------------------
function Assignment_Expression
(Statement : Asis.Statement)
return Asis.Expression
is
Arg_Kind : constant Internal_Element_Kinds := Int_Kind (Statement);
Arg_Node : Node_Id;
begin
Check_Validity (Statement, Package_Name & "Assignment_Expression");
if not (Arg_Kind = An_Assignment_Statement) then
Raise_ASIS_Inappropriate_Element
(Package_Name & "Assignment_Expression",
Wrong_Kind => Arg_Kind);
end if;
Arg_Node := Node (Statement);
return Node_To_Element_New (
Node => Sinfo.Expression (Arg_Node),
Starting_Element => Statement);
exception
when ASIS_Inappropriate_Element =>
raise;
when ASIS_Failed =>
if Status_Indicator = Unhandled_Exception_Error then
Add_Call_Information
(Argument => Statement,
Outer_Call => Package_Name & "Assignment_Expression");
end if;
raise;
when Ex : others =>
Report_ASIS_Bug
(Query_Name => Package_Name & "Assignment_Expression",
Ex => Ex,
Arg_Element => Statement);
end Assignment_Expression;
------------------------------
-- Assignment_Variable_Name --
------------------------------
function Assignment_Variable_Name
(Statement : Asis.Statement)
return Asis.Expression
is
Arg_Kind : constant Internal_Element_Kinds := Int_Kind (Statement);
Arg_Node : Node_Id;
begin
Check_Validity (Statement, Package_Name & "Assignment_Variable_Name");
if not (Arg_Kind = An_Assignment_Statement) then
Raise_ASIS_Inappropriate_Element
(Package_Name & "Assignment_Variable_Name",
Wrong_Kind => Arg_Kind);
end if;
Arg_Node := Node (Statement);
return Node_To_Element_New (
Node => Sinfo.Name (Arg_Node),
Starting_Element => Statement);
exception
when ASIS_Inappropriate_Element =>
raise;
when ASIS_Failed =>
if Status_Indicator = Unhandled_Exception_Error then
Add_Call_Information
(Argument => Statement,
Outer_Call => Package_Name & "Assignment_Variable_Name");
end if;
raise;
when Ex : others =>
Report_ASIS_Bug
(Query_Name => Package_Name & "Assignment_Variable_Name",
Ex => Ex,
Arg_Element => Statement);
end Assignment_Variable_Name;
-----------------------------
-- Block_Declarative_Items --
-----------------------------
function Block_Declarative_Items
(Statement : Asis.Statement;
Include_Pragmas : Boolean := False)
return Asis.Declarative_Item_List
is
Arg_El : Asis.Element;
Arg_Kind : constant Internal_Element_Kinds := Int_Kind (Statement);
Arg_Node : Node_Id;
begin
Check_Validity (Statement, Package_Name & "Block_Declarative_Items");
if not (Arg_Kind = A_Block_Statement) then
Raise_ASIS_Inappropriate_Element
(Package_Name & "Block_Declarative_Items",
Wrong_Kind => Arg_Kind);
end if;
Arg_Node := Node (Statement);
Arg_El := Statement;
if Special_Case (Arg_El) = A_Dummy_Block_Statement then
Set_Special_Case (Arg_El, Not_A_Special_Case);
end if;
return N_To_E_List_New
(List => Sinfo.Declarations (Arg_Node),
Include_Pragmas => Include_Pragmas,
Starting_Element => Arg_El);
exception
when ASIS_Inappropriate_Element =>
raise;
when ASIS_Failed =>
if Status_Indicator = Unhandled_Exception_Error then
Add_Call_Information
(Argument => Statement,
Bool_Par => Include_Pragmas,
Outer_Call => Package_Name & "Block_Declarative_Items");
end if;
raise;
when Ex : others =>
Report_ASIS_Bug
(Query_Name => Package_Name & "Block_Declarative_Items",
Ex => Ex,
Arg_Element => Statement,
Bool_Par_ON => Include_Pragmas);
end Block_Declarative_Items;
------------------------------
-- Block_Exception_Handlers --
------------------------------
function Block_Exception_Handlers
(Statement : Asis.Statement;
Include_Pragmas : Boolean := False)
return Asis.Exception_Handler_List
is
Arg_Kind : constant Internal_Element_Kinds := Int_Kind (Statement);
Arg_Node : Node_Id;
Arg_El : Asis.Element;
begin
Check_Validity (Statement, Package_Name & "Block_Exception_Handlers");
if not (Arg_Kind = A_Block_Statement) then
Raise_ASIS_Inappropriate_Element
(Package_Name & "Block_Exception_Handlers",
Wrong_Kind => Arg_Kind);
end if;
Arg_Node := Node (Statement);
if Special_Case (Statement) = A_Dummy_Block_Statement and then
No (Handled_Statement_Sequence (Arg_Node))
then
-- for the dummy block originated from the package_body_declaration
-- having no handled_sequence_of_statements on its own.
return Nil_Element_List;
end if;
Arg_El := Statement;
if Special_Case (Arg_El) = A_Dummy_Block_Statement then
Set_Special_Case (Arg_El, Not_A_Special_Case);
end if;
return N_To_E_List_New
(List =>
Exception_Handlers (Handled_Statement_Sequence (Arg_Node)),
Include_Pragmas => Include_Pragmas,
Starting_Element => Arg_El);
exception
when ASIS_Inappropriate_Element =>
raise;
when ASIS_Failed =>
if Status_Indicator = Unhandled_Exception_Error then
Add_Call_Information
(Argument => Statement,
Bool_Par => Include_Pragmas,
Outer_Call => Package_Name & "Block_Exception_Handlers");
end if;
raise;
when Ex : others =>
Report_ASIS_Bug
(Query_Name => Package_Name & "Block_Exception_Handlers",
Ex => Ex,
Arg_Element => Statement,
Bool_Par_ON => Include_Pragmas);
end Block_Exception_Handlers;
----------------------
-- Block_Statements --
----------------------
function Block_Statements
(Statement : Asis.Statement;
Include_Pragmas : Boolean := False)
return Asis.Statement_List
is
Arg_El : Asis.Element;
Arg_Kind : constant Internal_Element_Kinds := Int_Kind (Statement);
Arg_Node : Node_Id;
begin
Check_Validity (Statement, Package_Name & "Block_Statements");
if not (Arg_Kind = A_Block_Statement) then
Raise_ASIS_Inappropriate_Element
(Package_Name & "Block_Statements",
Wrong_Kind => Arg_Kind);
end if;
Arg_Node := Node (Statement);
Arg_El := Statement;
if Special_Case (Arg_El) = A_Dummy_Block_Statement then
Set_Special_Case (Arg_El, Not_A_Special_Case);
end if;
return N_To_E_List_New
(List =>
Sinfo.Statements (Handled_Statement_Sequence (Arg_Node)),
Include_Pragmas => Include_Pragmas,
Starting_Element => Arg_El);
exception
when ASIS_Inappropriate_Element =>
raise;
when ASIS_Failed =>
if Status_Indicator = Unhandled_Exception_Error then
Add_Call_Information
(Argument => Statement,
Bool_Par => Include_Pragmas,
Outer_Call => Package_Name & "Block_Statements");
end if;
raise;
when Ex : others =>
Report_ASIS_Bug
(Query_Name => Package_Name & "Block_Statements",
Ex => Ex,
Arg_Element => Statement,
Bool_Par_ON => Include_Pragmas);
end Block_Statements;
-------------------------------
-- Call_Statement_Parameters --
-------------------------------
function Call_Statement_Parameters
(Statement : Asis.Statement;
Normalized : Boolean := False)
return Asis.Association_List
is
Arg_Kind : constant Internal_Element_Kinds := Int_Kind (Statement);
Arg_Node : Node_Id;
Res_Norm_Case : Normalization_Cases := Is_Not_Normalized;
Res_Node_List : List_Id;
begin
Check_Validity (Statement, Package_Name & "Call_Statement_Parameters");
Arg_Node := Node (Statement);
if (not (Arg_Kind = An_Entry_Call_Statement or else
Arg_Kind = A_Procedure_Call_Statement))
or else
(Normalized and then Nkind (Arg_Node) = N_Attribute_Reference)
then
Raise_ASIS_Inappropriate_Element
(Package_Name & "Call_Statement_Parameters",
Wrong_Kind => Arg_Kind);
end if;
if Is_Prefix_Notation (Statement) then
Arg_Node := R_Node (Statement);
end if;
if Normalized then
Res_Norm_Case := Is_Normalized;
end if;
if Normalized and then
Nkind (Arg_Node) /= N_Attribute_Reference
then
if No (Parameter_Associations (Arg_Node))
or else
Is_Nil (Corresponding_Called_Entity (Statement))
then
return Nil_Element_List;
else
return Normalized_Param_Associations (Call_Elem => Statement);
end if;
else
if Nkind (Arg_Node) = N_Attribute_Reference then
-- call to 'Output, 'Read or 'Write
Res_Node_List := Sinfo.Expressions (Arg_Node);
else
Res_Node_List := Parameter_Associations (Arg_Node);
end if;
return N_To_E_List_New (List => Res_Node_List,
Internal_Kind => A_Parameter_Association,
Norm_Case => Res_Norm_Case,
Starting_Element => Statement);
end if;
exception
when ASIS_Inappropriate_Element =>
raise;
when ASIS_Failed =>
if Status_Indicator = Unhandled_Exception_Error then
Add_Call_Information
(Argument => Statement,
Bool_Par => Normalized,
Outer_Call => Package_Name & "Call_Statement_Parameters");
end if;
raise;
when Ex : others =>
Report_ASIS_Bug
(Query_Name => Package_Name & "Call_Statement_Parameters",
Ex => Ex,
Arg_Element => Statement,
Bool_Par_ON => Normalized);
end Call_Statement_Parameters;
-----------------
-- Called_Name --
-----------------
function Called_Name
(Statement : Asis.Statement)
return Asis.Expression
is
Arg_Kind : constant Internal_Element_Kinds := Int_Kind (Statement);
Arg_Node : Node_Id;
-- local variables needed for processing calls to 'Output, 'Read
-- and 'Write:
Result_Kind : Internal_Element_Kinds := Not_An_Element;
Result_Node : Node_Id;
begin
Check_Validity (Statement, Package_Name & "Called_Name");
if not (Arg_Kind = An_Entry_Call_Statement or else
Arg_Kind = A_Procedure_Call_Statement)
then
Raise_ASIS_Inappropriate_Element
(Package_Name & "Called_Name",
Wrong_Kind => Arg_Kind);
end if;
if Is_Prefix_Notation (Statement) then
Arg_Node := R_Node (Statement);
else
Arg_Node := Node (Statement);
end if;
if Nkind (Arg_Node) = N_Attribute_Reference then
-- calls like T'Output (...); T'Read (...) and T'Write (...)
-- should be processed separately, and the result should
-- be built on the same node as argument
Result_Kind := Subprogram_Attribute_Kind (Arg_Node);
Result_Node := Arg_Node;
else
Result_Node := Sinfo.Name (Arg_Node);
end if;
if Is_Rewrite_Substitution (Result_Node)
and then
Nkind (Result_Node) = N_Explicit_Dereference
and then
Nkind (Prefix (Result_Node)) = N_Function_Call
then
-- Needed to process cases like F (1), where F - parameterless
-- function that returns access-to-subprogram result.
Result_Node := Prefix (Result_Node);
end if;
return Node_To_Element_New (
Starting_Element => Statement,
Node => Result_Node,
Internal_Kind => Result_Kind);
exception
when ASIS_Inappropriate_Element =>
raise;
when ASIS_Failed =>
if Status_Indicator = Unhandled_Exception_Error then
Add_Call_Information
(Argument => Statement,
Outer_Call => Package_Name & "Called_Name");
end if;
raise;
when Ex : others =>
Report_ASIS_Bug
(Query_Name => Package_Name & "Called_Name",
Ex => Ex,
Arg_Element => Statement);
end Called_Name;
---------------------
-- Case_Expression --
---------------------
function Case_Expression
(Statement : Asis.Statement)
return Asis.Expression
is
Arg_Kind : constant Internal_Element_Kinds := Int_Kind (Statement);
Arg_Node : Node_Id;
begin
Check_Validity (Statement, Package_Name & "Case_Expression");
if not (Arg_Kind = A_Case_Statement or else
Arg_Kind = A_Case_Expression)
then
Raise_ASIS_Inappropriate_Element
(Package_Name & "Case_Expression",
Wrong_Kind => Arg_Kind);
end if;
Arg_Node := Node (Statement);
return Node_To_Element_New
(Node => Sinfo.Expression (Arg_Node),
Starting_Element => Statement);
exception
when ASIS_Inappropriate_Element =>
raise;
when ASIS_Failed =>
if Status_Indicator = Unhandled_Exception_Error then
Add_Call_Information
(Argument => Statement,
Outer_Call => Package_Name & "Case_Expression");
end if;
raise;
when Ex : others =>
Report_ASIS_Bug
(Query_Name => Package_Name & "Case_Expression",
Ex => Ex,
Arg_Element => Statement);
end Case_Expression;
----------------------------------------
-- Case_Statement_Alternative_Choices --
----------------------------------------
function Case_Statement_Alternative_Choices
(Path : Asis.Path)
return Asis.Element_List
is
Arg_Kind : constant Internal_Element_Kinds := Int_Kind (Path);
Arg_Node : Node_Id;
begin
Check_Validity
(Path, Package_Name & "Case_Statement_Alternative_Choices");
if not (Arg_Kind = A_Case_Path) then
Raise_ASIS_Inappropriate_Element
(Package_Name & "Case_Statement_Alternative_Choices",
Wrong_Kind => Arg_Kind);
end if;
Arg_Node := Node (Path);
return Discrete_Choice_Node_To_Element_List (
Choice_List => Discrete_Choices (Arg_Node),
Starting_Element => Path);
exception
when ASIS_Inappropriate_Element =>
raise;
when ASIS_Failed =>
if Status_Indicator = Unhandled_Exception_Error then
Add_Call_Information
(Argument => Path,
Outer_Call => Package_Name &
"Case_Statement_Alternative_Choices");
end if;
raise;
when Ex : others =>
Report_ASIS_Bug
(Query_Name => Package_Name & "Case_Statement_Alternative_Choices",
Ex => Ex,
Arg_Element => Path);
end Case_Statement_Alternative_Choices;
-----------------------------------
-- Choice_Parameter_Specification --
-------------------------------------
function Choice_Parameter_Specification
(Handler : Asis.Exception_Handler)
return Asis.Declaration
is
Arg_Kind : constant Internal_Element_Kinds := Int_Kind (Handler);
Arg_Node : Node_Id;
Result_Node : Node_Id;
begin
Check_Validity
(Handler, Package_Name & "Choice_Parameter_Specification");
if not (Arg_Kind = An_Exception_Handler) then
Raise_ASIS_Inappropriate_Element
(Package_Name & "Choice_Parameter_Specification",
Wrong_Kind => Arg_Kind);
end if;
Arg_Node := Node (Handler);
Result_Node := Choice_Parameter (Arg_Node);
if No (Result_Node) then
return Nil_Element;
else
return Node_To_Element_New (
Node => Result_Node,
Internal_Kind => A_Choice_Parameter_Specification,
Starting_Element => Handler);
end if;
exception
when ASIS_Inappropriate_Element =>
raise;
when ASIS_Failed =>
if Status_Indicator = Unhandled_Exception_Error then
Add_Call_Information
(Argument => Handler,
Outer_Call => Package_Name & "Choice_Parameter_Specification");
end if;
raise;
when Ex : others =>
Report_ASIS_Bug
(Query_Name => Package_Name & "Choice_Parameter_Specification",
Ex => Ex,
Arg_Element => Handler);
end Choice_Parameter_Specification;
--------------------------
-- Condition_Expression --
--------------------------
function Condition_Expression (Path : Asis.Path) return Asis.Expression is
Arg_Kind : constant Internal_Element_Kinds := Int_Kind (Path);
Res_Node : Node_Id := Empty;
Arg_Node : Node_Id;
begin
Check_Validity (Path, Package_Name & "Condition_Expression");
if not (Arg_Kind = An_If_Path or else
Arg_Kind = An_Elsif_Path or else
Arg_Kind = An_If_Expression_Path or else
Arg_Kind = An_Elsif_Expression_Path)
then
Raise_ASIS_Inappropriate_Element
(Package_Name & "Condition_Expression",
Wrong_Kind => Arg_Kind);
end if;
Arg_Node := R_Node (Path);
case Arg_Kind is
when An_If_Path |
An_Elsif_Path =>
Res_Node := Condition (Arg_Node);
when An_If_Expression_Path |
An_Elsif_Expression_Path =>
Res_Node := Prev (Arg_Node);
when others =>
null;
end case;
return Node_To_Element_New (Node => Res_Node,
Starting_Element => Path);
exception
when ASIS_Inappropriate_Element =>
raise;
when ASIS_Failed =>
if Status_Indicator = Unhandled_Exception_Error then
Add_Call_Information
(Argument => Path,
Outer_Call => Package_Name & "Condition_Expression");
end if;
raise;
when Ex : others =>
Report_ASIS_Bug
(Query_Name => Package_Name & "Condition_Expression",
Ex => Ex,
Arg_Element => Path);
end Condition_Expression;
---------------------------------
-- Corresponding_Called_Entity --
---------------------------------
function Corresponding_Called_Entity
(Statement : Asis.Statement)
return Asis.Declaration
is
Arg_Kind : constant Internal_Element_Kinds := Int_Kind (Statement);
begin
Check_Validity (Statement, Package_Name & "Corresponding_Called_Entity");
if not (Arg_Kind = An_Entry_Call_Statement or else
Arg_Kind = A_Procedure_Call_Statement)
then
Raise_ASIS_Inappropriate_Element
(Package_Name & "Corresponding_Called_Entity",
Wrong_Kind => Arg_Kind);
end if;
return Get_Corr_Called_Entity (Statement);
exception
when ASIS_Inappropriate_Element =>
raise;
when ASIS_Failed =>
if Status_Indicator = Unhandled_Exception_Error then
Add_Call_Information
(Argument => Statement,
Outer_Call => Package_Name & "Corresponding_Called_Entity");
end if;
raise;
when Ex : others =>
Report_ASIS_Bug
(Query_Name => Package_Name & "Corresponding_Called_Entity",
Ex => Ex,
Arg_Element => Statement);
end Corresponding_Called_Entity;
-----------------------------------------
-- Corresponding_Destination_Statement --
-----------------------------------------
function Corresponding_Destination_Statement
(Statement : Asis.Statement)
return Asis.Statement
is
Arg_Kind : constant Internal_Element_Kinds := Int_Kind (Statement);
Arg_Node : Node_Id;
Res_Label : Node_Id;
Res_Stmt : Node_Id;
begin
Check_Validity
(Statement, Package_Name & "Corresponding_Destination_Statement");
if not (Arg_Kind = A_Goto_Statement) then
Raise_ASIS_Inappropriate_Element
(Package_Name & "Corresponding_Destination_Statement",
Wrong_Kind => Arg_Kind);
end if;
Arg_Node := R_Node (Statement);
if Is_Rewrite_Substitution (Arg_Node)
and then
Nkind (Arg_Node) = N_Loop_Statement
and then
Nkind (Original_Node (Arg_Node)) = N_Goto_Statement
then
-- goto statement is rewritten into infinite loop
if not Is_Empty_List (Sinfo.Statements (Arg_Node)) then
Res_Stmt := First (Sinfo.Statements (Arg_Node));
else
-- Pathological case:
--
-- <<Junk>> goto Junk;
Res_Stmt := Arg_Node;
end if;
else
Arg_Node := Node (Statement);
Res_Label := Parent (Entity (Sinfo.Name (Arg_Node)));
-- this is N_Implicit_Label_Declaration node representing the
-- implicit declaration of the destination label
Res_Stmt := Label_Construct (Res_Label);
while not Is_Statement (Res_Stmt) loop
Res_Stmt := Next (Res_Stmt);
end loop;
-- if we are in the tree corresponding to a successful compiler
-- run, we shall for sure find a statement after any label!
end if;
return Node_To_Element_New (Node => Res_Stmt,
Starting_Element => Statement);
exception
when ASIS_Inappropriate_Element =>
raise;
when ASIS_Failed =>
if Status_Indicator = Unhandled_Exception_Error then
Add_Call_Information
(Argument => Statement,
Outer_Call => Package_Name &
"Corresponding_Destination_Statement");
end if;
raise;
when Ex : others =>
Report_ASIS_Bug
(Query_Name => Package_Name &
"Corresponding_Destination_Statement",
Ex => Ex,
Arg_Element => Statement);
end Corresponding_Destination_Statement;
-------------------------
-- Corresponding_Entry --
-------------------------
function Corresponding_Entry
(Statement : Asis.Statement)
return Asis.Declaration
is
Arg_Kind : constant Internal_Element_Kinds := Int_Kind (Statement);
Arg_Node : Node_Id;
Res_Entry_Dcl : Node_Id;
Result_Unit : Compilation_Unit;
begin
Check_Validity (Statement, Package_Name & "Corresponding_Entry");
if not (Arg_Kind = An_Accept_Statement) then
Raise_ASIS_Inappropriate_Element
(Package_Name & "Corresponding_Entry",
Wrong_Kind => Arg_Kind);
end if;
Arg_Node := Node (Statement);
Res_Entry_Dcl := Parent (Entity (Entry_Direct_Name (Arg_Node)));
Result_Unit := Enclosing_Unit
(Encl_Cont_Id (Statement), Res_Entry_Dcl);
return Node_To_Element_New (Node => Res_Entry_Dcl,
In_Unit => Result_Unit);
exception
when ASIS_Inappropriate_Element =>
raise;
when ASIS_Failed =>
if Status_Indicator = Unhandled_Exception_Error then
Add_Call_Information
(Argument => Statement,
Outer_Call => Package_Name & "Corresponding_Entry");
end if;
raise;
when Ex : others =>
Report_ASIS_Bug
(Query_Name => Package_Name & "Corresponding_Entry",
Ex => Ex,
Arg_Element => Statement);
end Corresponding_Entry;
-------------------------------
-- Corresponding_Loop_Exited --
-------------------------------
function Corresponding_Loop_Exited
(Statement : Asis.Statement)
return Asis.Statement
is
Arg_Kind : constant Internal_Element_Kinds := Int_Kind (Statement);
Arg_Node : Node_Id;
Res_Loop : Node_Id;
Loop_Name : Node_Id;
begin
Check_Validity (Statement, Package_Name & "Corresponding_Loop_Exited");
if not (Arg_Kind = An_Exit_Statement) then
Raise_ASIS_Inappropriate_Element
(Package_Name & "Corresponding_Loop_Exited",
Wrong_Kind => Arg_Kind);
end if;
Arg_Node := Node (Statement);
Loop_Name := Sinfo.Name (Arg_Node);
if Present (Loop_Name) then
-- we simply jump to the result loop:
Loop_Name := Parent (Entity (Loop_Name));
-- here we are in the implicit declaration of the loop name
Res_Loop := Label_Construct (Loop_Name);
else
-- here we have to traverse the tree up to the first enclosing
-- loop statement
Res_Loop := Parent (Arg_Node);
while Nkind (Res_Loop) /= N_Loop_Statement loop
Res_Loop := Parent (Res_Loop);
end loop;
end if;
return Node_To_Element_New (Node => Res_Loop,
Starting_Element => Statement);
exception
when ASIS_Inappropriate_Element =>
raise;
when ASIS_Failed =>
if Status_Indicator = Unhandled_Exception_Error then
Add_Call_Information
(Argument => Statement,
Outer_Call => Package_Name & "Corresponding_Loop_Exited");
end if;
raise;
when Ex : others =>
Report_ASIS_Bug
(Query_Name => Package_Name & "Corresponding_Loop_Exited",
Ex => Ex,
Arg_Element => Statement);
end Corresponding_Loop_Exited;
----------------------
-- Delay_Expression --
----------------------
function Delay_Expression
(Statement : Asis.Statement)
return Asis.Expression
is
Arg_Kind : constant Internal_Element_Kinds := Int_Kind (Statement);
Arg_Node : Node_Id;
begin
Check_Validity (Statement, Package_Name & "Delay_Expression");
if not (Arg_Kind = A_Delay_Until_Statement
or else
Arg_Kind = A_Delay_Relative_Statement)
then
Raise_ASIS_Inappropriate_Element
(Package_Name & "Delay_Expression",
Wrong_Kind => Arg_Kind);
end if;
Arg_Node := Node (Statement);
return Node_To_Element_New
(Node => Sinfo.Expression (Arg_Node),
Starting_Element => Statement);
exception
when ASIS_Inappropriate_Element =>
raise;
when ASIS_Failed =>
if Status_Indicator = Unhandled_Exception_Error then
Add_Call_Information
(Argument => Statement,
Outer_Call => Package_Name & "Delay_Expression");
end if;
raise;
when Ex : others =>
Report_ASIS_Bug
(Query_Name => Package_Name & "Delay_Expression",
Ex => Ex,
Arg_Element => Statement);
end Delay_Expression;
-----------------------
-- Exception_Choices --
-----------------------
function Exception_Choices
(Handler : Asis.Exception_Handler)
return Asis.Element_List
is
Arg_Kind : constant Internal_Element_Kinds := Int_Kind (Handler);
Arg_Node : Node_Id;
begin
Check_Validity (Handler, Package_Name & "Exception_Choices");
if not (Arg_Kind = An_Exception_Handler) then
Raise_ASIS_Inappropriate_Element
(Package_Name & "Exception_Choices",
Wrong_Kind => Arg_Kind);
end if;
Arg_Node := Node (Handler);
return N_To_E_List_New
(List => Exception_Choices (Arg_Node),
Starting_Element => Handler);
exception
when ASIS_Inappropriate_Element =>
raise;
when ASIS_Failed =>
if Status_Indicator = Unhandled_Exception_Error then
Add_Call_Information
(Argument => Handler,
Outer_Call => Package_Name & "Exception_Choices");
end if;
raise;
when Ex : others =>
Report_ASIS_Bug
(Query_Name => Package_Name & "Exception_Choices",
Ex => Ex,
Arg_Element => Handler);
end Exception_Choices;
--------------------
-- Exit_Condition --
--------------------
function Exit_Condition
(Statement : Asis.Statement)
return Asis.Expression
is
Arg_Kind : constant Internal_Element_Kinds := Int_Kind (Statement);
Arg_Node : Node_Id;
Result_Node : Node_Id;
begin
Check_Validity (Statement, Package_Name & "Exit_Condition");
if not (Arg_Kind = An_Exit_Statement) then
Raise_ASIS_Inappropriate_Element
(Package_Name & "Exit_Loop_Name",
Wrong_Kind => Arg_Kind);
end if;
Arg_Node := Node (Statement);
Result_Node := Condition (Arg_Node);
if No (Result_Node) then
return Nil_Element;
else
return Node_To_Element_New (Node => Result_Node,
Starting_Element => Statement);
end if;
exception
when ASIS_Inappropriate_Element =>
raise;
when ASIS_Failed =>
if Status_Indicator = Unhandled_Exception_Error then
Add_Call_Information
(Argument => Statement,
Outer_Call => Package_Name & "Exit_Condition");
end if;
raise;
when Ex : others =>
Report_ASIS_Bug
(Query_Name => Package_Name & "Exit_Condition",
Ex => Ex,
Arg_Element => Statement);
end Exit_Condition;
--------------------
-- Exit_Loop_Name --
--------------------
function Exit_Loop_Name
(Statement : Asis.Statement)
return Asis.Expression
is
Arg_Kind : constant Internal_Element_Kinds := Int_Kind (Statement);
Arg_Node : Node_Id;
Result_Node : Node_Id;
begin
Check_Validity (Statement, Package_Name & "Exit_Loop_Name");
if not (Arg_Kind = An_Exit_Statement) then
Raise_ASIS_Inappropriate_Element
(Package_Name & "Exit_Loop_Name",
Wrong_Kind => Arg_Kind);
end if;
Arg_Node := Node (Statement);
Result_Node := Sinfo.Name (Arg_Node);
if No (Result_Node) then
return Nil_Element;
else
return Node_To_Element_New (Node => Result_Node,
Starting_Element => Statement);
end if;
exception
when ASIS_Inappropriate_Element =>
raise;
when ASIS_Failed =>
if Status_Indicator = Unhandled_Exception_Error then
Add_Call_Information
(Argument => Statement,
Outer_Call => Package_Name & "Exit_Loop_Name");
end if;
raise;
when Ex : others =>
Report_ASIS_Bug
(Query_Name => Package_Name & "Exit_Loop_Name",
Ex => Ex,
Arg_Element => Statement);
end Exit_Loop_Name;
--------------------------------------
-- For_Loop_Parameter_Specification --
--------------------------------------
function For_Loop_Parameter_Specification
(Statement : Asis.Statement)
return Asis.Declaration
is
Arg_Kind : constant Internal_Element_Kinds := Int_Kind (Statement);
Res_Node : Node_Id;
Res_Kind : Internal_Element_Kinds := Not_An_Element;
begin
Check_Validity
(Statement, Package_Name & "For_Loop_Parameter_Specification");
if not (Arg_Kind = A_For_Loop_Statement) then
Raise_ASIS_Inappropriate_Element
(Package_Name & "For_Loop_Parameter_Specification",
Wrong_Kind => Arg_Kind);
end if;
Res_Node := Iteration_Scheme (Node (Statement));
if Present (Iterator_Specification (Res_Node)) then
Res_Node := Iterator_Specification (Res_Node);
if Of_Present (Res_Node) then
Res_Kind := An_Element_Iterator_Specification;
else
Res_Kind := A_Generalized_Iterator_Specification;
end if;
elsif Present (Loop_Parameter_Specification (Res_Node)) then
Res_Node := Loop_Parameter_Specification (Res_Node);
Res_Kind := A_Loop_Parameter_Specification;
else
null;
pragma Assert (False);
end if;
return Node_To_Element_New (
Node => Res_Node,
Internal_Kind => Res_Kind,
Starting_Element => Statement);
exception
when ASIS_Inappropriate_Element =>
raise;
when ASIS_Failed =>
if Status_Indicator = Unhandled_Exception_Error then
Add_Call_Information
(Argument => Statement,
Outer_Call => Package_Name &
"For_Loop_Parameter_Specification");
end if;
raise;
when Ex : others =>
Report_ASIS_Bug
(Query_Name => Package_Name & "For_Loop_Parameter_Specification",
Ex => Ex,
Arg_Element => Statement);
end For_Loop_Parameter_Specification;
----------------
-- Goto_Label --
----------------
function Goto_Label
(Statement : Asis.Statement)
return Asis.Expression
is
Arg_Kind : constant Internal_Element_Kinds := Int_Kind (Statement);
Arg_Node : Node_Id;
begin
Check_Validity (Statement, Package_Name & "Goto_Label");
if not (Arg_Kind = A_Goto_Statement) then
Raise_ASIS_Inappropriate_Element
(Package_Name & "Goto_Label",
Wrong_Kind => Arg_Kind);
end if;
Arg_Node := Node (Statement);
return Node_To_Element_New (Node => Sinfo.Name (Arg_Node),
Starting_Element => Statement);
exception
when ASIS_Inappropriate_Element =>
raise;
when ASIS_Failed =>
if Status_Indicator = Unhandled_Exception_Error then
Add_Call_Information
(Argument => Statement,
Outer_Call => Package_Name & "Goto_Label");
end if;
raise;
when Ex : others =>
Report_ASIS_Bug
(Query_Name => Package_Name & "Goto_Label",
Ex => Ex,
Arg_Element => Statement);
end Goto_Label;
-----------
-- Guard --
-----------
function Guard (Path : Asis.Path) return Asis.Expression is
Arg_Kind : constant Internal_Element_Kinds := Int_Kind (Path);
Arg_Node : Node_Id;
Result_Node : Node_Id;
begin
Check_Validity (Path, Package_Name & "Guard");
if not (Arg_Kind = A_Select_Path or else
Arg_Kind = An_Or_Path)
then
Raise_ASIS_Inappropriate_Element
(Package_Name & "Guard",
Wrong_Kind => Arg_Kind);
end if;
if not (Nkind (Parent (R_Node (Path))) = N_Selective_Accept) then
return Nil_Element;
end if;
Arg_Node := Node (Path);
Result_Node := Condition (Arg_Node);
if No (Result_Node) then
return Nil_Element;
else
return Node_To_Element_New (Node => Result_Node,
Starting_Element => Path);
end if;
exception
when ASIS_Inappropriate_Element =>
raise;
when ASIS_Failed =>
if Status_Indicator = Unhandled_Exception_Error then
Add_Call_Information
(Argument => Path,
Outer_Call => Package_Name & "Guard");
end if;
raise;
when Ex : others =>
Report_ASIS_Bug
(Query_Name => Package_Name & "Guard",
Ex => Ex,
Arg_Element => Path);
end Guard;
------------------------
-- Handler_Statements --
------------------------
function Handler_Statements
(Handler : Asis.Exception_Handler;
Include_Pragmas : Boolean := False)
return Asis.Statement_List
is
Arg_Kind : constant Internal_Element_Kinds := Int_Kind (Handler);
Arg_Node : Node_Id;
begin
Check_Validity (Handler, Package_Name & "Handler_Statements");
if not (Arg_Kind = An_Exception_Handler) then
Raise_ASIS_Inappropriate_Element
(Package_Name & "Handler_Statements",
Wrong_Kind => Arg_Kind);
end if;
Arg_Node := Node (Handler);
return N_To_E_List_New
(List => Sinfo.Statements (Arg_Node),
Include_Pragmas => Include_Pragmas,
Starting_Element => Handler);
exception
when ASIS_Inappropriate_Element =>
raise;
when ASIS_Failed =>
if Status_Indicator = Unhandled_Exception_Error then
Add_Call_Information
(Argument => Handler,
Bool_Par => Include_Pragmas,
Outer_Call => Package_Name & "Handler_Statements");
end if;
raise;
when Ex : others =>
Report_ASIS_Bug
(Query_Name => Package_Name & "Handler_Statements",
Ex => Ex,
Arg_Element => Handler,
Bool_Par_ON => Include_Pragmas);
end Handler_Statements;
--------------------------------------
-- Is_Call_On_Dispatching_Operation --
--------------------------------------
function Is_Call_On_Dispatching_Operation
(Call : Asis.Element)
return Boolean
is
Arg_Kind : constant Internal_Element_Kinds := Int_Kind (Call);
Called_Entity : Asis.Element;
begin
-- Just the first version, should be tested more carefully!
-- Is currently implemented as a secondary query based on
-- some queries from Asis.Extensions.
-- ??? !!!
-- Still depends on partially implemented queries from
-- Asis.Extensions
Check_Validity (Call, Package_Name & "Is_Call_On_Dispatching_Operation");
if not (Arg_Kind = A_Function_Call or else
Arg_Kind = A_Procedure_Call_Statement)
then
return False;
end if;
if Arg_Kind = A_Function_Call then
Called_Entity := Corresponding_Called_Function (Call);
else
Called_Entity := Corresponding_Called_Entity (Call);
end if;
if Is_Nil (Called_Entity) or else
(not Is_Dispatching_Operation (Called_Entity))
then
return False;
else
return True;
end if;
-- Owning_Type := Primary_Owner (Called_Entity);
-- Owning_Type := Type_Declaration_View (Owning_Type);
-- Owning_Type_Kind := Int_Kind (Owning_Type);
-- return
-- (Owning_Type_Kind = A_Tagged_Private_Type_Definition or else
-- Owning_Type_Kind = A_Private_Extension_Definition or else
-- Owning_Type_Kind = A_Derived_Record_Extension_Definition or else
-- Owning_Type_Kind = A_Tagged_Record_Type_Definition);
exception
when ASIS_Inappropriate_Element =>
raise;
when ASIS_Failed =>
if Status_Indicator = Unhandled_Exception_Error then
Add_Call_Information
(Argument => Call,
Outer_Call => Package_Name &
"Is_Call_On_Dispatching_Operation");
end if;
raise;
when Ex : others =>
Report_ASIS_Bug
(Query_Name => Package_Name & "Is_Call_On_Dispatching_Operation",
Ex => Ex,
Arg_Element => Call);
end Is_Call_On_Dispatching_Operation;
----------------------
-- Is_Declare_Block --
----------------------
function Is_Declare_Block
(Statement : Asis.Statement)
return Boolean
is
Arg_Kind : constant Internal_Element_Kinds := Int_Kind (Statement);
Arg_Node : Node_Id;
First_Letter : Character;
-- the first character of the statement, should be either
-- B[egin] or D[eclare]
begin
-- If the argument represents the dummy block statement created by
-- the Asis_Declarations.Body_Block_Statement (obsolescent!)
-- function, the result will be True if and only if the
-- corresponding body has any declarative item on its own.
Check_Validity (Statement, Package_Name & "Is_Declare_Block");
if not (Arg_Kind = A_Block_Statement) then
return False;
end if;
Arg_Node := Node (Statement);
if Special_Case (Statement) = A_Dummy_Block_Statement then
if Present (Sinfo.Declarations (Arg_Node)) then
return True;
else
return False;
end if;
else
-- a "normal" block statement: here we should be more accurate, and
-- we cannot rely on "Present (Declarations (Arg_Node))" approach
-- because of the implicit label declarations
First_Letter := Source_Text (Get_Source_File_Index (
Sloc (Arg_Node))) -- the unit's text buffer
(Sloc (Arg_Node));
case First_Letter is
when 'b' | 'B' =>
return False;
when 'd' | 'D' =>
return True;
when others =>
-- Unexpected beginning of the block statement
raise Internal_Implementation_Error;
end case;
end if;
exception
when ASIS_Inappropriate_Element =>
raise;
when ASIS_Failed =>
if Status_Indicator = Unhandled_Exception_Error then
Add_Call_Information
(Argument => Statement,
Outer_Call => Package_Name & "Is_Declare_Block");
end if;
raise;
when Ex : others =>
Report_ASIS_Bug
(Query_Name => Package_Name & "Is_Declare_Block",
Ex => Ex,
Arg_Element => Statement);
end Is_Declare_Block;
-------------------------
-- Is_Dispatching_Call --
-------------------------
function Is_Dispatching_Call (Call : Asis.Element) return Boolean is
Arg_Kind : constant Internal_Element_Kinds := Int_Kind (Call);
Arg_Node : Node_Id := R_Node (Call);
begin
Check_Validity (Call, Package_Name & "Is_Dispatching_Call");
if not (Arg_Kind = A_Function_Call or else
Arg_Kind = A_Procedure_Call_Statement)
then
return False;
end if;
if Is_Prefix_Notation (Call)
and then
Nkind (Arg_Node) = N_Explicit_Dereference
and then
Is_Rewrite_Substitution (Arg_Node)
and then
Nkind (Original_Node (Arg_Node)) = N_Function_Call
then
Arg_Node := Prefix (Arg_Node);
end if;
if not (Nkind (Arg_Node) = N_Function_Call or else
Nkind (Arg_Node) = N_Procedure_Call_Statement)
then
-- this may be possible as a result of tree rewriting, but if we
-- have rewriting, we do not have a dispatching call, so:
return False;
else
return Present (Controlling_Argument (Arg_Node));
end if;
exception
when ASIS_Inappropriate_Element =>
raise;
when ASIS_Failed =>
if Status_Indicator = Unhandled_Exception_Error then
Add_Call_Information
(Argument => Call,
Outer_Call => Package_Name & "Is_Dispatching_Call");
end if;
raise;
when Ex : others =>
Report_ASIS_Bug
(Query_Name => Package_Name & "Is_Dispatching_Call",
Ex => Ex,
Arg_Element => Call);
end Is_Dispatching_Call;
----------------------
-- Is_Name_Repeated --
----------------------
function Is_Name_Repeated (Statement : Asis.Statement) return Boolean is
Arg_Kind : constant Internal_Element_Kinds := Int_Kind (Statement);
Last_Comp : Asis.Element;
S : Source_Ptr;
Result : Boolean;
begin
Check_Validity (Statement, Package_Name & "Is_Name_Repeated");
if not (Arg_Kind = A_Loop_Statement or else
Arg_Kind = A_While_Loop_Statement or else
Arg_Kind = A_For_Loop_Statement or else
Arg_Kind = A_Block_Statement or else
Arg_Kind = An_Accept_Statement)
then
Result := False;
end if;
if Arg_Kind = A_Loop_Statement or else
Arg_Kind = A_While_Loop_Statement or else
Arg_Kind = A_For_Loop_Statement or else
Arg_Kind = A_Block_Statement
then
Result := not Asis.Elements.Is_Nil (Statement_Identifier (Statement));
elsif Arg_Kind = An_Accept_Statement then
if Is_Nil (Accept_Body_Statements (Statement, True)) then
-- no statements - no "do .. end;" part - no "end"
-- to repeat the name after
Result := False;
else
Last_Comp := Get_Last_Component (Statement);
S := Set_Image_End (Last_Comp);
-- now S points to the last character (it for sure is ';')
-- of the last component (a statement, an exception
-- handler or pragma) in the accept statement.
-- First, we reset S to point onto the first character
-- after the final end of the accept statement:
-- the final "end" lexically is an identifier, so:
S := Next_Identifier (S);
S := S + 3;
-- the first character after "end"
S := Rightmost_Non_Blank (S);
-- and the final check - what follows the final "end"
if Get_Character (S) = ';' then
Result := False;
else
Result := True;
end if;
end if;
end if;
return Result;
exception
when ASIS_Inappropriate_Element =>
raise;
when ASIS_Failed =>
if Status_Indicator = Unhandled_Exception_Error then
Add_Call_Information
(Argument => Statement,
Outer_Call => Package_Name & "Is_Name_Repeated");
end if;
raise;
when Ex : others =>
Report_ASIS_Bug
(Query_Name => Package_Name & "Is_Name_Repeated",
Ex => Ex,
Arg_Element => Statement);
end Is_Name_Repeated;
-----------------
-- Label_Names --
-----------------
function Label_Names
(Statement : Asis.Statement)
return Asis.Defining_Name_List
is
Arg_Kind : constant Internal_Element_Kinds := Int_Kind (Statement);
Arg_Node : Node_Id;
Parent_Node : Node_Id;
Labels_Number : Nat := 0; -- how many labels the statement has
Label_Node : Node_Id;
begin
Check_Validity (Statement, Package_Name & "Label_Names");
if not (Arg_Kind in Internal_Statement_Kinds) then
Raise_ASIS_Inappropriate_Element
(Package_Name & "Label_Names",
Wrong_Kind => Arg_Kind);
end if;
Arg_Node := Node (Statement);
-- First, process a special case when an infinite loop is programmed as
--
-- <<Target>> Stmt;
-- ...
-- goto Target;
--
-- If Stmt has exactly one label attached to it, the front-end rewrites
-- this construct as a subtree headed by N_Loop_Statement node
Parent_Node := Parent (R_Node (Statement));
if Nkind (Parent_Node) = N_Loop_Statement
and then
Is_Rewrite_Substitution (Parent_Node)
and then
Nkind (Original_Node (Parent_Node)) = N_Goto_Statement
and then
Arg_Node = First (Sinfo.Statements (Parent_Node))
then
return
(1 => Node_To_Element_New
(Node => Sinfo.Identifier (Parent_Node),
Internal_Kind => A_Defining_Identifier,
Starting_Element => Statement));
elsif Nkind (Arg_Node) = N_Goto_Statement
and then
Nkind (R_Node (Statement)) = N_Loop_Statement
and then
Is_Empty_List (Sinfo.Statements (R_Node (Statement)))
then
-- This is a pathological case of
--
-- <<Target>> goto Target;
return
(1 => Node_To_Element_New
(Node => Sinfo.Identifier (R_Node (Statement)),
Internal_Kind => A_Defining_Identifier,
Starting_Element => Statement));
end if;
if not Is_List_Member (Arg_Node) then
-- the accept statement in accept alternative, it cannot
-- have labels at all
return Nil_Element_List;
end if;
Label_Node := Prev (Arg_Node);
while Nkind (Label_Node) in N_Raise_xxx_Error loop
-- See B920-A06
Label_Node := Prev (Label_Node);
end loop;
while Nkind (Label_Node) = N_Label loop
Labels_Number := Labels_Number + 1;
Label_Node := Prev (Label_Node);
end loop;
-- Label_Node is not the Node of N_Label kind now
if Labels_Number = 0 then
return Nil_Element_List;
else
declare
Result_List : Asis.Element_List
(1 .. ASIS_Integer (Labels_Number));
begin
if Label_Node = Empty then
-- special case: the first statement in the statement
-- sequence is labeled
Label_Node := First (List_Containing (Arg_Node));
else
Label_Node := Next (Label_Node);
end if;
-- the first label attached to the statement and the number of
-- attached labels are obtained
for I in 1 .. ASIS_Integer (Labels_Number) loop
-- the order of labels is important !
Result_List (I) := Node_To_Element_New (
Node => Label_Node,
Internal_Kind => A_Defining_Identifier,
Starting_Element => Statement);
Label_Node := Next (Label_Node);
end loop;
return Result_List;
end;
end if;
exception
when ASIS_Inappropriate_Element =>
raise;
when ASIS_Failed =>
if Status_Indicator = Unhandled_Exception_Error then
Add_Call_Information
(Argument => Statement,
Outer_Call => Package_Name & "Label_Names");
end if;
raise;
when Ex : others =>
Report_ASIS_Bug
(Query_Name => Package_Name & "Label_Names",
Ex => Ex,
Arg_Element => Statement);
end Label_Names;
---------------------
-- Loop_Statements --
---------------------
function Loop_Statements
(Statement : Asis.Statement;
Include_Pragmas : Boolean := False)
return Asis.Statement_List
is
Arg_Kind : constant Internal_Element_Kinds := Int_Kind (Statement);
Arg_Node : Node_Id;
begin
Check_Validity (Statement, Package_Name & "Loop_Statements");
if not (Arg_Kind = A_Loop_Statement or else
Arg_Kind = A_While_Loop_Statement or else
Arg_Kind = A_For_Loop_Statement)
then
Raise_ASIS_Inappropriate_Element
("Asis_Statement.Loop_Statements",
Wrong_Kind => Arg_Kind);
end if;
Arg_Node := Node (Statement);
return N_To_E_List_New
(List => Sinfo.Statements (Arg_Node),
Include_Pragmas => Include_Pragmas,
Starting_Element => Statement);
exception
when ASIS_Inappropriate_Element =>
raise;
when ASIS_Failed =>
if Status_Indicator = Unhandled_Exception_Error then
Add_Call_Information
(Argument => Statement,
Bool_Par => Include_Pragmas,
Outer_Call => Package_Name & "Loop_Statements");
end if;
raise;
when Ex : others =>
Report_ASIS_Bug
(Query_Name => Package_Name & "Loop_Statements",
Ex => Ex,
Arg_Element => Statement,
Bool_Par_ON => Include_Pragmas);
end Loop_Statements;
--------------------------
-- Qualified_Expression --
--------------------------
function Qualified_Expression
(Statement : Asis.Statement)
return Asis.Expression
is
Arg_Kind : constant Internal_Element_Kinds := Int_Kind (Statement);
Arg_Node : Node_Id;
begin
Check_Validity (Statement, Package_Name & "Qualified_Expression");
if not (Arg_Kind = A_Code_Statement) then
Raise_ASIS_Inappropriate_Element
(Package_Name & "Qualified_Expression",
Wrong_Kind => Arg_Kind);
end if;
Arg_Node := Node (Statement);
return Node_To_Element_New (
Node => Sinfo.Expression (Arg_Node),
Internal_Kind => A_Qualified_Expression,
Starting_Element => Statement);
exception
when ASIS_Inappropriate_Element =>
raise;
when ASIS_Failed =>
if Status_Indicator = Unhandled_Exception_Error then
Add_Call_Information
(Argument => Statement,
Outer_Call => Package_Name & "Qualified_Expression");
end if;
raise;
when Ex : others =>
Report_ASIS_Bug
(Query_Name => Package_Name & "Qualified_Expression",
Ex => Ex,
Arg_Element => Statement);
end Qualified_Expression;
----------------------
-- Raised_Exception --
----------------------
function Raised_Exception
(Statement : Asis.Statement)
return Asis.Expression
is
Arg_Kind : constant Internal_Element_Kinds := Int_Kind (Statement);
Arg_Node : Node_Id;
Result_Node : Node_Id;
begin
Check_Validity (Statement, Package_Name & "Raised_Exception");
if not (Arg_Kind = A_Raise_Statement) then
Raise_ASIS_Inappropriate_Element
(Package_Name & "Raised_Exception",
Wrong_Kind => Arg_Kind);
end if;
Arg_Node := Node (Statement);
Result_Node := Sinfo.Name (Arg_Node);
if No (Result_Node) then
return Nil_Element;
else
return Node_To_Element_New (
Node => Result_Node,
Starting_Element => Statement);
end if;
exception
when ASIS_Inappropriate_Element =>
raise;
when ASIS_Failed =>
if Status_Indicator = Unhandled_Exception_Error then
Add_Call_Information
(Argument => Statement,
Outer_Call => Package_Name & "Raised_Exception");
end if;
raise;
when Ex : others =>
Report_ASIS_Bug
(Query_Name => Package_Name & "Raised_Exception",
Ex => Ex,
Arg_Element => Statement);
end Raised_Exception;
------------------------
-- Requeue_Entry_Name --
------------------------
function Requeue_Entry_Name
(Statement : Asis.Statement)
return Asis.Name
is
Arg_Kind : constant Internal_Element_Kinds := Int_Kind (Statement);
Arg_Node : Node_Id;
begin
Check_Validity (Statement, Package_Name & "Requeue_Entry_Name");
if not (Arg_Kind = A_Requeue_Statement
or else
Arg_Kind = A_Requeue_Statement_With_Abort)
then
Raise_ASIS_Inappropriate_Element
(Package_Name & "Requeue_Entry_Name",
Wrong_Kind => Arg_Kind);
end if;
Arg_Node := Node (Statement);
return Node_To_Element_New (Node => Sinfo.Name (Arg_Node),
Starting_Element => Statement);
exception
when ASIS_Inappropriate_Element =>
raise;
when ASIS_Failed =>
if Status_Indicator = Unhandled_Exception_Error then
Add_Call_Information
(Argument => Statement,
Outer_Call => Package_Name & "Requeue_Entry_Name");
end if;
raise;
when Ex : others =>
Report_ASIS_Bug
(Query_Name => Package_Name & "Requeue_Entry_Name",
Ex => Ex,
Arg_Element => Statement);
end Requeue_Entry_Name;
-----------------------
-- Return_Expression --
-----------------------
function Return_Expression
(Statement : Asis.Statement)
return Asis.Expression
is
Arg_Kind : constant Internal_Element_Kinds := Int_Kind (Statement);
Arg_Node : Node_Id;
Result_Node : Node_Id;
begin
Check_Validity (Statement, Package_Name & "Return_Expression");
if not (Arg_Kind = A_Return_Statement) then
Raise_ASIS_Inappropriate_Element
(Package_Name & "Return_Expression",
Wrong_Kind => Arg_Kind);
end if;
Arg_Node := Node (Statement);
Result_Node := Sinfo.Expression (Arg_Node);
if No (Result_Node) then
return Nil_Element;
else
return Node_To_Element_New (Node => Result_Node,
Starting_Element => Statement);
end if;
exception
when ASIS_Inappropriate_Element =>
raise;
when ASIS_Failed =>
if Status_Indicator = Unhandled_Exception_Error then
Add_Call_Information
(Argument => Statement,
Outer_Call => Package_Name & "Return_Expression");
end if;
raise;
when Ex : others =>
Report_ASIS_Bug
(Query_Name => Package_Name & "Return_Expression",
Ex => Ex,
Arg_Element => Statement);
end Return_Expression;
----------------------------
-- Sequence_Of_Statements --
----------------------------
function Sequence_Of_Statements
(Path : Asis.Path;
Include_Pragmas : Boolean := False)
return Asis.Statement_List
is
Arg_Kind : constant Internal_Element_Kinds := Int_Kind (Path);
Arg_Node : Node_Id;
Result_List : List_Id;
-- for processing An_If_Path, An_Elsif_Path, An_Else_Path, A_Case_Path
-- and A_Then_Abort_Path arguments; the node of such argument has
-- regular structure
-- local variables for processing A_Select_Path and An_Or_Path
-- arguments; the node of such arguments has irregular structure
Statement_List : List_Id;
First_Element : Asis.Element := Nil_Element;
Alternative_Node_Kind : Node_Kind;
begin
Check_Validity (Path, Package_Name & "Sequence_Of_Statements");
if not (Arg_Kind in Internal_Statement_Path_Kinds) then
Raise_ASIS_Inappropriate_Element
(Package_Name & "Sequence_Of_Statements",
Wrong_Kind => Arg_Kind);
end if;
Arg_Node := Node (Path);
case Arg_Kind is
when An_If_Path | An_Elsif_Path =>
Result_List := Then_Statements (Arg_Node);
when An_Else_Path =>
Result_List := Else_Statements (Arg_Node);
when A_Case_Path =>
Result_List := Sinfo.Statements (Arg_Node);
when A_Then_Abort_Path =>
Result_List := Sinfo.Statements (Arg_Node);
when A_Select_Path | An_Or_Path =>
Alternative_Node_Kind := Nkind (Arg_Node);
if Alternative_Node_Kind = N_Terminate_Alternative then
-- special case: result list contains only one dummy terminate
-- statement; no tree traversing needed: the result is based
-- on the same node as the argument
return Asis.Statement_List'(
1 => Node_To_Element_New (
Node => Arg_Node,
Internal_Kind => A_Terminate_Alternative_Statement,
Starting_Element => Path));
else
-- this alternative corresponds to the situation of
-- N_Accept_Alternative, N_Delay_Alternative,
-- N_Entry_Call_Alternative or N_Triggering_Alternative
-- forming the first element of the element list to be
-- returned:
if Alternative_Node_Kind = N_Accept_Alternative then
First_Element :=
Node_To_Element_New (
Node => Accept_Statement (Arg_Node),
Internal_Kind => An_Accept_Statement,
Starting_Element => Path);
elsif Alternative_Node_Kind = N_Delay_Alternative then
First_Element :=
Node_To_Element_New (
Node => Delay_Statement (Arg_Node),
Starting_Element => Path);
elsif Alternative_Node_Kind = N_Entry_Call_Alternative then
First_Element :=
Node_To_Element_New (
Node => Entry_Call_Statement (Arg_Node),
Starting_Element => Path);
elsif Alternative_Node_Kind = N_Triggering_Alternative then
First_Element :=
Node_To_Element_New (
Node => Triggering_Statement (Arg_Node),
Starting_Element => Path);
end if;
-- the rest of the returned list:
Statement_List := Sinfo.Statements (Arg_Node);
return Asis.Statement_List'(1 => First_Element) &
N_To_E_List_New
(List => Statement_List,
Include_Pragmas => Include_Pragmas,
Starting_Element => Path);
end if;
when others =>
null;
end case;
return N_To_E_List_New (List => Result_List,
Include_Pragmas => Include_Pragmas,
Starting_Element => Path);
exception
when ASIS_Inappropriate_Element =>
raise;
when ASIS_Failed =>
if Status_Indicator = Unhandled_Exception_Error then
Add_Call_Information
(Argument => Path,
Bool_Par => Include_Pragmas,
Outer_Call => Package_Name & "Sequence_Of_Statements");
end if;
raise;
when Ex : others =>
Report_ASIS_Bug
(Query_Name => Package_Name & "Sequence_Of_Statements",
Ex => Ex,
Arg_Element => Path,
Bool_Par_ON => Include_Pragmas);
end Sequence_Of_Statements;
--------------------------
-- Statement_Identifier --
--------------------------
function Statement_Identifier
(Statement : Asis.Statement)
return Asis.Defining_Name
is
Arg_Kind : constant Internal_Element_Kinds := Int_Kind (Statement);
Arg_Node : Node_Id;
begin
Check_Validity (Statement, Package_Name & "Statement_Identifier");
if not (Arg_Kind = A_Loop_Statement or else
Arg_Kind = A_While_Loop_Statement or else
Arg_Kind = A_For_Loop_Statement or else
Arg_Kind = A_Block_Statement)
then
Raise_ASIS_Inappropriate_Element
("Asis_Statement.Statement_Identifier",
Wrong_Kind => Arg_Kind);
end if;
Arg_Node := Node (Statement);
if Special_Case (Statement) = A_Dummy_Block_Statement or else
Has_Created_Identifier (Arg_Node)
then
return Nil_Element;
else
return Node_To_Element_New (
Node => Sinfo.Identifier (Arg_Node),
Internal_Kind => A_Defining_Identifier,
Starting_Element => Statement);
end if;
exception
when ASIS_Inappropriate_Element =>
raise;
when ASIS_Failed =>
if Status_Indicator = Unhandled_Exception_Error then
Add_Call_Information
(Argument => Statement,
Outer_Call => Package_Name & "Statement_Identifier");
end if;
raise;
when Ex : others =>
Report_ASIS_Bug
(Query_Name => Package_Name & "Statement_Identifier",
Ex => Ex,
Arg_Element => Statement);
end Statement_Identifier;
---------------------
-- Statement_Paths --
---------------------
function Statement_Paths
(Statement : Asis.Statement;
Include_Pragmas : Boolean := False)
return Asis.Path_List
is
Arg_Kind : constant Internal_Element_Kinds := Int_Kind (Statement);
Arg_Node : Node_Id;
Path_List_Length : ASIS_Integer; -- Length of returned list
Elsif_Or_Length : ASIS_Integer; -- Number of Elsif or Or paths
Else_Present : Boolean;
begin
Check_Validity (Statement, Package_Name & "Statement_Paths");
if not (Arg_Kind = An_If_Statement or else
Arg_Kind = A_Case_Statement or else
Arg_Kind = A_Selective_Accept_Statement or else
Arg_Kind = A_Timed_Entry_Call_Statement or else
Arg_Kind = A_Conditional_Entry_Call_Statement or else
Arg_Kind = An_Asynchronous_Select_Statement)
then
Raise_ASIS_Inappropriate_Element
(Package_Name & "Statement_Paths",
Wrong_Kind => Arg_Kind);
end if;
Arg_Node := Node (Statement);
case Arg_Kind is
when An_If_Statement =>
Path_List_Length := 1; -- An_If_Path
Else_Present := Present (Else_Statements (Arg_Node));
if Else_Present then
Path_List_Length := Path_List_Length + 1;
end if;
if Present (Elsif_Parts (Arg_Node)) then
Elsif_Or_Length := ASIS_Integer
(List_Length (Elsif_Parts (Arg_Node)));
else
Elsif_Or_Length := 0;
end if;
Path_List_Length := Path_List_Length + Elsif_Or_Length;
declare
Path_List : Asis.Element_List (1 .. Path_List_Length);
-- Element List to be returned by the function
begin
Path_List (1) := Node_To_Element_New
(Node => Arg_Node,
Internal_Kind => An_If_Path,
Starting_Element => Statement);
Path_List (2 .. Elsif_Or_Length + 1) :=
N_To_E_List_New
(List => Elsif_Parts (Arg_Node),
Internal_Kind => An_Elsif_Path,
Starting_Element => Statement);
if Else_Present then
Path_List (Path_List_Length) := Node_To_Element_New
(Node => Arg_Node,
Internal_Kind => An_Else_Path,
Starting_Element => Statement);
end if;
return Path_List;
end;
when A_Case_Statement =>
-- only here the value of Include_Pragmas is important
return N_To_E_List_New
(List => Alternatives (Arg_Node),
Include_Pragmas => Include_Pragmas,
Starting_Element => Statement);
when A_Selective_Accept_Statement =>
Elsif_Or_Length := ASIS_Integer
(List_Length (Select_Alternatives (Arg_Node)));
Path_List_Length := Elsif_Or_Length;
Else_Present := Present (Else_Statements (Arg_Node));
if Else_Present then
Path_List_Length := Path_List_Length + 1;
end if;
declare
Path_List : Asis.Element_List (1 .. Path_List_Length);
-- Element List to be returned by the function
begin
Path_List (1 .. Elsif_Or_Length) :=
N_To_E_List_New
(List => Select_Alternatives (Arg_Node),
Starting_Element => Statement);
if Else_Present then
Path_List (Path_List_Length) := Node_To_Element_New
(Node => Arg_Node,
Internal_Kind => An_Else_Path,
Starting_Element => Statement);
end if;
return Path_List;
end;
when A_Timed_Entry_Call_Statement =>
return Asis.Path_List'(
1 => Node_To_Element_New (
Node => Entry_Call_Alternative (Arg_Node),
Internal_Kind => A_Select_Path,
Starting_Element => Statement),
2 => Node_To_Element_New (
Node => Delay_Alternative (Arg_Node),
Internal_Kind => An_Or_Path,
Starting_Element => Statement));
when A_Conditional_Entry_Call_Statement =>
return Asis.Path_List'(
1 => Node_To_Element_New (
Node => Entry_Call_Alternative (Arg_Node),
Internal_Kind => A_Select_Path,
Starting_Element => Statement),
2 => Node_To_Element_New (
Node => Arg_Node,
Internal_Kind => An_Else_Path,
Starting_Element => Statement));
when An_Asynchronous_Select_Statement =>
return Asis.Path_List'(
1 => Node_To_Element_New (
Node => Triggering_Alternative (Arg_Node),
Internal_Kind => A_Select_Path,
Starting_Element => Statement),
2 => Node_To_Element_New (
Node => Abortable_Part (Arg_Node),
Internal_Kind => A_Then_Abort_Path,
Starting_Element => Statement));
when others =>
raise Internal_Implementation_Error;
-- this choice can never be reached, see the condition
-- for defining the appropriate element
end case;
exception
when ASIS_Inappropriate_Element =>
raise;
when ASIS_Failed =>
if Status_Indicator = Unhandled_Exception_Error then
Add_Call_Information
(Argument => Statement,
Bool_Par => Include_Pragmas,
Outer_Call => Package_Name & "Statement_Paths");
end if;
raise;
when Ex : others =>
Report_ASIS_Bug
(Query_Name => Package_Name & "Statement_Paths",
Ex => Ex,
Arg_Element => Statement,
Bool_Par_ON => Include_Pragmas);
end Statement_Paths;
---------------------
-- While_Condition --
---------------------
function While_Condition
(Statement : Asis.Statement)
return Asis.Expression
is
Arg_Kind : constant Internal_Element_Kinds := Int_Kind (Statement);
Arg_Node : Node_Id;
begin
Check_Validity (Statement, Package_Name & "While_Condition");
if not (Arg_Kind = A_While_Loop_Statement) then
Raise_ASIS_Inappropriate_Element
(Package_Name & "While_Condition",
Wrong_Kind => Arg_Kind);
end if;
Arg_Node := Node (Statement);
return Node_To_Element_New (
Node => Condition (Iteration_Scheme (Arg_Node)),
Starting_Element => Statement);
exception
when ASIS_Inappropriate_Element =>
raise;
when ASIS_Failed =>
if Status_Indicator = Unhandled_Exception_Error then
Add_Call_Information
(Argument => Statement,
Outer_Call => Package_Name & "While_Condition");
end if;
raise;
when Ex : others =>
Report_ASIS_Bug
(Query_Name => Package_Name & "While_Condition",
Ex => Ex,
Arg_Element => Statement);
end While_Condition;
end Asis.Statements;
| 32.28931 | 79 | 0.558859 |
d1a76d3e4821bda82b86b2c7abb72c08d0452f6f | 6,490 | ads | Ada | src/agate.ads | Fabien-Chouteau/AGATE | cd8dbc54c1c70379c833e7cd710e2326ad6e9a91 | [
"BSD-3-Clause"
] | 3 | 2017-12-23T10:25:07.000Z | 2021-06-09T13:47:19.000Z | src/agate.ads | Fabien-Chouteau/AGATE | cd8dbc54c1c70379c833e7cd710e2326ad6e9a91 | [
"BSD-3-Clause"
] | null | null | null | src/agate.ads | Fabien-Chouteau/AGATE | cd8dbc54c1c70379c833e7cd710e2326ad6e9a91 | [
"BSD-3-Clause"
] | null | null | null | ------------------------------------------------------------------------------
-- --
-- Copyright (C) 2017-2020, Fabien Chouteau --
-- --
-- Redistribution and use in source and binary forms, with or without --
-- modification, are permitted provided that the following conditions are --
-- met: --
-- 1. Redistributions of source code must retain the above copyright --
-- notice, this list of conditions and the following disclaimer. --
-- 2. Redistributions in binary form must reproduce the above copyright --
-- notice, this list of conditions and the following disclaimer in --
-- the documentation and/or other materials provided with the --
-- distribution. --
-- 3. Neither the name of the copyright holder nor the names of its --
-- contributors may be used to endorse or promote products derived --
-- from this software without specific prior written permission. --
-- --
-- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS --
-- "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT --
-- LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR --
-- A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT --
-- HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, --
-- SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT --
-- LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, --
-- DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY --
-- THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT --
-- (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE --
-- OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. --
-- --
------------------------------------------------------------------------------
with HAL; use HAL;
with System.Storage_Elements; use System.Storage_Elements;
with Tools; use Tools;
with AGATE_Arch_Parameters;
private with AGATE_Types_Data.Traces;
package AGATE is
subtype Word is AGATE_Arch_Parameters.Word;
-- Task --
type Task_ID is private;
Invalid_Task : constant Task_ID;
type Internal_Task_Priority is range -1 .. 256;
subtype Task_Priority is Internal_Task_Priority range 0 .. 256;
type Task_Procedure is access procedure;
type Task_Status is (Created, Ready, Running, Fault, Suspended_Alarm,
Suspended_Semaphore, Suspended_Mutex);
subtype Task_Name is String (1 .. 10);
function Image (Status : Task_Status) return String;
function Name (ID : Task_ID) return String;
function Image (ID : Task_ID) return String;
-- Time --
type Time is new UInt64;
-- Semaphore --
type Semaphore_Count is new Natural;
type Semaphore_ID is private;
Invalid_Semaphore : constant Semaphore_ID;
-- Mutex --
type Mutex_ID is private;
Invalid_Mutex : constant Mutex_ID;
type Process_Stack_Pointer is new System.Address;
private
-- Task --
type Task_Stack is new Storage_Array;
pragma Warnings (Off, "suspiciously large alignment");
for Task_Stack'Alignment use 8 * 8;
pragma Warnings (On, "suspiciously large alignment");
type Task_Stack_Access is access all Task_Stack;
type Task_Sec_Stack is new Storage_Array;
type Task_Sec_Stack_Access is access all Task_Sec_Stack;
type Task_Heap is new Storage_Array;
type Task_Heap_Access is access all Task_Heap;
Null_PSP : constant Process_Stack_Pointer :=
Process_Stack_Pointer (System.Null_Address);
function Image (P : Process_Stack_Pointer) return String
is (Hex (UInt32 (To_Integer (System.Address (P)))));
type Task_Object;
type Task_Object_Access is access all Task_Object;
type Task_Object (Proc : not null Task_Procedure;
Base_Prio : Internal_Task_Priority;
Stack : Task_Stack_Access;
Sec_Stack : Task_Sec_Stack_Access;
Heap : Task_Heap_Access)
is limited record
Canary : UInt32;
Current_Prio : Internal_Task_Priority;
Next : Task_Object_Access := null;
Stack_Pointer : Process_Stack_Pointer := Null_PSP;
Name : Task_Name := (others => ' ');
Context : AGATE_Arch_Parameters.Task_Context;
Alarm_Time : Time := 0;
Status : Task_Status := Created;
All_Task_Next : Task_Object_Access := null;
Trace_Data : AGATE_Types_Data.Traces.Task_Data;
end record;
type Task_ID is new Task_Object_Access;
Invalid_Task : constant Task_ID := null;
All_Tasks_List : Task_Object_Access := null;
procedure Set_Stack_Canary (T : Task_ID);
procedure Check_Stack_Canary (T : Task_ID);
procedure Check_All_Stack_Canaries;
-- Semaphore --
type Semaphore (Initial_Count : Semaphore_Count := 0)
is limited record
Count : Semaphore_Count := Initial_Count;
Waiting_List : Task_Object_Access := null;
Trace_Data : AGATE_Types_Data.Traces.Semaphore_Data;
end record;
type Semaphore_Access is access all Semaphore;
type Semaphore_ID is new Semaphore_Access;
pragma No_Strict_Aliasing (Semaphore_ID);
Invalid_Semaphore : constant Semaphore_ID := null;
function To_Word (ID : Semaphore_ID) return Word;
function To_ID (ID : Word) return Semaphore_ID;
-- Mutex --
type Mutex (Prio : Internal_Task_Priority)
is limited record
Owner : Task_Object_Access := null;
Waiting_List : Task_Object_Access := null;
Trace_Data : AGATE_Types_Data.Traces.Mutex_Data;
end record;
type Mutex_Access is access all Mutex;
type Mutex_ID is new Mutex_Access;
pragma No_Strict_Aliasing (Mutex_ID);
Invalid_Mutex : constant Mutex_ID := null;
function To_Word (ID : Mutex_ID) return Word;
function To_ID (ID : Word) return Mutex_ID;
end AGATE;
| 35.659341 | 78 | 0.621418 |
5ed7badc85384c13010272a9faebfe47cc3271c9 | 45,638 | adb | Ada | gcc-gcc-7_3_0-release/gcc/ada/s-taprop-posix.adb | best08618/asylo | 5a520a9f5c461ede0f32acc284017b737a43898c | [
"Apache-2.0"
] | 7 | 2020-05-02T17:34:05.000Z | 2021-10-17T10:15:18.000Z | gcc-gcc-7_3_0-release/gcc/ada/s-taprop-posix.adb | best08618/asylo | 5a520a9f5c461ede0f32acc284017b737a43898c | [
"Apache-2.0"
] | null | null | null | gcc-gcc-7_3_0-release/gcc/ada/s-taprop-posix.adb | best08618/asylo | 5a520a9f5c461ede0f32acc284017b737a43898c | [
"Apache-2.0"
] | 2 | 2020-07-27T00:22:36.000Z | 2021-04-01T09:41:02.000Z | ------------------------------------------------------------------------------
-- --
-- GNAT RUN-TIME LIBRARY (GNARL) COMPONENTS --
-- --
-- S Y S T E M . T A S K _ P R I M I T I V E S . O P E R A T I O N S --
-- --
-- B o d y --
-- --
-- Copyright (C) 1992-2015, Free Software Foundation, Inc. --
-- --
-- GNARL is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
-- ware Foundation; either version 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/>. --
-- --
-- GNARL was developed by the GNARL team at Florida State University. --
-- Extensive contributions were provided by Ada Core Technologies, Inc. --
-- --
------------------------------------------------------------------------------
-- This is a POSIX-like version of this package
-- This package contains all the GNULL primitives that interface directly with
-- the underlying OS.
-- Note: this file can only be used for POSIX compliant systems that implement
-- SCHED_FIFO and Ceiling Locking correctly.
-- For configurations where SCHED_FIFO and priority ceiling are not a
-- requirement, this file can also be used (e.g AiX threads)
pragma Polling (Off);
-- Turn off polling, we do not want ATC polling to take place during tasking
-- operations. It causes infinite loops and other problems.
with Ada.Unchecked_Conversion;
with Interfaces.C;
with System.Tasking.Debug;
with System.Interrupt_Management;
with System.OS_Constants;
with System.OS_Primitives;
with System.Task_Info;
with System.Soft_Links;
-- We use System.Soft_Links instead of System.Tasking.Initialization
-- because the later is a higher level package that we shouldn't depend on.
-- For example when using the restricted run time, it is replaced by
-- System.Tasking.Restricted.Stages.
package body System.Task_Primitives.Operations is
package OSC renames System.OS_Constants;
package SSL renames System.Soft_Links;
use System.Tasking.Debug;
use System.Tasking;
use Interfaces.C;
use System.OS_Interface;
use System.Parameters;
use System.OS_Primitives;
----------------
-- Local Data --
----------------
-- The followings are logically constants, but need to be initialized
-- at run time.
Single_RTS_Lock : aliased RTS_Lock;
-- This is a lock to allow only one thread of control in the RTS at
-- a time; it is used to execute in mutual exclusion from all other tasks.
-- Used mainly in Single_Lock mode, but also to protect All_Tasks_List
Environment_Task_Id : Task_Id;
-- A variable to hold Task_Id for the environment task
Locking_Policy : Character;
pragma Import (C, Locking_Policy, "__gl_locking_policy");
-- Value of the pragma Locking_Policy:
-- 'C' for Ceiling_Locking
-- 'I' for Inherit_Locking
-- ' ' for none.
Unblocked_Signal_Mask : aliased sigset_t;
-- The set of signals that should unblocked in all tasks
-- The followings are internal configuration constants needed
Next_Serial_Number : Task_Serial_Number := 100;
-- We start at 100, to reserve some special values for
-- using in error checking.
Time_Slice_Val : Integer;
pragma Import (C, Time_Slice_Val, "__gl_time_slice_val");
Dispatching_Policy : Character;
pragma Import (C, Dispatching_Policy, "__gl_task_dispatching_policy");
Foreign_Task_Elaborated : aliased Boolean := True;
-- Used to identified fake tasks (i.e., non-Ada Threads)
Use_Alternate_Stack : constant Boolean := Alternate_Stack_Size /= 0;
-- Whether to use an alternate signal stack for stack overflows
Abort_Handler_Installed : Boolean := False;
-- True if a handler for the abort signal is installed
--------------------
-- Local Packages --
--------------------
package Specific is
procedure Initialize (Environment_Task : Task_Id);
pragma Inline (Initialize);
-- Initialize various data needed by this package
function Is_Valid_Task return Boolean;
pragma Inline (Is_Valid_Task);
-- Does executing thread have a TCB?
procedure Set (Self_Id : Task_Id);
pragma Inline (Set);
-- Set the self id for the current task
function Self return Task_Id;
pragma Inline (Self);
-- Return a pointer to the Ada Task Control Block of the calling task
end Specific;
package body Specific is separate;
-- The body of this package is target specific
----------------------------------
-- ATCB allocation/deallocation --
----------------------------------
package body ATCB_Allocation is separate;
-- The body of this package is shared across several targets
---------------------------------
-- Support for foreign threads --
---------------------------------
function Register_Foreign_Thread (Thread : Thread_Id) return Task_Id;
-- Allocate and Initialize a new ATCB for the current Thread
function Register_Foreign_Thread
(Thread : Thread_Id) return Task_Id is separate;
-----------------------
-- Local Subprograms --
-----------------------
procedure Abort_Handler (Sig : Signal);
-- Signal handler used to implement asynchronous abort.
-- See also comment before body, below.
function To_Address is
new Ada.Unchecked_Conversion (Task_Id, System.Address);
function GNAT_pthread_condattr_setup
(attr : access pthread_condattr_t) return int;
pragma Import (C,
GNAT_pthread_condattr_setup, "__gnat_pthread_condattr_setup");
procedure Compute_Deadline
(Time : Duration;
Mode : ST.Delay_Modes;
Check_Time : out Duration;
Abs_Time : out Duration;
Rel_Time : out Duration);
-- Helper for Timed_Sleep and Timed_Delay: given a deadline specified by
-- Time and Mode, compute the current clock reading (Check_Time), and the
-- target absolute and relative clock readings (Abs_Time, Rel_Time). The
-- epoch for Time depends on Mode; the epoch for Check_Time and Abs_Time
-- is always that of CLOCK_RT_Ada.
-------------------
-- Abort_Handler --
-------------------
-- Target-dependent binding of inter-thread Abort signal to the raising of
-- the Abort_Signal exception.
-- The technical issues and alternatives here are essentially the
-- same as for raising exceptions in response to other signals
-- (e.g. Storage_Error). See code and comments in the package body
-- System.Interrupt_Management.
-- Some implementations may not allow an exception to be propagated out of
-- a handler, and others might leave the signal or interrupt that invoked
-- this handler masked after the exceptional return to the application
-- code.
-- GNAT exceptions are originally implemented using setjmp()/longjmp(). On
-- most UNIX systems, this will allow transfer out of a signal handler,
-- which is usually the only mechanism available for implementing
-- asynchronous handlers of this kind. However, some systems do not
-- restore the signal mask on longjmp(), leaving the abort signal masked.
procedure Abort_Handler (Sig : Signal) is
pragma Unreferenced (Sig);
T : constant Task_Id := Self;
Old_Set : aliased sigset_t;
Result : Interfaces.C.int;
pragma Warnings (Off, Result);
begin
-- It's not safe to raise an exception when using GCC ZCX mechanism.
-- Note that we still need to install a signal handler, since in some
-- cases (e.g. shutdown of the Server_Task in System.Interrupts) we
-- need to send the Abort signal to a task.
if ZCX_By_Default then
return;
end if;
if T.Deferral_Level = 0
and then T.Pending_ATC_Level < T.ATC_Nesting_Level and then
not T.Aborting
then
T.Aborting := True;
-- Make sure signals used for RTS internal purpose are unmasked
Result := pthread_sigmask (SIG_UNBLOCK,
Unblocked_Signal_Mask'Access, Old_Set'Access);
pragma Assert (Result = 0);
raise Standard'Abort_Signal;
end if;
end Abort_Handler;
----------------------
-- Compute_Deadline --
----------------------
procedure Compute_Deadline
(Time : Duration;
Mode : ST.Delay_Modes;
Check_Time : out Duration;
Abs_Time : out Duration;
Rel_Time : out Duration)
is
begin
Check_Time := Monotonic_Clock;
-- Relative deadline
if Mode = Relative then
Abs_Time := Duration'Min (Time, Max_Sensible_Delay) + Check_Time;
if Relative_Timed_Wait then
Rel_Time := Duration'Min (Max_Sensible_Delay, Time);
end if;
pragma Warnings (Off);
-- Comparison "OSC.CLOCK_RT_Ada = OSC.CLOCK_REALTIME" is compile
-- time known.
-- Absolute deadline specified using the tasking clock (CLOCK_RT_Ada)
elsif Mode = Absolute_RT
or else OSC.CLOCK_RT_Ada = OSC.CLOCK_REALTIME
then
pragma Warnings (On);
Abs_Time := Duration'Min (Check_Time + Max_Sensible_Delay, Time);
if Relative_Timed_Wait then
Rel_Time := Duration'Min (Max_Sensible_Delay, Time - Check_Time);
end if;
-- Absolute deadline specified using the calendar clock, in the
-- case where it is not the same as the tasking clock: compensate for
-- difference between clock epochs (Base_Time - Base_Cal_Time).
else
declare
Cal_Check_Time : constant Duration := OS_Primitives.Clock;
RT_Time : constant Duration :=
Time + Check_Time - Cal_Check_Time;
begin
Abs_Time :=
Duration'Min (Check_Time + Max_Sensible_Delay, RT_Time);
if Relative_Timed_Wait then
Rel_Time :=
Duration'Min (Max_Sensible_Delay, RT_Time - Check_Time);
end if;
end;
end if;
end Compute_Deadline;
-----------------
-- Stack_Guard --
-----------------
procedure Stack_Guard (T : ST.Task_Id; On : Boolean) is
Stack_Base : constant Address := Get_Stack_Base (T.Common.LL.Thread);
Page_Size : Address;
Res : Interfaces.C.int;
begin
if Stack_Base_Available then
-- Compute the guard page address
Page_Size := Address (Get_Page_Size);
Res :=
mprotect
(Stack_Base - (Stack_Base mod Page_Size) + Page_Size,
size_t (Page_Size),
prot => (if On then PROT_ON else PROT_OFF));
pragma Assert (Res = 0);
end if;
end Stack_Guard;
--------------------
-- Get_Thread_Id --
--------------------
function Get_Thread_Id (T : ST.Task_Id) return OSI.Thread_Id is
begin
return T.Common.LL.Thread;
end Get_Thread_Id;
----------
-- Self --
----------
function Self return Task_Id renames Specific.Self;
---------------------
-- Initialize_Lock --
---------------------
-- Note: mutexes and cond_variables needed per-task basis are
-- initialized in Initialize_TCB and the Storage_Error is
-- handled. Other mutexes (such as RTS_Lock, Memory_Lock...)
-- used in RTS is initialized before any status change of RTS.
-- Therefore raising Storage_Error in the following routines
-- should be able to be handled safely.
procedure Initialize_Lock
(Prio : System.Any_Priority;
L : not null access Lock)
is
Attributes : aliased pthread_mutexattr_t;
Result : Interfaces.C.int;
begin
Result := pthread_mutexattr_init (Attributes'Access);
pragma Assert (Result = 0 or else Result = ENOMEM);
if Result = ENOMEM then
raise Storage_Error;
end if;
if Locking_Policy = 'C' then
Result := pthread_mutexattr_setprotocol
(Attributes'Access, PTHREAD_PRIO_PROTECT);
pragma Assert (Result = 0);
Result := pthread_mutexattr_setprioceiling
(Attributes'Access, Interfaces.C.int (Prio));
pragma Assert (Result = 0);
elsif Locking_Policy = 'I' then
Result := pthread_mutexattr_setprotocol
(Attributes'Access, PTHREAD_PRIO_INHERIT);
pragma Assert (Result = 0);
end if;
Result := pthread_mutex_init (L.WO'Access, Attributes'Access);
pragma Assert (Result = 0 or else Result = ENOMEM);
if Result = ENOMEM then
Result := pthread_mutexattr_destroy (Attributes'Access);
raise Storage_Error;
end if;
Result := pthread_mutexattr_destroy (Attributes'Access);
pragma Assert (Result = 0);
end Initialize_Lock;
procedure Initialize_Lock
(L : not null access RTS_Lock; Level : Lock_Level)
is
pragma Unreferenced (Level);
Attributes : aliased pthread_mutexattr_t;
Result : Interfaces.C.int;
begin
Result := pthread_mutexattr_init (Attributes'Access);
pragma Assert (Result = 0 or else Result = ENOMEM);
if Result = ENOMEM then
raise Storage_Error;
end if;
if Locking_Policy = 'C' then
Result := pthread_mutexattr_setprotocol
(Attributes'Access, PTHREAD_PRIO_PROTECT);
pragma Assert (Result = 0);
Result := pthread_mutexattr_setprioceiling
(Attributes'Access, Interfaces.C.int (System.Any_Priority'Last));
pragma Assert (Result = 0);
elsif Locking_Policy = 'I' then
Result := pthread_mutexattr_setprotocol
(Attributes'Access, PTHREAD_PRIO_INHERIT);
pragma Assert (Result = 0);
end if;
Result := pthread_mutex_init (L, Attributes'Access);
pragma Assert (Result = 0 or else Result = ENOMEM);
if Result = ENOMEM then
Result := pthread_mutexattr_destroy (Attributes'Access);
raise Storage_Error;
end if;
Result := pthread_mutexattr_destroy (Attributes'Access);
pragma Assert (Result = 0);
end Initialize_Lock;
-------------------
-- Finalize_Lock --
-------------------
procedure Finalize_Lock (L : not null access Lock) is
Result : Interfaces.C.int;
begin
Result := pthread_mutex_destroy (L.WO'Access);
pragma Assert (Result = 0);
end Finalize_Lock;
procedure Finalize_Lock (L : not null access RTS_Lock) is
Result : Interfaces.C.int;
begin
Result := pthread_mutex_destroy (L);
pragma Assert (Result = 0);
end Finalize_Lock;
----------------
-- Write_Lock --
----------------
procedure Write_Lock
(L : not null access Lock; Ceiling_Violation : out Boolean)
is
Result : Interfaces.C.int;
begin
Result := pthread_mutex_lock (L.WO'Access);
-- Assume that the cause of EINVAL is a priority ceiling violation
Ceiling_Violation := (Result = EINVAL);
pragma Assert (Result = 0 or else Result = EINVAL);
end Write_Lock;
procedure Write_Lock
(L : not null access RTS_Lock;
Global_Lock : Boolean := False)
is
Result : Interfaces.C.int;
begin
if not Single_Lock or else Global_Lock then
Result := pthread_mutex_lock (L);
pragma Assert (Result = 0);
end if;
end Write_Lock;
procedure Write_Lock (T : Task_Id) is
Result : Interfaces.C.int;
begin
if not Single_Lock then
Result := pthread_mutex_lock (T.Common.LL.L'Access);
pragma Assert (Result = 0);
end if;
end Write_Lock;
---------------
-- Read_Lock --
---------------
procedure Read_Lock
(L : not null access Lock; Ceiling_Violation : out Boolean) is
begin
Write_Lock (L, Ceiling_Violation);
end Read_Lock;
------------
-- Unlock --
------------
procedure Unlock (L : not null access Lock) is
Result : Interfaces.C.int;
begin
Result := pthread_mutex_unlock (L.WO'Access);
pragma Assert (Result = 0);
end Unlock;
procedure Unlock
(L : not null access RTS_Lock; Global_Lock : Boolean := False)
is
Result : Interfaces.C.int;
begin
if not Single_Lock or else Global_Lock then
Result := pthread_mutex_unlock (L);
pragma Assert (Result = 0);
end if;
end Unlock;
procedure Unlock (T : Task_Id) is
Result : Interfaces.C.int;
begin
if not Single_Lock then
Result := pthread_mutex_unlock (T.Common.LL.L'Access);
pragma Assert (Result = 0);
end if;
end Unlock;
-----------------
-- Set_Ceiling --
-----------------
-- Dynamic priority ceilings are not supported by the underlying system
procedure Set_Ceiling
(L : not null access Lock;
Prio : System.Any_Priority)
is
pragma Unreferenced (L, Prio);
begin
null;
end Set_Ceiling;
-----------
-- Sleep --
-----------
procedure Sleep
(Self_ID : Task_Id;
Reason : System.Tasking.Task_States)
is
pragma Unreferenced (Reason);
Result : Interfaces.C.int;
begin
Result :=
pthread_cond_wait
(cond => Self_ID.Common.LL.CV'Access,
mutex => (if Single_Lock
then Single_RTS_Lock'Access
else Self_ID.Common.LL.L'Access));
-- EINTR is not considered a failure
pragma Assert (Result = 0 or else Result = EINTR);
end Sleep;
-----------------
-- Timed_Sleep --
-----------------
-- This is for use within the run-time system, so abort is
-- assumed to be already deferred, and the caller should be
-- holding its own ATCB lock.
procedure Timed_Sleep
(Self_ID : Task_Id;
Time : Duration;
Mode : ST.Delay_Modes;
Reason : Task_States;
Timedout : out Boolean;
Yielded : out Boolean)
is
pragma Unreferenced (Reason);
Base_Time : Duration;
Check_Time : Duration;
Abs_Time : Duration;
Rel_Time : Duration;
Request : aliased timespec;
Result : Interfaces.C.int;
begin
Timedout := True;
Yielded := False;
Compute_Deadline
(Time => Time,
Mode => Mode,
Check_Time => Check_Time,
Abs_Time => Abs_Time,
Rel_Time => Rel_Time);
Base_Time := Check_Time;
if Abs_Time > Check_Time then
Request :=
To_Timespec (if Relative_Timed_Wait then Rel_Time else Abs_Time);
loop
exit when Self_ID.Pending_ATC_Level < Self_ID.ATC_Nesting_Level;
Result :=
pthread_cond_timedwait
(cond => Self_ID.Common.LL.CV'Access,
mutex => (if Single_Lock
then Single_RTS_Lock'Access
else Self_ID.Common.LL.L'Access),
abstime => Request'Access);
Check_Time := Monotonic_Clock;
exit when Abs_Time <= Check_Time or else Check_Time < Base_Time;
if Result = 0 or Result = EINTR then
-- Somebody may have called Wakeup for us
Timedout := False;
exit;
end if;
pragma Assert (Result = ETIMEDOUT);
end loop;
end if;
end Timed_Sleep;
-----------------
-- Timed_Delay --
-----------------
-- This is for use in implementing delay statements, so we assume the
-- caller is abort-deferred but is holding no locks.
procedure Timed_Delay
(Self_ID : Task_Id;
Time : Duration;
Mode : ST.Delay_Modes)
is
Base_Time : Duration;
Check_Time : Duration;
Abs_Time : Duration;
Rel_Time : Duration;
Request : aliased timespec;
Result : Interfaces.C.int;
pragma Warnings (Off, Result);
begin
if Single_Lock then
Lock_RTS;
end if;
Write_Lock (Self_ID);
Compute_Deadline
(Time => Time,
Mode => Mode,
Check_Time => Check_Time,
Abs_Time => Abs_Time,
Rel_Time => Rel_Time);
Base_Time := Check_Time;
if Abs_Time > Check_Time then
Request :=
To_Timespec (if Relative_Timed_Wait then Rel_Time else Abs_Time);
Self_ID.Common.State := Delay_Sleep;
loop
exit when Self_ID.Pending_ATC_Level < Self_ID.ATC_Nesting_Level;
Result :=
pthread_cond_timedwait
(cond => Self_ID.Common.LL.CV'Access,
mutex => (if Single_Lock
then Single_RTS_Lock'Access
else Self_ID.Common.LL.L'Access),
abstime => Request'Access);
Check_Time := Monotonic_Clock;
exit when Abs_Time <= Check_Time or else Check_Time < Base_Time;
pragma Assert (Result = 0
or else Result = ETIMEDOUT
or else Result = EINTR);
end loop;
Self_ID.Common.State := Runnable;
end if;
Unlock (Self_ID);
if Single_Lock then
Unlock_RTS;
end if;
Result := sched_yield;
end Timed_Delay;
---------------------
-- Monotonic_Clock --
---------------------
function Monotonic_Clock return Duration is
TS : aliased timespec;
Result : Interfaces.C.int;
begin
Result := clock_gettime
(clock_id => OSC.CLOCK_RT_Ada, tp => TS'Unchecked_Access);
pragma Assert (Result = 0);
return To_Duration (TS);
end Monotonic_Clock;
-------------------
-- RT_Resolution --
-------------------
function RT_Resolution return Duration is
TS : aliased timespec;
Result : Interfaces.C.int;
begin
Result := clock_getres (OSC.CLOCK_REALTIME, TS'Unchecked_Access);
pragma Assert (Result = 0);
return To_Duration (TS);
end RT_Resolution;
------------
-- Wakeup --
------------
procedure Wakeup (T : Task_Id; Reason : System.Tasking.Task_States) is
pragma Unreferenced (Reason);
Result : Interfaces.C.int;
begin
Result := pthread_cond_signal (T.Common.LL.CV'Access);
pragma Assert (Result = 0);
end Wakeup;
-----------
-- Yield --
-----------
procedure Yield (Do_Yield : Boolean := True) is
Result : Interfaces.C.int;
pragma Unreferenced (Result);
begin
if Do_Yield then
Result := sched_yield;
end if;
end Yield;
------------------
-- Set_Priority --
------------------
procedure Set_Priority
(T : Task_Id;
Prio : System.Any_Priority;
Loss_Of_Inheritance : Boolean := False)
is
pragma Unreferenced (Loss_Of_Inheritance);
Result : Interfaces.C.int;
Param : aliased struct_sched_param;
function Get_Policy (Prio : System.Any_Priority) return Character;
pragma Import (C, Get_Policy, "__gnat_get_specific_dispatching");
-- Get priority specific dispatching policy
Priority_Specific_Policy : constant Character := Get_Policy (Prio);
-- Upper case first character of the policy name corresponding to the
-- task as set by a Priority_Specific_Dispatching pragma.
begin
T.Common.Current_Priority := Prio;
Param.sched_priority := To_Target_Priority (Prio);
if Time_Slice_Supported
and then (Dispatching_Policy = 'R'
or else Priority_Specific_Policy = 'R'
or else Time_Slice_Val > 0)
then
Result := pthread_setschedparam
(T.Common.LL.Thread, SCHED_RR, Param'Access);
elsif Dispatching_Policy = 'F'
or else Priority_Specific_Policy = 'F'
or else Time_Slice_Val = 0
then
Result := pthread_setschedparam
(T.Common.LL.Thread, SCHED_FIFO, Param'Access);
else
Result := pthread_setschedparam
(T.Common.LL.Thread, SCHED_OTHER, Param'Access);
end if;
pragma Assert (Result = 0);
end Set_Priority;
------------------
-- Get_Priority --
------------------
function Get_Priority (T : Task_Id) return System.Any_Priority is
begin
return T.Common.Current_Priority;
end Get_Priority;
----------------
-- Enter_Task --
----------------
procedure Enter_Task (Self_ID : Task_Id) is
begin
Self_ID.Common.LL.Thread := pthread_self;
Self_ID.Common.LL.LWP := lwp_self;
Specific.Set (Self_ID);
if Use_Alternate_Stack then
declare
Stack : aliased stack_t;
Result : Interfaces.C.int;
begin
Stack.ss_sp := Self_ID.Common.Task_Alternate_Stack;
Stack.ss_size := Alternate_Stack_Size;
Stack.ss_flags := 0;
Result := sigaltstack (Stack'Access, null);
pragma Assert (Result = 0);
end;
end if;
end Enter_Task;
-------------------
-- Is_Valid_Task --
-------------------
function Is_Valid_Task return Boolean renames Specific.Is_Valid_Task;
-----------------------------
-- Register_Foreign_Thread --
-----------------------------
function Register_Foreign_Thread return Task_Id is
begin
if Is_Valid_Task then
return Self;
else
return Register_Foreign_Thread (pthread_self);
end if;
end Register_Foreign_Thread;
--------------------
-- Initialize_TCB --
--------------------
procedure Initialize_TCB (Self_ID : Task_Id; Succeeded : out Boolean) is
Mutex_Attr : aliased pthread_mutexattr_t;
Result : Interfaces.C.int;
Cond_Attr : aliased pthread_condattr_t;
begin
-- Give the task a unique serial number
Self_ID.Serial_Number := Next_Serial_Number;
Next_Serial_Number := Next_Serial_Number + 1;
pragma Assert (Next_Serial_Number /= 0);
if not Single_Lock then
Result := pthread_mutexattr_init (Mutex_Attr'Access);
pragma Assert (Result = 0 or else Result = ENOMEM);
if Result = 0 then
if Locking_Policy = 'C' then
Result :=
pthread_mutexattr_setprotocol
(Mutex_Attr'Access,
PTHREAD_PRIO_PROTECT);
pragma Assert (Result = 0);
Result :=
pthread_mutexattr_setprioceiling
(Mutex_Attr'Access,
Interfaces.C.int (System.Any_Priority'Last));
pragma Assert (Result = 0);
elsif Locking_Policy = 'I' then
Result :=
pthread_mutexattr_setprotocol
(Mutex_Attr'Access,
PTHREAD_PRIO_INHERIT);
pragma Assert (Result = 0);
end if;
Result :=
pthread_mutex_init
(Self_ID.Common.LL.L'Access,
Mutex_Attr'Access);
pragma Assert (Result = 0 or else Result = ENOMEM);
end if;
if Result /= 0 then
Succeeded := False;
return;
end if;
Result := pthread_mutexattr_destroy (Mutex_Attr'Access);
pragma Assert (Result = 0);
end if;
Result := pthread_condattr_init (Cond_Attr'Access);
pragma Assert (Result = 0 or else Result = ENOMEM);
if Result = 0 then
Result := GNAT_pthread_condattr_setup (Cond_Attr'Access);
pragma Assert (Result = 0);
Result :=
pthread_cond_init
(Self_ID.Common.LL.CV'Access, Cond_Attr'Access);
pragma Assert (Result = 0 or else Result = ENOMEM);
end if;
if Result = 0 then
Succeeded := True;
else
if not Single_Lock then
Result := pthread_mutex_destroy (Self_ID.Common.LL.L'Access);
pragma Assert (Result = 0);
end if;
Succeeded := False;
end if;
Result := pthread_condattr_destroy (Cond_Attr'Access);
pragma Assert (Result = 0);
end Initialize_TCB;
-----------------
-- Create_Task --
-----------------
procedure Create_Task
(T : Task_Id;
Wrapper : System.Address;
Stack_Size : System.Parameters.Size_Type;
Priority : System.Any_Priority;
Succeeded : out Boolean)
is
Attributes : aliased pthread_attr_t;
Adjusted_Stack_Size : Interfaces.C.size_t;
Page_Size : constant Interfaces.C.size_t :=
Interfaces.C.size_t (Get_Page_Size);
Result : Interfaces.C.int;
function Thread_Body_Access is new
Ada.Unchecked_Conversion (System.Address, Thread_Body);
use System.Task_Info;
begin
Adjusted_Stack_Size :=
Interfaces.C.size_t (Stack_Size + Alternate_Stack_Size);
if Stack_Base_Available then
-- If Stack Checking is supported then allocate 2 additional pages:
-- In the worst case, stack is allocated at something like
-- N * Get_Page_Size - epsilon, we need to add the size for 2 pages
-- to be sure the effective stack size is greater than what
-- has been asked.
Adjusted_Stack_Size := Adjusted_Stack_Size + 2 * Page_Size;
end if;
-- Round stack size as this is required by some OSes (Darwin)
Adjusted_Stack_Size := Adjusted_Stack_Size + Page_Size - 1;
Adjusted_Stack_Size :=
Adjusted_Stack_Size - Adjusted_Stack_Size mod Page_Size;
Result := pthread_attr_init (Attributes'Access);
pragma Assert (Result = 0 or else Result = ENOMEM);
if Result /= 0 then
Succeeded := False;
return;
end if;
Result :=
pthread_attr_setdetachstate
(Attributes'Access, PTHREAD_CREATE_DETACHED);
pragma Assert (Result = 0);
Result :=
pthread_attr_setstacksize
(Attributes'Access, Adjusted_Stack_Size);
pragma Assert (Result = 0);
if T.Common.Task_Info /= Default_Scope then
case T.Common.Task_Info is
when System.Task_Info.Process_Scope =>
Result :=
pthread_attr_setscope
(Attributes'Access, PTHREAD_SCOPE_PROCESS);
when System.Task_Info.System_Scope =>
Result :=
pthread_attr_setscope
(Attributes'Access, PTHREAD_SCOPE_SYSTEM);
when System.Task_Info.Default_Scope =>
Result := 0;
end case;
pragma Assert (Result = 0);
end if;
-- Since the initial signal mask of a thread is inherited from the
-- creator, and the Environment task has all its signals masked, we
-- do not need to manipulate caller's signal mask at this point.
-- All tasks in RTS will have All_Tasks_Mask initially.
-- Note: the use of Unrestricted_Access in the following call is needed
-- because otherwise we have an error of getting a access-to-volatile
-- value which points to a non-volatile object. But in this case it is
-- safe to do this, since we know we have no problems with aliasing and
-- Unrestricted_Access bypasses this check.
Result := pthread_create
(T.Common.LL.Thread'Unrestricted_Access,
Attributes'Access,
Thread_Body_Access (Wrapper),
To_Address (T));
pragma Assert (Result = 0 or else Result = EAGAIN);
Succeeded := Result = 0;
Result := pthread_attr_destroy (Attributes'Access);
pragma Assert (Result = 0);
if Succeeded then
Set_Priority (T, Priority);
end if;
end Create_Task;
------------------
-- Finalize_TCB --
------------------
procedure Finalize_TCB (T : Task_Id) is
Result : Interfaces.C.int;
begin
if not Single_Lock then
Result := pthread_mutex_destroy (T.Common.LL.L'Access);
pragma Assert (Result = 0);
end if;
Result := pthread_cond_destroy (T.Common.LL.CV'Access);
pragma Assert (Result = 0);
if T.Known_Tasks_Index /= -1 then
Known_Tasks (T.Known_Tasks_Index) := null;
end if;
ATCB_Allocation.Free_ATCB (T);
end Finalize_TCB;
---------------
-- Exit_Task --
---------------
procedure Exit_Task is
begin
-- Mark this task as unknown, so that if Self is called, it won't
-- return a dangling pointer.
Specific.Set (null);
end Exit_Task;
----------------
-- Abort_Task --
----------------
procedure Abort_Task (T : Task_Id) is
Result : Interfaces.C.int;
begin
if Abort_Handler_Installed then
Result :=
pthread_kill
(T.Common.LL.Thread,
Signal (System.Interrupt_Management.Abort_Task_Interrupt));
pragma Assert (Result = 0);
end if;
end Abort_Task;
----------------
-- Initialize --
----------------
procedure Initialize (S : in out Suspension_Object) is
Mutex_Attr : aliased pthread_mutexattr_t;
Cond_Attr : aliased pthread_condattr_t;
Result : Interfaces.C.int;
begin
-- Initialize internal state (always to False (RM D.10 (6)))
S.State := False;
S.Waiting := False;
-- Initialize internal mutex
Result := pthread_mutexattr_init (Mutex_Attr'Access);
pragma Assert (Result = 0 or else Result = ENOMEM);
if Result = ENOMEM then
raise Storage_Error;
end if;
Result := pthread_mutex_init (S.L'Access, Mutex_Attr'Access);
pragma Assert (Result = 0 or else Result = ENOMEM);
if Result = ENOMEM then
Result := pthread_mutexattr_destroy (Mutex_Attr'Access);
pragma Assert (Result = 0);
raise Storage_Error;
end if;
Result := pthread_mutexattr_destroy (Mutex_Attr'Access);
pragma Assert (Result = 0);
-- Initialize internal condition variable
Result := pthread_condattr_init (Cond_Attr'Access);
pragma Assert (Result = 0 or else Result = ENOMEM);
if Result /= 0 then
Result := pthread_mutex_destroy (S.L'Access);
pragma Assert (Result = 0);
-- Storage_Error is propagated as intended if the allocation of the
-- underlying OS entities fails.
raise Storage_Error;
else
Result := GNAT_pthread_condattr_setup (Cond_Attr'Access);
pragma Assert (Result = 0);
end if;
Result := pthread_cond_init (S.CV'Access, Cond_Attr'Access);
pragma Assert (Result = 0 or else Result = ENOMEM);
if Result /= 0 then
Result := pthread_mutex_destroy (S.L'Access);
pragma Assert (Result = 0);
Result := pthread_condattr_destroy (Cond_Attr'Access);
pragma Assert (Result = 0);
-- Storage_Error is propagated as intended if the allocation of the
-- underlying OS entities fails.
raise Storage_Error;
end if;
Result := pthread_condattr_destroy (Cond_Attr'Access);
pragma Assert (Result = 0);
end Initialize;
--------------
-- Finalize --
--------------
procedure Finalize (S : in out Suspension_Object) is
Result : Interfaces.C.int;
begin
-- Destroy internal mutex
Result := pthread_mutex_destroy (S.L'Access);
pragma Assert (Result = 0);
-- Destroy internal condition variable
Result := pthread_cond_destroy (S.CV'Access);
pragma Assert (Result = 0);
end Finalize;
-------------------
-- Current_State --
-------------------
function Current_State (S : Suspension_Object) return Boolean is
begin
-- We do not want to use lock on this read operation. State is marked
-- as Atomic so that we ensure that the value retrieved is correct.
return S.State;
end Current_State;
---------------
-- Set_False --
---------------
procedure Set_False (S : in out Suspension_Object) is
Result : Interfaces.C.int;
begin
SSL.Abort_Defer.all;
Result := pthread_mutex_lock (S.L'Access);
pragma Assert (Result = 0);
S.State := False;
Result := pthread_mutex_unlock (S.L'Access);
pragma Assert (Result = 0);
SSL.Abort_Undefer.all;
end Set_False;
--------------
-- Set_True --
--------------
procedure Set_True (S : in out Suspension_Object) is
Result : Interfaces.C.int;
begin
SSL.Abort_Defer.all;
Result := pthread_mutex_lock (S.L'Access);
pragma Assert (Result = 0);
-- If there is already a task waiting on this suspension object then
-- we resume it, leaving the state of the suspension object to False,
-- as it is specified in (RM D.10(9)). Otherwise, it just leaves
-- the state to True.
if S.Waiting then
S.Waiting := False;
S.State := False;
Result := pthread_cond_signal (S.CV'Access);
pragma Assert (Result = 0);
else
S.State := True;
end if;
Result := pthread_mutex_unlock (S.L'Access);
pragma Assert (Result = 0);
SSL.Abort_Undefer.all;
end Set_True;
------------------------
-- Suspend_Until_True --
------------------------
procedure Suspend_Until_True (S : in out Suspension_Object) is
Result : Interfaces.C.int;
begin
SSL.Abort_Defer.all;
Result := pthread_mutex_lock (S.L'Access);
pragma Assert (Result = 0);
if S.Waiting then
-- Program_Error must be raised upon calling Suspend_Until_True
-- if another task is already waiting on that suspension object
-- (RM D.10(10)).
Result := pthread_mutex_unlock (S.L'Access);
pragma Assert (Result = 0);
SSL.Abort_Undefer.all;
raise Program_Error;
else
-- Suspend the task if the state is False. Otherwise, the task
-- continues its execution, and the state of the suspension object
-- is set to False (ARM D.10 par. 9).
if S.State then
S.State := False;
else
S.Waiting := True;
loop
-- Loop in case pthread_cond_wait returns earlier than expected
-- (e.g. in case of EINTR caused by a signal).
Result := pthread_cond_wait (S.CV'Access, S.L'Access);
pragma Assert (Result = 0 or else Result = EINTR);
exit when not S.Waiting;
end loop;
end if;
Result := pthread_mutex_unlock (S.L'Access);
pragma Assert (Result = 0);
SSL.Abort_Undefer.all;
end if;
end Suspend_Until_True;
----------------
-- Check_Exit --
----------------
-- Dummy version
function Check_Exit (Self_ID : ST.Task_Id) return Boolean is
pragma Unreferenced (Self_ID);
begin
return True;
end Check_Exit;
--------------------
-- Check_No_Locks --
--------------------
function Check_No_Locks (Self_ID : ST.Task_Id) return Boolean is
pragma Unreferenced (Self_ID);
begin
return True;
end Check_No_Locks;
----------------------
-- Environment_Task --
----------------------
function Environment_Task return Task_Id is
begin
return Environment_Task_Id;
end Environment_Task;
--------------
-- Lock_RTS --
--------------
procedure Lock_RTS is
begin
Write_Lock (Single_RTS_Lock'Access, Global_Lock => True);
end Lock_RTS;
----------------
-- Unlock_RTS --
----------------
procedure Unlock_RTS is
begin
Unlock (Single_RTS_Lock'Access, Global_Lock => True);
end Unlock_RTS;
------------------
-- Suspend_Task --
------------------
function Suspend_Task
(T : ST.Task_Id;
Thread_Self : Thread_Id) return Boolean
is
pragma Unreferenced (T, Thread_Self);
begin
return False;
end Suspend_Task;
-----------------
-- Resume_Task --
-----------------
function Resume_Task
(T : ST.Task_Id;
Thread_Self : Thread_Id) return Boolean
is
pragma Unreferenced (T, Thread_Self);
begin
return False;
end Resume_Task;
--------------------
-- Stop_All_Tasks --
--------------------
procedure Stop_All_Tasks is
begin
null;
end Stop_All_Tasks;
---------------
-- Stop_Task --
---------------
function Stop_Task (T : ST.Task_Id) return Boolean is
pragma Unreferenced (T);
begin
return False;
end Stop_Task;
-------------------
-- Continue_Task --
-------------------
function Continue_Task (T : ST.Task_Id) return Boolean is
pragma Unreferenced (T);
begin
return False;
end Continue_Task;
----------------
-- Initialize --
----------------
procedure Initialize (Environment_Task : Task_Id) is
act : aliased struct_sigaction;
old_act : aliased struct_sigaction;
Tmp_Set : aliased sigset_t;
Result : Interfaces.C.int;
function State
(Int : System.Interrupt_Management.Interrupt_ID) return Character;
pragma Import (C, State, "__gnat_get_interrupt_state");
-- Get interrupt state. Defined in a-init.c
-- The input argument is the interrupt number,
-- and the result is one of the following:
Default : constant Character := 's';
-- 'n' this interrupt not set by any Interrupt_State pragma
-- 'u' Interrupt_State pragma set state to User
-- 'r' Interrupt_State pragma set state to Runtime
-- 's' Interrupt_State pragma set state to System (use "default"
-- system handler)
begin
Environment_Task_Id := Environment_Task;
Interrupt_Management.Initialize;
-- Prepare the set of signals that should unblocked in all tasks
Result := sigemptyset (Unblocked_Signal_Mask'Access);
pragma Assert (Result = 0);
for J in Interrupt_Management.Interrupt_ID loop
if System.Interrupt_Management.Keep_Unmasked (J) then
Result := sigaddset (Unblocked_Signal_Mask'Access, Signal (J));
pragma Assert (Result = 0);
end if;
end loop;
-- Initialize the lock used to synchronize chain of all ATCBs
Initialize_Lock (Single_RTS_Lock'Access, RTS_Lock_Level);
Specific.Initialize (Environment_Task);
if Use_Alternate_Stack then
Environment_Task.Common.Task_Alternate_Stack :=
Alternate_Stack'Address;
end if;
-- Make environment task known here because it doesn't go through
-- Activate_Tasks, which does it for all other tasks.
Known_Tasks (Known_Tasks'First) := Environment_Task;
Environment_Task.Known_Tasks_Index := Known_Tasks'First;
Enter_Task (Environment_Task);
if State
(System.Interrupt_Management.Abort_Task_Interrupt) /= Default
then
act.sa_flags := 0;
act.sa_handler := Abort_Handler'Address;
Result := sigemptyset (Tmp_Set'Access);
pragma Assert (Result = 0);
act.sa_mask := Tmp_Set;
Result :=
sigaction
(Signal (System.Interrupt_Management.Abort_Task_Interrupt),
act'Unchecked_Access,
old_act'Unchecked_Access);
pragma Assert (Result = 0);
Abort_Handler_Installed := True;
end if;
end Initialize;
-----------------------
-- Set_Task_Affinity --
-----------------------
procedure Set_Task_Affinity (T : ST.Task_Id) is
pragma Unreferenced (T);
begin
-- Setting task affinity is not supported by the underlying system
null;
end Set_Task_Affinity;
end System.Task_Primitives.Operations;
| 29.596628 | 79 | 0.583395 |
305a83747f6df86198bcd02ce11d294e2a94aab4 | 3,573 | adb | Ada | middleware/src/command_line/command_line-filesystem-touch.adb | shakram02/Ada_Drivers_Library | a407ca7ddbc2d9756647016c2f8fd8ef24a239ff | [
"BSD-3-Clause"
] | 192 | 2016-06-01T18:32:04.000Z | 2022-03-26T22:52:31.000Z | middleware/src/command_line/command_line-filesystem-touch.adb | shakram02/Ada_Drivers_Library | a407ca7ddbc2d9756647016c2f8fd8ef24a239ff | [
"BSD-3-Clause"
] | 239 | 2016-05-26T20:02:01.000Z | 2022-03-31T09:46:56.000Z | middleware/src/command_line/command_line-filesystem-touch.adb | shakram02/Ada_Drivers_Library | a407ca7ddbc2d9756647016c2f8fd8ef24a239ff | [
"BSD-3-Clause"
] | 142 | 2016-06-05T08:12:20.000Z | 2022-03-24T17:37:17.000Z | ------------------------------------------------------------------------------
-- --
-- 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 File_IO; use File_IO;
package body Command_Line.Filesystem.Touch is
-------------
-- Execute --
-------------
overriding procedure Execute
(This : in out Touch_Cmd;
Args : in out Arguments'Class;
Put : Put_Procedure;
Put_Line : Put_Line_Procedure)
is
pragma Unreferenced (This, Put);
begin
loop
declare
Arg : constant String := Args.Next;
Status : Status_Code;
begin
if Arg'Length = 0 then
return;
end if;
Status := File_IO.Create_File (Arg);
if Status /= OK then
Put_Line ("Cannot create file '" & Arg & "': " &
Status'Img);
end if;
end;
end loop;
end Execute;
----------
-- Help --
----------
overriding
procedure Help (This : in out Touch_Cmd;
Put : Put_Procedure;
Put_Line : Put_Line_Procedure)
is
pragma Unreferenced (Put, This);
begin
Put_Line ("Usage: touch [FILE]...");
Put_Line ("Create empty file(s).");
end Help;
end Command_Line.Filesystem.Touch;
| 44.111111 | 78 | 0.5007 |
d160cf77ed942573e30c5a29724233fc8bb2eda5 | 12,349 | adb | Ada | old/old2.adb | twinbee/lamportsBakery | 19ce67e9e2ea36d34039625997e9131214b37c02 | [
"MIT"
] | null | null | null | old/old2.adb | twinbee/lamportsBakery | 19ce67e9e2ea36d34039625997e9131214b37c02 | [
"MIT"
] | null | null | null | old/old2.adb | twinbee/lamportsBakery | 19ce67e9e2ea36d34039625997e9131214b37c02 | [
"MIT"
] | null | null | null | ----------------------------csc410/prog4/as4.adb----------------------------
-- Author: Matthew Bennett
-- Class: CSC410 Burgess
-- Date: 10-05-04 Modified: 10-17-04
-- Due: 10-12-04
-- Desc: Assignment 4: DJIKSTRA'S STABILIZING ALGORITHM
--
-- a nonproduction implementation of
-- DJIKSTRA's algorithm which describes
-- mutual exclusion, fairness, and deadlock avoidance
-- n processes (TASKS), and is self-correcting
--
-- BRIEF: (please read all of this)
-- n processes form a [directed] virtual ring topology, and
-- use an internal integer counter called flag to determine
-- which may go next. In general, a process may not proceed
-- unless its flag is not equal to its previous neighbor, except for process0
--
-- The algorithm is ASYMMETRIC. Process0 behaves differently than
-- processes [1..n] in several respects. Also, since the
-- asymmetrical behavior is neccessary for the algorithm to
-- continue, some other process MUST assume the behavior of
-- Process0 in case that process is killed or quits.
--
-- The algorithm is self-stabilizing, so it should operate on a
-- "dummy resource" for several iterations (up to 10) eahc time
-- the tasks are reordered. I will try to add this feature to
-- code soon.
-- !! MUTUAL EXCLUSION IS NOT GUARANTEED UNTIL THE TASKS STABILIZE !!
--
-- DJIKSTRA implemented as described in
-- "Algorithms for Mutual Exclusion", M. Raynal
-- MIT PRESS Cambridge, 1986 ISBN: 0-262-18119-3
-- with minor revisions
----------------------------------------------------------------
-- Refactorings 10-05-04: (denoted @FIX@)
-- (1) enumerated types {_PREV_, _SELF_, _NEXT_} instead of {-1, 0 1}
-- (2) message passing / reindezvouz instead of function calls
-- (3) slect instead of case
-- (4) linked list of processes instread of array
-- (5) randomly kill of processes including process #1, check for stabiliz.
-- (6) remove "magic" constants
----------------------------------------------------------------
-- dependencies
-- style note: the reasons to "with in" but not "use" packages are
-- (1) to avoid crowding of the namespace
-- (2) to be explicit where abstract data types and methods come from.
-- for instance, line randomPool : Ada.Numerics.Float_Random.Generator;
-- is more explicit than randomPool : Generator;
WITH ADA.TEXT_IO; USE ADA.TEXT_IO;
WITH ADA.INTEGER_TEXT_IO; USE ADA.INTEGER_TEXT_IO;
WITH ADA.NUMERICS.FLOAT_RANDOM; USE ADA.NUMERICS.FLOAT_RANDOM;
--by request only
WITH ADA.CALENDAR;
-- (provides cast: natural -> time for input into delay)
WITH ADA.STRINGS; USE ADA.STRINGS;
----------------------------------------------------------------
----------------------------------------------------------------
PROCEDURE AS4 IS
--globals are: RandomPool, constants scale_factor, max_tasks, SPACES
randomPool : Ada.Numerics.Float_Random.Generator;
-- yields a random Natural after seed
MAX_TASKS : CONSTANT := 100;
--global constant for mem allocation restriction
SCALE_FACTOR : CONSTANT := 1.0;
--used to increase "spread" of random delays
SPACES : STRING(1..80) := (Others => ' ');
--for convenience in string manipulations
TYPE RX; --outer, receiving task
--this task contains djikstra's algorithm (djikstraTask),
-- and also the rendezvouz entries for interprocess communication
-- which is message passing, using entry calls.
-- its primary job is to listen in case a DjistraTask of some other task
-- tried to communicate with it, using the ENTRIES specified for the SELECT
-- statement.
TYPE RX_PTR IS ACCESS RX;
--for our array, so we do not lose track
---- Begin RX_Task declaration and definition ----
TASK TYPE RX IS --outer task spawns algorithm and then waits for a msg
ENTRY init ( --rendezvouz for initializing each task
i : Integer; --process ID number. may NOT change if processes die
self : RX_Ptr; --pointer so the process can refer to itself
prev : RX_Ptr; --pointer to ring neighbor prev
next : RX_Ptr; --pointer to ring neighbor next
selfFlag : Integer; --flag of self
prevFlag : Integer; --flag of prev, for comparisons
nextFlag : Integer; --flag of next, for comparisons
n : Integer; --total number of tasks
lowID : boolean -- am I the chosen one?
);
ENTRY Receive(
mesgType : Character; -- @FIX@ should be seprate rendezvous-es
id : Integer; -- process id
flag : Integer; -- new flag value
prev : RX_Ptr; -- prev pointer
next : RX_Ptr; -- next pointer
lowId : boolean -- am I the new low?
);
END RX; --end specification
TASK BODY RX IS
-- "local globals" (specific to each task)
procArray : array (0..2) of RX_Ptr;
flagArray : array (0..2) of Integer := (Others => 0);
--flagarray(0) is flag of prev process
--flagarray(1) is flag of curr process
--flagarray(2) is flag of next process
--same holds for procArray
myId : Integer;
recId : Integer;
num_count : Integer;
suicide : Boolean := false;
-- used to determine if the process' death has been requested
lowestId : Boolean;
-- used to determine if special protocol is in order
---- Begin AL_Task declaration and definition ----
TASK TYPE djikstraTask IS
--gee, that was short
END djikstraTask; --interior task, does the algorithm
TASK BODY djikstraTask IS
BEGIN
LOOP
IF (lowestId) THEN
-- Process 0, special protocol --
LOOP
EXIT WHEN flagArray(1) = flagArray(0);
END LOOP; --equivalent to wait loop
--!! IN CRITICAL SECTION PROCESS[0] !!--
Put (myId, (80/myId -8));
Put_line (" in CS");
delay (Standard.Duration( random(randomPool) * SCALE_FACTOR) );
-- note: callbacks, function calls, or code may be placed here
-- in order to use this code in some production environment
-- (in place of the delay)
Put (myId, (80/myId-8));
Put_line(" out CS");
--!! OUT CRITICAL SECTION PROCESS[0] !!--
flagArray(1) := (flagArray(1) + 1) MOD num_count;
procArray(2).Receive('U', myId, flagArray(1), null, null, FALSE);
-- done Process0 protocol --
--=====================================================--
ELSE --IF (NOT lowestID) THEN
-- process[k NOT EQUAL 0] --
LOOP
EXIT WHEN (flagArray(1) /= flagArray(0));
END LOOP;
--!! IN CRITICAL SECTION PROCESS[K] !!--
Put (myId, (80/myId-8));
Put_line (" in CS");
delay (Standard.Duration( random(randomPool) * SCALE_FACTOR) );
-- note: callbacks, function calls, or code may be placed here
-- in order to use this code in some production environment
-- (in place of the delay)
Put (myId, (80/myId-8));
Put_line (" out CS");
--!! OUT CRITICAL SECTION PROCESS[K] !!--
flagArray(1) := flagArray(0);
procArray(2).Receive('U', myId, flagArray(1), null, null, FALSE);
END IF;
END LOOP;
END djikstraTask;
---- End AL_Task declaration and definition ----
TYPE Djik IS ACCESS djikstraTask;
ptr : Djik; --pointer to interior task for algorithm from RX_TASK
BEGIN
-- Entry Point to initalize our id's from the main procedure
ACCEPT
init (
i : IN Integer; --process number of self
self : IN RX_Ptr; --pointer to self
prev : IN RX_Ptr; --pointer to prev in ring
next : IN RX_Ptr; --pointer to next in ring
selfFlag : IN Integer; --self's flag initializer
prevFlag : IN Integer; --flag of prev intial condition
nextFlag : IN Integer; --flag of next initial condition
n : IN Integer; --num tasks
lowID : IN Boolean --am i the chosen one?
)
DO
procArray(1) := self; -- "save my pointer to self"
procArray(0) := prev; -- "save my pointer to prev"
procArray(2) := next; -- "save my pointer to next, I'm in the list!"
flagArray(1) := selfFlag; --initialize my flag
flagArray(0) := prevFlag; --save my copy of prev's flag
flagArray(2) := nextFlag; --save my copy of next's flag
num_count := n; --save number of processes
myId := i; --save self's process number
lowestId := lowId;
END init;
ptr := new djikstraTask; --throw of an djikstra_TASK for each R(eceving X_TASK
-- RX twiddles its thumbs and waits for messages.
-- there should be a delay here, but I cant get the timing to work well
-- without giving me significant lag problems
LOOP
ACCEPT
Receive (
mesgType : Character; --@FIX@ it!
id : Integer;
flag : Integer;
prev : RX_Ptr;
next : RX_Ptr;
lowId: boolean
)
DO
CASE mesgType IS
WHEN 'U' => -- update message
BEGIN
Put (myId, (1+4*myId));
Put (",");
Put (id,0);
Put_line(" Update");
-- As we always receive update messages from the prev neighbour
-- we simply change our local copy of prev's new flag
flagArray(0) := flag;
END;
WHEN 'N' => -- newnode message
BEGIN
Put (myId, (1+4*myId));
Put (",");
Put (id,0);
Put_line (" Neighbour");
IF (prev = null)
THEN -- Someone is updating our next neighbour
procArray( 2) := next;
flagArray( 2) := flag;
ELSE -- Someone is updating our prev neighbour
procArray(0) := prev;
flagArray(0) := flag;
lowestID := lowID;
END IF;
END;
WHEN 'R' => -- remove msg -- this TASK is doomed!!
BEGIN
Put (myId, (1+4*myId));
Put (",");
Put (id,0);
Put_line (" RIP");
procArray(0).Receive('N', myId, flagArray(2),null,procArray(2),FALSE); -- Tell my prev who my next was
-- Also, if dying, we pass true as the lowest id to the next,
-- as it is our next lowest, if we were the lowest already
IF (lowestID)
THEN
procArray(2).Receive('N',myId,flagArray(0), procArray(0), null,TRUE); -- Tell my next who my prev was, and crown it the new low
ELSE
procArray(2).Receive('N',myId,flagArray(0), procArray(0),null,FALSE); -- Tell my next who my prev was
END IF;
suicide := true; -- kill thyself, as requested by a higher power!
END;
WHEN Others => null; --needed for {case/select} default path (do nothing)
END CASE;
END Receive;
EXIT WHEN suicide;
END LOOP;
END RX;
---- End RX_Task declaration and definition ----
PROCEDURE Driver IS --seperate out variables to avoid excess globals
numtasks_user, seed_user : Integer; --user defined at runtime by std. in
ptrArray : array (0..MAX_TASKS) of RX_Ptr; --to keep up with each task spun
specialProtocol : boolean; --temp var used for which djistra protocol to use
BEGIN
put("# random seed: ");
get(seed_user); --to ensure a significantly random series, a seed is needed
-- to generate pseudo-random numbers
Ada.Numerics.Float_Random.Reset(randomPool,seed_user);
--seed the random number pool
--sanity checked on the input
LOOP
put("# tasks[1-50]: ");
get(numTasks_user);
--sanity checked input
EXIT WHEN (numTasks_user > 0 AND numTasks_user <= MAX_TASKS);
END LOOP;
FOR task_counter IN 0 .. (numTasks_user - 1)
LOOP
ptrArray(task_counter) := new RX;
END LOOP; --spin out all our processes
--seperate, bc we'll want pointers to next process at initialization
FOR task_counter IN 0 .. (numTasks_user - 1)
LOOP
IF TASK_COUNTER = 0 THEN specialProtocol := TRUE;
ELSE specialProtocol := FALSE; END IF;
ptrArray(task_counter).init(
task_counter, --this will be the process' id number
ptrArray(task_counter), --this is the process' pointer to itself
ptrArray((task_counter - 1) MOD numTasks_user), --process' pointer to prev
ptrArray((task_counter + 1) MOD numTasks_user), --process' pointer to next
task_counter, -- process' initial flag ( so flag(n)=n )
-- in order to demonstrate stabilization
((task_counter - 1) MOD numTasks_user),
--process' initial prev flag ( so flag(_PREV)=n-1 )
((task_counter + 1) MOD numTasks_user),
--process' initial next flag ( so flag(_NEXT)=n+1 )
numTasks_user, --number of processes, which is constant
specialProtocol --flag for asymmetry in the algorithm
);
END LOOP; --initialize out all our processes
FOR kill_index IN REVERSE 0 .. (numTasks_user - 1)
LOOP
delay (600.0);
Put_Line ("Going to kill random process ... ");
ptrArray(kill_index).Receive('R', 0, 0, null, null, FALSE);
END LOOP; --kill out all our processes
END Driver;
-- main exec for AS4.adb:
BEGIN Driver; END AS4;
| 34.785915 | 137 | 0.649526 |
5ed7a97514af15e4dbd59c5c7730473803de5fad | 16,617 | adb | Ada | Milestone-2/IP/my_ip_hls/solution1/.autopilot/db/my_ip_hls_entry83.sched.adb | CSpyridakis/Reconfigurable-Computing | 345316489786c6470e47c66b0bf4a73d2ac4b0c0 | [
"MIT"
] | null | null | null | Milestone-2/IP/my_ip_hls/solution1/.autopilot/db/my_ip_hls_entry83.sched.adb | CSpyridakis/Reconfigurable-Computing | 345316489786c6470e47c66b0bf4a73d2ac4b0c0 | [
"MIT"
] | null | null | null | Milestone-2/IP/my_ip_hls/solution1/.autopilot/db/my_ip_hls_entry83.sched.adb | CSpyridakis/Reconfigurable-Computing | 345316489786c6470e47c66b0bf4a73d2ac4b0c0 | [
"MIT"
] | 3 | 2020-05-24T19:51:12.000Z | 2020-10-29T15:08:48.000Z | <?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>my_ip_hls_entry83</name>
<ret_bitwidth>0</ret_bitwidth>
<ports class_id="2" tracking_level="0" version="0">
<count>6</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>rule0_V</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></originalName>
<rtlName></rtlName>
<coreName></coreName>
</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>rule1_V</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>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>rule2_V</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>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="_4">
<Value>
<Obj>
<type>1</type>
<id>4</id>
<name>rule0_V_out</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>32</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="_5">
<Value>
<Obj>
<type>1</type>
<id>5</id>
<name>rule1_V_out</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>32</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="_6">
<Value>
<Obj>
<type>1</type>
<id>6</id>
<name>rule2_V_out</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>32</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="_7">
<Value>
<Obj>
<type>0</type>
<id>13</id>
<name>rule0_V_read</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>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>
</item>
<item class_id_reference="9" object_id="_8">
<Value>
<Obj>
<type>0</type>
<id>14</id>
<name>rule1_V_read</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>32</bitwidth>
</Value>
<oprand_edges>
<count>2</count>
<item_version>0</item_version>
<item>27</item>
<item>28</item>
</oprand_edges>
<opcode>read</opcode>
<m_Display>0</m_Display>
</item>
<item class_id_reference="9" object_id="_9">
<Value>
<Obj>
<type>0</type>
<id>15</id>
<name>rule2_V_read</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>32</bitwidth>
</Value>
<oprand_edges>
<count>2</count>
<item_version>0</item_version>
<item>29</item>
<item>30</item>
</oprand_edges>
<opcode>read</opcode>
<m_Display>0</m_Display>
</item>
<item class_id_reference="9" object_id="_10">
<Value>
<Obj>
<type>0</type>
<id>17</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>32</item>
<item>33</item>
<item>34</item>
</oprand_edges>
<opcode>write</opcode>
<m_Display>0</m_Display>
</item>
<item class_id_reference="9" object_id="_11">
<Value>
<Obj>
<type>0</type>
<id>19</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>35</item>
<item>36</item>
<item>37</item>
</oprand_edges>
<opcode>write</opcode>
<m_Display>0</m_Display>
</item>
<item class_id_reference="9" object_id="_12">
<Value>
<Obj>
<type>0</type>
<id>21</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>38</item>
<item>39</item>
<item>40</item>
</oprand_edges>
<opcode>write</opcode>
<m_Display>0</m_Display>
</item>
<item class_id_reference="9" object_id="_13">
<Value>
<Obj>
<type>0</type>
<id>22</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>0</count>
<item_version>0</item_version>
</oprand_edges>
<opcode>ret</opcode>
<m_Display>0</m_Display>
</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="_14">
<Obj>
<type>3</type>
<id>23</id>
<name>my_ip_hls.entry83</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>7</count>
<item_version>0</item_version>
<item>13</item>
<item>14</item>
<item>15</item>
<item>17</item>
<item>19</item>
<item>21</item>
<item>22</item>
</node_objs>
</item>
</blocks>
<edges class_id="14" tracking_level="0" version="0">
<count>9</count>
<item_version>0</item_version>
<item class_id="15" tracking_level="1" version="0" object_id="_15">
<id>26</id>
<edge_type>1</edge_type>
<source_obj>1</source_obj>
<sink_obj>13</sink_obj>
</item>
<item class_id_reference="15" object_id="_16">
<id>28</id>
<edge_type>1</edge_type>
<source_obj>2</source_obj>
<sink_obj>14</sink_obj>
</item>
<item class_id_reference="15" object_id="_17">
<id>30</id>
<edge_type>1</edge_type>
<source_obj>3</source_obj>
<sink_obj>15</sink_obj>
</item>
<item class_id_reference="15" object_id="_18">
<id>33</id>
<edge_type>1</edge_type>
<source_obj>4</source_obj>
<sink_obj>17</sink_obj>
</item>
<item class_id_reference="15" object_id="_19">
<id>34</id>
<edge_type>1</edge_type>
<source_obj>13</source_obj>
<sink_obj>17</sink_obj>
</item>
<item class_id_reference="15" object_id="_20">
<id>36</id>
<edge_type>1</edge_type>
<source_obj>5</source_obj>
<sink_obj>19</sink_obj>
</item>
<item class_id_reference="15" object_id="_21">
<id>37</id>
<edge_type>1</edge_type>
<source_obj>14</source_obj>
<sink_obj>19</sink_obj>
</item>
<item class_id_reference="15" object_id="_22">
<id>39</id>
<edge_type>1</edge_type>
<source_obj>6</source_obj>
<sink_obj>21</sink_obj>
</item>
<item class_id_reference="15" object_id="_23">
<id>40</id>
<edge_type>1</edge_type>
<source_obj>15</source_obj>
<sink_obj>21</sink_obj>
</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="_24">
<mId>1</mId>
<mTag>my_ip_hls.entry83</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>23</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="-1"></res>
<node_label_latency class_id="21" tracking_level="0" version="0">
<count>7</count>
<item_version>0</item_version>
<item class_id="22" tracking_level="0" version="0">
<first>13</first>
<second class_id="23" tracking_level="0" version="0">
<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>
<item>
<first>17</first>
<second>
<first>0</first>
<second>0</second>
</second>
</item>
<item>
<first>19</first>
<second>
<first>0</first>
<second>0</second>
</second>
</item>
<item>
<first>21</first>
<second>
<first>0</first>
<second>0</second>
</second>
</item>
<item>
<first>22</first>
<second>
<first>0</first>
<second>0</second>
</second>
</item>
</node_label_latency>
<bblk_ent_exit class_id="24" tracking_level="0" version="0">
<count>1</count>
<item_version>0</item_version>
<item class_id="25" tracking_level="0" version="0">
<first>23</first>
<second class_id="26" tracking_level="0" version="0">
<first>0</first>
<second>0</second>
</second>
</item>
</bblk_ent_exit>
<regions class_id="27" tracking_level="0" version="0">
<count>0</count>
<item_version>0</item_version>
</regions>
<dp_fu_nodes class_id="28" tracking_level="0" version="0">
<count>0</count>
<item_version>0</item_version>
</dp_fu_nodes>
<dp_fu_nodes_expression class_id="29" 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="30" 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="31" tracking_level="0" version="0">
<count>0</count>
<item_version>0</item_version>
</dp_port_io_nodes>
<port2core class_id="32" 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>
| 26.086342 | 70 | 0.612505 |
5e414959885f4f390f9010a339c6ccd9ef396ece | 1,062 | adb | Ada | examples/test_nop.adb | ytomino/iconv-ada | b1adc342a41887fae20b5bc1f1f3d08a5218a346 | [
"Unlicense"
] | null | null | null | examples/test_nop.adb | ytomino/iconv-ada | b1adc342a41887fae20b5bc1f1f3d08a5218a346 | [
"Unlicense"
] | null | null | null | examples/test_nop.adb | ytomino/iconv-ada | b1adc342a41887fae20b5bc1f1f3d08a5218a346 | [
"Unlicense"
] | null | null | null | -- test for uninitialized objects
with Ada.Streams;
with Ada.Text_IO;
with iconv;
with iconv.Streams;
procedure test_nop is
use type Ada.Streams.Stream_Element_Offset;
begin
declare
C : iconv.Converter;
pragma Unmodified (C);
begin
begin
declare
In_Last : Ada.Streams.Stream_Element_Offset;
Out_Item : Ada.Streams.Stream_Element_Array (0 .. 0);
Out_Last : Ada.Streams.Stream_Element_Offset;
Status : iconv.Substituting_Status_Type;
begin
iconv.Convert (C, (0 .. -1 => <>), In_Last, Out_Item, Out_Last, True, Status);
raise Program_Error; -- Status_Error shold be raised
end;
exception
when iconv.Status_Error => null;
end;
end;
begin
begin
declare
S : aliased iconv.Streams.Inout_Type;
Dummy : access Ada.Streams.Root_Stream_Type'Class;
begin
Dummy := iconv.Streams.Stream (S);
raise Program_Error; -- Status_Error shold be raised
end;
exception
when iconv.Status_Error => null;
end;
end;
-- finish
Ada.Text_IO.Put_Line (Ada.Text_IO.Standard_Error.all, "ok");
end test_nop;
| 24.697674 | 82 | 0.712806 |
3059387cdf31a980b297c1c957115cc305de5958 | 3,410 | adb | Ada | tools-src/gnu/gcc/gcc/ada/a-decima.adb | modern-tomato/tomato | 96f09fab4929c6ddde5c9113f1b2476ad37133c4 | [
"FSFAP"
] | 80 | 2015-01-02T10:14:04.000Z | 2021-06-07T06:29:49.000Z | tools-src/gnu/gcc/gcc/ada/a-decima.adb | modern-tomato/tomato | 96f09fab4929c6ddde5c9113f1b2476ad37133c4 | [
"FSFAP"
] | 9 | 2015-05-14T11:03:12.000Z | 2018-01-04T07:12:58.000Z | tools-src/gnu/gcc/gcc/ada/a-decima.adb | modern-tomato/tomato | 96f09fab4929c6ddde5c9113f1b2476ad37133c4 | [
"FSFAP"
] | 69 | 2015-01-02T10:45:56.000Z | 2021-09-06T07:52:13.000Z | ------------------------------------------------------------------------------
-- --
-- GNAT RUNTIME COMPONENTS --
-- --
-- A D A . D E C I M A L --
-- --
-- B o d y --
-- --
-- $Revision$
-- --
-- Copyright (C) 1992,1993,1994 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. --
-- --
------------------------------------------------------------------------------
package body Ada.Decimal is
------------
-- Divide --
------------
procedure Divide
(Dividend : in Dividend_Type;
Divisor : in Divisor_Type;
Quotient : out Quotient_Type;
Remainder : out Remainder_Type)
is
-- We have a nested procedure that is the actual intrinsic divide.
-- This is required because in the current RM, Divide itself does
-- not have convention Intrinsic.
procedure Divide
(Dividend : in Dividend_Type;
Divisor : in Divisor_Type;
Quotient : out Quotient_Type;
Remainder : out Remainder_Type);
pragma Import (Intrinsic, Divide);
begin
Divide (Dividend, Divisor, Quotient, Remainder);
end Divide;
end Ada.Decimal;
| 52.461538 | 78 | 0.441349 |
5e6de217e320a081d469a4b939d22a55bd3c076b | 867 | adb | Ada | src/day-1/adventofcode-day_1.adb | persan/advent-of-code-2020 | 123f9352b44d75fa445783659e6bcbbcafbc0471 | [
"MIT"
] | null | null | null | src/day-1/adventofcode-day_1.adb | persan/advent-of-code-2020 | 123f9352b44d75fa445783659e6bcbbcafbc0471 | [
"MIT"
] | null | null | null | src/day-1/adventofcode-day_1.adb | persan/advent-of-code-2020 | 123f9352b44d75fa445783659e6bcbbcafbc0471 | [
"MIT"
] | null | null | null | pragma Ada_2012;
package body Adventofcode.Day_1 is
----------
-- Eval --
----------
function Eval (Book : Expenses; To : Currency) return Currency is
begin
for A in Book'Range loop
for B in A + 1 .. Book'Last loop
if Book (A) + Book (B) = To then
return Book (A) * Book (B);
end if;
end loop;
end loop;
return 0;
end Eval;
function Eval3 (Book : Expenses; To : Currency) return Currency is
begin
for A in Book'Range loop
for B in A + 1 .. Book'Last loop
for C in B + 1 .. Book'Last loop
if Book (A) + Book (B) + Book (C) = To then
return Book (A) * Book (B) * Book (C);
end if;
end loop;
end loop;
end loop;
return 0;
end Eval3;
end Adventofcode.Day_1;
| 25.5 | 69 | 0.49481 |
196b7d2bd3edb9a6d0fe8fdaeb7075a4f85f6690 | 1,517 | ads | Ada | source/textio/a-tiflio.ads | ytomino/drake | 4e4bdcd8b8e23a11a29b31d3a8861fdf60090ea2 | [
"MIT"
] | 33 | 2015-04-04T09:19:36.000Z | 2021-11-10T05:33:34.000Z | source/textio/a-tiflio.ads | ytomino/drake | 4e4bdcd8b8e23a11a29b31d3a8861fdf60090ea2 | [
"MIT"
] | 8 | 2017-11-14T13:05:07.000Z | 2018-08-09T15:28:49.000Z | source/textio/a-tiflio.ads | ytomino/drake | 4e4bdcd8b8e23a11a29b31d3a8861fdf60090ea2 | [
"MIT"
] | 9 | 2015-02-03T17:09:53.000Z | 2021-11-12T01:16:05.000Z | pragma License (Unrestricted);
-- separated and auto-loaded by compiler
private generic
type Num is digits <>;
package Ada.Text_IO.Float_IO is
Default_Fore : Field := 2;
Default_Aft : Field := Num'Digits - 1;
Default_Exp : Field := 3;
procedure Get (
File : File_Type; -- Input_File_Type
Item : out Num;
Width : Field := 0);
procedure Get (
Item : out Num;
Width : Field := 0);
procedure Get (
File : not null File_Access;
Item : out Num;
Width : Field := 0); -- alt
procedure Put (
File : File_Type; -- Output_File_Type
Item : Num;
Fore : Field := Default_Fore;
Aft : Field := Default_Aft;
Exp : Field := Default_Exp);
procedure Put (
Item : Num;
Fore : Field := Default_Fore;
Aft : Field := Default_Aft;
Exp : Field := Default_Exp);
procedure Put (
File : not null File_Access;
Item : Num;
Fore : Field := Default_Fore;
Aft : Field := Default_Aft;
Exp : Field := Default_Exp); -- alt
procedure Get (
From : String;
Item : out Num;
Last : out Positive);
procedure Put (
To : out String;
Item : Num;
Aft : Field := Default_Aft;
Exp : Field := Default_Exp);
-- extended
-- This subprogram is used in Complex_IO.
procedure Put (
To : out String;
Last : out Natural;
Item : Num;
Aft : Field := Default_Aft;
Exp : Field := Default_Exp);
end Ada.Text_IO.Float_IO;
| 24.868852 | 45 | 0.574819 |
9a65116149771482e7c8d4a52b458281257ab186 | 916 | ads | Ada | src/gdb/gdb-7.11/gdb/testsuite/gdb.ada/aliased_array/pck.ads | alrooney/unum-sdk | bbccb10b0cd3500feccbbef22e27ea111c3d18eb | [
"Apache-2.0"
] | 31 | 2018-08-01T21:25:24.000Z | 2022-02-14T07:52:34.000Z | src/gdb/gdb-7.11/gdb/testsuite/gdb.ada/aliased_array/pck.ads | alrooney/unum-sdk | bbccb10b0cd3500feccbbef22e27ea111c3d18eb | [
"Apache-2.0"
] | 40 | 2018-12-03T19:48:52.000Z | 2021-03-10T06:34:26.000Z | src/gdb/gdb-7.11/gdb/testsuite/gdb.ada/aliased_array/pck.ads | alrooney/unum-sdk | bbccb10b0cd3500feccbbef22e27ea111c3d18eb | [
"Apache-2.0"
] | 20 | 2018-11-16T21:19:22.000Z | 2021-10-18T23:08:24.000Z | -- Copyright 2012-2016 Free Software Foundation, Inc.
--
-- This program is free software; you can redistribute it and/or modify
-- it under the terms of the GNU General Public License as published by
-- the Free Software Foundation; either version 3 of the License, or
-- (at your option) any later version.
--
-- This program is distributed in the hope that it will be useful,
-- but WITHOUT ANY WARRANTY; without even the implied warranty of
-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-- GNU General Public License for more details.
--
-- You should have received a copy of the GNU General Public License
-- along with this program. If not, see <http://www.gnu.org/licenses/>.
with System;
package Pck is
type Bounded is array (Integer range <>) of Integer;
function New_Bounded (Low, High : Integer) return Bounded;
procedure Do_Nothing (A : System.Address);
end Pck;
| 41.636364 | 73 | 0.735808 |
8b6c3e5e4ef55c1880d120c59f75e497f76eb410 | 2,760 | adb | Ada | src/shared/big_endian/lsc-internal-byteorder64.adb | Componolit/libsparkcrypto | 8531a07b6e9f5eb33eae0fa32759b4cbd3509d95 | [
"OpenSSL",
"Unlicense"
] | 30 | 2018-05-18T09:11:50.000Z | 2021-05-18T16:29:14.000Z | src/shared/big_endian/lsc-internal-byteorder64.adb | Componolit/libsparkcrypto | 8531a07b6e9f5eb33eae0fa32759b4cbd3509d95 | [
"OpenSSL",
"Unlicense"
] | 15 | 2018-12-13T07:53:36.000Z | 2019-09-24T19:43:35.000Z | src/shared/big_endian/lsc-internal-byteorder64.adb | Componolit/libsparkcrypto | 8531a07b6e9f5eb33eae0fa32759b4cbd3509d95 | [
"OpenSSL",
"Unlicense"
] | 3 | 2019-04-04T17:41:29.000Z | 2021-05-07T22:28:46.000Z | -------------------------------------------------------------------------------
-- This file is part of libsparkcrypto.
--
-- Copyright (C) 2010, Alexander Senier
-- Copyright (C) 2010, secunet Security Networks AG
-- All rights reserved.
--
-- Redistribution and use in source and binary forms, with or without
-- modification, are permitted provided that the following conditions are met:
--
-- * Redistributions of source code must retain the above copyright notice,
-- this list of conditions and the following disclaimer.
--
-- * Redistributions in binary form must reproduce the above copyright
-- notice, this list of conditions and the following disclaimer in the
-- documentation and/or other materials provided with the distribution.
--
-- * Neither the name of the nor the names of its contributors may be used
-- to endorse or promote products derived from this software without
-- specific prior written permission.
--
-- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
-- AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-- IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
-- ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS
-- BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
-- CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
-- SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
-- INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
-- CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
-- ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
-- POSSIBILITY OF SUCH DAMAGE.
-------------------------------------------------------------------------------
with LSC.Internal.Byteswap64;
package body LSC.Internal.Byteorder64 is
function Native_To_BE (Item : Types.Word64) return Types.Word64
is
begin
return Item;
end Native_To_BE;
---------------------------------------------------------------------------
function Native_To_LE (Item : Types.Word64) return Types.Word64
is
begin
return Byteswap64.Swap (Item);
end Native_To_LE;
---------------------------------------------------------------------------
function BE_To_Native (Item : Types.Word64) return Types.Word64
is
begin
return Item;
end BE_To_Native;
---------------------------------------------------------------------------
function LE_To_Native (Item : Types.Word64) return Types.Word64
is
begin
return Byteswap64.Swap (Item);
end LE_To_Native;
end LSC.Internal.Byteorder64;
| 39.428571 | 79 | 0.621739 |
8bbc4afb038c7b2bda1662b62fbd7751e1be1d9a | 3,256 | ada | Ada | gcc-gcc-7_3_0-release/gcc/testsuite/ada/acats/tests/c7/c73002a.ada | best08618/asylo | 5a520a9f5c461ede0f32acc284017b737a43898c | [
"Apache-2.0"
] | 7 | 2020-05-02T17:34:05.000Z | 2021-10-17T10:15:18.000Z | gcc-gcc-7_3_0-release/gcc/testsuite/ada/acats/tests/c7/c73002a.ada | best08618/asylo | 5a520a9f5c461ede0f32acc284017b737a43898c | [
"Apache-2.0"
] | null | null | null | gcc-gcc-7_3_0-release/gcc/testsuite/ada/acats/tests/c7/c73002a.ada | best08618/asylo | 5a520a9f5c461ede0f32acc284017b737a43898c | [
"Apache-2.0"
] | 2 | 2020-07-27T00:22:36.000Z | 2021-04-01T09:41:02.000Z | -- C73002A.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 STATEMENTS IN A PACKAGE BODY ARE EXECUTED AFTER THE
-- ELABORATION OF THE DECLARATIONS (IN SPEC AND IN BODY).
-- RM 05/15/81
-- JBG 9/21/83
WITH REPORT;
PROCEDURE C73002A IS
USE REPORT;
BEGIN
TEST( "C73002A" , "CHECK: EXECUTION OF STATEMENTS IN A PACKAGE " &
"BODY FOLLOWS ELABORATION OF THE DECLARATIONS");
DECLARE
PACKAGE P1 IS
A : INTEGER := IDENT_INT(7);
PACKAGE P2 IS
B : INTEGER := IDENT_INT(11);
END P2;
END P1;
PACKAGE BODY P1 IS -- A AA B BB
AA : INTEGER := IDENT_INT(7); -- 7 7 11 (11)
PACKAGE BODY P2 IS
BB : INTEGER := IDENT_INT(11);-- 7 11 11
BEGIN
B := 2*B ; -- 7 7 22 11
BB := 2*BB; -- 7 7 22 22
A := 5*A ; -- 35 7 22 22
AA := 2*AA; -- 35 14 22 22
IF BB /= 22 OR
AA /= 14 OR
A /= 35 OR
B /= 22
THEN
FAILED( "ASSIGNED VALUES INCORRECT - 1" );
END IF;
END P2;
BEGIN
A := A + 20; -- 55 14 22 22
AA := AA + 20; -- 55 34 22 22
IF AA /= 34 OR
A /= 55 OR
P2.B /= 22
THEN
FAILED( "ASSIGNED VALUES INCORRECT - 2" );
END IF;
END P1;
USE P1;
USE P2;
BEGIN
IF A /= 55 OR
B /= 22
THEN
FAILED( "ASSIGNED VALUES INCORRECT - 3" );
END IF;
END;
RESULT;
END C73002A;
| 29.333333 | 79 | 0.475123 |
1947e67768c41b1cc6f6efc29c04f10a2c7fd5a0 | 4,095 | adb | Ada | source/nodes/program-nodes-abort_statements.adb | optikos/oasis | 9f64d46d26d964790d69f9db681c874cfb3bf96d | [
"MIT"
] | null | null | null | source/nodes/program-nodes-abort_statements.adb | optikos/oasis | 9f64d46d26d964790d69f9db681c874cfb3bf96d | [
"MIT"
] | null | null | null | source/nodes/program-nodes-abort_statements.adb | optikos/oasis | 9f64d46d26d964790d69f9db681c874cfb3bf96d | [
"MIT"
] | 2 | 2019-09-14T23:18:50.000Z | 2019-10-02T10:11:40.000Z | -- Copyright (c) 2019 Maxim Reznik <[email protected]>
--
-- SPDX-License-Identifier: MIT
-- License-Filename: LICENSE
-------------------------------------------------------------
package body Program.Nodes.Abort_Statements is
function Create
(Abort_Token : not null Program.Lexical_Elements
.Lexical_Element_Access;
Aborted_Tasks : not null Program.Elements.Expressions
.Expression_Vector_Access;
Semicolon_Token : not null Program.Lexical_Elements
.Lexical_Element_Access)
return Abort_Statement is
begin
return Result : Abort_Statement :=
(Abort_Token => Abort_Token, Aborted_Tasks => Aborted_Tasks,
Semicolon_Token => Semicolon_Token, Enclosing_Element => null)
do
Initialize (Result);
end return;
end Create;
function Create
(Aborted_Tasks : not null Program.Elements.Expressions
.Expression_Vector_Access;
Is_Part_Of_Implicit : Boolean := False;
Is_Part_Of_Inherited : Boolean := False;
Is_Part_Of_Instance : Boolean := False)
return Implicit_Abort_Statement is
begin
return Result : Implicit_Abort_Statement :=
(Aborted_Tasks => Aborted_Tasks,
Is_Part_Of_Implicit => Is_Part_Of_Implicit,
Is_Part_Of_Inherited => Is_Part_Of_Inherited,
Is_Part_Of_Instance => Is_Part_Of_Instance, Enclosing_Element => null)
do
Initialize (Result);
end return;
end Create;
overriding function Aborted_Tasks
(Self : Base_Abort_Statement)
return not null Program.Elements.Expressions.Expression_Vector_Access is
begin
return Self.Aborted_Tasks;
end Aborted_Tasks;
overriding function Abort_Token
(Self : Abort_Statement)
return not null Program.Lexical_Elements.Lexical_Element_Access is
begin
return Self.Abort_Token;
end Abort_Token;
overriding function Semicolon_Token
(Self : Abort_Statement)
return not null Program.Lexical_Elements.Lexical_Element_Access is
begin
return Self.Semicolon_Token;
end Semicolon_Token;
overriding function Is_Part_Of_Implicit
(Self : Implicit_Abort_Statement)
return Boolean is
begin
return Self.Is_Part_Of_Implicit;
end Is_Part_Of_Implicit;
overriding function Is_Part_Of_Inherited
(Self : Implicit_Abort_Statement)
return Boolean is
begin
return Self.Is_Part_Of_Inherited;
end Is_Part_Of_Inherited;
overriding function Is_Part_Of_Instance
(Self : Implicit_Abort_Statement)
return Boolean is
begin
return Self.Is_Part_Of_Instance;
end Is_Part_Of_Instance;
procedure Initialize (Self : aliased in out Base_Abort_Statement'Class) is
begin
for Item in Self.Aborted_Tasks.Each_Element loop
Set_Enclosing_Element (Item.Element, Self'Unchecked_Access);
end loop;
null;
end Initialize;
overriding function Is_Abort_Statement_Element
(Self : Base_Abort_Statement)
return Boolean is
pragma Unreferenced (Self);
begin
return True;
end Is_Abort_Statement_Element;
overriding function Is_Statement_Element
(Self : Base_Abort_Statement)
return Boolean is
pragma Unreferenced (Self);
begin
return True;
end Is_Statement_Element;
overriding procedure Visit
(Self : not null access Base_Abort_Statement;
Visitor : in out Program.Element_Visitors.Element_Visitor'Class) is
begin
Visitor.Abort_Statement (Self);
end Visit;
overriding function To_Abort_Statement_Text
(Self : aliased in out Abort_Statement)
return Program.Elements.Abort_Statements.Abort_Statement_Text_Access is
begin
return Self'Unchecked_Access;
end To_Abort_Statement_Text;
overriding function To_Abort_Statement_Text
(Self : aliased in out Implicit_Abort_Statement)
return Program.Elements.Abort_Statements.Abort_Statement_Text_Access is
pragma Unreferenced (Self);
begin
return null;
end To_Abort_Statement_Text;
end Program.Nodes.Abort_Statements;
| 30.789474 | 79 | 0.715263 |
193f1f033801039997c6d752faa16967e4469d76 | 13,643 | adb | Ada | contrib/zlib/contrib/ada/test.adb | SpiritSeeker/assimp | 1e539a9f1600c8e26661472c8610b29ebca10a5c | [
"BSD-3-Clause"
] | 85 | 2015-02-08T20:36:17.000Z | 2021-11-14T20:38:31.000Z | contrib/zlib/contrib/ada/test.adb | SpiritSeeker/assimp | 1e539a9f1600c8e26661472c8610b29ebca10a5c | [
"BSD-3-Clause"
] | 9 | 2015-01-28T16:33:19.000Z | 2020-04-12T23:03:28.000Z | contrib/zlib/contrib/ada/test.adb | SpiritSeeker/assimp | 1e539a9f1600c8e26661472c8610b29ebca10a5c | [
"BSD-3-Clause"
] | 27 | 2015-01-28T16:33:30.000Z | 2021-08-12T05:04:39.000Z | ----------------------------------------------------------------
-- ZLib for Ada thick binding. --
-- --
-- Copyright (C) 2002-2003 Dmitriy Anisimkov --
-- --
-- Open source license information is in the zlib.ads file. --
----------------------------------------------------------------
-- $Id: test.adb,v 1.17 2003/08/12 12:13:30 vagul Exp $
-- The program has a few aims.
-- 1. Test ZLib.Ada95 thick binding functionality.
-- 2. Show the example of use main functionality of the ZLib.Ada95 binding.
-- 3. Build this program automatically compile all ZLib.Ada95 packages under
-- GNAT Ada95 compiler.
with ZLib.Streams;
with Ada.Streams.Stream_IO;
with Ada.Numerics.Discrete_Random;
with Ada.Text_IO;
with Ada.Calendar;
procedure Test is
use Ada.Streams;
use Stream_IO;
------------------------------------
-- Test configuration parameters --
------------------------------------
File_Size : Count := 100_000;
Continuous : constant Boolean := False;
Header : constant ZLib.Header_Type := ZLib.Default;
-- ZLib.None;
-- ZLib.Auto;
-- ZLib.GZip;
-- Do not use Header other then Default in ZLib versions 1.1.4
-- and older.
Strategy : constant ZLib.Strategy_Type := ZLib.Default_Strategy;
Init_Random : constant := 10;
-- End --
In_File_Name : constant String := "testzlib.in";
-- Name of the input file
Z_File_Name : constant String := "testzlib.zlb";
-- Name of the compressed file.
Out_File_Name : constant String := "testzlib.out";
-- Name of the decompressed file.
File_In : File_Type;
File_Out : File_Type;
File_Back : File_Type;
File_Z : ZLib.Streams.Stream_Type;
Filter : ZLib.Filter_Type;
Time_Stamp : Ada.Calendar.Time;
procedure Generate_File;
-- Generate file of spetsified size with some random data.
-- The random data is repeatable, for the good compression.
procedure Compare_Streams
(Left, Right : in out Root_Stream_Type'Class);
-- The procedure compearing data in 2 streams.
-- It is for compare data before and after compression/decompression.
procedure Compare_Files (Left, Right : String);
-- Compare files. Based on the Compare_Streams.
procedure Copy_Streams
(Source, Target : in out Root_Stream_Type'Class;
Buffer_Size : in Stream_Element_Offset := 1024);
-- Copying data from one stream to another. It is for test stream
-- interface of the library.
procedure Data_In
(Item : out Stream_Element_Array;
Last : out Stream_Element_Offset);
-- this procedure is for generic instantiation of
-- ZLib.Generic_Translate.
-- reading data from the File_In.
procedure Data_Out (Item : in Stream_Element_Array);
-- this procedure is for generic instantiation of
-- ZLib.Generic_Translate.
-- writing data to the File_Out.
procedure Stamp;
-- Store the timestamp to the local variable.
procedure Print_Statistic (Msg : String; Data_Size : ZLib.Count);
-- Print the time statistic with the message.
procedure Translate is new ZLib.Generic_Translate
(Data_In => Data_In,
Data_Out => Data_Out);
-- This procedure is moving data from File_In to File_Out
-- with compression or decompression, depend on initialization of
-- Filter parameter.
-------------------
-- Compare_Files --
-------------------
procedure Compare_Files (Left, Right : String) is
Left_File, Right_File : File_Type;
begin
Open (Left_File, In_File, Left);
Open (Right_File, In_File, Right);
Compare_Streams (Stream (Left_File).all, Stream (Right_File).all);
Close (Left_File);
Close (Right_File);
end Compare_Files;
---------------------
-- Compare_Streams --
---------------------
procedure Compare_Streams
(Left, Right : in out Ada.Streams.Root_Stream_Type'Class)
is
Left_Buffer, Right_Buffer : Stream_Element_Array (0 .. 16#FFF#);
Left_Last, Right_Last : Stream_Element_Offset;
begin
loop
Read (Left, Left_Buffer, Left_Last);
Read (Right, Right_Buffer, Right_Last);
if Left_Last /= Right_Last then
Ada.Text_IO.Put_Line ("Compare error :"
& Stream_Element_Offset'Image (Left_Last)
& " /= "
& Stream_Element_Offset'Image (Right_Last));
raise Constraint_Error;
elsif Left_Buffer (0 .. Left_Last)
/= Right_Buffer (0 .. Right_Last)
then
Ada.Text_IO.Put_Line ("ERROR: IN and OUT files is not equal.");
raise Constraint_Error;
end if;
exit when Left_Last < Left_Buffer'Last;
end loop;
end Compare_Streams;
------------------
-- Copy_Streams --
------------------
procedure Copy_Streams
(Source, Target : in out Ada.Streams.Root_Stream_Type'Class;
Buffer_Size : in Stream_Element_Offset := 1024)
is
Buffer : Stream_Element_Array (1 .. Buffer_Size);
Last : Stream_Element_Offset;
begin
loop
Read (Source, Buffer, Last);
Write (Target, Buffer (1 .. Last));
exit when Last < Buffer'Last;
end loop;
end Copy_Streams;
-------------
-- Data_In --
-------------
procedure Data_In
(Item : out Stream_Element_Array;
Last : out Stream_Element_Offset) is
begin
Read (File_In, Item, Last);
end Data_In;
--------------
-- Data_Out --
--------------
procedure Data_Out (Item : in Stream_Element_Array) is
begin
Write (File_Out, Item);
end Data_Out;
-------------------
-- Generate_File --
-------------------
procedure Generate_File is
subtype Visible_Symbols is Stream_Element range 16#20# .. 16#7E#;
package Random_Elements is
new Ada.Numerics.Discrete_Random (Visible_Symbols);
Gen : Random_Elements.Generator;
Buffer : Stream_Element_Array := (1 .. 77 => 16#20#) & 10;
Buffer_Count : constant Count := File_Size / Buffer'Length;
-- Number of same buffers in the packet.
Density : constant Count := 30; -- from 0 to Buffer'Length - 2;
procedure Fill_Buffer (J, D : in Count);
-- Change the part of the buffer.
-----------------
-- Fill_Buffer --
-----------------
procedure Fill_Buffer (J, D : in Count) is
begin
for K in 0 .. D loop
Buffer
(Stream_Element_Offset ((J + K) mod (Buffer'Length - 1) + 1))
:= Random_Elements.Random (Gen);
end loop;
end Fill_Buffer;
begin
Random_Elements.Reset (Gen, Init_Random);
Create (File_In, Out_File, In_File_Name);
Fill_Buffer (1, Buffer'Length - 2);
for J in 1 .. Buffer_Count loop
Write (File_In, Buffer);
Fill_Buffer (J, Density);
end loop;
-- fill remain size.
Write
(File_In,
Buffer
(1 .. Stream_Element_Offset
(File_Size - Buffer'Length * Buffer_Count)));
Flush (File_In);
Close (File_In);
end Generate_File;
---------------------
-- Print_Statistic --
---------------------
procedure Print_Statistic (Msg : String; Data_Size : ZLib.Count) is
use Ada.Calendar;
use Ada.Text_IO;
package Count_IO is new Integer_IO (ZLib.Count);
Curr_Dur : Duration := Clock - Time_Stamp;
begin
Put (Msg);
Set_Col (20);
Ada.Text_IO.Put ("size =");
Count_IO.Put
(Data_Size,
Width => Stream_IO.Count'Image (File_Size)'Length);
Put_Line (" duration =" & Duration'Image (Curr_Dur));
end Print_Statistic;
-----------
-- Stamp --
-----------
procedure Stamp is
begin
Time_Stamp := Ada.Calendar.Clock;
end Stamp;
begin
Ada.Text_IO.Put_Line ("ZLib " & ZLib.Version);
loop
Generate_File;
for Level in ZLib.Compression_Level'Range loop
Ada.Text_IO.Put_Line ("Level ="
& ZLib.Compression_Level'Image (Level));
-- Test generic interface.
Open (File_In, In_File, In_File_Name);
Create (File_Out, Out_File, Z_File_Name);
Stamp;
-- Deflate using generic instantiation.
ZLib.Deflate_Init
(Filter => Filter,
Level => Level,
Strategy => Strategy,
Header => Header);
Translate (Filter);
Print_Statistic ("Generic compress", ZLib.Total_Out (Filter));
ZLib.Close (Filter);
Close (File_In);
Close (File_Out);
Open (File_In, In_File, Z_File_Name);
Create (File_Out, Out_File, Out_File_Name);
Stamp;
-- Inflate using generic instantiation.
ZLib.Inflate_Init (Filter, Header => Header);
Translate (Filter);
Print_Statistic ("Generic decompress", ZLib.Total_Out (Filter));
ZLib.Close (Filter);
Close (File_In);
Close (File_Out);
Compare_Files (In_File_Name, Out_File_Name);
-- Test stream interface.
-- Compress to the back stream.
Open (File_In, In_File, In_File_Name);
Create (File_Back, Out_File, Z_File_Name);
Stamp;
ZLib.Streams.Create
(Stream => File_Z,
Mode => ZLib.Streams.Out_Stream,
Back => ZLib.Streams.Stream_Access
(Stream (File_Back)),
Back_Compressed => True,
Level => Level,
Strategy => Strategy,
Header => Header);
Copy_Streams
(Source => Stream (File_In).all,
Target => File_Z);
-- Flushing internal buffers to the back stream.
ZLib.Streams.Flush (File_Z, ZLib.Finish);
Print_Statistic ("Write compress",
ZLib.Streams.Write_Total_Out (File_Z));
ZLib.Streams.Close (File_Z);
Close (File_In);
Close (File_Back);
-- Compare reading from original file and from
-- decompression stream.
Open (File_In, In_File, In_File_Name);
Open (File_Back, In_File, Z_File_Name);
ZLib.Streams.Create
(Stream => File_Z,
Mode => ZLib.Streams.In_Stream,
Back => ZLib.Streams.Stream_Access
(Stream (File_Back)),
Back_Compressed => True,
Header => Header);
Stamp;
Compare_Streams (Stream (File_In).all, File_Z);
Print_Statistic ("Read decompress",
ZLib.Streams.Read_Total_Out (File_Z));
ZLib.Streams.Close (File_Z);
Close (File_In);
Close (File_Back);
-- Compress by reading from compression stream.
Open (File_Back, In_File, In_File_Name);
Create (File_Out, Out_File, Z_File_Name);
ZLib.Streams.Create
(Stream => File_Z,
Mode => ZLib.Streams.In_Stream,
Back => ZLib.Streams.Stream_Access
(Stream (File_Back)),
Back_Compressed => False,
Level => Level,
Strategy => Strategy,
Header => Header);
Stamp;
Copy_Streams
(Source => File_Z,
Target => Stream (File_Out).all);
Print_Statistic ("Read compress",
ZLib.Streams.Read_Total_Out (File_Z));
ZLib.Streams.Close (File_Z);
Close (File_Out);
Close (File_Back);
-- Decompress to decompression stream.
Open (File_In, In_File, Z_File_Name);
Create (File_Back, Out_File, Out_File_Name);
ZLib.Streams.Create
(Stream => File_Z,
Mode => ZLib.Streams.Out_Stream,
Back => ZLib.Streams.Stream_Access
(Stream (File_Back)),
Back_Compressed => False,
Header => Header);
Stamp;
Copy_Streams
(Source => Stream (File_In).all,
Target => File_Z);
Print_Statistic ("Write decompress",
ZLib.Streams.Write_Total_Out (File_Z));
ZLib.Streams.Close (File_Z);
Close (File_In);
Close (File_Back);
Compare_Files (In_File_Name, Out_File_Name);
end loop;
Ada.Text_IO.Put_Line (Count'Image (File_Size) & " Ok.");
exit when not Continuous;
File_Size := File_Size + 1;
end loop;
end Test;
| 29.403017 | 78 | 0.527157 |
30db68862bf5969d8e5d4c087b70b6b2131494e0 | 5,420 | ads | Ada | awa/src/awa-components-wikis.ads | stcarrez/ada-awa | 0b153316e3f0462789c5cb255dd60624d73d06f0 | [
"Apache-2.0"
] | 81 | 2015-01-18T23:02:30.000Z | 2022-03-19T17:34:57.000Z | awa/src/awa-components-wikis.ads | jquorning/ada-awa | 1307bbadbbaba34052b3bf1b1707e07c58c98e4c | [
"Apache-2.0"
] | 20 | 2015-12-09T19:26:19.000Z | 2022-03-23T14:32:43.000Z | awa/src/awa-components-wikis.ads | jquorning/ada-awa | 1307bbadbbaba34052b3bf1b1707e07c58c98e4c | [
"Apache-2.0"
] | 16 | 2015-06-29T02:44:06.000Z | 2021-09-23T18:47:50.000Z | -----------------------------------------------------------------------
-- awa-components-wikis -- Wiki rendering component
-- Copyright (C) 2011, 2015, 2016, 2021 Stephane Carrez
-- Written by Stephane Carrez ([email protected])
--
-- Licensed under the Apache License, Version 2.0 (the "License");
-- you may not use this file except in compliance with the License.
-- You may obtain a copy of the License at
--
-- http://www.apache.org/licenses/LICENSE-2.0
--
-- Unless required by applicable law or agreed to in writing, software
-- distributed under the License is distributed on an "AS IS" BASIS,
-- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-- See the License for the specific language governing permissions and
-- limitations under the License.
-----------------------------------------------------------------------
with Ada.Strings.Wide_Wide_Unbounded;
with Util.Beans.Basic;
with Util.Beans.Objects;
with ASF.Contexts.Faces;
with ASF.Components;
with ASF.Components.Html;
with Wiki.Strings;
with Wiki.Render;
with Wiki.Plugins;
with Wiki.Render.Links;
package AWA.Components.Wikis is
use ASF.Contexts.Faces;
-- The wiki format of the wiki text. The valid values are:
-- dotclear, markdown, creole, mediawiki, html
FORMAT_NAME : constant String := "format";
VALUE_NAME : constant String := ASF.Components.VALUE_NAME;
-- The link renderer bean that controls the generation of page and image links.
LINKS_NAME : constant String := "links";
-- The plugin factory bean that must be used for Wiki plugins.
PLUGINS_NAME : constant String := "plugins";
-- Whether the TOC is rendered in the document.
TOC_NAME : constant String := "toc";
-- The output format when rendering the content ("text" or "html", default is "html").
OUTPUT_NAME : constant String := "output";
-- ------------------------------
-- Wiki component
-- ------------------------------
--
-- <awa:wiki value="wiki-text" format="dotclear|google|creole|phpbb" styleClass="class"/>
--
type UIWiki is new ASF.Components.Html.UIHtmlComponent with null record;
type UIWiki_Access is access all UIWiki'Class;
-- Get the wiki format style. The format style is obtained from the <b>format</b>
-- attribute name.
function Get_Wiki_Style (UI : in UIWiki;
Context : in Faces_Context'Class)
return Wiki.Wiki_Syntax;
-- Get the links renderer that must be used to render image and page links.
function Get_Links_Renderer (UI : in UIWiki;
Context : in Faces_Context'Class)
return Wiki.Render.Links.Link_Renderer_Access;
-- Get the plugin factory that must be used by the Wiki parser.
function Get_Plugin_Factory (UI : in UIWiki;
Context : in Faces_Context'Class)
return Wiki.Plugins.Plugin_Factory_Access;
-- Returns true if we must render a text content instead of html.
function Is_Text (UI : in UIWiki;
Context : in Faces_Context'Class) return Boolean;
-- Render the wiki text
overriding
procedure Encode_Begin (UI : in UIWiki;
Context : in out Faces_Context'Class);
use Ada.Strings.Wide_Wide_Unbounded;
IMAGE_PREFIX_ATTR : constant String := "image_prefix";
PAGE_PREFIX_ATTR : constant String := "page_prefix";
type Link_Renderer_Bean is new Util.Beans.Basic.Bean
and Wiki.Render.Links.Link_Renderer with record
Page_Prefix : Unbounded_Wide_Wide_String;
Image_Prefix : Unbounded_Wide_Wide_String;
end record;
-- Make a link adding a prefix unless the link is already absolute.
procedure Make_Link (Renderer : in Link_Renderer_Bean;
Link : in Wiki.Strings.WString;
Prefix : in Unbounded_Wide_Wide_String;
URI : out Unbounded_Wide_Wide_String);
-- Get the value identified by the name.
overriding
function Get_Value (From : in Link_Renderer_Bean;
Name : in String) return Util.Beans.Objects.Object;
-- Set the value identified by the name.
overriding
procedure Set_Value (From : in out Link_Renderer_Bean;
Name : in String;
Value : in Util.Beans.Objects.Object);
-- Get the image link that must be rendered from the wiki image link.
overriding
procedure Make_Image_Link (Renderer : in out Link_Renderer_Bean;
Link : in Wiki.Strings.WString;
URI : out Unbounded_Wide_Wide_String;
Width : in out Natural;
Height : in out Natural);
-- Get the page link that must be rendered from the wiki page link.
overriding
procedure Make_Page_Link (Renderer : in out Link_Renderer_Bean;
Link : in Wiki.Strings.WString;
URI : out Unbounded_Wide_Wide_String;
Exists : out Boolean);
private
function Starts_With (Content : in Unbounded_Wide_Wide_String;
Item : in String) return Boolean;
end AWA.Components.Wikis;
| 39.852941 | 93 | 0.614576 |
d139b70462d46b7e4473b0f1debde9ba1f8d80b1 | 6,742 | adb | Ada | bb-runtimes/arm/stm32/stm32f7x/s-stm32.adb | JCGobbi/Nucleo-STM32F334R8 | 2a0b1b4b2664c92773703ac5e95dcb71979d051c | [
"BSD-3-Clause"
] | null | null | null | bb-runtimes/arm/stm32/stm32f7x/s-stm32.adb | JCGobbi/Nucleo-STM32F334R8 | 2a0b1b4b2664c92773703ac5e95dcb71979d051c | [
"BSD-3-Clause"
] | null | null | null | bb-runtimes/arm/stm32/stm32f7x/s-stm32.adb | JCGobbi/Nucleo-STM32F334R8 | 2a0b1b4b2664c92773703ac5e95dcb71979d051c | [
"BSD-3-Clause"
] | null | null | null | ------------------------------------------------------------------------------
-- --
-- GNAT RUN-TIME COMPONENTS --
-- --
-- Copyright (C) 2012-2016, 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.Unchecked_Conversion;
with System.BB.Parameters;
with Interfaces; use Interfaces;
with Interfaces.STM32; use Interfaces.STM32;
with Interfaces.STM32.RCC; use Interfaces.STM32.RCC;
package body System.STM32 is
package Param renames System.BB.Parameters;
HPRE_Presc_Table : constant array (AHB_Prescaler_Enum) of UInt32 :=
(2, 4, 8, 16, 64, 128, 256, 512);
PPRE_Presc_Table : constant array (APB_Prescaler_Enum) of UInt32 :=
(2, 4, 8, 16);
-------------------
-- System_Clocks --
-------------------
function System_Clocks return RCC_System_Clocks
is
Source : constant SYSCLK_Source :=
SYSCLK_Source'Val (RCC_Periph.CFGR.SWS);
Result : RCC_System_Clocks;
begin
case Source is
-- HSI as source
when SYSCLK_SRC_HSI =>
Result.SYSCLK := Param.HSI_Clock;
-- HSE as source
when SYSCLK_SRC_HSE =>
Result.SYSCLK := Param.HSE_Clock;
-- PLL as source
when SYSCLK_SRC_PLL =>
declare
Pllm : constant UInt32 := UInt32 (RCC_Periph.PLLCFGR.PLLM);
Plln : constant UInt32 := UInt32 (RCC_Periph.PLLCFGR.PLLN);
Pllp : constant UInt32 := UInt32 (RCC_Periph.PLLCFGR.PLLP);
Pllvco : UInt32;
begin
case PLL_Source'Val (RCC_Periph.PLLCFGR.PLLSRC) is
when PLL_SRC_HSE =>
Pllvco := (Param.HSE_Clock / Pllm) * Plln;
when PLL_SRC_HSI =>
Pllvco := (Param.HSI_Clock / Pllm) * Plln;
end case;
Result.SYSCLK := Pllvco / ((Pllp + 1) * 2);
end;
end case;
declare
function To_AHBP is new Ada.Unchecked_Conversion
(CFGR_HPRE_Field, AHB_Prescaler);
function To_APBP is new Ada.Unchecked_Conversion
(CFGR_PPRE_Element, APB_Prescaler);
HPRE : constant AHB_Prescaler := To_AHBP (RCC_Periph.CFGR.HPRE);
HPRE_Div : constant UInt32 := (if HPRE.Enabled
then HPRE_Presc_Table (HPRE.Value)
else 1);
PPRE1 : constant APB_Prescaler :=
To_APBP (RCC_Periph.CFGR.PPRE.Arr (1));
PPRE1_Div : constant UInt32 := (if PPRE1.Enabled
then PPRE_Presc_Table (PPRE1.Value)
else 1);
PPRE2 : constant APB_Prescaler :=
To_APBP (RCC_Periph.CFGR.PPRE.Arr (2));
PPRE2_Div : constant UInt32 := (if PPRE2.Enabled
then PPRE_Presc_Table (PPRE2.Value)
else 1);
begin
Result.HCLK := Result.SYSCLK / HPRE_Div;
Result.PCLK1 := Result.HCLK / PPRE1_Div;
Result.PCLK2 := Result.HCLK / PPRE2_Div;
-- Timer clocks
-- See Dedicated clock cfg register documentation.
if RCC_Periph.DKCFGR1.TIMPRE = 0 then
-- Mode 0:
-- If the APB prescaler (PPRE1, PPRE2 in the RCC_CFGR register)
-- is configured to a division factor of 1, TIMxCLK = PCLKx.
-- Otherwise, the timer clock frequencies are set to twice to the
-- frequency of the APB domain to which the timers are connected :
-- TIMxCLK = 2xPCLKx.
if not PPRE1.Enabled then
Result.TIMCLK1 := Result.PCLK1;
else
Result.TIMCLK1 := Result.PCLK1 * 2;
end if;
if not PPRE2.Enabled then
Result.TIMCLK2 := Result.PCLK2;
else
Result.TIMCLK2 := Result.PCLK2 * 2;
end if;
else
-- Mode 1:
-- If the APB prescaler (PPRE1, PPRE2 in the RCC_CFGR register) is
-- configured to a division factor of 1, 2 or 4, TIMxCLK = HCLK.
-- Otherwise, the timer clock frequencies are set to four times
-- to the frequency of the APB domain to which the timers are
-- connected : TIMxCLK = 4xPCLKx.
if PPRE1_Div in 1 .. 4 then
Result.TIMCLK1 := Result.HCLK;
else
Result.TIMCLK1 := Result.PCLK1 * 4;
end if;
if PPRE2_Div in 1 .. 4 then
Result.TIMCLK2 := Result.HCLK;
else
Result.TIMCLK2 := Result.PCLK1 * 4;
end if;
end if;
end;
return Result;
end System_Clocks;
end System.STM32;
| 41.875776 | 79 | 0.492287 |
d1da6a9a047f5e51b64602a0ba5dedd06e1116b8 | 2,118 | ads | Ada | software/hal/boards/pixhawk/media_reader-sdcard-config.ads | TUM-EI-RCS/StratoX | 5fdd04e01a25efef6052376f43ce85b5bc973392 | [
"BSD-3-Clause"
] | 12 | 2017-06-08T14:19:57.000Z | 2022-03-09T02:48:59.000Z | software/hal/boards/pixhawk/media_reader-sdcard-config.ads | TUM-EI-RCS/StratoX | 5fdd04e01a25efef6052376f43ce85b5bc973392 | [
"BSD-3-Clause"
] | 6 | 2017-06-08T13:13:50.000Z | 2020-05-15T09:32:43.000Z | software/hal/boards/pixhawk/media_reader-sdcard-config.ads | TUM-EI-RCS/StratoX | 5fdd04e01a25efef6052376f43ce85b5bc973392 | [
"BSD-3-Clause"
] | 3 | 2017-06-30T14:05:06.000Z | 2022-02-17T12:20:45.000Z | -- Based on AdaCore's Ada Drivers Library,
-- see https://github.com/AdaCore/Ada_Drivers_Library,
-- checkout 93b5f269341f970698af18f9182fac82a0be66c3.
-- Copyright (C) Adacore
--
-- Institution: Technische Universität München
-- Department: Real-Time Computer Systems (RCS)
-- Project: StratoX
-- Authors: Martin Becker ([email protected])
with Ada.Interrupts.Names;
with STM32.GPIO;
with STM32.DMA; use STM32.DMA;
with STM32.Device; use STM32.Device;
with STM32_SVD.SDIO;
-- @summary
-- setup the on-chip SD controller, clock and irq.
--
-- based on https://raw.githubusercontent.com/AdaCore/Ada_Drivers_Library/
-- master/examples/sdcard/src/stm32f7/device_sd_configuration.ads.
package Media_Reader.SDCard.Config with SPARK_Mode => Off is
SD_Pins : constant STM32.GPIO.GPIO_Points :=
(PC8, PC9, PC10, PC11, PC12, PD2);
-- manual: 8x data, 1xCK, 1x CMD
-- PC8=D0, PC9=D1, PC10=D2, PC11=D3, PC12=CK, PD2=CMD
-- SD_Detect_Pin : constant STM32.GPIO.GPIO_Point :=
-- no card detect pin on pixhawk
-- DMA: DMA2 (Stream 3 or Stream 6) with Channel4
SD_DMA : DMA_Controller renames DMA_2;
SD_DMA_Rx_Channel : constant DMA_Channel_Selector :=
Channel_4;
SD_DMA_Rx_Stream : constant DMA_Stream_Selector :=
Stream_3;
Rx_IRQ : Ada.Interrupts.Interrupt_ID renames
Ada.Interrupts.Names.DMA2_Stream3_Interrupt;
SD_DMA_Tx_Channel : constant DMA_Channel_Selector :=
Channel_4;
SD_DMA_Tx_Stream : constant DMA_Stream_Selector :=
Stream_6;
Tx_IRQ : Ada.Interrupts.Interrupt_ID renames
Ada.Interrupts.Names.DMA2_Stream6_Interrupt;
SD_Interrupt : Ada.Interrupts.Interrupt_ID renames
Ada.Interrupts.Names.SDIO_Interrupt;
SD_Device : STM32_SVD.SDIO.SDIO_Peripheral renames
STM32_SVD.SDIO.SDIO_Periph;
procedure Enable_Clock_Device;
procedure Reset_Device;
end Media_Reader.SDCard.Config;
| 36.517241 | 75 | 0.664306 |
0389a7a5dff1f75382873a025e28f8f8a435fe82 | 6,040 | adb | Ada | source/web/servlet/servlet-request_wrappers.adb | reznikmm/matreshka | 6f4414cb5fc4d6d9ffce3b61347c06ce8d365cee | [
"BSD-3-Clause"
] | 24 | 2016-11-29T06:59:41.000Z | 2021-08-30T11:55:16.000Z | source/web/servlet/servlet-request_wrappers.adb | reznikmm/matreshka | 6f4414cb5fc4d6d9ffce3b61347c06ce8d365cee | [
"BSD-3-Clause"
] | 1 | 2021-03-16T16:09:54.000Z | 2021-08-30T10:37:31.000Z | source/web/servlet/servlet-request_wrappers.adb | reznikmm/matreshka | 6f4414cb5fc4d6d9ffce3b61347c06ce8d365cee | [
"BSD-3-Clause"
] | 4 | 2017-07-18T07:11:05.000Z | 2020-06-21T03:02:25.000Z | ------------------------------------------------------------------------------
-- --
-- Matreshka Project --
-- --
-- Web Framework --
-- --
-- Runtime Library Component --
-- --
------------------------------------------------------------------------------
-- --
-- Copyright © 2014-2020, Vadim Godunko <[email protected]> --
-- All rights reserved. --
-- --
-- Redistribution and use in source and binary forms, with or without --
-- modification, are permitted provided that the following conditions --
-- are met: --
-- --
-- * Redistributions of source code must retain the above copyright --
-- notice, this list of conditions and the following disclaimer. --
-- --
-- * Redistributions in binary form must reproduce the above copyright --
-- notice, this list of conditions and the following disclaimer in the --
-- documentation and/or other materials provided with the distribution. --
-- --
-- * Neither the name of the Vadim Godunko, IE nor the names of its --
-- contributors may be used to endorse or promote products derived from --
-- this software without specific prior written permission. --
-- --
-- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS --
-- "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT --
-- LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR --
-- A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT --
-- HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, --
-- SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED --
-- TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR --
-- PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF --
-- LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING --
-- NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS --
-- SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. --
-- --
------------------------------------------------------------------------------
-- $Revision$ $Date$
------------------------------------------------------------------------------
package body Servlet.Request_Wrappers is
----------------------
-- Get_Content_Type --
----------------------
overriding function Get_Content_Type
(Self : Servlet_Request_Wrapper) return League.Strings.Universal_String is
begin
return Self.Request.Get_Content_Type;
end Get_Content_Type;
----------------------
-- Get_Input_Stream --
----------------------
overriding function Get_Input_Stream
(Self : Servlet_Request_Wrapper)
return not null access Ada.Streams.Root_Stream_Type'Class is
begin
return Self.Request.Get_Input_Stream;
end Get_Input_Stream;
-------------------------
-- Get_Parameter_Names --
-------------------------
overriding function Get_Parameter_Names
(Self : Servlet_Request_Wrapper)
return League.String_Vectors.Universal_String_Vector is
begin
return Self.Request.Get_Parameter_Names;
end Get_Parameter_Names;
--------------------------
-- Get_Parameter_Values --
--------------------------
overriding function Get_Parameter_Values
(Self : Servlet_Request_Wrapper;
Name : League.Strings.Universal_String)
return League.String_Vectors.Universal_String_Vector is
begin
return Self.Request.Get_Parameter_Values (Name);
end Get_Parameter_Values;
----------------
-- Get_Scheme --
----------------
overriding function Get_Scheme
(Self : Servlet_Request_Wrapper) return League.Strings.Universal_String is
begin
return Self.Request.Get_Scheme;
end Get_Scheme;
---------------------
-- Get_Server_Name --
---------------------
overriding function Get_Server_Name
(Self : Servlet_Request_Wrapper) return League.Strings.Universal_String is
begin
return Self.Request.Get_Server_Name;
end Get_Server_Name;
---------------------
-- Get_Server_Port --
---------------------
overriding function Get_Server_Port
(Self : Servlet_Request_Wrapper) return Positive is
begin
return Self.Request.Get_Server_Port;
end Get_Server_Port;
-------------------------
-- Get_Servlet_Context --
-------------------------
overriding function Get_Servlet_Context
(Self : Servlet_Request_Wrapper)
return access Servlet.Contexts.Servlet_Context'Class is
begin
return Self.Request.Get_Servlet_Context;
end Get_Servlet_Context;
------------------------
-- Is_Async_Supported --
------------------------
overriding function Is_Async_Supported
(Self : not null access Servlet_Request_Wrapper) return Boolean is
begin
return Self.Request.Is_Async_Supported;
end Is_Async_Supported;
end Servlet.Request_Wrappers;
| 42.237762 | 78 | 0.491722 |
5ee01db8ecd365fa1b40235e1ab502c49f60fb01 | 1,368 | ads | Ada | src/lzma.ads | stcarrez/ada-lzma | 51dbf4028ff8944ebb8a7f702b5dcad182fbe6bb | [
"MIT"
] | 4 | 2015-08-03T16:26:56.000Z | 2020-05-15T14:46:52.000Z | src/lzma.ads | stcarrez/ada-lzma | 51dbf4028ff8944ebb8a7f702b5dcad182fbe6bb | [
"MIT"
] | null | null | null | src/lzma.ads | stcarrez/ada-lzma | 51dbf4028ff8944ebb8a7f702b5dcad182fbe6bb | [
"MIT"
] | null | null | null | -----------------------------------------------------------------------
-- lzma - LZMA package
-- The MIT License (MIT)
--
-- Copyright (c) 2015 Stephane Carrez
--
-- Permission is hereby granted, free of charge, to any person obtaining a copy
-- of this software and associated documentation files (the "Software"), to deal
-- in the Software without restriction, including without limitation the rights
-- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-- copies of the Software, and to permit persons to whom the Software is
-- furnished to do so, subject to the following conditions:
--
-- The above copyright notice and this permission notice shall be included in all
-- copies or substantial portions of the Software.
--
-- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
-- SOFTWARE.
-----------------------------------------------------------------------
package Lzma is
pragma Pure;
end Lzma;
| 48.857143 | 82 | 0.66886 |
30308ee98f0203346173cd39ba55681d29a8d6b5 | 1,193 | adb | Ada | build/gnat/rts/common/adainclude/memory.adb | Lucretia/bare_bones | 2666092925729aa8b5655211211529b98c5d18bd | [
"CC0-1.0"
] | 70 | 2015-01-03T01:44:38.000Z | 2022-03-20T14:24:24.000Z | build/gnat/rts/common/adainclude/memory.adb | Lucretia/bare_bones | 2666092925729aa8b5655211211529b98c5d18bd | [
"CC0-1.0"
] | null | null | null | build/gnat/rts/common/adainclude/memory.adb | Lucretia/bare_bones | 2666092925729aa8b5655211211529b98c5d18bd | [
"CC0-1.0"
] | 12 | 2015-07-13T04:36:54.000Z | 2020-06-21T02:55:04.000Z | -- -*- Mode: Ada -*-
-- Filename : memory.adb
-- Description : Memory routines.
-- Author : Luke A. Guest
-- Created On : Thur Nov 17 15:07:32 2016
-- Licence : See LICENCE in the root directory.
with Interfaces;
-- with System.Address_To_Access_Conversions;
package body Memory is
type Byte_Array is array (Integer range <>) of aliased Interfaces.Integer_8;
-- package Convert is new System.Address_To_Access_Conversions
-- (Object => Byte_Array);
function Copy (Dest : System.Address;
Source : System.Address;
Size : Integer) return System.Address is
-- S : Convert.Object_Pointer := Convert.To_Pointer (Source);
-- D : Convert.Object_Pointer := Convert.To_Pointer (Dest);
S : Byte_Array (0 .. Size) with
Address => Source;
pragma Import (Convention => C, Entity => S);
D : Byte_Array (0 .. Size) with
Address => Dest;
pragma Import (Convention => C, Entity => D);
begin
for I in S'Range loop
D (I) := S (I);
end loop;
return Dest;
end Copy;
end Memory;
| 30.589744 | 79 | 0.57083 |
Subsets and Splits