content
stringlengths 23
1.05M
|
|---|
with AUnit.Test_Suites;
package Test.Test_Suite is
function Suite return AUnit.Test_Suites.Access_Test_Suite;
end Test.Test_Suite;
|
function Warnsdorff_Get_Tour(Start_X, Start_Y: Index; Scene: Tour := Empty)
return Tour;
-- uses Warnsdorff heurisitic to find a tour faster
-- same interface as Get_Tour
|
-- Numeric Literals
123
123_456
12_34_56
123.456
123_456.789
123.456_789
12_34.567_89
123E12
1.23e5_4
12_3E+5
1.2_3e+5
1_2.3E-5
123.4e-5
1#123#
1_6#123.3#e-12
32#12_3_Ab#E4_5
-- Textual Literals
' '
'A'
'b'
'0'
';'
'"'
'['
'}'
'#'
'='
'+'
'/'
'?'
"Hello"
"Hello world!"
"A single quote ' in a string literal"
"The following is not a comment -- hello world!"
"This is a ""single valid string literal"" in Ada"
"But these are separate" "string literals in Ada"
|
with
openGL.Geometry;
package openGL.Model.terrain
--
-- Models lit, textured terrain.
--
is
type height_Map_view is access all height_Map;
type Item is new Model.item with
record
heights_Asset : asset_Name := null_Asset;
Heights : height_Map_view;
Row, Col : Integer;
color_Map : asset_Name := null_Asset;
Tiling : texture_Transform_2D;
end record;
type View is access all Item'Class;
---------
--- Forge
--
function new_Item (heights_Asset : in asset_Name;
Row, Col : in Integer;
Heights : in height_Map_view;
color_Map : in asset_Name;
Tiling : in texture_Transform_2d := (S => (0.0, 1.0),
T => (0.0, 1.0))) return View;
overriding
procedure destroy (Self : in out Item);
--------------
--- Attributes
--
overriding
function to_GL_Geometries (Self : access Item; Textures : access Texture.name_Map_of_texture'Class;
Fonts : in Font.font_id_Map_of_font) return Geometry.views;
private
overriding
procedure set_Bounds (Self : in out Item);
end openGL.Model.terrain;
|
-- This spec has been automatically generated from STM32L151.svd
pragma Restrictions (No_Elaboration_Code);
pragma Ada_2012;
pragma Style_Checks (Off);
with System;
-- STM32L151
package STM32_SVD is
pragma Preelaborate;
--------------------
-- Base addresses --
--------------------
AES_Base : constant System.Address :=
System'To_Address (16#50060000#);
COMP_Base : constant System.Address :=
System'To_Address (16#40007C00#);
CRC_Base : constant System.Address :=
System'To_Address (16#40023000#);
DAC_Base : constant System.Address :=
System'To_Address (16#40007400#);
DMA1_Base : constant System.Address :=
System'To_Address (16#40026000#);
DMA2_Base : constant System.Address :=
System'To_Address (16#40026400#);
EXTI_Base : constant System.Address :=
System'To_Address (16#40010400#);
Flash_Base : constant System.Address :=
System'To_Address (16#40023C00#);
FSMC_Base : constant System.Address :=
System'To_Address (16#A0000000#);
GPIOA_Base : constant System.Address :=
System'To_Address (16#40020000#);
GPIOB_Base : constant System.Address :=
System'To_Address (16#40020400#);
GPIOC_Base : constant System.Address :=
System'To_Address (16#40020800#);
GPIOD_Base : constant System.Address :=
System'To_Address (16#40020C00#);
GPIOE_Base : constant System.Address :=
System'To_Address (16#40021000#);
GPIOF_Base : constant System.Address :=
System'To_Address (16#40021800#);
GPIOG_Base : constant System.Address :=
System'To_Address (16#40021C00#);
GPIOH_Base : constant System.Address :=
System'To_Address (16#40021400#);
I2C1_Base : constant System.Address :=
System'To_Address (16#40005400#);
I2C2_Base : constant System.Address :=
System'To_Address (16#40005800#);
IWDG_Base : constant System.Address :=
System'To_Address (16#40003000#);
LCD_Base : constant System.Address :=
System'To_Address (16#40002400#);
OPAMP_Base : constant System.Address :=
System'To_Address (16#40007C5C#);
PWR_Base : constant System.Address :=
System'To_Address (16#40007000#);
RCC_Base : constant System.Address :=
System'To_Address (16#40023800#);
RI_Base : constant System.Address :=
System'To_Address (16#40007C04#);
RTC_Base : constant System.Address :=
System'To_Address (16#40002800#);
SDIO_Base : constant System.Address :=
System'To_Address (16#40012C00#);
SPI1_Base : constant System.Address :=
System'To_Address (16#40013000#);
SPI2_Base : constant System.Address :=
System'To_Address (16#40003800#);
SPI3_Base : constant System.Address :=
System'To_Address (16#40003C00#);
SYSCFG_Base : constant System.Address :=
System'To_Address (16#40010000#);
TIM10_Base : constant System.Address :=
System'To_Address (16#40010C00#);
TIM11_Base : constant System.Address :=
System'To_Address (16#40011000#);
TIM2_Base : constant System.Address :=
System'To_Address (16#40000000#);
TIM3_Base : constant System.Address :=
System'To_Address (16#40000400#);
TIM4_Base : constant System.Address :=
System'To_Address (16#40000800#);
TIM5_Base : constant System.Address :=
System'To_Address (16#40000C00#);
TIM6_Base : constant System.Address :=
System'To_Address (16#40001000#);
TIM7_Base : constant System.Address :=
System'To_Address (16#40001400#);
TIM9_Base : constant System.Address :=
System'To_Address (16#40010800#);
USART1_Base : constant System.Address :=
System'To_Address (16#40013800#);
USART2_Base : constant System.Address :=
System'To_Address (16#40004400#);
USART3_Base : constant System.Address :=
System'To_Address (16#40004800#);
UART4_Base : constant System.Address :=
System'To_Address (16#40004C00#);
UART5_Base : constant System.Address :=
System'To_Address (16#40005000#);
USB_Base : constant System.Address :=
System'To_Address (16#40005C00#);
USB_SRAM_Base : constant System.Address :=
System'To_Address (16#40006000#);
WWDG_Base : constant System.Address :=
System'To_Address (16#40002C00#);
ADC_Base : constant System.Address :=
System'To_Address (16#40012400#);
NVIC_Base : constant System.Address :=
System'To_Address (16#E000E100#);
DBGMCU_Base : constant System.Address :=
System'To_Address (16#E0042000#);
MPU_Base : constant System.Address :=
System'To_Address (16#E000ED90#);
SCB_ACTRL_Base : constant System.Address :=
System'To_Address (16#E000E008#);
NVIC_STIR_Base : constant System.Address :=
System'To_Address (16#E000EF00#);
SCB_Base : constant System.Address :=
System'To_Address (16#E000ED00#);
STK_Base : constant System.Address :=
System'To_Address (16#E000E010#);
end STM32_SVD;
|
with Ada.Text_IO;
procedure HelloWorld is
begin
Ada.Text_IO.Put_Line("Hello, World!");
end HelloWorld;
|
-- Generated by Snowball 2.2.0 - https://snowballstem.org/
package body Stemmer.Turkish is
pragma Style_Checks ("-mr");
pragma Warnings (Off, "*variable*is never read and never assigned*");
pragma Warnings (Off, "*mode could be*instead of*");
pragma Warnings (Off, "*formal parameter.*is not modified*");
pragma Warnings (Off, "*this line is too long*");
pragma Warnings (Off, "*is not referenced*");
procedure R_Stem_suffix_chain_before_ki (Z : in out Context_Type; Result : out Boolean);
procedure R_Stem_noun_suffixes (Z : in out Context_Type; Result : out Boolean);
procedure R_Stem_nominal_verb_suffixes (Z : in out Context_Type; Result : out Boolean);
procedure R_Postlude (Z : in out Context_Type; Result : out Boolean);
procedure R_Post_process_last_consonants (Z : in out Context_Type; Result : out Boolean);
procedure R_More_than_one_syllable_word (Z : in out Context_Type; Result : out Boolean);
procedure R_Mark_suffix_with_optional_s_consonant (Z : in out Context_Type; Result : out Boolean);
procedure R_Mark_suffix_with_optional_n_consonant (Z : in out Context_Type; Result : out Boolean);
procedure R_Mark_suffix_with_optional_U_vowel (Z : in out Context_Type; Result : out Boolean);
procedure R_Mark_suffix_with_optional_y_consonant (Z : in out Context_Type; Result : out Boolean);
procedure R_Mark_ysA (Z : in out Context_Type; Result : out Boolean);
procedure R_Mark_ymUs_E (Z : in out Context_Type; Result : out Boolean);
procedure R_Mark_yken (Z : in out Context_Type; Result : out Boolean);
procedure R_Mark_yDU (Z : in out Context_Type; Result : out Boolean);
procedure R_Mark_yUz (Z : in out Context_Type; Result : out Boolean);
procedure R_Mark_yUm (Z : in out Context_Type; Result : out Boolean);
procedure R_Mark_yU (Z : in out Context_Type; Result : out Boolean);
procedure R_Mark_ylA (Z : in out Context_Type; Result : out Boolean);
procedure R_Mark_yA (Z : in out Context_Type; Result : out Boolean);
procedure R_Mark_possessives (Z : in out Context_Type; Result : out Boolean);
procedure R_Mark_sUnUz (Z : in out Context_Type; Result : out Boolean);
procedure R_Mark_sUn (Z : in out Context_Type; Result : out Boolean);
procedure R_Mark_sU (Z : in out Context_Type; Result : out Boolean);
procedure R_Mark_nUz (Z : in out Context_Type; Result : out Boolean);
procedure R_Mark_nUn (Z : in out Context_Type; Result : out Boolean);
procedure R_Mark_nU (Z : in out Context_Type; Result : out Boolean);
procedure R_Mark_ndAn (Z : in out Context_Type; Result : out Boolean);
procedure R_Mark_ndA (Z : in out Context_Type; Result : out Boolean);
procedure R_Mark_ncA (Z : in out Context_Type; Result : out Boolean);
procedure R_Mark_nA (Z : in out Context_Type; Result : out Boolean);
procedure R_Mark_lArI (Z : in out Context_Type; Result : out Boolean);
procedure R_Mark_lAr (Z : in out Context_Type; Result : out Boolean);
procedure R_Mark_ki (Z : in out Context_Type; Result : out Boolean);
procedure R_Mark_DUr (Z : in out Context_Type; Result : out Boolean);
procedure R_Mark_DAn (Z : in out Context_Type; Result : out Boolean);
procedure R_Mark_DA (Z : in out Context_Type; Result : out Boolean);
procedure R_Mark_cAsInA (Z : in out Context_Type; Result : out Boolean);
procedure R_Is_reserved_word (Z : in out Context_Type; Result : out Boolean);
procedure R_Check_vowel_harmony (Z : in out Context_Type; Result : out Boolean);
procedure R_Append_U_to_stems_ending_with_d_or_g (Z : in out Context_Type; Result : out Boolean);
G_Vowel : constant Grouping_Array (0 .. 215) := (
True, False, False, False, True, False, False, False,
True, False, False, False, False, False, True, False,
False, False, False, False, True, False, False, False,
False, False, False, False, False, False, False, False,
False, False, False, False, False, False, False, False,
False, False, False, False, False, False, False, False,
False, False, False, False, False, False, False, False,
False, False, False, False, False, False, False, False,
False, False, False, False, False, False, False, False,
False, False, False, False, False, False, False, False,
False, False, False, False, False, False, False, False,
False, False, False, False, False, False, False, False,
False, False, False, False, False, False, False, False,
False, False, False, False, False, False, False, False,
False, False, False, False, False, False, False, False,
False, False, False, False, False, False, False, False,
False, False, False, False, False, False, False, False,
False, False, False, False, False, False, False, False,
False, False, False, False, False, True, False, False,
False, False, False, True, False, False, False, False,
False, False, False, False, False, False, False, False,
False, False, False, False, False, False, False, False,
False, False, False, False, False, False, False, False,
False, False, False, False, False, False, False, False,
False, False, False, False, False, False, False, False,
False, False, False, False, False, False, False, False,
True, False, False, False, False, False, False, False
);
G_U : constant Grouping_Array (0 .. 207) := (
True, False, False, False, False, False, False, False,
False, False, False, False, True, False, False, False,
False, False, False, False, False, False, False, False,
False, False, False, False, False, False, False, False,
False, False, False, False, False, False, False, False,
False, False, False, False, False, False, False, False,
False, False, False, False, False, False, False, False,
False, False, False, False, False, False, False, False,
False, False, False, False, False, False, False, False,
False, False, False, False, False, False, False, False,
False, False, False, False, False, False, False, False,
False, False, False, False, False, False, False, False,
False, False, False, False, False, False, False, False,
False, False, False, False, False, False, False, False,
False, False, False, False, False, False, False, False,
False, False, False, False, False, False, False, False,
False, False, False, False, False, False, False, False,
False, False, False, False, False, False, False, False,
False, False, False, True, False, False, False, False,
False, False, False, False, False, False, False, False,
False, False, False, False, False, False, False, False,
False, False, False, False, False, False, False, False,
False, False, False, False, False, False, False, False,
False, False, False, False, False, False, False, False,
False, False, False, False, False, False, False, False,
True, False, False, False, False, False, False, False
);
G_Vowel1 : constant Grouping_Array (0 .. 215) := (
True, False, False, False, False, False, False, False,
False, False, False, False, False, False, True, False,
False, False, False, False, True, False, False, False,
False, False, False, False, False, False, False, False,
False, False, False, False, False, False, False, False,
False, False, False, False, False, False, False, False,
False, False, False, False, False, False, False, False,
False, False, False, False, False, False, False, False,
False, False, False, False, False, False, False, False,
False, False, False, False, False, False, False, False,
False, False, False, False, False, False, False, False,
False, False, False, False, False, False, False, False,
False, False, False, False, False, False, False, False,
False, False, False, False, False, False, False, False,
False, False, False, False, False, False, False, False,
False, False, False, False, False, False, False, False,
False, False, False, False, False, False, False, False,
False, False, False, False, False, False, False, False,
False, False, False, False, False, False, False, False,
False, False, False, False, False, False, False, False,
False, False, False, False, False, False, False, False,
False, False, False, False, False, False, False, False,
False, False, False, False, False, False, False, False,
False, False, False, False, False, False, False, False,
False, False, False, False, False, False, False, False,
False, False, False, False, False, False, False, False,
True, False, False, False, False, False, False, False
);
G_Vowel2 : constant Grouping_Array (0 .. 151) := (
True, False, False, False, True, False, False, False,
False, False, False, False, False, False, False, False,
False, False, False, False, False, False, False, False,
False, False, False, False, False, False, False, False,
False, False, False, False, False, False, False, False,
False, False, False, False, False, False, False, False,
False, False, False, False, False, False, False, False,
False, False, False, False, False, False, False, False,
False, False, False, False, False, False, False, False,
False, False, False, False, False, False, False, False,
False, False, False, False, False, False, False, False,
False, False, False, False, False, False, False, False,
False, False, False, False, False, False, False, False,
False, False, False, False, False, False, False, False,
False, False, False, False, False, False, False, False,
False, False, False, False, False, False, False, False,
False, False, False, False, False, False, False, False,
False, False, False, False, False, False, False, False,
False, True, False, False, False, False, False, True
);
G_Vowel3 : constant Grouping_Array (0 .. 215) := (
True, False, False, False, False, False, False, False,
False, False, False, False, False, False, False, False,
False, False, False, False, False, False, False, False,
False, False, False, False, False, False, False, False,
False, False, False, False, False, False, False, False,
False, False, False, False, False, False, False, False,
False, False, False, False, False, False, False, False,
False, False, False, False, False, False, False, False,
False, False, False, False, False, False, False, False,
False, False, False, False, False, False, False, False,
False, False, False, False, False, False, False, False,
False, False, False, False, False, False, False, False,
False, False, False, False, False, False, False, False,
False, False, False, False, False, False, False, False,
False, False, False, False, False, False, False, False,
False, False, False, False, False, False, False, False,
False, False, False, False, False, False, False, False,
False, False, False, False, False, False, False, False,
False, False, False, False, False, False, False, False,
False, False, False, False, False, False, False, False,
False, False, False, False, False, False, False, False,
False, False, False, False, False, False, False, False,
False, False, False, False, False, False, False, False,
False, False, False, False, False, False, False, False,
False, False, False, False, False, False, False, False,
False, False, False, False, False, False, False, False,
True, False, False, False, False, False, False, False
);
G_Vowel4 : constant Grouping_Array (0 .. 7) := (
True, False, False, False, True, False, False, False
);
G_Vowel5 : constant Grouping_Array (0 .. 7) := (
True, False, False, False, False, False, True, False
);
G_Vowel6 : constant Grouping_Array (0 .. 7) := (
True, False, False, False, False, False, True, False
);
Among_String : constant String := "m" & "n" & "miz" & "niz" & "muz"
& "nuz" & "mız" & "nız" & "müz" & "nüz" & "leri" & "ları" & "ni" & "nu"
& "nı" & "nü" & "in" & "un" & "ın" & "ün" & "a" & "e" & "na" & "ne" & "da"
& "ta" & "de" & "te" & "nda" & "nde" & "dan" & "tan" & "den" & "ten" & "ndan"
& "nden" & "la" & "le" & "ca" & "ce" & "im" & "um" & "ım" & "üm" & "sin"
& "sun" & "sın" & "sün" & "iz" & "uz" & "ız" & "üz" & "siniz" & "sunuz"
& "sınız" & "sünüz" & "lar" & "ler" & "niz" & "nuz" & "nız" & "nüz" & "dir"
& "tir" & "dur" & "tur" & "dır" & "tır" & "dür" & "tür" & "casına"
& "cesine" & "di" & "ti" & "dik" & "tik" & "duk" & "tuk" & "dık" & "tık"
& "dük" & "tük" & "dim" & "tim" & "dum" & "tum" & "dım" & "tım" & "düm"
& "tüm" & "din" & "tin" & "dun" & "tun" & "dın" & "tın" & "dün" & "tün"
& "du" & "tu" & "dı" & "tı" & "dü" & "tü" & "sa" & "se" & "sak" & "sek"
& "sam" & "sem" & "san" & "sen" & "miş" & "muş" & "mış" & "müş" & "b" & "c"
& "d" & "ğ";
A_0 : constant Among_Array_Type (0 .. 9) := (
(1, 1, -1, -1, 0),
(2, 2, -1, -1, 0),
(3, 5, -1, -1, 0),
(6, 8, -1, -1, 0),
(9, 11, -1, -1, 0),
(12, 14, -1, -1, 0),
(15, 18, -1, -1, 0),
(19, 22, -1, -1, 0),
(23, 26, -1, -1, 0),
(27, 30, -1, -1, 0));
A_1 : constant Among_Array_Type (0 .. 1) := (
(31, 34, -1, -1, 0),
(35, 39, -1, -1, 0));
A_2 : constant Among_Array_Type (0 .. 3) := (
(40, 41, -1, -1, 0),
(42, 43, -1, -1, 0),
(44, 46, -1, -1, 0),
(47, 49, -1, -1, 0));
A_3 : constant Among_Array_Type (0 .. 3) := (
(50, 51, -1, -1, 0),
(52, 53, -1, -1, 0),
(54, 56, -1, -1, 0),
(57, 59, -1, -1, 0));
A_4 : constant Among_Array_Type (0 .. 1) := (
(60, 60, -1, -1, 0),
(61, 61, -1, -1, 0));
A_5 : constant Among_Array_Type (0 .. 1) := (
(62, 63, -1, -1, 0),
(64, 65, -1, -1, 0));
A_6 : constant Among_Array_Type (0 .. 3) := (
(66, 67, -1, -1, 0),
(68, 69, -1, -1, 0),
(70, 71, -1, -1, 0),
(72, 73, -1, -1, 0));
A_7 : constant Among_Array_Type (0 .. 1) := (
(74, 76, -1, -1, 0),
(77, 79, -1, -1, 0));
A_8 : constant Among_Array_Type (0 .. 3) := (
(80, 82, -1, -1, 0),
(83, 85, -1, -1, 0),
(86, 88, -1, -1, 0),
(89, 91, -1, -1, 0));
A_9 : constant Among_Array_Type (0 .. 1) := (
(92, 95, -1, -1, 0),
(96, 99, -1, -1, 0));
A_10 : constant Among_Array_Type (0 .. 1) := (
(100, 101, -1, -1, 0),
(102, 103, -1, -1, 0));
A_11 : constant Among_Array_Type (0 .. 1) := (
(104, 105, -1, -1, 0),
(106, 107, -1, -1, 0));
A_12 : constant Among_Array_Type (0 .. 3) := (
(108, 109, -1, -1, 0),
(110, 111, -1, -1, 0),
(112, 114, -1, -1, 0),
(115, 117, -1, -1, 0));
A_13 : constant Among_Array_Type (0 .. 3) := (
(118, 120, -1, -1, 0),
(121, 123, -1, -1, 0),
(124, 127, -1, -1, 0),
(128, 131, -1, -1, 0));
A_14 : constant Among_Array_Type (0 .. 3) := (
(132, 133, -1, -1, 0),
(134, 135, -1, -1, 0),
(136, 138, -1, -1, 0),
(139, 141, -1, -1, 0));
A_15 : constant Among_Array_Type (0 .. 3) := (
(142, 146, -1, -1, 0),
(147, 151, -1, -1, 0),
(152, 158, -1, -1, 0),
(159, 165, -1, -1, 0));
A_16 : constant Among_Array_Type (0 .. 1) := (
(166, 168, -1, -1, 0),
(169, 171, -1, -1, 0));
A_17 : constant Among_Array_Type (0 .. 3) := (
(172, 174, -1, -1, 0),
(175, 177, -1, -1, 0),
(178, 181, -1, -1, 0),
(182, 185, -1, -1, 0));
A_18 : constant Among_Array_Type (0 .. 7) := (
(186, 188, -1, -1, 0),
(189, 191, -1, -1, 0),
(192, 194, -1, -1, 0),
(195, 197, -1, -1, 0),
(198, 201, -1, -1, 0),
(202, 205, -1, -1, 0),
(206, 209, -1, -1, 0),
(210, 213, -1, -1, 0));
A_19 : constant Among_Array_Type (0 .. 1) := (
(214, 220, -1, -1, 0),
(221, 226, -1, -1, 0));
A_20 : constant Among_Array_Type (0 .. 31) := (
(227, 228, -1, -1, 0),
(229, 230, -1, -1, 0),
(231, 233, -1, -1, 0),
(234, 236, -1, -1, 0),
(237, 239, -1, -1, 0),
(240, 242, -1, -1, 0),
(243, 246, -1, -1, 0),
(247, 250, -1, -1, 0),
(251, 254, -1, -1, 0),
(255, 258, -1, -1, 0),
(259, 261, -1, -1, 0),
(262, 264, -1, -1, 0),
(265, 267, -1, -1, 0),
(268, 270, -1, -1, 0),
(271, 274, -1, -1, 0),
(275, 278, -1, -1, 0),
(279, 282, -1, -1, 0),
(283, 286, -1, -1, 0),
(287, 289, -1, -1, 0),
(290, 292, -1, -1, 0),
(293, 295, -1, -1, 0),
(296, 298, -1, -1, 0),
(299, 302, -1, -1, 0),
(303, 306, -1, -1, 0),
(307, 310, -1, -1, 0),
(311, 314, -1, -1, 0),
(315, 316, -1, -1, 0),
(317, 318, -1, -1, 0),
(319, 321, -1, -1, 0),
(322, 324, -1, -1, 0),
(325, 327, -1, -1, 0),
(328, 330, -1, -1, 0));
A_21 : constant Among_Array_Type (0 .. 7) := (
(331, 332, -1, -1, 0),
(333, 334, -1, -1, 0),
(335, 337, -1, -1, 0),
(338, 340, -1, -1, 0),
(341, 343, -1, -1, 0),
(344, 346, -1, -1, 0),
(347, 349, -1, -1, 0),
(350, 352, -1, -1, 0));
A_22 : constant Among_Array_Type (0 .. 3) := (
(353, 356, -1, -1, 0),
(357, 360, -1, -1, 0),
(361, 365, -1, -1, 0),
(366, 370, -1, -1, 0));
A_23 : constant Among_Array_Type (0 .. 3) := (
(371, 371, -1, 1, 0),
(372, 372, -1, 2, 0),
(373, 373, -1, 3, 0),
(374, 375, -1, 4, 0));
procedure R_Check_vowel_harmony (Z : in out Context_Type; Result : out Boolean) is
C : Result_Index;
A : Integer;
v_1 : Char_Index;
v_2 : Char_Index;
begin
-- test, line 110
v_1 := Z.L - Z.C;
-- (, line 111
-- goto, line 112
Out_Grouping_Backward (Z, G_Vowel, 97, 305, True, C); if C < 0 then
Result := False;
return;
end if;
-- or, line 114
v_2 := Z.L - Z.C;
-- (, line 114
-- literal, line 114
C := Eq_S_Backward (Z, "a");
if C = 0 then
goto lab2;
end if;
Z.C := Z.C - C;
-- goto, line 114
Out_Grouping_Backward (Z, G_Vowel1, 97, 305, True, C); if C < 0 then
goto lab2;
end if;
goto lab1;
<<lab2>>
Z.C := Z.L - v_2;
-- (, line 115
-- literal, line 115
C := Eq_S_Backward (Z, "e");
if C = 0 then
goto lab4;
end if;
Z.C := Z.C - C;
-- goto, line 115
Out_Grouping_Backward (Z, G_Vowel2, 101, 252, True, C); if C < 0 then
goto lab4;
end if;
goto lab1;
<<lab4>>
Z.C := Z.L - v_2;
-- (, line 116
-- literal, line 116
C := Eq_S_Backward (Z, "ı");
if C = 0 then
goto lab6;
end if;
Z.C := Z.C - C;
-- goto, line 116
Out_Grouping_Backward (Z, G_Vowel3, 97, 305, True, C); if C < 0 then
goto lab6;
end if;
goto lab1;
<<lab6>>
Z.C := Z.L - v_2;
-- (, line 117
-- literal, line 117
C := Eq_S_Backward (Z, "i");
if C = 0 then
goto lab8;
end if;
Z.C := Z.C - C;
-- goto, line 117
Out_Grouping_Backward (Z, G_Vowel4, 101, 105, True, C); if C < 0 then
goto lab8;
end if;
goto lab1;
<<lab8>>
Z.C := Z.L - v_2;
-- (, line 118
-- literal, line 118
C := Eq_S_Backward (Z, "o");
if C = 0 then
goto lab10;
end if;
Z.C := Z.C - C;
-- goto, line 118
Out_Grouping_Backward (Z, G_Vowel5, 111, 117, True, C); if C < 0 then
goto lab10;
end if;
goto lab1;
<<lab10>>
Z.C := Z.L - v_2;
-- (, line 119
-- literal, line 119
C := Eq_S_Backward (Z, "ö");
if C = 0 then
goto lab12;
end if;
Z.C := Z.C - C;
-- goto, line 119
Out_Grouping_Backward (Z, G_Vowel6, 246, 252, True, C); if C < 0 then
goto lab12;
end if;
goto lab1;
<<lab12>>
Z.C := Z.L - v_2;
-- (, line 120
-- literal, line 120
C := Eq_S_Backward (Z, "u");
if C = 0 then
goto lab14;
end if;
Z.C := Z.C - C;
-- goto, line 120
Out_Grouping_Backward (Z, G_Vowel5, 111, 117, True, C); if C < 0 then
goto lab14;
end if;
goto lab1;
<<lab14>>
Z.C := Z.L - v_2;
-- (, line 121
-- literal, line 121
C := Eq_S_Backward (Z, "ü");
if C = 0 then
Result := False;
return;
end if;
Z.C := Z.C - C;
-- goto, line 121
Out_Grouping_Backward (Z, G_Vowel6, 246, 252, True, C); if C < 0 then
Result := False;
return;
end if;
<<lab1>>
Z.C := Z.L - v_1;
Result := True;
end R_Check_vowel_harmony;
procedure R_Mark_suffix_with_optional_n_consonant (Z : in out Context_Type; Result : out Boolean) is
C : Result_Index;
A : Integer;
v_1 : Char_Index;
v_2 : Char_Index;
v_3 : Char_Index;
v_4 : Char_Index;
v_5 : Char_Index;
begin
-- or, line 132
v_1 := Z.L - Z.C;
-- (, line 131
-- literal, line 131
C := Eq_S_Backward (Z, "n");
if C = 0 then
goto lab1;
end if;
Z.C := Z.C - C;
-- test, line 131
v_2 := Z.L - Z.C;
In_Grouping_Backward (Z, G_Vowel, 97, 305, False, C);
if C /= 0 then
goto lab1;
end if;
Z.C := Z.L - v_2;
goto lab0;
<<lab1>>
Z.C := Z.L - v_1;
-- (, line 133
-- not, line 133
v_3 := Z.L - Z.C;
-- test, line 133
v_4 := Z.L - Z.C;
-- literal, line 133
C := Eq_S_Backward (Z, "n");
if C = 0 then
goto lab2;
end if;
Z.C := Z.C - C;
Z.C := Z.L - v_4;
Result := False;
return;
<<lab2>>
Z.C := Z.L - v_3;
-- test, line 133
v_5 := Z.L - Z.C;
-- (, line 133
-- next, line 133
C := Skip_Utf8_Backward (Z);
if C < 0 then
Result := False;
return;
end if;
Z.C := C;
In_Grouping_Backward (Z, G_Vowel, 97, 305, False, C);
if C /= 0 then
Result := False;
return;
end if;
Z.C := Z.L - v_5;
<<lab0>>
Result := True;
end R_Mark_suffix_with_optional_n_consonant;
procedure R_Mark_suffix_with_optional_s_consonant (Z : in out Context_Type; Result : out Boolean) is
C : Result_Index;
A : Integer;
v_1 : Char_Index;
v_2 : Char_Index;
v_3 : Char_Index;
v_4 : Char_Index;
v_5 : Char_Index;
begin
-- or, line 143
v_1 := Z.L - Z.C;
-- (, line 142
-- literal, line 142
C := Eq_S_Backward (Z, "s");
if C = 0 then
goto lab1;
end if;
Z.C := Z.C - C;
-- test, line 142
v_2 := Z.L - Z.C;
In_Grouping_Backward (Z, G_Vowel, 97, 305, False, C);
if C /= 0 then
goto lab1;
end if;
Z.C := Z.L - v_2;
goto lab0;
<<lab1>>
Z.C := Z.L - v_1;
-- (, line 144
-- not, line 144
v_3 := Z.L - Z.C;
-- test, line 144
v_4 := Z.L - Z.C;
-- literal, line 144
C := Eq_S_Backward (Z, "s");
if C = 0 then
goto lab2;
end if;
Z.C := Z.C - C;
Z.C := Z.L - v_4;
Result := False;
return;
<<lab2>>
Z.C := Z.L - v_3;
-- test, line 144
v_5 := Z.L - Z.C;
-- (, line 144
-- next, line 144
C := Skip_Utf8_Backward (Z);
if C < 0 then
Result := False;
return;
end if;
Z.C := C;
In_Grouping_Backward (Z, G_Vowel, 97, 305, False, C);
if C /= 0 then
Result := False;
return;
end if;
Z.C := Z.L - v_5;
<<lab0>>
Result := True;
end R_Mark_suffix_with_optional_s_consonant;
procedure R_Mark_suffix_with_optional_y_consonant (Z : in out Context_Type; Result : out Boolean) is
C : Result_Index;
A : Integer;
v_1 : Char_Index;
v_2 : Char_Index;
v_3 : Char_Index;
v_4 : Char_Index;
v_5 : Char_Index;
begin
-- or, line 153
v_1 := Z.L - Z.C;
-- (, line 152
-- literal, line 152
C := Eq_S_Backward (Z, "y");
if C = 0 then
goto lab1;
end if;
Z.C := Z.C - C;
-- test, line 152
v_2 := Z.L - Z.C;
In_Grouping_Backward (Z, G_Vowel, 97, 305, False, C);
if C /= 0 then
goto lab1;
end if;
Z.C := Z.L - v_2;
goto lab0;
<<lab1>>
Z.C := Z.L - v_1;
-- (, line 154
-- not, line 154
v_3 := Z.L - Z.C;
-- test, line 154
v_4 := Z.L - Z.C;
-- literal, line 154
C := Eq_S_Backward (Z, "y");
if C = 0 then
goto lab2;
end if;
Z.C := Z.C - C;
Z.C := Z.L - v_4;
Result := False;
return;
<<lab2>>
Z.C := Z.L - v_3;
-- test, line 154
v_5 := Z.L - Z.C;
-- (, line 154
-- next, line 154
C := Skip_Utf8_Backward (Z);
if C < 0 then
Result := False;
return;
end if;
Z.C := C;
In_Grouping_Backward (Z, G_Vowel, 97, 305, False, C);
if C /= 0 then
Result := False;
return;
end if;
Z.C := Z.L - v_5;
<<lab0>>
Result := True;
end R_Mark_suffix_with_optional_y_consonant;
procedure R_Mark_suffix_with_optional_U_vowel (Z : in out Context_Type; Result : out Boolean) is
C : Result_Index;
A : Integer;
v_1 : Char_Index;
v_2 : Char_Index;
v_3 : Char_Index;
v_4 : Char_Index;
v_5 : Char_Index;
begin
-- or, line 159
v_1 := Z.L - Z.C;
-- (, line 158
In_Grouping_Backward (Z, G_U, 105, 305, False, C);
if C /= 0 then
goto lab1;
end if;
-- test, line 158
v_2 := Z.L - Z.C;
Out_Grouping_Backward (Z, G_Vowel, 97, 305, False, C);
if C /= 0 then
goto lab1;
end if;
Z.C := Z.L - v_2;
goto lab0;
<<lab1>>
Z.C := Z.L - v_1;
-- (, line 160
-- not, line 160
v_3 := Z.L - Z.C;
-- test, line 160
v_4 := Z.L - Z.C;
In_Grouping_Backward (Z, G_U, 105, 305, False, C);
if C /= 0 then
goto lab2;
end if;
Z.C := Z.L - v_4;
Result := False;
return;
<<lab2>>
Z.C := Z.L - v_3;
-- test, line 160
v_5 := Z.L - Z.C;
-- (, line 160
-- next, line 160
C := Skip_Utf8_Backward (Z);
if C < 0 then
Result := False;
return;
end if;
Z.C := C;
Out_Grouping_Backward (Z, G_Vowel, 97, 305, False, C);
if C /= 0 then
Result := False;
return;
end if;
Z.C := Z.L - v_5;
<<lab0>>
Result := True;
end R_Mark_suffix_with_optional_U_vowel;
procedure R_Mark_possessives (Z : in out Context_Type; Result : out Boolean) is
C : Result_Index;
A : Integer;
begin
-- (, line 164
-- among, line 165
if Z.C <= Z.Lb or else Check_Among (Z, Z.C - 1, 3, 16#4006000#) then
Result := False;
return;
-- among, line 165
end if;
Find_Among_Backward (Z, A_0, Among_String, null, A);
if A = 0 then
Result := False;
return;
end if;
-- call mark_suffix_with_optional_U_vowel, line 167
R_Mark_suffix_with_optional_U_vowel (Z, Result);
if not Result then
Result := False;
return;
end if;
Result := True;
end R_Mark_possessives;
procedure R_Mark_sU (Z : in out Context_Type; Result : out Boolean) is
C : Result_Index;
A : Integer;
begin
-- (, line 170
-- call check_vowel_harmony, line 171
R_Check_vowel_harmony (Z, Result);
if not Result then
Result := False;
return;
end if;
In_Grouping_Backward (Z, G_U, 105, 305, False, C);
if C /= 0 then
Result := False;
return;
end if;
-- call mark_suffix_with_optional_s_consonant, line 173
R_Mark_suffix_with_optional_s_consonant (Z, Result);
if not Result then
Result := False;
return;
end if;
Result := True;
end R_Mark_sU;
procedure R_Mark_lArI (Z : in out Context_Type; Result : out Boolean) is
C : Result_Index;
A : Integer;
begin
-- among, line 177
if Z.C - 3 <= Z.Lb or else (Character'Pos (Z.P (Z.C)) /= 105 and then Character'Pos (Z.P (Z.C)) /= 177) then
Result := False;
return;
-- among, line 177
end if;
Find_Among_Backward (Z, A_1, Among_String, null, A);
if A = 0 then
Result := False;
return;
end if;
Result := True;
end R_Mark_lArI;
procedure R_Mark_yU (Z : in out Context_Type; Result : out Boolean) is
C : Result_Index;
A : Integer;
begin
-- (, line 180
-- call check_vowel_harmony, line 181
R_Check_vowel_harmony (Z, Result);
if not Result then
Result := False;
return;
end if;
In_Grouping_Backward (Z, G_U, 105, 305, False, C);
if C /= 0 then
Result := False;
return;
end if;
-- call mark_suffix_with_optional_y_consonant, line 183
R_Mark_suffix_with_optional_y_consonant (Z, Result);
if not Result then
Result := False;
return;
end if;
Result := True;
end R_Mark_yU;
procedure R_Mark_nU (Z : in out Context_Type; Result : out Boolean) is
C : Result_Index;
A : Integer;
begin
-- (, line 186
-- call check_vowel_harmony, line 187
R_Check_vowel_harmony (Z, Result);
if not Result then
Result := False;
return;
end if;
-- among, line 188
Find_Among_Backward (Z, A_2, Among_String, null, A);
if A = 0 then
Result := False;
return;
end if;
Result := True;
end R_Mark_nU;
procedure R_Mark_nUn (Z : in out Context_Type; Result : out Boolean) is
C : Result_Index;
A : Integer;
begin
-- (, line 191
-- call check_vowel_harmony, line 192
R_Check_vowel_harmony (Z, Result);
if not Result then
Result := False;
return;
end if;
-- among, line 193
if Z.C - 1 <= Z.Lb or else Character'Pos (Z.P (Z.C)) /= 110 then
Result := False;
return;
-- among, line 193
end if;
Find_Among_Backward (Z, A_3, Among_String, null, A);
if A = 0 then
Result := False;
return;
end if;
-- call mark_suffix_with_optional_n_consonant, line 194
R_Mark_suffix_with_optional_n_consonant (Z, Result);
if not Result then
Result := False;
return;
end if;
Result := True;
end R_Mark_nUn;
procedure R_Mark_yA (Z : in out Context_Type; Result : out Boolean) is
C : Result_Index;
A : Integer;
begin
-- (, line 197
-- call check_vowel_harmony, line 198
R_Check_vowel_harmony (Z, Result);
if not Result then
Result := False;
return;
end if;
-- among, line 199
if Z.C <= Z.Lb or else (Character'Pos (Z.P (Z.C)) /= 97 and then Character'Pos (Z.P (Z.C)) /= 101) then
Result := False;
return;
-- among, line 199
end if;
Find_Among_Backward (Z, A_4, Among_String, null, A);
if A = 0 then
Result := False;
return;
end if;
-- call mark_suffix_with_optional_y_consonant, line 200
R_Mark_suffix_with_optional_y_consonant (Z, Result);
if not Result then
Result := False;
return;
end if;
Result := True;
end R_Mark_yA;
procedure R_Mark_nA (Z : in out Context_Type; Result : out Boolean) is
C : Result_Index;
A : Integer;
begin
-- (, line 203
-- call check_vowel_harmony, line 204
R_Check_vowel_harmony (Z, Result);
if not Result then
Result := False;
return;
end if;
-- among, line 205
if Z.C - 1 <= Z.Lb or else (Character'Pos (Z.P (Z.C)) /= 97 and then Character'Pos (Z.P (Z.C)) /= 101) then
Result := False;
return;
-- among, line 205
end if;
Find_Among_Backward (Z, A_5, Among_String, null, A);
if A = 0 then
Result := False;
return;
end if;
Result := True;
end R_Mark_nA;
procedure R_Mark_DA (Z : in out Context_Type; Result : out Boolean) is
C : Result_Index;
A : Integer;
begin
-- (, line 208
-- call check_vowel_harmony, line 209
R_Check_vowel_harmony (Z, Result);
if not Result then
Result := False;
return;
end if;
-- among, line 210
if Z.C - 1 <= Z.Lb or else (Character'Pos (Z.P (Z.C)) /= 97 and then Character'Pos (Z.P (Z.C)) /= 101) then
Result := False;
return;
-- among, line 210
end if;
Find_Among_Backward (Z, A_6, Among_String, null, A);
if A = 0 then
Result := False;
return;
end if;
Result := True;
end R_Mark_DA;
procedure R_Mark_ndA (Z : in out Context_Type; Result : out Boolean) is
C : Result_Index;
A : Integer;
begin
-- (, line 213
-- call check_vowel_harmony, line 214
R_Check_vowel_harmony (Z, Result);
if not Result then
Result := False;
return;
end if;
-- among, line 215
if Z.C - 2 <= Z.Lb or else (Character'Pos (Z.P (Z.C)) /= 97 and then Character'Pos (Z.P (Z.C)) /= 101) then
Result := False;
return;
-- among, line 215
end if;
Find_Among_Backward (Z, A_7, Among_String, null, A);
if A = 0 then
Result := False;
return;
end if;
Result := True;
end R_Mark_ndA;
procedure R_Mark_DAn (Z : in out Context_Type; Result : out Boolean) is
C : Result_Index;
A : Integer;
begin
-- (, line 218
-- call check_vowel_harmony, line 219
R_Check_vowel_harmony (Z, Result);
if not Result then
Result := False;
return;
end if;
-- among, line 220
if Z.C - 2 <= Z.Lb or else Character'Pos (Z.P (Z.C)) /= 110 then
Result := False;
return;
-- among, line 220
end if;
Find_Among_Backward (Z, A_8, Among_String, null, A);
if A = 0 then
Result := False;
return;
end if;
Result := True;
end R_Mark_DAn;
procedure R_Mark_ndAn (Z : in out Context_Type; Result : out Boolean) is
C : Result_Index;
A : Integer;
begin
-- (, line 223
-- call check_vowel_harmony, line 224
R_Check_vowel_harmony (Z, Result);
if not Result then
Result := False;
return;
end if;
-- among, line 225
if Z.C - 3 <= Z.Lb or else Character'Pos (Z.P (Z.C)) /= 110 then
Result := False;
return;
-- among, line 225
end if;
Find_Among_Backward (Z, A_9, Among_String, null, A);
if A = 0 then
Result := False;
return;
end if;
Result := True;
end R_Mark_ndAn;
procedure R_Mark_ylA (Z : in out Context_Type; Result : out Boolean) is
C : Result_Index;
A : Integer;
begin
-- (, line 228
-- call check_vowel_harmony, line 229
R_Check_vowel_harmony (Z, Result);
if not Result then
Result := False;
return;
end if;
-- among, line 230
if Z.C - 1 <= Z.Lb or else (Character'Pos (Z.P (Z.C)) /= 97 and then Character'Pos (Z.P (Z.C)) /= 101) then
Result := False;
return;
-- among, line 230
end if;
Find_Among_Backward (Z, A_10, Among_String, null, A);
if A = 0 then
Result := False;
return;
end if;
-- call mark_suffix_with_optional_y_consonant, line 231
R_Mark_suffix_with_optional_y_consonant (Z, Result);
if not Result then
Result := False;
return;
end if;
Result := True;
end R_Mark_ylA;
procedure R_Mark_ki (Z : in out Context_Type; Result : out Boolean) is
C : Result_Index;
A : Integer;
begin
-- literal, line 235
C := Eq_S_Backward (Z, "ki");
if C = 0 then
Result := False;
return;
end if;
Z.C := Z.C - C;
Result := True;
end R_Mark_ki;
procedure R_Mark_ncA (Z : in out Context_Type; Result : out Boolean) is
C : Result_Index;
A : Integer;
begin
-- (, line 238
-- call check_vowel_harmony, line 239
R_Check_vowel_harmony (Z, Result);
if not Result then
Result := False;
return;
end if;
-- among, line 240
if Z.C - 1 <= Z.Lb or else (Character'Pos (Z.P (Z.C)) /= 97 and then Character'Pos (Z.P (Z.C)) /= 101) then
Result := False;
return;
-- among, line 240
end if;
Find_Among_Backward (Z, A_11, Among_String, null, A);
if A = 0 then
Result := False;
return;
end if;
-- call mark_suffix_with_optional_n_consonant, line 241
R_Mark_suffix_with_optional_n_consonant (Z, Result);
if not Result then
Result := False;
return;
end if;
Result := True;
end R_Mark_ncA;
procedure R_Mark_yUm (Z : in out Context_Type; Result : out Boolean) is
C : Result_Index;
A : Integer;
begin
-- (, line 244
-- call check_vowel_harmony, line 245
R_Check_vowel_harmony (Z, Result);
if not Result then
Result := False;
return;
end if;
-- among, line 246
if Z.C - 1 <= Z.Lb or else Character'Pos (Z.P (Z.C)) /= 109 then
Result := False;
return;
-- among, line 246
end if;
Find_Among_Backward (Z, A_12, Among_String, null, A);
if A = 0 then
Result := False;
return;
end if;
-- call mark_suffix_with_optional_y_consonant, line 247
R_Mark_suffix_with_optional_y_consonant (Z, Result);
if not Result then
Result := False;
return;
end if;
Result := True;
end R_Mark_yUm;
procedure R_Mark_sUn (Z : in out Context_Type; Result : out Boolean) is
C : Result_Index;
A : Integer;
begin
-- (, line 250
-- call check_vowel_harmony, line 251
R_Check_vowel_harmony (Z, Result);
if not Result then
Result := False;
return;
end if;
-- among, line 252
if Z.C - 2 <= Z.Lb or else Character'Pos (Z.P (Z.C)) /= 110 then
Result := False;
return;
-- among, line 252
end if;
Find_Among_Backward (Z, A_13, Among_String, null, A);
if A = 0 then
Result := False;
return;
end if;
Result := True;
end R_Mark_sUn;
procedure R_Mark_yUz (Z : in out Context_Type; Result : out Boolean) is
C : Result_Index;
A : Integer;
begin
-- (, line 255
-- call check_vowel_harmony, line 256
R_Check_vowel_harmony (Z, Result);
if not Result then
Result := False;
return;
end if;
-- among, line 257
if Z.C - 1 <= Z.Lb or else Character'Pos (Z.P (Z.C)) /= 122 then
Result := False;
return;
-- among, line 257
end if;
Find_Among_Backward (Z, A_14, Among_String, null, A);
if A = 0 then
Result := False;
return;
end if;
-- call mark_suffix_with_optional_y_consonant, line 258
R_Mark_suffix_with_optional_y_consonant (Z, Result);
if not Result then
Result := False;
return;
end if;
Result := True;
end R_Mark_yUz;
procedure R_Mark_sUnUz (Z : in out Context_Type; Result : out Boolean) is
C : Result_Index;
A : Integer;
begin
-- among, line 262
if Z.C - 4 <= Z.Lb or else Character'Pos (Z.P (Z.C)) /= 122 then
Result := False;
return;
-- among, line 262
end if;
Find_Among_Backward (Z, A_15, Among_String, null, A);
if A = 0 then
Result := False;
return;
end if;
Result := True;
end R_Mark_sUnUz;
procedure R_Mark_lAr (Z : in out Context_Type; Result : out Boolean) is
C : Result_Index;
A : Integer;
begin
-- (, line 265
-- call check_vowel_harmony, line 266
R_Check_vowel_harmony (Z, Result);
if not Result then
Result := False;
return;
end if;
-- among, line 267
if Z.C - 2 <= Z.Lb or else Character'Pos (Z.P (Z.C)) /= 114 then
Result := False;
return;
-- among, line 267
end if;
Find_Among_Backward (Z, A_16, Among_String, null, A);
if A = 0 then
Result := False;
return;
end if;
Result := True;
end R_Mark_lAr;
procedure R_Mark_nUz (Z : in out Context_Type; Result : out Boolean) is
C : Result_Index;
A : Integer;
begin
-- (, line 270
-- call check_vowel_harmony, line 271
R_Check_vowel_harmony (Z, Result);
if not Result then
Result := False;
return;
end if;
-- among, line 272
if Z.C - 2 <= Z.Lb or else Character'Pos (Z.P (Z.C)) /= 122 then
Result := False;
return;
-- among, line 272
end if;
Find_Among_Backward (Z, A_17, Among_String, null, A);
if A = 0 then
Result := False;
return;
end if;
Result := True;
end R_Mark_nUz;
procedure R_Mark_DUr (Z : in out Context_Type; Result : out Boolean) is
C : Result_Index;
A : Integer;
begin
-- (, line 275
-- call check_vowel_harmony, line 276
R_Check_vowel_harmony (Z, Result);
if not Result then
Result := False;
return;
end if;
-- among, line 277
if Z.C - 2 <= Z.Lb or else Character'Pos (Z.P (Z.C)) /= 114 then
Result := False;
return;
-- among, line 277
end if;
Find_Among_Backward (Z, A_18, Among_String, null, A);
if A = 0 then
Result := False;
return;
end if;
Result := True;
end R_Mark_DUr;
procedure R_Mark_cAsInA (Z : in out Context_Type; Result : out Boolean) is
C : Result_Index;
A : Integer;
begin
-- among, line 281
if Z.C - 5 <= Z.Lb or else (Character'Pos (Z.P (Z.C)) /= 97 and then Character'Pos (Z.P (Z.C)) /= 101) then
Result := False;
return;
-- among, line 281
end if;
Find_Among_Backward (Z, A_19, Among_String, null, A);
if A = 0 then
Result := False;
return;
end if;
Result := True;
end R_Mark_cAsInA;
procedure R_Mark_yDU (Z : in out Context_Type; Result : out Boolean) is
C : Result_Index;
A : Integer;
begin
-- (, line 284
-- call check_vowel_harmony, line 285
R_Check_vowel_harmony (Z, Result);
if not Result then
Result := False;
return;
end if;
-- among, line 286
Find_Among_Backward (Z, A_20, Among_String, null, A);
if A = 0 then
Result := False;
return;
end if;
-- call mark_suffix_with_optional_y_consonant, line 290
R_Mark_suffix_with_optional_y_consonant (Z, Result);
if not Result then
Result := False;
return;
end if;
Result := True;
end R_Mark_yDU;
procedure R_Mark_ysA (Z : in out Context_Type; Result : out Boolean) is
C : Result_Index;
A : Integer;
begin
-- (, line 294
-- among, line 295
if Z.C - 1 <= Z.Lb or else Check_Among (Z, Z.C - 1, 3, 16#6822#) then
Result := False;
return;
-- among, line 295
end if;
Find_Among_Backward (Z, A_21, Among_String, null, A);
if A = 0 then
Result := False;
return;
end if;
-- call mark_suffix_with_optional_y_consonant, line 296
R_Mark_suffix_with_optional_y_consonant (Z, Result);
if not Result then
Result := False;
return;
end if;
Result := True;
end R_Mark_ysA;
procedure R_Mark_ymUs_E (Z : in out Context_Type; Result : out Boolean) is
C : Result_Index;
A : Integer;
begin
-- (, line 299
-- call check_vowel_harmony, line 300
R_Check_vowel_harmony (Z, Result);
if not Result then
Result := False;
return;
end if;
-- among, line 301
if Z.C - 3 <= Z.Lb or else Character'Pos (Z.P (Z.C)) /= 159 then
Result := False;
return;
-- among, line 301
end if;
Find_Among_Backward (Z, A_22, Among_String, null, A);
if A = 0 then
Result := False;
return;
end if;
-- call mark_suffix_with_optional_y_consonant, line 302
R_Mark_suffix_with_optional_y_consonant (Z, Result);
if not Result then
Result := False;
return;
end if;
Result := True;
end R_Mark_ymUs_E;
procedure R_Mark_yken (Z : in out Context_Type; Result : out Boolean) is
C : Result_Index;
A : Integer;
begin
-- (, line 305
-- literal, line 306
C := Eq_S_Backward (Z, "ken");
if C = 0 then
Result := False;
return;
end if;
Z.C := Z.C - C;
-- call mark_suffix_with_optional_y_consonant, line 306
R_Mark_suffix_with_optional_y_consonant (Z, Result);
if not Result then
Result := False;
return;
end if;
Result := True;
end R_Mark_yken;
procedure R_Stem_nominal_verb_suffixes (Z : in out Context_Type; Result : out Boolean) is
C : Result_Index;
A : Integer;
v_1 : Char_Index;
v_2 : Char_Index;
v_3 : Char_Index;
v_4 : Char_Index;
v_5 : Char_Index;
v_6 : Char_Index;
v_7 : Char_Index;
v_8 : Char_Index;
v_9 : Char_Index;
v_10 : Char_Index;
begin
-- (, line 309
Z.Ket := Z.C; -- [, line 310
-- set continue_stemming_noun_suffixes, line 311
Z.B_Continue_stemming_noun_suffixes := True;
-- or, line 313
v_1 := Z.L - Z.C;
-- or, line 312
v_2 := Z.L - Z.C;
-- call mark_ymUs_, line 312
R_Mark_ymUs_E (Z, Result);
if not Result then
goto lab3;
end if;
goto lab2;
<<lab3>>
Z.C := Z.L - v_2;
-- call mark_yDU, line 312
R_Mark_yDU (Z, Result);
if not Result then
goto lab4;
end if;
goto lab2;
<<lab4>>
Z.C := Z.L - v_2;
-- call mark_ysA, line 312
R_Mark_ysA (Z, Result);
if not Result then
goto lab5;
end if;
goto lab2;
<<lab5>>
Z.C := Z.L - v_2;
-- call mark_yken, line 312
R_Mark_yken (Z, Result);
if not Result then
goto lab1;
end if;
<<lab2>>
goto lab0;
<<lab1>>
Z.C := Z.L - v_1;
-- (, line 314
-- call mark_cAsInA, line 314
R_Mark_cAsInA (Z, Result);
if not Result then
goto lab6;
end if;
-- or, line 314
v_3 := Z.L - Z.C;
-- call mark_sUnUz, line 314
R_Mark_sUnUz (Z, Result);
if not Result then
goto lab8;
end if;
goto lab7;
<<lab8>>
Z.C := Z.L - v_3;
-- call mark_lAr, line 314
R_Mark_lAr (Z, Result);
if not Result then
goto lab9;
end if;
goto lab7;
<<lab9>>
Z.C := Z.L - v_3;
-- call mark_yUm, line 314
R_Mark_yUm (Z, Result);
if not Result then
goto lab10;
end if;
goto lab7;
<<lab10>>
Z.C := Z.L - v_3;
-- call mark_sUn, line 314
R_Mark_sUn (Z, Result);
if not Result then
goto lab11;
end if;
goto lab7;
<<lab11>>
Z.C := Z.L - v_3;
-- call mark_yUz, line 314
R_Mark_yUz (Z, Result);
if not Result then
goto lab12;
end if;
goto lab7;
<<lab12>>
Z.C := Z.L - v_3;
<<lab7>>
-- call mark_ymUs_, line 314
R_Mark_ymUs_E (Z, Result);
if not Result then
goto lab6;
end if;
goto lab0;
<<lab6>>
Z.C := Z.L - v_1;
-- (, line 316
-- call mark_lAr, line 317
R_Mark_lAr (Z, Result);
if not Result then
goto lab13;
end if;
Z.Bra := Z.C; -- ], line 317
-- delete, line 317
Slice_Del (Z);
-- try, line 317
v_4 := Z.L - Z.C;
-- (, line 317
Z.Ket := Z.C; -- [, line 317
-- or, line 317
v_5 := Z.L - Z.C;
-- call mark_DUr, line 317
R_Mark_DUr (Z, Result);
if not Result then
goto lab16;
end if;
goto lab15;
<<lab16>>
Z.C := Z.L - v_5;
-- call mark_yDU, line 317
R_Mark_yDU (Z, Result);
if not Result then
goto lab17;
end if;
goto lab15;
<<lab17>>
Z.C := Z.L - v_5;
-- call mark_ysA, line 317
R_Mark_ysA (Z, Result);
if not Result then
goto lab18;
end if;
goto lab15;
<<lab18>>
Z.C := Z.L - v_5;
-- call mark_ymUs_, line 317
R_Mark_ymUs_E (Z, Result);
if not Result then
Z.C := Z.L - v_4;
goto lab14;
end if;
<<lab15>>
<<lab14>>
-- unset continue_stemming_noun_suffixes, line 318
Z.B_Continue_stemming_noun_suffixes := False;
goto lab0;
<<lab13>>
Z.C := Z.L - v_1;
-- (, line 321
-- call mark_nUz, line 321
R_Mark_nUz (Z, Result);
if not Result then
goto lab19;
end if;
-- or, line 321
v_6 := Z.L - Z.C;
-- call mark_yDU, line 321
R_Mark_yDU (Z, Result);
if not Result then
goto lab21;
end if;
goto lab20;
<<lab21>>
Z.C := Z.L - v_6;
-- call mark_ysA, line 321
R_Mark_ysA (Z, Result);
if not Result then
goto lab19;
end if;
<<lab20>>
goto lab0;
<<lab19>>
Z.C := Z.L - v_1;
-- (, line 323
-- or, line 323
v_7 := Z.L - Z.C;
-- call mark_sUnUz, line 323
R_Mark_sUnUz (Z, Result);
if not Result then
goto lab24;
end if;
goto lab23;
<<lab24>>
Z.C := Z.L - v_7;
-- call mark_yUz, line 323
R_Mark_yUz (Z, Result);
if not Result then
goto lab25;
end if;
goto lab23;
<<lab25>>
Z.C := Z.L - v_7;
-- call mark_sUn, line 323
R_Mark_sUn (Z, Result);
if not Result then
goto lab26;
end if;
goto lab23;
<<lab26>>
Z.C := Z.L - v_7;
-- call mark_yUm, line 323
R_Mark_yUm (Z, Result);
if not Result then
goto lab22;
end if;
<<lab23>>
Z.Bra := Z.C; -- ], line 323
-- delete, line 323
Slice_Del (Z);
-- try, line 323
v_8 := Z.L - Z.C;
-- (, line 323
Z.Ket := Z.C; -- [, line 323
-- call mark_ymUs_, line 323
R_Mark_ymUs_E (Z, Result);
if not Result then
Z.C := Z.L - v_8;
goto lab27;
end if;
<<lab27>>
goto lab0;
<<lab22>>
Z.C := Z.L - v_1;
-- (, line 325
-- call mark_DUr, line 325
R_Mark_DUr (Z, Result);
if not Result then
Result := False;
return;
end if;
Z.Bra := Z.C; -- ], line 325
-- delete, line 325
Slice_Del (Z);
-- try, line 325
v_9 := Z.L - Z.C;
-- (, line 325
Z.Ket := Z.C; -- [, line 325
-- or, line 325
v_10 := Z.L - Z.C;
-- call mark_sUnUz, line 325
R_Mark_sUnUz (Z, Result);
if not Result then
goto lab30;
end if;
goto lab29;
<<lab30>>
Z.C := Z.L - v_10;
-- call mark_lAr, line 325
R_Mark_lAr (Z, Result);
if not Result then
goto lab31;
end if;
goto lab29;
<<lab31>>
Z.C := Z.L - v_10;
-- call mark_yUm, line 325
R_Mark_yUm (Z, Result);
if not Result then
goto lab32;
end if;
goto lab29;
<<lab32>>
Z.C := Z.L - v_10;
-- call mark_sUn, line 325
R_Mark_sUn (Z, Result);
if not Result then
goto lab33;
end if;
goto lab29;
<<lab33>>
Z.C := Z.L - v_10;
-- call mark_yUz, line 325
R_Mark_yUz (Z, Result);
if not Result then
goto lab34;
end if;
goto lab29;
<<lab34>>
Z.C := Z.L - v_10;
<<lab29>>
-- call mark_ymUs_, line 325
R_Mark_ymUs_E (Z, Result);
if not Result then
Z.C := Z.L - v_9;
goto lab28;
end if;
<<lab28>>
<<lab0>>
Z.Bra := Z.C; -- ], line 326
-- delete, line 326
Slice_Del (Z);
Result := True;
end R_Stem_nominal_verb_suffixes;
procedure R_Stem_suffix_chain_before_ki (Z : in out Context_Type; Result : out Boolean) is
C : Result_Index;
A : Integer;
v_1 : Char_Index;
v_2 : Char_Index;
v_3 : Char_Index;
v_4 : Char_Index;
v_5 : Char_Index;
v_6 : Char_Index;
v_7 : Char_Index;
v_8 : Char_Index;
v_9 : Char_Index;
v_10 : Char_Index;
v_11 : Char_Index;
begin
-- (, line 330
Z.Ket := Z.C; -- [, line 331
-- call mark_ki, line 332
R_Mark_ki (Z, Result);
if not Result then
Result := False;
return;
end if;
-- or, line 340
v_1 := Z.L - Z.C;
-- (, line 334
-- call mark_DA, line 334
R_Mark_DA (Z, Result);
if not Result then
goto lab1;
end if;
Z.Bra := Z.C; -- ], line 334
-- delete, line 334
Slice_Del (Z);
-- try, line 334
v_2 := Z.L - Z.C;
-- (, line 334
Z.Ket := Z.C; -- [, line 334
-- or, line 336
v_3 := Z.L - Z.C;
-- (, line 335
-- call mark_lAr, line 335
R_Mark_lAr (Z, Result);
if not Result then
goto lab4;
end if;
Z.Bra := Z.C; -- ], line 335
-- delete, line 335
Slice_Del (Z);
-- try, line 335
v_4 := Z.L - Z.C;
-- call stem_suffix_chain_before_ki, line 335
R_Stem_suffix_chain_before_ki (Z, Result);
if not Result then
Z.C := Z.L - v_4;
goto lab5;
end if;
<<lab5>>
goto lab3;
<<lab4>>
Z.C := Z.L - v_3;
-- (, line 337
-- call mark_possessives, line 337
R_Mark_possessives (Z, Result);
if not Result then
Z.C := Z.L - v_2;
goto lab2;
end if;
Z.Bra := Z.C; -- ], line 337
-- delete, line 337
Slice_Del (Z);
-- try, line 337
v_5 := Z.L - Z.C;
-- (, line 337
Z.Ket := Z.C; -- [, line 337
-- call mark_lAr, line 337
R_Mark_lAr (Z, Result);
if not Result then
Z.C := Z.L - v_5;
goto lab6;
end if;
Z.Bra := Z.C; -- ], line 337
-- delete, line 337
Slice_Del (Z);
-- call stem_suffix_chain_before_ki, line 337
R_Stem_suffix_chain_before_ki (Z, Result);
if not Result then
Z.C := Z.L - v_5;
goto lab6;
end if;
<<lab6>>
<<lab3>>
<<lab2>>
goto lab0;
<<lab1>>
Z.C := Z.L - v_1;
-- (, line 341
-- call mark_nUn, line 341
R_Mark_nUn (Z, Result);
if not Result then
goto lab7;
end if;
Z.Bra := Z.C; -- ], line 341
-- delete, line 341
Slice_Del (Z);
-- try, line 341
v_6 := Z.L - Z.C;
-- (, line 341
Z.Ket := Z.C; -- [, line 341
-- or, line 343
v_7 := Z.L - Z.C;
-- (, line 342
-- call mark_lArI, line 342
R_Mark_lArI (Z, Result);
if not Result then
goto lab10;
end if;
Z.Bra := Z.C; -- ], line 342
-- delete, line 342
Slice_Del (Z);
goto lab9;
<<lab10>>
Z.C := Z.L - v_7;
-- (, line 344
Z.Ket := Z.C; -- [, line 344
-- or, line 344
v_8 := Z.L - Z.C;
-- call mark_possessives, line 344
R_Mark_possessives (Z, Result);
if not Result then
goto lab13;
end if;
goto lab12;
<<lab13>>
Z.C := Z.L - v_8;
-- call mark_sU, line 344
R_Mark_sU (Z, Result);
if not Result then
goto lab11;
end if;
<<lab12>>
Z.Bra := Z.C; -- ], line 344
-- delete, line 344
Slice_Del (Z);
-- try, line 344
v_9 := Z.L - Z.C;
-- (, line 344
Z.Ket := Z.C; -- [, line 344
-- call mark_lAr, line 344
R_Mark_lAr (Z, Result);
if not Result then
Z.C := Z.L - v_9;
goto lab14;
end if;
Z.Bra := Z.C; -- ], line 344
-- delete, line 344
Slice_Del (Z);
-- call stem_suffix_chain_before_ki, line 344
R_Stem_suffix_chain_before_ki (Z, Result);
if not Result then
Z.C := Z.L - v_9;
goto lab14;
end if;
<<lab14>>
goto lab9;
<<lab11>>
Z.C := Z.L - v_7;
-- call stem_suffix_chain_before_ki, line 346
R_Stem_suffix_chain_before_ki (Z, Result);
if not Result then
Z.C := Z.L - v_6;
goto lab8;
end if;
<<lab9>>
<<lab8>>
goto lab0;
<<lab7>>
Z.C := Z.L - v_1;
-- (, line 349
-- call mark_ndA, line 349
R_Mark_ndA (Z, Result);
if not Result then
Result := False;
return;
end if;
-- or, line 351
v_10 := Z.L - Z.C;
-- (, line 350
-- call mark_lArI, line 350
R_Mark_lArI (Z, Result);
if not Result then
goto lab16;
end if;
Z.Bra := Z.C; -- ], line 350
-- delete, line 350
Slice_Del (Z);
goto lab15;
<<lab16>>
Z.C := Z.L - v_10;
-- (, line 352
-- call mark_sU, line 352
R_Mark_sU (Z, Result);
if not Result then
goto lab17;
end if;
Z.Bra := Z.C; -- ], line 352
-- delete, line 352
Slice_Del (Z);
-- try, line 352
v_11 := Z.L - Z.C;
-- (, line 352
Z.Ket := Z.C; -- [, line 352
-- call mark_lAr, line 352
R_Mark_lAr (Z, Result);
if not Result then
Z.C := Z.L - v_11;
goto lab18;
end if;
Z.Bra := Z.C; -- ], line 352
-- delete, line 352
Slice_Del (Z);
-- call stem_suffix_chain_before_ki, line 352
R_Stem_suffix_chain_before_ki (Z, Result);
if not Result then
Z.C := Z.L - v_11;
goto lab18;
end if;
<<lab18>>
goto lab15;
<<lab17>>
Z.C := Z.L - v_10;
-- call stem_suffix_chain_before_ki, line 354
R_Stem_suffix_chain_before_ki (Z, Result);
if not Result then
Result := False;
return;
end if;
<<lab15>>
<<lab0>>
Result := True;
end R_Stem_suffix_chain_before_ki;
procedure R_Stem_noun_suffixes (Z : in out Context_Type; Result : out Boolean) is
C : Result_Index;
A : Integer;
v_1 : Char_Index;
v_2 : Char_Index;
v_3 : Char_Index;
v_4 : Char_Index;
v_5 : Char_Index;
v_6 : Char_Index;
v_7 : Char_Index;
v_8 : Char_Index;
v_9 : Char_Index;
v_10 : Char_Index;
v_11 : Char_Index;
v_12 : Char_Index;
v_13 : Char_Index;
v_14 : Char_Index;
v_15 : Char_Index;
v_16 : Char_Index;
v_17 : Char_Index;
v_18 : Char_Index;
v_19 : Char_Index;
v_20 : Char_Index;
v_21 : Char_Index;
v_22 : Char_Index;
v_23 : Char_Index;
v_24 : Char_Index;
v_25 : Char_Index;
v_26 : Char_Index;
v_27 : Char_Index;
begin
-- or, line 361
v_1 := Z.L - Z.C;
-- (, line 360
Z.Ket := Z.C; -- [, line 360
-- call mark_lAr, line 360
R_Mark_lAr (Z, Result);
if not Result then
goto lab1;
end if;
Z.Bra := Z.C; -- ], line 360
-- delete, line 360
Slice_Del (Z);
-- try, line 360
v_2 := Z.L - Z.C;
-- call stem_suffix_chain_before_ki, line 360
R_Stem_suffix_chain_before_ki (Z, Result);
if not Result then
Z.C := Z.L - v_2;
goto lab2;
end if;
<<lab2>>
goto lab0;
<<lab1>>
Z.C := Z.L - v_1;
-- (, line 362
Z.Ket := Z.C; -- [, line 362
-- call mark_ncA, line 362
R_Mark_ncA (Z, Result);
if not Result then
goto lab3;
end if;
Z.Bra := Z.C; -- ], line 362
-- delete, line 362
Slice_Del (Z);
-- try, line 363
v_3 := Z.L - Z.C;
-- or, line 365
v_4 := Z.L - Z.C;
-- (, line 364
Z.Ket := Z.C; -- [, line 364
-- call mark_lArI, line 364
R_Mark_lArI (Z, Result);
if not Result then
goto lab6;
end if;
Z.Bra := Z.C; -- ], line 364
-- delete, line 364
Slice_Del (Z);
goto lab5;
<<lab6>>
Z.C := Z.L - v_4;
-- (, line 366
Z.Ket := Z.C; -- [, line 366
-- or, line 366
v_5 := Z.L - Z.C;
-- call mark_possessives, line 366
R_Mark_possessives (Z, Result);
if not Result then
goto lab9;
end if;
goto lab8;
<<lab9>>
Z.C := Z.L - v_5;
-- call mark_sU, line 366
R_Mark_sU (Z, Result);
if not Result then
goto lab7;
end if;
<<lab8>>
Z.Bra := Z.C; -- ], line 366
-- delete, line 366
Slice_Del (Z);
-- try, line 366
v_6 := Z.L - Z.C;
-- (, line 366
Z.Ket := Z.C; -- [, line 366
-- call mark_lAr, line 366
R_Mark_lAr (Z, Result);
if not Result then
Z.C := Z.L - v_6;
goto lab10;
end if;
Z.Bra := Z.C; -- ], line 366
-- delete, line 366
Slice_Del (Z);
-- call stem_suffix_chain_before_ki, line 366
R_Stem_suffix_chain_before_ki (Z, Result);
if not Result then
Z.C := Z.L - v_6;
goto lab10;
end if;
<<lab10>>
goto lab5;
<<lab7>>
Z.C := Z.L - v_4;
-- (, line 368
Z.Ket := Z.C; -- [, line 368
-- call mark_lAr, line 368
R_Mark_lAr (Z, Result);
if not Result then
Z.C := Z.L - v_3;
goto lab4;
end if;
Z.Bra := Z.C; -- ], line 368
-- delete, line 368
Slice_Del (Z);
-- call stem_suffix_chain_before_ki, line 368
R_Stem_suffix_chain_before_ki (Z, Result);
if not Result then
Z.C := Z.L - v_3;
goto lab4;
end if;
<<lab5>>
<<lab4>>
goto lab0;
<<lab3>>
Z.C := Z.L - v_1;
-- (, line 372
Z.Ket := Z.C; -- [, line 372
-- or, line 372
v_7 := Z.L - Z.C;
-- call mark_ndA, line 372
R_Mark_ndA (Z, Result);
if not Result then
goto lab13;
end if;
goto lab12;
<<lab13>>
Z.C := Z.L - v_7;
-- call mark_nA, line 372
R_Mark_nA (Z, Result);
if not Result then
goto lab11;
end if;
<<lab12>>
-- or, line 375
v_8 := Z.L - Z.C;
-- (, line 374
-- call mark_lArI, line 374
R_Mark_lArI (Z, Result);
if not Result then
goto lab15;
end if;
Z.Bra := Z.C; -- ], line 374
-- delete, line 374
Slice_Del (Z);
goto lab14;
<<lab15>>
Z.C := Z.L - v_8;
-- (, line 376
-- call mark_sU, line 376
R_Mark_sU (Z, Result);
if not Result then
goto lab16;
end if;
Z.Bra := Z.C; -- ], line 376
-- delete, line 376
Slice_Del (Z);
-- try, line 376
v_9 := Z.L - Z.C;
-- (, line 376
Z.Ket := Z.C; -- [, line 376
-- call mark_lAr, line 376
R_Mark_lAr (Z, Result);
if not Result then
Z.C := Z.L - v_9;
goto lab17;
end if;
Z.Bra := Z.C; -- ], line 376
-- delete, line 376
Slice_Del (Z);
-- call stem_suffix_chain_before_ki, line 376
R_Stem_suffix_chain_before_ki (Z, Result);
if not Result then
Z.C := Z.L - v_9;
goto lab17;
end if;
<<lab17>>
goto lab14;
<<lab16>>
Z.C := Z.L - v_8;
-- call stem_suffix_chain_before_ki, line 378
R_Stem_suffix_chain_before_ki (Z, Result);
if not Result then
goto lab11;
end if;
<<lab14>>
goto lab0;
<<lab11>>
Z.C := Z.L - v_1;
-- (, line 382
Z.Ket := Z.C; -- [, line 382
-- or, line 382
v_10 := Z.L - Z.C;
-- call mark_ndAn, line 382
R_Mark_ndAn (Z, Result);
if not Result then
goto lab20;
end if;
goto lab19;
<<lab20>>
Z.C := Z.L - v_10;
-- call mark_nU, line 382
R_Mark_nU (Z, Result);
if not Result then
goto lab18;
end if;
<<lab19>>
-- or, line 382
v_11 := Z.L - Z.C;
-- (, line 382
-- call mark_sU, line 382
R_Mark_sU (Z, Result);
if not Result then
goto lab22;
end if;
Z.Bra := Z.C; -- ], line 382
-- delete, line 382
Slice_Del (Z);
-- try, line 382
v_12 := Z.L - Z.C;
-- (, line 382
Z.Ket := Z.C; -- [, line 382
-- call mark_lAr, line 382
R_Mark_lAr (Z, Result);
if not Result then
Z.C := Z.L - v_12;
goto lab23;
end if;
Z.Bra := Z.C; -- ], line 382
-- delete, line 382
Slice_Del (Z);
-- call stem_suffix_chain_before_ki, line 382
R_Stem_suffix_chain_before_ki (Z, Result);
if not Result then
Z.C := Z.L - v_12;
goto lab23;
end if;
<<lab23>>
goto lab21;
<<lab22>>
Z.C := Z.L - v_11;
-- call mark_lArI, line 382
R_Mark_lArI (Z, Result);
if not Result then
goto lab18;
end if;
<<lab21>>
goto lab0;
<<lab18>>
Z.C := Z.L - v_1;
-- (, line 384
Z.Ket := Z.C; -- [, line 384
-- call mark_DAn, line 384
R_Mark_DAn (Z, Result);
if not Result then
goto lab24;
end if;
Z.Bra := Z.C; -- ], line 384
-- delete, line 384
Slice_Del (Z);
-- try, line 384
v_13 := Z.L - Z.C;
-- (, line 384
Z.Ket := Z.C; -- [, line 384
-- or, line 387
v_14 := Z.L - Z.C;
-- (, line 386
-- call mark_possessives, line 386
R_Mark_possessives (Z, Result);
if not Result then
goto lab27;
end if;
Z.Bra := Z.C; -- ], line 386
-- delete, line 386
Slice_Del (Z);
-- try, line 386
v_15 := Z.L - Z.C;
-- (, line 386
Z.Ket := Z.C; -- [, line 386
-- call mark_lAr, line 386
R_Mark_lAr (Z, Result);
if not Result then
Z.C := Z.L - v_15;
goto lab28;
end if;
Z.Bra := Z.C; -- ], line 386
-- delete, line 386
Slice_Del (Z);
-- call stem_suffix_chain_before_ki, line 386
R_Stem_suffix_chain_before_ki (Z, Result);
if not Result then
Z.C := Z.L - v_15;
goto lab28;
end if;
<<lab28>>
goto lab26;
<<lab27>>
Z.C := Z.L - v_14;
-- (, line 388
-- call mark_lAr, line 388
R_Mark_lAr (Z, Result);
if not Result then
goto lab29;
end if;
Z.Bra := Z.C; -- ], line 388
-- delete, line 388
Slice_Del (Z);
-- try, line 388
v_16 := Z.L - Z.C;
-- call stem_suffix_chain_before_ki, line 388
R_Stem_suffix_chain_before_ki (Z, Result);
if not Result then
Z.C := Z.L - v_16;
goto lab30;
end if;
<<lab30>>
goto lab26;
<<lab29>>
Z.C := Z.L - v_14;
-- call stem_suffix_chain_before_ki, line 390
R_Stem_suffix_chain_before_ki (Z, Result);
if not Result then
Z.C := Z.L - v_13;
goto lab25;
end if;
<<lab26>>
<<lab25>>
goto lab0;
<<lab24>>
Z.C := Z.L - v_1;
-- (, line 394
Z.Ket := Z.C; -- [, line 394
-- or, line 394
v_17 := Z.L - Z.C;
-- call mark_nUn, line 394
R_Mark_nUn (Z, Result);
if not Result then
goto lab33;
end if;
goto lab32;
<<lab33>>
Z.C := Z.L - v_17;
-- call mark_ylA, line 394
R_Mark_ylA (Z, Result);
if not Result then
goto lab31;
end if;
<<lab32>>
Z.Bra := Z.C; -- ], line 394
-- delete, line 394
Slice_Del (Z);
-- try, line 395
v_18 := Z.L - Z.C;
-- or, line 397
v_19 := Z.L - Z.C;
-- (, line 396
Z.Ket := Z.C; -- [, line 396
-- call mark_lAr, line 396
R_Mark_lAr (Z, Result);
if not Result then
goto lab36;
end if;
Z.Bra := Z.C; -- ], line 396
-- delete, line 396
Slice_Del (Z);
-- call stem_suffix_chain_before_ki, line 396
R_Stem_suffix_chain_before_ki (Z, Result);
if not Result then
goto lab36;
end if;
goto lab35;
<<lab36>>
Z.C := Z.L - v_19;
-- (, line 398
Z.Ket := Z.C; -- [, line 398
-- or, line 398
v_20 := Z.L - Z.C;
-- call mark_possessives, line 398
R_Mark_possessives (Z, Result);
if not Result then
goto lab39;
end if;
goto lab38;
<<lab39>>
Z.C := Z.L - v_20;
-- call mark_sU, line 398
R_Mark_sU (Z, Result);
if not Result then
goto lab37;
end if;
<<lab38>>
Z.Bra := Z.C; -- ], line 398
-- delete, line 398
Slice_Del (Z);
-- try, line 398
v_21 := Z.L - Z.C;
-- (, line 398
Z.Ket := Z.C; -- [, line 398
-- call mark_lAr, line 398
R_Mark_lAr (Z, Result);
if not Result then
Z.C := Z.L - v_21;
goto lab40;
end if;
Z.Bra := Z.C; -- ], line 398
-- delete, line 398
Slice_Del (Z);
-- call stem_suffix_chain_before_ki, line 398
R_Stem_suffix_chain_before_ki (Z, Result);
if not Result then
Z.C := Z.L - v_21;
goto lab40;
end if;
<<lab40>>
goto lab35;
<<lab37>>
Z.C := Z.L - v_19;
-- call stem_suffix_chain_before_ki, line 400
R_Stem_suffix_chain_before_ki (Z, Result);
if not Result then
Z.C := Z.L - v_18;
goto lab34;
end if;
<<lab35>>
<<lab34>>
goto lab0;
<<lab31>>
Z.C := Z.L - v_1;
-- (, line 404
Z.Ket := Z.C; -- [, line 404
-- call mark_lArI, line 404
R_Mark_lArI (Z, Result);
if not Result then
goto lab41;
end if;
Z.Bra := Z.C; -- ], line 404
-- delete, line 404
Slice_Del (Z);
goto lab0;
<<lab41>>
Z.C := Z.L - v_1;
-- call stem_suffix_chain_before_ki, line 406
R_Stem_suffix_chain_before_ki (Z, Result);
if not Result then
goto lab42;
end if;
goto lab0;
<<lab42>>
Z.C := Z.L - v_1;
-- (, line 408
Z.Ket := Z.C; -- [, line 408
-- or, line 408
v_22 := Z.L - Z.C;
-- call mark_DA, line 408
R_Mark_DA (Z, Result);
if not Result then
goto lab45;
end if;
goto lab44;
<<lab45>>
Z.C := Z.L - v_22;
-- call mark_yU, line 408
R_Mark_yU (Z, Result);
if not Result then
goto lab46;
end if;
goto lab44;
<<lab46>>
Z.C := Z.L - v_22;
-- call mark_yA, line 408
R_Mark_yA (Z, Result);
if not Result then
goto lab43;
end if;
<<lab44>>
Z.Bra := Z.C; -- ], line 408
-- delete, line 408
Slice_Del (Z);
-- try, line 408
v_23 := Z.L - Z.C;
-- (, line 408
Z.Ket := Z.C; -- [, line 408
-- or, line 408
v_24 := Z.L - Z.C;
-- (, line 408
-- call mark_possessives, line 408
R_Mark_possessives (Z, Result);
if not Result then
goto lab49;
end if;
Z.Bra := Z.C; -- ], line 408
-- delete, line 408
Slice_Del (Z);
-- try, line 408
v_25 := Z.L - Z.C;
-- (, line 408
Z.Ket := Z.C; -- [, line 408
-- call mark_lAr, line 408
R_Mark_lAr (Z, Result);
if not Result then
Z.C := Z.L - v_25;
goto lab50;
end if;
<<lab50>>
goto lab48;
<<lab49>>
Z.C := Z.L - v_24;
-- call mark_lAr, line 408
R_Mark_lAr (Z, Result);
if not Result then
Z.C := Z.L - v_23;
goto lab47;
end if;
<<lab48>>
Z.Bra := Z.C; -- ], line 408
-- delete, line 408
Slice_Del (Z);
Z.Ket := Z.C; -- [, line 408
-- call stem_suffix_chain_before_ki, line 408
R_Stem_suffix_chain_before_ki (Z, Result);
if not Result then
Z.C := Z.L - v_23;
goto lab47;
end if;
<<lab47>>
goto lab0;
<<lab43>>
Z.C := Z.L - v_1;
-- (, line 410
Z.Ket := Z.C; -- [, line 410
-- or, line 410
v_26 := Z.L - Z.C;
-- call mark_possessives, line 410
R_Mark_possessives (Z, Result);
if not Result then
goto lab52;
end if;
goto lab51;
<<lab52>>
Z.C := Z.L - v_26;
-- call mark_sU, line 410
R_Mark_sU (Z, Result);
if not Result then
Result := False;
return;
end if;
<<lab51>>
Z.Bra := Z.C; -- ], line 410
-- delete, line 410
Slice_Del (Z);
-- try, line 410
v_27 := Z.L - Z.C;
-- (, line 410
Z.Ket := Z.C; -- [, line 410
-- call mark_lAr, line 410
R_Mark_lAr (Z, Result);
if not Result then
Z.C := Z.L - v_27;
goto lab53;
end if;
Z.Bra := Z.C; -- ], line 410
-- delete, line 410
Slice_Del (Z);
-- call stem_suffix_chain_before_ki, line 410
R_Stem_suffix_chain_before_ki (Z, Result);
if not Result then
Z.C := Z.L - v_27;
goto lab53;
end if;
<<lab53>>
<<lab0>>
Result := True;
end R_Stem_noun_suffixes;
procedure R_Post_process_last_consonants (Z : in out Context_Type; Result : out Boolean) is
C : Result_Index;
A : Integer;
begin
-- (, line 413
Z.Ket := Z.C; -- [, line 414
-- substring, line 414
Find_Among_Backward (Z, A_23, Among_String, null, A);
if A = 0 then
Result := False;
return;
end if;
Z.Bra := Z.C; -- ], line 414
-- among, line 414
case A is
when 1 =>
-- (, line 415
-- <-, line 415
Slice_From (Z, "p");
when 2 =>
-- (, line 416
-- <-, line 416
Slice_From (Z, "ç");
when 3 =>
-- (, line 417
-- <-, line 417
Slice_From (Z, "t");
when 4 =>
-- (, line 418
-- <-, line 418
Slice_From (Z, "k");
when others =>
null;
end case;
Result := True;
end R_Post_process_last_consonants;
procedure R_Append_U_to_stems_ending_with_d_or_g (Z : in out Context_Type; Result : out Boolean) is
C : Result_Index;
A : Integer;
v_1 : Char_Index;
v_2 : Char_Index;
v_3 : Char_Index;
v_4 : Char_Index;
v_5 : Char_Index;
v_6 : Char_Index;
v_7 : Char_Index;
v_8 : Char_Index;
v_9 : Char_Index;
v_10 : Char_Index;
v_11 : Char_Index;
begin
-- (, line 428
-- test, line 429
v_1 := Z.L - Z.C;
-- or, line 429
v_2 := Z.L - Z.C;
-- literal, line 429
C := Eq_S_Backward (Z, "d");
if C = 0 then
goto lab1;
end if;
Z.C := Z.C - C;
goto lab0;
<<lab1>>
Z.C := Z.L - v_2;
-- literal, line 429
C := Eq_S_Backward (Z, "g");
if C = 0 then
Result := False;
return;
end if;
Z.C := Z.C - C;
<<lab0>>
Z.C := Z.L - v_1;
-- or, line 431
v_3 := Z.L - Z.C;
-- (, line 430
-- test, line 430
v_4 := Z.L - Z.C;
-- (, line 430
-- goto, line 430
Out_Grouping_Backward (Z, G_Vowel, 97, 305, True, C); if C < 0 then
goto lab3;
end if;
-- or, line 430
v_5 := Z.L - Z.C;
-- literal, line 430
C := Eq_S_Backward (Z, "a");
if C = 0 then
goto lab6;
end if;
Z.C := Z.C - C;
goto lab5;
<<lab6>>
Z.C := Z.L - v_5;
-- literal, line 430
C := Eq_S_Backward (Z, "ı");
if C = 0 then
goto lab3;
end if;
Z.C := Z.C - C;
<<lab5>>
Z.C := Z.L - v_4;
-- <+, line 430
C := Z.C;
Insert (Z, Z.C, Z.C, "ı");
Z.C := C;
goto lab2;
<<lab3>>
Z.C := Z.L - v_3;
-- (, line 432
-- test, line 432
v_6 := Z.L - Z.C;
-- (, line 432
-- goto, line 432
Out_Grouping_Backward (Z, G_Vowel, 97, 305, True, C); if C < 0 then
goto lab7;
end if;
-- or, line 432
v_7 := Z.L - Z.C;
-- literal, line 432
C := Eq_S_Backward (Z, "e");
if C = 0 then
goto lab10;
end if;
Z.C := Z.C - C;
goto lab9;
<<lab10>>
Z.C := Z.L - v_7;
-- literal, line 432
C := Eq_S_Backward (Z, "i");
if C = 0 then
goto lab7;
end if;
Z.C := Z.C - C;
<<lab9>>
Z.C := Z.L - v_6;
-- <+, line 432
C := Z.C;
Insert (Z, Z.C, Z.C, "i");
Z.C := C;
goto lab2;
<<lab7>>
Z.C := Z.L - v_3;
-- (, line 434
-- test, line 434
v_8 := Z.L - Z.C;
-- (, line 434
-- goto, line 434
Out_Grouping_Backward (Z, G_Vowel, 97, 305, True, C); if C < 0 then
goto lab11;
end if;
-- or, line 434
v_9 := Z.L - Z.C;
-- literal, line 434
C := Eq_S_Backward (Z, "o");
if C = 0 then
goto lab14;
end if;
Z.C := Z.C - C;
goto lab13;
<<lab14>>
Z.C := Z.L - v_9;
-- literal, line 434
C := Eq_S_Backward (Z, "u");
if C = 0 then
goto lab11;
end if;
Z.C := Z.C - C;
<<lab13>>
Z.C := Z.L - v_8;
-- <+, line 434
C := Z.C;
Insert (Z, Z.C, Z.C, "u");
Z.C := C;
goto lab2;
<<lab11>>
Z.C := Z.L - v_3;
-- (, line 436
-- test, line 436
v_10 := Z.L - Z.C;
-- (, line 436
-- goto, line 436
Out_Grouping_Backward (Z, G_Vowel, 97, 305, True, C); if C < 0 then
Result := False;
return;
end if;
-- or, line 436
v_11 := Z.L - Z.C;
-- literal, line 436
C := Eq_S_Backward (Z, "ö");
if C = 0 then
goto lab17;
end if;
Z.C := Z.C - C;
goto lab16;
<<lab17>>
Z.C := Z.L - v_11;
-- literal, line 436
C := Eq_S_Backward (Z, "ü");
if C = 0 then
Result := False;
return;
end if;
Z.C := Z.C - C;
<<lab16>>
Z.C := Z.L - v_10;
-- <+, line 436
C := Z.C;
Insert (Z, Z.C, Z.C, "ü");
Z.C := C;
<<lab2>>
Result := True;
end R_Append_U_to_stems_ending_with_d_or_g;
procedure R_Is_reserved_word (Z : in out Context_Type; Result : out Boolean) is
C : Result_Index;
A : Integer;
v_1 : Char_Index;
begin
-- (, line 439
-- literal, line 440
C := Eq_S_Backward (Z, "ad");
if C = 0 then
Result := False;
return;
end if;
Z.C := Z.C - C;
-- try, line 440
v_1 := Z.L - Z.C;
-- literal, line 440
C := Eq_S_Backward (Z, "soy");
if C = 0 then
Z.C := Z.L - v_1;
goto lab0;
end if;
Z.C := Z.C - C;
<<lab0>>
-- atlimit, line 440
if Z.C > Z.Lb then
Result := False;
return;
end if;
Result := True;
end R_Is_reserved_word;
procedure R_More_than_one_syllable_word (Z : in out Context_Type; Result : out Boolean) is
C : Result_Index;
A : Integer;
v_1 : Char_Index;
v_2 : Integer;
v_3 : Char_Index;
begin
-- test, line 447
v_1 := Z.C;
-- atleast, line 447
begin
v_2 := 2;
<<lab0>>
loop
v_3 := Z.C;
-- gopast, line 447
-- grouping vowel, line 447
Out_Grouping (Z, G_Vowel, 97, 305, True, C);
if C < 0 then
goto lab1;
end if;
Z.C := Z.C + C;
v_2 := v_2 - 1;
goto lab0;
<<lab1>>
Z.C := v_3;
exit;
end loop;
if v_2 > 0 then
Result := False;
return;
end if;
end;
Z.C := v_1;
Result := True;
end R_More_than_one_syllable_word;
procedure R_Postlude (Z : in out Context_Type; Result : out Boolean) is
C : Result_Index;
A : Integer;
v_1 : Char_Index;
v_2 : Char_Index;
v_3 : Char_Index;
begin
Z.Lb := Z.C; Z.C := Z.L; -- backwards, line 451
-- (, line 451
-- not, line 452
v_1 := Z.L - Z.C;
-- call is_reserved_word, line 452
R_Is_reserved_word (Z, Result);
if not Result then
goto lab0;
end if;
Result := False;
return;
<<lab0>>
Z.C := Z.L - v_1;
-- do, line 453
v_2 := Z.L - Z.C;
-- call append_U_to_stems_ending_with_d_or_g, line 453
R_Append_U_to_stems_ending_with_d_or_g (Z, Result);
Z.C := Z.L - v_2;
-- do, line 454
v_3 := Z.L - Z.C;
-- call post_process_last_consonants, line 454
R_Post_process_last_consonants (Z, Result);
Z.C := Z.L - v_3;
Z.C := Z.Lb;
Result := True;
end R_Postlude;
procedure Stem (Z : in out Context_Type; Result : out Boolean) is
C : Result_Index;
A : Integer;
v_1 : Char_Index;
v_2 : Char_Index;
begin
-- (, line 459
-- call more_than_one_syllable_word, line 460
R_More_than_one_syllable_word (Z, Result);
if not Result then
Result := False;
return;
end if;
-- (, line 461
Z.Lb := Z.C; Z.C := Z.L; -- backwards, line 462
-- (, line 462
-- do, line 463
v_1 := Z.L - Z.C;
-- call stem_nominal_verb_suffixes, line 463
R_Stem_nominal_verb_suffixes (Z, Result);
Z.C := Z.L - v_1;
-- Boolean test continue_stemming_noun_suffixes, line 464
if not Z.B_Continue_stemming_noun_suffixes then
Result := False;
return;
end if;
-- do, line 465
v_2 := Z.L - Z.C;
-- call stem_noun_suffixes, line 465
R_Stem_noun_suffixes (Z, Result);
Z.C := Z.L - v_2;
Z.C := Z.Lb;
-- call postlude, line 468
R_Postlude (Z, Result);
if not Result then
Result := False;
return;
end if;
Result := True;
end Stem;
end Stemmer.Turkish;
|
pragma License (Unrestricted);
-- with Ada.Task_Identification;
with Ada.Real_Time; -- use Ada.Real_Time;
package Ada.Execution_Time is
type CPU_Time is private;
CPU_Time_First : constant CPU_Time;
CPU_Time_Last : constant CPU_Time;
CPU_Time_Unit : constant :=
Duration'Delta; -- implementation-defined-real-number
-- CPU_Tick : constant Time_Span;
-- function Clock (
-- T : Task_Identification.Task_Id := Task_Identification.Current_Task)
-- return CPU_Time;
function Clock return CPU_Time; -- substitution
pragma Inline (Clock);
-- function "+" (Left : CPU_Time; Right : Time_Span) return CPU_Time;
-- function "+" (Left : Time_Span; Right : CPU_Time) return CPU_Time;
-- function "-" (Left : CPU_Time; Right : Time_Span) return CPU_Time;
function "-" (Left : CPU_Time; Right : CPU_Time) return Real_Time.Time_Span
with Import, Convention => Intrinsic;
-- function "<" (Left, Right : CPU_Time) return Boolean;
-- function "<=" (Left, Right : CPU_Time) return Boolean;
-- function ">" (Left, Right : CPU_Time) return Boolean;
-- function ">=" (Left, Right : CPU_Time) return Boolean;
-- procedure Split (T : CPU_Time; SC : out Seconds_Count; TS : out Time_Span);
-- function Time_Of (SC : Seconds_Count; TS : Time_Span := Time_Span_Zero)
-- return CPU_Time;
Interrupt_Clocks_Supported : constant Boolean :=
False; -- implementation-defined
Separate_Interrupt_Clocks_Supported : constant Boolean :=
False; -- implementation-defined
-- function Clock_For_Interrupts return CPU_Time;
private
type CPU_Time is new Real_Time.Time_Span; -- from 0.0
CPU_Time_First : constant CPU_Time := CPU_Time (Real_Time.Time_Span_First);
CPU_Time_Last : constant CPU_Time := CPU_Time (Real_Time.Time_Span_Last);
end Ada.Execution_Time;
|
-- ----------------------------------------------------------------- --
-- AdaSDL --
-- Binding to Simple Direct Media Layer --
-- Copyright (C) 2001 A.M.F.Vargas --
-- Antonio M. F. Vargas --
-- Ponta Delgada - Azores - Portugal --
-- http://www.adapower.net/~avargas --
-- E-mail: avargas@adapower.net --
-- ----------------------------------------------------------------- --
-- --
-- This library is free software; you can redistribute it and/or --
-- modify it under the terms of the GNU General Public --
-- License as published by the Free Software Foundation; either --
-- version 2 of the License, or (at your option) any later version. --
-- --
-- This library is distributed in the hope that it will be useful, --
-- but WITHOUT ANY WARRANTY; without even the implied warranty of --
-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU --
-- General Public License for more details. --
-- --
-- You should have received a copy of the GNU General Public --
-- License along with this library; if not, write to the --
-- Free Software Foundation, Inc., 59 Temple Place - Suite 330, --
-- Boston, MA 02111-1307, USA. --
-- --
-- As a special exception, if other files instantiate generics from --
-- this unit, or you link this unit with other files to produce an --
-- executable, this unit does not by itself cause the resulting --
-- executable to be covered by the GNU General Public License. This --
-- exception does not however invalidate any other reasons why the --
-- executable file might be covered by the GNU Public License. --
-- ----------------------------------------------------------------- --
-- **************************************************************** --
-- This is an Ada binding to SDL ( Simple DirectMedia Layer from --
-- Sam Lantinga - www.libsld.org ) --
-- **************************************************************** --
-- In order to help the Ada programmer, the comments in this file --
-- are, in great extent, a direct copy of the original text in the --
-- SDL header files. --
-- **************************************************************** --
with System;
with Interfaces.C;
with SDL.Types; use SDL.Types;
with SDL.Keyboard;
with SDL.Active;
with SDL.Mouse;
with SDL.Joystick;
package SDL.Events is
type Event_Type is new Interfaces.Unsigned_8;
for Event_Type'Size use 8;
-- pragma Convention (C, Event_Type);
package I renames Interfaces;
package M renames SDL.Mouse;
package Jy renames SDL.Joystick;
-- ------------------
-- Orginal C Event enumerations
-- ------------------
-- Unused (do not remove)
NOEVENT : constant Event_Type := 0;
-- Application loses/gains visibility
ISACTIVEEVENT : constant Event_Type := 1;
-- Keys pressed
KEYDOWN : constant Event_Type := 2;
-- Keys released
KEYUP : constant Event_Type := 3;
-- Mouse moved
MOUSEMOTION : constant Event_Type := 4;
-- Mouse button pressed
MOUSEBUTTONDOWN : constant Event_Type := 5;
-- Mouse button released
MOUSEBUTTONUP : constant Event_Type := 6;
-- Joystick axis motion
JOYAXISMOTION : constant Event_Type := 7;
-- Joystick trackball motion
JOYBALLMOTION : constant Event_Type := 8;
-- Joystick hat position change
JOYHATMOTION : constant Event_Type := 9;
-- Joystick button pressed
JOYBUTTONDOWN : constant Event_Type := 10;
-- Joystick button released
JOYBUTTONUP : constant Event_Type := 11;
-- User-requested quit
QUIT : constant Event_Type := 12;
-- System specific event
ISSYSWMEVENT : constant Event_Type := 13;
-- Reserved for future use..
EVENT_RESERVEDA : constant Event_Type := 14;
-- Reserved for future use..
EVENT_RESERVEDB : constant Event_Type := 15;
-- User resized video mode
VIDEORESIZE : constant Event_Type := 16;
-- Reserved for future use..
EVENT_RESERVED1 : constant Event_Type := 17;
-- Reserved for future use..
EVENT_RESERVED2 : constant Event_Type := 18;
-- Reserved for future use..
EVENT_RESERVED3 : constant Event_Type := 19;
-- Reserved for future use..
EVENT_RESERVED4 : constant Event_Type := 20;
-- Reserved for future use..
EVENT_RESERVED5 : constant Event_Type := 21;
-- Reserved for future use..
EVENT_RESERVED6 : constant Event_Type := 22;
-- Reserved for future use..
EVENT_RESERVED7 : constant Event_Type := 23;
-- Events USEREVENT through MAXEVENTS-1 are for your use
ISUSEREVENT : constant Event_Type := 24;
-- This last event is only for bounding internal arrays
-- It is the number of bits in the event mask datatype -- Uint32
NUMEVENTS : constant Event_Type := 32;
-- Predefined event masks
type Event_Mask is mod 2**Integer (NUMEVENTS);
ACTIVEEVENTMASK : constant Event_Mask :=
Event_Mask (I.Shift_Left (I.Unsigned_32 (1), Integer (ISACTIVEEVENT)));
KEYDOWNMASK : constant Event_Mask :=
Event_Mask (I.Shift_Left (I.Unsigned_32 (1), Integer (KEYDOWN)));
KEYUPMASK : constant Event_Mask :=
Event_Mask (I.Shift_Left (I.Unsigned_32 (1), Integer (KEYUP)));
MOUSEMOTIONMASK : constant Event_Mask :=
Event_Mask (I.Shift_Left (I.Unsigned_32 (1), Integer (MOUSEMOTION)));
MOUSEBUTTONDOWNMASK : constant Event_Mask :=
Event_Mask (I.Shift_Left (I.Unsigned_32 (1), Integer (MOUSEBUTTONDOWN)));
MOUSEBUTTONUPMASK : constant Event_Mask :=
Event_Mask (I.Shift_Left (I.Unsigned_32 (1), Integer (MOUSEBUTTONUP)));
MOUSEEVENTMASK : constant Event_Mask :=
Event_Mask (I.Shift_Left (I.Unsigned_32 (1), Integer (MOUSEMOTION))) or
Event_Mask (I.Shift_Left (I.Unsigned_32 (1), Integer (MOUSEBUTTONDOWN))) or
Event_Mask (I.Shift_Left (I.Unsigned_32 (1), Integer (MOUSEBUTTONUP)));
JOYAXISMOTIONMASK : constant Event_Mask :=
Event_Mask (I.Shift_Left (I.Unsigned_32 (1), Integer (JOYAXISMOTION)));
JOYBALLMOTIONMASK : constant Event_Mask :=
Event_Mask (I.Shift_Left (I.Unsigned_32 (1), Integer (JOYBALLMOTION)));
JOYHATMOTIONMASK : constant Event_Mask :=
Event_Mask (I.Shift_Left (I.Unsigned_32 (1), Integer (JOYHATMOTION)));
JOYBUTTONDOWNMASK : constant Event_Mask :=
Event_Mask (I.Shift_Left (I.Unsigned_32 (1), Integer (JOYBUTTONDOWN)));
JOYBUTTONUPMASK : constant Event_Mask :=
Event_Mask (I.Shift_Left (I.Unsigned_32 (1), Integer (JOYBUTTONUP)));
JOYEVENTMASK : constant Event_Mask :=
Event_Mask (I.Shift_Left (I.Unsigned_32 (1), Integer (JOYAXISMOTION))) or
Event_Mask (I.Shift_Left (I.Unsigned_32 (1), Integer (JOYBALLMOTION))) or
Event_Mask (I.Shift_Left (I.Unsigned_32 (1), Integer (JOYHATMOTION))) or
Event_Mask (I.Shift_Left (I.Unsigned_32 (1), Integer (JOYBUTTONDOWN))) or
Event_Mask (I.Shift_Left (I.Unsigned_32 (1), Integer (JOYBUTTONUP)));
VIDEORESIZEMASK : constant Event_Mask :=
Event_Mask (I.Shift_Left (I.Unsigned_32 (1), Integer (VIDEORESIZE)));
QUITMASK : constant Event_Mask :=
Event_Mask (I.Shift_Left (I.Unsigned_32 (1), Integer (QUIT)));
SYSWMEVENTMASK : constant Event_Mask :=
Event_Mask (I.Shift_Left (I.Unsigned_32 (1), Integer (ISSYSWMEVENT)));
ALLEVENTS : constant Event_Mask := 16#FFFFFFFF#;
-- Application visibility event structure
type ActiveEvent is
record
-- the_type, -- ISACTIVEEVENT
the_type : Event_Type; -- ISACTIVEEVENT;
gain, -- Whether given states were gained or lost (1/0)
state : SDL.Active.Active_State; -- A mask of the focus states
end record;
pragma Convention (C, ActiveEvent);
-- Keyboard event structure
type KeyboardEvent is
record
the_type : Event_Type; -- KEYDOWN or KEYUP
which : Uint8; -- The keyboard device index
state : Uint8; -- PRESSED or RELEASED
keysym : aliased SDL.Keyboard.keysym;
end record;
pragma Convention (C, KeyboardEvent);
-- Mouse motion event structure
type MouseMotionEvent is
record
the_type : Event_Type; -- MOUSEMOTION
which : Uint8; -- The mouse device index
state : Uint8; -- The current state
x, y : Uint16; -- The X/Y coordinates of the mouse
xrel : Sint16; -- The relative motion in the X direction
yrel : Sint16; -- The relative motion in the Y direction
end record;
pragma Convention (C, MouseMotionEvent);
-- Mouse button event structure
type MouseButtonEvent is
record
the_type : Event_Type; -- MOUSEBUTTONDOWN or MOUSEBUTTONUP
which : Uint8; -- The mouse device index
button : Uint8; -- The mouse button index
state : M.Mouse_Button_State; -- PRESSED or RELEASED
x, y : Uint16; -- The X/Y coordinates of the mouse at
-- press time
end record;
pragma Convention (C, MouseButtonEvent);
-- Joystick axis motion event structure
type JoyAxisEvent is
record
the_type : Event_Type; -- JOYAXISMOTION
which : Uint8; -- The joystick device index
axis : Uint8; -- The joystick axis index
value : Sint16; -- The axis value (range: -32768 to 32767)
end record;
pragma Convention (C, JoyAxisEvent);
-- Joystick trackball motion event structure
type JoyBallEvent is
record
the_type : Event_Type; -- JOYBALLMOTION
which : Uint8; -- The joystick device index
ball : Uint8; -- The joystick trackball index
xrel : Sint16; -- The relative motion in the X direction
yrel : Sint16; -- The relative motion in the Y direction
end record;
pragma Convention (C, JoyBallEvent);
-- Joystick hat position change event structure
type JoyHatEvent is
record
the_type : Event_Type; -- JOYHATMOTION
which : Uint8; -- The joystick device index
hat : Uint8; -- The joystick hat index
value : Jy.HAT_State; -- The hat position value
-- 8 1 2
-- 7 0 3
-- 6 5 4
-- Note that zero means the POV is centered.
end record;
pragma Convention (C, JoyHatEvent);
-- Joystick button event structure */
type JoyButtonEvent is
record
the_type : Event_Type; -- JOYBUTTONDOWN or JOYBUTTONUP
which : Uint8; -- The joystick device index
button : Uint8; -- The joystick button index
state : Uint8; -- PRESSED or RELEASED
end record;
pragma Convention (C, JoyButtonEvent);
-- The "window resized" event
-- When you get this event, you are responsible for setting a new video
-- mode with the new width and height.
type ResizeEvent is
record
the_type : Event_Type; -- VIDEORESIZE
w, h : C.int; -- New width and height
end record;
pragma Convention (C, ResizeEvent);
-- The "quit requested" event
type QuitEvent is
record
the_type : Event_Type; -- QUIT
end record;
pragma Convention (C, QuitEvent);
-- A user-defined event type
type UserEvent is
record
the_type : Event_Type; -- USEREVENT through NUMEVENTS-1
code : C.int; -- User defined event code
data1 : void_ptr; -- User defined data pointer
data2 : void_ptr; -- User defined data pointer
end record;
pragma Convention (C, UserEvent);
type SysWMmsg_ptr is new System.Address;
-- If you want to use this event, you should use SDL.Syswm
type SysWMEvent is
record
the_type : Event_Type;
msg : SysWMmsg_ptr;
end record;
pragma Convention (C, SysWMEvent);
type Event_Selection is (
Is_Event_Type,
Is_ActiveEvent,
Is_KeyboardEvent,
Is_MouseMotionEvent,
Is_MouseButtonEvent,
Is_JoyAxisEvent,
Is_JoyBallEvent,
Is_JoyHatEvent,
Is_JoyButtonEvent,
Is_ResizeEvent,
Is_QuitEvent,
Is_UserEvent,
Is_SysWMEvent);
-- General event structure
type Event (Event_Selec : Event_Selection := Is_Event_Type) is
record
case Event_Selec is
when Is_Event_Type => the_type : Event_Type;
when Is_ActiveEvent => active : ActiveEvent;
when Is_KeyboardEvent => key : KeyboardEvent;
when Is_MouseMotionEvent => motion : MouseMotionEvent;
when Is_MouseButtonEvent => button : MouseButtonEvent;
when Is_JoyAxisEvent => jaxis : JoyAxisEvent;
when Is_JoyBallEvent => jball : JoyBallEvent;
when Is_JoyHatEvent => jhat : JoyHatEvent;
when Is_JoyButtonEvent => jbutton : JoyButtonEvent;
when Is_ResizeEvent => resize : ResizeEvent;
when Is_QuitEvent => quit : QuitEvent;
when Is_UserEvent => user : UserEvent;
when Is_SysWMEvent => syswm : SysWMEvent;
end case;
end record;
pragma Convention (C, Event);
pragma Unchecked_Union (Event);
type Event_ptr is access all Event;
pragma Convention (C, Event_ptr);
-- -------------------
-- Function prototypes
-- -------------------
-- Pumps the event loop, gathering events from the input devices.
-- This function updates the event queue and internal input device state.
-- This should only be run in the thread that sets the video mode.
procedure PumpEvents;
pragma Import (C, PumpEvents, "SDL_PumpEvents");
-- Checks the event queue for messages and optionally returns them.
-- If 'action' is ADDEVENT, up to 'numevents' events will be added to
-- the back of the event queue.
-- If 'action' is PEEKEVENT, up to 'numevents' events at the front
-- of the event queue, matching 'mask', will be returned and will not
-- be removed from the queue.
-- If 'action' is GETEVENT, up to 'numevents' events at the front
-- of the event queue, matching 'mask', will be returned and will be
-- removed from the queue.
-- This function returns the number of events actually stored, or -1
-- if there was an error. This function is thread-safe.
type eventaction is new C.int;
ADDEVENT : constant := 0;
PEEKEVENT : constant := 1;
GETEVENT : constant := 2;
type Events_Array is array (Natural range <>) of Event;
procedure PeepEventsVP (
result : out C.int;
events : in out Events_Array;
numevents : C.int;
action : eventaction;
mask : Event_Mask);
pragma Import (C, PeepEventsVP, "SDL_PeepEvents");
pragma Import_Valued_Procedure (PeepEventsVP);
-- From Ada this function is to be called only as
-- ... := PeepEvents (null, 0, the_action, the_mask);
-- in other cases use PeepEventsVP.
function PeepEvents (
events : Event_ptr;
numevents : C.int;
action : eventaction;
mask : Event_Mask)
return C.int;
pragma Import (C, PeepEvents, "SDL_PeepEvents");
-- pending events, or 0 if there are none available. If 'event' is not
-- NULL, the next event is removed from the queue and stored in that area.
function PollEvent (the_event : access Event) return C.int;
pragma Import (C, PollEvent, "SDL_PollEvent");
-- Check the pending events. Doesn't remove them.
function Poll_Event return C.int;
pragma Inline (Poll_Event);
-- A corresponding Valued Procedure
procedure PollEventVP (result : out C.int; the_event : in out Event);
pragma Import (C, PollEventVP, "SDL_PollEvent");
pragma Import_Valued_Procedure (PollEventVP);
-- Waits indefinitely for the next available event, returning 1, or 0
-- if there was an error while waiting for events. If 'event' is not
-- NULL, the next event is removed from the queue and stored in that area.
function WaitEvent (event : Event_ptr) return C.int;
procedure WaitEvent (event : Event_ptr);
procedure WaitEvent (the_event : in out Event);
pragma Import (C, WaitEvent, "SDL_WaitEvent");
procedure Wait_Event (
Result : out C.int;
the_event : in out Event);
pragma Import (C, Wait_Event, "SDL_WaitEvent");
pragma Import_Valued_Procedure (Wait_Event);
function Wait_Any_Event return C.int;
pragma Inline (Wait_Any_Event);
-- Add an event to the event queue.
-- This function returns 0, or -1 if the event couldn't be added to
-- the event queue. If the event queue is full, this function fails.
function PushEvent (event : Event_ptr) return C.int;
procedure PushEvent (event : Event_ptr);
function PushEvent (the_event : Event) return C.int;
procedure PushEvent (the_event : Event);
pragma Import (C, PushEvent, "SDL_PushEvent");
-- This function sets up a filter to process all events before they
-- change internal state and are posted to the internal event queue.
-- The filter is protypted as:
type EventFilter_ptr is access function (event : Event_ptr) return C.int;
pragma Convention (C, EventFilter_ptr);
-- If the filter returns 1, then the event will be added to the internal
-- queue. If it returns 0, then the event will be dropped from the queue,
-- but the internal state will still be updated. This allows selective
-- filtering of dynamically arriving events.
-- WARNING: Be very careful of what you do in the event filter function,
-- as it may run in a different thread!
-- There is one caveat when dealing with the QUITEVENT event type. The
-- event filter is only called when the window manager desires to close the
-- application window. If the event filter returns 1, then the window will
-- be closed, otherwise the window will remain open if possible.
-- If the quit event is generated by an interrupt signal, it will bypass
-- the internal queue and be delivered to the application at the next event
-- poll.
procedure SetEventFilter (filter : EventFilter_ptr);
pragma Import (C, SetEventFilter, "SDL_SetEventFilter");
-- Return the current event filter - can be used to "chain" filters.
-- If there is no event filter set, this function returns NULL.
function GetEventFilter return EventFilter_ptr;
pragma Import (C, GetEventFilter, "SDL_GetEventFilter");
-- This function allows you to set the state of processing certain events.
-- If 'state' is set to IGNORE, that event will be automatically dropped
-- from the event queue and will not event be filtered.
-- If 'state' is set to ENABLE, that event will be processed normally.
-- If 'state' is set to QUERY, EventState will return the
-- current processing state of the specified event.
QUERY : constant := -1;
IGNORE : constant := 0;
DISABLE : constant := 0;
ENABLE : constant := 1;
function EventState (
the_type : Event_Type;
state : C.int) return Uint8;
procedure EventState (
the_type : Event_Type;
state : C.int);
pragma Import (C, EventState, "SDL_EventState");
end SDL.Events;
|
------------------------------------------------------------------------------
-- T M A L L O C --
-- --
-- Copyright (C) 2011, AdaCore --
-- --
-- This 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. Couverture 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. 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. --
-- --
------------------------------------------------------------------------------
with Ada.Numerics.Discrete_Random;
with Ada.Text_IO; use Ada.Text_IO;
with System.C.Malloc; use System.C.Malloc;
with System.C.Malloc.Ext; use System.C.Malloc.Ext;
use System;
use System.C;
with Heap;
procedure Tmalloc is
subtype Array_Range is Integer range 1 .. 256;
subtype Size_Range is Size_T range 0 .. 511;
package Arr_Random is new Ada.Numerics.Discrete_Random (Array_Range);
package Size_Random is new Ada.Numerics.Discrete_Random (Size_Range);
type Addr_Array is array (Natural range <>) of Address;
Addrs : Addr_Array (Array_Range) := (others => Null_Address);
P : Array_Range;
P_Gen : Arr_Random.Generator;
S_Gen : Size_Random.Generator;
S : size_t;
Verbose : constant Boolean := True;
begin
Arr_Random.Reset (P_Gen, 3);
Size_Random.Reset (S_Gen, 0);
for I in 1 .. 800_000 loop
P := Arr_Random.Random (P_Gen);
if Addrs (P) = Null_Address then
S := Size_Random.Random (S_Gen);
Addrs (P) := Alloc (S);
if Verbose then
Put_Line ("Alloc block" & Array_Range'Image (P)
& " = " & Image (Addrs (P)) & ", size ="
& size_t'Image (S));
end if;
else
if Verbose then
Put_Line ("Free block" & Array_Range'Image (P)
& " (addr = " & Image (Addrs (P)) & ")");
end if;
Free (Addrs (P));
Addrs (P) := Null_Address;
end if;
Check;
-- Disp_Stats;
-- Disp_Heap;
end loop;
Put_Line ("Freeing all blocks");
for I in Addrs'Range loop
Free (Addrs (I));
Check;
end loop;
Put_Line ("Heap at end:");
Disp_Heap;
end Tmalloc;
|
-- Abstract :
--
-- Procedural packrat parser, supporting only direct left recursion.
--
-- Coding style, algorithm is the same as generated by
-- wisi-generate_packrat, but in procedural form.
--
-- References:
--
-- See parent.
--
-- Copyright (C) 2018 - 2020 Free Software Foundation, Inc.
--
-- This library is free software; you can redistribute it and/or modify it
-- under terms of the GNU General Public License as published by the Free
-- Software Foundation; either version 3, or (at your option) any later
-- version. This library is distributed in the hope that it will be useful,
-- but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHAN-
-- TABILITY or FITNESS FOR A PARTICULAR PURPOSE.
-- As a special exception under Section 7 of GPL version 3, you are granted
-- additional permissions described in the GCC Runtime Library Exception,
-- version 3.1, as published by the Free Software Foundation.
pragma License (Modified_GPL);
with WisiToken.Productions;
package WisiToken.Parse.Packrat.Procedural is
-- These types duplicate Packrat.Generated. We keep them separate so
-- we can experiment with ways of implementing indirect left
-- recursion.
type Memo_State is (No_Result, Failure, Success);
subtype Result_States is Memo_State range Failure .. Success;
type Memo_Entry (State : Memo_State := No_Result) is record
case State is
when No_Result =>
null;
when Failure =>
null;
when Success =>
Result : WisiToken.Valid_Node_Index;
Last_Pos : Base_Token_Index;
end case;
end record;
package Memos is new SAL.Gen_Unbounded_Definite_Vectors
(Token_Index, Memo_Entry, Default_Element => (others => <>));
type Derivs is array (Token_ID range <>) of Memos.Vector;
type Parser (First_Nonterminal, Last_Nonterminal : Token_ID) is new Packrat.Parser with
record
Grammar : WisiToken.Productions.Prod_Arrays.Vector;
Start_ID : Token_ID;
Direct_Left_Recursive : Token_ID_Set (First_Nonterminal .. Last_Nonterminal);
Derivs : Procedural.Derivs (First_Nonterminal .. Last_Nonterminal);
end record;
function Create
(Grammar : in WisiToken.Productions.Prod_Arrays.Vector;
Direct_Left_Recursive : in Token_ID_Set;
Start_ID : in Token_ID;
Trace : access WisiToken.Trace'Class;
Lexer : WisiToken.Lexer.Handle;
User_Data : WisiToken.Syntax_Trees.User_Data_Access)
return Procedural.Parser;
overriding procedure Parse (Parser : aliased in out Procedural.Parser);
overriding function Tree (Parser : in Procedural.Parser) return Syntax_Trees.Tree;
overriding function Tree_Var_Ref
(Parser : aliased in out Procedural.Parser)
return Syntax_Trees.Tree_Variable_Reference;
overriding function Any_Errors (Parser : in Procedural.Parser) return Boolean
is (False);
-- All errors are reported by Parse raising Syntax_Error.
overriding procedure Put_Errors (Parser : in Procedural.Parser)
is null;
end WisiToken.Parse.Packrat.Procedural;
|
with Ada.Text_IO, Cards, Deck;
use Ada.Text_IO, Cards, Deck;
procedure HiLo is
Old_Card : Card;
New_Card : Card;
First_Draw : Boolean := True;
type Choice_Type is (Higher, Lower);
Choice : Choice_Type;
Input : Character;
begin
Old_Card := Deck.Draw;
loop
New_Card := Deck.Draw;
if First_Draw then
First_Draw := False;
else
if Choice = Higher and then New_Card.Face > Old_Card.Face then
Put_Line("You were right!");
elsif Choice = Lower and then New_Card.Face < Old_Card.Face then
Put_Line("You were right!");
else
Put_Line("You were wrong!");
end if;
end if;
Put_Line("Drew: " & Image(New_Card));
<<EnterChoice>>
Put("[H]igher or [L]ower? ");
Get_Immediate(Input);
case Input is
when 'h' | 'H' => Choice := Higher;
when 'l' | 'L' => Choice := Lower;
when 'q' | 'Q' => return;
when others =>
New_Line;
goto EnterChoice;
end case;
New_Line;
Old_Card := New_Card;
end loop;
end HiLo;
|
------------------------------------------------------------------------------
-- --
-- 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 body OV7725 is
type Addr_And_Data is record
Addr, Data : UInt8;
end record;
type Command_Array is array (Natural range <>) of Addr_And_Data;
Setup_Commands : constant Command_Array :=
((REG_COM3, COM3_SWAP_YUV),
(REG_COM7, COM7_RES_VGA or COM7_FMT_RGB565 or COM7_FMT_RGB),
(REG_COM4, 16#41#),
(REG_CLKRC, 16#C0#),
(REG_HSTART, 16#23#),
(REG_HSIZE, 16#A0#),
(REG_VSTART, 16#07#),
(REG_VSIZE, 16#F0#),
(REG_HREF, 16#00#),
(REG_HOUTSIZE, 16#50#),
(REG_VOUTSIZE, 16#78#),
(REG_COM12, 16#03#),
(REG_EXHCH, 16#00#),
(REG_TGT_B, 16#7F#),
(REG_FIXGAIN, 16#09#),
(REG_AWB_CTRL0, 16#E0#),
(REG_DSP_CTRL1, 16#FF#),
(REG_DSP_CTRL2, DSP_CTRL2_VDCW_EN or DSP_CTRL2_HDCW_EN or
DSP_CTRL2_HZOOM_EN or DSP_CTRL2_VZOOM_EN),
(REG_DSP_CTRL3, 16#00#),
(REG_DSP_CTRL4, 16#00#),
(REG_DSPAUTO, 16#FF#),
(REG_COM8, 16#F0#),
(REG_COM6, 16#C5#),
(REG_COM9, 16#21#),
(REG_BDBASE, 16#7F#),
(REG_DBSTEP, 16#03#),
(REG_AEW, 16#96#),
(REG_AEB, 16#64#),
(REG_VPT, 16#A1#),
(REG_EXHCL, 16#00#),
(REG_AWB_CTRL3, 16#AA#),
(REG_COM8, 16#FF#),
(REG_GAM1, 16#0C#),
(REG_GAM2, 16#16#),
(REG_GAM3, 16#2A#),
(REG_GAM4, 16#4E#),
(REG_GAM5, 16#61#),
(REG_GAM6, 16#6F#),
(REG_GAM7, 16#7B#),
(REG_GAM8, 16#86#),
(REG_GAM9, 16#8E#),
(REG_GAM10, 16#97#),
(REG_GAM11, 16#A4#),
(REG_GAM12, 16#AF#),
(REG_GAM13, 16#C5#),
(REG_GAM14, 16#D7#),
(REG_GAM15, 16#E8#),
(REG_SLOP, 16#20#),
(REG_EDGE1, 16#05#),
(REG_EDGE2, 16#03#),
(REG_EDGE3, 16#00#),
(REG_DNSOFF, 16#01#),
(REG_MTX1, 16#B0#),
(REG_MTX2, 16#9D#),
(REG_MTX3, 16#13#),
(REG_MTX4, 16#16#),
(REG_MTX5, 16#7B#),
(REG_MTX6, 16#91#),
(REG_MTX_CTRL, 16#1E#),
(REG_BRIGHTNESS, 16#08#),
(REG_CONTRAST, 16#20#),
(REG_UVADJ0, 16#81#),
(REG_SDE, (SDE_CONT_BRIGHT_EN or SDE_SATURATION_EN)),
(REG_DM_LNL, 16#00#),
(REG_DM_LNH, 16#00#),
(REG_BDBASE, 16#7F#),
(REG_DBSTEP, 16#03#),
(REG_LC_RADI, 16#10#),
(REG_LC_COEF, 16#10#),
(REG_LC_COEFB, 16#14#),
(REG_LC_COEFR, 16#17#),
(REG_LC_CTR, 16#05#),
(REG_COM5, 16#D5#));
function Read (This : OV7725_Camera;
Mem_Addr : UInt8) return UInt8;
procedure Write (This : OV7725_Camera;
Mem_Addr : UInt8;
Data : UInt8);
----------
-- Read --
----------
function Read (This : OV7725_Camera;
Mem_Addr : UInt8) return UInt8
is
Status : I2C_Status;
Data : I2C_Data (1 .. 1);
begin
This.I2C.Master_Transmit (Addr => This.Addr,
Data => (1 => Mem_Addr),
Status => Status);
if Status /= Ok then
raise Program_Error;
end if;
This.I2C.Master_Receive (Addr => This.Addr,
Data => Data,
Status => Status);
if Status /= Ok then
raise Program_Error;
end if;
return Data (Data'First);
end Read;
-----------
-- Write --
-----------
procedure Write (This : OV7725_Camera;
Mem_Addr : UInt8;
Data : UInt8)
is
Status : I2C_Status;
begin
This.I2C.Master_Transmit (Addr => This.Addr,
Data => (1 => Mem_Addr, 2 => Data),
Status => Status);
if Status /= Ok then
raise Program_Error;
end if;
end Write;
----------------
-- Initialize --
----------------
procedure Initialize
(This : in out OV7725_Camera;
Addr : I2C_Address)
is
begin
This.Addr := Addr;
for Elt of Setup_Commands loop
Write (This, Elt.Addr, Elt.Data);
end loop;
end Initialize;
----------------------
-- Set_Pixel_Format --
----------------------
procedure Set_Pixel_Format
(This : OV7725_Camera;
Pix : Pixel_Format)
is
Reg : UInt8 := Read (This, REG_COM7);
begin
Reg := Reg and 2#1111_00_11#;
case Pix is
when Pix_RGB565 =>
Reg := Reg or 2#0000_01_00#;
when Pix_RGB555 =>
Reg := Reg or 2#0000_10_00#;
when Pix_RGB444 =>
Reg := Reg or 2#0000_11_00#;
end case;
Write (This, REG_COM7, Reg);
Reg := Read (This, REG_COM3);
Write (This, REG_COM3, Reg and 2#0000_1000#); -- SWAP MSB/LSB
end Set_Pixel_Format;
--------------------
-- Set_Frame_Size --
--------------------
procedure Set_Frame_Size
(This : OV7725_Camera;
Res : OV2640.Frame_Size)
is
use type OV2640.Frame_Size;
Width : constant UInt16 := OV2640.Resolutions (Res).Width;
Height : constant UInt16 := OV2640.Resolutions (Res).Height;
begin
Write (This, REG_HOUTSIZE, UInt8 (Shift_Right (Width, 2)));
Write (This, REG_VOUTSIZE, UInt8 (Shift_Right (Height, 1)));
Write (This, REG_EXHCH,
UInt8 (Width and 2#0111#)
or
Shift_Left (UInt8 (Height and 2#0001#), 2));
if Res < OV2640.VGA then
Write (This, REG_DSPAUTO, 16#FF#);
else
Write (This, REG_DSPAUTO, 16#F3#);
Write (This, REG_SCAL0, 16#00#);
Write (This, REG_SCAL1, 16#00#);
Write (This, REG_SCAL2, 16#00#);
end if;
end Set_Frame_Size;
-------------
-- Get_PID --
-------------
function Get_PID (This : OV7725_Camera) return UInt8 is
begin
return Read (This, REG_PID);
end Get_PID;
end OV7725;
|
-------------------------------------------------------------------------------
-- This file is part of libsparkcrypto.
--
-- Copyright (C) 2011, Stefan Berghofer
-- Copyright (C) 2011, 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 author nor the names of its contributors may be
-- used to endorse or promote products derived from this software without
-- specific prior written permission.
--
-- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
-- AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-- IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
-- ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS
-- BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
-- CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
-- SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
-- INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
-- CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
-- ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
-- POSSIBILITY OF SUCH DAMAGE.
-------------------------------------------------------------------------------
with Interfaces;
with LSC.Internal.Byteorder32;
package body LSC.Internal.Bignum
is
function GCD (A, B : Types.Word32) return Types.Word32
with Ghost, Import, Global => null;
----------------------------------------------------------------------------
procedure Initialize
(A : out Big_Int;
A_First : in Natural;
A_Last : in Natural)
is
begin
for I in Natural range A_First .. A_Last
loop
pragma Warnings (Off, """A"" may be referenced before it has a value");
pragma Loop_Invariant
(for all K in Natural range A_First .. I - 1 => (A (K) = 0));
pragma Warnings (On, """A"" may be referenced before it has a value");
pragma Annotate
(GNATprove, False_Positive,
"""A"" might not be initialized",
"Initialized between A_First and A_Last");
A (I) := 0;
end loop;
end Initialize;
pragma Annotate
(GNATprove, False_Positive,
"""A"" might not be initialized",
"Initialized between A_First and A_Last");
pragma Annotate
(GNATprove, False_Positive,
"""A"" might not be initialized in ""Initialize""",
"Initialized between A_First and A_Last");
----------------------------------------------------------------------------
procedure Copy
(A : in Big_Int;
A_First : in Natural;
A_Last : in Natural;
B : in out Big_Int;
B_First : in Natural)
is
begin
for I in Natural range A_First .. A_Last
loop
pragma Loop_Invariant
(for all K in Natural range B'Range =>
((if K in B_First .. B_First + I - A_First - 1 then
B (K) = A (A_First + K - B_First)) and
(if K not in B_First .. B_First + I - A_First - 1 then
B (K) = B'Loop_Entry (K))));
B (B_First + (I - A_First)) := A (I);
pragma Assert_And_Cut
(for all K in Natural range B'Range =>
((if K in B_First .. B_First + (I + 1) - A_First - 1 then
B (K) = A (A_First + K - B_First)) and
(if K not in B_First .. B_First + (I + 1) - A_First - 1 then
B (K) = B'Loop_Entry (K))));
end loop;
end Copy;
----------------------------------------------------------------------------
procedure Native_To_BE
(A : in Big_Int;
A_First : in Natural;
A_Last : in Natural;
B : out Big_Int;
B_First : in Natural)
is
begin
for I in Natural range A_First .. A_Last
loop
B (B_First + (A_Last - I)) := Byteorder32.Native_To_BE (A (I));
pragma Annotate
(GNATprove, False_Positive,
"""B"" might not be initialized",
"Copied between A_First and A_Last");
end loop;
end Native_To_BE;
pragma Annotate
(GNATprove, False_Positive,
"""B"" might not be initialized in ""Native_To_Be""",
"Copied between A_First and A_Last");
----------------------------------------------------------------------------
function Word_Of_Boolean (B : Boolean) return Types.Word32
with Post =>
Math_Int.From_Word32 (Word_Of_Boolean'Result) = Num_Of_Boolean (B);
function Word_Of_Boolean (B : Boolean) return Types.Word32
is
Result : Types.Word32;
begin
if B then
Result := 1;
else
Result := 0;
end if;
return Result;
end Word_Of_Boolean;
----------------------------------------------------------------------------
procedure Double_Inplace
(A : in out Big_Int;
A_First : in Natural;
A_Last : in Natural;
Carry : out Boolean)
is
New_Carry : Boolean;
begin
Carry := False;
for I in Natural range A_First .. A_Last
loop
pragma Loop_Invariant
(Num_Of_Big_Int (A'Loop_Entry, A_First, I - A_First) *
Math_Int.From_Word32 (2) =
Num_Of_Big_Int (A, A_First, I - A_First) +
Base ** (I - A_First) * Num_Of_Boolean (Carry) and
(for all K in Natural range I .. A_Last =>
(A (K) = A'Loop_Entry (K))));
New_Carry := (A (I) and 2 ** 31) /= 0;
A (I) := Interfaces.Shift_Left (A (I), 1) + Word_Of_Boolean (Carry);
Carry := New_Carry;
pragma Assert_And_Cut
(Num_Of_Big_Int (A'Loop_Entry, A_First, (I + 1) - A_First) *
Math_Int.From_Word32 (2) =
Num_Of_Big_Int (A, A_First, (I + 1) - A_First) +
Base ** ((I + 1) - A_First) * Num_Of_Boolean (Carry) and
(for all K in Natural range I + 1 .. A_Last =>
(A (K) = A'Loop_Entry (K))));
end loop;
end Double_Inplace;
----------------------------------------------------------------------------
procedure SHR_Inplace
(A : in out Big_Int;
A_First : in Natural;
A_Last : in Natural;
K : in Natural)
is
H1, H2 : Types.Word32;
begin
H1 := 0;
for I in reverse Natural range A_First .. A_Last
loop
pragma Loop_Invariant
(Num_Of_Big_Int (A'Loop_Entry, I + 1, A_Last - I) =
Num_Of_Big_Int (A, I + 1, A_Last - I) *
Math_Int.From_Word32 (2) ** K +
Math_Int.From_Word32 (H1) mod Math_Int.From_Word32 (2) ** K and
(for all J in Natural range A_First .. I =>
(A (J) = A'Loop_Entry (J))));
H2 := A (I);
A (I) :=
Interfaces.Shift_Right (A (I), K) +
Interfaces.Shift_Left (H1, 32 - K);
H1 := H2;
pragma Assert_And_Cut
(Num_Of_Big_Int (A'Loop_Entry, (I - 1) + 1, A_Last - (I - 1)) =
Num_Of_Big_Int (A, (I - 1) + 1, A_Last - (I - 1)) *
Math_Int.From_Word32 (2) ** K +
Math_Int.From_Word32 (H1) mod Math_Int.From_Word32 (2) ** K and
(for all J in Natural range A_First .. I - 1 =>
(A (J) = A'Loop_Entry (J))));
end loop;
end SHR_Inplace;
----------------------------------------------------------------------------
procedure Add_Inplace
(A : in out Big_Int;
A_First : in Natural;
A_Last : in Natural;
B : in Big_Int;
B_First : in Natural;
Carry : out Boolean)
is
H : Types.Word32;
begin
Carry := False;
for I in Natural range A_First .. A_Last
loop
pragma Loop_Invariant
(Num_Of_Big_Int (A'Loop_Entry, A_First, I - A_First) +
Num_Of_Big_Int (B, B_First, I - A_First) =
Num_Of_Big_Int (A, A_First, I - A_First) +
Base ** (I - A_First) * Num_Of_Boolean (Carry) and
(for all K in Natural range I .. A_Last =>
(A (K) = A'Loop_Entry (K))));
H := A (I) + B (B_First + (I - A_First)) + Word_Of_Boolean (Carry);
Carry := H < A (I) or (H = A (I) and Carry);
A (I) := H;
pragma Assert_And_Cut
(Num_Of_Big_Int (A'Loop_Entry, A_First, (I + 1) - A_First) +
Num_Of_Big_Int (B, B_First, (I + 1) - A_First) =
Num_Of_Big_Int (A, A_First, (I + 1) - A_First) +
Base ** ((I + 1) - A_First) * Num_Of_Boolean (Carry) and
(for all K in Natural range I + 1 .. A_Last =>
(A (K) = A'Loop_Entry (K))));
end loop;
end Add_Inplace;
----------------------------------------------------------------------------
procedure Add
(A : out Big_Int;
A_First : in Natural;
A_Last : in Natural;
B : in Big_Int;
B_First : in Natural;
C : in Big_Int;
C_First : in Natural;
Carry : out Boolean)
is
J : Natural;
H : Types.Word32;
begin
Carry := False;
for I in Natural range A_First .. A_Last
loop
pragma Warnings (Off, """A"" may be referenced before it has a value");
pragma Loop_Invariant
(Num_Of_Big_Int (B, B_First, I - A_First) +
Num_Of_Big_Int (C, C_First, I - A_First) =
Num_Of_Big_Int (A, A_First, I - A_First) +
Base ** (I - A_First) * Num_Of_Boolean (Carry));
pragma Warnings (On, """A"" may be referenced before it has a value");
pragma Annotate
(GNATprove, False_Positive,
"""A"" might not be initialized",
"Initialized between A_First and A_Last");
J := I - A_First;
H := B (B_First + J) + C (C_First + J) + Word_Of_Boolean (Carry);
Carry := H < B (B_First + J) or (H = B (B_First + J) and Carry);
A (I) := H;
pragma Assert_And_Cut
(Num_Of_Big_Int (B, B_First, (I + 1) - A_First) +
Num_Of_Big_Int (C, C_First, (I + 1) - A_First) =
Num_Of_Big_Int (A, A_First, (I + 1) - A_First) +
Base ** ((I + 1) - A_First) * Num_Of_Boolean (Carry));
pragma Annotate
(GNATprove, False_Positive,
"""A"" might not be initialized",
"Initialized between A_First and A_Last");
end loop;
end Add;
pragma Annotate
(GNATprove, False_Positive,
"""A"" might not be initialized",
"Initialized between A_First and A_Last");
pragma Annotate
(GNATprove, False_Positive,
"""A"" might not be initialized in ""Add""",
"Initialized between A_First and A_Last");
----------------------------------------------------------------------------
procedure Sub_Inplace
(A : in out Big_Int;
A_First : in Natural;
A_Last : in Natural;
B : in Big_Int;
B_First : in Natural;
Carry : out Boolean)
is
J : Natural;
New_Carry : Boolean;
begin
Carry := False;
for I in Natural range A_First .. A_Last
loop
pragma Loop_Invariant
(Num_Of_Big_Int (A'Loop_Entry, A_First, I - A_First) -
Num_Of_Big_Int (B, B_First, I - A_First) =
Num_Of_Big_Int (A, A_First, I - A_First) -
Base ** (I - A_First) * Num_Of_Boolean (Carry) and
(for all K in Natural range I .. A_Last =>
(A (K) = A'Loop_Entry (K))));
J := B_First + (I - A_First);
New_Carry := A (I) < B (J) or else (A (I) = B (J) and then Carry);
A (I) := (A (I) - B (J)) - Word_Of_Boolean (Carry);
Carry := New_Carry;
pragma Assert_And_Cut
(Num_Of_Big_Int (A'Loop_Entry, A_First, (I + 1) - A_First) -
Num_Of_Big_Int (B, B_First, (I + 1) - A_First) =
Num_Of_Big_Int (A, A_First, (I + 1) - A_First) -
Base ** ((I + 1) - A_First) * Num_Of_Boolean (Carry) and
(for all K in Natural range I + 1 .. A_Last =>
(A (K) = A'Loop_Entry (K))));
end loop;
end Sub_Inplace;
----------------------------------------------------------------------------
procedure Sub
(A : out Big_Int;
A_First : in Natural;
A_Last : in Natural;
B : in Big_Int;
B_First : in Natural;
C : in Big_Int;
C_First : in Natural;
Carry : out Boolean)
is
J : Natural;
New_Carry : Boolean;
begin
Carry := False;
for I in Natural range A_First .. A_Last
loop
pragma Warnings (Off, """A"" may be referenced before it has a value");
pragma Loop_Invariant
(Num_Of_Big_Int (B, B_First, I - A_First) -
Num_Of_Big_Int (C, C_First, I - A_First) =
Num_Of_Big_Int (A, A_First, I - A_First) -
Base ** (I - A_First) * Num_Of_Boolean (Carry));
pragma Warnings (On, """A"" may be referenced before it has a value");
pragma Annotate
(GNATprove, False_Positive,
"""A"" might not be initialized",
"Initialized between A_First and A_Last");
J := I - A_First;
New_Carry := B (B_First + J) < C (C_First + J) or else
(B (B_First + J) = C (C_First + J) and then Carry);
A (I) := (B (B_First + J) - C (C_First + J)) - Word_Of_Boolean (Carry);
Carry := New_Carry;
pragma Assert_And_Cut
(Num_Of_Big_Int (B, B_First, (I + 1) - A_First) -
Num_Of_Big_Int (C, C_First, (I + 1) - A_First) =
Num_Of_Big_Int (A, A_First, (I + 1) - A_First) -
Base ** ((I + 1) - A_First) * Num_Of_Boolean (Carry));
pragma Annotate
(GNATprove, False_Positive,
"""A"" might not be initialized",
"Initialized between A_First and A_Last");
end loop;
end Sub;
pragma Annotate
(GNATprove, False_Positive,
"""A"" might not be initialized",
"Initialized between A_First and A_Last");
pragma Annotate
(GNATprove, False_Positive,
"""A"" might not be initialized in ""Sub""",
"Initialized between A_First and A_Last");
----------------------------------------------------------------------------
procedure Mod_Add_Inplace
(A : in out Big_Int;
A_First : in Natural;
A_Last : in Natural;
B : in Big_Int;
B_First : in Natural;
M : in Big_Int;
M_First : in Natural)
is
Carry : Boolean;
begin
Add_Inplace (A, A_First, A_Last, B, B_First, Carry);
if Carry then
pragma Warnings (Off, "unused assignment to ""Carry""");
Sub_Inplace (A, A_First, A_Last, M, M_First, Carry);
pragma Warnings (On, "unused assignment to ""Carry""");
end if;
end Mod_Add_Inplace;
----------------------------------------------------------------------------
procedure Mod_Add
(A : out Big_Int;
A_First : in Natural;
A_Last : in Natural;
B : in Big_Int;
B_First : in Natural;
C : in Big_Int;
C_First : in Natural;
M : in Big_Int;
M_First : in Natural)
is
Carry : Boolean;
begin
Add (A, A_First, A_Last, B, B_First, C, C_First, Carry);
if Carry then
pragma Warnings (Off, "unused assignment to ""Carry""");
Sub_Inplace (A, A_First, A_Last, M, M_First, Carry);
pragma Warnings (On, "unused assignment to ""Carry""");
end if;
end Mod_Add;
----------------------------------------------------------------------------
procedure Mod_Sub_Inplace
(A : in out Big_Int;
A_First : in Natural;
A_Last : in Natural;
B : in Big_Int;
B_First : in Natural;
M : in Big_Int;
M_First : in Natural)
is
Carry : Boolean;
begin
Sub_Inplace (A, A_First, A_Last, B, B_First, Carry);
if Carry then
pragma Warnings (Off, "unused assignment to ""Carry""");
Add_Inplace (A, A_First, A_Last, M, M_First, Carry);
pragma Warnings (On, "unused assignment to ""Carry""");
end if;
end Mod_Sub_Inplace;
----------------------------------------------------------------------------
procedure Mod_Sub
(A : out Big_Int;
A_First : in Natural;
A_Last : in Natural;
B : in Big_Int;
B_First : in Natural;
C : in Big_Int;
C_First : in Natural;
M : in Big_Int;
M_First : in Natural)
is
Carry : Boolean;
begin
Sub (A, A_First, A_Last, B, B_First, C, C_First, Carry);
if Carry then
pragma Warnings (Off, "unused assignment to ""Carry""");
Add_Inplace (A, A_First, A_Last, M, M_First, Carry);
pragma Warnings (On, "unused assignment to ""Carry""");
end if;
end Mod_Sub;
----------------------------------------------------------------------------
function Is_Zero
(A : Big_Int;
A_First : Natural;
A_Last : Natural)
return Boolean
is
Result : Boolean;
begin
Result := True;
for I in Natural range A_First .. A_Last
loop
pragma Loop_Invariant
(Result =
(for all J in Natural range A_First .. I - 1 =>
(A (J) = 0)));
if A (I) /= 0 then
Result := False;
exit;
end if;
end loop;
return Result;
end Is_Zero;
----------------------------------------------------------------------------
function Equal
(A : Big_Int;
A_First : Natural;
A_Last : Natural;
B : Big_Int;
B_First : Natural)
return Boolean
is
Result : Boolean;
begin
Result := True;
for I in Natural range A_First .. A_Last
loop
pragma Loop_Invariant
(Result =
(for all J in Natural range A_First .. I - 1 =>
(A (J) = B (B_First + (J - A_First)))));
if A (I) /= B (B_First + (I - A_First)) then
Result := False;
exit;
end if;
end loop;
return Result;
end Equal;
----------------------------------------------------------------------------
function Less
(A : Big_Int;
A_First : Natural;
A_Last : Natural;
B : Big_Int;
B_First : Natural)
return Boolean
is
J : Natural;
Result : Boolean;
begin
Result := False;
for I in reverse Natural range A_First .. A_Last
loop
pragma Loop_Invariant
(Num_Of_Big_Int (A, I + 1, A_Last - I) =
Num_Of_Big_Int (B, B_First + (I - A_First) + 1, A_Last - I) and
not Result);
J := B_First + (I - A_First);
if A (I) < B (J) then
Result := True;
exit;
end if;
exit when A (I) > B (J);
end loop;
return Result;
end Less;
----------------------------------------------------------------------------
procedure Size_Square_Mod
(M : in Big_Int;
M_First : in Natural;
M_Last : in Natural;
R : out Big_Int;
R_First : in Natural)
is
R_Last : Natural;
Carry : Boolean;
begin
R_Last := R_First + (M_Last - M_First);
Initialize (R, R_First, R_Last);
R (R_First) := 1;
for I in Natural range M_First .. M_Last
loop
pragma Loop_Invariant
(Num_Of_Big_Int (R, R_First, M_Last - M_First + 1) =
Base ** (Math_Int.From_Integer (2) *
Math_Int.From_Integer (I - M_First)) mod
Num_Of_Big_Int (M, M_First, M_Last - M_First + 1) and
R_Last = R_First + (M_Last - M_First));
for J in Natural range 0 .. 63
loop
pragma Loop_Invariant
(Num_Of_Big_Int (R, R_First, M_Last - M_First + 1) =
Base ** (Math_Int.From_Integer (2) *
Math_Int.From_Integer (I - M_First)) *
Math_Int.From_Word32 (2) ** J mod
Num_Of_Big_Int (M, M_First, M_Last - M_First + 1) and
R_Last = R_First + (M_Last - M_First));
Double_Inplace (R, R_First, R_Last, Carry);
if Carry or else not Less (R, R_First, R_Last, M, M_First) then
pragma Warnings (Off, "unused assignment to ""Carry""");
Sub_Inplace (R, R_First, R_Last, M, M_First, Carry);
pragma Warnings (On, "unused assignment to ""Carry""");
end if;
pragma Assert_And_Cut
(Num_Of_Big_Int (R, R_First, M_Last - M_First + 1) =
Base ** (Math_Int.From_Integer (2) *
Math_Int.From_Integer (I - M_First)) *
Math_Int.From_Word32 (2) ** (J + 1) mod
Num_Of_Big_Int (M, M_First, M_Last - M_First + 1) and
R_Last = R_First + (M_Last - M_First));
end loop;
end loop;
end Size_Square_Mod;
----------------------------------------------------------------------------
function Word_Inverse (M : Types.Word32) return Types.Word32
is
A, B, Quot, Temp, P, Q : Types.Word32;
begin
A := M;
B := (0 - M) mod M;
P := 1;
Q := (0 - ((0 - M) / M)) - 1;
loop
pragma Loop_Invariant
(A = P * M and B = Q * M and
GCD (A, B) = 1);
-- FIXME workaround for [N410-033]
exit when B = 0;
Quot := A / B;
Temp := A mod B;
A := B;
B := Temp;
Temp := P - Quot * Q;
P := Q;
Q := Temp;
end loop;
return 0 - P;
end Word_Inverse;
----------------------------------------------------------------------------
procedure Single_Add_Mult_Mult
(A : in out Types.Word32;
V : in Types.Word32;
W : in Types.Word32;
X : in Types.Word32;
Y : in Types.Word32;
Carry1 : in out Types.Word32;
Carry2 : in out Types.Word32)
with
Depends =>
(A =>+ (V, W, X, Y, Carry1),
(Carry1, Carry2) => (A, V, W, X, Y, Carry1, Carry2)),
Post =>
Math_Int.From_Word32 (A'Old) +
Math_Int.From_Word32 (V) * Math_Int.From_Word32 (W) +
Math_Int.From_Word32 (X) * Math_Int.From_Word32 (Y) +
Math_Int.From_Word32 (Carry1'Old) +
Base * Math_Int.From_Word32 (Carry2'Old) =
Math_Int.From_Word32 (A) +
Base * (Math_Int.From_Word32 (Carry1) +
Base * Math_Int.From_Word32 (Carry2));
procedure Single_Add_Mult_Mult
(A : in out Types.Word32;
V : in Types.Word32;
W : in Types.Word32;
X : in Types.Word32;
Y : in Types.Word32;
Carry1 : in out Types.Word32;
Carry2 : in out Types.Word32)
is
Mult1, Mult2, Temp : Types.Word64;
begin
Mult1 := Types.Word64 (V) * Types.Word64 (W);
Mult2 := Types.Word64 (X) * Types.Word64 (Y);
Temp :=
Types.Word64 (A) +
Types.Word64 (Carry1) +
(Mult1 and Types.Word64 (Types.Word32'Last)) +
(Mult2 and Types.Word64 (Types.Word32'Last));
A := Types.Word32 (Temp and Types.Word64 (Types.Word32'Last));
Temp :=
Types.Word64 (Carry2) +
Interfaces.Shift_Right (Mult1, 32) +
Interfaces.Shift_Right (Mult2, 32) +
Interfaces.Shift_Right (Temp, 32);
Carry1 := Types.Word32 (Temp and Types.Word64 (Types.Word32'Last));
Carry2 := Types.Word32 (Interfaces.Shift_Right (Temp, 32));
end Single_Add_Mult_Mult;
----------------------------------------------------------------------------
procedure Add_Mult_Mult
(A : in out Big_Int;
A_First : in Natural;
A_Last : in Natural;
B : in Big_Int;
B_First : in Natural;
C : in Big_Int;
C_First : in Natural;
X : in Types.Word32;
Y : in Types.Word32;
Carry1 : in out Types.Word32;
Carry2 : in out Types.Word32)
with
Depends =>
((A, Carry1, Carry2) =>
(A, A_First, A_Last, B, B_First, C, C_First, X, Y, Carry1, Carry2)),
Pre =>
A_First in A'Range and
A_Last + 1 in A'Range and
A_First <= A_Last and
B_First in B'Range and
B_First + (A_Last - A_First) in B'Range and
C_First in C'Range and
C_First + (A_Last - A_First) in C'Range,
Post =>
Num_Of_Big_Int (A'Old, A_First + 1, A_Last - A_First + 1) +
Num_Of_Big_Int (B, B_First, A_Last - A_First + 1) *
Math_Int.From_Word32 (X) +
Num_Of_Big_Int (C, C_First, A_Last - A_First + 1) *
Math_Int.From_Word32 (Y) +
Math_Int.From_Word32 (Carry1'Old) +
Base * Math_Int.From_Word32 (Carry2'Old) =
Num_Of_Big_Int (A, A_First, A_Last - A_First + 1) +
Base ** (A_Last - A_First + 1) * (Math_Int.From_Word32 (Carry1) +
Base * Math_Int.From_Word32 (Carry2));
procedure Add_Mult_Mult
(A : in out Big_Int;
A_First : in Natural;
A_Last : in Natural;
B : in Big_Int;
B_First : in Natural;
C : in Big_Int;
C_First : in Natural;
X : in Types.Word32;
Y : in Types.Word32;
Carry1 : in out Types.Word32;
Carry2 : in out Types.Word32)
is
Temp : Types.Word32;
begin
for I in Natural range A_First .. A_Last
loop
pragma Loop_Invariant
(Num_Of_Big_Int (A'Loop_Entry, A_First + 1, I - A_First) +
Num_Of_Big_Int (B, B_First, I - A_First) *
Math_Int.From_Word32 (X) +
Num_Of_Big_Int (C, C_First, I - A_First) *
Math_Int.From_Word32 (Y) +
Math_Int.From_Word32 (Carry1'Loop_Entry) +
Base * Math_Int.From_Word32 (Carry2'Loop_Entry) =
Num_Of_Big_Int (A, A_First, I - A_First) +
Base ** (I - A_First) * (Math_Int.From_Word32 (Carry1) +
Base * Math_Int.From_Word32 (Carry2)) and
(for all K in Natural range I .. A_Last + 1 =>
(A (K) = A'Loop_Entry (K))));
Temp := A (I + 1);
Single_Add_Mult_Mult
(Temp,
B (B_First + (I - A_First)), X,
C (C_First + (I - A_First)), Y,
Carry1, Carry2);
A (I) := Temp;
pragma Assert_And_Cut
(Num_Of_Big_Int (A'Loop_Entry, A_First + 1, (I + 1) - A_First) +
Num_Of_Big_Int (B, B_First, (I + 1) - A_First) *
Math_Int.From_Word32 (X) +
Num_Of_Big_Int (C, C_First, (I + 1) - A_First) *
Math_Int.From_Word32 (Y) +
Math_Int.From_Word32 (Carry1'Loop_Entry) +
Base * Math_Int.From_Word32 (Carry2'Loop_Entry) =
Num_Of_Big_Int (A, A_First, (I + 1) - A_First) +
Base ** ((I + 1) - A_First) * (Math_Int.From_Word32 (Carry1) +
Base * Math_Int.From_Word32 (Carry2)) and
(for all K in Natural range I + 1 .. A_Last + 1 =>
(A (K) = A'Loop_Entry (K))));
end loop;
end Add_Mult_Mult;
----------------------------------------------------------------------------
procedure Mont_Mult
(A : out Big_Int;
A_First : in Natural;
A_Last : in Natural;
B : in Big_Int;
B_First : in Natural;
C : in Big_Int;
C_First : in Natural;
M : in Big_Int;
M_First : in Natural;
M_Inv : in Types.Word32)
is
Carry : Boolean;
Carry1, Carry2, A_MSW, BI, U : Types.Word32;
begin
Initialize (A, A_First, A_Last);
A_MSW := 0;
for I in Natural range A_First .. A_Last
loop
pragma Loop_Invariant
((Num_Of_Big_Int (A, A_First, A_Last - A_First + 1) +
Base ** (A_Last - A_First + 1) * Math_Int.From_Word32 (A_MSW)) mod
Num_Of_Big_Int (M, M_First, A_Last - A_First + 1) =
(Num_Of_Big_Int (B, B_First, I - A_First) *
Num_Of_Big_Int (C, C_First, A_Last - A_First + 1) *
Inverse (Num_Of_Big_Int (M, M_First, A_Last - A_First + 1),
Base) ** (I - A_First)) mod
Num_Of_Big_Int (M, M_First, A_Last - A_First + 1) and
Num_Of_Big_Int (A, A_First, A_Last - A_First + 1) +
Base ** (A_Last - A_First + 1) * Math_Int.From_Word32 (A_MSW) <
Math_Int.From_Word32 (2) *
Num_Of_Big_Int (M, M_First, A_Last - A_First + 1) -
Math_Int.From_Word32 (1));
Carry1 := 0;
Carry2 := 0;
BI := B (B_First + (I - A_First));
U := (A (A_First) + BI * C (C_First)) * M_Inv;
Single_Add_Mult_Mult
(A (A_First), BI, C (C_First), M (M_First), U, Carry1, Carry2);
Add_Mult_Mult
(A, A_First, A_Last - 1,
C, C_First + 1, M, M_First + 1,
BI, U, Carry1, Carry2);
A (A_Last) := A_MSW + Carry1;
A_MSW := Carry2 + Word_Of_Boolean (A (A_Last) < Carry1);
pragma Assert_And_Cut
((Num_Of_Big_Int (A, A_First, A_Last - A_First + 1) +
Base ** (A_Last - A_First + 1) * Math_Int.From_Word32 (A_MSW)) mod
Num_Of_Big_Int (M, M_First, A_Last - A_First + 1) =
(Num_Of_Big_Int (B, B_First, (I + 1) - A_First) *
Num_Of_Big_Int (C, C_First, A_Last - A_First + 1) *
Inverse (Num_Of_Big_Int (M, M_First, A_Last - A_First + 1),
Base) ** ((I + 1) - A_First)) mod
Num_Of_Big_Int (M, M_First, A_Last - A_First + 1) and
Num_Of_Big_Int (A, A_First, A_Last - A_First + 1) +
Base ** (A_Last - A_First + 1) * Math_Int.From_Word32 (A_MSW) <
Math_Int.From_Word32 (2) *
Num_Of_Big_Int (M, M_First, A_Last - A_First + 1) -
Math_Int.From_Word32 (1));
end loop;
if A_MSW /= 0 or else
not Less (A, A_First, A_Last, M, M_First)
then
pragma Warnings (Off, "unused assignment to ""Carry""");
Sub_Inplace (A, A_First, A_Last, M, M_First, Carry);
pragma Warnings (On, "unused assignment to ""Carry""");
end if;
end Mont_Mult;
----------------------------------------------------------------------------
procedure Mont_Exp
(A : out Big_Int;
A_First : in Natural;
A_Last : in Natural;
X : in Big_Int;
X_First : in Natural;
E : in Big_Int;
E_First : in Natural;
E_Last : in Natural;
M : in Big_Int;
M_First : in Natural;
Aux1 : out Big_Int;
Aux1_First : in Natural;
Aux2 : out Big_Int;
Aux2_First : in Natural;
Aux3 : out Big_Int;
Aux3_First : in Natural;
R : in Big_Int;
R_First : in Natural;
M_Inv : in Types.Word32)
is
begin
Initialize (Aux1, Aux1_First, Aux1_First + (A_Last - A_First));
Aux1 (Aux1_First) := 1;
Mont_Mult
(Aux3, Aux3_First, Aux3_First + (A_Last - A_First),
R, R_First, Aux1, Aux1_First,
M, M_First, M_Inv);
Mont_Mult
(Aux2, Aux2_First, Aux2_First + (A_Last - A_First),
X, X_First, R, R_First,
M, M_First, M_Inv);
for I in reverse Natural range E_First .. E_Last
loop
pragma Loop_Invariant
(Num_Of_Big_Int (Aux1, Aux1_First, A_Last - A_First + 1) =
Math_Int.From_Word32 (1) and
Num_Of_Big_Int (Aux2, Aux2_First, A_Last - A_First + 1) =
Num_Of_Big_Int (X, X_First, A_Last - A_First + 1) *
Base ** (A_Last - A_First + 1) mod
Num_Of_Big_Int (M, M_First, A_Last - A_First + 1) and
Num_Of_Big_Int (Aux3, Aux3_First, A_Last - A_First + 1) =
Num_Of_Big_Int (X, X_First, A_Last - A_First + 1) **
Num_Of_Big_Int (E, I + 1, E_Last - I) *
Base ** (A_Last - A_First + 1) mod
Num_Of_Big_Int (M, M_First, A_Last - A_First + 1));
for J in reverse Natural range 0 .. 31
loop
pragma Loop_Invariant
(Num_Of_Big_Int (Aux1, Aux1_First, A_Last - A_First + 1) =
Math_Int.From_Word32 (1) and
Num_Of_Big_Int (Aux2, Aux2_First, A_Last - A_First + 1) =
Num_Of_Big_Int (X, X_First, A_Last - A_First + 1) *
Base ** (A_Last - A_First + 1) mod
Num_Of_Big_Int (M, M_First, A_Last - A_First + 1) and
Num_Of_Big_Int (Aux3, Aux3_First, A_Last - A_First + 1) =
Num_Of_Big_Int (X, X_First, A_Last - A_First + 1) **
(Num_Of_Big_Int (E, I + 1, E_Last - I) *
Math_Int.From_Word32 (2) ** (31 - J) +
Math_Int.From_Word32 (E (I)) /
Math_Int.From_Word32 (2) ** (J + 1)) *
Base ** (A_Last - A_First + 1) mod
Num_Of_Big_Int (M, M_First, A_Last - A_First + 1));
Mont_Mult
(A, A_First, A_Last,
Aux3, Aux3_First, Aux3, Aux3_First,
M, M_First, M_Inv);
if (E (I) and 2 ** J) /= 0 then
Mont_Mult
(Aux3, Aux3_First, Aux3_First + (A_Last - A_First),
A, A_First, Aux2, Aux2_First,
M, M_First, M_Inv);
else
Copy (A, A_First, A_Last, Aux3, Aux3_First);
end if;
pragma Assert_And_Cut
(Num_Of_Big_Int (Aux1, Aux1_First, A_Last - A_First + 1) =
Math_Int.From_Word32 (1) and
Num_Of_Big_Int (Aux2, Aux2_First, A_Last - A_First + 1) =
Num_Of_Big_Int (X, X_First, A_Last - A_First + 1) *
Base ** (A_Last - A_First + 1) mod
Num_Of_Big_Int (M, M_First, A_Last - A_First + 1) and
Num_Of_Big_Int (Aux3, Aux3_First, A_Last - A_First + 1) =
Num_Of_Big_Int (X, X_First, A_Last - A_First + 1) **
(Num_Of_Big_Int (E, I + 1, E_Last - I) *
Math_Int.From_Word32 (2) ** (31 - (J - 1)) +
Math_Int.From_Word32 (E (I)) /
Math_Int.From_Word32 (2) ** ((J - 1) + 1)) *
Base ** (A_Last - A_First + 1) mod
Num_Of_Big_Int (M, M_First, A_Last - A_First + 1));
end loop;
end loop;
Mont_Mult
(A, A_First, A_Last,
Aux3, Aux3_First, Aux1, Aux1_First,
M, M_First, M_Inv);
end Mont_Exp;
----------------------------------------------------------------------------
function Bit_Set
(A : Big_Int;
A_First : Natural;
I : Types.Word64)
return Boolean
with
Pre =>
A_First in A'Range and then
I / 32 <= Types.Word64 (A'Last - A_First),
Post =>
Bit_Set'Result =
((A (A_First + Natural (I / 32)) and
2 ** (Natural (I mod 32))) /= 0);
function Bit_Set
(A : Big_Int;
A_First : Natural;
I : Types.Word64)
return Boolean
is
begin
return
(A (A_First + Natural (I / 32)) and
2 ** (Natural (I mod 32))) /= 0;
end Bit_Set;
----------------------------------------------------------------------------
procedure Mont_Exp_Window
(A : out Big_Int;
A_First : in Natural;
A_Last : in Natural;
X : in Big_Int;
X_First : in Natural;
E : in Big_Int;
E_First : in Natural;
E_Last : in Natural;
M : in Big_Int;
M_First : in Natural;
K : in Natural;
Aux1 : out Big_Int;
Aux1_First : in Natural;
Aux2 : out Big_Int;
Aux2_First : in Natural;
Aux3 : out Big_Int;
Aux3_First : in Natural;
Aux4 : out Big_Int;
Aux4_First : in Natural;
R : in Big_Int;
R_First : in Natural;
M_Inv : in Types.Word32)
is
J, L, S : Natural;
I : Types.Word64;
W : Types.Word32;
begin
L := A_Last - A_First;
Initialize (Aux1, Aux1_First, Aux1_First + L);
Aux1 (Aux1_First) := 1;
Mont_Mult
(Aux3, Aux3_First, Aux3_First + L,
R, R_First, Aux1, Aux1_First,
M, M_First, M_Inv);
Mont_Mult
(Aux4, Aux4_First, Aux4_First + L,
X, X_First, R, R_First,
M, M_First, M_Inv);
Mont_Mult
(Aux2, Aux2_First, Aux2_First + L,
Aux4, Aux4_First, Aux4, Aux4_First,
M, M_First, M_Inv);
pragma Assert_And_Cut
(L = A_Last - A_First and
Num_Of_Big_Int (Aux1, Aux1_First, L + 1) =
Math_Int.From_Word32 (1) and
Num_Of_Big_Int (Aux2, Aux2_First, L + 1) =
Num_Of_Big_Int (X, X_First, L + 1) *
Num_Of_Big_Int (X, X_First, L + 1) *
Base ** (L + 1) mod
Num_Of_Big_Int (M, M_First, L + 1) and
Num_Of_Big_Int (Aux3, Aux3_First, L + 1) =
Base ** (L + 1) mod
Num_Of_Big_Int (M, M_First, L + 1) and
Num_Of_Big_Int (Aux4, Aux4_First, L + 1) =
Num_Of_Big_Int (X, X_First, L + 1) *
Base ** (L + 1) mod
Num_Of_Big_Int (M, M_First, L + 1));
for H in Natural range 1 .. 2 ** K - 1
loop
pragma Loop_Invariant
(L = A_Last - A_First and
Num_Of_Big_Int (Aux1, Aux1_First, L + 1) =
Math_Int.From_Word32 (1) and
Num_Of_Big_Int (Aux2, Aux2_First, L + 1) =
Num_Of_Big_Int (X, X_First, L + 1) *
Num_Of_Big_Int (X, X_First, L + 1) *
Base ** (L + 1) mod
Num_Of_Big_Int (M, M_First, L + 1) and
Num_Of_Big_Int (Aux3, Aux3_First, L + 1) =
Base ** (L + 1) mod
Num_Of_Big_Int (M, M_First, L + 1) and
(for all N in Natural range 0 .. H - 1 =>
(Num_Of_Big_Int (Aux4, Aux4_First + N * (L + 1), L + 1) =
Num_Of_Big_Int (X, X_First, L + 1) ** (2 * N + 1) *
Base ** (L + 1) mod
Num_Of_Big_Int (M, M_First, L + 1))));
Mont_Mult
(A, A_First, A_Last,
Aux4, Aux4_First + (H - 1) * (L + 1), Aux2, Aux2_First,
M, M_First, M_Inv);
Copy (A, A_First, A_Last, Aux4, Aux4_First + H * (L + 1));
pragma Assert_And_Cut
(L = A_Last - A_First and
Num_Of_Big_Int (Aux1, Aux1_First, L + 1) =
Math_Int.From_Word32 (1) and
Num_Of_Big_Int (Aux2, Aux2_First, L + 1) =
Num_Of_Big_Int (X, X_First, L + 1) *
Num_Of_Big_Int (X, X_First, L + 1) *
Base ** (L + 1) mod
Num_Of_Big_Int (M, M_First, L + 1) and
Num_Of_Big_Int (Aux3, Aux3_First, L + 1) =
Base ** (L + 1) mod
Num_Of_Big_Int (M, M_First, L + 1) and
(for all N in Natural range 0 .. H =>
(Num_Of_Big_Int (Aux4, Aux4_First + N * (L + 1), L + 1) =
Num_Of_Big_Int (X, X_First, L + 1) ** (2 * N + 1) *
Base ** (L + 1) mod
Num_Of_Big_Int (M, M_First, L + 1))));
end loop;
I := (Types.Word64 (E_Last - E_First) + 1) * 32 - 1;
loop
pragma Loop_Invariant
(L = A_Last - A_First and
Num_Of_Big_Int (Aux1, Aux1_First, L + 1) =
Math_Int.From_Word32 (1) and
Num_Of_Big_Int (Aux2, Aux2_First, L + 1) =
Num_Of_Big_Int (X, X_First, L + 1) *
Num_Of_Big_Int (X, X_First, L + 1) *
Base ** (L + 1) mod
Num_Of_Big_Int (M, M_First, L + 1) and
Num_Of_Big_Int (Aux3, Aux3_First, L + 1) =
Num_Of_Big_Int (X, X_First, L + 1) **
(Num_Of_Big_Int (E, E_First, E_Last - E_First + 1) /
Math_Int.From_Word32 (2) **
(Math_Int.From_Word64 (I) + Math_Int.From_Word32 (1))) *
Base ** (L + 1) mod
Num_Of_Big_Int (M, M_First, L + 1) and
(for all N in Natural range 0 .. 2 ** K - 1 =>
(Num_Of_Big_Int (Aux4, Aux4_First + N * (L + 1), L + 1) =
Num_Of_Big_Int (X, X_First, L + 1) ** (2 * N + 1) *
Base ** (L + 1) mod
Num_Of_Big_Int (M, M_First, L + 1))) and
I < (Types.Word64 (E_Last - E_First) + 1) * 32);
if Bit_Set (E, E_First, I) then
W := 1;
S := 0;
J := 1;
loop
pragma Loop_Invariant
(L = A_Last - A_First and
Num_Of_Big_Int (Aux1, Aux1_First, L + 1) =
Math_Int.From_Word32 (1) and
Num_Of_Big_Int (Aux2, Aux2_First, L + 1) =
Num_Of_Big_Int (X, X_First, L + 1) *
Num_Of_Big_Int (X, X_First, L + 1) *
Base ** (L + 1) mod
Num_Of_Big_Int (M, M_First, L + 1) and
Num_Of_Big_Int (Aux3, Aux3_First, L + 1) =
Num_Of_Big_Int (X, X_First, L + 1) **
(Num_Of_Big_Int (E, E_First, E_Last - E_First + 1) /
Math_Int.From_Word32 (2) **
(Math_Int.From_Word64 (I) + Math_Int.From_Word32 (1))) *
Base ** (L + 1) mod
Num_Of_Big_Int (M, M_First, L + 1) and
(for all N in Natural range 0 .. 2 ** K - 1 =>
(Num_Of_Big_Int (Aux4, Aux4_First + N * (L + 1), L + 1) =
Num_Of_Big_Int (X, X_First, L + 1) ** (2 * N + 1) *
Base ** (L + 1) mod
Num_Of_Big_Int (M, M_First, L + 1))) and
Math_Int.From_Word32 (W) * Math_Int.From_Word32 (2) ** (J - S - 1) =
Num_Of_Big_Int (E, E_First, E_Last - E_First + 1) /
Math_Int.From_Word32 (2) ** (Math_Int.From_Word64 (I) -
(Math_Int.From_Integer (J) - Math_Int.From_Word32 (1))) mod
Math_Int.From_Word32 (2) ** J and
W mod 2 = 1 and 0 <= S and S < J and J <= K + 1 and
Math_Int.From_Integer (J) <=
Math_Int.From_Word64 (I) + Math_Int.From_Word32 (1) and
I < (Types.Word64 (E_Last - E_First) + 1) * 32);
-- FIXME workaround for [N410-033]
exit when not (J <= K and Types.Word64 (J) <= I);
if Bit_Set (E, E_First, I - Types.Word64 (J)) then
W := Interfaces.Shift_Left (W, J - S) or 1;
S := J;
end if;
J := J + 1;
end loop;
S := S + 1;
for H in Natural range 1 .. S
loop
pragma Loop_Invariant
(L = A_Last - A_First and
Num_Of_Big_Int (Aux1, Aux1_First, L + 1) =
Math_Int.From_Word32 (1) and
Num_Of_Big_Int (Aux2, Aux2_First, L + 1) =
Num_Of_Big_Int (X, X_First, L + 1) *
Num_Of_Big_Int (X, X_First, L + 1) *
Base ** (L + 1) mod
Num_Of_Big_Int (M, M_First, L + 1) and
Num_Of_Big_Int (Aux3, Aux3_First, L + 1) =
Num_Of_Big_Int (X, X_First, L + 1) **
(Num_Of_Big_Int (E, E_First, E_Last - E_First + 1) /
Math_Int.From_Word32 (2) **
(Math_Int.From_Word64 (I) + Math_Int.From_Word32 (1)) *
Math_Int.From_Word32 (2) ** (H - 1)) *
Base ** (L + 1) mod
Num_Of_Big_Int (M, M_First, L + 1) and
(for all N in Natural range 0 .. 2 ** K - 1 =>
(Num_Of_Big_Int (Aux4, Aux4_First + N * (L + 1), L + 1) =
Num_Of_Big_Int (X, X_First, L + 1) ** (2 * N + 1) *
Base ** (L + 1) mod
Num_Of_Big_Int (M, M_First, L + 1))) and
Math_Int.From_Word32 (W) =
Num_Of_Big_Int (E, E_First, E_Last - E_First + 1) /
Math_Int.From_Word32 (2) ** (Math_Int.From_Word64 (I) -
(Math_Int.From_Integer (S) - Math_Int.From_Word32 (1))) mod
Math_Int.From_Word32 (2) ** S and
W mod 2 = 1 and 0 <= S and S <= K + 1 and S'Loop_Entry = S and
Math_Int.From_Integer (S) <=
Math_Int.From_Word64 (I) + Math_Int.From_Word32 (1) and
I < (Types.Word64 (E_Last - E_First) + 1) * 32);
Mont_Mult
(A, A_First, A_Last,
Aux3, Aux3_First, Aux3, Aux3_First,
M, M_First, M_Inv);
Copy (A, A_First, A_Last, Aux3, Aux3_First);
pragma Assert_And_Cut
(L = A_Last - A_First and
Num_Of_Big_Int (Aux1, Aux1_First, L + 1) =
Math_Int.From_Word32 (1) and
Num_Of_Big_Int (Aux2, Aux2_First, L + 1) =
Num_Of_Big_Int (X, X_First, L + 1) *
Num_Of_Big_Int (X, X_First, L + 1) *
Base ** (L + 1) mod
Num_Of_Big_Int (M, M_First, L + 1) and
Num_Of_Big_Int (Aux3, Aux3_First, L + 1) =
Num_Of_Big_Int (X, X_First, L + 1) **
(Num_Of_Big_Int (E, E_First, E_Last - E_First + 1) /
Math_Int.From_Word32 (2) **
(Math_Int.From_Word64 (I) + Math_Int.From_Word32 (1)) *
Math_Int.From_Word32 (2) ** H) *
Base ** (L + 1) mod
Num_Of_Big_Int (M, M_First, L + 1) and
(for all N in Natural range 0 .. 2 ** K - 1 =>
(Num_Of_Big_Int (Aux4, Aux4_First + N * (L + 1), L + 1) =
Num_Of_Big_Int (X, X_First, L + 1) ** (2 * N + 1) *
Base ** (L + 1) mod
Num_Of_Big_Int (M, M_First, L + 1))) and
Math_Int.From_Word32 (W) =
Num_Of_Big_Int (E, E_First, E_Last - E_First + 1) /
Math_Int.From_Word32 (2) ** (Math_Int.From_Word64 (I) -
(Math_Int.From_Integer (S) - Math_Int.From_Word32 (1))) mod
Math_Int.From_Word32 (2) ** S and
W mod 2 = 1 and 0 <= S and S <= K + 1 and S'Loop_Entry = S and
Math_Int.From_Integer (S) <=
Math_Int.From_Word64 (I) + Math_Int.From_Word32 (1) and
I < (Types.Word64 (E_Last - E_First) + 1) * 32);
end loop;
Mont_Mult
(A, A_First, A_Last,
Aux3, Aux3_First,
Aux4, Aux4_First + Natural (Interfaces.Shift_Right (W, 1)) * (L + 1),
M, M_First, M_Inv);
Copy (A, A_First, A_Last, Aux3, Aux3_First);
else
S := 1;
Mont_Mult
(A, A_First, A_Last,
Aux3, Aux3_First, Aux3, Aux3_First,
M, M_First, M_Inv);
Copy (A, A_First, A_Last, Aux3, Aux3_First);
end if;
pragma Assert_And_Cut
(L = A_Last - A_First and
Num_Of_Big_Int (Aux1, Aux1_First, L + 1) =
Math_Int.From_Word32 (1) and
Num_Of_Big_Int (Aux2, Aux2_First, L + 1) =
Num_Of_Big_Int (X, X_First, L + 1) *
Num_Of_Big_Int (X, X_First, L + 1) *
Base ** (L + 1) mod
Num_Of_Big_Int (M, M_First, L + 1) and
Num_Of_Big_Int (Aux3, Aux3_First, L + 1) =
Num_Of_Big_Int (X, X_First, L + 1) **
(Num_Of_Big_Int (E, E_First, E_Last - E_First + 1) /
Math_Int.From_Word32 (2) ** (Math_Int.From_Word64 (I) -
Math_Int.From_Integer (S) + Math_Int.From_Word32 (1))) *
Base ** (L + 1) mod
Num_Of_Big_Int (M, M_First, L + 1) and
(for all N in Natural range 0 .. 2 ** K - 1 =>
(Num_Of_Big_Int (Aux4, Aux4_First + N * (L + 1), L + 1) =
Num_Of_Big_Int (X, X_First, L + 1) ** (2 * N + 1) *
Base ** (L + 1) mod
Num_Of_Big_Int (M, M_First, L + 1))) and
Math_Int.From_Integer (S) <=
Math_Int.From_Word64 (I) + Math_Int.From_Word32 (1) and
I < (Types.Word64 (E_Last - E_First) + 1) * 32);
exit when I < Types.Word64 (S);
I := I - Types.Word64 (S);
end loop;
Mont_Mult
(A, A_First, A_Last,
Aux3, Aux3_First, Aux1, Aux1_First,
M, M_First, M_Inv);
end Mont_Exp_Window;
end LSC.Internal.Bignum;
|
------------------------------------------------------------------------------
-- --
-- GNAT COMPILER COMPONENTS --
-- --
-- E X P _ D I S T --
-- --
-- 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 package contains utility routines used for the generation of the
-- stubs relevant to the distribution annex.
with Namet; use Namet;
with Snames; use Snames;
with Types; use Types;
package Exp_Dist is
PCS_Version_Number : constant array (PCS_Names) of Int :=
(Name_No_DSA => 1,
Name_GARLIC_DSA => 1,
Name_PolyORB_DSA => 6);
-- PCS interface version. This is used to check for consistency between the
-- compiler used to generate distribution stubs and the PCS implementation.
-- It must be incremented whenever a change is made to the generated code
-- for distribution stubs that would result in the compiler being
-- incompatible with an older version of the PCS, or vice versa.
procedure Add_RAST_Features (Vis_Decl : Node_Id);
-- Build and add bodies for dereference and 'Access subprograms for a
-- remote access to subprogram type. Vis_Decl is the declaration node for
-- the RAS type.
procedure Add_RACW_Features (RACW_Type : Entity_Id);
-- Add RACW features. If the RACW and the designated type are not in the
-- same scope, then Add_RACW_Primitive_Declarations_And_Bodies is called
-- automatically since we do know the primitive list already.
procedure Add_RACW_Primitive_Declarations_And_Bodies
(Designated_Type : Entity_Id;
Insertion_Node : Node_Id;
Body_Decls : List_Id);
-- Add primitive for the stub type, and the RPC receiver. The declarations
-- are inserted after Insertion_Node, while the bodies are appended at the
-- end of Body_Decls.
procedure Remote_Types_Tagged_Full_View_Encountered
(Full_View : Entity_Id);
-- When a full view with a private view is encountered in a Remote_Types
-- package and corresponds to a tagged type, then this procedure is called
-- to generate the needed RACW features if it is needed.
procedure RACW_Type_Is_Asynchronous (RACW_Type : Entity_Id);
-- This subprogram must be called when it is detected that the RACW type
-- is asynchronous.
procedure Expand_Calling_Stubs_Bodies (Unit_Node : Node_Id);
-- Call the expansion phase for the calling stubs. The code will be added
-- at the end of the compilation unit, which is a package spec.
procedure Expand_Receiving_Stubs_Bodies (Unit_Node : Node_Id);
-- Call the expansion phase for the receiving stubs. The code will be added
-- at the end of the compilation unit, which may be either a package spec
-- or a package body.
procedure Expand_All_Calls_Remote_Subprogram_Call (N : Node_Id);
-- Rewrite a call to a subprogram located in a Remote_Call_Interface
-- package to which the pragma All_Calls_Remote applies so that it
-- goes through the PCS. N is either an N_Procedure_Call_Statement
-- or an N_Function_Call node.
procedure Build_Passive_Partition_Stub (U : Node_Id);
-- Build stub for a shared passive package. U is the analyzed
-- compilation unit for a package declaration.
function Build_Subprogram_Id
(Loc : Source_Ptr;
E : Entity_Id) return Node_Id;
-- Build a literal representing the remote subprogram identifier of E
function Copy_Specification
(Loc : Source_Ptr;
Spec : Node_Id;
Ctrl_Type : Entity_Id := Empty;
New_Name : Name_Id := No_Name) return Node_Id;
-- Build a subprogram specification from another one, or from an
-- access-to-subprogram definition. If Ctrl_Type is not Empty, and any
-- controlling formal of an anonymous access type is found, then it is
-- replaced by an access to Ctrl_Type. If New_Name is given, then it will
-- be used as the name for the newly created spec.
--
-- Possibly factor this wrt Exp_Ch9.Build_Private_Protected_Declaration???
function Corresponding_Stub_Type (RACW_Type : Entity_Id) return Entity_Id;
-- Return the stub type associated with the given RACW type
function Underlying_RACW_Type (RAS_Typ : Entity_Id) return Entity_Id;
-- Given a remote access-to-subprogram type or its equivalent
-- record type, return the RACW type generated to implement it.
procedure Append_RACW_Bodies (Decls : List_Id; Spec_Id : Entity_Id);
-- Append the unanalyzed subprogram bodies generated to support RACWs
-- declared in the given package spec (RACW stream subprograms, calling
-- stubs primitive operations) to the given list (which is expected to be
-- the declarations list for the corresponding package body, if there is
-- one). In the case where a body is present, the subprogram bodies must
-- not be generated in the package spec because this would cause an
-- incorrect attempt to freeze Taft amendment types declared in the spec.
function Make_Transportable_Check
(Loc : Source_Ptr;
Expr : Node_Id) return Node_Id;
-- Generate a check that the given expression (an actual in a remote
-- subprogram call, or the return value of a function in the context of
-- a remote call) satisfies the requirements for being transportable
-- across partitions, raising Program_Error if it does not.
----------------------------------------------------------------
-- Functions for expansion of PolyORB/DSA specific attributes --
----------------------------------------------------------------
function Build_From_Any_Call
(Typ : Entity_Id;
N : Node_Id;
Decls : List_Id) return Node_Id;
-- Build call to From_Any attribute function of type Typ with expression
-- N as actual parameter. Decls is the declarations list for an appropriate
-- enclosing scope of the point where the call will be inserted; if the
-- From_Any attribute for Typ needs to be generated at this point, its
-- declaration is appended to Decls.
function Build_To_Any_Call
(Loc : Source_Ptr;
N : Node_Id;
Decls : List_Id;
Constrained : Boolean := False) return Node_Id;
-- Build call to To_Any attribute function with expression as actual
-- parameter. Loc is the reference location for generated nodes, Decls is
-- the declarations list for an appropriate enclosing scope of the point
-- where the call will be inserted; if the To_Any attribute for Typ needs
-- to be generated at this point, its declaration is appended to Decls.
-- For limited types, if Constrained is True then use 'Write else use
-- 'Output.
function Build_TypeCode_Call
(Loc : Source_Ptr;
Typ : Entity_Id;
Decls : List_Id) return Node_Id;
-- Build call to TypeCode attribute function for Typ. Decls is the
-- declarations list for an appropriate enclosing scope of the point
-- where the call will be inserted; if the To_Any attribute for Typ
-- needs to be generated at this point, its declaration is appended
-- to Decls.
end Exp_Dist;
|
package body DCF.Streams.Calendar is
procedure Set_Time (S : out Root_Zipstream_Type'Class; Modification_Time : Ada.Calendar.Time) is
begin
Set_Time (S, Calendar.Convert (Modification_Time));
end Set_Time;
function Get_Time (S : in Root_Zipstream_Type'Class) return Ada.Calendar.Time is
begin
return Calendar.Convert (Get_Time (S));
end Get_Time;
------------------------------------------------
-- Time = DOS Time. Valid through Year 2107 --
------------------------------------------------
procedure Split
(Date : Time;
Year : out Year_Number;
Month : out Month_Number;
Day : out Day_Number;
Seconds : out Day_Duration)
is
D_Date : constant Integer := Integer (Date / 65536);
D_Time : constant Integer := Integer (Date and 65535);
X : Integer;
Hours : Integer;
Minutes : Integer;
Seconds_Only : Integer;
begin
Year := 1980 + D_Date / 512;
X := (D_Date / 32) mod 16;
if X not in Month_Number then -- that is 0, or in 13..15
raise Time_Error;
end if;
Month := X;
X := D_Date mod 32;
if X not in Day_Number then -- that is 0
raise Time_Error;
end if;
Day := X;
Hours := D_Time / 2048;
Minutes := (D_Time / 32) mod 64;
Seconds_Only := 2 * (D_Time mod 32);
if Hours not in 0 .. 23 or Minutes not in 0 .. 59 or Seconds_Only not in 0 .. 59 then
raise Time_Error;
end if;
Seconds := Day_Duration (Hours * 3600 + Minutes * 60 + Seconds_Only);
end Split;
function Time_Of
(Year : Year_Number;
Month : Month_Number;
Day : Day_Number;
Seconds : Day_Duration := 0.0) return Time
is
Year_2 : Integer := Year;
Hours : Unsigned_32;
Minutes : Unsigned_32;
Seconds_Only : Unsigned_32;
Seconds_Day : Unsigned_32;
Result : Unsigned_32;
begin
if Year_2 < 1980 then -- Avoid invalid DOS date
Year_2 := 1980;
end if;
Seconds_Day := Unsigned_32 (Seconds);
Hours := Seconds_Day / 3600;
Minutes := (Seconds_Day / 60) mod 60;
Seconds_Only := Seconds_Day mod 60;
Result :=
-- MSDN formula for encoding:
Unsigned_32 ((Year_2 - 1980) * 512 + Month * 32 + Day) * 65536 -- Date
+
Hours * 2048 +
Minutes * 32 +
Seconds_Only / 2; -- Time
return Time (Result);
end Time_Of;
function ">" (Left, Right : Time) return Boolean is
begin
return Unsigned_32 (Left) > Unsigned_32 (Right);
end ">";
function Convert (Date : in Ada.Calendar.Time) return Time is
Year : Year_Number;
Month : Month_Number;
Day : Day_Number;
Seconds_Day_Dur : Day_Duration;
begin
Split (Date, Year, Month, Day, Seconds_Day_Dur);
return Time_Of (Year, Month, Day, Seconds_Day_Dur);
end Convert;
function Convert (Date : in Time) return Ada.Calendar.Time is
Year : Year_Number;
Month : Month_Number;
Day : Day_Number;
Seconds_Day_Dur : Day_Duration;
begin
Split (Date, Year, Month, Day, Seconds_Day_Dur);
return Time_Of (Year, Month, Day, Seconds_Day_Dur);
end Convert;
end DCF.Streams.Calendar;
|
package TOML_Slicer is
-- Procedures to directly edit a TOML file without parsing it. Heavily
-- incomplete and tailored to Alire needs.
Slicing_Error : exception;
-- Raised when the requested operation could not be completed. Original
-- file remains untouched.
procedure Remove_Line_From_Array (File_Name : String;
Array_Name : String;
Entry_Name : String;
Cleanup : Boolean;
Backup : Boolean;
Backup_Dir : String := ".");
-- Removes a line starting with Entry_Name = ... from [[Array_Name]].
-- If Cleanup, it will remove empty array entries (all of them). A
-- "filename.prev" file will be copied into Backup_Dir with the
-- original contents in case of success.
end TOML_Slicer;
|
-------------------------------------------------------------------------------
-- Copyright (c) 2016 Daniel King
--
-- Permission is hereby granted, free of charge, to any person obtaining a
-- copy of this software and associated documentation files (the "Software"),
-- to deal in the Software without restriction, including without limitation
-- the rights to use, copy, modify, merge, publish, distribute, sublicense,
-- and/or sell copies of the Software, and to permit persons to whom the
-- Software is furnished to do so, subject to the following conditions:
--
-- The above copyright notice and this permission notice shall be included in
-- all copies or substantial portions of the Software.
--
-- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
-- FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
-- DEALINGS IN THE SOFTWARE.
-------------------------------------------------------------------------------
with Interfaces;
package DW1000.Types
with SPARK_Mode => On
is
type Bits_1 is mod 2**1 with Size => 1;
type Bits_2 is mod 2**2 with Size => 2;
type Bits_3 is mod 2**3 with Size => 3;
type Bits_4 is mod 2**4 with Size => 4;
type Bits_5 is mod 2**5 with Size => 5;
type Bits_6 is mod 2**6 with Size => 6;
type Bits_7 is mod 2**7 with Size => 7;
subtype Bits_8 is Interfaces.Unsigned_8;
type Bits_9 is mod 2**9 with Size => 9;
type Bits_10 is mod 2**10 with Size => 10;
type Bits_11 is mod 2**11 with Size => 11;
type Bits_12 is mod 2**12 with Size => 12;
type Bits_13 is mod 2**13 with Size => 13;
type Bits_14 is mod 2**14 with Size => 14;
type Bits_15 is mod 2**15 with Size => 15;
subtype Bits_16 is Interfaces.Unsigned_16;
type Bits_17 is mod 2**17 with Size => 17;
type Bits_18 is mod 2**18 with Size => 18;
type Bits_19 is mod 2**19 with Size => 19;
type Bits_20 is mod 2**20 with Size => 20;
type Bits_21 is mod 2**21 with Size => 21;
type Bits_22 is mod 2**22 with Size => 22;
type Bits_23 is mod 2**23 with Size => 23;
type Bits_24 is mod 2**24 with Size => 24;
type Bits_25 is mod 2**25 with Size => 25;
type Bits_26 is mod 2**26 with Size => 26;
type Bits_27 is mod 2**27 with Size => 27;
type Bits_28 is mod 2**28 with Size => 28;
type Bits_29 is mod 2**29 with Size => 29;
type Bits_30 is mod 2**30 with Size => 30;
type Bits_31 is mod 2**31 with Size => 31;
subtype Bits_32 is Interfaces.Unsigned_32;
type Bits_33 is mod 2**33 with Size => 33;
type Bits_34 is mod 2**34 with Size => 34;
type Bits_35 is mod 2**35 with Size => 35;
type Bits_36 is mod 2**36 with Size => 36;
type Bits_37 is mod 2**37 with Size => 37;
type Bits_38 is mod 2**38 with Size => 38;
type Bits_39 is mod 2**39 with Size => 39;
type Bits_40 is mod 2**40 with Size => 40;
type Bits_41 is mod 2**41 with Size => 41;
type Bits_42 is mod 2**42 with Size => 42;
type Bits_43 is mod 2**43 with Size => 43;
type Bits_44 is mod 2**44 with Size => 44;
type Bits_45 is mod 2**45 with Size => 45;
type Bits_46 is mod 2**46 with Size => 46;
type Bits_47 is mod 2**47 with Size => 47;
type Bits_48 is mod 2**48 with Size => 48;
type Bits_49 is mod 2**49 with Size => 49;
type Bits_50 is mod 2**50 with Size => 50;
type Bits_51 is mod 2**51 with Size => 51;
type Bits_52 is mod 2**52 with Size => 52;
type Bits_53 is mod 2**53 with Size => 53;
type Bits_54 is mod 2**54 with Size => 54;
type Bits_55 is mod 2**55 with Size => 55;
type Bits_56 is mod 2**56 with Size => 56;
type Bits_57 is mod 2**57 with Size => 57;
type Bits_58 is mod 2**58 with Size => 58;
type Bits_59 is mod 2**59 with Size => 59;
type Bits_60 is mod 2**60 with Size => 60;
type Bits_61 is mod 2**61 with Size => 61;
type Bits_62 is mod 2**62 with Size => 62;
type Bits_63 is mod 2**63 with Size => 63;
subtype Bits_64 is Interfaces.Unsigned_64;
subtype Index is Natural range 0 .. Natural'Last - 1;
type Byte_Array is array (Index range <>) of Bits_8;
end DW1000.Types;
|
-- SPDX-FileCopyrightText: 2019 Max Reznik <reznikmm@gmail.com>
--
-- SPDX-License-Identifier: MIT
-------------------------------------------------------------
with Program.Units.Bodies;
package body Program.Units.Subunits is
--------------------
-- Append_Subunit --
--------------------
procedure Append_Subunit
(Self : in out Subunit;
Value : Program.Compilation_Units.Compilation_Unit_Access)
is
begin
Self.Subunits.Append (Value);
end Append_Subunit;
----------------
-- Initialize --
----------------
procedure Initialize
(Self : in out Subunit;
Compilation : Program.Compilations.Compilation_Access;
Full_Name : Text;
Context_Clause : Program.Element_Vectors.Element_Vector_Access;
Unit_Declaration : not null Program.Elements.Element_Access;
Parent_Body : not null Program.Compilation_Units
.Compilation_Unit_Access) is
begin
Self.Initialize
(Compilation => Compilation,
Full_Name => Full_Name,
Context_Clause => Context_Clause,
Unit_Declaration => Unit_Declaration);
Self.Parent_Body := Parent_Body;
if Parent_Body.all in Program.Units.Bodies.Unit_Body then
Program.Units.Bodies.Unit_Body (Parent_Body.all).Append_Subunit
(Self'Unchecked_Access);
else
Subunit (Parent_Body.all).Append_Subunit (Self'Unchecked_Access);
end if;
Self.Subunits.Clear;
end Initialize;
--------------
-- Subunits --
--------------
overriding function Subunits (Self : access Subunit)
return Program.Compilation_Unit_Vectors.Compilation_Unit_Vector_Access is
begin
if Self.Subunits.Is_Empty then
return null;
else
return Self.Subunits'Access;
end if;
end Subunits;
-----------------
-- Parent_Body --
-----------------
overriding function Parent_Body (Self : access Subunit)
return not null Program.Compilation_Units.Compilation_Unit_Access is
begin
return Self.Parent_Body;
end Parent_Body;
end Program.Units.Subunits;
|
package body annee is
function Est_Bissextile (Annee : Integer) return Boolean is
begin
return (Annee Mod 4 = 0 And Annee Mod 100 /= 0) Or Annee Mod 400 = 0;
end Est_Bissextile;
end annee;
|
--PRÁCTICA 4: CÉSAR BORAO MORATINOS (Chat_Client_2)
with Handlers;
with Ada.Text_IO;
with Chat_Messages;
with Lower_Layer_UDP;
with Ada.Command_Line;
with Ada.Strings.Unbounded;
procedure Chat_Client_2 is
package ATI renames Ada.Text_IO;
package CM renames Chat_Messages;
package LLU renames Lower_Layer_UDP;
package ACL renames Ada.Command_Line;
package ASU renames Ada.Strings.Unbounded;
use type CM.Message_Type;
Server_EP: LLU.End_Point_Type;
Port: Integer;
Nick: ASU.Unbounded_String;
Client_EP_Receive: LLU.End_Point_Type;
Client_EP_Handler: LLU.End_Point_Type;
Buffer_In: aliased LLU.Buffer_Type(1024);
Buffer_Out: aliased LLU.Buffer_Type(1024);
Mess: CM.Message_Type;
Expired: Boolean;
Accepted: Boolean;
Comment: ASU.Unbounded_String;
begin
--Binding
Port := Integer'Value(ACL.Argument(2));
Server_EP := LLU.Build(LLU.To_IP(ACL.Argument(1)),Port);
Nick := ASU.To_Unbounded_String(ACL.Argument(3));
LLU.Bind_Any(Client_EP_Receive);
LLU.Bind_Any(Client_EP_Handler, Handlers.Client_Handler'Access);
LLU.Reset(Buffer_In);
if ACL.Argument_Count = 3 then
if ASU.To_String(Nick) /= "server" then
--Init Message
CM.Init_Message(Server_EP,Client_EP_Receive,
Client_EP_Handler,Nick,Buffer_Out'Access);
LLU.Receive(Client_EP_Receive, Buffer_In'Access, 10.0, Expired);
if Expired then
ATI.Put_Line("Server unreachable");
else
--Server Reply
Mess := CM.Message_Type'Input(Buffer_In'Access);
Accepted := Boolean'Input(Buffer_In'Access);
LLU.Reset(Buffer_In);
if Accepted then
ATI.Put_Line("Mini-Chat v2.0: Welcome "
& ASU.To_String(Nick));
loop
ATI.Put(">> ");
Comment := ASU.To_Unbounded_String(ATI.Get_Line);
exit when ASU.To_String(Comment) = ".quit";
--Writer Message
CM.Writer_Message(Server_EP,Client_EP_Handler,
Nick,Comment,Buffer_Out'Access);
end loop;
--Logout Message
CM.Logout_Message(Server_EP,Client_EP_Handler,
Nick,Buffer_Out'Access);
else
ATI.Put_Line("Mini-Chat v2.0: IGNORED new user " &
ASU.To_String(Nick) & ", nick already used");
end if;
end if;
else
ATI.New_Line;
ATI.Put_Line("Nick 'server' not avaliable, try again");
ATI.New_Line;
end if;
else
ATI.New_Line;
ATI.Put_Line("Client Usage: [user] [Port] <nick>");
ATI.New_Line;
end if;
LLU.Finalize;
end Chat_Client_2;
|
with SDL;
with SDL.Error;
with SDL.Events.Events;
with SDL.Events.Keyboards;
with SDL.Inputs.Mice;
with SDL.Log;
with SDL.Video.Palettes;
with SDL.Video.Pixel_Formats;
with SDL.Video.Renderers.Makers;
with SDL.Video.Textures.Makers;
with SDL.Video.Windows.Makers;
with SDL.Versions;
procedure Mouse is
use type SDL.Dimension;
use type SDL.Positive_Sizes;
Window_Size : constant SDL.Positive_Sizes := SDL.Positive_Sizes'(800, 640);
W : SDL.Video.Windows.Window;
Renderer : SDL.Video.Renderers.Renderer;
Texture : SDL.Video.Textures.Texture;
begin
SDL.Log.Set (Category => SDL.Log.Application, Priority => SDL.Log.Debug);
if SDL.Initialise = True then
SDL.Video.Windows.Makers.Create (Win => W,
Title => "Mouse",
Position => SDL.Natural_Coordinates'(X => 300, Y => 300),
Size => Window_Size,
Flags => SDL.Video.Windows.Resizable);
SDL.Video.Renderers.Makers.Create (Renderer, W);
SDL.Video.Textures.Makers.Create (Tex => Texture,
Renderer => Renderer,
Format => SDL.Video.Pixel_Formats.Pixel_Format_ARGB_8888,
Kind => SDL.Video.Textures.Streaming,
Size => Window_Size);
-- Main loop.
declare
Event : SDL.Events.Events.Events;
Finished : Boolean := False;
Mouse_Shown : Boolean := True;
Warp_Rel : Boolean := True;
Warp_Screen : Boolean := False;
use type SDL.Events.Event_Types;
use type SDL.Events.Keyboards.Key_Codes;
use type SDL.Events.Keyboards.Scan_Codes;
begin
loop
while SDL.Events.Events.Poll (Event) loop
case Event.Common.Event_Type is
when SDL.Events.Quit =>
Finished := True;
when SDL.Events.Keyboards.Key_Down =>
case Event.Keyboard.Key_Sym.Key_Code is
when SDL.Events.Keyboards.Code_Escape =>
Finished := True;
when SDL.Events.Keyboards.Code_M =>
Mouse_Shown := not Mouse_Shown;
SDL.Inputs.Mice.Show_Cursor (Mouse_Shown);
SDL.Log.Put_Debug ("Mouse Shown : " & Boolean'Image (Mouse_Shown));
when SDL.Events.Keyboards.Code_R =>
Warp_Rel := True;
SDL.Log.Put_Debug ("Mouse warp relative: " & Boolean'Image (Warp_Rel));
when SDL.Events.Keyboards.Code_A =>
Warp_Rel := False;
SDL.Log.Put_Debug ("Mouse warp relative: " & Boolean'Image (Warp_Rel));
when SDL.Events.Keyboards.Code_W =>
SDL.Log.Put_Debug ("Warping mouse!");
if Warp_Screen then
SDL.Inputs.Mice.Warp ((0, 0));
else
SDL.Inputs.Mice.Warp (W, (0, 0));
end if;
when SDL.Events.Keyboards.Code_S =>
Warp_Screen := not Warp_Screen;
SDL.Log.Put_Debug ("Mouse warp to " & (if Warp_Screen then "screen!" else "window!"));
when others =>
null;
end case;
when others =>
null;
end case;
end loop;
Renderer.Clear;
Renderer.Copy (Texture);
Renderer.Present;
exit when Finished;
end loop;
end;
W.Finalize;
SDL.Finalise;
end if;
end Mouse;
|
package Lto20_Pkg is
type Arr is private;
Null_Arr : constant Arr;
procedure Proc (A : Arr);
private
type Obj;
type Handle is access Obj;
Null_Handle : constant Handle := null;
type Arr is array (1 .. 2) of Handle;
Null_Arr : constant Arr := (others => Null_Handle);
end Lto20_Pkg;
|
-- This package has been generated automatically by GNATtest.
-- You are allowed to add your code to the bodies of test routines.
-- Such changes will be kept during further regeneration of this file.
-- All code placed outside of test routine bodies will be lost. The
-- code intended to set up and tear down the test environment should be
-- placed into Crafts.Test_Data.
with AUnit.Assertions; use AUnit.Assertions;
with System.Assertions;
-- begin read only
-- id:2.2/00/
--
-- This section can be used to add with clauses if necessary.
--
-- end read only
with Ships.Cargo; use Ships.Cargo;
-- begin read only
-- end read only
package body Crafts.Test_Data.Tests is
-- begin read only
-- id:2.2/01/
--
-- This section can be used to add global variables and other elements.
--
-- end read only
-- begin read only
-- end read only
-- begin read only
procedure Wrap_Test_Manufacturing_dd583a_cf804c(Minutes: Positive) is
begin
GNATtest_Generated.GNATtest_Standard.Crafts.Manufacturing(Minutes);
end Wrap_Test_Manufacturing_dd583a_cf804c;
-- end read only
-- begin read only
procedure Test_Manufacturing_test_manufacturing(Gnattest_T: in out Test);
procedure Test_Manufacturing_dd583a_cf804c(Gnattest_T: in out Test) renames
Test_Manufacturing_test_manufacturing;
-- id:2.2/dd583af67efcd5dc/Manufacturing/1/0/test_manufacturing/
procedure Test_Manufacturing_test_manufacturing(Gnattest_T: in out Test) is
procedure Manufacturing(Minutes: Positive) renames
Wrap_Test_Manufacturing_dd583a_cf804c;
-- end read only
pragma Unreferenced(Gnattest_T);
begin
Manufacturing(15);
Assert(True, "This test can only crash.");
-- begin read only
end Test_Manufacturing_test_manufacturing;
-- end read only
-- begin read only
function Wrap_Test_CheckRecipe_6b22c5_37e1c4
(RecipeIndex: Unbounded_String) return Positive is
begin
begin
pragma Assert(RecipeIndex /= Null_Unbounded_String);
null;
exception
when System.Assertions.Assert_Failure =>
AUnit.Assertions.Assert
(False,
"req_sloc(crafts.ads:0):Test_CheckRecipe test requirement violated");
end;
declare
Test_CheckRecipe_6b22c5_37e1c4_Result: constant Positive :=
GNATtest_Generated.GNATtest_Standard.Crafts.CheckRecipe
(RecipeIndex);
begin
begin
pragma Assert(True);
null;
exception
when System.Assertions.Assert_Failure =>
AUnit.Assertions.Assert
(False,
"ens_sloc(crafts.ads:0:):Test_CheckRecipe test commitment violated");
end;
return Test_CheckRecipe_6b22c5_37e1c4_Result;
end;
end Wrap_Test_CheckRecipe_6b22c5_37e1c4;
-- end read only
-- begin read only
procedure Test_CheckRecipe_test_checkrecipe(Gnattest_T: in out Test);
procedure Test_CheckRecipe_6b22c5_37e1c4(Gnattest_T: in out Test) renames
Test_CheckRecipe_test_checkrecipe;
-- id:2.2/6b22c50e71f35d02/CheckRecipe/1/0/test_checkrecipe/
procedure Test_CheckRecipe_test_checkrecipe(Gnattest_T: in out Test) is
function CheckRecipe
(RecipeIndex: Unbounded_String) return Positive renames
Wrap_Test_CheckRecipe_6b22c5_37e1c4;
-- end read only
pragma Unreferenced(Gnattest_T);
begin
UpdateCargo(Player_Ship, To_Unbounded_String("6"), 10);
Assert
(CheckRecipe(To_Unbounded_String("1")) = 10,
"Failed to check crafting recipe requirements.");
-- begin read only
end Test_CheckRecipe_test_checkrecipe;
-- end read only
-- begin read only
procedure Wrap_Test_SetRecipe_d9013b_447571
(Workshop, Amount: Positive; RecipeIndex: Unbounded_String) is
begin
begin
pragma Assert
((Workshop <= Player_Ship.Modules.Last_Index and
RecipeIndex /= Null_Unbounded_String));
null;
exception
when System.Assertions.Assert_Failure =>
AUnit.Assertions.Assert
(False,
"req_sloc(crafts.ads:0):Test_SetRecipe test requirement violated");
end;
GNATtest_Generated.GNATtest_Standard.Crafts.SetRecipe
(Workshop, Amount, RecipeIndex);
begin
pragma Assert(True);
null;
exception
when System.Assertions.Assert_Failure =>
AUnit.Assertions.Assert
(False,
"ens_sloc(crafts.ads:0:):Test_SetRecipe test commitment violated");
end;
end Wrap_Test_SetRecipe_d9013b_447571;
-- end read only
-- begin read only
procedure Test_SetRecipe_test_setrecipe(Gnattest_T: in out Test);
procedure Test_SetRecipe_d9013b_447571(Gnattest_T: in out Test) renames
Test_SetRecipe_test_setrecipe;
-- id:2.2/d9013bfcb0ae8d7e/SetRecipe/1/0/test_setrecipe/
procedure Test_SetRecipe_test_setrecipe(Gnattest_T: in out Test) is
procedure SetRecipe
(Workshop, Amount: Positive; RecipeIndex: Unbounded_String) renames
Wrap_Test_SetRecipe_d9013b_447571;
-- end read only
pragma Unreferenced(Gnattest_T);
begin
UpdateCargo(Player_Ship, To_Unbounded_String("6"), 10);
SetRecipe(9, 10, To_Unbounded_String("1"));
Assert
(Player_Ship.Modules(9).Crafting_Amount = 10,
"Failed to set crafting recipe.");
-- begin read only
end Test_SetRecipe_test_setrecipe;
-- end read only
-- begin read only
-- id:2.2/02/
--
-- This section can be used to add elaboration code for the global state.
--
begin
-- end read only
null;
-- begin read only
-- end read only
end Crafts.Test_Data.Tests;
|
-- Copyright 2016-2021 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 FP1_Type is delta 0.1 range -1.0 .. +1.0;
FP1_Var : FP1_Type := 0.25;
type FP2_Type is delta 0.01 digits 14;
FP2_Var : FP2_Type := -0.01;
type FP3_Type is delta 0.1 range 0.0 .. 1.0 with Small => 0.1/3.0;
FP3_Var : FP3_Type := 0.1;
Delta4 : constant := 0.000_000_1;
type FP4_Type is delta Delta4 range 0.0 .. Delta4 * 10
with Small => Delta4 / 3.0;
FP4_Var : FP4_Type := 2 * Delta4;
Delta5 : constant := 0.000_000_000_000_000_000_1;
type FP5_Type is delta Delta5 range 0.0 .. Delta5 * 10
with Small => Delta5 / 3.0;
procedure Do_Nothing (A : System.Address);
end pck;
|
package body Tokens with SPARK_Mode is
function New_Token
(Kind : Token_Kind;
Lexeme : String;
Line : Positive)
return Token
is
begin
return Token'(Kind => Kind,
Lexeme => L_Strings.To_Bounded_String (Lexeme),
Line => Line);
end New_Token;
function To_String (T : Token) return String is
begin
return To_String (T.Kind) & L_Strings.To_String (T.Lexeme);
end To_String;
function To_String (T : Token_Kind) return String is
Image : constant String := Token_Kind'Image (T);
Result : constant String (1 .. Image'Length) := Image;
begin
if Result'Length < 100 then
return Result;
else
return Result (Result'First .. Result'First + 99);
end if;
end To_String;
end Tokens;
|
-- ___ _ ___ _ _ --
-- / __| |/ (_) | | Common SKilL implementation --
-- \__ \ ' <| | | |__ iterator over static instances --
-- |___/_|\_\_|_|____| by: Timm Felden --
-- --
pragma Ada_2012;
with Skill.Types;
with Skill.Types.Pools;
package Skill.Iterators.Static_Data is
use Skill.Types;
use type Skill.Types.Pools.Pool;
-- @note in contrast to c++, this implementation uses type erasure as I dont
-- see how to solve elaboration otherwise
type Iterator is tagged record
Current : Skill.Types.Pools.Pool;
SecondIndex : Skill_ID_T;
LastBlock : Skill_ID_T;
Index : Skill_ID_T;
Last : Skill_ID_T;
end record;
function Make (First : Skill.Types.Pools.Pool := null) return Iterator;
procedure Init (This : access Iterator'Class;
First : Skill.Types.Pools.Pool := null);
function Element
(This : access Iterator'Class) return Annotation;
function Has_Next
(This : access Iterator'Class) return Boolean is
(This.Index /= This.Last);
function Next (This : access Iterator'Class) return Annotation;
end Skill.Iterators.Static_Data;
|
--
-- Copyright (c) 2015, John Leimon <jleimon@gmail.com>
--
-- Permission to use, copy, modify, and/or distribute this software for any
-- purpose with or without fee is hereby granted, provided that the above copyright
-- notice and this permission notice appear in all copies.
--
-- THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH REGARD
-- TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN
-- NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR
-- CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
-- PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
-- ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
--
pragma Ada_2005;
pragma Style_Checks (Off);
with Interfaces.C; use Interfaces.C;
with x86_64_linux_gnu_bits_types_h;
with wchar_h;
package uG_config_h is
type u_G_fpos_t is record
uu_pos : aliased x86_64_linux_gnu_bits_types_h.uu_off_t; -- /usr/include/_G_config.h:23
uu_state : aliased wchar_h.uu_mbstate_t; -- /usr/include/_G_config.h:24
end record;
pragma Convention (C_Pass_By_Copy, u_G_fpos_t); -- /usr/include/_G_config.h:25
-- skipped anonymous struct anon_3
type u_G_fpos64_t is record
uu_pos : aliased x86_64_linux_gnu_bits_types_h.uu_off64_t; -- /usr/include/_G_config.h:28
uu_state : aliased wchar_h.uu_mbstate_t; -- /usr/include/_G_config.h:29
end record;
pragma Convention (C_Pass_By_Copy, u_G_fpos64_t); -- /usr/include/_G_config.h:30
-- skipped anonymous struct anon_4
end uG_config_h;
|
------------------------------------------------------------------------------
-- --
-- GNAT RUN-TIME COMPONENTS --
-- --
-- A D A . S T R I N G S . U N B O U N D E D --
-- --
-- S p e c --
-- --
-- Copyright (C) 1992-2020, Free Software Foundation, Inc. --
-- --
-- This specification is derived from the Ada Reference Manual for use with --
-- GNAT. The copyright notice above, and the license provisions that follow --
-- apply solely to the contents of the part following the private keyword. --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
-- ware Foundation; either version 3, or (at your option) any later ver- --
-- sion. GNAT is distributed in the hope that it will be useful, but WITH- --
-- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY --
-- or FITNESS FOR A PARTICULAR PURPOSE. --
-- --
-- As a special exception under Section 7 of GPL version 3, you are granted --
-- additional permissions described in the GCC Runtime Library Exception, --
-- version 3.1, as published by the Free Software Foundation. --
-- --
-- You should have received a copy of the GNU General Public License and --
-- a copy of the GCC Runtime Library Exception along with this program; --
-- see the files COPYING3 and COPYING.RUNTIME respectively. If not, see --
-- <http://www.gnu.org/licenses/>. --
-- --
-- GNAT was originally developed by the GNAT team at New York University. --
-- Extensive contributions were provided by Ada Core Technologies Inc. --
-- --
------------------------------------------------------------------------------
-- Preconditions in this unit are meant for analysis only, not for run-time
-- checking, so that the expected exceptions are raised. This is enforced by
-- setting the corresponding assertion policy to Ignore.
pragma Assertion_Policy (Pre => Ignore);
with Ada.Strings.Maps;
with Ada.Finalization;
private with Ada.Strings.Text_Output;
-- The language-defined package Strings.Unbounded provides a private type
-- Unbounded_String and a set of operations. An object of type
-- Unbounded_String represents a String whose low bound is 1 and whose length
-- can vary conceptually between 0 and Natural'Last. The subprograms for
-- fixed-length string handling are either overloaded directly for
-- Unbounded_String, or are modified as needed to reflect the flexibility in
-- length. Since the Unbounded_String type is private, relevant constructor
-- and selector operations are provided.
package Ada.Strings.Unbounded with
Initial_Condition => Length (Null_Unbounded_String) = 0
is
pragma Preelaborate;
type Unbounded_String is private;
pragma Preelaborable_Initialization (Unbounded_String);
Null_Unbounded_String : constant Unbounded_String;
-- Represents the null String. If an object of type Unbounded_String is not
-- otherwise initialized, it will be initialized to the same value as
-- Null_Unbounded_String.
function Length (Source : Unbounded_String) return Natural with
Global => null;
-- Returns the length of the String represented by Source
type String_Access is access all String;
-- Provides a (nonprivate) access type for explicit processing of
-- unbounded-length strings.
procedure Free (X : in out String_Access);
-- Performs an unchecked deallocation of an object of type String_Access
--------------------------------------------------------
-- Conversion, Concatenation, and Selection Functions --
--------------------------------------------------------
function To_Unbounded_String
(Source : String) return Unbounded_String
with
Post => Length (To_Unbounded_String'Result) = Source'Length,
Global => null;
-- Returns an Unbounded_String that represents Source
function To_Unbounded_String
(Length : Natural) return Unbounded_String
with
Post =>
Ada.Strings.Unbounded.Length (To_Unbounded_String'Result)
= Length,
Global => null;
-- Returns an Unbounded_String that represents an uninitialized String
-- whose length is Length.
function To_String (Source : Unbounded_String) return String with
Post => To_String'Result'Length = Length (Source),
Global => null;
-- Returns the String with lower bound 1 represented by Source
-- To_String and To_Unbounded_String are related as follows:
--
-- * If S is a String, then To_String (To_Unbounded_String (S)) = S.
--
-- * If U is an Unbounded_String, then
-- To_Unbounded_String (To_String (U)) = U.
procedure Set_Unbounded_String
(Target : out Unbounded_String;
Source : String)
with
Global => null;
pragma Ada_05 (Set_Unbounded_String);
-- Sets Target to an Unbounded_String that represents Source
procedure Append
(Source : in out Unbounded_String;
New_Item : Unbounded_String)
with
Pre => Length (New_Item) <= Natural'Last - Length (Source),
Post => Length (Source) = Length (Source)'Old + Length (New_Item),
Global => null;
procedure Append
(Source : in out Unbounded_String;
New_Item : String)
with
Pre => New_Item'Length <= Natural'Last - Length (Source),
Post => Length (Source) = Length (Source)'Old + New_Item'Length,
Global => null;
procedure Append
(Source : in out Unbounded_String;
New_Item : Character)
with
Pre => Length (Source) < Natural'Last,
Post => Length (Source) = Length (Source)'Old + 1,
Global => null;
-- For each of the Append procedures, the resulting string represented by
-- the Source parameter is given by the concatenation of the original value
-- of Source and the value of New_Item.
function "&"
(Left : Unbounded_String;
Right : Unbounded_String) return Unbounded_String
with
Pre => Length (Right) <= Natural'Last - Length (Left),
Post => Length ("&"'Result) = Length (Left) + Length (Right),
Global => null;
function "&"
(Left : Unbounded_String;
Right : String) return Unbounded_String
with
Pre => Right'Length <= Natural'Last - Length (Left),
Post => Length ("&"'Result) = Length (Left) + Right'Length,
Global => null;
function "&"
(Left : String;
Right : Unbounded_String) return Unbounded_String
with
Pre => Left'Length <= Natural'Last - Length (Right),
Post => Length ("&"'Result) = Left'Length + Length (Right),
Global => null;
function "&"
(Left : Unbounded_String;
Right : Character) return Unbounded_String
with
Pre => Length (Left) < Natural'Last,
Post => Length ("&"'Result) = Length (Left) + 1,
Global => null;
function "&"
(Left : Character;
Right : Unbounded_String) return Unbounded_String
with
Pre => Length (Right) < Natural'Last,
Post => Length ("&"'Result) = Length (Right) + 1,
Global => null;
-- Each of the "&" functions returns an Unbounded_String obtained by
-- concatenating the string or character given or represented by one of the
-- parameters, with the string or character given or represented by the
-- other parameter, and applying To_Unbounded_String to the concatenation
-- result string.
function Element
(Source : Unbounded_String;
Index : Positive) return Character
with
Pre => Index <= Length (Source),
Global => null;
-- Returns the character at position Index in the string represented by
-- Source; propagates Index_Error if Index > Length (Source).
procedure Replace_Element
(Source : in out Unbounded_String;
Index : Positive;
By : Character)
with
Pre => Index <= Length (Source),
Post => Length (Source) = Length (Source)'Old,
Global => null;
-- Updates Source such that the character at position Index in the string
-- represented by Source is By; propagates Index_Error if
-- Index > Length (Source).
function Slice
(Source : Unbounded_String;
Low : Positive;
High : Natural) return String
with
Pre => Low - 1 <= Length (Source) and then High <= Length (Source),
Post => Slice'Result'Length = Natural'Max (0, High - Low + 1),
Global => null;
-- Returns the slice at positions Low through High in the string
-- represented by Source; propagates Index_Error if
-- Low > Length (Source) + 1 or High > Length (Source). The bounds of the
-- returned string are Low and High.
function Unbounded_Slice
(Source : Unbounded_String;
Low : Positive;
High : Natural) return Unbounded_String
with
Pre => Low - 1 <= Length (Source) and then High <= Length (Source),
Post =>
Length (Unbounded_Slice'Result) = Natural'Max (0, High - Low + 1),
Global => null;
pragma Ada_05 (Unbounded_Slice);
-- Returns the slice at positions Low through High in the string
-- represented by Source as an Unbounded_String. This propagates
-- Index_Error if Low > Length(Source) + 1 or High > Length (Source).
procedure Unbounded_Slice
(Source : Unbounded_String;
Target : out Unbounded_String;
Low : Positive;
High : Natural)
with
Pre => Low - 1 <= Length (Source) and then High <= Length (Source),
Post => Length (Target) = Natural'Max (0, High - Low + 1),
Global => null;
pragma Ada_05 (Unbounded_Slice);
-- Sets Target to the Unbounded_String representing the slice at positions
-- Low through High in the string represented by Source. This propagates
-- Index_Error if Low > Length(Source) + 1 or High > Length (Source).
function "="
(Left : Unbounded_String;
Right : Unbounded_String) return Boolean
with
Global => null;
function "="
(Left : Unbounded_String;
Right : String) return Boolean
with
Global => null;
function "="
(Left : String;
Right : Unbounded_String) return Boolean
with
Global => null;
function "<"
(Left : Unbounded_String;
Right : Unbounded_String) return Boolean
with
Global => null;
function "<"
(Left : Unbounded_String;
Right : String) return Boolean
with
Global => null;
function "<"
(Left : String;
Right : Unbounded_String) return Boolean
with
Global => null;
function "<="
(Left : Unbounded_String;
Right : Unbounded_String) return Boolean
with
Global => null;
function "<="
(Left : Unbounded_String;
Right : String) return Boolean
with
Global => null;
function "<="
(Left : String;
Right : Unbounded_String) return Boolean
with
Global => null;
function ">"
(Left : Unbounded_String;
Right : Unbounded_String) return Boolean
with
Global => null;
function ">"
(Left : Unbounded_String;
Right : String) return Boolean
with
Global => null;
function ">"
(Left : String;
Right : Unbounded_String) return Boolean
with
Global => null;
function ">="
(Left : Unbounded_String;
Right : Unbounded_String) return Boolean
with
Global => null;
function ">="
(Left : Unbounded_String;
Right : String) return Boolean
with
Global => null;
function ">="
(Left : String;
Right : Unbounded_String) return Boolean
with
Global => null;
-- Each of the functions "=", "<", ">", "<=", and ">=" returns the same
-- result as the corresponding String operation applied to the String
-- values given or represented by Left and Right.
------------------------
-- Search Subprograms --
------------------------
function Index
(Source : Unbounded_String;
Pattern : String;
Going : Direction := Forward;
Mapping : Maps.Character_Mapping := Maps.Identity) return Natural
with
Pre => Pattern'Length /= 0,
Global => null;
function Index
(Source : Unbounded_String;
Pattern : String;
Going : Direction := Forward;
Mapping : Maps.Character_Mapping_Function) return Natural
with
Pre => Pattern'Length /= 0,
Global => null;
function Index
(Source : Unbounded_String;
Set : Maps.Character_Set;
Test : Membership := Inside;
Going : Direction := Forward) return Natural
with
Global => null;
function Index
(Source : Unbounded_String;
Pattern : String;
From : Positive;
Going : Direction := Forward;
Mapping : Maps.Character_Mapping := Maps.Identity) return Natural
with
Pre => (if Length (Source) /= 0 then From <= Length (Source))
and then Pattern'Length /= 0,
Global => null;
pragma Ada_05 (Index);
function Index
(Source : Unbounded_String;
Pattern : String;
From : Positive;
Going : Direction := Forward;
Mapping : Maps.Character_Mapping_Function) return Natural
with
Pre => (if Length (Source) /= 0 then From <= Length (Source))
and then Pattern'Length /= 0,
Global => null;
pragma Ada_05 (Index);
function Index
(Source : Unbounded_String;
Set : Maps.Character_Set;
From : Positive;
Test : Membership := Inside;
Going : Direction := Forward) return Natural
with
Pre => (if Length (Source) /= 0 then From <= Length (Source)),
Global => null;
pragma Ada_05 (Index);
function Index_Non_Blank
(Source : Unbounded_String;
Going : Direction := Forward) return Natural
with
Global => null;
function Index_Non_Blank
(Source : Unbounded_String;
From : Positive;
Going : Direction := Forward) return Natural
with
Pre => (if Length (Source) /= 0 then From <= Length (Source)),
Global => null;
pragma Ada_05 (Index_Non_Blank);
function Count
(Source : Unbounded_String;
Pattern : String;
Mapping : Maps.Character_Mapping := Maps.Identity) return Natural
with
Pre => Pattern'Length /= 0,
Global => null;
function Count
(Source : Unbounded_String;
Pattern : String;
Mapping : Maps.Character_Mapping_Function) return Natural
with
Pre => Pattern'Length /= 0,
Global => null;
function Count
(Source : Unbounded_String;
Set : Maps.Character_Set) return Natural
with
Global => null;
procedure Find_Token
(Source : Unbounded_String;
Set : Maps.Character_Set;
From : Positive;
Test : Membership;
First : out Positive;
Last : out Natural)
with
Pre => (if Length (Source) /= 0 then From <= Length (Source)),
Global => null;
pragma Ada_2012 (Find_Token);
procedure Find_Token
(Source : Unbounded_String;
Set : Maps.Character_Set;
Test : Membership;
First : out Positive;
Last : out Natural)
with
Global => null;
-- Each of the search subprograms (Index, Index_Non_Blank, Count,
-- Find_Token) has the same effect as the corresponding subprogram in
-- Strings.Fixed applied to the string represented by the Unbounded_String
-- parameter.
------------------------------------
-- String Translation Subprograms --
------------------------------------
function Translate
(Source : Unbounded_String;
Mapping : Maps.Character_Mapping) return Unbounded_String
with
Post => Length (Translate'Result) = Length (Source),
Global => null;
procedure Translate
(Source : in out Unbounded_String;
Mapping : Maps.Character_Mapping)
with
Post => Length (Source) = Length (Source)'Old,
Global => null;
function Translate
(Source : Unbounded_String;
Mapping : Maps.Character_Mapping_Function) return Unbounded_String
with
Post => Length (Translate'Result) = Length (Source),
Global => null;
procedure Translate
(Source : in out Unbounded_String;
Mapping : Maps.Character_Mapping_Function)
with
Post => Length (Source) = Length (Source)'Old,
Global => null;
-- The Translate function has an analogous effect to the corresponding
-- subprogram in Strings.Fixed. The translation is applied to the string
-- represented by the Unbounded_String parameter, and the result is
-- converted (via To_Unbounded_String) to an Unbounded_String.
---------------------------------------
-- String Transformation Subprograms --
---------------------------------------
function Replace_Slice
(Source : Unbounded_String;
Low : Positive;
High : Natural;
By : String) return Unbounded_String
with
Pre =>
Low - 1 <= Length (Source)
and then (if High >= Low
then Low - 1
<= Natural'Last - By'Length
- Natural'Max (Length (Source) - High, 0)
else Length (Source) <= Natural'Last - By'Length),
Contract_Cases =>
(High >= Low =>
Length (Replace_Slice'Result)
= Low - 1 + By'Length + Natural'Max (Length (Source)'Old - High, 0),
others =>
Length (Replace_Slice'Result) = Length (Source)'Old + By'Length),
Global => null;
procedure Replace_Slice
(Source : in out Unbounded_String;
Low : Positive;
High : Natural;
By : String)
with
Pre =>
Low - 1 <= Length (Source)
and then (if High >= Low
then Low - 1
<= Natural'Last - By'Length
- Natural'Max (Length (Source) - High, 0)
else Length (Source) <= Natural'Last - By'Length),
Contract_Cases =>
(High >= Low =>
Length (Source)
= Low - 1 + By'Length + Natural'Max (Length (Source)'Old - High, 0),
others =>
Length (Source) = Length (Source)'Old + By'Length),
Global => null;
function Insert
(Source : Unbounded_String;
Before : Positive;
New_Item : String) return Unbounded_String
with
Pre => Before - 1 <= Length (Source)
and then New_Item'Length <= Natural'Last - Length (Source),
Post => Length (Insert'Result) = Length (Source) + New_Item'Length,
Global => null;
procedure Insert
(Source : in out Unbounded_String;
Before : Positive;
New_Item : String)
with
Pre => Before - 1 <= Length (Source)
and then New_Item'Length <= Natural'Last - Length (Source),
Post => Length (Source) = Length (Source)'Old + New_Item'Length,
Global => null;
function Overwrite
(Source : Unbounded_String;
Position : Positive;
New_Item : String) return Unbounded_String
with
Pre => Position - 1 <= Length (Source)
and then (if New_Item'Length /= 0
then
New_Item'Length <= Natural'Last - (Position - 1)),
Post =>
Length (Overwrite'Result)
= Natural'Max (Length (Source), Position - 1 + New_Item'Length),
Global => null;
procedure Overwrite
(Source : in out Unbounded_String;
Position : Positive;
New_Item : String)
with
Pre => Position - 1 <= Length (Source)
and then (if New_Item'Length /= 0
then
New_Item'Length <= Natural'Last - (Position - 1)),
Post =>
Length (Source)
= Natural'Max (Length (Source)'Old, Position - 1 + New_Item'Length),
Global => null;
function Delete
(Source : Unbounded_String;
From : Positive;
Through : Natural) return Unbounded_String
with
Pre => (if Through <= From then From - 1 <= Length (Source)),
Contract_Cases =>
(Through >= From =>
Length (Delete'Result) = Length (Source) - (Through - From + 1),
others =>
Length (Delete'Result) = Length (Source)),
Global => null;
procedure Delete
(Source : in out Unbounded_String;
From : Positive;
Through : Natural)
with
Pre => (if Through <= From then From - 1 <= Length (Source)),
Contract_Cases =>
(Through >= From =>
Length (Source) = Length (Source)'Old - (Through - From + 1),
others =>
Length (Source) = Length (Source)'Old),
Global => null;
function Trim
(Source : Unbounded_String;
Side : Trim_End) return Unbounded_String
with
Post => Length (Trim'Result) <= Length (Source),
Global => null;
procedure Trim
(Source : in out Unbounded_String;
Side : Trim_End)
with
Post => Length (Source) <= Length (Source)'Old,
Global => null;
function Trim
(Source : Unbounded_String;
Left : Maps.Character_Set;
Right : Maps.Character_Set) return Unbounded_String
with
Post => Length (Trim'Result) <= Length (Source),
Global => null;
procedure Trim
(Source : in out Unbounded_String;
Left : Maps.Character_Set;
Right : Maps.Character_Set)
with
Post => Length (Source) <= Length (Source)'Old,
Global => null;
function Head
(Source : Unbounded_String;
Count : Natural;
Pad : Character := Space) return Unbounded_String
with
Post => Length (Head'Result) = Count,
Global => null;
procedure Head
(Source : in out Unbounded_String;
Count : Natural;
Pad : Character := Space)
with
Post => Length (Source) = Count,
Global => null;
function Tail
(Source : Unbounded_String;
Count : Natural;
Pad : Character := Space) return Unbounded_String
with
Post => Length (Tail'Result) = Count,
Global => null;
procedure Tail
(Source : in out Unbounded_String;
Count : Natural;
Pad : Character := Space)
with
Post => Length (Source) = Count,
Global => null;
function "*"
(Left : Natural;
Right : Character) return Unbounded_String
with
Pre => Left <= Natural'Last,
Post => Length ("*"'Result) = Left,
Global => null;
function "*"
(Left : Natural;
Right : String) return Unbounded_String
with
Pre => (if Left /= 0 then Right'Length <= Natural'Last / Left),
Post => Length ("*"'Result) = Left * Right'Length,
Global => null;
function "*"
(Left : Natural;
Right : Unbounded_String) return Unbounded_String
with
Pre => (if Left /= 0 then Length (Right) <= Natural'Last / Left),
Post => Length ("*"'Result) = Left * Length (Right),
Global => null;
-- Each of the transformation functions (Replace_Slice, Insert, Overwrite,
-- Delete), selector functions (Trim, Head, Tail), and constructor
-- functions ("*") is likewise analogous to its corresponding subprogram in
-- Strings.Fixed. For each of the subprograms, the corresponding
-- fixed-length string subprogram is applied to the string represented by
-- the Unbounded_String parameter, and To_Unbounded_String is applied the
-- result string.
--
-- For each of the procedures Translate, Replace_Slice, Insert, Overwrite,
-- Delete, Trim, Head, and Tail, the resulting string represented by the
-- Source parameter is given by the corresponding function for fixed-length
-- strings applied to the string represented by Source's original value.
private
pragma Inline (Length);
package AF renames Ada.Finalization;
Null_String : aliased String := "";
function To_Unbounded (S : String) return Unbounded_String
renames To_Unbounded_String;
type Unbounded_String is new AF.Controlled with record
Reference : String_Access := Null_String'Access;
Last : Natural := 0;
end record with Put_Image => Put_Image;
procedure Put_Image
(S : in out Ada.Strings.Text_Output.Sink'Class; V : Unbounded_String);
-- The Unbounded_String is using a buffered implementation to increase
-- speed of the Append/Delete/Insert procedures. The Reference string
-- pointer above contains the current string value and extra room at the
-- end to be used by the next Append routine. Last is the index of the
-- string ending character. So the current string value is really
-- Reference (1 .. Last).
pragma Stream_Convert (Unbounded_String, To_Unbounded, To_String);
-- Provide stream routines without dragging in Ada.Streams
pragma Finalize_Storage_Only (Unbounded_String);
-- Finalization is required only for freeing storage
procedure Initialize (Object : in out Unbounded_String);
procedure Adjust (Object : in out Unbounded_String);
procedure Finalize (Object : in out Unbounded_String);
procedure Realloc_For_Chunk
(Source : in out Unbounded_String;
Chunk_Size : Natural);
pragma Inline (Realloc_For_Chunk);
-- Adjust the size allocated for the string. Add at least Chunk_Size so it
-- is safe to add a string of this size at the end of the current content.
-- The real size allocated for the string is Chunk_Size + x of the current
-- string size. This buffered handling makes the Append unbounded string
-- routines very fast. This spec is in the private part so that it can be
-- accessed from children (e.g. from Unbounded.Text_IO).
Null_Unbounded_String : constant Unbounded_String :=
(AF.Controlled with
Reference => Null_String'Access,
Last => 0);
end Ada.Strings.Unbounded;
|
with Simple_IO;
package body Aliasing
with SPARK_Mode => On
is
procedure Multiply (X, Y : in Rec;
Z : out Rec)
is
begin
Z := (0, 0);
Z.F := X.F * Y.F;
Z.G := X.G * Y.G;
end Multiply;
procedure Test
is
R : Rec;
Result : Integer;
begin
R := (10, 10);
Result := 100;
-- If R is passed by reference, then parameters might be aliased here.
-- This is unspecified in Ada, so must be eliminated in SPARK
Multiply (R, R, R);
Result := Result / R.F; -- So R.F might be 0 here
Simple_IO.Put_Line (Result);
end Test;
end Aliasing;
|
with Loop_Optimization10_Pkg; use Loop_Optimization10_Pkg;
package Loop_Optimization10 is
type Dual_Axis_Type is (One, Two);
type Array_Real_Type is array (Dual_Axis_Type) of Float;
type Array_Limit_Type is array (Dual_Axis_Type) of Limit_Type;
function F (Low, High : in Array_Real_Type) return Array_Limit_Type;
end Loop_Optimization10;
|
-- Copyright (c) 2017 Maxim Reznik <reznikmm@gmail.com>
--
-- SPDX-License-Identifier: MIT
-- License-Filename: LICENSE
-------------------------------------------------------------
with Ada.Containers.Hashed_Maps;
with Ada.Streams;
with League.Strings;
private with League.Strings.Hash;
with LSP.Messages;
with LSP.Message_Handlers;
with LSP.Types;
package LSP.Request_Dispatchers is
pragma Preelaborate;
type Request_Dispatcher is tagged limited private;
type Parameter_Handler_Access is access function
(Stream : access Ada.Streams.Root_Stream_Type'Class;
Handler : not null LSP.Message_Handlers.Request_Handler_Access)
return LSP.Messages.ResponseMessage'Class;
not overriding procedure Register
(Self : in out Request_Dispatcher;
Method : League.Strings.Universal_String;
Value : Parameter_Handler_Access);
not overriding function Dispatch
(Self : in out Request_Dispatcher;
Method : LSP.Types.LSP_String;
Stream : access Ada.Streams.Root_Stream_Type'Class;
Handler : not null LSP.Message_Handlers.Request_Handler_Access)
return LSP.Messages.ResponseMessage'Class;
private
package Maps is new Ada.Containers.Hashed_Maps
(Key_Type => League.Strings.Universal_String,
Element_Type => Parameter_Handler_Access,
Hash => League.Strings.Hash,
Equivalent_Keys => League.Strings."=",
"=" => "=");
type Request_Dispatcher is tagged limited record
Map : Maps.Map;
Value : LSP.Message_Handlers.Request_Handler_Access;
end record;
end LSP.Request_Dispatchers;
|
------------------------------------------------------------------------------
-- Copyright (c) 2016, Natacha Porté --
-- --
-- Permission to use, copy, modify, and distribute this software for any --
-- purpose with or without fee is hereby granted, provided that the above --
-- copyright notice and this permission notice appear in all copies. --
-- --
-- THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES --
-- WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF --
-- MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR --
-- ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES --
-- WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN --
-- ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF --
-- OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. --
------------------------------------------------------------------------------
------------------------------------------------------------------------------
-- Natools.Smaz_Implementations.Base_64 provides the subprograms needed to --
-- instantiate Natools.Smaz_Generic into a variant of the Smaz compression --
-- algorithm that output directly base-64 printable symbols, but with a --
-- dictionary containing at most 61 elements. --
-- --
-- Similarly to original Smaz, low-numbered base-64 digit are indices in --
-- the static dictionary, while high-numbered ones are verbatim headers. --
-- The verbatim headers all indicate a number of bytes in the decoded --
-- stream, and it is encoded without padding characters in the output (e.g. --
-- a two-byte verbatim sequence would be encoded as only three base-64 --
-- symbols). --
-- --
-- When Variable_Length_Verbatim is True, the same scheme as original Smaz --
-- is used: 62 means one verbatim byte (encoded in two base-64 digits), 61 --
-- means two verbatim bytes, and so on, while 63 is followed by the number --
-- of bytes on top of the hardcoded ones. For example, with a 60-entry --
-- dictionary, 59 means the last dictionary entry, and 60 means 3-byte --
-- verbatim string, and 63, 0 means 4-byte verbatim string. --
-- --
-- When Variable_Length_Verbatim is False, another variable-length scheme --
-- is used, where the number of extra blocks is stored in the padding bits. --
-- * 111111 nnnnnn ... means (n+1) 3-byte blocks of verbatim data, --
-- * 111110 AAAAAA AAnnnn ... means n 3-byte blocks and 1 byte (A), --
-- * 111101 AAAAAA AABBBB BBBBnn ... means n 3-byte blocks and 2 bytes --
-- If the dictionary is smaller, the extra codes are used for further 3n+2 --
-- blocks. For example, 60 would then mean 3(n+4)+2 bytes of verbatim data. --
------------------------------------------------------------------------------
with Ada.Streams;
with Natools.Smaz_Implementations.Base_64_Tools;
package Natools.Smaz_Implementations.Base_64 is
pragma Pure;
procedure Read_Code
(Input : in Ada.Streams.Stream_Element_Array;
Offset : in out Ada.Streams.Stream_Element_Offset;
Code : out Natools.Smaz_Implementations.Base_64_Tools.Base_64_Digit;
Verbatim_Length : out Natural;
Last_Code : in Natools.Smaz_Implementations.Base_64_Tools.Base_64_Digit;
Variable_Length_Verbatim : in Boolean);
procedure Read_Verbatim
(Input : in Ada.Streams.Stream_Element_Array;
Offset : in out Ada.Streams.Stream_Element_Offset;
Output : out String);
procedure Skip_Verbatim
(Input : in Ada.Streams.Stream_Element_Array;
Offset : in out Ada.Streams.Stream_Element_Offset;
Verbatim_Length : in Positive);
function Verbatim_Size
(Input_Length : in Positive;
Last_Code : in Natools.Smaz_Implementations.Base_64_Tools.Base_64_Digit;
Variable_Length_Verbatim : in Boolean)
return Ada.Streams.Stream_Element_Count;
procedure Write_Code
(Output : in out Ada.Streams.Stream_Element_Array;
Offset : in out Ada.Streams.Stream_Element_Offset;
Code : in Natools.Smaz_Implementations.Base_64_Tools.Base_64_Digit);
procedure Write_Verbatim
(Output : in out Ada.Streams.Stream_Element_Array;
Offset : in out Ada.Streams.Stream_Element_Offset;
Input : in String;
Last_Code : in Natools.Smaz_Implementations.Base_64_Tools.Base_64_Digit;
Variable_Length_Verbatim : in Boolean);
end Natools.Smaz_Implementations.Base_64;
|
with Ada.Integer_Text_IO;
use Ada.Integer_Text_IO;
procedure For_Each is
A : array (1..5) of Integer := (-1, 0, 1, 2, 3);
begin
for Num in A'Range loop
Put( A (Num) );
end loop;
end For_Each;
|
-- Copyright (C) 2019 Thierry Rascle <thierr26@free.fr>
-- MIT license. Please refer to the LICENSE file.
function Apsepp_Test_Node_Barrier.Create_Test_Reporter
(Barrier : Test_Node_Barrier_Access;
Char_Name_Image : Char_Name_Image_Func;
Tag_To_Char : Tag_To_Char_Func) return Test_Reporter_W_Barrier;
|
with Interfaces;
package STM32.F4.RCC is
pragma Preelaborate;
-- CR
type Clock_Control_Register is record
HSION: Boolean;
HSIRDY: Boolean;
HSITRIM: Integer range 0 .. 2**5 - 1;
HSICAL: Integer range 0 .. 2**8 - 1;
HSEON: Boolean;
HSERDY: Boolean;
HSEBYP: Boolean;
CSSON: Boolean;
PLLON: Boolean;
PLLRDY: Boolean;
PLLI2SON: Boolean;
PLLI2SRDY: Boolean;
end record with Size => 32;
for Clock_Control_Register use record
HSION at 0 range 0 .. 0;
HSIRDY at 0 range 1 .. 1;
HSITRIM at 0 range 3 .. 7;
HSICAL at 0 range 8 .. 15;
HSEON at 0 range 16 .. 16;
HSERDY at 0 range 17 .. 17;
HSEBYP at 0 range 18 .. 18;
CSSON at 0 range 19 .. 19;
PLLON at 0 range 24 .. 24;
PLLRDY at 0 range 25 .. 25;
PLLI2SON at 0 range 26 .. 26;
PLLI2SRDY at 0 range 27 .. 27;
end record;
--- PLLCFGR
type PLL_Division_Factor is (
PLL_DIV_2,
PLL_DIV_4,
PLL_DIV_6,
PLL_DIV_8
);
for PLL_Division_Factor use (
PLL_DIV_2 => 2#00#,
PLL_DIV_4 => 2#01#,
PLL_DIV_6 => 2#10#,
PLL_DIV_8 => 2#11#
);
type PLL_Clock_Source is (
PLLSRC_HSI,
PLLSRC_HSE
);
for PLL_Clock_Source use (
PLLSRC_HSI => 0,
PLLSRC_HSE => 1
);
type PLL_Configuration_Register is record
PLLM: Integer range 2 .. 63;
PLLN: Integer range 50 .. 432;
PLLP: PLL_Division_Factor;
PLLSRC: PLL_Clock_Source;
PLLQ: Integer range 2 .. 15;
end record with Size => 32;
for PLL_Configuration_Register use record
PLLM at 0 range 0 .. 5;
PLLN at 0 range 6 .. 14;
PLLP at 0 range 16 .. 17;
PLLSRC at 0 range 22 .. 22;
PLLQ at 0 range 24 .. 27;
end record;
-- CFGR
type System_Clock_Switch is (
System_Clock_HSI,
System_Clock_HSE,
System_Clock_PLL
) with Size => 2;
for System_Clock_Switch use (
System_Clock_HSI => 2#00#,
System_Clock_HSE => 2#01#,
System_Clock_PLL => 2#10#
);
type AHB_Prescaler_Factor is (
AHB_Prescaler_1,
AHB_Prescaler_2,
AHB_Prescaler_4,
AHB_Prescaler_8,
AHB_Prescaler_16,
AHB_Prescaler_64,
AHB_Prescaler_128,
AHB_Prescaler_256,
AHB_Prescaler_512
) with Size => 4;
for AHB_Prescaler_Factor use (
AHB_Prescaler_1 => 2#0000#,
AHB_Prescaler_2 => 2#1000#,
AHB_Prescaler_4 => 2#1001#,
AHB_Prescaler_8 => 2#1010#,
AHB_Prescaler_16 => 2#1011#,
AHB_Prescaler_64 => 2#1100#,
AHB_Prescaler_128 => 2#1101#,
AHB_Prescaler_256 => 2#1110#,
AHB_Prescaler_512 => 2#1111#
);
type APB_Prescaler_Factor is (
APB_Prescaler_1,
APB_Prescaler_2,
APB_Prescaler_4,
APB_Prescaler_8,
APB_Prescaler_16
) with Size => 3;
for APB_Prescaler_Factor use (
APB_Prescaler_1 => 2#000#,
APB_Prescaler_2 => 2#100#,
APB_Prescaler_4 => 2#101#,
APB_Prescaler_8 => 2#110#,
APB_Prescaler_16 => 2#111#
);
type Clock_Output_1 is (
Clock_Output_1_HSI,
Clock_Output_1_LSE,
Clock_Output_1_HSE,
Clock_Output_1_PLL
) with Size => 2;
for Clock_Output_1 use (
Clock_Output_1_HSI => 2#00#,
Clock_Output_1_LSE => 2#01#,
Clock_Output_1_HSE => 2#10#,
Clock_Output_1_PLL => 2#11#
);
type I2S_Clock_Source is (
I2S_Clock_PLLI2S,
I2S_Clock_CLKIN
) with Size => 1;
for I2S_Clock_Source use (
I2S_Clock_PLLI2S => 0,
I2S_Clock_CLKIN => 1
);
type Clock_Output_Prescaler_Factor is (
MCO_Prescaler_1,
MCO_Prescaler_2,
MCO_Prescaler_3,
MCO_Prescaler_4,
MCO_Prescaler_5
) with Size => 3;
for Clock_Output_Prescaler_Factor use (
MCO_Prescaler_1 => 2#000#,
MCO_Prescaler_2 => 2#100#,
MCO_Prescaler_3 => 2#101#,
MCO_Prescaler_4 => 2#110#,
MCO_Prescaler_5 => 2#111#
);
type Clock_Output_2 is (
Clock_Output_2_SYSCLK,
Clock_Output_2_PLLI2S,
Clock_Output_2_HSE,
Clock_Output_2_PLL
) with Size => 2;
for Clock_Output_2 use (
Clock_Output_2_SYSCLK => 2#00#,
Clock_Output_2_PLLI2S => 2#01#,
Clock_Output_2_HSE => 2#10#,
Clock_Output_2_PLL => 2#11#
);
type Clock_Configuration_Register is record
SW: System_Clock_Switch;
SWS: System_Clock_Switch;
HPRE: AHB_Prescaler_Factor;
Reserved_8: Integer range 0 .. 3;
PPRE1: APB_Prescaler_Factor;
PPRE2: APB_Prescaler_Factor;
RTCPRE: Integer range 0 .. 31;
MCO1: Clock_Output_1;
I2SSCR: I2S_Clock_Source;
MCO1PRE: Clock_Output_Prescaler_Factor;
MCO2PRE: Clock_Output_Prescaler_Factor;
MCO2: Clock_Output_2;
end record with Size => 32;
for Clock_Configuration_Register use record
SW at 0 range 0 .. 1;
SWS at 0 range 2 .. 3;
HPRE at 0 range 4 .. 7;
Reserved_8 at 0 range 8 .. 9;
PPRE1 at 0 range 10 .. 12;
PPRE2 at 0 range 13 .. 15;
RTCPRE at 0 range 16 .. 20;
MCO1 at 0 range 21 .. 22;
I2SSCR at 0 range 23 .. 23;
MCO1PRE at 0 range 24 .. 26;
MCO2PRE at 0 range 27 .. 29;
MCO2 at 0 range 30 .. 31;
end record;
-- CIR
type Clock_Interrupt_Register is record
LSIRDYF: Boolean;
LSERDYF: Boolean;
HSIRDYF: Boolean;
HSERDYF: Boolean;
PLLRDYF: Boolean;
PLLI2SRDYF: Boolean;
Reserved_6: Integer range 0 .. 1;
CSSF: Boolean;
LSIRDYIE: Boolean;
LSERDYIE: Boolean;
HSIRDYIE: Boolean;
HSERDYIE: Boolean;
PLLRDYIE: Boolean;
PLLI2SRDYIE: Boolean;
Reserved_14: Integer range 0 .. 2**2 - 1;
LSIRDYC: Boolean;
LSERDYC: Boolean;
HSIRDYC: Boolean;
HSERDYC: Boolean;
PLLRDYC: Boolean;
PLLI2SRDYC: Boolean;
Reserved_22: Integer range 0 .. 1;
CSSC: Boolean;
Reserved_24: Integer range 0 .. 2**8 - 1;
end record with Size => 32;
for Clock_Interrupt_Register use record
LSIRDYF at 0 range 0 .. 0;
LSERDYF at 0 range 1 .. 1;
HSIRDYF at 0 range 2 .. 2;
HSERDYF at 0 range 3 .. 3;
PLLRDYF at 0 range 4 .. 4;
PLLI2SRDYF at 0 range 5 .. 5;
Reserved_6 at 0 range 6 .. 6;
CSSF at 0 range 7 .. 7;
LSIRDYIE at 0 range 8 .. 8;
LSERDYIE at 0 range 9 .. 9;
HSIRDYIE at 0 range 10 .. 10;
HSERDYIE at 0 range 11 .. 11;
PLLRDYIE at 0 range 12 .. 12;
PLLI2SRDYIE at 0 range 13 .. 13;
Reserved_14 at 0 range 14 .. 15;
LSIRDYC at 0 range 16 .. 16;
LSERDYC at 0 range 17 .. 17;
HSIRDYC at 0 range 18 .. 18;
HSERDYC at 0 range 19 .. 19;
PLLRDYC at 0 range 20 .. 20;
PLLI2SRDYC at 0 range 21 .. 21;
Reserved_22 at 0 range 22 .. 22;
CSSC at 0 range 23 .. 23;
Reserved_24 at 0 range 24 .. 31;
end record;
-- AHB1RSTR, AHB1ENR
type AHB1_Register is record
GPIOA: Boolean;
GPIOB: Boolean;
GPIOC: Boolean;
GPIOD: Boolean;
GPIOE: Boolean;
GPIOF: Boolean;
GPIOG: Boolean;
GPIOH: Boolean;
GPIOI: Boolean;
GPIOJ: Boolean;
GPIOK: Boolean;
CRC: Boolean;
FLITF: Boolean;
SRAM1: Boolean;
SRAM2: Boolean;
BKPSRAM: Boolean;
CCMDATARAM: Boolean;
DMA1: Boolean;
DMA2: Boolean;
DMA2D: Boolean;
ETHMAC: Boolean;
ETHMACTX: Boolean;
ETHMACRX: Boolean;
ETHMACPTP: Boolean;
OTGHS: Boolean;
OTGHSULPI: Boolean;
end record with Size => 32;
for AHB1_Register use record
GPIOA at 0 range 0 .. 0;
GPIOB at 0 range 1 .. 1;
GPIOC at 0 range 2 .. 2;
GPIOD at 0 range 3 .. 3;
GPIOE at 0 range 4 .. 4;
GPIOF at 0 range 5 .. 5;
GPIOG at 0 range 6 .. 6;
GPIOH at 0 range 7 .. 7;
GPIOI at 0 range 8 .. 8;
GPIOJ at 0 range 9 .. 9;
GPIOK at 0 range 10 .. 10;
CRC at 0 range 12 .. 12;
FLITF at 0 range 15 .. 15;
SRAM1 at 0 range 16 .. 16;
SRAM2 at 0 range 17 .. 17;
BKPSRAM at 0 range 18 .. 18;
CCMDATARAM at 0 range 20 .. 20;
DMA1 at 0 range 21 .. 21;
DMA2 at 0 range 22 .. 22;
DMA2D at 0 range 23 .. 23;
ETHMAC at 0 range 25 .. 25;
ETHMACTX at 0 range 26 .. 26;
ETHMACRX at 0 range 27 .. 27;
ETHMACPTP at 0 range 28 .. 28;
OTGHS at 0 range 29 .. 29;
OTGHSULPI at 0 range 30 .. 30;
end record;
-- AHB2RSTR, AHB2ENR
type AHB2_Register is record
DCMI: Boolean;
CRYP: Boolean;
HASH: Boolean;
RNG: Boolean;
OTGFS: Boolean;
end record with Size => 32;
for AHB2_Register use record
DCMI at 0 range 0 .. 0;
CRYP at 0 range 4 .. 4;
HASH at 0 range 5 .. 5;
RNG at 0 range 6 .. 6;
OTGFS at 0 range 7 .. 7;
end record;
-- AHB3RSTR, AHB3ENR
type AHB3_Register is record
FMC: Boolean;
end record with Size => 32;
for AHB3_Register use record
FMC at 0 range 0 .. 0;
end record;
-- APB1RSTR, APB1ENR
type APB1_Register is record
TIM2: Boolean;
TIM3: Boolean;
TIM4: Boolean;
TIM5: Boolean;
TIM6: Boolean;
TIM7: Boolean;
TIM12: Boolean;
TIM13: Boolean;
TIM14: Boolean;
WWDG: Boolean;
SPI2: Boolean;
SPI3: Boolean;
USART2: Boolean;
USART3: Boolean;
UART4: Boolean;
UART5: Boolean;
I2C1: Boolean;
I2C2: Boolean;
I2C3: Boolean;
CAN1: Boolean;
CAN2: Boolean;
PWR: Boolean;
DAC: Boolean;
UART7: Boolean;
UART8: Boolean;
end record with Size => 32;
for APB1_Register use record
TIM2 at 0 range 0 .. 0;
TIM3 at 0 range 1 .. 1;
TIM4 at 0 range 2 .. 2;
TIM5 at 0 range 3 .. 3;
TIM6 at 0 range 4 .. 4;
TIM7 at 0 range 5 .. 5;
TIM12 at 0 range 6 .. 6;
TIM13 at 0 range 7 .. 7;
TIM14 at 0 range 8 .. 8;
WWDG at 0 range 11 .. 11;
SPI2 at 0 range 14 .. 14;
SPI3 at 0 range 15 .. 15;
USART2 at 0 range 17 .. 17;
USART3 at 0 range 18 .. 18;
UART4 at 0 range 19 .. 19;
UART5 at 0 range 20 .. 20;
I2C1 at 0 range 21 .. 21;
I2C2 at 0 range 22 .. 22;
I2C3 at 0 range 23 .. 23;
CAN1 at 0 range 25 .. 25;
CAN2 at 0 range 26 .. 26;
PWR at 0 range 28 .. 28;
DAC at 0 range 29 .. 29;
UART7 at 0 range 30 .. 30;
UART8 at 0 range 31 .. 31;
end record;
-- APB2RSTR, APB2ENR
type APB2_Register is record
TIM1: Boolean;
TIM8: Boolean;
USART1: Boolean;
USART6: Boolean;
ADC1: Boolean; -- RST resets all ADCs
ADC2: Boolean;
ADC3: Boolean;
SDIO: Boolean;
SPI1: Boolean;
SPI4: Boolean;
SYSCFG: Boolean;
TIM9: Boolean;
TIM10: Boolean;
TIM11: Boolean;
SPI5: Boolean;
SPI6: Boolean;
SAI1: Boolean;
LTDC: Boolean;
end record with Size => 32;
for APB2_Register use record
TIM1 at 0 range 0 .. 0;
TIM8 at 0 range 1 .. 1;
USART1 at 0 range 4 .. 4;
USART6 at 0 range 5 .. 5;
ADC1 at 0 range 8 .. 8;
ADC2 at 0 range 9 .. 9;
ADC3 at 0 range 10 .. 10;
SDIO at 0 range 11 .. 11;
SPI1 at 0 range 12 .. 12;
SPI4 at 0 range 13 .. 13;
SYSCFG at 0 range 14 .. 14;
TIM9 at 0 range 16 .. 16;
TIM10 at 0 range 17 .. 17;
TIM11 at 0 range 18 .. 18;
SPI5 at 0 range 20 .. 20;
SPI6 at 0 range 21 .. 21;
SAI1 at 0 range 22 .. 22;
LTDC at 0 range 26 .. 26;
end record;
-- BCDR
type RTC_Clock_Source is (
RTC_Not_Clocked,
RTC_Clock_LSE,
RTC_Clock_LSI,
RTC_Clock_HSE
) with Size => 2;
for RTC_Clock_Source use (
RTC_Not_Clocked => 2#00#,
RTC_Clock_LSE => 2#01#,
RTC_Clock_LSI => 2#10#,
RTC_Clock_HSE => 2#11#
);
type Backup_Domain_Control_Register is record
LSEON: Boolean;
LSERDY: Boolean;
LSEBYP: Boolean;
Reserved_3: Integer range 0 .. 2**5 - 1;
RTCSEL: RTC_Clock_Source;
Reserved_10: Integer range 0 .. 2**5 - 1;
RTCEN: Boolean;
BDRST: Boolean;
Reserved_17: Integer range 0 .. 2**15 - 1;
end record with Size => 32;
for Backup_Domain_Control_Register use record
LSEON at 0 range 0 .. 0;
LSERDY at 0 range 1 .. 1;
LSEBYP at 0 range 2 .. 2;
Reserved_3 at 0 range 3 .. 7;
RTCSEL at 0 range 8 .. 9;
Reserved_10 at 0 range 10 .. 14;
RTCEN at 0 range 15 .. 15;
BDRST at 0 range 16 .. 16;
Reserved_17 at 0 range 17 .. 31;
end record;
-- CSR
type Clock_Control_and_Status_Register is record
LSION: Boolean;
LSIRDY: Boolean;
Reserved_2: Integer range 0 .. 2**22 - 1;
RMVF: Boolean;
BORRSTF: Boolean;
PINRSTF: Boolean;
PORRSTF: Boolean;
SFTRSTF: Boolean;
IWDGRSTF: Boolean;
WWDGRSTF: Boolean;
LPWRRSTF: Boolean;
end record with Size => 32;
for Clock_Control_and_Status_Register use record
LSION at 0 range 0 .. 0;
LSIRDY at 0 range 1 .. 1;
Reserved_2 at 0 range 2 .. 23;
RMVF at 0 range 24 .. 24;
BORRSTF at 0 range 25 .. 25;
PINRSTF at 0 range 26 .. 26;
PORRSTF at 0 range 27 .. 27;
SFTRSTF at 0 range 28 .. 28;
IWDGRSTF at 0 range 29 .. 29;
WWDGRSTF at 0 range 30 .. 30;
LPWRRSTF at 0 range 31 .. 31;
end record;
-- SSCGR
type Spread_Select is (
Center_Spread,
Down_Spread
) with Size => 1;
for Spread_Select use (
Center_Spread => 0,
Down_Spread => 1
);
type Spread_Spectrum_Clock_Generation_Register is record
MODPER: Integer range 0 .. 2**13 - 1;
INCSTEP: Integer range 0 .. 2**15 - 1;
Reserved_28: Integer range 0 .. 3;
SPREADSEL: Spread_Select;
SSCGEN: Boolean;
end record with Size => 32;
for Spread_Spectrum_Clock_Generation_Register use record
MODPER at 0 range 0 .. 12;
INCSTEP at 0 range 13 .. 27;
Reserved_28 at 0 range 28 .. 29;
SPREADSEL at 0 range 30 .. 30;
SSCGEN at 0 range 31 .. 31;
end record;
-- PLLI2SCFGR
type PLLI2S_Configuration_Register is record
Reserved_0: Integer range 0 .. 2**6 - 1;
PLLI2SN: Integer range 2 .. 432;
Reserved_15: Integer range 0 .. 2**13 - 1;
PLLI2SR: Integer range 2 .. 7;
Reserved_31: Integer range 0 .. 1;
end record with Size => 32;
for PLLI2S_Configuration_Register use record
Reserved_0 at 0 range 0 .. 5;
PLLI2SN at 0 range 6 .. 14;
Reserved_15 at 0 range 15 .. 27;
PLLI2SR at 0 range 28 .. 30;
Reserved_31 at 0 range 31 .. 31;
end record;
type RCC_Registers is record
CR: Clock_Control_Register;
PLLCFGR: PLL_Configuration_Register;
CFGR: Clock_Configuration_Register;
CIR: Clock_Interrupt_Register;
AHB1RSTR: AHB1_Register;
AHB2RSTR: AHB2_Register;
AHB3RSTR: AHB3_Register;
APB1RSTR: APB1_Register;
APB2RSTR: APB2_Register;
AHB1ENR: AHB1_Register;
AHB2ENR: AHB2_Register;
AHB3ENR: AHB3_Register;
APB1ENR: APB1_Register;
APB2ENR: APB2_Register;
AHB1LPENR: AHB1_Register;
AHB2LPENR: AHB2_Register;
AHB3LPENR: AHB3_Register;
APB1LPENR: APB1_Register;
APB2LPENR: APB2_Register;
BDCR: Backup_Domain_Control_Register;
CSR: Clock_Control_and_Status_Register;
SSCGR: Spread_Spectrum_Clock_Generation_Register;
PLLI2SCFGR: PLLI2S_Configuration_Register;
end record with Volatile;
for RCC_Registers use record
CR at 16#00# range 0 .. 31;
PLLCFGR at 16#04# range 0 .. 31;
CFGR at 16#08# range 0 .. 31;
CIR at 16#0C# range 0 .. 31;
AHB1RSTR at 16#10# range 0 .. 31;
AHB2RSTR at 16#14# range 0 .. 31;
AHB3RSTR at 16#18# range 0 .. 31;
APB1RSTR at 16#20# range 0 .. 31;
APB2RSTR at 16#24# range 0 .. 31;
AHB1ENR at 16#30# range 0 .. 31;
AHB2ENR at 16#34# range 0 .. 31;
AHB3ENR at 16#38# range 0 .. 31;
APB1ENR at 16#40# range 0 .. 31;
APB2ENR at 16#44# range 0 .. 31;
AHB1LPENR at 16#50# range 0 .. 31;
AHB2LPENR at 16#54# range 0 .. 31;
AHB3LPENR at 16#58# range 0 .. 31;
APB1LPENR at 16#60# range 0 .. 31;
APB2LPENR at 16#64# range 0 .. 31;
BDCR at 16#70# range 0 .. 31;
CSR at 16#74# range 0 .. 31;
SSCGR at 16#80# range 0 .. 31;
PLLI2SCFGR at 16#84# range 0 .. 31;
end record;
end STM32.F4.RCC;
|
------------------------------------------------------------------------------
-- --
-- Matreshka Project --
-- --
-- Localization, Internationalization, Globalization for Ada --
-- --
-- Runtime Library Component --
-- --
------------------------------------------------------------------------------
-- --
-- Copyright © 2009-2015, Vadim Godunko <vgodunko@gmail.com> --
-- All rights reserved. --
-- --
-- Redistribution and use in source and binary forms, with or without --
-- modification, are permitted provided that the following conditions --
-- are met: --
-- --
-- * Redistributions of source code must retain the above copyright --
-- notice, this list of conditions and the following disclaimer. --
-- --
-- * Redistributions in binary form must reproduce the above copyright --
-- notice, this list of conditions and the following disclaimer in the --
-- documentation and/or other materials provided with the distribution. --
-- --
-- * Neither the name of the Vadim Godunko, IE nor the names of its --
-- contributors may be used to endorse or promote products derived from --
-- this software without specific prior written permission. --
-- --
-- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS --
-- "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT --
-- LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR --
-- A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT --
-- HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, --
-- SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED --
-- TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR --
-- PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF --
-- LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING --
-- NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS --
-- SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. --
-- --
------------------------------------------------------------------------------
-- $Revision$ $Date$
------------------------------------------------------------------------------
package Matreshka.Internals.Unicode.Ucd is
pragma Preelaborate;
type First_Stage_Index is mod 16#1100#;
type Second_Stage_Index is mod 16#100#;
type Sequence_Count is range 0 .. 2 ** 16 - 1;
for Sequence_Count'Size use 16;
subtype Sequence_Index is Sequence_Count range 1 .. Sequence_Count'Last;
type Code_Point_Sequence is array (Sequence_Index range <>) of Code_Point;
type Code_Point_Sequence_Access is access constant Code_Point_Sequence;
---------------------
-- Core properties --
---------------------
type General_Category is
(Control,
Format,
Unassigned,
Private_Use,
Surrogate,
Lowercase_Letter,
Titlecase_Letter,
Uppercase_Letter,
Modifier_Letter,
Other_Letter,
Spacing_Mark,
Enclosing_Mark,
Nonspacing_Mark,
Decimal_Number,
Letter_Number,
Other_Number,
Connector_Punctuation,
Dash_Punctuation,
Close_Punctuation,
Final_Punctuation,
Initial_Punctuation,
Other_Punctuation,
Open_Punctuation,
Currency_Symbol,
Modifier_Symbol,
Math_Symbol,
Other_Symbol,
Line_Separator,
Paragraph_Separator,
Space_Separator);
for General_Category'Size use 8;
type Boolean_Properties is
(Composition_Exclusion, -- XXX
Expands_On_NFC, -- Derived
Expands_On_NFD, -- Derived
Expands_On_NFKC, -- Derived
Expands_On_NFKD, -- Derived
Full_Composition_Exclusion, -- Derived
ASCII_Hex_Digit,
Bidi_Control,
Dash,
Deprecated,
Diacritic,
Extender,
Hex_Digit,
Hyphen,
Ideographic,
IDS_Binary_Operator,
IDS_Trinary_Operator,
Join_Control,
Logical_Order_Exception,
Noncharacter_Code_Point,
Other_Alphabetic,
Other_Default_Ignorable_Code_Point,
Other_Grapheme_Extend,
Other_ID_Continue,
Other_ID_Start,
Other_Lowercase,
Other_Math,
Other_Uppercase,
Pattern_Syntax,
Pattern_White_Space,
Quotation_Mark,
Radical,
Soft_Dotted,
STerm,
Terminal_Punctuation,
Unified_Ideograph,
Variation_Selector,
White_Space,
-- Bidi_Mirrored, -- XXX
-- Derived core properties. This list must include only properties
-- from DerivedCoreProperties.txt file.
Alphabetic, -- Derived
Cased, -- Derived
Case_Ignorable, -- Derived
Changes_When_Lowercased, -- Derived
Changes_When_Uppercased, -- Derived
Changes_When_Titlecased, -- Derived
Changes_When_Casefolded, -- Derived
Changes_When_Casemapped, -- Derived
Default_Ignorable_Code_Point, -- Derived
Grapheme_Base, -- Derived
Grapheme_Extend, -- Derived
Grapheme_Link, -- Deprecated, derived
ID_Continue, -- Derived
ID_Start, -- Derived
Lowercase, -- Derived
Math, -- Derived
Uppercase, -- Derived
XID_Continue, -- Derived
XID_Start, -- Derived
-- Derived normalization properties.
Changes_When_NFKC_Casefolded); -- Derived
subtype Overridable_Boolean_Properties is Boolean_Properties
range ASCII_Hex_Digit .. Changes_When_NFKC_Casefolded;
type Boolean_Values is array (Overridable_Boolean_Properties) of Boolean;
for Boolean_Values'Component_Size use 1;
for Boolean_Values'Size use 64; -- 52 bits used for now
type East_Asian_Width is
(Ambiguous,
Fullwidth,
Halfwidth,
Neutral,
Narrow,
Wide);
for East_Asian_Width'Size use 8;
type Grapheme_Cluster_Break is
(Control,
CR,
Extend,
L,
LF,
LV,
LVT,
Prepend,
Regional_Indicator,
Spacing_Mark,
T,
V,
Other);
for Grapheme_Cluster_Break'Size use 8;
type Word_Break is
(CR,
LF,
Newline,
Extend,
Regional_Indicator,
Format,
Katakana,
Hebrew_Letter,
A_Letter,
Single_Quote,
Double_Quote,
Mid_Num_Let,
Mid_Letter,
Mid_Num,
Numeric,
Extend_Num_Let,
Other);
for Word_Break'Size use 8;
type Sentence_Break is
(Other,
CR,
LF,
Sep,
Sp,
Lower,
Upper,
O_Letter,
Numeric,
A_Term,
S_Term,
Close,
S_Continue,
Format,
Extend);
for Sentence_Break'Size use 8;
type Line_Break is
(Ambiguous,
Alphabetic,
Break_Both,
Break_After,
Break_Before,
Mandatory_Break,
Contingent_Break,
Conditional_Japanese_Starter,
Close_Punctuation,
Combining_Mark,
Close_Parenthesis,
Carriage_Return,
Exclamation,
Glue,
H2,
H3,
Hebrew_Letter,
Hyphen,
Ideographic,
Inseparable,
Infix_Numeric,
JL,
JT,
JV,
Line_Feed,
Next_Line,
Nonstarter,
Numeric,
Open_Punctuation,
Postfix_Numeric,
Prefix_Numeric,
Quotation,
Regional_Indicator,
Complex_Context,
Surrogate,
Space,
Break_Symbols,
Word_Joiner,
Unknown,
ZW_Space);
for Line_Break'Size use 8;
type Core_Values is record
GC : General_Category; -- 8 (5) bits
EA : East_Asian_Width; -- 8 (3) bits
GCB : Grapheme_Cluster_Break; -- 8 (4) bits
WB : Word_Break; -- 8 (4) bits
SB : Sentence_Break; -- 8 (4) bits
LB : Line_Break; -- 8 (6) bits
B : Boolean_Values; -- 64 (52) bits
end record;
for Core_Values'Size use 128;
for Core_Values use record
B at 0 range 0 .. 63;
GC at 0 range 64 .. 71;
GCB at 0 range 72 .. 79;
WB at 0 range 80 .. 87;
SB at 0 range 88 .. 95;
LB at 0 range 96 .. 103;
EA at 0 range 104 .. 111;
end record;
type Core_Second_Stage is array (Second_Stage_Index) of Core_Values;
type Core_Second_Stage_Access is not null access constant Core_Second_Stage;
type Core_First_Stage is
array (First_Stage_Index) of Core_Second_Stage_Access;
type Core_First_Stage_Access is not null access constant Core_First_Stage;
------------
-- Casing --
------------
type Casing_Context is
(Final_Sigma,
After_Soft_Dotted,
More_Above,
Before_Dot,
After_I);
type Case_Mapping_Range is record
First : Sequence_Count;
Last : Sequence_Count;
end record;
type Case_Mapping_Kinds is (Lower, Upper, Title, Folding);
type Case_Mapping_Ranges is
array (Case_Mapping_Kinds) of Case_Mapping_Range;
type Simple_Case_Mappings is
array (Case_Mapping_Kinds) of Code_Point;
type Casing_Context_Mapping_Ranges is
array (Case_Mapping_Kinds range Lower .. Title) of Case_Mapping_Range;
type Case_Mapping is record
Simple : Simple_Case_Mappings;
Ranges : Case_Mapping_Ranges;
Context_First : Sequence_Count;
Context_Last : Sequence_Count;
end record;
type Casing_Context_Mapping is record
Context : Casing_Context;
Negative : Boolean;
Ranges : Casing_Context_Mapping_Ranges;
end record;
type Case_Mapping_Second_Stage is
array (Second_Stage_Index) of Case_Mapping;
type Case_Mapping_Second_Stage_Access is
not null access constant Case_Mapping_Second_Stage;
type Case_Mapping_First_Stage is
array (First_Stage_Index) of Case_Mapping_Second_Stage_Access;
type Case_Mapping_First_Stage_Access is
access constant Case_Mapping_First_Stage;
type Casing_Context_Mapping_Sequence is
array (Sequence_Index range <>) of Casing_Context_Mapping;
type Casing_Context_Mapping_Sequence_Access is
access constant Casing_Context_Mapping_Sequence;
-------------------
-- Normalization --
-------------------
type Canonical_Combining_Class is mod 256;
Not_Reordered : constant Canonical_Combining_Class := 0;
Overlay : constant Canonical_Combining_Class := 1;
Nukta : constant Canonical_Combining_Class := 7;
Kana_Voicing : constant Canonical_Combining_Class := 8;
Virama : constant Canonical_Combining_Class := 9;
Attached_Below_Left : constant Canonical_Combining_Class := 200;
Attached_Below : constant Canonical_Combining_Class := 202;
Attached_Above_Right : constant Canonical_Combining_Class := 216;
Below_Left : constant Canonical_Combining_Class := 218;
Below : constant Canonical_Combining_Class := 220;
Below_Right : constant Canonical_Combining_Class := 222;
Left : constant Canonical_Combining_Class := 224;
Right : constant Canonical_Combining_Class := 226;
Above_Left : constant Canonical_Combining_Class := 228;
Above : constant Canonical_Combining_Class := 230;
Above_Right : constant Canonical_Combining_Class := 232;
Double_Below : constant Canonical_Combining_Class := 233;
Double_Above : constant Canonical_Combining_Class := 234;
Iota_Subscript : constant Canonical_Combining_Class := 240;
type Decomposition_Type is
(None,
Canonical,
Font,
No_Break,
Initial,
Medial,
Final,
Isolated,
Circle,
Super,
Sub,
Vertical,
Wide,
Narrow,
Small,
Square,
Fraction,
Compat);
for Decomposition_Type'Size use 8;
subtype Not_Overridable_Boolean_Properties is Boolean_Properties
range Composition_Exclusion .. Full_Composition_Exclusion;
type Non_Overridable_Boolean_Values is
array (Not_Overridable_Boolean_Properties) of Boolean;
for Non_Overridable_Boolean_Values'Component_Size use 1;
for Non_Overridable_Boolean_Values'Size use 8; -- 6 bits used for now
type Normalization_Quick_Check is (No, Maybe, Yes);
for Normalization_Quick_Check'Size use 2;
type Normalization_Form is (NFC, NFD, NFKC, NFKD);
type Normalization_Quick_Checks is
array (Normalization_Form) of Normalization_Quick_Check;
for Normalization_Quick_Checks'Size use 8;
for Normalization_Quick_Checks'Component_Size
use Normalization_Quick_Check'Size;
type Normalization_Mapping_Range is record
First : Sequence_Count;
Last : Sequence_Count;
end record;
type Decomposition_Kinds is (Canonical, Compatibility);
type Decomposition_Mapping is
array (Decomposition_Kinds) of Normalization_Mapping_Range;
type Normalization_Mapping is record
Decomposition : Decomposition_Mapping;
Composition : Normalization_Mapping_Range;
CCC : Canonical_Combining_Class; -- 8 bits
NQC : Normalization_Quick_Checks; -- 8 bits
DT : Decomposition_Type; -- 8 (5) bits
B : Non_Overridable_Boolean_Values;
end record;
for Normalization_Mapping'Size use 128;
type Normalization_Mapping_Second_Stage is
array (Second_Stage_Index) of Normalization_Mapping;
type Normalization_Mapping_Second_Stage_Access is
not null access constant Normalization_Mapping_Second_Stage;
type Normalization_Mapping_First_Stage is
array (First_Stage_Index) of Normalization_Mapping_Second_Stage_Access;
type Composition_Mapping is
array (Sequence_Index range <>, Sequence_Index range <>) of Code_Point;
---------------
-- Collation --
---------------
type Collation_Weight is mod 2**16;
for Collation_Weight'Size use 16;
pragma Assert (Code_Unit_16'Size = Collation_Weight'Size);
-- Note: collation algoriphm in identical strength level adds copy of the
-- source string in NFD form at the end of produced sorting key, thus it is
-- important that Code_Unit_16 and Collation_Weight types have equal size.
type Collation_Element is record
Primary : Collation_Weight;
Secondary : Collation_Weight;
Trinary : Collation_Weight;
end record;
type Collation_Element_Sequence is
array (Sequence_Index range <>) of Collation_Element;
type Collation_Element_Sequence_Access is
access constant Collation_Element_Sequence;
type Contractor_Record is record
Code : Code_Point;
Contractor_First : Sequence_Count;
Contractor_Last : Sequence_Count;
Expansion_First : Sequence_Count;
Expansion_Last : Sequence_Count;
end record;
type Contractor_Array is
array (Sequence_Index range <>) of Contractor_Record;
type Contractor_Array_Access is access constant Contractor_Array;
type Collation_Record is record
Contractor_First : Sequence_Count;
Contractor_Last : Sequence_Count;
Expansion_First : Sequence_Count;
Expansion_Last : Sequence_Count;
end record;
type Collation_Second_Stage is
array (Second_Stage_Index) of Collation_Record;
type Collation_Second_Stage_Access is
not null access constant Collation_Second_Stage;
type Collation_First_Stage is
array (First_Stage_Index) of Collation_Second_Stage_Access;
type Collation_First_Stage_Access is access constant Collation_First_Stage;
-------------------------------
-- Two stage table utilities --
-------------------------------
generic
type Element_Type is private;
type Second_Stage_Array is
array (Second_Stage_Index) of Element_Type;
type Second_Stage_Array_Access is
not null access constant Second_Stage_Array;
type First_Stage_Array is
array (First_Stage_Index) of Second_Stage_Array_Access;
function Generic_Element (Data : First_Stage_Array; Code : Code_Point)
return Element_Type;
end Matreshka.Internals.Unicode.Ucd;
|
with Ada.Assertions; use Ada.Assertions;
with Ada.Containers.Hashed_Maps; use Ada.Containers;
with Ada.Text_IO; use Ada.Text_IO;
with Ada.Strings.Hash;
procedure Day18 is
subtype Input_String is String (1 .. 50);
type String_Array is array (Input_String'Range) of Input_String;
function Array_Hash (A : String_Array) return Hash_Type is
Hash : Hash_Type := 0;
begin
for I in A'Range loop
Hash := Hash + Ada.Strings.Hash (A (I));
end loop;
return Hash;
end Array_Hash;
package Array_Maps is new Hashed_Maps
(Key_Type => String_Array,
Element_Type => Natural,
Hash => Array_Hash,
Equivalent_Keys => "=");
Grid : String_Array;
function Count_Neighbors
(X_Start, Y_Start : Natural;
Char : Character) return Natural
is
Result : Natural := 0;
begin
for Y in Y_Start - 1 .. Y_Start + 1 loop
for X in X_Start - 1 .. X_Start + 1 loop
if (X /= X_Start or Y /= Y_Start) and
(X >= Grid'First and X <= Grid'Last) and
(Y >= Grid'First and Y <= Grid'Last)
then
if Grid (Y) (X) = Char then
Result := Result + 1;
end if;
end if;
end loop;
end loop;
return Result;
end Count_Neighbors;
function Change_Tile (X, Y : Positive) return Character is
Current_Tile : constant Character := Grid (Y) (X);
New_Tile : Character := Current_Tile;
begin
if Current_Tile = '.' then
if Count_Neighbors (X, Y, '|') >= 3 then
New_Tile := '|';
end if;
elsif Current_Tile = '|' then
if Count_Neighbors (X, Y, '#') >= 3 then
New_Tile := '#';
end if;
elsif Current_Tile = '#' then
if Count_Neighbors (X, Y, '#') = 0 or Count_Neighbors (X, Y, '|') = 0
then
New_Tile := '.';
end if;
else
Assert (False, "Illegal tile: " & Current_Tile);
end if;
return New_Tile;
end Change_Tile;
function Change_Grid return String_Array is
New_Grid : String_Array;
begin
for Y in Grid'Range loop
for X in Grid'Range loop
New_Grid (Y) (X) := Change_Tile (X, Y);
end loop;
end loop;
return New_Grid;
end Change_Grid;
function Resource_Value return Natural is
Tree_Count : Natural := 0;
Lumber_Count : Natural := 0;
begin
for I in Grid'Range loop
for J in Grid'Range loop
if Grid (I) (J) = '|' then
Tree_Count := Tree_Count + 1;
elsif Grid (I) (J) = '#' then
Lumber_Count := Lumber_Count + 1;
end if;
end loop;
end loop;
return Tree_Count * Lumber_Count;
end Resource_Value;
begin
-- Input Handling
declare
File : File_Type;
begin
Open (File, In_File, "input.txt");
for I in Grid'Range loop
Grid (I) := Get_Line (File);
end loop;
Assert (End_Of_File (File), "More input than expected!");
Close (File);
end;
declare
Total : constant Natural := 1000000000;
Remaining : Natural := 0;
Seen_Grids : Array_Maps.Map;
begin
Seen_Grids.Insert (Grid, 0);
Outer_Loop :
for I in 1 .. Total loop
Grid := Change_Grid;
-- Part 1
if I = 10 then
Put_Line ("Part 1 =" & Natural'Image (Resource_Value));
end if;
-- Detection of cycle
if Seen_Grids.Contains (Grid) then
Remaining := (Total - I) mod (I - Seen_Grids (Grid));
exit Outer_Loop;
else
Seen_Grids.Insert (Grid, I);
end if;
end loop Outer_Loop;
for I in 1 .. Remaining loop
Grid := Change_Grid;
end loop;
Put_Line ("Part 2 =" & Natural'Image (Resource_Value));
end;
end Day18;
|
package elab1 is
-- the forward declaration is the trigger
type Stream;
type Stream_Ptr is access Stream;
type Stream is array (Positive range <>) of Character;
function Get_Size (S : Stream_Ptr) return Natural;
type Rec (Size : Natural) is
record
B : Boolean;
end record;
My_Desc : constant Stream_Ptr := new Stream'(1 => ' ');
My_Size : constant Natural := Get_Size (My_Desc);
subtype My_Rec is Rec (My_Size);
end;
|
with Ada.Strings.Maps, Ada.Characters.Handling, Interfaces.C;
use Ada, Ada.Strings, Ada.Strings.Maps, Interfaces;
package body Morse is
Dit, Dah, Lettergap, Wordgap : Duration; -- in seconds
Dit_ms, Dah_ms : C.unsigned; -- durations expressed in ms
Freq : constant C.unsigned := 1280; -- in Herz
Morse_Sequence : constant Character_Sequence :=
" ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789";
Morse_charset : constant Character_Set := To_Set (Morse_Sequence);
function Convert (Input : String) return Morse_Str is
Cap_String : constant String := Characters.Handling.To_Upper (Input);
Result : Morse_Str (1 .. 7 * Input'Length); -- Upper Capacity
First, Last : Natural := 0;
Char_code : Codings;
begin
for I in Cap_String'Range loop
if Is_In (Cap_String (I), Morse_charset) then
First := Last + 1;
if Cap_String (I) = ' ' then
Result (First) := ' ';
Last := Last + 1;
else
Char_code := Table (Reschars (Cap_String (I)));
Last := First + Char_code.L - 1;
Result (First .. Last) := Char_code.Code (1 .. Char_code.L);
Last := Last + 1;
Result (Last) := Nul;
end if;
end if;
end loop;
if Result (Last) /= ' ' then
Last := Last + 1;
Result (Last) := ' ';
end if;
return Result (1 .. Last);
end Convert;
procedure Morsebeep (Input : Morse_Str) is
-- Beep is not portable : adapt to your OS/sound board
-- Implementation for Windows XP / interface to fn in stdlib
procedure win32xp_beep
(dwFrequency : C.unsigned;
dwDuration : C.unsigned);
pragma Import (C, win32xp_beep, "_beep");
begin
for I in Input'Range loop
case Input (I) is
when Nul =>
delay Lettergap;
when Dot =>
win32xp_beep (Freq, Dit_ms);
delay Dit;
when Dash =>
win32xp_beep (Freq, Dah_ms);
delay Dit;
when ' ' =>
delay Wordgap;
end case;
end loop;
end Morsebeep;
begin
Dit := 0.20;
Lettergap := 2 * Dit;
Dah := 3 * Dit;
Wordgap := 4 * Dit;
Dit_ms := C.unsigned (Integer (Dit * 1000));
Dah_ms := C.unsigned (Integer (Dah * 1000));
end Morse;
|
-- Copyright (C) 2019 Thierry Rascle <thierr26@free.fr>
-- MIT license. Please refer to the LICENSE file.
with Apsepp.Generic_Fixture;
with Apsepp.Debug_Trace_Class.Stub; use Apsepp.Debug_Trace_Class.Stub;
package Apsepp_Scope_Debug_Test_Fixture is
procedure Increment_Scope_Entry_Count;
procedure Increment_Scope_Exit_Count;
type Scope_Debug_Test_Fixture is tagged limited null record;
type Scope_Debug_Test_Fixture_Access
is not null access all Scope_Debug_Test_Fixture;
not overriding
procedure Reset (Obj : Scope_Debug_Test_Fixture);
not overriding
function Scope_Entry_Count (Obj : Scope_Debug_Test_Fixture) return Natural;
not overriding
function Scope_Exit_Count (Obj : Scope_Debug_Test_Fixture) return Natural;
function Allocate return Scope_Debug_Test_Fixture_Access
is (new Scope_Debug_Test_Fixture'(null record));
package Scope_Debug_T_F is new Apsepp.Generic_Fixture
(Fixture_Type => Scope_Debug_Test_Fixture,
Fixture_Type_Access => Scope_Debug_Test_Fixture_Access,
Default_Allocator => Allocate);
function Instance return Scope_Debug_Test_Fixture_Access
renames Scope_Debug_T_F.Instance;
type SDFDT is limited new Debug_Trace_Stub with null record;
overriding
procedure Trace (Obj : in out SDFDT;
Message : String;
Entity_Name : String := "");
end Apsepp_Scope_Debug_Test_Fixture;
|
-- SPDX-FileCopyrightText: 2019-2021 Max Reznik <reznikmm@gmail.com>
--
-- SPDX-License-Identifier: MIT
-------------------------------------------------------------
with Program.Visibility;
package Program.Type_Matchers is
pragma Preelaborate;
type Type_Matcher is limited interface;
type Type_Matcher_Access is access all Type_Matcher'Class;
not overriding function Is_Matched
(Self : Type_Matcher;
Tipe : Program.Visibility.View) return Boolean is abstract
with Pre'Class => Tipe.Kind in Program.Visibility.Type_View_Kind;
type Record_Type_Matcher is new Type_Matcher with null record;
use all type Program.Visibility.View_Kind;
overriding function Is_Matched
(Self : Record_Type_Matcher;
Tipe : Program.Visibility.View) return Boolean is
(Tipe.Kind = Record_Type_View);
type Discrete_Type_Matcher is new Type_Matcher with null record;
overriding function Is_Matched
(Self : Discrete_Type_Matcher;
Tipe : Program.Visibility.View) return Boolean is
(Tipe.Kind in Enumeration_Type_View
| Signed_Integer_Type_View | Modular_Type_View);
end Program.Type_Matchers;
|
with fov_h, Interfaces.C.Extensions;
package body Libtcod.Maps is
use fov_h, Interfaces.C, Interfaces.C.Extensions;
subtype Limited_Controlled is Ada.Finalization.Limited_Controlled;
procedure increment(x : in out X_Pos; d : X_Diff) is
begin
x := X_Pos(X_Diff(x) + d);
end increment;
function "+"(x : X_Pos; d : X_Diff) return X_Pos is (X_Pos(X_Diff(x) + d));
function "-"(x : X_Pos; d : X_Pos) return X_Diff is (X_Diff(x) - X_Diff(d));
procedure increment(y : in out Y_Pos; d : Y_Diff) is
begin
y := Y_Pos(Y_Diff(y) + d);
end increment;
function "+"(y : Y_Pos; d : Y_Diff) return Y_Pos is (Y_Pos(Y_Diff(y) + d));
function "-"(x : Y_Pos; d : Y_Pos) return Y_Diff is (Y_Diff(x) - Y_Diff(d));
function make_map(w : Width; h : Height) return Map is
begin
return result : Map :=
Map'(Limited_Controlled with TCOD_map_new(int(w), int(h)));
end make_map;
overriding procedure Finalize(m : in out Map) is
begin
TCOD_map_delete(m.data);
end Finalize;
function get_width(m : Map) return Width is (Width(TCOD_map_get_width(m.data)));
function get_height(m : Map) return Height is (Height(TCOD_map_get_height(m.data)));
function get_cell_count(m : Map) return Natural is
(Natural(TCOD_map_get_nb_cells(m.data)));
procedure set_properties_all(m : in out Map; transparent, walkable : Boolean) is
begin
TCOD_map_clear(m.data, bool(transparent), bool(walkable));
end set_properties_all;
procedure set_properties(m : in out Map; x : X_Pos; y : Y_Pos;
transparent, walkable : Boolean) is
begin
TCOD_map_set_properties(m.data, int(x), int(y), bool(transparent), bool(walkable));
end set_properties;
function is_transparent(m : Map; x : X_Pos; y : Y_Pos) return Boolean is
(Boolean(TCOD_map_is_transparent(m.data, int(x), int(y))));
function is_walkable(m : Map; x : X_Pos; y : Y_Pos) return Boolean is
(Boolean(TCOD_map_is_walkable(m.data, int(x), int(y))));
end Libtcod.Maps;
|
with
physics.Forge,
openGL.Renderer.lean;
package body gel.World.simple
is
-- procedure log (Message : in String)
-- renames ada.text_IO.put_Line;
---------
--- Forge
--
-- procedure free (Self : in out View)
-- is
-- procedure deallocate is new ada.unchecked_Deallocation (Item'Class, View);
-- begin
-- deallocate (Self);
-- end free;
procedure define (Self : in out Item'Class; Name : in String;
Id : in world_Id;
space_Kind : in physics.space_Kind;
Renderer : access openGL.Renderer.lean.item'Class);
package body Forge
is
function to_World (Name : in String;
Id : in world_Id;
space_Kind : in physics.space_Kind;
Renderer : access openGL.Renderer.lean.item'Class) return gel.World.simple.item
is
use lace.Subject_and_deferred_Observer.Forge;
begin
return Self : gel.World.simple.item := (to_Subject_and_Observer (Name => Name & " world" & Id'Image)
with others => <>)
do
Self.define (Name, Id, space_Kind, Renderer);
end return;
end to_World;
function new_World (Name : in String;
Id : in world_Id;
space_Kind : in physics.space_Kind;
Renderer : access openGL.Renderer.lean.item'Class) return gel.World.simple.view
is
use lace.Subject_and_deferred_Observer.Forge;
Self : constant gel.World.simple.view
:= new gel.World.simple.item' (to_Subject_and_Observer (name => Name & " world" & Id'Image)
with others => <>);
begin
Self.define (Name, Id, space_Kind, Renderer);
return Self;
end new_World;
end Forge;
----------
--- Define
--
procedure define (Self : in out Item'Class; Name : in String;
Id : in world_Id;
space_Kind : in physics.space_Kind;
Renderer : access openGL.Renderer.lean.Item'Class)
is
use lace.Subject_and_deferred_Observer.Forge;
begin
Self.local_Subject_and_deferred_Observer := new_Subject_and_Observer (name => Name & " world" & Id'Image);
Self.Id := Id;
Self.space_Kind := space_Kind;
Self.Renderer := Renderer;
-- Self.sprite_Count := 0;
Self.physics_Space := physics.Forge.new_Space (space_Kind);
end define;
--------------
--- sprite_Map
--
overriding
function fetch (From : in sprite_Map) return id_Maps_of_sprite.Map
is
begin
return From.Map;
end fetch;
overriding
procedure add (To : in out sprite_Map; the_Sprite : in Sprite.view)
is
begin
To.Map.insert (the_Sprite.Id, the_Sprite);
end add;
overriding
procedure rid (From : in out sprite_Map; the_Sprite : in Sprite.view)
is
begin
From.Map.delete (the_Sprite.Id);
end rid;
overriding
function all_Sprites (Self : access Item) return access World.sprite_Map'Class
is
begin
return Self.all_Sprites'unchecked_Access;
end all_Sprites;
end gel.World.simple;
|
with Interfaces; use Interfaces;
with Interfaces.C.Extensions;
package Lv.Color_Types is
subtype Color_Int_T is Uint8_T;
type Color_T_Comp is record
Blue : Extensions.Unsigned_2;
Green : Extensions.Unsigned_3;
Red : Extensions.Unsigned_3;
end record
with Pack, Object_Size => 8;
pragma Convention (C_Pass_By_Copy, Color_T_Comp);
type Color_T (Discr : unsigned := 0) is record
case Discr is
when 0 =>
Comp : aliased Color_T_Comp;
when others =>
Full : aliased Color_Int_T;
end case;
end record
with Pack, Object_Size => 8;
pragma Convention (C_Pass_By_Copy, Color_T);
pragma Unchecked_Union (Color_T);
function Color_Make
(R8, G8, B8 : Uint8_T) return Color_T is
(Discr => 0,
Comp => (Extensions.Unsigned_2 (Shift_Right (B8, 6)),
Extensions.Unsigned_3 (Shift_Right (G8, 5)),
Extensions.Unsigned_3 (Shift_Right (R8, 5))))
with Inline_Always;
end Lv.Color_Types;
|
with Ada.Strings.Fixed; use Ada.Strings.Fixed;
with Ada.Strings.Unbounded; use Ada.Strings.Unbounded;
with AUnit.Assertions; use AUnit.Assertions;
with Rejuvenation.Nested; use Rejuvenation.Nested;
package body Test_Nested is
OFF_TAG : constant String := "--@OFF@--";
ON_TAG : constant String := "--@ON@--";
procedure Test_None (T : in out Test_Case'Class);
procedure Test_None (T : in out Test_Case'Class) is
pragma Unreferenced (T);
Input : constant String := "Test";
begin
-- pre condition checks
Assert
(Condition => Index (Input, ON_TAG) = 0,
Message => "ON_TAG unexpectedly in input");
Assert
(Condition => Index (Input, OFF_TAG) = 0,
Message => "OFF_TAG unexpectedly in input");
-- test
Assert
(Actual => Remove_Nested_Flags (Input, ON_TAG, OFF_TAG),
Expected => Input,
Message =>
"Unexpected difference with input " &
"without any on/off flags - " & Input);
end Test_None;
procedure Test_Flat (T : in out Test_Case'Class);
procedure Test_Flat (T : in out Test_Case'Class) is
pragma Unreferenced (T);
Construction : Unbounded_String := To_Unbounded_String (OFF_TAG);
Occurances : constant Positive := 2;
begin
for Index in 1 .. Occurances loop
Append (Construction, Index'Image & ON_TAG & Index'Image & OFF_TAG);
end loop;
Append (Construction, "Tail");
declare
Input : constant String := To_String (Construction);
Actual : constant String :=
Remove_Nested_Flags (Input, ON_TAG, OFF_TAG, 1);
begin
Assert
(Actual => Actual, Expected => Input,
Message => "Unexpected difference with flat string - " & Input);
end;
end Test_Flat;
procedure Test_Nested (T : in out Test_Case'Class);
procedure Test_Nested (T : in out Test_Case'Class) is
pragma Unreferenced (T);
Construction_Input, Construction_Expected : Unbounded_String :=
To_Unbounded_String (OFF_TAG);
Depth : constant Positive := 2;
begin
Append (Construction_Input, "Head");
Append (Construction_Expected, "Head");
Append (Construction_Expected, ON_TAG);
for Index in 1 .. Depth loop
Append (Construction_Input, ON_TAG & Index'Image);
Append (Construction_Expected, Index'Image);
end loop;
for Index in reverse 1 .. Depth loop
Append (Construction_Input, Index'Image & OFF_TAG);
Append (Construction_Expected, Index'Image);
end loop;
Append (Construction_Expected, OFF_TAG);
Append (Construction_Input, "Tail");
Append (Construction_Expected, "Tail");
declare
Input : constant String := To_String (Construction_Input);
Expected : constant String := To_String (Construction_Expected);
Actual : constant String :=
Remove_Nested_Flags (Input, ON_TAG, OFF_TAG, 1);
begin
Assert
(Actual => Actual, Expected => Expected,
Message => "Unexpected difference with nested string - " & Input);
end;
end Test_Nested;
-- Test plumbing
overriding function Name (T : Nested_Test_Case) return AUnit.Message_String
is
pragma Unreferenced (T);
begin
return AUnit.Format ("Nested");
end Name;
overriding procedure Register_Tests (T : in out Nested_Test_Case) is
begin
Registration.Register_Routine (T, Test_None'Access, "None");
Registration.Register_Routine (T, Test_Flat'Access, "Flat");
Registration.Register_Routine (T, Test_Nested'Access, "Nested");
end Register_Tests;
end Test_Nested;
|
package ADMBase.Time_Derivs is
procedure set_finite_diff_factors;
procedure set_time_derivatives_intr
(params : SlaveParams);
procedure set_time_derivatives_bndry_ns
(params : SlaveParams);
procedure set_time_derivatives_bndry_ew
(params : SlaveParams);
procedure set_time_derivatives_bndry_fb
(params : SlaveParams);
procedure set_time_derivatives
(point : GridPoint);
procedure set_time_derivatives;
end ADMBase.Time_Derivs;
|
with Ada.Text_IO;
with Ada.Strings.Unbounded;
procedure Best_Shuffle is
function Best_Shuffle (S : String) return String;
function Best_Shuffle (S : String) return String is
T : String (S'Range) := S;
Tmp : Character;
begin
for I in S'Range loop
for J in S'Range loop
if I /= J and S (I) /= T (J) and S (J) /= T (I) then
Tmp := T (I);
T (I) := T (J);
T (J) := Tmp;
end if;
end loop;
end loop;
return T;
end Best_Shuffle;
Test_Cases : constant array (1 .. 6)
of Ada.Strings.Unbounded.Unbounded_String :=
(Ada.Strings.Unbounded.To_Unbounded_String ("abracadabra"),
Ada.Strings.Unbounded.To_Unbounded_String ("seesaw"),
Ada.Strings.Unbounded.To_Unbounded_String ("elk"),
Ada.Strings.Unbounded.To_Unbounded_String ("grrrrrr"),
Ada.Strings.Unbounded.To_Unbounded_String ("up"),
Ada.Strings.Unbounded.To_Unbounded_String ("a"));
begin -- main procedure
for Test_Case in Test_Cases'Range loop
declare
Original : constant String := Ada.Strings.Unbounded.To_String
(Test_Cases (Test_Case));
Shuffle : constant String := Best_Shuffle (Original);
Score : Natural := 0;
begin
for I in Original'Range loop
if Original (I) = Shuffle (I) then
Score := Score + 1;
end if;
end loop;
Ada.Text_IO.Put_Line (Original & ", " & Shuffle & ", (" &
Natural'Image (Score) & " )");
end;
end loop;
end Best_Shuffle;
|
with Ada.Text_IO; use Ada.Text_IO;
package body Hello is
procedure Print_On_Console (P : Ada_Printer; V : String) is
begin
Put_Line ("[Ada ] " & V);
end Print_On_Console;
procedure Print_Messages (P : Printer'Class) is
begin
P.Print_On_Console ("Hello");
P.Print_On_Console ("This subprograms makes cross dispatching calls");
P.Print_On_Console ("Printer is either extended from Ada");
P.Print_On_Console ("or from Java.");
end Print_Messages;
end Hello;
|
-----------------------------------------------------------------------
-- helios-main -- Helios agent main procedure
-- Copyright (C) 2017, 2019 Stephane Carrez
-- Written by Stephane Carrez (Stephane.Carrez@gmail.com)
--
-- Licensed under the Apache License, Version 2.0 (the "License");
-- you may not use this file except in compliance with the License.
-- You may obtain a copy of the License at
--
-- http://www.apache.org/licenses/LICENSE-2.0
--
-- Unless required by applicable law or agreed to in writing, software
-- distributed under the License is distributed on an "AS IS" BASIS,
-- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-- See the License for the specific language governing permissions and
-- limitations under the License.
-----------------------------------------------------------------------
with Ada.Text_IO;
with Ada.Command_Line;
with GNAT.Command_Line;
with Util.Log.Loggers;
with Util.Properties;
with Util.Commands;
with Util.Http.Clients.Curl;
with Helios.Commands;
procedure Helios.Main is
use GNAT.Command_Line;
Log : constant Util.Log.Loggers.Logger := Util.Log.Loggers.Create ("Helios.Main");
Log_Config : Util.Properties.Manager;
Debug : Boolean := False;
Verbose : Boolean := False;
First : Natural := 0;
All_Args : Util.Commands.Default_Argument_List (0);
Ctx : Helios.Commands.Context_Type;
begin
Log_Config.Set ("log4j.rootCategory", "DEBUG,console");
Log_Config.Set ("log4j.appender.console", "Console");
Log_Config.Set ("log4j.appender.console.level", "ERROR");
Log_Config.Set ("log4j.appender.console.layout", "level-message");
Log_Config.Set ("log4j.appender.stdout", "Console");
Log_Config.Set ("log4j.appender.stdout.level", "INFO");
Log_Config.Set ("log4j.appender.stdout.layout", "message");
Log_Config.Set ("log4j.logger.Util", "FATAL");
Log_Config.Set ("log4j.logger.Util.Events", "ERROR");
Log_Config.Set ("log4j.logger.Helios", "ERROR");
Util.Log.Loggers.Initialize (Log_Config);
Helios.Commands.Initialize;
Util.Http.Clients.Curl.Register;
Initialize_Option_Scan (Stop_At_First_Non_Switch => True, Section_Delimiters => "targs");
-- Parse the command line
loop
case Getopt ("* v d c:") is
when ASCII.NUL =>
exit;
when 'c' =>
Helios.Commands.Set_Configuration (Ctx, Parameter);
First := First + 1;
when 'd' =>
Debug := True;
when 'v' =>
Verbose := True;
when '*' =>
exit;
when others =>
null;
end case;
First := First + 1;
end loop;
if Verbose or Debug then
Log_Config.Set ("log4j.appender.console.level", "INFO");
Log_Config.Set ("log4j.logger.Util", "WARN");
Log_Config.Set ("log4j.logger.Helios", "DEBUG");
Log_Config.Set ("log4j.logger.Swagger", "DEBUG");
end if;
if Debug then
Log_Config.Set ("log4j.appender.console.level", "DEBUG");
end if;
Util.Log.Loggers.Initialize (Log_Config);
if First >= Ada.Command_Line.Argument_Count then
Ada.Text_IO.Put_Line ("Missing command name to execute.");
Helios.Commands.Usage (All_Args);
Ada.Command_Line.Set_Exit_Status (Ada.Command_Line.Failure);
return;
end if;
declare
Cmd_Name : constant String := Full_Switch;
Args : Util.Commands.Default_Argument_List (First + 1);
begin
Helios.Commands.Execute (Cmd_Name, Args, Ctx);
end;
exception
when Helios.Commands.Error =>
Ada.Command_Line.Set_Exit_Status (Ada.Command_Line.Failure);
when Util.Commands.Not_Found =>
Ada.Command_Line.Set_Exit_Status (Ada.Command_Line.Failure);
when E : others =>
Log.Error ("Some internal error occurred", E);
Ada.Command_Line.Set_Exit_Status (Ada.Command_Line.Failure);
end Helios.Main;
|
------------------------------------------------------------------------------
-- --
-- GNAT RUN-TIME COMPONENTS --
-- --
-- S Y S T E M . V A L _ I N T --
-- --
-- S p e c --
-- --
-- Copyright (C) 1992-2020, Free Software Foundation, Inc. --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
-- ware Foundation; either version 3, or (at your option) any later ver- --
-- sion. GNAT is distributed in the hope that it will be useful, but WITH- --
-- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY --
-- or FITNESS FOR A PARTICULAR PURPOSE. --
-- --
-- As a special exception under Section 7 of GPL version 3, you are granted --
-- additional permissions described in the GCC Runtime Library Exception, --
-- version 3.1, as published by the Free Software Foundation. --
-- --
-- You should have received a copy of the GNU General Public License and --
-- a copy of the GCC Runtime Library Exception along with this program; --
-- see the files COPYING3 and COPYING.RUNTIME respectively. If not, see --
-- <http://www.gnu.org/licenses/>. --
-- --
-- GNAT was originally developed by the GNAT team at New York University. --
-- Extensive contributions were provided by Ada Core Technologies Inc. --
-- --
------------------------------------------------------------------------------
-- This package contains routines for scanning signed Integer values for use
-- in Text_IO.Integer_IO, and the Value attribute.
package System.Val_Int is
pragma Preelaborate;
function Scan_Integer
(Str : String;
Ptr : not null access Integer;
Max : Integer) return Integer;
-- This function scans the string starting at Str (Ptr.all) for a valid
-- integer according to the syntax described in (RM 3.5(43)). The substring
-- scanned extends no further than Str (Max). There are three cases for the
-- return:
--
-- If a valid integer is found after scanning past any initial spaces, then
-- Ptr.all is updated past the last character of the integer (but trailing
-- spaces are not scanned out).
--
-- If no valid integer is found, then Ptr.all points either to an initial
-- non-digit character, or to Max + 1 if the field is all spaces and the
-- exception Constraint_Error is raised.
--
-- If a syntactically valid integer is scanned, but the value is out of
-- range, or, in the based case, the base value is out of range or there
-- is an out of range digit, then Ptr.all points past the integer, and
-- Constraint_Error is raised.
--
-- Note: these rules correspond to the requirements for leaving the pointer
-- positioned in Text_Io.Get
--
-- Note: if Str is null, i.e. if Max is less than Ptr, then this is a
-- special case of an all-blank string, and Ptr is unchanged, and hence
-- is greater than Max as required in this case.
function Value_Integer (Str : String) return Integer;
-- Used in computing X'Value (Str) where X is a signed integer type whose
-- base range does not exceed the base range of Integer. Str is the string
-- argument of the attribute. Constraint_Error is raised if the string is
-- malformed, or if the value is out of range.
end System.Val_Int;
|
with Ada.Text_IO; use Ada.Text_IO;
with Types;
with Types.Strings;
procedure Main is
-- Use 'renames' to simplfy access to global formatting objects
Hours : Types.Hours_T;
Miles : Types.Miles_T;
function Get
(Prompt : String)
return String is
begin
Put (Prompt & "> ");
return Get_Line;
end Get;
begin
-- Query user for distance and time values
-- Calculate and print MPH for all distance/time combinations
Miles := Types.Miles_T'value (Get ("Miles"));
Hours := Types.Hours_T'value (Get ("Hours"));
Put_Line
(Types.Strings.To_String (Miles) & " miles / " &
Types.Strings.To_String (Hours) & " hour = ? mph");
end Main;
|
-- 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 System;
-- LPC55S69JBD100,LPC55S69JBD64,LPC55S69JEV98,LPC55S66JBD100,LPC55S66JBD64,LPC55S66JEV98
package NXP_SVD is
pragma Preelaborate;
--------------------
-- Base addresses --
--------------------
FLASH_CFPA0_Base : constant System.Address :=
System'To_Address (16#9E000#);
FLASH_CFPA_SCRATCH_Base : constant System.Address :=
System'To_Address (16#9DE00#);
FLASH_CFPA1_Base : constant System.Address :=
System'To_Address (16#9E200#);
FLASH_CMPA_Base : constant System.Address :=
System'To_Address (16#9E400#);
FLASH_KEY_STORE_Base : constant System.Address :=
System'To_Address (16#9E600#);
SYSCON_Base : constant System.Address :=
System'To_Address (16#40000000#);
IOCON_Base : constant System.Address :=
System'To_Address (16#40001000#);
GINT0_Base : constant System.Address :=
System'To_Address (16#40002000#);
GINT1_Base : constant System.Address :=
System'To_Address (16#40003000#);
PINT_Base : constant System.Address :=
System'To_Address (16#40004000#);
SECPINT_Base : constant System.Address :=
System'To_Address (16#40005000#);
INPUTMUX_Base : constant System.Address :=
System'To_Address (16#40006000#);
CTIMER0_Base : constant System.Address :=
System'To_Address (16#40008000#);
CTIMER1_Base : constant System.Address :=
System'To_Address (16#40009000#);
CTIMER2_Base : constant System.Address :=
System'To_Address (16#40028000#);
CTIMER3_Base : constant System.Address :=
System'To_Address (16#40029000#);
CTIMER4_Base : constant System.Address :=
System'To_Address (16#4002A000#);
WWDT_Base : constant System.Address :=
System'To_Address (16#4000C000#);
MRT0_Base : constant System.Address :=
System'To_Address (16#4000D000#);
UTICK0_Base : constant System.Address :=
System'To_Address (16#4000E000#);
ANACTRL_Base : constant System.Address :=
System'To_Address (16#40013000#);
PMC_Base : constant System.Address :=
System'To_Address (16#40020000#);
SYSCTL_Base : constant System.Address :=
System'To_Address (16#40023000#);
RTC_Base : constant System.Address :=
System'To_Address (16#4002C000#);
OSTIMER_Base : constant System.Address :=
System'To_Address (16#4002D000#);
FLASH_Base : constant System.Address :=
System'To_Address (16#40034000#);
PRINCE_Base : constant System.Address :=
System'To_Address (16#40035000#);
USBPHY_Base : constant System.Address :=
System'To_Address (16#40038000#);
RNG_Base : constant System.Address :=
System'To_Address (16#4003A000#);
PUF_Base : constant System.Address :=
System'To_Address (16#4003B000#);
PLU_Base : constant System.Address :=
System'To_Address (16#4003D000#);
DMA0_Base : constant System.Address :=
System'To_Address (16#40082000#);
DMA1_Base : constant System.Address :=
System'To_Address (16#400A7000#);
USB0_Base : constant System.Address :=
System'To_Address (16#40084000#);
SCT0_Base : constant System.Address :=
System'To_Address (16#40085000#);
FLEXCOMM0_Base : constant System.Address :=
System'To_Address (16#40086000#);
FLEXCOMM1_Base : constant System.Address :=
System'To_Address (16#40087000#);
FLEXCOMM2_Base : constant System.Address :=
System'To_Address (16#40088000#);
FLEXCOMM3_Base : constant System.Address :=
System'To_Address (16#40089000#);
FLEXCOMM4_Base : constant System.Address :=
System'To_Address (16#4008A000#);
FLEXCOMM5_Base : constant System.Address :=
System'To_Address (16#40096000#);
FLEXCOMM6_Base : constant System.Address :=
System'To_Address (16#40097000#);
FLEXCOMM7_Base : constant System.Address :=
System'To_Address (16#40098000#);
FLEXCOMM8_Base : constant System.Address :=
System'To_Address (16#4009F000#);
I2C0_Base : constant System.Address :=
System'To_Address (16#40086000#);
I2C1_Base : constant System.Address :=
System'To_Address (16#40087000#);
I2C2_Base : constant System.Address :=
System'To_Address (16#40088000#);
I2C3_Base : constant System.Address :=
System'To_Address (16#40089000#);
I2C4_Base : constant System.Address :=
System'To_Address (16#4008A000#);
I2C5_Base : constant System.Address :=
System'To_Address (16#40096000#);
I2C6_Base : constant System.Address :=
System'To_Address (16#40097000#);
I2C7_Base : constant System.Address :=
System'To_Address (16#40098000#);
I2S0_Base : constant System.Address :=
System'To_Address (16#40086000#);
I2S1_Base : constant System.Address :=
System'To_Address (16#40087000#);
I2S2_Base : constant System.Address :=
System'To_Address (16#40088000#);
I2S3_Base : constant System.Address :=
System'To_Address (16#40089000#);
I2S4_Base : constant System.Address :=
System'To_Address (16#4008A000#);
I2S5_Base : constant System.Address :=
System'To_Address (16#40096000#);
I2S6_Base : constant System.Address :=
System'To_Address (16#40097000#);
I2S7_Base : constant System.Address :=
System'To_Address (16#40098000#);
SPI0_Base : constant System.Address :=
System'To_Address (16#40086000#);
SPI1_Base : constant System.Address :=
System'To_Address (16#40087000#);
SPI2_Base : constant System.Address :=
System'To_Address (16#40088000#);
SPI3_Base : constant System.Address :=
System'To_Address (16#40089000#);
SPI4_Base : constant System.Address :=
System'To_Address (16#4008A000#);
SPI5_Base : constant System.Address :=
System'To_Address (16#40096000#);
SPI6_Base : constant System.Address :=
System'To_Address (16#40097000#);
SPI7_Base : constant System.Address :=
System'To_Address (16#40098000#);
SPI8_Base : constant System.Address :=
System'To_Address (16#4009F000#);
USART0_Base : constant System.Address :=
System'To_Address (16#40086000#);
USART1_Base : constant System.Address :=
System'To_Address (16#40087000#);
USART2_Base : constant System.Address :=
System'To_Address (16#40088000#);
USART3_Base : constant System.Address :=
System'To_Address (16#40089000#);
USART4_Base : constant System.Address :=
System'To_Address (16#4008A000#);
USART5_Base : constant System.Address :=
System'To_Address (16#40096000#);
USART6_Base : constant System.Address :=
System'To_Address (16#40097000#);
USART7_Base : constant System.Address :=
System'To_Address (16#40098000#);
MAILBOX_Base : constant System.Address :=
System'To_Address (16#4008B000#);
GPIO_Base : constant System.Address :=
System'To_Address (16#4008C000#);
USBHSD_Base : constant System.Address :=
System'To_Address (16#40094000#);
CRC_ENGINE_Base : constant System.Address :=
System'To_Address (16#40095000#);
SDIF_Base : constant System.Address :=
System'To_Address (16#4009B000#);
DBGMAILBOX_Base : constant System.Address :=
System'To_Address (16#4009C000#);
ADC0_Base : constant System.Address :=
System'To_Address (16#400A0000#);
USBFSH_Base : constant System.Address :=
System'To_Address (16#400A2000#);
USBHSH_Base : constant System.Address :=
System'To_Address (16#400A3000#);
HASHCRYPT_Base : constant System.Address :=
System'To_Address (16#400A4000#);
CASPER_Base : constant System.Address :=
System'To_Address (16#400A5000#);
POWERQUAD_Base : constant System.Address :=
System'To_Address (16#400A6000#);
SECGPIO_Base : constant System.Address :=
System'To_Address (16#400A8000#);
AHB_SECURE_CTRL_Base : constant System.Address :=
System'To_Address (16#400AC000#);
end NXP_SVD;
|
with Ada.Finalization;
use Ada;
private with Pulse_Simple_H;
package Pulsada.Thin is
type Session_Type is
new Finalization.Limited_Controlled
with
private;
procedure Open (Session : in out Session_Type;
Rate : Sampling_Frequency;
N_Channels : Channel_Index;
Application_Name : String := "";
Stream_Name : String := "");
procedure Read (Session : in out Session_Type;
Data : Frame_Block);
procedure Close (Session : in out Session_Type);
private
type Session_Type is
new Finalization.Limited_Controlled
with
record
S : Pulse_Simple_H.Pa_Simple_Access;
end record;
overriding procedure Initialize (Obj : in out Session_Type);
overriding procedure Finalize (Obj : in out Session_Type);
end Pulsada.Thin;
|
package body Measure_Units is
function To_Mps (V : Kn) return Mps is
(Mps (Float (V) * Mps_per_Knot));
function To_Meters (V : NM) return Meter is
(Meter (Float (V) * Meters_per_Nautical_Mile));
function To_Meters (V : Ft) return Meter is
(Meter (Float (V) * Meters_per_Foot));
function "*"
(Speed : Kn;
T : Duration) return NM is
(NM (Float (Speed) * Float (T) / 3600.0));
function "*"
(CR : Climb_Rate;
T : Duration) return Ft is
(Ft (Float (CR) * Float (T) / 60.0));
function "/"
(D : Ft;
T : Duration) return Climb_Rate is
(Climb_Rate (60.0 * Float (D) / Float (T)));
end Measure_Units;
|
------------------------------------------------------------------------------
-- --
-- GNAT COMPILER COMPONENTS --
-- --
-- S P A R K _ X R E F S --
-- --
-- S p e c --
-- --
-- Copyright (C) 2011-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. 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 package defines tables used to store information needed for the SPARK
-- mode. It is used by procedures in Lib.Xref.SPARK_Specific to build the
-- SPARK-specific cross-reference information before writing it to the ALI
-- file, and by Get_SPARK_Xrefs/Put_SPARK_Xrefs to read/write the textual
-- representation that is stored in the ALI file.
with Types; use Types;
with GNAT.Table;
package SPARK_Xrefs is
-- SPARK cross-reference information can exist in one of two forms. In
-- the ALI file, it is represented using a text format that is described
-- in this specification. Internally it is stored using three tables:
-- SPARK_Xref_Table, SPARK_Scope_Table and SPARK_File_Table, which are
-- also defined in this unit.
-- Lib.Xref.SPARK_Specific is part of the compiler. It extracts SPARK
-- cross-reference information from the complete set of cross-references
-- generated during compilation.
-- Get_SPARK_Xrefs reads the text lines in ALI format and populates the
-- internal tables with corresponding information.
-- Put_SPARK_Xrefs reads the internal tables and generates text lines in
-- the ALI format.
----------------------------
-- SPARK Xrefs ALI Format --
----------------------------
-- SPARK cross-reference information is generated on a unit-by-unit basis
-- in the ALI file, using lines that start with the identifying character F
-- ("Formal"). These lines are generated if GNATprove_Mode is True.
-- The SPARK cross-reference information comes after the shared
-- cross-reference information, so it can be ignored by tools like
-- gnatbind, gnatmake, etc.
-- -------------------
-- -- Scope Section --
-- -------------------
-- A first section defines the scopes in which entities are defined and
-- referenced. A scope is a package/subprogram/protected_type/task_type
-- declaration/body. Note that a package declaration and body define two
-- different scopes. Similarly, a subprogram, protected type and task type
-- declaration and body, when both present, define two different scopes.
-- FD dependency-number filename (-> unit-filename)?
-- This header precedes scope information for the unit identified by
-- dependency number and file name. The dependency number is the index
-- into the generated D lines and is ones-origin (e.g. 2 = reference to
-- second generated D line).
-- The list of FD lines should match the list of D lines defined in the
-- ALI file, in the same order.
-- Note that the filename here will reflect the original name if a
-- Source_Reference pragma was encountered (since all line number
-- references will be with respect to the original file).
-- Note: the filename is redundant in that it could be deduced from the
-- corresponding D line, but it is convenient at least for human
-- reading of the SPARK cross-reference information, and means that
-- the SPARK cross-reference information can stand on its own without
-- needing other parts of the ALI file.
-- The optional unit filename is given only for subunits.
-- FS . scope line type col entity (-> spec-file . spec-scope)?
-- (The ? mark stands for an optional entry in the syntax)
-- scope is the ones-origin scope number for the current file (e.g. 2 =
-- reference to the second FS line in this FD block).
-- line is the line number of the scope entity. The name of the entity
-- starts in column col. Columns are numbered from one, and if
-- horizontal tab characters are present, the column number is computed
-- assuming standard 1,9,17,.. tab stops. For example, if the entity is
-- the first token on the line, and is preceded by space-HT-space, then
-- the column would be column 10.
-- type is a single letter identifying the type of the entity, using
-- the same code as in cross-references:
-- K = package (k = generic package)
-- V = function (v = generic function)
-- U = procedure (u = generic procedure)
-- Y = entry
-- col is the column number of the scope entity
-- entity is the name of the scope entity, with casing in the canonical
-- casing for the source file where it is defined.
-- spec-file and spec-scope are respectively the file and scope for the
-- spec corresponding to the current body scope, when they differ.
-- ------------------
-- -- Xref Section --
-- ------------------
-- A second section defines cross-references useful for computing global
-- variables read/written in each subprogram/package/protected_type/
-- task_type.
-- FX dependency-number filename . entity-number entity
-- dependency-number and filename identify a file in FD lines
-- entity-number and entity identify a scope in FS lines
-- for the previously identified file.
-- (filename and entity are just a textual representations of
-- dependency-number and entity-number)
-- F line typ col entity ref*
-- line is the line number of the referenced entity
-- typ is the type of the referenced entity, using a code similar to
-- the one used for cross-references:
-- > = IN parameter
-- < = OUT parameter
-- = = IN OUT parameter
-- * = all other cases
-- col is the column number of the referenced entity
-- entity is the name of the referenced entity as written in the source
-- file where it is defined.
-- There may be zero or more ref entries on each line
-- (file |)? ((. scope :)? line type col)*
-- file is the dependency number of the file with the reference. It and
-- the following vertical bar are omitted if the file is the same as
-- the previous ref, and the refs for the current file are first (and
-- do not need a bar).
-- scope is the scope number of the scope with the reference. It and
-- the following colon are omitted if the scope is the same as the
-- previous ref, and the refs for the current scope are first (and do
-- not need a colon).
-- line is the line number of the reference
-- col is the column number of the reference
-- type is one of the following, using the same code as in
-- cross-references:
-- m = modification
-- r = reference
-- c = reference to constant object
-- s = subprogram reference in a static call
-- Special entries for reads and writes to memory reference a special
-- variable called "__HEAP". These special entries are present in every
-- scope where reads and writes to memory are present. Line and column for
-- this special variable are always 0.
-- Examples: ??? add examples here
-- -------------------------------
-- -- Generated Globals Section --
-- -------------------------------
-- The Generated Globals section is located at the end of the ALI file
-- All lines with information related to the Generated Globals begin with
-- string "GG". This string should therefore not be used in the beginning
-- of any line not related to Generated Globals.
-- The processing (reading and writing) of this section happens in package
-- Flow_Generated_Globals (from the SPARK 2014 sources), for further
-- information please refer there.
----------------
-- Xref Table --
----------------
-- The following table records SPARK cross-references
type Xref_Index is new Nat;
-- Used to index values in this table. Values start at 1 and are assigned
-- sequentially as entries are constructed; value 0 is used temporarily
-- until a proper value is determined.
type SPARK_Xref_Record is record
Entity_Name : String_Ptr;
-- Pointer to entity name in ALI file
Entity_Line : Nat;
-- Line number for the entity referenced
Etype : Character;
-- Indicates type of entity, using code used in ALI file:
-- > = IN parameter
-- < = OUT parameter
-- = = IN OUT parameter
-- * = all other cases
Entity_Col : Nat;
-- Column number for the entity referenced
File_Num : Nat;
-- File dependency number for the cross-reference. Note that if no file
-- entry is present explicitly, this is just a copy of the reference for
-- the current cross-reference section.
Scope_Num : Nat;
-- Scope number for the cross-reference. Note that if no scope entry is
-- present explicitly, this is just a copy of the reference for the
-- current cross-reference section.
Line : Nat;
-- Line number for the reference
Rtype : Character;
-- Indicates type of the reference, using code used in ALI file:
-- r = reference
-- c = reference to constant object
-- m = modification
-- s = call
Col : Nat;
-- Column number for the reference
end record;
package SPARK_Xref_Table is new GNAT.Table (
Table_Component_Type => SPARK_Xref_Record,
Table_Index_Type => Xref_Index,
Table_Low_Bound => 1,
Table_Initial => 2000,
Table_Increment => 300);
-----------------
-- Scope Table --
-----------------
-- This table keeps track of the scopes and the corresponding starting and
-- ending indexes (From, To) in the Xref table.
type Scope_Index is new Nat;
-- Used to index values in this table. Values start at 1 and are assigned
-- sequentially as entries are constructed; value 0 indicates that no
-- entries have been constructed and is also used until a proper value is
-- determined.
type SPARK_Scope_Record is record
Scope_Name : String_Ptr;
-- Pointer to scope name in ALI file
File_Num : Nat;
-- Set to the file dependency number for the scope
Scope_Num : Pos;
-- Set to the scope number for the scope
Spec_File_Num : Nat;
-- Set to the file dependency number for the scope corresponding to the
-- spec of the current scope entity, if different, or else 0.
Spec_Scope_Num : Nat;
-- Set to the scope number for the scope corresponding to the spec of
-- the current scope entity, if different, or else 0.
Line : Nat;
-- Line number for the scope
Stype : Character;
-- Indicates type of scope, using code used in ALI file:
-- K = package
-- T = task
-- U = procedure
-- V = function
-- Y = entry
Col : Nat;
-- Column number for the scope
From_Xref : Xref_Index;
-- Starting index in Xref table for this scope
To_Xref : Xref_Index;
-- Ending index in Xref table for this scope
-- The following component is only used in-memory, not printed out in
-- ALI file.
Scope_Entity : Entity_Id := Empty;
-- Entity (subprogram or package) for the scope
end record;
package SPARK_Scope_Table is new GNAT.Table (
Table_Component_Type => SPARK_Scope_Record,
Table_Index_Type => Scope_Index,
Table_Low_Bound => 1,
Table_Initial => 200,
Table_Increment => 300);
----------------
-- File Table --
----------------
-- This table keeps track of the units and the corresponding starting and
-- ending indexes (From, To) in the Scope table.
type File_Index is new Nat;
-- Used to index values in this table. Values start at 1 and are assigned
-- sequentially as entries are constructed; value 0 indicates that no
-- entries have been constructed.
type SPARK_File_Record is record
File_Name : String_Ptr;
-- Pointer to file name in ALI file
Unit_File_Name : String_Ptr;
-- Pointer to file name for unit in ALI file, when File_Name refers to a
-- subunit; otherwise null.
File_Num : Nat;
-- Dependency number in ALI file
From_Scope : Scope_Index;
-- Starting index in Scope table for this unit
To_Scope : Scope_Index;
-- Ending index in Scope table for this unit
end record;
package SPARK_File_Table is new GNAT.Table (
Table_Component_Type => SPARK_File_Record,
Table_Index_Type => File_Index,
Table_Low_Bound => 1,
Table_Initial => 20,
Table_Increment => 200);
---------------
-- Constants --
---------------
Name_Of_Heap_Variable : constant String := "__HEAP";
-- Name of special variable used in effects to denote reads and writes
-- through explicit dereference.
-----------------
-- Subprograms --
-----------------
procedure Initialize_SPARK_Tables;
-- Reset tables for a new compilation
procedure dspark;
-- Debug routine to dump internal SPARK cross-reference tables. This is a
-- raw format dump showing exactly what the tables contain.
procedure pspark;
-- Debugging procedure to output contents of SPARK cross-reference binary
-- tables in the format in which they appear in an ALI file.
end SPARK_Xrefs;
|
------------------------------------------------------------------------------
-- --
-- ASIS-for-GNAT IMPLEMENTATION COMPONENTS --
-- --
-- A S I S . C O M P I L A T I O N _ U N I T S . T I M E S --
-- --
-- B o d y --
-- --
-- Copyright (C) 1995-2008, 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, 59 Temple Place --
-- - Suite 330, Boston, MA 02111-1307, 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 Ada Core Technologies Inc --
-- (http://www.gnat.com). --
-- --
------------------------------------------------------------------------------
with Asis.Exceptions; use Asis.Exceptions;
with Asis.Errors; use Asis.Errors;
with Asis.Set_Get; use Asis.Set_Get;
with A4G.Vcheck; use A4G.Vcheck;
package body Asis.Compilation_Units.Times is
Package_Name : constant String := "Asis.Compilation_Units.Times.";
Standard_Time : constant Ada.Calendar.Time :=
Ada.Calendar.Time_Of (1994, 12, 21, 0.0);
-- used as Time_Of_Last_Update for the predefined Standard package
--------------------
-- Attribute_Time --
--------------------
function Attribute_Time
(Compilation_Unit : Asis.Compilation_Unit;
Attribute : Wide_String)
return Ada.Calendar.Time
is
begin
pragma Unreferenced (Attribute);
Check_Validity (Compilation_Unit, Package_Name & "Attribute_Time");
return Nil_ASIS_Time;
end Attribute_Time;
------------------------------
-- Compilation_CPU_Duration --
------------------------------
function Compilation_CPU_Duration
(Compilation_Unit : Asis.Compilation_Unit)
return Standard.Duration
is
begin
Check_Validity
(Compilation_Unit, Package_Name & "Compilation_CPU_Duration");
return 0.0;
end Compilation_CPU_Duration;
-------------------------
-- Time_Of_Last_Update --
-------------------------
function Time_Of_Last_Update
(Compilation_Unit : Asis.Compilation_Unit)
return Ada.Calendar.Time
is
begin
Check_Validity (Compilation_Unit, Package_Name & "Time_Of_Last_Update");
if Get_Unit_Id (Compilation_Unit) = Standard_Id then
return Standard_Time;
else
return Time_Stamp (Compilation_Unit);
end if;
exception
when ASIS_Inappropriate_Compilation_Unit =>
raise;
when ASIS_Failed =>
if Status_Indicator = Unhandled_Exception_Error then
Add_Call_Information
(Outer_Call => Package_Name & "Time_Of_Last_Update");
end if;
raise;
when Ex : others =>
Report_ASIS_Bug
(Query_Name => Package_Name & "Time_Of_Last_Update",
Ex => Ex,
Arg_CU => Compilation_Unit);
end Time_Of_Last_Update;
end Asis.Compilation_Units.Times;
|
--
-- This package provides handlers for enumerative types. Since the
-- type is not fixed in advance, the package needs to be generic.
--
generic
type Value_Type is (<>);
package Line_Parsers.Receivers.Enumeration_Receivers is
type Receiver_Type is new Abstract_Parameter_Handler with private;
function Is_Set (Handler : Receiver_Type) return Boolean;
overriding
procedure Receive (Handler : in out Receiver_Type;
Name : String;
Value : String;
Position : Natural);
function Get (Handler : Receiver_Type) return Value_Type
with Pre => Handler.Is_Set;
overriding function Reusable (Handler : Receiver_Type) return Boolean;
private
type Receiver_Type is new Abstract_Parameter_Handler with
record
Value : Value_Type;
Set : Boolean := False;
end record;
function Is_Set (Handler : Receiver_Type) return Boolean
is (Handler.Set);
function Reusable (Handler : Receiver_Type) return Boolean
is (False);
function Get (Handler : Receiver_Type) return Value_Type
is (Handler.Value);
end Line_Parsers.Receivers.Enumeration_Receivers;
|
with Ada.Calendar; use Ada.Calendar;
with Ada.Calendar.Formatting; use Ada.Calendar.Formatting;
with Ada.Text_IO; use Ada.Text_IO;
procedure Date_Format is
function Image (Month : Month_Number) return String is
begin
case Month is
when 1 => return "January";
when 2 => return "February";
when 3 => return "March";
when 4 => return "April";
when 5 => return "May";
when 6 => return "June";
when 7 => return "July";
when 8 => return "August";
when 9 => return "September";
when 10 => return "October";
when 11 => return "November";
when 12 => return "December";
end case;
end Image;
function Image (Day : Day_Name) return String is
begin
case Day is
when Monday => return "Monday";
when Tuesday => return "Tuesday";
when Wednesday => return "Wednesday";
when Thursday => return "Thursday";
when Friday => return "Friday";
when Saturday => return "Saturday";
when Sunday => return "Sunday";
end case;
end Image;
Today : Time := Clock;
begin
Put_Line (Image (Today) (1..10));
Put_Line
( Image (Day_Of_Week (Today)) & ", "
& Image (Ada.Calendar.Month (Today))
& Day_Number'Image (Ada.Calendar.Day (Today)) & ","
& Year_Number'Image (Ada.Calendar.Year (Today))
);
end Date_Format;
|
package body agar.gui.widget.ucombo is
package cbinds is
function allocate_polled
(parent : widget_access_t;
flags : flags_t;
callback : agar.core.event.callback_t;
fmt : agar.core.types.void_ptr_t) return ucombo_access_t;
pragma import (c, allocate_polled, "AG_UComboNewPolled");
procedure size_hint
(ucombo : ucombo_access_t;
text : cs.chars_ptr;
items : c.int);
pragma import (c, size_hint, "AG_UComboSizeHint");
procedure size_hint_pixels
(ucombo : ucombo_access_t;
width : c.int;
height : c.int);
pragma import (c, size_hint_pixels, "AG_UComboSizeHintPixels");
end cbinds;
function allocate_polled
(parent : widget_access_t;
flags : flags_t;
callback : agar.core.event.callback_t) return ucombo_access_t is
begin
return cbinds.allocate_polled
(parent => parent,
flags => flags,
callback => callback,
fmt => agar.core.types.null_ptr);
end allocate_polled;
procedure size_hint
(ucombo : ucombo_access_t;
text : string;
items : natural)
is
c_text : aliased c.char_array := c.to_c (text);
begin
cbinds.size_hint
(ucombo => ucombo,
text => cs.to_chars_ptr (c_text'unchecked_access),
items => c.int (items));
end size_hint;
procedure size_hint_pixels
(ucombo : ucombo_access_t;
width : natural;
height : natural) is
begin
cbinds.size_hint_pixels
(ucombo => ucombo,
width => c.int (width),
height => c.int (height));
end size_hint_pixels;
--
function widget (ucombo : ucombo_access_t) return widget_access_t is
begin
return ucombo.widget'access;
end widget;
end agar.gui.widget.ucombo;
|
package GESTE_Fonts.FreeMono5pt7b is
Font : constant Bitmap_Font_Ref;
private
FreeMono5pt7bBitmaps : aliased constant Font_Bitmap := (
16#00#, 16#00#, 16#08#, 16#20#, 16#80#, 16#00#, 16#30#, 16#00#, 16#00#,
16#00#, 16#0C#, 16#31#, 16#40#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#,
16#08#, 16#78#, 16#C7#, 16#94#, 16#00#, 16#00#, 16#00#, 16#00#, 16#0E#,
16#48#, 16#E4#, 16#9C#, 16#00#, 16#00#, 16#00#, 16#02#, 16#14#, 16#20#,
16#27#, 16#8A#, 16#18#, 16#00#, 16#00#, 16#00#, 16#0C#, 16#41#, 16#06#,
16#94#, 16#68#, 16#00#, 16#00#, 16#00#, 16#0C#, 16#20#, 16#80#, 16#00#,
16#00#, 16#00#, 16#00#, 16#00#, 16#04#, 16#10#, 16#41#, 16#04#, 16#10#,
16#40#, 16#00#, 16#00#, 16#10#, 16#20#, 16#82#, 16#08#, 16#21#, 16#00#,
16#00#, 16#00#, 16#00#, 16#68#, 16#C5#, 16#00#, 16#00#, 16#00#, 16#00#,
16#00#, 16#00#, 16#01#, 16#E0#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#,
16#00#, 16#00#, 16#00#, 16#08#, 16#21#, 16#00#, 16#00#, 16#00#, 16#00#,
16#01#, 16#E0#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#,
16#00#, 16#00#, 16#30#, 16#00#, 16#00#, 16#00#, 16#84#, 16#10#, 16#82#,
16#08#, 16#41#, 16#00#, 16#00#, 16#03#, 16#12#, 16#49#, 16#24#, 16#92#,
16#30#, 16#00#, 16#00#, 16#00#, 16#08#, 16#60#, 16#82#, 16#08#, 16#78#,
16#00#, 16#00#, 16#03#, 16#12#, 16#08#, 16#42#, 16#10#, 16#78#, 16#00#,
16#00#, 16#07#, 16#02#, 16#08#, 16#40#, 16#82#, 16#70#, 16#00#, 16#00#,
16#01#, 16#0C#, 16#31#, 16#45#, 16#1E#, 16#18#, 16#00#, 16#00#, 16#07#,
16#90#, 16#41#, 16#C4#, 16#82#, 16#70#, 16#00#, 16#00#, 16#01#, 16#88#,
16#41#, 16#E4#, 16#92#, 16#38#, 16#00#, 16#00#, 16#07#, 16#82#, 16#10#,
16#41#, 16#04#, 16#00#, 16#00#, 16#00#, 16#03#, 16#12#, 16#48#, 16#C4#,
16#92#, 16#30#, 16#00#, 16#00#, 16#03#, 16#12#, 16#49#, 16#23#, 16#82#,
16#70#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#C0#, 16#00#, 16#30#,
16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#C0#, 16#00#, 16#21#, 16#00#,
16#00#, 16#00#, 16#00#, 16#08#, 16#C4#, 16#0C#, 16#00#, 16#00#, 16#00#,
16#00#, 16#00#, 16#01#, 16#E7#, 16#80#, 16#00#, 16#00#, 16#00#, 16#00#,
16#00#, 16#40#, 16#C0#, 16#8C#, 16#00#, 16#00#, 16#00#, 16#00#, 16#0E#,
16#08#, 16#40#, 16#00#, 16#30#, 16#00#, 16#00#, 16#03#, 16#12#, 16#59#,
16#A6#, 16#96#, 16#40#, 16#C0#, 16#00#, 16#00#, 16#18#, 16#31#, 16#44#,
16#9E#, 16#CC#, 16#00#, 16#00#, 16#00#, 16#3E#, 16#49#, 16#C4#, 16#92#,
16#F8#, 16#00#, 16#00#, 16#00#, 16#0C#, 16#49#, 16#04#, 16#10#, 16#38#,
16#00#, 16#00#, 16#00#, 16#3C#, 16#8A#, 16#28#, 16#A2#, 16#F0#, 16#00#,
16#00#, 16#00#, 16#3E#, 16#51#, 16#C5#, 16#10#, 16#F8#, 16#00#, 16#00#,
16#00#, 16#3E#, 16#51#, 16#C5#, 16#10#, 16#E0#, 16#00#, 16#00#, 16#00#,
16#0C#, 16#49#, 16#05#, 16#D2#, 16#38#, 16#00#, 16#00#, 16#00#, 16#12#,
16#49#, 16#E4#, 16#92#, 16#4C#, 16#00#, 16#00#, 16#00#, 16#1E#, 16#20#,
16#82#, 16#08#, 16#78#, 16#00#, 16#00#, 16#00#, 16#0F#, 16#08#, 16#20#,
16#82#, 16#70#, 16#00#, 16#00#, 16#00#, 16#3A#, 16#51#, 16#85#, 16#12#,
16#EC#, 16#00#, 16#00#, 16#00#, 16#1C#, 16#41#, 16#04#, 16#10#, 16#78#,
16#00#, 16#00#, 16#00#, 16#33#, 16#4A#, 16#EA#, 16#A2#, 16#CC#, 16#00#,
16#00#, 16#00#, 16#33#, 16#CA#, 16#A9#, 16#A6#, 16#C8#, 16#00#, 16#00#,
16#00#, 16#0C#, 16#49#, 16#24#, 16#92#, 16#30#, 16#00#, 16#00#, 16#00#,
16#3C#, 16#49#, 16#27#, 16#10#, 16#E0#, 16#00#, 16#00#, 16#00#, 16#0C#,
16#49#, 16#24#, 16#92#, 16#30#, 16#C0#, 16#00#, 16#00#, 16#3C#, 16#49#,
16#27#, 16#12#, 16#E4#, 16#00#, 16#00#, 16#00#, 16#0E#, 16#49#, 16#03#,
16#92#, 16#30#, 16#00#, 16#00#, 16#00#, 16#1E#, 16#20#, 16#82#, 16#08#,
16#78#, 16#00#, 16#00#, 16#00#, 16#33#, 16#8A#, 16#28#, 16#92#, 16#30#,
16#00#, 16#00#, 16#00#, 16#33#, 16#89#, 16#25#, 16#0C#, 16#20#, 16#00#,
16#00#, 16#00#, 16#33#, 16#8A#, 16#EB#, 16#92#, 16#48#, 16#00#, 16#00#,
16#00#, 16#12#, 16#48#, 16#C3#, 16#12#, 16#CC#, 16#00#, 16#00#, 16#00#,
16#12#, 16#48#, 16#C2#, 16#08#, 16#78#, 16#00#, 16#00#, 16#00#, 16#1E#,
16#50#, 16#42#, 16#10#, 16#78#, 16#00#, 16#00#, 16#01#, 16#04#, 16#10#,
16#41#, 16#04#, 16#10#, 16#40#, 16#00#, 16#04#, 16#10#, 16#40#, 16#82#,
16#04#, 16#10#, 16#20#, 16#00#, 16#02#, 16#08#, 16#20#, 16#82#, 16#08#,
16#20#, 16#80#, 16#00#, 16#02#, 16#14#, 16#48#, 16#00#, 16#00#, 16#00#,
16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#03#, 16#F0#,
16#00#, 16#00#, 16#08#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#,
16#00#, 16#00#, 16#01#, 16#C7#, 16#92#, 16#78#, 16#00#, 16#00#, 16#08#,
16#20#, 16#82#, 16#E4#, 16#92#, 16#B8#, 16#00#, 16#00#, 16#00#, 16#00#,
16#00#, 16#C4#, 16#90#, 16#38#, 16#00#, 16#00#, 16#00#, 16#82#, 16#08#,
16#E4#, 16#92#, 16#74#, 16#00#, 16#00#, 16#00#, 16#00#, 16#01#, 16#E7#,
16#90#, 16#38#, 16#00#, 16#00#, 16#01#, 16#88#, 16#21#, 16#E2#, 16#08#,
16#78#, 16#00#, 16#00#, 16#00#, 16#00#, 16#01#, 16#F4#, 16#92#, 16#78#,
16#20#, 16#00#, 16#0C#, 16#10#, 16#41#, 16#E4#, 16#92#, 16#4C#, 16#00#,
16#00#, 16#00#, 16#08#, 16#01#, 16#82#, 16#08#, 16#78#, 16#00#, 16#00#,
16#00#, 16#04#, 16#01#, 16#C1#, 16#04#, 16#10#, 16#40#, 16#00#, 16#04#,
16#10#, 16#41#, 16#66#, 16#14#, 16#48#, 16#00#, 16#00#, 16#06#, 16#08#,
16#20#, 16#82#, 16#08#, 16#78#, 16#00#, 16#00#, 16#00#, 16#00#, 16#03#,
16#EA#, 16#AA#, 16#D4#, 16#00#, 16#00#, 16#00#, 16#00#, 16#01#, 16#E4#,
16#92#, 16#48#, 16#00#, 16#00#, 16#00#, 16#00#, 16#01#, 16#E4#, 16#92#,
16#78#, 16#00#, 16#00#, 16#00#, 16#00#, 16#02#, 16#E4#, 16#92#, 16#BA#,
16#00#, 16#00#, 16#00#, 16#00#, 16#01#, 16#D4#, 16#92#, 16#78#, 16#20#,
16#00#, 16#00#, 16#00#, 16#01#, 16#62#, 16#10#, 16#78#, 16#00#, 16#00#,
16#00#, 16#00#, 16#00#, 16#E7#, 16#82#, 16#30#, 16#00#, 16#00#, 16#00#,
16#10#, 16#43#, 16#C4#, 16#10#, 16#38#, 16#00#, 16#00#, 16#00#, 16#00#,
16#03#, 16#64#, 16#92#, 16#78#, 16#00#, 16#00#, 16#00#, 16#00#, 16#03#,
16#34#, 16#8C#, 16#30#, 16#00#, 16#00#, 16#00#, 16#00#, 16#03#, 16#38#,
16#9E#, 16#48#, 16#00#, 16#00#, 16#00#, 16#00#, 16#01#, 16#23#, 16#14#,
16#48#, 16#00#, 16#00#, 16#00#, 16#00#, 16#01#, 16#24#, 16#94#, 16#20#,
16#80#, 16#00#, 16#00#, 16#00#, 16#01#, 16#E5#, 16#18#, 16#78#, 16#00#,
16#00#, 16#01#, 16#08#, 16#20#, 16#82#, 16#08#, 16#20#, 16#40#, 16#00#,
16#00#, 16#08#, 16#20#, 16#82#, 16#08#, 16#20#, 16#00#, 16#00#, 16#02#,
16#08#, 16#20#, 16#81#, 16#08#, 16#20#, 16#80#, 16#00#, 16#00#, 16#00#,
16#01#, 16#81#, 16#80#, 16#00#, 16#00#);
Font_D : aliased constant Bitmap_Font :=
(
Bytes_Per_Glyph => 8,
Glyph_Width => 6,
Glyph_Height => 10,
Data => FreeMono5pt7bBitmaps'Access);
Font : constant Bitmap_Font_Ref := Font_D'Access;
end GESTE_Fonts.FreeMono5pt7b;
|
------------------------------------------------------------------------------
-- --
-- GNAT COMPILER COMPONENTS --
-- --
-- S Y S T E M . P A R A M E T E R 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. --
-- --
------------------------------------------------------------------------------
-- This is the RT-GNU/Linux version.
-- Blank line intentional so that it lines up exactly with default.
-- This package defines some system dependent parameters for GNAT. These
-- are values that are referenced by the runtime library and are therefore
-- relevant to the target machine.
-- The parameters whose value is defined in the spec are not generally
-- expected to be changed. If they are changed, it will be necessary to
-- recompile the run-time library.
-- The parameters which are defined by functions can be changed by modifying
-- the body of System.Parameters in file s-parame.adb. A change to this body
-- requires only rebinding and relinking of the application.
-- Note: do not introduce any pragma Inline statements into this unit, since
-- otherwise the relinking and rebinding capability would be deactivated.
package System.Parameters is
pragma Pure (Parameters);
---------------------------------------
-- Task And Stack Allocation Control --
---------------------------------------
type Task_Storage_Size is new Integer;
-- Type used in tasking units for task storage size
type Size_Type is new Task_Storage_Size;
-- Type used to provide task storage size to runtime
Unspecified_Size : constant Size_Type := Size_Type'First;
-- Value used to indicate that no size type is set
subtype Ratio is Size_Type range -1 .. 100;
Dynamic : constant Size_Type := 10;
-- The secondary stack ratio is a constant between 0 and 100 which
-- determines the percentage of the allocated task stack that is
-- used by the secondary stack (the rest being the primary stack).
-- The special value of minus one indicates that the secondary
-- stack is to be allocated from the heap instead.
Sec_Stack_Ratio : constant Ratio := Dynamic;
-- This constant defines the handling of the secondary stack
Sec_Stack_Dynamic : constant Boolean := Sec_Stack_Ratio = Dynamic;
-- Convenient Boolean for testing for dynamic secondary stack
function Default_Stack_Size return Size_Type;
-- Default task stack size used if none is specified
function Minimum_Stack_Size return Size_Type;
-- Minimum task stack size permitted
function Adjust_Storage_Size (Size : Size_Type) return Size_Type;
-- Given the storage size stored in the TCB, return the Storage_Size
-- value required by the RM for the Storage_Size attribute. The
-- required adjustment is as follows:
--
-- when Size = Unspecified_Size, return Default_Stack_Size
-- when Size < Minimum_Stack_Size, return Minimum_Stack_Size
-- otherwise return given Size
Stack_Grows_Down : constant Boolean := True;
-- This constant indicates whether the stack grows up (False) or
-- down (True) in memory as functions are called. It is used for
-- proper implementation of the stack overflow check.
----------------------------------------------
-- Characteristics of types in Interfaces.C --
----------------------------------------------
long_bits : constant := Long_Integer'Size;
-- Number of bits in type long and unsigned_long. The normal convention
-- is that this is the same as type Long_Integer, but this is not true
-- of all targets. For example, in OpenVMS long /= Long_Integer.
----------------------------------------------
-- Behavior of Pragma Finalize_Storage_Only --
----------------------------------------------
-- Garbage_Collected is a Boolean constant whose value indicates the
-- effect of the pragma Finalize_Storage_Entry on a controlled type.
-- Garbage_Collected = False
-- The system releases all storage on program termination only,
-- but not other garbage collection occurs, so finalization calls
-- are ommitted only for outer level onjects can be omitted if
-- pragma Finalize_Storage_Only is used.
-- Garbage_Collected = True
-- The system provides full garbage collection, so it is never
-- necessary to release storage for controlled objects for which
-- a pragma Finalize_Storage_Only is used.
Garbage_Collected : constant Boolean := False;
-- The storage mode for this system (release on program exit)
end System.Parameters;
|
------------------------------------------------------------------------------
-- --
-- GNAT COMPILER COMPONENTS --
-- --
-- P A R . C H 6 --
-- --
-- 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. --
-- --
-- GNAT was originally developed by the GNAT team at New York University. --
-- Extensive contributions were provided by Ada Core Technologies Inc. --
-- --
------------------------------------------------------------------------------
pragma Style_Checks (All_Checks);
-- Turn off subprogram body ordering check. Subprograms are in order
-- by RM section rather than alphabetical
with Sinfo.CN; use Sinfo.CN;
separate (Par)
package body Ch6 is
-- Local subprograms, used only in this chapter
function P_Defining_Designator return Node_Id;
function P_Defining_Operator_Symbol return Node_Id;
procedure Check_Junk_Semicolon_Before_Return;
-- Check for common error of junk semicolon before RETURN keyword of
-- function specification. If present, skip over it with appropriate
-- error message, leaving Scan_Ptr pointing to the RETURN after. This
-- routine also deals with a possibly misspelled version of Return.
----------------------------------------
-- Check_Junk_Semicolon_Before_Return --
----------------------------------------
procedure Check_Junk_Semicolon_Before_Return is
Scan_State : Saved_Scan_State;
begin
if Token = Tok_Semicolon then
Save_Scan_State (Scan_State);
Scan; -- past the semicolon
if Token = Tok_Return then
Restore_Scan_State (Scan_State);
Error_Msg_SC ("Unexpected semicolon ignored");
Scan; -- rescan past junk semicolon
else
Restore_Scan_State (Scan_State);
end if;
elsif Bad_Spelling_Of (Tok_Return) then
null;
end if;
end Check_Junk_Semicolon_Before_Return;
-----------------------------------------------------
-- 6.1 Subprogram (Also 6.3, 8.5.4, 10.1.3, 12.3) --
-----------------------------------------------------
-- This routine scans out a subprogram declaration, subprogram body,
-- subprogram renaming declaration or subprogram generic instantiation.
-- SUBPROGRAM_DECLARATION ::= SUBPROGRAM_SPECIFICATION;
-- ABSTRACT_SUBPROGRAM_DECLARATION ::=
-- SUBPROGRAM_SPECIFICATION is abstract;
-- SUBPROGRAM_SPECIFICATION ::=
-- procedure DEFINING_PROGRAM_UNIT_NAME PARAMETER_PROFILE
-- | function DEFINING_DESIGNATOR PARAMETER_AND_RESULT_PROFILE
-- PARAMETER_PROFILE ::= [FORMAL_PART]
-- PARAMETER_AND_RESULT_PROFILE ::= [FORMAL_PART] return SUBTYPE_MARK
-- SUBPROGRAM_BODY ::=
-- SUBPROGRAM_SPECIFICATION is
-- DECLARATIVE_PART
-- begin
-- HANDLED_SEQUENCE_OF_STATEMENTS
-- end [DESIGNATOR];
-- SUBPROGRAM_RENAMING_DECLARATION ::=
-- SUBPROGRAM_SPECIFICATION renames callable_entity_NAME;
-- SUBPROGRAM_BODY_STUB ::=
-- SUBPROGRAM_SPECIFICATION is separate;
-- GENERIC_INSTANTIATION ::=
-- procedure DEFINING_PROGRAM_UNIT_NAME is
-- new generic_procedure_NAME [GENERIC_ACTUAL_PART];
-- | function DEFINING_DESIGNATOR is
-- new generic_function_NAME [GENERIC_ACTUAL_PART];
-- The value in Pf_Flags indicates which of these possible declarations
-- is acceptable to the caller:
-- Pf_Flags.Decl Set if declaration OK
-- Pf_Flags.Gins Set if generic instantiation OK
-- Pf_Flags.Pbod Set if proper body OK
-- Pf_Flags.Rnam Set if renaming declaration OK
-- Pf_Flags.Stub Set if body stub OK
-- If an inappropriate form is encountered, it is scanned out but an
-- error message indicating that it is appearing in an inappropriate
-- context is issued. The only possible values for Pf_Flags are those
-- defined as constants in the Par package.
-- The caller has checked that the initial token is FUNCTION or PROCEDURE
-- Error recovery: cannot raise Error_Resync
function P_Subprogram (Pf_Flags : Pf_Rec) return Node_Id is
Specification_Node : Node_Id;
Name_Node : Node_Id;
Fpart_List : List_Id;
Fpart_Sloc : Source_Ptr;
Return_Node : Node_Id;
Inst_Node : Node_Id;
Body_Node : Node_Id;
Decl_Node : Node_Id;
Rename_Node : Node_Id;
Absdec_Node : Node_Id;
Stub_Node : Node_Id;
Fproc_Sloc : Source_Ptr;
Func : Boolean;
Scan_State : Saved_Scan_State;
begin
-- Set up scope stack entry. Note that the Labl field will be set later
SIS_Entry_Active := False;
SIS_Missing_Semicolon_Message := No_Error_Msg;
Push_Scope_Stack;
Scope.Table (Scope.Last).Sloc := Token_Ptr;
Scope.Table (Scope.Last).Etyp := E_Name;
Scope.Table (Scope.Last).Ecol := Start_Column;
Scope.Table (Scope.Last).Lreq := False;
Func := (Token = Tok_Function);
Fproc_Sloc := Token_Ptr;
Scan; -- past FUNCTION or PROCEDURE
Ignore (Tok_Type);
Ignore (Tok_Body);
if Func then
Name_Node := P_Defining_Designator;
if Nkind (Name_Node) = N_Defining_Operator_Symbol
and then Scope.Last = 1
then
Error_Msg_SP ("operator symbol not allowed at library level");
Name_Node := New_Entity (N_Defining_Identifier, Sloc (Name_Node));
-- Set name from file name, we need some junk name, and that's
-- as good as anything. This is only approximate, since we do
-- not do anything with non-standard name translations.
Get_Name_String (File_Name (Current_Source_File));
for J in 1 .. Name_Len loop
if Name_Buffer (J) = '.' then
Name_Len := J - 1;
exit;
end if;
end loop;
Set_Chars (Name_Node, Name_Find);
Set_Error_Posted (Name_Node);
end if;
else
Name_Node := P_Defining_Program_Unit_Name;
end if;
Scope.Table (Scope.Last).Labl := Name_Node;
if Token = Tok_Colon then
Error_Msg_SC ("redundant colon ignored");
Scan; -- past colon
end if;
-- Deal with generic instantiation, the one case in which we do not
-- have a subprogram specification as part of whatever we are parsing
if Token = Tok_Is then
Save_Scan_State (Scan_State); -- at the IS
T_Is; -- checks for redundant IS's
if Token = Tok_New then
if not Pf_Flags.Gins then
Error_Msg_SC ("generic instantiation not allowed here!");
end if;
Scan; -- past NEW
if Func then
Inst_Node := New_Node (N_Function_Instantiation, Fproc_Sloc);
Set_Name (Inst_Node, P_Function_Name);
else
Inst_Node := New_Node (N_Procedure_Instantiation, Fproc_Sloc);
Set_Name (Inst_Node, P_Qualified_Simple_Name);
end if;
Set_Defining_Unit_Name (Inst_Node, Name_Node);
Set_Generic_Associations (Inst_Node, P_Generic_Actual_Part_Opt);
TF_Semicolon;
Pop_Scope_Stack; -- Don't need scope stack entry in this case
return Inst_Node;
else
Restore_Scan_State (Scan_State); -- to the IS
end if;
end if;
-- If not a generic instantiation, then we definitely have a subprogram
-- specification (all possibilities at this stage include one here)
Fpart_Sloc := Token_Ptr;
Check_Misspelling_Of (Tok_Return);
-- Scan formal part. First a special error check. If we have an
-- identifier here, then we have a definite error. If this identifier
-- is on the same line as the designator, then we assume it is the
-- first formal after a missing left parenthesis
if Token = Tok_Identifier
and then not Token_Is_At_Start_Of_Line
then
T_Left_Paren; -- to generate message
Fpart_List := P_Formal_Part;
-- Otherwise scan out an optional formal part in the usual manner
else
Fpart_List := P_Parameter_Profile;
end if;
-- We treat what we have as a function specification if FUNCTION was
-- used, or if a RETURN is present. This gives better error recovery
-- since later RETURN statements will be valid in either case.
Check_Junk_Semicolon_Before_Return;
Return_Node := Error;
if Token = Tok_Return then
if not Func then
Error_Msg ("PROCEDURE should be FUNCTION", Fproc_Sloc);
Func := True;
end if;
Scan; -- past RETURN
Return_Node := P_Subtype_Mark;
No_Constraint;
else
if Func then
Ignore (Tok_Right_Paren);
TF_Return;
end if;
end if;
if Func then
Specification_Node :=
New_Node (N_Function_Specification, Fproc_Sloc);
Set_Subtype_Mark (Specification_Node, Return_Node);
else
Specification_Node :=
New_Node (N_Procedure_Specification, Fproc_Sloc);
end if;
Set_Defining_Unit_Name (Specification_Node, Name_Node);
Set_Parameter_Specifications (Specification_Node, Fpart_List);
-- Error check: barriers not allowed on protected functions/procedures
if Token = Tok_When then
if Func then
Error_Msg_SC ("barrier not allowed on function, only on entry");
else
Error_Msg_SC ("barrier not allowed on procedure, only on entry");
end if;
Scan; -- past WHEN
Discard_Junk_Node (P_Expression);
end if;
-- Deal with case of semicolon ending a subprogram declaration
if Token = Tok_Semicolon then
if not Pf_Flags.Decl then
T_Is;
end if;
Scan; -- past semicolon
-- If semicolon is immediately followed by IS, then ignore the
-- semicolon, and go process the body.
if Token = Tok_Is then
Error_Msg_SP ("unexpected semicolon ignored");
T_Is; -- ignroe redundant IS's
goto Subprogram_Body;
-- If BEGIN follows in an appropriate column, we immediately
-- commence the error action of assuming that the previous
-- subprogram declaration should have been a subprogram body,
-- i.e. that the terminating semicolon should have been IS.
elsif Token = Tok_Begin
and then Start_Column >= Scope.Table (Scope.Last).Ecol
then
Error_Msg_SP (""";"" should be IS!");
goto Subprogram_Body;
else
goto Subprogram_Declaration;
end if;
-- Case of not followed by semicolon
else
-- Subprogram renaming declaration case
Check_Misspelling_Of (Tok_Renames);
if Token = Tok_Renames then
if not Pf_Flags.Rnam then
Error_Msg_SC ("renaming declaration not allowed here!");
end if;
Rename_Node :=
New_Node (N_Subprogram_Renaming_Declaration, Token_Ptr);
Scan; -- past RENAMES
Set_Name (Rename_Node, P_Name);
Set_Specification (Rename_Node, Specification_Node);
TF_Semicolon;
Pop_Scope_Stack;
return Rename_Node;
-- Case of IS following subprogram specification
elsif Token = Tok_Is then
T_Is; -- ignore redundant Is's
if Token_Name = Name_Abstract then
Check_95_Keyword (Tok_Abstract, Tok_Semicolon);
end if;
-- Deal nicely with (now obsolete) use of <> in place of abstract
if Token = Tok_Box then
Error_Msg_SC ("ABSTRACT expected");
Token := Tok_Abstract;
end if;
-- Abstract subprogram declaration case
if Token = Tok_Abstract then
Absdec_Node :=
New_Node (N_Abstract_Subprogram_Declaration, Token_Ptr);
Set_Specification (Absdec_Node, Specification_Node);
Pop_Scope_Stack; -- discard unneeded entry
Scan; -- past ABSTRACT
TF_Semicolon;
return Absdec_Node;
-- Check for IS NEW with Formal_Part present and handle nicely
elsif Token = Tok_New then
Error_Msg
("formal part not allowed in instantiation", Fpart_Sloc);
Scan; -- past NEW
if Func then
Inst_Node := New_Node (N_Function_Instantiation, Fproc_Sloc);
else
Inst_Node :=
New_Node (N_Procedure_Instantiation, Fproc_Sloc);
end if;
Set_Defining_Unit_Name (Inst_Node, Name_Node);
Set_Name (Inst_Node, P_Name);
Set_Generic_Associations (Inst_Node, P_Generic_Actual_Part_Opt);
TF_Semicolon;
Pop_Scope_Stack; -- Don't need scope stack entry in this case
return Inst_Node;
else
goto Subprogram_Body;
end if;
-- Here we have a missing IS or missing semicolon, we always guess
-- a missing semicolon, since we are pretty good at fixing up a
-- semicolon which should really be an IS
else
Error_Msg_AP ("missing "";""");
SIS_Missing_Semicolon_Message := Get_Msg_Id;
goto Subprogram_Declaration;
end if;
end if;
-- Processing for subprogram body
<<Subprogram_Body>>
if not Pf_Flags.Pbod then
Error_Msg_SP ("subprogram body not allowed here!");
end if;
-- Subprogram body stub case
if Separate_Present then
if not Pf_Flags.Stub then
Error_Msg_SC ("body stub not allowed here!");
end if;
if Nkind (Name_Node) = N_Defining_Operator_Symbol then
Error_Msg
("operator symbol cannot be used as subunit name",
Sloc (Name_Node));
end if;
Stub_Node :=
New_Node (N_Subprogram_Body_Stub, Sloc (Specification_Node));
Set_Specification (Stub_Node, Specification_Node);
Scan; -- past SEPARATE
Pop_Scope_Stack;
TF_Semicolon;
return Stub_Node;
-- Subprogram body case
else
-- Here is the test for a suspicious IS (i.e. one that looks
-- like it might more properly be a semicolon). See separate
-- section discussing use of IS instead of semicolon in
-- package Parse.
if (Token in Token_Class_Declk
or else
Token = Tok_Identifier)
and then Start_Column <= Scope.Table (Scope.Last).Ecol
and then Scope.Last /= 1
then
Scope.Table (Scope.Last).Etyp := E_Suspicious_Is;
Scope.Table (Scope.Last).S_Is := Prev_Token_Ptr;
end if;
Body_Node :=
New_Node (N_Subprogram_Body, Sloc (Specification_Node));
Set_Specification (Body_Node, Specification_Node);
Parse_Decls_Begin_End (Body_Node);
return Body_Node;
end if;
-- Processing for subprogram declaration
<<Subprogram_Declaration>>
Decl_Node :=
New_Node (N_Subprogram_Declaration, Sloc (Specification_Node));
Set_Specification (Decl_Node, Specification_Node);
-- If this is a context in which a subprogram body is permitted,
-- set active SIS entry in case (see section titled "Handling
-- Semicolon Used in Place of IS" in body of Parser package)
-- Note that SIS_Missing_Semicolon_Message is already set properly.
if Pf_Flags.Pbod then
SIS_Labl := Scope.Table (Scope.Last).Labl;
SIS_Sloc := Scope.Table (Scope.Last).Sloc;
SIS_Ecol := Scope.Table (Scope.Last).Ecol;
SIS_Declaration_Node := Decl_Node;
SIS_Semicolon_Sloc := Prev_Token_Ptr;
SIS_Entry_Active := True;
end if;
Pop_Scope_Stack;
return Decl_Node;
end P_Subprogram;
---------------------------------
-- 6.1 Subprogram Declaration --
---------------------------------
-- Parsed by P_Subprogram (6.1)
------------------------------------------
-- 6.1 Abstract Subprogram Declaration --
------------------------------------------
-- Parsed by P_Subprogram (6.1)
-----------------------------------
-- 6.1 Subprogram Specification --
-----------------------------------
-- SUBPROGRAM_SPECIFICATION ::=
-- procedure DEFINING_PROGRAM_UNIT_NAME PARAMETER_PROFILE
-- | function DEFINING_DESIGNATOR PARAMETER_AND_RESULT_PROFILE
-- PARAMETER_PROFILE ::= [FORMAL_PART]
-- PARAMETER_AND_RESULT_PROFILE ::= [FORMAL_PART] return SUBTYPE_MARK
-- Subprogram specifications that appear in subprogram declarations
-- are parsed by P_Subprogram (6.1). This routine is used in other
-- contexts where subprogram specifications occur.
-- Note: this routine does not affect the scope stack in any way
-- Error recovery: can raise Error_Resync
function P_Subprogram_Specification return Node_Id is
Specification_Node : Node_Id;
begin
if Token = Tok_Function then
Specification_Node := New_Node (N_Function_Specification, Token_Ptr);
Scan; -- past FUNCTION
Ignore (Tok_Body);
Set_Defining_Unit_Name (Specification_Node, P_Defining_Designator);
Set_Parameter_Specifications
(Specification_Node, P_Parameter_Profile);
Check_Junk_Semicolon_Before_Return;
TF_Return;
Set_Subtype_Mark (Specification_Node, P_Subtype_Mark);
No_Constraint;
return Specification_Node;
elsif Token = Tok_Procedure then
Specification_Node := New_Node (N_Procedure_Specification, Token_Ptr);
Scan; -- past PROCEDURE
Ignore (Tok_Body);
Set_Defining_Unit_Name
(Specification_Node, P_Defining_Program_Unit_Name);
Set_Parameter_Specifications
(Specification_Node, P_Parameter_Profile);
return Specification_Node;
else
Error_Msg_SC ("subprogram specification expected");
raise Error_Resync;
end if;
end P_Subprogram_Specification;
---------------------
-- 6.1 Designator --
---------------------
-- DESIGNATOR ::=
-- [PARENT_UNIT_NAME .] IDENTIFIER | OPERATOR_SYMBOL
-- The caller has checked that the initial token is an identifier,
-- operator symbol, or string literal. Note that we don't bother to
-- do much error diagnosis in this routine, since it is only used for
-- the label on END lines, and the routines in package Par.Endh will
-- check that the label is appropriate.
-- Error recovery: cannot raise Error_Resync
function P_Designator return Node_Id is
Ident_Node : Node_Id;
Name_Node : Node_Id;
Prefix_Node : Node_Id;
function Real_Dot return Boolean;
-- Tests if a current token is an interesting period, i.e. is followed
-- by an identifier or operator symbol or string literal. If not, it is
-- probably just incorrect punctuation to be caught by our caller. Note
-- that the case of an operator symbol or string literal is also an
-- error, but that is an error that we catch here. If the result is
-- True, a real dot has been scanned and we are positioned past it,
-- if the result is False, the scan position is unchanged.
function Real_Dot return Boolean is
Scan_State : Saved_Scan_State;
begin
if Token /= Tok_Dot then
return False;
else
Save_Scan_State (Scan_State);
Scan; -- past dot
if Token = Tok_Identifier
or else Token = Tok_Operator_Symbol
or else Token = Tok_String_Literal
then
return True;
else
Restore_Scan_State (Scan_State);
return False;
end if;
end if;
end Real_Dot;
-- Start of processing for P_Designator
begin
Ident_Node := Token_Node;
Scan; -- past initial token
if Prev_Token = Tok_Operator_Symbol
or else Prev_Token = Tok_String_Literal
or else not Real_Dot
then
return Ident_Node;
-- Child name case
else
Prefix_Node := Ident_Node;
-- Loop through child names, on entry to this loop, Prefix contains
-- the name scanned so far, and Ident_Node is the last identifier.
loop
Name_Node := New_Node (N_Selected_Component, Prev_Token_Ptr);
Set_Prefix (Name_Node, Prefix_Node);
Ident_Node := P_Identifier;
Set_Selector_Name (Name_Node, Ident_Node);
Prefix_Node := Name_Node;
exit when not Real_Dot;
end loop;
-- On exit from the loop, Ident_Node is the last identifier scanned,
-- i.e. the defining identifier, and Prefix_Node is a node for the
-- entire name, structured (incorrectly!) as a selected component.
Name_Node := Prefix (Prefix_Node);
Change_Node (Prefix_Node, N_Designator);
Set_Name (Prefix_Node, Name_Node);
Set_Identifier (Prefix_Node, Ident_Node);
return Prefix_Node;
end if;
exception
when Error_Resync =>
while Token = Tok_Dot or else Token = Tok_Identifier loop
Scan;
end loop;
return Error;
end P_Designator;
------------------------------
-- 6.1 Defining Designator --
------------------------------
-- DEFINING_DESIGNATOR ::=
-- DEFINING_PROGRAM_UNIT_NAME | DEFINING_OPERATOR_SYMBOL
-- Error recovery: cannot raise Error_Resync
function P_Defining_Designator return Node_Id is
begin
if Token = Tok_Operator_Symbol then
return P_Defining_Operator_Symbol;
elsif Token = Tok_String_Literal then
Error_Msg_SC ("invalid operator name");
Scan; -- past junk string
return Error;
else
return P_Defining_Program_Unit_Name;
end if;
end P_Defining_Designator;
-------------------------------------
-- 6.1 Defining Program Unit Name --
-------------------------------------
-- DEFINING_PROGRAM_UNIT_NAME ::=
-- [PARENT_UNIT_NAME .] DEFINING_IDENTIFIER
-- Note: PARENT_UNIT_NAME may be present only in 95 mode at the outer level
-- Error recovery: cannot raise Error_Resync
function P_Defining_Program_Unit_Name return Node_Id is
Ident_Node : Node_Id;
Name_Node : Node_Id;
Prefix_Node : Node_Id;
begin
-- Set identifier casing if not already set and scan initial identifier
if Token = Tok_Identifier
and then Identifier_Casing (Current_Source_File) = Unknown
then
Set_Identifier_Casing (Current_Source_File, Determine_Token_Casing);
end if;
Ident_Node := P_Identifier;
Merge_Identifier (Ident_Node, Tok_Return);
-- Normal case (not child library unit name)
if Token /= Tok_Dot then
Change_Identifier_To_Defining_Identifier (Ident_Node);
return Ident_Node;
-- Child library unit name case
else
if Scope.Last > 1 then
Error_Msg_SP ("child unit allowed only at library level");
raise Error_Resync;
elsif Ada_83 then
Error_Msg_SP ("(Ada 83) child unit not allowed!");
end if;
Prefix_Node := Ident_Node;
-- Loop through child names, on entry to this loop, Prefix contains
-- the name scanned so far, and Ident_Node is the last identifier.
loop
exit when Token /= Tok_Dot;
Name_Node := New_Node (N_Selected_Component, Token_Ptr);
Scan; -- past period
Set_Prefix (Name_Node, Prefix_Node);
Ident_Node := P_Identifier;
Set_Selector_Name (Name_Node, Ident_Node);
Prefix_Node := Name_Node;
end loop;
-- On exit from the loop, Ident_Node is the last identifier scanned,
-- i.e. the defining identifier, and Prefix_Node is a node for the
-- entire name, structured (incorrectly!) as a selected component.
Name_Node := Prefix (Prefix_Node);
Change_Node (Prefix_Node, N_Defining_Program_Unit_Name);
Set_Name (Prefix_Node, Name_Node);
Change_Identifier_To_Defining_Identifier (Ident_Node);
Set_Defining_Identifier (Prefix_Node, Ident_Node);
-- All set with unit name parsed
return Prefix_Node;
end if;
exception
when Error_Resync =>
while Token = Tok_Dot or else Token = Tok_Identifier loop
Scan;
end loop;
return Error;
end P_Defining_Program_Unit_Name;
--------------------------
-- 6.1 Operator Symbol --
--------------------------
-- OPERATOR_SYMBOL ::= STRING_LITERAL
-- Operator symbol is returned by the scanner as Tok_Operator_Symbol
-----------------------------------
-- 6.1 Defining Operator Symbol --
-----------------------------------
-- DEFINING_OPERATOR_SYMBOL ::= OPERATOR_SYMBOL
-- The caller has checked that the initial symbol is an operator symbol
function P_Defining_Operator_Symbol return Node_Id is
Op_Node : Node_Id;
begin
Op_Node := Token_Node;
Change_Operator_Symbol_To_Defining_Operator_Symbol (Op_Node);
Scan; -- past operator symbol
return Op_Node;
end P_Defining_Operator_Symbol;
----------------------------
-- 6.1 Parameter_Profile --
----------------------------
-- PARAMETER_PROFILE ::= [FORMAL_PART]
-- Empty is returned if no formal part is present
-- Error recovery: cannot raise Error_Resync
function P_Parameter_Profile return List_Id is
begin
if Token = Tok_Left_Paren then
Scan; -- part left paren
return P_Formal_Part;
else
return No_List;
end if;
end P_Parameter_Profile;
---------------------------------------
-- 6.1 Parameter And Result Profile --
---------------------------------------
-- Parsed by its parent construct, which uses P_Parameter_Profile to
-- parse the parameters, and P_Subtype_Mark to parse the return type.
----------------------
-- 6.1 Formal part --
----------------------
-- FORMAL_PART ::= (PARAMETER_SPECIFICATION {; PARAMETER_SPECIFICATION})
-- PARAMETER_SPECIFICATION ::=
-- DEFINING_IDENTIFIER_LIST : MODE SUBTYPE_MARK
-- [:= DEFAULT_EXPRESSION]
-- | DEFINING_IDENTIFIER_LIST : ACCESS_DEFINITION
-- [:= DEFAULT_EXPRESSION]
-- This scans the construct Formal_Part. The caller has already checked
-- that the initial token is a left parenthesis, and skipped past it, so
-- that on entry Token is the first token following the left parenthesis.
-- Error recovery: cannot raise Error_Resync
function P_Formal_Part return List_Id is
Specification_List : List_Id;
Specification_Node : Node_Id;
Scan_State : Saved_Scan_State;
Num_Idents : Nat;
Ident : Nat;
Ident_Sloc : Source_Ptr;
Idents : array (Int range 1 .. 4096) of Entity_Id;
-- This array holds the list of defining identifiers. The upper bound
-- of 4096 is intended to be essentially infinite, and we do not even
-- bother to check for it being exceeded.
begin
Specification_List := New_List;
Specification_Loop : loop
begin
if Token = Tok_Pragma then
P_Pragmas_Misplaced;
end if;
Ignore (Tok_Left_Paren);
Ident_Sloc := Token_Ptr;
Idents (1) := P_Defining_Identifier;
Num_Idents := 1;
Ident_Loop : loop
exit Ident_Loop when Token = Tok_Colon;
-- The only valid tokens are colon and comma, so if we have
-- neither do a bit of investigation to see which is the
-- better choice for insertion.
if Token /= Tok_Comma then
-- Assume colon if IN or OUT keyword found
exit Ident_Loop when Token = Tok_In or else Token = Tok_Out;
-- Otherwise scan ahead
Save_Scan_State (Scan_State);
Look_Ahead : loop
-- If we run into a semicolon, then assume that a
-- colon was missing, e.g. Parms (X Y; ...). Also
-- assume missing colon on EOF (a real disaster!)
-- and on a right paren, e.g. Parms (X Y), and also
-- on an assignment symbol, e.g. Parms (X Y := ..)
if Token = Tok_Semicolon
or else Token = Tok_Right_Paren
or else Token = Tok_EOF
or else Token = Tok_Colon_Equal
then
Restore_Scan_State (Scan_State);
exit Ident_Loop;
-- If we run into a colon, assume that we had a missing
-- comma, e.g. Parms (A B : ...). Also assume a missing
-- comma if we hit another comma, e.g. Parms (A B, C ..)
elsif Token = Tok_Colon
or else Token = Tok_Comma
then
Restore_Scan_State (Scan_State);
exit Look_Ahead;
end if;
Scan;
end loop Look_Ahead;
end if;
-- Here if a comma is present, or to be assumed
T_Comma;
Num_Idents := Num_Idents + 1;
Idents (Num_Idents) := P_Defining_Identifier;
end loop Ident_Loop;
-- Fall through the loop on encountering a colon, or deciding
-- that there is a missing colon.
T_Colon;
-- If there are multiple identifiers, we repeatedly scan the
-- type and initialization expression information by resetting
-- the scan pointer (so that we get completely separate trees
-- for each occurrence).
if Num_Idents > 1 then
Save_Scan_State (Scan_State);
end if;
-- Loop through defining identifiers in list
Ident := 1;
Ident_List_Loop : loop
Specification_Node :=
New_Node (N_Parameter_Specification, Ident_Sloc);
Set_Defining_Identifier (Specification_Node, Idents (Ident));
if Token = Tok_Access then
if Ada_83 then
Error_Msg_SC ("(Ada 83) access parameters not allowed");
end if;
Set_Parameter_Type
(Specification_Node, P_Access_Definition);
else
P_Mode (Specification_Node);
if Token = Tok_Procedure
or else
Token = Tok_Function
then
Error_Msg_SC ("formal subprogram parameter not allowed");
Scan;
if Token = Tok_Left_Paren then
Discard_Junk_List (P_Formal_Part);
end if;
if Token = Tok_Return then
Scan;
Discard_Junk_Node (P_Subtype_Mark);
end if;
Set_Parameter_Type (Specification_Node, Error);
else
Set_Parameter_Type (Specification_Node, P_Subtype_Mark);
No_Constraint;
end if;
end if;
Set_Expression (Specification_Node, Init_Expr_Opt (True));
if Ident > 1 then
Set_Prev_Ids (Specification_Node, True);
end if;
if Ident < Num_Idents then
Set_More_Ids (Specification_Node, True);
end if;
Append (Specification_Node, Specification_List);
exit Ident_List_Loop when Ident = Num_Idents;
Ident := Ident + 1;
Restore_Scan_State (Scan_State);
end loop Ident_List_Loop;
exception
when Error_Resync =>
Resync_Semicolon_List;
end;
if Token = Tok_Semicolon then
Scan; -- past semicolon
-- If we have RETURN or IS after the semicolon, then assume
-- that semicolon should have been a right parenthesis and exit
if Token = Tok_Is or else Token = Tok_Return then
Error_Msg_SP ("expected "")"" in place of "";""");
exit Specification_Loop;
end if;
elsif Token = Tok_Right_Paren then
Scan; -- past right paren
exit Specification_Loop;
-- Special check for common error of using comma instead of semicolon
elsif Token = Tok_Comma then
T_Semicolon;
Scan; -- past comma
-- Special check for omitted separator
elsif Token = Tok_Identifier then
T_Semicolon;
-- If nothing sensible, skip to next semicolon or right paren
else
T_Semicolon;
Resync_Semicolon_List;
if Token = Tok_Semicolon then
Scan; -- past semicolon
else
T_Right_Paren;
exit Specification_Loop;
end if;
end if;
end loop Specification_Loop;
return Specification_List;
end P_Formal_Part;
----------------------------------
-- 6.1 Parameter Specification --
----------------------------------
-- Parsed by P_Formal_Part (6.1)
---------------
-- 6.1 Mode --
---------------
-- MODE ::= [in] | in out | out
-- There is no explicit node in the tree for the Mode. Instead the
-- In_Present and Out_Present flags are set in the parent node to
-- record the presence of keywords specifying the mode.
-- Error_Recovery: cannot raise Error_Resync
procedure P_Mode (Node : Node_Id) is
begin
if Token = Tok_In then
Scan; -- past IN
Set_In_Present (Node, True);
end if;
if Token = Tok_Out then
Scan; -- past OUT
Set_Out_Present (Node, True);
end if;
if Token = Tok_In then
Error_Msg_SC ("IN must precede OUT in parameter mode");
Scan; -- past IN
Set_In_Present (Node, True);
end if;
end P_Mode;
--------------------------
-- 6.3 Subprogram Body --
--------------------------
-- Parsed by P_Subprogram (6.1)
-----------------------------------
-- 6.4 Procedure Call Statement --
-----------------------------------
-- Parsed by P_Sequence_Of_Statements (5.1)
------------------------
-- 6.4 Function Call --
------------------------
-- Parsed by P_Call_Or_Name (4.1)
--------------------------------
-- 6.4 Actual Parameter Part --
--------------------------------
-- Parsed by P_Call_Or_Name (4.1)
--------------------------------
-- 6.4 Parameter Association --
--------------------------------
-- Parsed by P_Call_Or_Name (4.1)
------------------------------------
-- 6.4 Explicit Actual Parameter --
------------------------------------
-- Parsed by P_Call_Or_Name (4.1)
---------------------------
-- 6.5 Return Statement --
---------------------------
-- RETURN_STATEMENT ::= return [EXPRESSION];
-- The caller has checked that the initial token is RETURN
-- Error recovery: can raise Error_Resync
function P_Return_Statement return Node_Id is
Return_Node : Node_Id;
begin
Return_Node := New_Node (N_Return_Statement, Token_Ptr);
-- Sloc points to RETURN
-- Expression (Op3)
Scan; -- past RETURN
if Token /= Tok_Semicolon then
-- If no semicolon, then scan an expression, except that
-- we avoid trying to scan an expression if we are at an
-- expression terminator since in that case the best error
-- message is probably that we have a missing semicolon.
if Token not in Token_Class_Eterm then
Set_Expression (Return_Node, P_Expression_No_Right_Paren);
end if;
end if;
TF_Semicolon;
return Return_Node;
end P_Return_Statement;
end Ch6;
|
-----------------------------------------------------------------------
-- gen-model -- Model for Code Generator
-- Copyright (C) 2009, 2010, 2011, 2012, 2018, 2019, 2020 Stephane Carrez
-- Written by Stephane Carrez (Stephane.Carrez@gmail.com)
--
-- Licensed under the Apache License, Version 2.0 (the "License");
-- you may not use this file except in compliance with the License.
-- You may obtain a copy of the License at
--
-- http://www.apache.org/licenses/LICENSE-2.0
--
-- Unless required by applicable law or agreed to in writing, software
-- distributed under the License is distributed on an "AS IS" BASIS,
-- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-- See the License for the specific language governing permissions and
-- limitations under the License.
-----------------------------------------------------------------------
with Ada.Strings.Fixed;
with Ada.Strings.Maps;
with DOM.Core.Nodes;
with Gen.Utils;
package body Gen.Model is
Trim_Chars : constant Ada.Strings.Maps.Character_Set
:= Ada.Strings.Maps.To_Set (" " & ASCII.HT & ASCII.LF & ASCII.CR);
-- ------------------------------
-- Get the object unique name.
-- ------------------------------
function Get_Name (From : in Definition) return String is
begin
return Ada.Strings.Unbounded.To_String (From.Def_Name);
end Get_Name;
function Name (From : in Definition) return Ada.Strings.Unbounded.Unbounded_String is
begin
return From.Def_Name;
end Name;
-- ------------------------------
-- Set the object unique name.
-- ------------------------------
procedure Set_Name (Def : in out Definition;
Name : in String) is
begin
Def.Def_Name := Ada.Strings.Unbounded.To_Unbounded_String (Name);
end Set_Name;
procedure Set_Name (Def : in out Definition;
Name : in Ada.Strings.Unbounded.Unbounded_String) is
begin
Def.Def_Name := Name;
end Set_Name;
-- ------------------------------
-- Get the value identified by the name.
-- If the name cannot be found, the method should return the Null object.
-- ------------------------------
function Get_Value (From : in Definition;
Name : in String) return Util.Beans.Objects.Object is
begin
if Name = "comment" then
return From.Comment;
elsif Name = "rowIndex" then
return Util.Beans.Objects.To_Object (From.Row_Index);
elsif Name = "name" then
return Util.Beans.Objects.To_Object (From.Def_Name);
else
return From.Attrs.Get_Value (Name);
end if;
end Get_Value;
-- ------------------------------
-- Get the value identified by the name.
-- If the name cannot be found, the method should return the Null object.
-- ------------------------------
function Get_Attribute (From : in Definition;
Name : in String) return String is
V : constant Util.Beans.Objects.Object := From.Get_Value (Name);
begin
return Util.Beans.Objects.To_String (V);
end Get_Attribute;
-- ------------------------------
-- Get the value identified by the name.
-- If the name cannot be found, the method should return the Null object.
-- ------------------------------
function Get_Attribute (From : in Definition;
Name : in String) return Ada.Strings.Unbounded.Unbounded_String is
begin
return Ada.Strings.Unbounded.To_Unbounded_String (From.Get_Attribute (Name));
end Get_Attribute;
-- ------------------------------
-- Set the comment associated with the element.
-- ------------------------------
procedure Set_Comment (Def : in out Definition;
Comment : in String) is
Trimmed_Comment : constant String
:= Ada.Strings.Fixed.Trim (Comment, Trim_Chars, Trim_Chars);
begin
Def.Comment := Util.Beans.Objects.To_Object (Trimmed_Comment);
end Set_Comment;
-- ------------------------------
-- Get the comment associated with the element.
-- ------------------------------
function Get_Comment (Def : in Definition) return Util.Beans.Objects.Object is
begin
return Def.Comment;
end Get_Comment;
-- ------------------------------
-- Set the location (file and line) where the model element is defined in the XMI file.
-- ------------------------------
procedure Set_Location (Node : in out Definition;
Location : in String) is
begin
Node.Location := Ada.Strings.Unbounded.To_Unbounded_String (Location);
end Set_Location;
-- ------------------------------
-- Get the location file and line where the model element is defined.
-- ------------------------------
function Get_Location (Node : in Definition) return String is
begin
return Ada.Strings.Unbounded.To_String (Node.Location);
end Get_Location;
-- ------------------------------
-- Initialize the definition from the DOM node attributes.
-- ------------------------------
procedure Initialize (Def : in out Definition;
Name : in Ada.Strings.Unbounded.Unbounded_String;
Node : in DOM.Core.Node) is
use type DOM.Core.Node;
Attrs : constant DOM.Core.Named_Node_Map := DOM.Core.Nodes.Attributes (Node);
begin
Def.Def_Name := Name;
Def.Comment := Util.Beans.Objects.To_Object (Gen.Utils.Get_Comment (Node));
for I in 0 .. DOM.Core.Nodes.Length (Attrs) loop
declare
A : constant DOM.Core.Node := DOM.Core.Nodes.Item (Attrs, I);
begin
if A /= null then
declare
Name : constant DOM.Core.DOM_String := DOM.Core.Nodes.Node_Name (A);
Value : constant DOM.Core.DOM_String := DOM.Core.Nodes.Node_Value (A);
begin
Def.Attrs.Include (Name, Util.Beans.Objects.To_Object (Value));
end;
end if;
end;
end loop;
end Initialize;
-- ------------------------------
-- Validate the definition by checking and reporting problems to the logger interface.
-- ------------------------------
procedure Validate (Def : in out Definition;
Log : in out Util.Log.Logging'Class) is
begin
if Ada.Strings.Unbounded.Length (Def.Def_Name) = 0 then
Log.Error (Def.Get_Location & ": name is empty");
end if;
end Validate;
procedure Set_Index (Def : in out Definition;
Index : in Natural) is
begin
Def.Row_Index := Index;
end Set_Index;
end Gen.Model;
|
-----------------------------------------------------------------------
-- awa-components-wikis -- Wiki rendering component
-- Copyright (C) 2011, 2015, 2016 Stephane Carrez
-- Written by Stephane Carrez (Stephane.Carrez@gmail.com)
--
-- Licensed under the Apache License, Version 2.0 (the "License");
-- you may not use this file except in compliance with the License.
-- You may obtain a copy of the License at
--
-- http://www.apache.org/licenses/LICENSE-2.0
--
-- Unless required by applicable law or agreed to in writing, software
-- distributed under the License is distributed on an "AS IS" BASIS,
-- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-- See the License for the specific language governing permissions and
-- limitations under the License.
-----------------------------------------------------------------------
with Ada.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, google, creole, phpbb, mediawiki
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";
-- ------------------------------
-- 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;
-- 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;
|
-----------------------------------------------------------------------
-- util-beans-basic-ranges -- Range of values with helper for list iteration
-- Copyright (C) 2011 Stephane Carrez
-- Written by Stephane Carrez (Stephane.Carrez@gmail.com)
--
-- Licensed under the Apache License, Version 2.0 (the "License");
-- you may not use this file except in compliance with the License.
-- You may obtain a copy of the License at
--
-- http://www.apache.org/licenses/LICENSE-2.0
--
-- Unless required by applicable law or agreed to in writing, software
-- distributed under the License is distributed on an "AS IS" BASIS,
-- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-- See the License for the specific language governing permissions and
-- limitations under the License.
-----------------------------------------------------------------------
package body Util.Beans.Basic.Ranges is
-- ------------------------------
-- Create a range definition.
-- ------------------------------
function Create (First, Last : in T) return Range_Bean is
Result : Range_Bean;
begin
Result.First := First;
Result.Last := Last;
Result.Current := First;
return Result;
end Create;
-- ------------------------------
-- Get the range lower bound.
-- ------------------------------
function Get_First (From : in Range_Bean) return T is
begin
return From.First;
end Get_First;
-- ------------------------------
-- Get the range upper bound.
-- ------------------------------
function Get_Last (From : in Range_Bean) return T is
begin
return From.Last;
end Get_Last;
-- ------------------------------
-- Get the current value within the first/last bounds.
-- ------------------------------
function Get_Current (From : in Range_Bean) return T is
begin
return From.Current;
end Get_Current;
-- ------------------------------
-- Get the value identified by the name.
-- If the name cannot be found, the method should return the Null object.
-- ------------------------------
overriding
function Get_Value (From : in Range_Bean;
Name : in String) return Util.Beans.Objects.Object is
begin
if Name = "first" then
return To_Object (From.First);
elsif Name = "last" then
return To_Object (From.Last);
elsif Name = "value" then
return To_Object (From.Current);
else
return Util.Beans.Objects.Null_Object;
end if;
end Get_Value;
-- ------------------------------
-- Get the number of elements in the list.
-- ------------------------------
overriding
function Get_Count (From : in Range_Bean) return Natural is
begin
if From.Last < From.First then
return 0;
else
return Natural (T'Pos (From.Last) - T'Pos (From.First)) + 1;
end if;
end Get_Count;
-- ------------------------------
-- Set the current row index. Valid row indexes start at 1.
-- ------------------------------
overriding
procedure Set_Row_Index (From : in out Range_Bean;
Index : in Natural) is
begin
From.Current := T'Val (T'Pos (From.First) + Index - 1);
end Set_Row_Index;
-- ------------------------------
-- Get the element at the current row index.
-- ------------------------------
overriding
function Get_Row (From : in Range_Bean) return Util.Beans.Objects.Object is
begin
return To_Object (From.Current);
end Get_Row;
end Util.Beans.Basic.Ranges;
|
-- This package has been generated automatically by GNATtest.
-- You are allowed to add your code to the bodies of test routines.
-- Such changes will be kept during further regeneration of this file.
-- All code placed outside of test routine bodies will be lost. The
-- code intended to set up and tear down the test environment should be
-- placed into Tk.Image.Bitmap.Test_Data.
with AUnit.Assertions; use AUnit.Assertions;
with System.Assertions;
-- begin read only
-- id:2.2/00/
--
-- This section can be used to add with clauses if necessary.
--
-- end read only
with Ada.Environment_Variables; use Ada.Environment_Variables;
-- begin read only
-- end read only
package body Tk.Image.Bitmap.Test_Data.Tests is
-- begin read only
-- id:2.2/01/
--
-- This section can be used to add global variables and other elements.
--
-- end read only
-- begin read only
-- end read only
-- begin read only
function Wrap_Test_Get_Option_e3d52c_aaa578
(Bitmap_Image: Tk_Image; Name: String;
Interpreter: Tcl_Interpreter := Get_Interpreter) return String is
begin
begin
pragma Assert
(Bitmap_Image'Length > 0 and Name'Length > 0 and
Interpreter /= Null_Interpreter);
null;
exception
when System.Assertions.Assert_Failure =>
AUnit.Assertions.Assert
(False,
"req_sloc(tk-image-bitmap.ads:0):Tests_Get_Option_Bitmap test requirement violated");
end;
declare
Test_Get_Option_e3d52c_aaa578_Result: constant String :=
GNATtest_Generated.GNATtest_Standard.Tk.Image.Bitmap.Get_Option
(Bitmap_Image, Name, Interpreter);
begin
begin
pragma Assert(True);
null;
exception
when System.Assertions.Assert_Failure =>
AUnit.Assertions.Assert
(False,
"ens_sloc(tk-image-bitmap.ads:0:):Tests_Get_Option_Bitmap test commitment violated");
end;
return Test_Get_Option_e3d52c_aaa578_Result;
end;
end Wrap_Test_Get_Option_e3d52c_aaa578;
-- end read only
-- begin read only
procedure Test_Get_Option_tests_get_option_bitmap(Gnattest_T: in out Test);
procedure Test_Get_Option_e3d52c_aaa578(Gnattest_T: in out Test) renames
Test_Get_Option_tests_get_option_bitmap;
-- id:2.2/e3d52c2e49e4f170/Get_Option/1/0/tests_get_option_bitmap/
procedure Test_Get_Option_tests_get_option_bitmap
(Gnattest_T: in out Test) is
function Get_Option
(Bitmap_Image: Tk_Image; Name: String;
Interpreter: Tcl_Interpreter := Get_Interpreter) return String renames
Wrap_Test_Get_Option_e3d52c_aaa578;
-- end read only
pragma Unreferenced(Gnattest_T);
begin
if Value("DISPLAY", "")'Length = 0 then
Assert(True, "No display, can't test");
return;
end if;
Assert
(Get_Option("mybitmap", "background") = "black",
"Failed to get option of the selected image");
-- begin read only
end Test_Get_Option_tests_get_option_bitmap;
-- end read only
-- begin read only
-- id:2.2/02/
--
-- This section can be used to add elaboration code for the global state.
--
begin
-- end read only
null;
-- begin read only
-- end read only
end Tk.Image.Bitmap.Test_Data.Tests;
|
-- nymph_test_client.ada - Test client application using the NymphRPC library.
-- Revision 0
-- Features:
-
-- Notes:
-
-- 2019/04/04, Maya Posch : Initial version.
-- (c) Nyanko.ws
with Ada.Text_IO;
use Ada.Text_IO;
with NymphRemoteServer;
procedure logFunction(level: in integer, text: in string)
begin
--
put_line(level'Image & " - " & text);
end logFunction;
procedure Main is
begin
-- Just connect to the remote server and disconnect afterwards.
Integer timeout = 5000;
string result;
if NymphRemoteServer.connect() not true then
put_line("Connecting to remote server failed: " & result);
NymphRemoteServer.disconnect(handle, result);
NymphRemoteServer.shutdown();
return;
end if;
-- Send message and wait for response.
-- TODO:
-- Shutdown.
NymphRemoteServer.disconnect(handle, result);
NymphRemoteServer.shutdown();
end Main;
|
-- { dg-do run }
-- { dg-options "-gnatws" }
procedure Discr44 is
function Ident (I : Integer) return Integer is
begin
return I;
end;
type Int is range 1 .. 10;
type Str is array (Int range <>) of Character;
type Parent (D1, D2 : Int; B : Boolean) is record
S : Str (D1 .. D2);
end record;
type Derived (D : Int) is new Parent (D1 => D, D2 => D, B => False);
X1 : Derived (D => Int (Ident (7)));
begin
if X1.D /= 7 then
raise Program_Error;
end if;
end;
|
-- { dg-do compile }
-- { dg-options "-gnatws" }
procedure Rep_Clause3 is
subtype U_16 is integer range 0..2**16-1;
type TYPE1 is range 0 .. 135;
for TYPE1'size use 14;
type TYPE2 is range 0 .. 262_143;
for TYPE2'size use 18;
subtype TYPE3 is integer range 1 .. 21*6;
type ARR is array (TYPE3 range <>) of boolean;
pragma Pack(ARR);
subtype SUB_ARR is ARR(1 .. 5*6);
OBJ : SUB_ARR;
type R is
record
N : TYPE1;
L : TYPE2;
I : SUB_ARR;
CRC : U_16;
end record;
for R use
record at mod 4;
N at 0 range 0 .. 13;
L at 0 range 14 .. 31;
I at 4 range 2 .. 37;
CRC at 8 range 16 .. 31;
end record;
for R'size use 12*8;
type SUB_R is array (1..4) of R;
T : SUB_R;
begin
if OBJ = T(1).I then
raise Program_Error;
end if;
end;
|
------------------------------------------------------------------------------
-- --
-- GNAT RUN-TIME COMPONENTS --
-- --
-- G N A T . T H R E A D S --
-- --
-- B o d y --
-- --
-- Copyright (C) 1998-2005 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 2, or (at your option) any later ver- --
-- sion. GNAT is distributed in the hope that it will be useful, but WITH- --
-- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY --
-- or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License --
-- for more details. You should have received a copy of the GNU General --
-- Public License distributed with GNAT; see file COPYING. If not, write --
-- to the Free Software Foundation, 51 Franklin Street, Fifth Floor, --
-- Boston, MA 02110-1301, USA. --
-- --
-- As a special exception, if other files instantiate generics from this --
-- unit, or you link this unit with other files to produce an executable, --
-- this unit does not by itself cause the resulting executable to be --
-- covered by the GNU General Public License. This exception does not --
-- however invalidate any other reasons why the executable file might be --
-- covered by the GNU Public License. --
-- --
-- GNAT was originally developed by the GNAT team at New York University. --
-- Extensive contributions were provided by Ada Core Technologies Inc. --
-- --
------------------------------------------------------------------------------
with Ada.Task_Identification; use Ada.Task_Identification;
with System.Task_Primitives.Operations;
with System.Tasking;
with System.Tasking.Stages; use System.Tasking.Stages;
with System.OS_Interface; use System.OS_Interface;
with System.Soft_Links; use System.Soft_Links;
with Unchecked_Conversion;
package body GNAT.Threads is
use System;
package STPO renames System.Task_Primitives.Operations;
type Thread_Id_Ptr is access all Thread_Id;
pragma Warnings (Off);
-- The following unchecked conversions are aliasing safe, since they
-- are never used to create pointers to improperly aliased data.
function To_Addr is new Unchecked_Conversion (Task_Id, Address);
function To_Id is new Unchecked_Conversion (Address, Task_Id);
function To_Id is new Unchecked_Conversion (Address, Tasking.Task_Id);
function To_Tid is new Unchecked_Conversion
(Address, Ada.Task_Identification.Task_Id);
function To_Thread is new Unchecked_Conversion (Address, Thread_Id_Ptr);
pragma Warnings (On);
type Code_Proc is access procedure (Id : Address; Parm : Void_Ptr);
task type Thread
(Stsz : Natural;
Prio : Any_Priority;
Parm : Void_Ptr;
Code : Code_Proc)
is
pragma Priority (Prio);
pragma Storage_Size (Stsz);
end Thread;
task body Thread is
begin
Code.all (To_Addr (Current_Task), Parm);
end Thread;
type Tptr is access Thread;
-------------------
-- Create_Thread --
-------------------
function Create_Thread
(Code : Address;
Parm : Void_Ptr;
Size : Natural;
Prio : Integer) return System.Address
is
TP : Tptr;
function To_CP is new Unchecked_Conversion (Address, Code_Proc);
begin
TP := new Thread (Size, Prio, Parm, To_CP (Code));
return To_Addr (TP'Identity);
end Create_Thread;
---------------------
-- Register_Thread --
---------------------
function Register_Thread return System.Address is
begin
return Task_Primitives.Operations.Register_Foreign_Thread.all'Address;
end Register_Thread;
-----------------------
-- Unregister_Thread --
-----------------------
procedure Unregister_Thread is
Self_Id : constant Tasking.Task_Id := Task_Primitives.Operations.Self;
begin
Self_Id.Common.State := Tasking.Terminated;
Destroy_TSD (Self_Id.Common.Compiler_Data);
Free_Task (Self_Id);
end Unregister_Thread;
--------------------------
-- Unregister_Thread_Id --
--------------------------
procedure Unregister_Thread_Id (Thread : System.Address) is
Thr : constant Thread_Id := To_Thread (Thread).all;
T : Tasking.Task_Id;
use type Tasking.Task_Id;
begin
STPO.Lock_RTS;
T := Tasking.All_Tasks_List;
loop
exit when T = null or else STPO.Get_Thread_Id (T) = Thr;
T := T.Common.All_Tasks_Link;
end loop;
STPO.Unlock_RTS;
if T /= null then
T.Common.State := Tasking.Terminated;
Destroy_TSD (T.Common.Compiler_Data);
Free_Task (T);
end if;
end Unregister_Thread_Id;
--------------------
-- Destroy_Thread --
--------------------
procedure Destroy_Thread (Id : Address) is
Tid : constant Task_Id := To_Id (Id);
begin
Abort_Task (Tid);
end Destroy_Thread;
----------------
-- Get_Thread --
----------------
procedure Get_Thread (Id : Address; Thread : Address) is
Thr : constant Thread_Id_Ptr := To_Thread (Thread);
begin
Thr.all := Task_Primitives.Operations.Get_Thread_Id (To_Id (Id));
end Get_Thread;
----------------
-- To_Task_Id --
----------------
function To_Task_Id
(Id : System.Address) return Ada.Task_Identification.Task_Id
is
begin
return To_Tid (Id);
end To_Task_Id;
end GNAT.Threads;
|
with
float_Math;
package box2d_Physics
--
-- Provides an implementation of the physics interface using a binding to the Box2D C library.
--
is
pragma Pure;
package Math renames float_Math;
Error : exception;
end box2d_Physics;
|
------------------------------------------------------------------------------
-- --
-- GNAT LIBRARY COMPONENTS --
-- --
-- ADA.CONTAINERS.FUNCTIONAL_VECTORS --
-- --
-- S p e c --
-- --
-- Copyright (C) 2016-2020, Free Software Foundation, Inc. --
-- --
-- This specification is derived from the Ada Reference Manual for use with --
-- GNAT. The copyright notice above, and the license provisions that follow --
-- apply solely to the contents of the part following the private keyword. --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
-- ware Foundation; either version 3, or (at your option) any later ver- --
-- sion. GNAT is distributed in the hope that it will be useful, but WITH- --
-- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY --
-- or FITNESS FOR A PARTICULAR PURPOSE. --
-- --
-- As a special exception under Section 7 of GPL version 3, you are granted --
-- additional permissions described in the GCC Runtime Library Exception, --
-- version 3.1, as published by the Free Software Foundation. --
-- --
-- You should have received a copy of the GNU General Public License and --
-- a copy of the GCC Runtime Library Exception along with this program; --
-- see the files COPYING3 and COPYING.RUNTIME respectively. If not, see --
-- <http://www.gnu.org/licenses/>. --
------------------------------------------------------------------------------
pragma Ada_2012;
private with Ada.Containers.Functional_Base;
generic
type Index_Type is (<>);
-- To avoid Constraint_Error being raised at run time, Index_Type'Base
-- should have at least one more element at the low end than Index_Type.
type Element_Type (<>) is private;
with function "=" (Left, Right : Element_Type) return Boolean is <>;
package Ada.Containers.Functional_Vectors with SPARK_Mode is
subtype Extended_Index is Index_Type'Base range
Index_Type'Pred (Index_Type'First) .. Index_Type'Last;
-- Index_Type with one more element at the low end of the range.
-- This type is never used but it forces GNATprove to check that there is
-- room for one more element at the low end of Index_Type.
type Sequence is private
with Default_Initial_Condition => Length (Sequence) = 0,
Iterable => (First => Iter_First,
Has_Element => Iter_Has_Element,
Next => Iter_Next,
Element => Get);
-- Sequences are empty when default initialized.
-- Quantification over sequences can be done using the regular
-- quantification over its range or directly on its elements with "for of".
-----------------------
-- Basic operations --
-----------------------
-- Sequences are axiomatized using Length and Get, providing respectively
-- the length of a sequence and an accessor to its Nth element:
function Length (Container : Sequence) return Count_Type with
-- Length of a sequence
Global => null,
Post =>
(Index_Type'Pos (Index_Type'First) - 1) + Length'Result <=
Index_Type'Pos (Index_Type'Last);
function Get
(Container : Sequence;
Position : Extended_Index) return Element_Type
-- Access the Element at position Position in Container
with
Global => null,
Pre => Position in Index_Type'First .. Last (Container);
function Last (Container : Sequence) return Extended_Index with
-- Last index of a sequence
Global => null,
Post =>
Last'Result =
Index_Type'Val ((Index_Type'Pos (Index_Type'First) - 1) +
Length (Container));
pragma Annotate (GNATprove, Inline_For_Proof, Last);
function First return Extended_Index is (Index_Type'First) with
Global => null;
-- First index of a sequence
------------------------
-- Property Functions --
------------------------
function "=" (Left : Sequence; Right : Sequence) return Boolean with
-- Extensional equality over sequences
Global => null,
Post =>
"="'Result =
(Length (Left) = Length (Right)
and then (for all N in Index_Type'First .. Last (Left) =>
Get (Left, N) = Get (Right, N)));
pragma Annotate (GNATprove, Inline_For_Proof, "=");
function "<" (Left : Sequence; Right : Sequence) return Boolean with
-- Left is a strict subsequence of Right
Global => null,
Post =>
"<"'Result =
(Length (Left) < Length (Right)
and then (for all N in Index_Type'First .. Last (Left) =>
Get (Left, N) = Get (Right, N)));
pragma Annotate (GNATprove, Inline_For_Proof, "<");
function "<=" (Left : Sequence; Right : Sequence) return Boolean with
-- Left is a subsequence of Right
Global => null,
Post =>
"<="'Result =
(Length (Left) <= Length (Right)
and then (for all N in Index_Type'First .. Last (Left) =>
Get (Left, N) = Get (Right, N)));
pragma Annotate (GNATprove, Inline_For_Proof, "<=");
function Contains
(Container : Sequence;
Fst : Index_Type;
Lst : Extended_Index;
Item : Element_Type) return Boolean
-- Returns True if Item occurs in the range from Fst to Lst of Container
with
Global => null,
Pre => Lst <= Last (Container),
Post =>
Contains'Result =
(for some I in Fst .. Lst => Get (Container, I) = Item);
pragma Annotate (GNATprove, Inline_For_Proof, Contains);
function Constant_Range
(Container : Sequence;
Fst : Index_Type;
Lst : Extended_Index;
Item : Element_Type) return Boolean
-- Returns True if every element of the range from Fst to Lst of Container
-- is equal to Item.
with
Global => null,
Pre => Lst <= Last (Container),
Post =>
Constant_Range'Result =
(for all I in Fst .. Lst => Get (Container, I) = Item);
pragma Annotate (GNATprove, Inline_For_Proof, Constant_Range);
function Equal_Except
(Left : Sequence;
Right : Sequence;
Position : Index_Type) return Boolean
-- Returns True is Left and Right are the same except at position Position
with
Global => null,
Pre => Position <= Last (Left),
Post =>
Equal_Except'Result =
(Length (Left) = Length (Right)
and then (for all I in Index_Type'First .. Last (Left) =>
(if I /= Position then Get (Left, I) = Get (Right, I))));
pragma Annotate (GNATprove, Inline_For_Proof, Equal_Except);
function Equal_Except
(Left : Sequence;
Right : Sequence;
X : Index_Type;
Y : Index_Type) return Boolean
-- Returns True is Left and Right are the same except at positions X and Y
with
Global => null,
Pre => X <= Last (Left) and Y <= Last (Left),
Post =>
Equal_Except'Result =
(Length (Left) = Length (Right)
and then (for all I in Index_Type'First .. Last (Left) =>
(if I /= X and I /= Y then
Get (Left, I) = Get (Right, I))));
pragma Annotate (GNATprove, Inline_For_Proof, Equal_Except);
function Range_Equal
(Left : Sequence;
Right : Sequence;
Fst : Index_Type;
Lst : Extended_Index) return Boolean
-- Returns True if the ranges from Fst to Lst contain the same elements in
-- Left and Right.
with
Global => null,
Pre => Lst <= Last (Left) and Lst <= Last (Right),
Post =>
Range_Equal'Result =
(for all I in Fst .. Lst => Get (Left, I) = Get (Right, I));
pragma Annotate (GNATprove, Inline_For_Proof, Range_Equal);
function Range_Shifted
(Left : Sequence;
Right : Sequence;
Fst : Index_Type;
Lst : Extended_Index;
Offset : Count_Type'Base) return Boolean
-- Returns True if the range from Fst to Lst in Left contains the same
-- elements as the range from Fst + Offset to Lst + Offset in Right.
with
Global => null,
Pre =>
Lst <= Last (Left)
and then
(if Offset < 0 then
Index_Type'Pos (Index_Type'Base'First) - Offset <=
Index_Type'Pos (Index_Type'First))
and then
(if Fst <= Lst then
Offset in
Index_Type'Pos (Index_Type'First) - Index_Type'Pos (Fst) ..
(Index_Type'Pos (Index_Type'First) - 1) + Length (Right) -
Index_Type'Pos (Lst)),
Post =>
Range_Shifted'Result =
((for all I in Fst .. Lst =>
Get (Left, I) =
Get (Right, Index_Type'Val (Index_Type'Pos (I) + Offset)))
and
(for all I in Index_Type'Val (Index_Type'Pos (Fst) + Offset) ..
Index_Type'Val (Index_Type'Pos (Lst) + Offset)
=>
Get (Left, Index_Type'Val (Index_Type'Pos (I) - Offset)) =
Get (Right, I)));
pragma Annotate (GNATprove, Inline_For_Proof, Range_Shifted);
----------------------------
-- Construction Functions --
----------------------------
-- For better efficiency of both proofs and execution, avoid using
-- construction functions in annotations and rather use property functions.
function Set
(Container : Sequence;
Position : Index_Type;
New_Item : Element_Type) return Sequence
-- Returns a new sequence which contains the same elements as Container
-- except for the one at position Position which is replaced by New_Item.
with
Global => null,
Pre => Position in Index_Type'First .. Last (Container),
Post =>
Get (Set'Result, Position) = New_Item
and then Equal_Except (Container, Set'Result, Position);
function Add (Container : Sequence; New_Item : Element_Type) return Sequence
-- Returns a new sequence which contains the same elements as Container
-- plus New_Item at the end.
with
Global => null,
Pre =>
Length (Container) < Count_Type'Last
and then Last (Container) < Index_Type'Last,
Post =>
Length (Add'Result) = Length (Container) + 1
and then Get (Add'Result, Last (Add'Result)) = New_Item
and then Container <= Add'Result;
function Add
(Container : Sequence;
Position : Index_Type;
New_Item : Element_Type) return Sequence
with
-- Returns a new sequence which contains the same elements as Container
-- except that New_Item has been inserted at position Position.
Global => null,
Pre =>
Length (Container) < Count_Type'Last
and then Last (Container) < Index_Type'Last
and then Position <= Extended_Index'Succ (Last (Container)),
Post =>
Length (Add'Result) = Length (Container) + 1
and then Get (Add'Result, Position) = New_Item
and then Range_Equal
(Left => Container,
Right => Add'Result,
Fst => Index_Type'First,
Lst => Index_Type'Pred (Position))
and then Range_Shifted
(Left => Container,
Right => Add'Result,
Fst => Position,
Lst => Last (Container),
Offset => 1);
function Remove
(Container : Sequence;
Position : Index_Type) return Sequence
-- Returns a new sequence which contains the same elements as Container
-- except that the element at position Position has been removed.
with
Global => null,
Pre => Position in Index_Type'First .. Last (Container),
Post =>
Length (Remove'Result) = Length (Container) - 1
and then Range_Equal
(Left => Container,
Right => Remove'Result,
Fst => Index_Type'First,
Lst => Index_Type'Pred (Position))
and then Range_Shifted
(Left => Remove'Result,
Right => Container,
Fst => Position,
Lst => Last (Remove'Result),
Offset => 1);
---------------------------
-- Iteration Primitives --
---------------------------
function Iter_First (Container : Sequence) return Extended_Index with
Global => null;
function Iter_Has_Element
(Container : Sequence;
Position : Extended_Index) return Boolean
with
Global => null,
Post =>
Iter_Has_Element'Result =
(Position in Index_Type'First .. Last (Container));
pragma Annotate (GNATprove, Inline_For_Proof, Iter_Has_Element);
function Iter_Next
(Container : Sequence;
Position : Extended_Index) return Extended_Index
with
Global => null,
Pre => Iter_Has_Element (Container, Position);
private
pragma SPARK_Mode (Off);
package Containers is new Ada.Containers.Functional_Base
(Index_Type => Index_Type,
Element_Type => Element_Type);
type Sequence is record
Content : Containers.Container;
end record;
function Iter_First (Container : Sequence) return Extended_Index is
(Index_Type'First);
function Iter_Next
(Container : Sequence;
Position : Extended_Index) return Extended_Index
is
(if Position = Extended_Index'Last then
Extended_Index'First
else
Extended_Index'Succ (Position));
function Iter_Has_Element
(Container : Sequence;
Position : Extended_Index) return Boolean
is
(Position in Index_Type'First ..
(Index_Type'Val
((Index_Type'Pos (Index_Type'First) - 1) + Length (Container))));
end Ada.Containers.Functional_Vectors;
|
-- Copyright (c) 2019 Maxim Reznik <reznikmm@gmail.com>
--
-- SPDX-License-Identifier: MIT
-- License-Filename: LICENSE
-------------------------------------------------------------
with Slim.Message_Visiters;
package body Slim.Messages.grfb is
List : constant Field_Description_Array :=
(1 => (Uint_16_Field, 1)); -- Brightness
----------
-- Read --
----------
overriding function Read
(Data : not null access
League.Stream_Element_Vectors.Stream_Element_Vector)
return Grfb_Message is
begin
return Result : Grfb_Message do
Read_Fields (Result, List, Data.all);
end return;
end Read;
--------------------
-- Set_Brightness --
--------------------
not overriding procedure Set_Brightness
(Self : in out Grfb_Message;
Value : Natural) is
begin
Self.Data_16 (1) := Interfaces.Unsigned_16 (Value);
end Set_Brightness;
-----------
-- Visit --
-----------
overriding procedure Visit
(Self : not null access Grfb_Message;
Visiter : in out Slim.Message_Visiters.Visiter'Class) is
begin
Visiter.grfb (Self);
end Visit;
-----------
-- Write --
-----------
overriding procedure Write
(Self : Grfb_Message;
Tag : out Message_Tag;
Data : out League.Stream_Element_Vectors.Stream_Element_Vector) is
begin
Tag := "grfb";
Write_Fields (Self, List, Data);
end Write;
end Slim.Messages.grfb;
|
-- { dg-do compile }
package Integer_Value is
X : constant Integer :=
Integer'Integer_Value (12.8); -- { dg-error "fixed-point type" "" }
end Integer_Value;
|
-- { dg-do compile }
-- { dg-options "-w" }
package body Vect10 is
procedure Add_Mul (X : in out Unit; Y, Z : in Unit) is
begin
X := X + Y * Z;
end;
pragma Inline_Always (Add_Mul);
procedure Proc
(F : in Rec_Vector;
First_Index : in Natural;
Last_Index : in Natural;
Result : out Unit)
is
begin
Result := (others => 0.0);
for I in First_Index + 1 .. Last_Index loop
declare
Local : Rec renames F (I);
begin
Add_Mul (Result, Local.Val, Local.Val);
end;
end loop;
end;
end Vect10;
|
-----------------------------------------------------------------------
-- search-indexers-databases -- Search engine indexer
-- Copyright (C) 2020 Stephane Carrez
-- Written by Stephane Carrez (Stephane.Carrez@gmail.com)
--
-- Licensed under the Apache License, Version 2.0 (the "License");
-- you may not use this file except in compliance with the License.
-- You may obtain a copy of the License at
--
-- http://www.apache.org/licenses/LICENSE-2.0
--
-- Unless required by applicable law or agreed to in writing, software
-- distributed under the License is distributed on an "AS IS" BASIS,
-- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-- See the License for the specific language governing permissions and
-- limitations under the License.
-----------------------------------------------------------------------
with Search.Fields;
with Search.Tokens;
with Search.Tokenizers;
with Search.Documents;
with Search.Analyzers;
with ADO.Sessions;
private with Search.Positions;
private with Search.Tokens.Factories.Default;
private with Search.Models;
private with Search.Tokens.Compare;
private with Ada.Containers.Hashed_Maps;
private with Generic_Indefinite_B_Tree;
private with Persistent.Memory_Pools.Streams.Generic_External_B_Tree;
private with Persistent.Blocking_Files.Transactional.Dump;
private with Persistent.Memory_Pools.Dump;
package Search.Indexers.Databases is
type Indexer_Type is limited new Search.Indexers.Indexer_Type with private;
-- Initialize the indexer.
procedure Initialize (Indexer : in out Indexer_Type;
Session : in out ADO.Sessions.Master_Session;
Ident : in ADO.Identifier);
-- Add the field in the index. The field content is not tokenized.
procedure Add_Field (Indexer : in out Indexer_Type;
Document : in out Search.Documents.Document_Type'Class;
Field : in Search.Fields.Field_Type);
-- Add the document in the index by storing and indexing all indexable fields.
procedure Add_Document (Indexer : in out Indexer_Type;
Document : in out Search.Documents.Document_Type'Class;
Analyzer : in out Search.Analyzers.Analyzer_Type'Class;
Tokenizer : in out Search.Tokenizers.Tokenizer_Type'Class);
overriding
procedure Add_Field (Indexer : in out Indexer_Type;
Document : in out Search.Documents.Document_Type'Class;
Field : in Search.Fields.Field_Type;
Analyzer : in out Search.Analyzers.Analyzer_Type'Class;
Tokenizer : in out Search.Tokenizers.Tokenizer_Type'Class);
procedure Add_Token (Indexer : in out Indexer_Type;
Document : in out Search.Documents.Document_Type'Class;
Field : in Search.Fields.Field_Type;
Token : in String);
private
use ADO;
type Position_Access is access all Search.Positions.Position_Type;
package Persistent_Fields is
new Persistent.Memory_Pools.Streams.Generic_External_B_Tree
(String, Search.Positions.Position_Type,
String'Input, Search.Positions.Read,
String'Output, Search.Positions.Write);
package Field_Maps is
new Ada.Containers.Hashed_Maps (Key_Type => Search.Fields.Field_Type,
Element_Type => ADO.Identifier,
Hash => Search.Fields.Hash,
Equivalent_Keys => Search.Fields."=");
package Position_Maps is
new Ada.Containers.Hashed_Maps (Key_Type => Search.Tokens.Token_Type,
Element_Type => Position_Access,
Hash => Search.Tokens.Compare.Hash,
Equivalent_Keys => Search.Tokens.Compare."=");
protected type Field_Map is
procedure Insert (Field : in Search.Fields.Field_Type;
Id : in ADO.Identifier);
function Find (Field : in Search.Fields.Field_Type) return ADO.Identifier;
private
Fields : Field_Maps.Map;
end Field_Map;
package Token_Maps is
new Ada.Containers.Hashed_Maps (Key_Type => Search.Tokens.Token_Type,
Element_Type => ADO.Identifier,
Hash => Search.Tokens.Compare.Hash,
Equivalent_Keys => Search.Tokens.Compare."=");
protected type Token_Map is
procedure Insert (Token : in Search.Tokens.Token_Type;
Id : in ADO.Identifier);
function Find (Token : in Search.Tokens.Token_Type) return ADO.Identifier;
procedure Create (Value : in String;
Token : out Search.Tokens.Token_Type);
private
Tokens : Token_Maps.Map;
Factory : Search.Tokens.Factories.Default.Token_Factory;
end Token_Map;
type Indexer_Type is limited new Search.Indexers.Indexer_Type with record
DB : aliased Persistent.Blocking_Files.Transactional.Persistent_Transactional_Array;
Session : ADO.Sessions.Master_Session;
Index : Search.Models.Index_Ref;
Fields : Field_Map;
Tokens : Token_Map;
Positions : Position_Maps.Map;
Document : Search.Models.Document_Ref;
Position : Natural := 0;
end record;
end Search.Indexers.Databases;
|
-- Copyright (c) 2019 Maxim Reznik <reznikmm@gmail.com>
--
-- SPDX-License-Identifier: MIT
-- License-Filename: LICENSE
-------------------------------------------------------------
with Ada.Wide_Wide_Text_IO;
with League.String_Vectors;
package body Meta.Read is
function To_Name (Text : League.Strings.Universal_String)
return League.Strings.Universal_String;
--------------
-- Read_AST --
--------------
procedure Read_AST
(File_Name : League.Strings.Universal_String;
Result : out Class_Vectors.Vector)
is
Input : Ada.Wide_Wide_Text_IO.File_Type;
Class : Meta.Classes.Class;
begin
Class.Initialize (League.Strings.Empty_Universal_String);
Ada.Wide_Wide_Text_IO.Open
(Input,
Ada.Wide_Wide_Text_IO.In_File,
File_Name.To_UTF_8_String);
while not Ada.Wide_Wide_Text_IO.End_Of_File (Input) loop
declare
Line : constant League.Strings.Universal_String :=
League.Strings.To_Universal_String
(Ada.Wide_Wide_Text_IO.Get_Line (Input));
List : constant League.String_Vectors.Universal_String_Vector :=
Line.Split (' ', League.Strings.Skip_Empty);
begin
if Line.Starts_With ("##") then
if not Class.Name.Is_Empty then
Result.Append (Class);
end if;
Class.Initialize
(Name => To_Name (List (2)),
Is_Abstract => List.Element (2).Starts_With ("_"));
elsif Line.Starts_With ("> ") then
declare
Parents : constant
League.String_Vectors.Universal_String_Vector :=
List (2).Split (',');
begin
for J in 1 .. Parents.Length loop
Class.Add_Parent (To_Name (Parents (J)));
end loop;
end;
elsif Line.Starts_With (" - ") then
declare
Name : constant League.Strings.Universal_String := List (2);
Tipe : League.Strings.Universal_String := List (4);
Capacity : Meta.Classes.Capacity_Kind :=
Meta.Classes.Just_One;
begin
if Tipe.Ends_With ("?") then
Tipe := Tipe.Head_To (Tipe.Length - 1);
Capacity := Meta.Classes.Zero_Or_One;
elsif Tipe.Ends_With ("+") then
Tipe := Tipe.Head_To (Tipe.Length - 1);
Capacity := Meta.Classes.One_Or_More;
elsif Tipe.Ends_With ("*") then
Tipe := Tipe.Head_To (Tipe.Length - 1);
Capacity := Meta.Classes.Zero_Or_More;
end if;
Class.Add_Property
((Name => Name,
Type_Name => To_Name (Tipe),
Capacity => Capacity));
end;
end if;
end;
end loop;
Result.Append (Class);
Ada.Wide_Wide_Text_IO.Close (Input);
end Read_AST;
-------------
-- To_Name --
-------------
function To_Name (Text : League.Strings.Universal_String)
return League.Strings.Universal_String
is
Result : League.Strings.Universal_String := Text;
begin
if Result.Starts_With ("_") then
Result := Result.Tail_From (2);
end if;
if Result.Ends_With ("_") then
Result := Result.Head_To (Result.Length - 1);
end if;
if Result.Starts_With ("[") then
Result := Result.Tail_From (2);
end if;
if Result.Ends_With ("]") then
Result := Result.Head_To (Result.Length - 1);
end if;
return Result;
end To_Name;
end Meta.Read;
|
--
-- (c) Copyright 1993,1994,1995,1996 Silicon Graphics, Inc.
-- ALL RIGHTS RESERVED
-- Permission to use, copy, modify, and distribute this software for
-- any purpose and without fee is hereby granted, provided that the above
-- copyright notice appear in all copies and that both the copyright notice
-- and this permission notice appear in supporting documentation, and that
-- the name of Silicon Graphics, Inc. not be used in advertising
-- or publicity pertaining to distribution of the software without specific,
-- written prior permission.
--
-- THE MATERIAL EMBODIED ON THIS SOFTWARE IS PROVIDED TO YOU "AS-IS"
-- AND WITHOUT WARRANTY OF ANY KIND, EXPRESS, IMPLIED OR OTHERWISE,
-- INCLUDING WITHOUT LIMITATION, ANY WARRANTY OF MERCHANTABILITY OR
-- FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL SILICON
-- GRAPHICS, INC. BE LIABLE TO YOU OR ANYONE ELSE FOR ANY DIRECT,
-- SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY
-- KIND, OR ANY DAMAGES WHATSOEVER, INCLUDING WITHOUT LIMITATION,
-- LOSS OF PROFIT, LOSS OF USE, SAVINGS OR REVENUE, OR THE CLAIMS OF
-- THIRD PARTIES, WHETHER OR NOT SILICON GRAPHICS, INC. HAS BEEN
-- ADVISED OF THE POSSIBILITY OF SUCH LOSS, HOWEVER CAUSED AND ON
-- ANY THEORY OF LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE
-- POSSESSION, USE OR PERFORMANCE OF THIS SOFTWARE.
--
-- US Government Users Restricted Rights
-- Use, duplication, or disclosure by the Government is subject to
-- restrictions set forth in FAR 52.227.19(c)(2) or subparagraph
-- (c)(1)(ii) of the Rights in Technical Data and Computer Software
-- clause at DFARS 252.227-7013 and/or in similar or successor
-- clauses in the FAR or the DOD or NASA FAR Supplement.
-- Unpublished-- rights reserved under the copyright laws of the
-- United States. Contractor/manufacturer is Silicon Graphics,
-- Inc., 2011 N. Shoreline Blvd., Mountain View, CA 94039-7311.
--
-- OpenGL(TM) is a trademark of Silicon Graphics, Inc.
--
with GL; use GL;
package Jitter is
type Jitter_Point is
record
x, y : GLfloat;
end record;
j2 : array (1 .. 2) of Jitter_Point :=
((0.246490, 0.249999),
(-0.246490, -0.249999));
j3 : array (1 .. 3) of Jitter_Point :=
((-0.373411, -0.250550),
(0.256263, 0.368119),
(0.117148, -0.117570));
j4 : array (1 .. 4) of Jitter_Point :=
((-0.208147, 0.353730),
(0.203849, -0.353780),
(-0.292626, -0.149945),
(0.296924, 0.149994));
j8 : array (1 .. 8) of Jitter_Point :=
((-0.334818, 0.435331),
(0.286438, -0.393495),
(0.459462, 0.141540),
(-0.414498, -0.192829),
(-0.183790, 0.082102),
(-0.079263, -0.317383),
(0.102254, 0.299133),
(0.164216, -0.054399));
j15 : array (1 .. 15) of Jitter_Point :=
((0.285561, 0.188437),
(0.360176, -0.065688),
(-0.111751, 0.275019),
(-0.055918, -0.215197),
(-0.080231, -0.470965),
(0.138721, 0.409168),
(0.384120, 0.458500),
(-0.454968, 0.134088),
(0.179271, -0.331196),
(-0.307049, -0.364927),
(0.105354, -0.010099),
(-0.154180, 0.021794),
(-0.370135, -0.116425),
(0.451636, -0.300013),
(-0.370610, 0.387504));
j24 : array (1 .. 24) of Jitter_Point :=
((0.030245, 0.136384),
(0.018865, -0.348867),
(-0.350114, -0.472309),
(0.222181, 0.149524),
(-0.393670, -0.266873),
(0.404568, 0.230436),
(0.098381, 0.465337),
(0.462671, 0.442116),
(0.400373, -0.212720),
(-0.409988, 0.263345),
(-0.115878, -0.001981),
(0.348425, -0.009237),
(-0.464016, 0.066467),
(-0.138674, -0.468006),
(0.144932, -0.022780),
(-0.250195, 0.150161),
(-0.181400, -0.264219),
(0.196097, -0.234139),
(-0.311082, -0.078815),
(0.268379, 0.366778),
(-0.040601, 0.327109),
(-0.234392, 0.354659),
(-0.003102, -0.154402),
(0.297997, -0.417965));
j66 : array (1 .. 66) of Jitter_Point :=
((0.266377, -0.218171),
(-0.170919, -0.429368),
(0.047356, -0.387135),
(-0.430063, 0.363413),
(-0.221638, -0.313768),
(0.124758, -0.197109),
(-0.400021, 0.482195),
(0.247882, 0.152010),
(-0.286709, -0.470214),
(-0.426790, 0.004977),
(-0.361249, -0.104549),
(-0.040643, 0.123453),
(-0.189296, 0.438963),
(-0.453521, -0.299889),
(0.408216, -0.457699),
(0.328973, -0.101914),
(-0.055540, -0.477952),
(0.194421, 0.453510),
(0.404051, 0.224974),
(0.310136, 0.419700),
(-0.021743, 0.403898),
(-0.466210, 0.248839),
(0.341369, 0.081490),
(0.124156, -0.016859),
(-0.461321, -0.176661),
(0.013210, 0.234401),
(0.174258, -0.311854),
(0.294061, 0.263364),
(-0.114836, 0.328189),
(0.041206, -0.106205),
(0.079227, 0.345021),
(-0.109319, -0.242380),
(0.425005, -0.332397),
(0.009146, 0.015098),
(-0.339084, -0.355707),
(-0.224596, -0.189548),
(0.083475, 0.117028),
(0.295962, -0.334699),
(0.452998, 0.025397),
(0.206511, -0.104668),
(0.447544, -0.096004),
(-0.108006, -0.002471),
(-0.380810, 0.130036),
(-0.242440, 0.186934),
(-0.200363, 0.070863),
(-0.344844, -0.230814),
(0.408660, 0.345826),
(-0.233016, 0.305203),
(0.158475, -0.430762),
(0.486972, 0.139163),
(-0.301610, 0.009319),
(0.282245, -0.458671),
(0.482046, 0.443890),
(-0.121527, 0.210223),
(-0.477606, -0.424878),
(-0.083941, -0.121440),
(-0.345773, 0.253779),
(0.234646, 0.034549),
(0.394102, -0.210901),
(-0.312571, 0.397656),
(0.200906, 0.333293),
(0.018703, -0.261792),
(-0.209349, -0.065383),
(0.076248, 0.478538),
(-0.073036, -0.355064),
(0.145087, 0.221726));
end Jitter;
|
with ObjectPack, AbstractStrategyCombinatorPackage, IntrospectorPackage, StrategyPackage;
use ObjectPack, AbstractStrategyCombinatorPackage, IntrospectorPackage, StrategyPackage;
package OneIdStrategy is
ARG : constant Integer := 0;
type OneId is new AbstractStrategyCombinator and Object with null record;
----------------------------------------------------------------------------
-- Object implementation
----------------------------------------------------------------------------
function toString(o: OneId) return String;
----------------------------------------------------------------------------
-- Strategy implementation
----------------------------------------------------------------------------
function visitLight(str:access OneId; any: ObjectPtr; intro: access Introspector'Class) return ObjectPtr;
function visit(str: access OneId; intro: access Introspector'Class) return Integer;
----------------------------------------------------------------------------
procedure makeOneId(o : in out OneId; v: StrategyPtr);
function newOneId(v: StrategyPtr) return StrategyPtr;
----------------------------------------------------------------------------
end OneIdStrategy;
|
with STM32_SVD; use STM32_SVD;
with STM32_SVD.RCC;
with STM32GD.EXTI;
package body Peripherals is
procedure Init is
begin
STM32_SVD.RCC.RCC_Periph.APB2ENR.SPI1EN := 1;
-- IRQ.Configure_Trigger (STM32GD.EXTI.Interrupt_Falling_Edge);
CSN.Init;
CSN.Set;
SCLK.Init;
MISO.Init;
MOSI.Init;
IRQ.Init;
SPI.Init;
Timer.Init;
Radio.Init;
end Init;
end Peripherals;
|
-- Institution: Technische Universitaet Muenchen
-- Department: Real-Time Computer Systems (RCS)
-- Project: StratoX
-- Authors: Martin Becker (becker@rcs.ei.tum.de)
with Interfaces; use Interfaces;
package body NVRAM with SPARK_Mode => On, -- Somehow this package includes interrupts, which are accesses
Refined_State => (Memory_State => null)
is
procedure Init is null;
procedure Self_Check (Status : out Boolean) is null;
procedure Load (variable : Variable_Name; data : out HIL.Byte) is
begin
data := HIL.Byte( 0 );
end Load;
procedure Load (variable : in Variable_Name; data : out Float) is
begin
data := 0.0;
end Load;
procedure Store (variable : Variable_Name; data : in HIL.Byte) is null;
procedure Store (variable : in Variable_Name; data : in Float) is null;
procedure Reset is null;
end NVRAM;
|
X : Image (1..16, 1..16);
begin
Fill (X, White);
Cubic_Bezier (X, (16, 1), (1, 4), (3, 16), (15, 11), Black);
Print (X);
|
--
-- (c) Copyright 1993,1994,1995,1996 Silicon Graphics, Inc.
-- ALL RIGHTS RESERVED
-- Permission to use, copy, modify, and distribute this software for
-- any purpose and without fee is hereby granted, provided that the above
-- copyright notice appear in all copies and that both the copyright notice
-- and this permission notice appear in supporting documentation, and that
-- the name of Silicon Graphics, Inc. not be used in advertising
-- or publicity pertaining to distribution of the software without specific,
-- written prior permission.
--
-- THE MATERIAL EMBODIED ON THIS SOFTWARE IS PROVIDED TO YOU "AS-IS"
-- AND WITHOUT WARRANTY OF ANY KIND, EXPRESS, IMPLIED OR OTHERWISE,
-- INCLUDING WITHOUT LIMITATION, ANY WARRANTY OF MERCHANTABILITY OR
-- FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL SILICON
-- GRAPHICS, INC. BE LIABLE TO YOU OR ANYONE ELSE FOR ANY DIRECT,
-- SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY
-- KIND, OR ANY DAMAGES WHATSOEVER, INCLUDING WITHOUT LIMITATION,
-- LOSS OF PROFIT, LOSS OF USE, SAVINGS OR REVENUE, OR THE CLAIMS OF
-- THIRD PARTIES, WHETHER OR NOT SILICON GRAPHICS, INC. HAS BEEN
-- ADVISED OF THE POSSIBILITY OF SUCH LOSS, HOWEVER CAUSED AND ON
-- ANY THEORY OF LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE
-- POSSESSION, USE OR PERFORMANCE OF THIS SOFTWARE.
--
-- US Government Users Restricted Rights
-- Use, duplication, or disclosure by the Government is subject to
-- restrictions set forth in FAR 52.227.19(c)(2) or subparagraph
-- (c)(1)(ii) of the Rights in Technical Data and Computer Software
-- clause at DFARS 252.227-7013 and/or in similar or successor
-- clauses in the FAR or the DOD or NASA FAR Supplement.
-- Unpublished-- rights reserved under the copyright laws of the
-- United States. Contractor/manufacturer is Silicon Graphics,
-- Inc., 2011 N. Shoreline Blvd., Mountain View, CA 94039-7311.
--
-- OpenGL(TM) is a trademark of Silicon Graphics, Inc.
--
with GL; use GL;
with Glut; use Glut;
with Text_IO;
with Texgen_Procs; use Texgen_Procs;
with Interfaces.C.Strings;
procedure Texgen is
package Tio renames Text_IO;
package ICS renames Interfaces.C.Strings;
type chars_ptr_ptr is access ICS.chars_ptr;
argc : aliased integer;
pragma Import (C, argc, "gnat_argc");
argv : chars_ptr_ptr;
pragma Import (C, argv, "gnat_argv");
foobar : Integer;
begin
glutInitWindowSize (300, 300);
glutInit (argc'access, argv);
glutInitDisplayMode(GLUT_RGB or GLUT_DEPTH or GLUT_SINGLE);
foobar := glutCreateWindow ("OpenGL & Ada: texgen");
DoInit;
glutReshapeFunc (ReshapeCallback'ACCESS);
glutDisplayFunc (DoDisplay'ACCESS);
glutMainLoop;
end Texgen;
|
-- This spec has been automatically generated from STM32L4x3.svd
pragma Restrictions (No_Elaboration_Code);
pragma Ada_2012;
pragma Style_Checks (Off);
with HAL;
with System;
package STM32_SVD.Firewall is
pragma Preelaborate;
---------------
-- Registers --
---------------
subtype CSSA_ADD_Field is HAL.UInt16;
-- Code segment start address
type CSSA_Register is record
-- unspecified
Reserved_0_7 : HAL.UInt8 := 16#0#;
-- code segment start address
ADD : CSSA_ADD_Field := 16#0#;
-- unspecified
Reserved_24_31 : HAL.UInt8 := 16#0#;
end record
with Volatile_Full_Access, Object_Size => 32,
Bit_Order => System.Low_Order_First;
for CSSA_Register use record
Reserved_0_7 at 0 range 0 .. 7;
ADD at 0 range 8 .. 23;
Reserved_24_31 at 0 range 24 .. 31;
end record;
subtype CSL_LENG_Field is HAL.UInt14;
-- Code segment length
type CSL_Register is record
-- unspecified
Reserved_0_7 : HAL.UInt8 := 16#0#;
-- code segment length
LENG : CSL_LENG_Field := 16#0#;
-- unspecified
Reserved_22_31 : HAL.UInt10 := 16#0#;
end record
with Volatile_Full_Access, Object_Size => 32,
Bit_Order => System.Low_Order_First;
for CSL_Register use record
Reserved_0_7 at 0 range 0 .. 7;
LENG at 0 range 8 .. 21;
Reserved_22_31 at 0 range 22 .. 31;
end record;
subtype NVDSSA_ADD_Field is HAL.UInt16;
-- Non-volatile data segment start address
type NVDSSA_Register is record
-- unspecified
Reserved_0_7 : HAL.UInt8 := 16#0#;
-- Non-volatile data segment start address
ADD : NVDSSA_ADD_Field := 16#0#;
-- unspecified
Reserved_24_31 : HAL.UInt8 := 16#0#;
end record
with Volatile_Full_Access, Object_Size => 32,
Bit_Order => System.Low_Order_First;
for NVDSSA_Register use record
Reserved_0_7 at 0 range 0 .. 7;
ADD at 0 range 8 .. 23;
Reserved_24_31 at 0 range 24 .. 31;
end record;
subtype NVDSL_LENG_Field is HAL.UInt14;
-- Non-volatile data segment length
type NVDSL_Register is record
-- unspecified
Reserved_0_7 : HAL.UInt8 := 16#0#;
-- Non-volatile data segment length
LENG : NVDSL_LENG_Field := 16#0#;
-- unspecified
Reserved_22_31 : HAL.UInt10 := 16#0#;
end record
with Volatile_Full_Access, Object_Size => 32,
Bit_Order => System.Low_Order_First;
for NVDSL_Register use record
Reserved_0_7 at 0 range 0 .. 7;
LENG at 0 range 8 .. 21;
Reserved_22_31 at 0 range 22 .. 31;
end record;
subtype VDSSA_ADD_Field is HAL.UInt10;
-- Volatile data segment start address
type VDSSA_Register is record
-- unspecified
Reserved_0_5 : HAL.UInt6 := 16#0#;
-- Volatile data segment start address
ADD : VDSSA_ADD_Field := 16#0#;
-- unspecified
Reserved_16_31 : HAL.UInt16 := 16#0#;
end record
with Volatile_Full_Access, Object_Size => 32,
Bit_Order => System.Low_Order_First;
for VDSSA_Register use record
Reserved_0_5 at 0 range 0 .. 5;
ADD at 0 range 6 .. 15;
Reserved_16_31 at 0 range 16 .. 31;
end record;
subtype VDSL_LENG_Field is HAL.UInt10;
-- Volatile data segment length
type VDSL_Register is record
-- unspecified
Reserved_0_5 : HAL.UInt6 := 16#0#;
-- Non-volatile data segment length
LENG : VDSL_LENG_Field := 16#0#;
-- unspecified
Reserved_16_31 : HAL.UInt16 := 16#0#;
end record
with Volatile_Full_Access, Object_Size => 32,
Bit_Order => System.Low_Order_First;
for VDSL_Register use record
Reserved_0_5 at 0 range 0 .. 5;
LENG at 0 range 6 .. 15;
Reserved_16_31 at 0 range 16 .. 31;
end record;
-- Configuration register
type CR_Register is record
-- Firewall pre alarm
FPA : Boolean := False;
-- Volatile data shared
VDS : Boolean := False;
-- Volatile data execution
VDE : Boolean := False;
-- unspecified
Reserved_3_31 : HAL.UInt29 := 16#0#;
end record
with Volatile_Full_Access, Object_Size => 32,
Bit_Order => System.Low_Order_First;
for CR_Register use record
FPA at 0 range 0 .. 0;
VDS at 0 range 1 .. 1;
VDE at 0 range 2 .. 2;
Reserved_3_31 at 0 range 3 .. 31;
end record;
-----------------
-- Peripherals --
-----------------
-- Firewall
type FIREWALL_Peripheral is record
-- Code segment start address
CSSA : aliased CSSA_Register;
-- Code segment length
CSL : aliased CSL_Register;
-- Non-volatile data segment start address
NVDSSA : aliased NVDSSA_Register;
-- Non-volatile data segment length
NVDSL : aliased NVDSL_Register;
-- Volatile data segment start address
VDSSA : aliased VDSSA_Register;
-- Volatile data segment length
VDSL : aliased VDSL_Register;
-- Configuration register
CR : aliased CR_Register;
end record
with Volatile;
for FIREWALL_Peripheral use record
CSSA at 16#0# range 0 .. 31;
CSL at 16#4# range 0 .. 31;
NVDSSA at 16#8# range 0 .. 31;
NVDSL at 16#C# range 0 .. 31;
VDSSA at 16#10# range 0 .. 31;
VDSL at 16#14# range 0 .. 31;
CR at 16#20# range 0 .. 31;
end record;
-- Firewall
FIREWALL_Periph : aliased FIREWALL_Peripheral
with Import, Address => FIREWALL_Base;
end STM32_SVD.Firewall;
|
--------------------------------------------------------------------------
-- Copyright 2022 (C) Holger Rodriguez
--
-- SPDX-License-Identifier: BSD-3-Clause
--
with HAL.GPIO;
with HAL.UART;
with RP.Device;
with RP.Clock;
with RP.GPIO;
with RP.UART;
with Pico;
procedure Pico_Master_Main is
procedure Wait_For_Trigger_Fired;
procedure Wait_For_Trigger_Released;
Trigger : RP.GPIO.GPIO_Point renames Pico.GP15;
Button : RP.GPIO.GPIO_Point renames Pico.GP16;
UART : RP.UART.UART_Port renames RP.Device.UART_0;
UART_TX : RP.GPIO.GPIO_Point renames Pico.GP0;
UART_RX : RP.GPIO.GPIO_Point renames Pico.GP1;
UART_Buffer_T : HAL.UART.UART_Data_8b (1 .. 1)
:= (others => 16#A5#);
UART_Buffer_R : HAL.UART.UART_Data_8b (1 .. 1);
UART_Status_T : HAL.UART.UART_Status;
UART_Status_R : HAL.UART.UART_Status;
procedure Wait_For_Trigger_Fired is
begin
if False then
loop
exit when not Button.Get;
end loop;
end if;
end Wait_For_Trigger_Fired;
procedure Wait_For_Trigger_Released is
begin
if False then
loop
exit when Button.Get;
end loop;
end if;
end Wait_For_Trigger_Released;
use HAL;
begin
RP.Clock.Initialize (Pico.XOSC_Frequency);
RP.Clock.Enable (RP.Clock.PERI);
Pico.LED.Configure (RP.GPIO.Output);
RP.Device.Timer.Enable;
Button.Configure (Mode => RP.GPIO.Input,
Pull => RP.GPIO.Pull_Up,
Func => RP.GPIO.SIO);
Trigger.Configure (Mode => RP.GPIO.Output,
Pull => RP.GPIO.Pull_Up,
Func => RP.GPIO.SIO);
UART_TX.Configure (RP.GPIO.Output, RP.GPIO.Pull_Up, RP.GPIO.UART);
UART_RX.Configure (RP.GPIO.Input, RP.GPIO.Floating, RP.GPIO.UART);
UART.Configure
(Config =>
(Baud => 115_200,
Word_Size => 8,
Parity => False,
Stop_Bits => 1,
others => <>));
Trigger.Set;
loop
Wait_For_Trigger_Fired;
Pico.LED.Set;
Trigger.Clear;
UART.Transmit (Data => UART_Buffer_T,
Status => UART_Status_T,
Timeout => 0);
Wait_For_Trigger_Released;
UART.Receive (Data => UART_Buffer_R,
Status => UART_Status_R,
Timeout => 0);
Wait_For_Trigger_Fired;
Trigger.Set;
Pico.LED.Clear;
Wait_For_Trigger_Released;
UART_Buffer_T (1) := UART_Buffer_T (1) + 0;
end loop;
end Pico_Master_Main;
|
------------------------------------------------------------------------------
-- --
-- GNAT RUN-TIME COMPONENTS --
-- --
-- A D A . S Y N C H R O N O U S _ T A S K _ C O N T R O L --
-- --
-- B o d y --
-- --
-- Copyright (C) 1992-2009, Free Software Foundation, Inc. --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
-- ware Foundation; either version 3, or (at your option) any later ver- --
-- sion. GNAT is distributed in the hope that it will be useful, but WITH- --
-- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY --
-- or FITNESS FOR A PARTICULAR PURPOSE. --
-- --
-- As a special exception under Section 7 of GPL version 3, you are granted --
-- additional permissions described in the GCC Runtime Library Exception, --
-- version 3.1, as published by the Free Software Foundation. --
-- --
-- You should have received a copy of the GNU General Public License and --
-- a copy of the GCC Runtime Library Exception along with this program; --
-- see the files COPYING3 and COPYING.RUNTIME respectively. If not, see --
-- <http://www.gnu.org/licenses/>. --
-- --
-- GNAT was originally developed by the GNAT team at New York University. --
-- Extensive contributions were provided by Ada Core Technologies Inc. --
-- --
------------------------------------------------------------------------------
with Ada.Exceptions;
with System.Tasking;
with System.Task_Primitives.Operations;
package body Ada.Synchronous_Task_Control with
SPARK_Mode => Off
is
----------------
-- Initialize --
----------------
procedure Initialize (S : in out Suspension_Object) is
begin
System.Task_Primitives.Operations.Initialize (S.SO);
end Initialize;
--------------
-- Finalize --
--------------
procedure Finalize (S : in out Suspension_Object) is
begin
System.Task_Primitives.Operations.Finalize (S.SO);
end Finalize;
-------------------
-- Current_State --
-------------------
function Current_State (S : Suspension_Object) return Boolean is
begin
return System.Task_Primitives.Operations.Current_State (S.SO);
end Current_State;
---------------
-- Set_False --
---------------
procedure Set_False (S : in out Suspension_Object) is
begin
System.Task_Primitives.Operations.Set_False (S.SO);
end Set_False;
--------------
-- Set_True --
--------------
procedure Set_True (S : in out Suspension_Object) is
begin
System.Task_Primitives.Operations.Set_True (S.SO);
end Set_True;
------------------------
-- Suspend_Until_True --
------------------------
procedure Suspend_Until_True (S : in out Suspension_Object) is
begin
-- This is a potentially blocking (see ARM D.10, par. 10), so that
-- if pragma Detect_Blocking is active then Program_Error must be
-- raised if this operation is called from a protected action.
if System.Tasking.Detect_Blocking
and then System.Tasking.Self.Common.Protected_Action_Nesting > 0
then
Ada.Exceptions.Raise_Exception
(Program_Error'Identity, "potentially blocking operation");
end if;
System.Task_Primitives.Operations.Suspend_Until_True (S.SO);
end Suspend_Until_True;
end Ada.Synchronous_Task_Control;
|
--//////////////////////////////////////////////////////////
-- SFML - Simple and Fast Multimedia Library
-- Copyright (C) 2007-2015 Laurent Gomila (laurent@sfml-dev.org)
-- 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 System;
package Sf.System.Thread is
type sfThreadFunc_Ptr is access procedure (arg : Standard.System.Address);
--//////////////////////////////////////////////////////////
--//////////////////////////////////////////////////////////
--/ @brief Create a new thread from a function pointer
--/
--/ Note: this does *not* run the thread, use sfThread_launch.
--/
--/ @param func Entry point of the thread
--/ @param userData Custom data to pass to the thread function
--/
--/ @return A new sfThread object
--/
--//////////////////////////////////////////////////////////
function create (func : sfThreadFunc_Ptr;
userData : Standard.System.Address) return sfThread_Ptr;
--//////////////////////////////////////////////////////////
--/ @brief Destroy a thread
--/
--/ This function calls sfThread_wait, so that the internal thread
--/ cannot survive after the sfThread object is destroyed.
--/
--/ @param thread Thread to destroy
--/
--//////////////////////////////////////////////////////////
procedure destroy (thread : sfThread_Ptr);
--//////////////////////////////////////////////////////////
--/ @brief Run a thread
--/
--/ This function starts the entry point passed to the
--/ thread's constructor, and returns immediately.
--/ After this function returns, the thread's function is
--/ running in parallel to the calling code.
--/
--/ @param thread Thread object
--/
--//////////////////////////////////////////////////////////
procedure launch (thread : sfThread_Ptr);
--//////////////////////////////////////////////////////////
--/ @brief Wait until a thread finishes
--/
--/ This function will block the execution until the
--/ thread's function ends.
--/ Warning: if the thread function never ends, the calling
--/ thread will block forever.
--/ If this function is called from its owner thread, it
--/ returns without doing anything.
--/
--/ @param thread Thread object
--/
--//////////////////////////////////////////////////////////
procedure wait (thread : sfThread_Ptr);
--//////////////////////////////////////////////////////////
--/ @brief Terminate a thread
--/
--/ This function immediately stops the thread, without waiting
--/ for its function to finish.
--/ Terminating a thread with this function is not safe,
--/ and can lead to local variables not being destroyed
--/ on some operating systems. You should rather try to make
--/ the thread function terminate by itself.
--/
--/ @param thread Thread object
--/
--//////////////////////////////////////////////////////////
procedure sfThread_terminate (thread : sfThread_Ptr);
private
pragma Convention (C, sfThreadFunc_Ptr);
pragma Import (C, create, "sfThread_create");
pragma Import (C, destroy, "sfThread_destroy");
pragma Import (C, launch, "sfThread_launch");
pragma Import (C, wait, "sfThread_wait");
pragma Import (C, sfThread_terminate, "sfThread_terminate");
end Sf.System.Thread;
|
with Ada.Text_IO; use Ada.Text_IO;
with Ada.Integer_Text_IO; use Ada.Integer_Text_IO;
with Ada.Numerics.Discrete_Random;
with Ada.Command_Line; use Ada.Command_Line;
procedure Lab3b is
type Integers is array (1..2) of Integer;
type Integers_Array is array (1..20) of Integers;
Array_20: Integers_Array;
function "<"(Arr1, Arr2: in Integers)
return Boolean is
begin
--for I in Arr1'Range loop
if Arr1(2) < Arr2(2) then
return True;
elsif Arr1(2) = Arr2(2) then
if Arr1(1) < Arr2(1) then
return True;
else
return False;
end if;
else
return False;
end if;
end "<";
-------------------------------------------------------
procedure Generate(Array_20: in out Integers_Array) is
subtype First_Ten_Numbers is Integer range 1..10;
package Random_Number_One_To_Ten is
new Ada.Numerics.Discrete_Random(Result_Subtype => First_Ten_Numbers);
G : Random_Number_One_To_Ten.Generator;
begin
Random_Number_One_To_Ten.Reset(G);
for I in Array_20'Range loop
for X in Array_20(I)'Range loop
Array_20(I)(X) := Random_Number_One_To_Ten.Random(G);
end loop;
end loop;
end Generate;
-------------------------------------------------------
-------------------------------------------------------
procedure Swap(Tal_1,Tal_2: in out Integers) is
Tal_B : Integers; -- Temporary buffer
begin
Tal_B := Tal_1;
Tal_1 := Tal_2;
Tal_2 := Tal_B;
-- DEBUG New_Line; Put("SWAP IS RUNNING! INDEXES INPUT: "); Put(Tal_1); Put("+"); Put(Tal_2); New_Line;
end Swap;
-------------------------------------------------------
------------------------------------------------------
procedure Sort(Arrayen_Med_Talen: in out Integers_Array) is
Minsta_Talet: Integers;
Minsta_Talet_Index: Integer;
begin
Minsta_Talet := (0,0);
-- -- Loopa antalet gånger som arrayens längd
for IOuter in Arrayen_Med_Talen'Range loop
-- -- DEBUG Put("> "); Put(IOuter); Put(" <"); New_Line;
-- -- Loopa arrayen med start från yttra loopens värde varje gång. 1..20, 2..20, ... , 20..20
for I in IOuter..Arrayen_Med_Talen'Last loop
-- --DEBUG Put(">>>"); Put(I); New_Line;
if I = IOuter or Arrayen_Med_Talen(I) < Minsta_Talet then
Minsta_Talet := Arrayen_Med_Talen(I);
Minsta_Talet_Index := I;
end if;
end loop;
--
Swap(Arrayen_Med_Talen(IOuter), Arrayen_Med_Talen(Minsta_Talet_Index));
-- --DEBUG New_Line; Put("Vi swappar "); Put(Iouter); Put(" och "); Put(Minsta_Talet_Index); New_Line;
end loop;
end Sort;
-----------------------------
-- procedure Put(Arr: in Integers_Array) is
--
-- begin
-- -- Printar ut en array
-- for I in Arr'Range loop
-- Put(Arr(I));
-- New_Line;
-- end loop;
-- end Put;
procedure Put(Ints: in Integers) is
begin
for X in Ints'Range loop
Put(Ints(X),2); Put(" ");
end loop;
end Put;
procedure Put(Arr: in Integers_Array) is
begin
for I in Arr'Range loop
Put(Arr(I));
New_Line;
end loop;
end Put;
begin
-- Fyller en array med random data
Generate(Array_20);
Put(Array_20);
--Put(Array_20);
New_Line;
-- Sorterar arrayen, stigande ordning
Sort(Array_20);
-- Printar ut en array
Put(Array_20);
---------------------------
-- KOD FÖR TERMINALARGUMENT
---------------------------
-- New_Line;
-- New_Line;
-- if Argument_Count = 0 then
-- run A
-- Put("No arguments input");
-- else
-- if Argument_Count = 1 then
-- Put("Arg Input: "); Put(Argument(1));
-- elsif Argument_Count = 2 then
-- Put("Arg 1 Input: "); Put(Argument(1)); Put(" Arg 2 Input: "); Put(Argument(2));
-- end if;
-- end if;
end Lab3b;
|
------------------------------------------------------------------------------
-- G E L A X A S I S --
-- ASIS implementation for Gela project, a portable Ada compiler --
-- http://gela.ada-ru.org --
-- - - - - - - - - - - - - - - - --
-- Read copyright and license at the end of this file --
------------------------------------------------------------------------------
-- $Revision: 209 $ $Date: 2013-11-30 21:03:24 +0200 (Сб., 30 нояб. 2013) $
with Asis.Expressions;
with Asis.Definitions;
with XASIS.Static.Float;
with XASIS.Static.Discrete;
package body XASIS.Static.Fixed is
use Asis;
use XASIS.Integers;
use XASIS.Fractions;
use Asis.Expressions;
package F renames XASIS.Fractions;
function B (Data : Boolean) return Value renames Discrete.B;
function Eval
(Element : Asis.Expression;
Object : Type_Class) return Value;
function Get_Small (Tipe : Classes.Type_Info) return Value;
function Get_Delta (Tipe : Classes.Type_Info) return Value;
function Get_Digits (Tipe : Classes.Type_Info) return Value;
function Is_Float (Right : Value) return Boolean renames Float.Is_Float;
----------
-- Eval --
----------
function Eval
(Element : Asis.Expression;
Object : Type_Class) return Value
is
Item : constant Value := Evaluate (Element);
begin
return V (Item, Object.Info);
end Eval;
--------------
-- Evaluate --
--------------
function Evaluate
(Object : Type_Class;
Kind : Asis.Operator_Kinds;
Args : Asis.Association_List)
return Value
is
procedure Scale_Small
(Left : in out Value;
Right : in Value) is
begin
if Left.Invert_Small = Right.Invert_Small then
Left.Small := Left.Small * Right.Small;
elsif Left.Small >= Right.Small then
Left.Small := Left.Small / Right.Small;
else
Left.Invert_Small := Right.Invert_Small;
Left.Small := Right.Small / Left.Small;
end if;
end Scale_Small;
begin
case Kind is
when A_Unary_Plus_Operator =>
return Evaluate (Actual_Parameter (Args (1)));
when A_Unary_Minus_Operator | An_Abs_Operator =>
declare
Item : Value :=
Eval (Actual_Parameter (Args (1)), Object);
begin
if not Is_Fixed (Item) then
return Undefined;
elsif Kind = A_Unary_Minus_Operator then
Item.Fixed := -Item.Fixed;
return Item;
else
Item.Fixed := abs Item.Fixed;
return Item;
end if;
end;
when A_Multiply_Operator =>
declare
Left : Value :=
Evaluate (Actual_Parameter (Args (1)));
Right : Value :=
Evaluate (Actual_Parameter (Args (2)));
begin
if Is_Fixed (Left) and Is_Fixed (Right) then
Left.Fixed := Left.Fixed * Right.Fixed;
Scale_Small (Left, Right);
return Left;
elsif Is_Fixed (Left) and Discrete.Is_Discrete (Right) then
Left.Fixed := Left.Fixed * Right.Pos;
return Left;
elsif Discrete.Is_Discrete (Left) and Is_Fixed (Right) then
Right.Fixed := Right.Fixed * Left.Pos;
return Right;
else
return Undefined;
end if;
end;
when A_Divide_Operator =>
declare
Left : Value :=
Evaluate (Actual_Parameter (Args (1)));
Right : Value :=
Evaluate (Actual_Parameter (Args (2)));
begin
Check_Zero (Right);
if Is_Fixed (Left) and Is_Fixed (Right) then
Left.Fixed := Left.Fixed / Right.Fixed;
Right.Invert_Small := not Right.Invert_Small;
Scale_Small (Left, Right);
return Left;
elsif Is_Fixed (Left) and Discrete.Is_Discrete (Right) then
Left.Fixed := Left.Fixed / Right.Pos;
return Left;
else
return Undefined;
end if;
end;
when others =>
declare
Left : Value :=
Eval (Actual_Parameter (Args (1)), Object);
Right : Value renames
Eval (Actual_Parameter (Args (2)), Object);
begin
if Is_Fixed (Left) and Is_Fixed (Right) then
case Kind is
when A_Plus_Operator =>
Left.Fixed := Left.Fixed + Right.Fixed;
return Left;
when A_Minus_Operator =>
Left.Fixed := Left.Fixed - Right.Fixed;
return Left;
when An_Equal_Operator =>
return B (Left.Fixed = Right.Fixed);
when A_Not_Equal_Operator =>
return B (Left.Fixed /= Right.Fixed);
when A_Less_Than_Operator =>
return B (Left.Fixed < Right.Fixed);
when A_Less_Than_Or_Equal_Operator =>
return B (Left.Fixed <= Right.Fixed);
when A_Greater_Than_Operator =>
return B (Left.Fixed > Right.Fixed);
when A_Greater_Than_Or_Equal_Operator =>
return B (Left.Fixed >= Right.Fixed);
when others =>
null;
end case;
else
return Undefined;
end if;
end;
end case;
Raise_Error (Internal_Error);
return Undefined;
end Evaluate;
--------------
-- Evaluate --
--------------
function Evaluate
(Object : Type_Class;
Kind : Asis.Attribute_Kinds;
Args : Asis.Association_List)
return Value
is
begin
case Kind is
when A_Round_Attribute =>
declare
X : Value renames Evaluate (Actual_Parameter (Args (1)));
R : F.Fraction;
L : I.Value;
U : I.Value;
begin
if Is_Fixed (X) then
if X.Invert_Small then
R := Int (X.Fixed) / Int (X.Small);
else
return X;
end if;
elsif not Is_Float (X) then
return Undefined;
else
R := X.Fraction;
end if;
L := Truncate (R);
if X.Fraction >= F.Zero then
U := L + I.One;
else
U := L - I.One;
end if;
if abs (Int (L) - R) < abs (Int (U) - R) then
return Float.V (Int (L));
else
return Float.V (Int (U));
end if;
end;
when others =>
null;
end case;
Raise_Error (Internal_Error);
return Undefined;
end Evaluate;
--------------
-- Evaluate --
--------------
function Evaluate
(Object : Type_Class;
Kind : Asis.Attribute_Kinds;
Element : Asis.Expression)
return Value
is
begin
case Kind is
when An_Aft_Attribute =>
declare
Item : Value := Get_Delta (Object.Info);
N : I.Value := I.One;
begin
if not Is_Float (Item) then
return Undefined;
end if;
while Int (I.Ten ** N) * Item.Fraction < F.One loop
N := N + I.One;
end loop;
return Discrete.I (N);
end;
when An_Alignment_Attribute
| A_Fore_Attribute
| A_Machine_Overflows_Attribute
| A_Machine_Radix_Attribute
| A_Machine_Rounds_Attribute
| A_Max_Size_In_Storage_Elements_Attribute
| A_Size_Attribute
| A_Stream_Size_Attribute
| A_Wide_Wide_Width_Attribute
| A_Wide_Width_Attribute
| A_Width_Attribute
=>
return Undefined;
when A_Delta_Attribute =>
return Get_Delta (Object.Info);
when A_Digits_Attribute =>
return Get_Digits (Object.Info);
when A_First_Attribute =>
declare
Rng : Static_Range := Static_Range_Attribute (Element);
begin
return Rng (Lower);
end;
when A_Last_Attribute =>
declare
Rng : Static_Range := Static_Range_Attribute (Element);
begin
return Rng (Upper);
end;
when A_Scale_Attribute =>
declare
Item : Value := Get_Delta (Object.Info);
N : I.Value := I.Zero;
begin
if not Is_Float (Item) then
return Undefined;
end if;
if Item.Fraction < F.One then
while F.One / Int (I.Ten ** N) > Item.Fraction loop
N := N + I.One;
end loop;
else
while Int (I.Ten ** N) < Item.Fraction loop
N := N + I.One;
end loop;
end if;
return Discrete.I (N);
end;
when A_Small_Attribute =>
return Get_Small (Object.Info);
when others =>
null;
end case;
Raise_Error (Internal_Error);
return Undefined;
end Evaluate;
---------------
-- Get_Delta --
---------------
function Get_Delta (Tipe : Classes.Type_Info) return Value is
Def : constant Asis.Definition := Classes.Get_Definition (Tipe);
Delt : constant Asis.Expression :=
Asis.Definitions.Delta_Expression (Def);
begin
return Evaluate (Delt);
end Get_Delta;
----------------
-- Get_Digits --
----------------
function Get_Digits (Tipe : Classes.Type_Info) return Value is
Def : constant Asis.Definition := Classes.Get_Definition (Tipe);
Expr : constant Asis.Expression :=
Asis.Definitions.Digits_Expression (Def);
begin
return Evaluate (Expr);
end Get_Digits;
---------------
-- Get_Small --
---------------
function Get_Small (Tipe : Classes.Type_Info) return Value is
Val : Value := Get_Delta (Tipe);
Result : Value := (Static_Fixed, I.One, I.One, False);
begin
if not Is_Float (Val) then
return Undefined;
end if;
if Val.Fraction < F.One then
Result.Invert_Small := True;
Val.Fraction := F.One / Val.Fraction;
end if;
if Classes.Is_Ordinary_Fixed_Point (Tipe) then
while Int (Result.Small) < Val.Fraction loop
Result.Small := Result.Small * I.Two;
end loop;
elsif Val.Fraction < F.One then
Result.Small := Truncate (F.One / Val.Fraction);
else
Result.Small := Truncate (Val.Fraction);
end if;
return Result;
end Get_Small;
--------------
-- Is_Fixed --
--------------
function Is_Fixed (Right : Value) return Boolean is
begin
return Right.Kind = Static_Fixed;
end Is_Fixed;
-------
-- V --
-------
function V
(Item : Value;
Tipe : Classes.Type_Info) return Value
is
Small : Value := Get_Small (Tipe);
begin
if not Is_Fixed (Small) then
return Undefined;
elsif Is_Float (Item) then
if Small.Invert_Small then
Small.Fixed := Truncate (Item.Fraction * Int (Small.Small));
else
Small.Fixed := Truncate (Item.Fraction / Int (Small.Small));
end if;
return Small;
elsif not Is_Fixed (Item) then
return Undefined;
elsif Small.Invert_Small = Item.Invert_Small
and then Small.Small = Item.Small
then
return Item;
else
Small.Fixed := Item.Fixed;
if Small.Invert_Small then
Small.Fixed := Small.Fixed * Small.Small;
end if;
if not Item.Invert_Small then
Small.Fixed := Small.Fixed * Item.Small;
end if;
if not Small.Invert_Small then
Small.Fixed := Small.Fixed / Small.Small;
end if;
if Item.Invert_Small then
Small.Fixed := Small.Fixed / Item.Small;
end if;
return Small;
end if;
end V;
end XASIS.Static.Fixed;
------------------------------------------------------------------------------
-- 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.
------------------------------------------------------------------------------
|
-----------------------------------------------------------------------
-- components-util -- ASF Util Components
-- Copyright (C) 2009, 2010, 2011, 2013, 2015 Stephane Carrez
-- Written by Stephane Carrez (Stephane.Carrez@gmail.com)
--
-- Licensed under the Apache License, Version 2.0 (the "License");
-- you may not use this file except in compliance with the License.
-- You may obtain a copy of the License at
--
-- http://www.apache.org/licenses/LICENSE-2.0
--
-- Unless required by applicable law or agreed to in writing, software
-- distributed under the License is distributed on an "AS IS" BASIS,
-- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-- See the License for the specific language governing permissions and
-- limitations under the License.
-----------------------------------------------------------------------
with Util.Beans.Objects;
with ASF.Views;
with ASF.Views.Nodes;
package body ASF.Components.Utils is
function Get_Line_Info (UI : in Base.UIComponent'Class) return Views.Line_Info;
-- ------------------------------
-- Get the line information where the component is defined.
-- ------------------------------
function Get_Line_Info (UI : in Base.UIComponent'Class) return Views.Line_Info is
Tag : constant access ASF.Views.Nodes.Tag_Node'Class := UI.Get_Tag;
begin
if Tag /= null then
return Tag.Get_Line_Info;
else
return Tag.Get_Line_Info;
end if;
end Get_Line_Info;
pragma Unreferenced (Get_Line_Info);
-- ------------------------------
-- Get the line information where the component is defined.
-- ------------------------------
function Get_Line_Info (UI : in Base.UIComponent'Class) return String is
Tag : constant access ASF.Views.Nodes.Tag_Node'Class := UI.Get_Tag;
begin
if Tag /= null then
return Tag.Get_Line_Info;
else
return "?";
end if;
end Get_Line_Info;
-- ------------------------------
-- Get the component attribute that implements the <tt>List_Bean</tt> interface.
-- Returns null if the attribute is not found or does not implement the interface.
-- ------------------------------
function Get_List_Bean (UI : in Base.UIComponent'Class;
Name : in String;
Context : in ASF.Contexts.Faces.Faces_Context'Class)
return Util.Beans.Basic.List_Bean_Access is
use type Util.Beans.Objects.Data_Type;
Value : constant Util.Beans.Objects.Object := UI.Get_Attribute (Context, Name);
Kind : constant Util.Beans.Objects.Data_Type := Util.Beans.Objects.Get_Type (Value);
Bean : access Util.Beans.Basic.Readonly_Bean'Class;
List : Util.Beans.Basic.List_Bean_Access;
begin
-- Check that we have a List_Bean but do not complain if we have a null value.
if Kind /= Util.Beans.Objects.TYPE_BEAN then
if Kind /= Util.Beans.Objects.TYPE_NULL then
ASF.Components.Base.Log_Error (UI, "Invalid list bean (found a {0})",
Util.Beans.Objects.Get_Type_Name (Value));
end if;
return null;
end if;
Bean := Util.Beans.Objects.To_Bean (Value);
if Bean = null or else not (Bean.all in Util.Beans.Basic.List_Bean'Class) then
ASF.Components.Base.Log_Error (UI, "Invalid list bean: it does not implement"
& " 'List_Bean' interface");
return null;
end if;
List := Util.Beans.Basic.List_Bean'Class (Bean.all)'Unchecked_Access;
return List;
end Get_List_Bean;
end ASF.Components.Utils;
|
package Hofstadter_Figure_Figure is
function FFR(P: Positive) return Positive;
function FFS(P: Positive) return Positive;
end Hofstadter_Figure_Figure;
|
-----------------------------------------------------------------------
-- security-openid -- OpenID 2.0 Support
-- Copyright (C) 2009, 2010, 2011, 2012 Stephane Carrez
-- Written by Stephane Carrez (Stephane.Carrez@gmail.com)
--
-- Licensed under the Apache License, Version 2.0 (the "License");
-- you may not use this file except in compliance with the License.
-- You may obtain a copy of the License at
--
-- http://www.apache.org/licenses/LICENSE-2.0
--
-- Unless required by applicable law or agreed to in writing, software
-- distributed under the License is distributed on an "AS IS" BASIS,
-- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-- See the License for the specific language governing permissions and
-- limitations under the License.
-----------------------------------------------------------------------
with Ada.Strings.Unbounded;
with Ada.Calendar;
with Ada.Finalization;
with Security.Auth;
-- == OpenID ==
-- The <b>Security.OpenID</b> package implements an authentication framework based
-- on OpenID 2.0.
--
-- See OpenID Authentication 2.0 - Final
-- http://openid.net/specs/openid-authentication-2_0.html
--
-- There are basically two steps that an application must implement:
--
-- * <b>Discovery</b>: to resolve and use the OpenID provider and redirect the user to the
-- provider authentication form.
-- * <b>Verify</b>: to decode the authentication and check its result.
--
-- [http://ada-security.googlecode.com/svn/wiki/OpenID.png]
--
-- The authentication process is the following:
--
-- * The application should redirect the user to the authentication URL.
-- * The OpenID provider authenticate the user and redirects the user to the callback CB.
-- * The association is decoded from the callback parameter.
-- * The <b>Verify</b> procedure is called with the association to check the result and
-- obtain the authentication results.
--
-- === Initialization ===
-- The initialization process must be done before each two steps (discovery and verify).
-- The OpenID manager must be declared and configured.
--
-- Mgr : Security.OpenID.Manager;
--
-- For the configuration, the <b>Initialize</b> procedure is called to configure
-- the OpenID realm and set the OpenID return callback URL. The return callback
-- must be a valid URL that is based on the realm. Example:
--
-- Mgr.Initialize (Name => "http://app.site.com/auth",
-- Return_To => "http://app.site.com/auth/verify");
--
-- After this initialization, the OpenID manager can be used in the authentication process.
--
-- === Discovery: creating the authentication URL ===
-- The first step is to create an authentication URL to which the user must be redirected.
-- In this step, we have to create an OpenID manager, discover the OpenID provider,
-- do the association and get an <b>End_Point</b>. The OpenID provider is specified as an
-- URL, below is an example for Google OpenID:
--
-- Provider : constant String := "https://www.google.com/accounts/o8/id";
-- OP : Security.OpenID.End_Point;
-- Assoc : constant Security.OpenID.Association_Access := new Security.OpenID.Association;
--
-- The following steps are performed:
--
-- * The <b>Discover</b> procedure is called to retrieve from the OpenID provider the XRDS
-- stream and identify the provider. An <b>End_Point</b> is returned in <tt>OP</tt>.
-- * The <b>Associate</b> procedure is called to make the association with the <b>End_Point</b>.
-- The <b>Association</b> record holds session, and authentication.
--
-- Mgr.Discover (Provider, OP); -- Yadis discovery (get the XRDS file).
-- Mgr.Associate (OP, Assoc.all);-- Associate and get an end-point with a key.
--
-- After this first step, you must manage to save the association in the HTTP session.
-- Then you must redirect to the authentication URL that is obtained by using:
--
-- Auth_URL : constant String := Mgr.Get_Authentication_URL (OP, Assoc.all);
--
-- === Verify: acknowledge the authentication in the callback URL ===
-- The second step is done when the user has finished the authentication successfully or not.
-- For this step, the application must get back the association that was saved in the session.
-- It must also prepare a parameters object that allows the OpenID framework to get the
-- URI parameters from the return callback.
--
-- Assoc : Association_Access := ...; -- Get the association saved in the session.
-- Auth : OpenID.Authentication;
-- Params : Auth_Params;
--
-- The OpenID manager must be initialized and the <b>Verify</b> procedure is called with
-- the association, parameters and the authentication result. The <b>Get_Status</b> function
-- must be used to check that the authentication succeeded.
--
-- Mgr.Verify (Assoc.all, Params, Auth);
-- if Security.OpenID.Get_Status (Auth) = Security.OpenID.AUTHENTICATED then ... -- Success.
--
-- === Principal creation ===
-- After the user is successfully authenticated, a user principal can be created and saved in
-- the session. The user principal can then be used to assign permissions to that user and
-- enforce the application permissions using the security policy manger.
--
-- P : Security.OpenID.Principal_Access := Security.OpenID.Create_Principal (Auth);
--
package Security.OpenID is
pragma Obsolescent ("Use the Security.Auth package instead");
Invalid_End_Point : exception;
Service_Error : exception;
subtype Parameters is Security.Auth.Parameters;
-- ------------------------------
-- OpenID provider
-- ------------------------------
-- The <b>End_Point</b> represents the OpenID provider that will authenticate
-- the user.
subtype End_Point is Security.Auth.End_Point;
-- ------------------------------
-- Association
-- ------------------------------
-- The OpenID association contains the shared secret between the relying party
-- and the OpenID provider. The association can be cached and reused to authenticate
-- different users using the same OpenID provider. The association also has an
-- expiration date.
subtype Association is Security.Auth.End_Point;
subtype Auth_Result is Security.Auth.Auth_Result;
-- ------------------------------
-- OpenID provider
-- ------------------------------
--
subtype Authentication is Security.Auth.Authentication;
-- ------------------------------
-- OpenID Default principal
-- ------------------------------
subtype Principal is Security.Auth.Principal;
subtype Principal_Access is Security.Auth.Principal_Access;
-- ------------------------------
-- OpenID Manager
-- ------------------------------
-- The <b>Manager</b> provides the core operations for the OpenID process.
subtype Manager is Security.Auth.Manager;
-- Initialize the OpenID realm.
procedure Initialize (Realm : in out Manager;
Name : in String;
Return_To : in String);
private
use Ada.Strings.Unbounded;
--
-- type Manager is new Ada.Finalization.Limited_Controlled with record
-- Realm : Unbounded_String;
-- Return_To : Unbounded_String;
-- end record;
end Security.OpenID;
|
--
-- Copyright 2018 The wookey project team <wookey@ssi.gouv.fr>
-- - Ryad Benadjila
-- - Arnauld Michelizza
-- - Mathieu Renard
-- - Philippe Thierry
-- - Philippe Trebuchet
--
-- Licensed under the Apache License, Version 2.0 (the "License");
-- you may not use this file except in compliance with the License.
-- You may obtain a copy of the License at
--
-- http://www.apache.org/licenses/LICENSE-2.0
--
-- Unless required by applicable law or agreed to in writing, software
-- distributed under the License is distributed on an "AS IS" BASIS,
-- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-- See the License for the specific language governing permissions and
-- limitations under the License.
--
--
with ewok.tasks_shared;
package ewok.ipc
with spark_mode => on
is
--
-- IPC EndPoints
--
MAX_IPC_MSG_SIZE : constant := 128;
type t_endpoint_state is (
-- IPC endpoint is unused
FREE,
-- IPC endpoint is used and is ready for message passing
READY,
-- send() block until the receiver read the message
WAIT_FOR_RECEIVER);
type t_extended_task_id is
(ID_UNUSED,
ID_APP1,
ID_APP2,
ID_APP3,
ID_APP4,
ID_APP5,
ID_APP6,
ID_APP7,
ANY_APP)
with size => 8;
for t_extended_task_id use
(ID_UNUSED => 0,
ID_APP1 => 1,
ID_APP2 => 2,
ID_APP3 => 3,
ID_APP4 => 4,
ID_APP5 => 5,
ID_APP6 => 6,
ID_APP7 => 7,
ANY_APP => 255);
function to_task_id
(id : t_extended_task_id) return ewok.tasks_shared.t_task_id;
function to_ext_task_id
(id : ewok.tasks_shared.t_task_id) return t_extended_task_id;
type t_endpoint is record
from : t_extended_task_id;
to : t_extended_task_id;
state : t_endpoint_state;
data : byte_array (1 .. MAX_IPC_MSG_SIZE);
size : unsigned_8;
end record;
--
-- Global pool of IPC EndPoints
--
ENDPOINTS_POOL_SIZE : constant := 10;
ID_ENDPOINT_UNUSED : constant := 0;
type t_extended_endpoint_id is
range ID_ENDPOINT_UNUSED .. ENDPOINTS_POOL_SIZE;
subtype t_endpoint_id is
t_extended_endpoint_id range 1 .. ENDPOINTS_POOL_SIZE;
ipc_endpoints : array (t_endpoint_id) of aliased t_endpoint;
--
-- Functions
--
-- Init IPC endpoints
procedure init_endpoints;
-- Get a free IPC endpoint
procedure get_endpoint
(endpoint : out t_extended_endpoint_id;
success : out boolean);
-- Release a used IPC endpoint
procedure release_endpoint
(ep_id : in t_endpoint_id);
end ewok.ipc;
|
------------------------------------------------------------------------------
-- --
-- Matreshka Project --
-- --
-- Ada Modeling Framework --
-- --
-- Runtime Library Component --
-- --
------------------------------------------------------------------------------
-- --
-- Copyright © 2012-2013, Vadim Godunko <vgodunko@gmail.com> --
-- All rights reserved. --
-- --
-- Redistribution and use in source and binary forms, with or without --
-- modification, are permitted provided that the following conditions --
-- are met: --
-- --
-- * Redistributions of source code must retain the above copyright --
-- notice, this list of conditions and the following disclaimer. --
-- --
-- * Redistributions in binary form must reproduce the above copyright --
-- notice, this list of conditions and the following disclaimer in the --
-- documentation and/or other materials provided with the distribution. --
-- --
-- * Neither the name of the Vadim Godunko, IE nor the names of its --
-- contributors may be used to endorse or promote products derived from --
-- this software without specific prior written permission. --
-- --
-- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS --
-- "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT --
-- LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR --
-- A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT --
-- HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, --
-- SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED --
-- TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR --
-- PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF --
-- LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING --
-- NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS --
-- SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. --
-- --
------------------------------------------------------------------------------
-- $Revision$ $Date$
------------------------------------------------------------------------------
-- This file is generated, don't edit it.
------------------------------------------------------------------------------
with AMF.Internals.Tables.OCL_Types;
package AMF.Internals.Tables.OCL_Attribute_Mappings is
pragma Preelaborate;
OCL_Collection_Offset : constant
array (AMF.Internals.Tables.OCL_Types.Element_Kinds,
AMF.Internals.CMOF_Element range 48 .. 54)
of AMF.Internals.AMF_Collection_Of_Element :=
(AMF.Internals.Tables.OCL_Types.E_None =>
(others => 0),
AMF.Internals.Tables.OCL_Types.E_OCL_Any_Type =>
(others => 0),
AMF.Internals.Tables.OCL_Types.E_OCL_Association_Class_Call_Exp =>
(52 => 4, -- NavigationCallExp::qualifier
others => 0),
AMF.Internals.Tables.OCL_Types.E_OCL_Bag_Type =>
(others => 0),
AMF.Internals.Tables.OCL_Types.E_OCL_Boolean_Literal_Exp =>
(others => 0),
AMF.Internals.Tables.OCL_Types.E_OCL_Collection_Item =>
(others => 0),
AMF.Internals.Tables.OCL_Types.E_OCL_Collection_Literal_Exp =>
(48 => 4, -- CollectionLiteralExp::part
others => 0),
AMF.Internals.Tables.OCL_Types.E_OCL_Collection_Range =>
(others => 0),
AMF.Internals.Tables.OCL_Types.E_OCL_Collection_Type =>
(others => 0),
AMF.Internals.Tables.OCL_Types.E_OCL_Enum_Literal_Exp =>
(others => 0),
AMF.Internals.Tables.OCL_Types.E_OCL_Expression_In_Ocl =>
(49 => 4, -- ExpressionInOcl::parameterVariable
others => 0),
AMF.Internals.Tables.OCL_Types.E_OCL_If_Exp =>
(others => 0),
AMF.Internals.Tables.OCL_Types.E_OCL_Integer_Literal_Exp =>
(others => 0),
AMF.Internals.Tables.OCL_Types.E_OCL_Invalid_Literal_Exp =>
(others => 0),
AMF.Internals.Tables.OCL_Types.E_OCL_Invalid_Type =>
(others => 0),
AMF.Internals.Tables.OCL_Types.E_OCL_Iterate_Exp =>
(50 => 4, -- LoopExp::iterator
others => 0),
AMF.Internals.Tables.OCL_Types.E_OCL_Iterator_Exp =>
(50 => 4, -- LoopExp::iterator
others => 0),
AMF.Internals.Tables.OCL_Types.E_OCL_Let_Exp =>
(others => 0),
AMF.Internals.Tables.OCL_Types.E_OCL_Message_Exp =>
(51 => 4, -- MessageExp::argument
others => 0),
AMF.Internals.Tables.OCL_Types.E_OCL_Message_Type =>
(others => 0),
AMF.Internals.Tables.OCL_Types.E_OCL_Null_Literal_Exp =>
(others => 0),
AMF.Internals.Tables.OCL_Types.E_OCL_Operation_Call_Exp =>
(53 => 4, -- OperationCallExp::argument
others => 0),
AMF.Internals.Tables.OCL_Types.E_OCL_Ordered_Set_Type =>
(others => 0),
AMF.Internals.Tables.OCL_Types.E_OCL_Property_Call_Exp =>
(52 => 4, -- NavigationCallExp::qualifier
others => 0),
AMF.Internals.Tables.OCL_Types.E_OCL_Real_Literal_Exp =>
(others => 0),
AMF.Internals.Tables.OCL_Types.E_OCL_Sequence_Type =>
(others => 0),
AMF.Internals.Tables.OCL_Types.E_OCL_Set_Type =>
(others => 0),
AMF.Internals.Tables.OCL_Types.E_OCL_State_Exp =>
(others => 0),
AMF.Internals.Tables.OCL_Types.E_OCL_String_Literal_Exp =>
(others => 0),
AMF.Internals.Tables.OCL_Types.E_OCL_Template_Parameter_Type =>
(others => 0),
AMF.Internals.Tables.OCL_Types.E_OCL_Tuple_Literal_Exp =>
(54 => 4, -- TupleLiteralExp::part
others => 0),
AMF.Internals.Tables.OCL_Types.E_OCL_Tuple_Literal_Part =>
(others => 0),
AMF.Internals.Tables.OCL_Types.E_OCL_Tuple_Type =>
(others => 0),
AMF.Internals.Tables.OCL_Types.E_OCL_Type_Exp =>
(others => 0),
AMF.Internals.Tables.OCL_Types.E_OCL_Unlimited_Natural_Literal_Exp =>
(others => 0),
AMF.Internals.Tables.OCL_Types.E_OCL_Unspecified_Value_Exp =>
(others => 0),
AMF.Internals.Tables.OCL_Types.E_OCL_Variable =>
(others => 0),
AMF.Internals.Tables.OCL_Types.E_OCL_Variable_Exp =>
(others => 0),
AMF.Internals.Tables.OCL_Types.E_OCL_Void_Type =>
(others => 0));
OCL_Member_Offset : constant
array (AMF.Internals.Tables.OCL_Types.Element_Kinds,
AMF.Internals.CMOF_Element range 55 .. 93) of Natural :=
(AMF.Internals.Tables.OCL_Types.E_None =>
(others => 0),
AMF.Internals.Tables.OCL_Types.E_OCL_Any_Type =>
(others => 0),
AMF.Internals.Tables.OCL_Types.E_OCL_Association_Class_Call_Exp =>
(81 => 9, -- NavigationCallExp::navigationSource
55 => 10, -- AssociationClassCallExp::referredAssociationClass
57 => 8, -- CallExp::source
others => 0),
AMF.Internals.Tables.OCL_Types.E_OCL_Bag_Type =>
(62 => 17, -- CollectionType::elementType
others => 0),
AMF.Internals.Tables.OCL_Types.E_OCL_Boolean_Literal_Exp =>
(56 => 8, -- BooleanLiteralExp::booleanSymbol
others => 0),
AMF.Internals.Tables.OCL_Types.E_OCL_Collection_Item =>
(58 => 8, -- CollectionItem::item
others => 0),
AMF.Internals.Tables.OCL_Types.E_OCL_Collection_Literal_Exp =>
(59 => 8, -- CollectionLiteralExp::kind
others => 0),
AMF.Internals.Tables.OCL_Types.E_OCL_Collection_Range =>
(60 => 8, -- CollectionRange::first
61 => 9, -- CollectionRange::last
others => 0),
AMF.Internals.Tables.OCL_Types.E_OCL_Collection_Type =>
(62 => 17, -- CollectionType::elementType
others => 0),
AMF.Internals.Tables.OCL_Types.E_OCL_Enum_Literal_Exp =>
(63 => 8, -- EnumLiteralExp::referredEnumLiteral
others => 0),
AMF.Internals.Tables.OCL_Types.E_OCL_Expression_In_Ocl =>
(64 => 14, -- ExpressionInOcl::bodyExpression
65 => 15, -- ExpressionInOcl::contextVariable
66 => 17, -- ExpressionInOcl::generatedType
67 => 16, -- ExpressionInOcl::resultVariable
others => 0),
AMF.Internals.Tables.OCL_Types.E_OCL_If_Exp =>
(68 => 8, -- IfExp::condition
69 => 10, -- IfExp::elseExpression
70 => 9, -- IfExp::thenExpression
others => 0),
AMF.Internals.Tables.OCL_Types.E_OCL_Integer_Literal_Exp =>
(71 => 8, -- IntegerLiteralExp::integerSymbol
others => 0),
AMF.Internals.Tables.OCL_Types.E_OCL_Invalid_Literal_Exp =>
(others => 0),
AMF.Internals.Tables.OCL_Types.E_OCL_Invalid_Type =>
(others => 0),
AMF.Internals.Tables.OCL_Types.E_OCL_Iterate_Exp =>
(75 => 9, -- LoopExp::body
72 => 10, -- IterateExp::result
57 => 8, -- CallExp::source
others => 0),
AMF.Internals.Tables.OCL_Types.E_OCL_Iterator_Exp =>
(75 => 9, -- LoopExp::body
57 => 8, -- CallExp::source
others => 0),
AMF.Internals.Tables.OCL_Types.E_OCL_Let_Exp =>
(73 => 8, -- LetExp::in
74 => 9, -- LetExp::variable
others => 0),
AMF.Internals.Tables.OCL_Types.E_OCL_Message_Exp =>
(76 => 9, -- MessageExp::calledOperation
77 => 10, -- MessageExp::sentSignal
78 => 8, -- MessageExp::target
others => 0),
AMF.Internals.Tables.OCL_Types.E_OCL_Message_Type =>
(79 => 18, -- MessageType::referredOperation
80 => 17, -- MessageType::referredSignal
others => 0),
AMF.Internals.Tables.OCL_Types.E_OCL_Null_Literal_Exp =>
(others => 0),
AMF.Internals.Tables.OCL_Types.E_OCL_Operation_Call_Exp =>
(82 => 9, -- OperationCallExp::referredOperation
57 => 8, -- CallExp::source
others => 0),
AMF.Internals.Tables.OCL_Types.E_OCL_Ordered_Set_Type =>
(62 => 17, -- CollectionType::elementType
others => 0),
AMF.Internals.Tables.OCL_Types.E_OCL_Property_Call_Exp =>
(81 => 9, -- NavigationCallExp::navigationSource
83 => 10, -- PropertyCallExp::referredProperty
57 => 8, -- CallExp::source
others => 0),
AMF.Internals.Tables.OCL_Types.E_OCL_Real_Literal_Exp =>
(84 => 8, -- RealLiteralExp::realSymbol
others => 0),
AMF.Internals.Tables.OCL_Types.E_OCL_Sequence_Type =>
(62 => 17, -- CollectionType::elementType
others => 0),
AMF.Internals.Tables.OCL_Types.E_OCL_Set_Type =>
(62 => 17, -- CollectionType::elementType
others => 0),
AMF.Internals.Tables.OCL_Types.E_OCL_State_Exp =>
(85 => 8, -- StateExp::referredState
others => 0),
AMF.Internals.Tables.OCL_Types.E_OCL_String_Literal_Exp =>
(86 => 8, -- StringLiteralExp::stringSymbol
others => 0),
AMF.Internals.Tables.OCL_Types.E_OCL_Template_Parameter_Type =>
(87 => 17, -- TemplateParameterType::specification
others => 0),
AMF.Internals.Tables.OCL_Types.E_OCL_Tuple_Literal_Exp =>
(others => 0),
AMF.Internals.Tables.OCL_Types.E_OCL_Tuple_Literal_Part =>
(88 => 8, -- TupleLiteralPart::attribute
others => 0),
AMF.Internals.Tables.OCL_Types.E_OCL_Tuple_Type =>
(others => 0),
AMF.Internals.Tables.OCL_Types.E_OCL_Type_Exp =>
(89 => 8, -- TypeExp::referredType
others => 0),
AMF.Internals.Tables.OCL_Types.E_OCL_Unlimited_Natural_Literal_Exp =>
(90 => 8, -- UnlimitedNaturalLiteralExp::unlimitedNaturalSymbol
others => 0),
AMF.Internals.Tables.OCL_Types.E_OCL_Unspecified_Value_Exp =>
(others => 0),
AMF.Internals.Tables.OCL_Types.E_OCL_Variable =>
(91 => 8, -- Variable::initExpression
92 => 9, -- Variable::representedParameter
others => 0),
AMF.Internals.Tables.OCL_Types.E_OCL_Variable_Exp =>
(93 => 8, -- VariableExp::referredVariable
others => 0),
AMF.Internals.Tables.OCL_Types.E_OCL_Void_Type =>
(others => 0));
UML_Collection_Offset : constant
array (AMF.Internals.Tables.OCL_Types.Element_Kinds,
AMF.Internals.CMOF_Element range 243 .. 482)
of AMF.Internals.AMF_Collection_Of_Element :=
(AMF.Internals.Tables.OCL_Types.E_None =>
(others => 0),
AMF.Internals.Tables.OCL_Types.E_OCL_Any_Type =>
(296 => 13, -- Classifier::attribute
400 => 3, -- NamedElement::clientDependency
297 => 14, -- Classifier::collaborationUse
401 => 4, -- Namespace::elementImport
298 => 15, -- Classifier::feature
299 => 16, -- Classifier::general
300 => 17, -- Classifier::generalization
402 => 5, -- Namespace::importedMember
301 => 18, -- Classifier::inheritedMember
403 => 6, -- Namespace::member
347 => 1, -- Element::ownedComment
348 => 2, -- Element::ownedElement
404 => 7, -- Namespace::ownedMember
405 => 8, -- Namespace::ownedRule
302 => 19, -- Classifier::ownedUseCase
406 => 9, -- Namespace::packageImport
303 => 20, -- Classifier::powertypeExtent
304 => 21, -- Classifier::redefinedClassifier
439 => 11, -- RedefinableElement::redefinedElement
440 => 12, -- RedefinableElement::redefinitionContext
305 => 22, -- Classifier::substitution
472 => 10, -- TemplateableElement::templateBinding
306 => 23, -- Classifier::useCase
others => 0),
AMF.Internals.Tables.OCL_Types.E_OCL_Association_Class_Call_Exp =>
(400 => 3, -- NamedElement::clientDependency
347 => 1, -- Element::ownedComment
348 => 2, -- Element::ownedElement
others => 0),
AMF.Internals.Tables.OCL_Types.E_OCL_Bag_Type =>
(296 => 13, -- Classifier::attribute
400 => 3, -- NamedElement::clientDependency
297 => 14, -- Classifier::collaborationUse
401 => 4, -- Namespace::elementImport
298 => 15, -- Classifier::feature
299 => 16, -- Classifier::general
300 => 17, -- Classifier::generalization
402 => 5, -- Namespace::importedMember
301 => 18, -- Classifier::inheritedMember
403 => 6, -- Namespace::member
334 => 24, -- DataType::ownedAttribute
347 => 1, -- Element::ownedComment
348 => 2, -- Element::ownedElement
404 => 7, -- Namespace::ownedMember
335 => 25, -- DataType::ownedOperation
405 => 8, -- Namespace::ownedRule
302 => 19, -- Classifier::ownedUseCase
406 => 9, -- Namespace::packageImport
303 => 20, -- Classifier::powertypeExtent
304 => 21, -- Classifier::redefinedClassifier
439 => 11, -- RedefinableElement::redefinedElement
440 => 12, -- RedefinableElement::redefinitionContext
305 => 22, -- Classifier::substitution
472 => 10, -- TemplateableElement::templateBinding
306 => 23, -- Classifier::useCase
others => 0),
AMF.Internals.Tables.OCL_Types.E_OCL_Boolean_Literal_Exp =>
(400 => 3, -- NamedElement::clientDependency
347 => 1, -- Element::ownedComment
348 => 2, -- Element::ownedElement
others => 0),
AMF.Internals.Tables.OCL_Types.E_OCL_Collection_Item =>
(400 => 3, -- NamedElement::clientDependency
347 => 1, -- Element::ownedComment
348 => 2, -- Element::ownedElement
others => 0),
AMF.Internals.Tables.OCL_Types.E_OCL_Collection_Literal_Exp =>
(400 => 3, -- NamedElement::clientDependency
347 => 1, -- Element::ownedComment
348 => 2, -- Element::ownedElement
others => 0),
AMF.Internals.Tables.OCL_Types.E_OCL_Collection_Range =>
(400 => 3, -- NamedElement::clientDependency
347 => 1, -- Element::ownedComment
348 => 2, -- Element::ownedElement
others => 0),
AMF.Internals.Tables.OCL_Types.E_OCL_Collection_Type =>
(296 => 13, -- Classifier::attribute
400 => 3, -- NamedElement::clientDependency
297 => 14, -- Classifier::collaborationUse
401 => 4, -- Namespace::elementImport
298 => 15, -- Classifier::feature
299 => 16, -- Classifier::general
300 => 17, -- Classifier::generalization
402 => 5, -- Namespace::importedMember
301 => 18, -- Classifier::inheritedMember
403 => 6, -- Namespace::member
334 => 24, -- DataType::ownedAttribute
347 => 1, -- Element::ownedComment
348 => 2, -- Element::ownedElement
404 => 7, -- Namespace::ownedMember
335 => 25, -- DataType::ownedOperation
405 => 8, -- Namespace::ownedRule
302 => 19, -- Classifier::ownedUseCase
406 => 9, -- Namespace::packageImport
303 => 20, -- Classifier::powertypeExtent
304 => 21, -- Classifier::redefinedClassifier
439 => 11, -- RedefinableElement::redefinedElement
440 => 12, -- RedefinableElement::redefinitionContext
305 => 22, -- Classifier::substitution
472 => 10, -- TemplateableElement::templateBinding
306 => 23, -- Classifier::useCase
others => 0),
AMF.Internals.Tables.OCL_Types.E_OCL_Enum_Literal_Exp =>
(400 => 3, -- NamedElement::clientDependency
347 => 1, -- Element::ownedComment
348 => 2, -- Element::ownedElement
others => 0),
AMF.Internals.Tables.OCL_Types.E_OCL_Expression_In_Ocl =>
(400 => 3, -- NamedElement::clientDependency
347 => 1, -- Element::ownedComment
348 => 2, -- Element::ownedElement
others => 0),
AMF.Internals.Tables.OCL_Types.E_OCL_If_Exp =>
(400 => 3, -- NamedElement::clientDependency
347 => 1, -- Element::ownedComment
348 => 2, -- Element::ownedElement
others => 0),
AMF.Internals.Tables.OCL_Types.E_OCL_Integer_Literal_Exp =>
(400 => 3, -- NamedElement::clientDependency
347 => 1, -- Element::ownedComment
348 => 2, -- Element::ownedElement
others => 0),
AMF.Internals.Tables.OCL_Types.E_OCL_Invalid_Literal_Exp =>
(400 => 3, -- NamedElement::clientDependency
347 => 1, -- Element::ownedComment
348 => 2, -- Element::ownedElement
others => 0),
AMF.Internals.Tables.OCL_Types.E_OCL_Invalid_Type =>
(296 => 13, -- Classifier::attribute
400 => 3, -- NamedElement::clientDependency
297 => 14, -- Classifier::collaborationUse
401 => 4, -- Namespace::elementImport
298 => 15, -- Classifier::feature
299 => 16, -- Classifier::general
300 => 17, -- Classifier::generalization
402 => 5, -- Namespace::importedMember
301 => 18, -- Classifier::inheritedMember
403 => 6, -- Namespace::member
347 => 1, -- Element::ownedComment
348 => 2, -- Element::ownedElement
404 => 7, -- Namespace::ownedMember
405 => 8, -- Namespace::ownedRule
302 => 19, -- Classifier::ownedUseCase
406 => 9, -- Namespace::packageImport
303 => 20, -- Classifier::powertypeExtent
304 => 21, -- Classifier::redefinedClassifier
439 => 11, -- RedefinableElement::redefinedElement
440 => 12, -- RedefinableElement::redefinitionContext
305 => 22, -- Classifier::substitution
472 => 10, -- TemplateableElement::templateBinding
306 => 23, -- Classifier::useCase
others => 0),
AMF.Internals.Tables.OCL_Types.E_OCL_Iterate_Exp =>
(400 => 3, -- NamedElement::clientDependency
347 => 1, -- Element::ownedComment
348 => 2, -- Element::ownedElement
others => 0),
AMF.Internals.Tables.OCL_Types.E_OCL_Iterator_Exp =>
(400 => 3, -- NamedElement::clientDependency
347 => 1, -- Element::ownedComment
348 => 2, -- Element::ownedElement
others => 0),
AMF.Internals.Tables.OCL_Types.E_OCL_Let_Exp =>
(400 => 3, -- NamedElement::clientDependency
347 => 1, -- Element::ownedComment
348 => 2, -- Element::ownedElement
others => 0),
AMF.Internals.Tables.OCL_Types.E_OCL_Message_Exp =>
(400 => 3, -- NamedElement::clientDependency
347 => 1, -- Element::ownedComment
348 => 2, -- Element::ownedElement
others => 0),
AMF.Internals.Tables.OCL_Types.E_OCL_Message_Type =>
(296 => 13, -- Classifier::attribute
400 => 3, -- NamedElement::clientDependency
297 => 14, -- Classifier::collaborationUse
401 => 4, -- Namespace::elementImport
298 => 15, -- Classifier::feature
299 => 16, -- Classifier::general
300 => 17, -- Classifier::generalization
402 => 5, -- Namespace::importedMember
301 => 18, -- Classifier::inheritedMember
403 => 6, -- Namespace::member
347 => 1, -- Element::ownedComment
348 => 2, -- Element::ownedElement
404 => 7, -- Namespace::ownedMember
405 => 8, -- Namespace::ownedRule
302 => 19, -- Classifier::ownedUseCase
406 => 9, -- Namespace::packageImport
303 => 20, -- Classifier::powertypeExtent
304 => 21, -- Classifier::redefinedClassifier
439 => 11, -- RedefinableElement::redefinedElement
440 => 12, -- RedefinableElement::redefinitionContext
305 => 22, -- Classifier::substitution
472 => 10, -- TemplateableElement::templateBinding
306 => 23, -- Classifier::useCase
others => 0),
AMF.Internals.Tables.OCL_Types.E_OCL_Null_Literal_Exp =>
(400 => 3, -- NamedElement::clientDependency
347 => 1, -- Element::ownedComment
348 => 2, -- Element::ownedElement
others => 0),
AMF.Internals.Tables.OCL_Types.E_OCL_Operation_Call_Exp =>
(400 => 3, -- NamedElement::clientDependency
347 => 1, -- Element::ownedComment
348 => 2, -- Element::ownedElement
others => 0),
AMF.Internals.Tables.OCL_Types.E_OCL_Ordered_Set_Type =>
(296 => 13, -- Classifier::attribute
400 => 3, -- NamedElement::clientDependency
297 => 14, -- Classifier::collaborationUse
401 => 4, -- Namespace::elementImport
298 => 15, -- Classifier::feature
299 => 16, -- Classifier::general
300 => 17, -- Classifier::generalization
402 => 5, -- Namespace::importedMember
301 => 18, -- Classifier::inheritedMember
403 => 6, -- Namespace::member
334 => 24, -- DataType::ownedAttribute
347 => 1, -- Element::ownedComment
348 => 2, -- Element::ownedElement
404 => 7, -- Namespace::ownedMember
335 => 25, -- DataType::ownedOperation
405 => 8, -- Namespace::ownedRule
302 => 19, -- Classifier::ownedUseCase
406 => 9, -- Namespace::packageImport
303 => 20, -- Classifier::powertypeExtent
304 => 21, -- Classifier::redefinedClassifier
439 => 11, -- RedefinableElement::redefinedElement
440 => 12, -- RedefinableElement::redefinitionContext
305 => 22, -- Classifier::substitution
472 => 10, -- TemplateableElement::templateBinding
306 => 23, -- Classifier::useCase
others => 0),
AMF.Internals.Tables.OCL_Types.E_OCL_Property_Call_Exp =>
(400 => 3, -- NamedElement::clientDependency
347 => 1, -- Element::ownedComment
348 => 2, -- Element::ownedElement
others => 0),
AMF.Internals.Tables.OCL_Types.E_OCL_Real_Literal_Exp =>
(400 => 3, -- NamedElement::clientDependency
347 => 1, -- Element::ownedComment
348 => 2, -- Element::ownedElement
others => 0),
AMF.Internals.Tables.OCL_Types.E_OCL_Sequence_Type =>
(296 => 13, -- Classifier::attribute
400 => 3, -- NamedElement::clientDependency
297 => 14, -- Classifier::collaborationUse
401 => 4, -- Namespace::elementImport
298 => 15, -- Classifier::feature
299 => 16, -- Classifier::general
300 => 17, -- Classifier::generalization
402 => 5, -- Namespace::importedMember
301 => 18, -- Classifier::inheritedMember
403 => 6, -- Namespace::member
334 => 24, -- DataType::ownedAttribute
347 => 1, -- Element::ownedComment
348 => 2, -- Element::ownedElement
404 => 7, -- Namespace::ownedMember
335 => 25, -- DataType::ownedOperation
405 => 8, -- Namespace::ownedRule
302 => 19, -- Classifier::ownedUseCase
406 => 9, -- Namespace::packageImport
303 => 20, -- Classifier::powertypeExtent
304 => 21, -- Classifier::redefinedClassifier
439 => 11, -- RedefinableElement::redefinedElement
440 => 12, -- RedefinableElement::redefinitionContext
305 => 22, -- Classifier::substitution
472 => 10, -- TemplateableElement::templateBinding
306 => 23, -- Classifier::useCase
others => 0),
AMF.Internals.Tables.OCL_Types.E_OCL_Set_Type =>
(296 => 13, -- Classifier::attribute
400 => 3, -- NamedElement::clientDependency
297 => 14, -- Classifier::collaborationUse
401 => 4, -- Namespace::elementImport
298 => 15, -- Classifier::feature
299 => 16, -- Classifier::general
300 => 17, -- Classifier::generalization
402 => 5, -- Namespace::importedMember
301 => 18, -- Classifier::inheritedMember
403 => 6, -- Namespace::member
334 => 24, -- DataType::ownedAttribute
347 => 1, -- Element::ownedComment
348 => 2, -- Element::ownedElement
404 => 7, -- Namespace::ownedMember
335 => 25, -- DataType::ownedOperation
405 => 8, -- Namespace::ownedRule
302 => 19, -- Classifier::ownedUseCase
406 => 9, -- Namespace::packageImport
303 => 20, -- Classifier::powertypeExtent
304 => 21, -- Classifier::redefinedClassifier
439 => 11, -- RedefinableElement::redefinedElement
440 => 12, -- RedefinableElement::redefinitionContext
305 => 22, -- Classifier::substitution
472 => 10, -- TemplateableElement::templateBinding
306 => 23, -- Classifier::useCase
others => 0),
AMF.Internals.Tables.OCL_Types.E_OCL_State_Exp =>
(400 => 3, -- NamedElement::clientDependency
347 => 1, -- Element::ownedComment
348 => 2, -- Element::ownedElement
others => 0),
AMF.Internals.Tables.OCL_Types.E_OCL_String_Literal_Exp =>
(400 => 3, -- NamedElement::clientDependency
347 => 1, -- Element::ownedComment
348 => 2, -- Element::ownedElement
others => 0),
AMF.Internals.Tables.OCL_Types.E_OCL_Template_Parameter_Type =>
(296 => 13, -- Classifier::attribute
400 => 3, -- NamedElement::clientDependency
297 => 14, -- Classifier::collaborationUse
401 => 4, -- Namespace::elementImport
298 => 15, -- Classifier::feature
299 => 16, -- Classifier::general
300 => 17, -- Classifier::generalization
402 => 5, -- Namespace::importedMember
301 => 18, -- Classifier::inheritedMember
403 => 6, -- Namespace::member
347 => 1, -- Element::ownedComment
348 => 2, -- Element::ownedElement
404 => 7, -- Namespace::ownedMember
405 => 8, -- Namespace::ownedRule
302 => 19, -- Classifier::ownedUseCase
406 => 9, -- Namespace::packageImport
303 => 20, -- Classifier::powertypeExtent
304 => 21, -- Classifier::redefinedClassifier
439 => 11, -- RedefinableElement::redefinedElement
440 => 12, -- RedefinableElement::redefinitionContext
305 => 22, -- Classifier::substitution
472 => 10, -- TemplateableElement::templateBinding
306 => 23, -- Classifier::useCase
others => 0),
AMF.Internals.Tables.OCL_Types.E_OCL_Tuple_Literal_Exp =>
(400 => 3, -- NamedElement::clientDependency
347 => 1, -- Element::ownedComment
348 => 2, -- Element::ownedElement
others => 0),
AMF.Internals.Tables.OCL_Types.E_OCL_Tuple_Literal_Part =>
(400 => 3, -- NamedElement::clientDependency
347 => 1, -- Element::ownedComment
348 => 2, -- Element::ownedElement
others => 0),
AMF.Internals.Tables.OCL_Types.E_OCL_Tuple_Type =>
(296 => 13, -- Classifier::attribute
400 => 3, -- NamedElement::clientDependency
297 => 14, -- Classifier::collaborationUse
401 => 4, -- Namespace::elementImport
298 => 15, -- Classifier::feature
299 => 16, -- Classifier::general
300 => 17, -- Classifier::generalization
402 => 5, -- Namespace::importedMember
301 => 18, -- Classifier::inheritedMember
403 => 6, -- Namespace::member
334 => 24, -- DataType::ownedAttribute
347 => 1, -- Element::ownedComment
348 => 2, -- Element::ownedElement
404 => 7, -- Namespace::ownedMember
335 => 25, -- DataType::ownedOperation
405 => 8, -- Namespace::ownedRule
302 => 19, -- Classifier::ownedUseCase
406 => 9, -- Namespace::packageImport
303 => 20, -- Classifier::powertypeExtent
304 => 21, -- Classifier::redefinedClassifier
439 => 11, -- RedefinableElement::redefinedElement
440 => 12, -- RedefinableElement::redefinitionContext
305 => 22, -- Classifier::substitution
472 => 10, -- TemplateableElement::templateBinding
306 => 23, -- Classifier::useCase
others => 0),
AMF.Internals.Tables.OCL_Types.E_OCL_Type_Exp =>
(400 => 3, -- NamedElement::clientDependency
347 => 1, -- Element::ownedComment
348 => 2, -- Element::ownedElement
others => 0),
AMF.Internals.Tables.OCL_Types.E_OCL_Unlimited_Natural_Literal_Exp =>
(400 => 3, -- NamedElement::clientDependency
347 => 1, -- Element::ownedComment
348 => 2, -- Element::ownedElement
others => 0),
AMF.Internals.Tables.OCL_Types.E_OCL_Unspecified_Value_Exp =>
(400 => 3, -- NamedElement::clientDependency
347 => 1, -- Element::ownedComment
348 => 2, -- Element::ownedElement
others => 0),
AMF.Internals.Tables.OCL_Types.E_OCL_Variable =>
(400 => 3, -- NamedElement::clientDependency
347 => 1, -- Element::ownedComment
348 => 2, -- Element::ownedElement
others => 0),
AMF.Internals.Tables.OCL_Types.E_OCL_Variable_Exp =>
(400 => 3, -- NamedElement::clientDependency
347 => 1, -- Element::ownedComment
348 => 2, -- Element::ownedElement
others => 0),
AMF.Internals.Tables.OCL_Types.E_OCL_Void_Type =>
(296 => 13, -- Classifier::attribute
400 => 3, -- NamedElement::clientDependency
297 => 14, -- Classifier::collaborationUse
401 => 4, -- Namespace::elementImport
298 => 15, -- Classifier::feature
299 => 16, -- Classifier::general
300 => 17, -- Classifier::generalization
402 => 5, -- Namespace::importedMember
301 => 18, -- Classifier::inheritedMember
403 => 6, -- Namespace::member
347 => 1, -- Element::ownedComment
348 => 2, -- Element::ownedElement
404 => 7, -- Namespace::ownedMember
405 => 8, -- Namespace::ownedRule
302 => 19, -- Classifier::ownedUseCase
406 => 9, -- Namespace::packageImport
303 => 20, -- Classifier::powertypeExtent
304 => 21, -- Classifier::redefinedClassifier
439 => 11, -- RedefinableElement::redefinedElement
440 => 12, -- RedefinableElement::redefinitionContext
305 => 22, -- Classifier::substitution
472 => 10, -- TemplateableElement::templateBinding
306 => 23, -- Classifier::useCase
others => 0));
UML_Member_Offset : constant
array (AMF.Internals.Tables.OCL_Types.Element_Kinds,
AMF.Internals.CMOF_Element range 483 .. 866) of Natural :=
(AMF.Internals.Tables.OCL_Types.E_None =>
(others => 0),
AMF.Internals.Tables.OCL_Types.E_OCL_Any_Type =>
(530 => 12, -- Classifier::isAbstract
531 => 13, -- Classifier::isFinalSpecialization
772 => 11, -- RedefinableElement::isLeaf
669 => 2, -- NamedElement::name
670 => 3, -- NamedElement::nameExpression
671 => 4, -- NamedElement::namespace
532 => 14, -- Classifier::ownedTemplateSignature
831 => 10, -- TemplateableElement::ownedTemplateSignature
577 => 1, -- Element::owner
718 => 8, -- ParameterableElement::owningTemplateParameter
853 => 7, -- Type::package
672 => 5, -- NamedElement::qualifiedName
533 => 15, -- Classifier::representation
534 => 16, -- Classifier::templateParameter
719 => 9, -- ParameterableElement::templateParameter
673 => 6, -- NamedElement::visibility
710 => 6, -- PackageableElement::visibility
others => 0),
AMF.Internals.Tables.OCL_Types.E_OCL_Association_Class_Call_Exp =>
(669 => 2, -- NamedElement::name
670 => 3, -- NamedElement::nameExpression
671 => 4, -- NamedElement::namespace
577 => 1, -- Element::owner
672 => 5, -- NamedElement::qualifiedName
854 => 7, -- TypedElement::type
673 => 6, -- NamedElement::visibility
others => 0),
AMF.Internals.Tables.OCL_Types.E_OCL_Bag_Type =>
(530 => 12, -- Classifier::isAbstract
531 => 13, -- Classifier::isFinalSpecialization
772 => 11, -- RedefinableElement::isLeaf
669 => 2, -- NamedElement::name
670 => 3, -- NamedElement::nameExpression
671 => 4, -- NamedElement::namespace
532 => 14, -- Classifier::ownedTemplateSignature
831 => 10, -- TemplateableElement::ownedTemplateSignature
577 => 1, -- Element::owner
718 => 8, -- ParameterableElement::owningTemplateParameter
853 => 7, -- Type::package
672 => 5, -- NamedElement::qualifiedName
533 => 15, -- Classifier::representation
534 => 16, -- Classifier::templateParameter
719 => 9, -- ParameterableElement::templateParameter
673 => 6, -- NamedElement::visibility
710 => 6, -- PackageableElement::visibility
others => 0),
AMF.Internals.Tables.OCL_Types.E_OCL_Boolean_Literal_Exp =>
(669 => 2, -- NamedElement::name
670 => 3, -- NamedElement::nameExpression
671 => 4, -- NamedElement::namespace
577 => 1, -- Element::owner
672 => 5, -- NamedElement::qualifiedName
854 => 7, -- TypedElement::type
673 => 6, -- NamedElement::visibility
others => 0),
AMF.Internals.Tables.OCL_Types.E_OCL_Collection_Item =>
(669 => 2, -- NamedElement::name
670 => 3, -- NamedElement::nameExpression
671 => 4, -- NamedElement::namespace
577 => 1, -- Element::owner
672 => 5, -- NamedElement::qualifiedName
854 => 7, -- TypedElement::type
673 => 6, -- NamedElement::visibility
others => 0),
AMF.Internals.Tables.OCL_Types.E_OCL_Collection_Literal_Exp =>
(669 => 2, -- NamedElement::name
670 => 3, -- NamedElement::nameExpression
671 => 4, -- NamedElement::namespace
577 => 1, -- Element::owner
672 => 5, -- NamedElement::qualifiedName
854 => 7, -- TypedElement::type
673 => 6, -- NamedElement::visibility
others => 0),
AMF.Internals.Tables.OCL_Types.E_OCL_Collection_Range =>
(669 => 2, -- NamedElement::name
670 => 3, -- NamedElement::nameExpression
671 => 4, -- NamedElement::namespace
577 => 1, -- Element::owner
672 => 5, -- NamedElement::qualifiedName
854 => 7, -- TypedElement::type
673 => 6, -- NamedElement::visibility
others => 0),
AMF.Internals.Tables.OCL_Types.E_OCL_Collection_Type =>
(530 => 12, -- Classifier::isAbstract
531 => 13, -- Classifier::isFinalSpecialization
772 => 11, -- RedefinableElement::isLeaf
669 => 2, -- NamedElement::name
670 => 3, -- NamedElement::nameExpression
671 => 4, -- NamedElement::namespace
532 => 14, -- Classifier::ownedTemplateSignature
831 => 10, -- TemplateableElement::ownedTemplateSignature
577 => 1, -- Element::owner
718 => 8, -- ParameterableElement::owningTemplateParameter
853 => 7, -- Type::package
672 => 5, -- NamedElement::qualifiedName
533 => 15, -- Classifier::representation
534 => 16, -- Classifier::templateParameter
719 => 9, -- ParameterableElement::templateParameter
673 => 6, -- NamedElement::visibility
710 => 6, -- PackageableElement::visibility
others => 0),
AMF.Internals.Tables.OCL_Types.E_OCL_Enum_Literal_Exp =>
(669 => 2, -- NamedElement::name
670 => 3, -- NamedElement::nameExpression
671 => 4, -- NamedElement::namespace
577 => 1, -- Element::owner
672 => 5, -- NamedElement::qualifiedName
854 => 7, -- TypedElement::type
673 => 6, -- NamedElement::visibility
others => 0),
AMF.Internals.Tables.OCL_Types.E_OCL_Expression_In_Ocl =>
(687 => 10, -- OpaqueExpression::behavior
688 => 11, -- OpaqueExpression::body
689 => 12, -- OpaqueExpression::language
669 => 2, -- NamedElement::name
670 => 3, -- NamedElement::nameExpression
671 => 4, -- NamedElement::namespace
577 => 1, -- Element::owner
718 => 8, -- ParameterableElement::owningTemplateParameter
672 => 5, -- NamedElement::qualifiedName
690 => 13, -- OpaqueExpression::result
719 => 9, -- ParameterableElement::templateParameter
854 => 7, -- TypedElement::type
673 => 6, -- NamedElement::visibility
710 => 6, -- PackageableElement::visibility
others => 0),
AMF.Internals.Tables.OCL_Types.E_OCL_If_Exp =>
(669 => 2, -- NamedElement::name
670 => 3, -- NamedElement::nameExpression
671 => 4, -- NamedElement::namespace
577 => 1, -- Element::owner
672 => 5, -- NamedElement::qualifiedName
854 => 7, -- TypedElement::type
673 => 6, -- NamedElement::visibility
others => 0),
AMF.Internals.Tables.OCL_Types.E_OCL_Integer_Literal_Exp =>
(669 => 2, -- NamedElement::name
670 => 3, -- NamedElement::nameExpression
671 => 4, -- NamedElement::namespace
577 => 1, -- Element::owner
672 => 5, -- NamedElement::qualifiedName
854 => 7, -- TypedElement::type
673 => 6, -- NamedElement::visibility
others => 0),
AMF.Internals.Tables.OCL_Types.E_OCL_Invalid_Literal_Exp =>
(669 => 2, -- NamedElement::name
670 => 3, -- NamedElement::nameExpression
671 => 4, -- NamedElement::namespace
577 => 1, -- Element::owner
672 => 5, -- NamedElement::qualifiedName
854 => 7, -- TypedElement::type
673 => 6, -- NamedElement::visibility
others => 0),
AMF.Internals.Tables.OCL_Types.E_OCL_Invalid_Type =>
(530 => 12, -- Classifier::isAbstract
531 => 13, -- Classifier::isFinalSpecialization
772 => 11, -- RedefinableElement::isLeaf
669 => 2, -- NamedElement::name
670 => 3, -- NamedElement::nameExpression
671 => 4, -- NamedElement::namespace
532 => 14, -- Classifier::ownedTemplateSignature
831 => 10, -- TemplateableElement::ownedTemplateSignature
577 => 1, -- Element::owner
718 => 8, -- ParameterableElement::owningTemplateParameter
853 => 7, -- Type::package
672 => 5, -- NamedElement::qualifiedName
533 => 15, -- Classifier::representation
534 => 16, -- Classifier::templateParameter
719 => 9, -- ParameterableElement::templateParameter
673 => 6, -- NamedElement::visibility
710 => 6, -- PackageableElement::visibility
others => 0),
AMF.Internals.Tables.OCL_Types.E_OCL_Iterate_Exp =>
(669 => 2, -- NamedElement::name
670 => 3, -- NamedElement::nameExpression
671 => 4, -- NamedElement::namespace
577 => 1, -- Element::owner
672 => 5, -- NamedElement::qualifiedName
854 => 7, -- TypedElement::type
673 => 6, -- NamedElement::visibility
others => 0),
AMF.Internals.Tables.OCL_Types.E_OCL_Iterator_Exp =>
(669 => 2, -- NamedElement::name
670 => 3, -- NamedElement::nameExpression
671 => 4, -- NamedElement::namespace
577 => 1, -- Element::owner
672 => 5, -- NamedElement::qualifiedName
854 => 7, -- TypedElement::type
673 => 6, -- NamedElement::visibility
others => 0),
AMF.Internals.Tables.OCL_Types.E_OCL_Let_Exp =>
(669 => 2, -- NamedElement::name
670 => 3, -- NamedElement::nameExpression
671 => 4, -- NamedElement::namespace
577 => 1, -- Element::owner
672 => 5, -- NamedElement::qualifiedName
854 => 7, -- TypedElement::type
673 => 6, -- NamedElement::visibility
others => 0),
AMF.Internals.Tables.OCL_Types.E_OCL_Message_Exp =>
(669 => 2, -- NamedElement::name
670 => 3, -- NamedElement::nameExpression
671 => 4, -- NamedElement::namespace
577 => 1, -- Element::owner
672 => 5, -- NamedElement::qualifiedName
854 => 7, -- TypedElement::type
673 => 6, -- NamedElement::visibility
others => 0),
AMF.Internals.Tables.OCL_Types.E_OCL_Message_Type =>
(530 => 12, -- Classifier::isAbstract
531 => 13, -- Classifier::isFinalSpecialization
772 => 11, -- RedefinableElement::isLeaf
669 => 2, -- NamedElement::name
670 => 3, -- NamedElement::nameExpression
671 => 4, -- NamedElement::namespace
532 => 14, -- Classifier::ownedTemplateSignature
831 => 10, -- TemplateableElement::ownedTemplateSignature
577 => 1, -- Element::owner
718 => 8, -- ParameterableElement::owningTemplateParameter
853 => 7, -- Type::package
672 => 5, -- NamedElement::qualifiedName
533 => 15, -- Classifier::representation
534 => 16, -- Classifier::templateParameter
719 => 9, -- ParameterableElement::templateParameter
673 => 6, -- NamedElement::visibility
710 => 6, -- PackageableElement::visibility
others => 0),
AMF.Internals.Tables.OCL_Types.E_OCL_Null_Literal_Exp =>
(669 => 2, -- NamedElement::name
670 => 3, -- NamedElement::nameExpression
671 => 4, -- NamedElement::namespace
577 => 1, -- Element::owner
672 => 5, -- NamedElement::qualifiedName
854 => 7, -- TypedElement::type
673 => 6, -- NamedElement::visibility
others => 0),
AMF.Internals.Tables.OCL_Types.E_OCL_Operation_Call_Exp =>
(669 => 2, -- NamedElement::name
670 => 3, -- NamedElement::nameExpression
671 => 4, -- NamedElement::namespace
577 => 1, -- Element::owner
672 => 5, -- NamedElement::qualifiedName
854 => 7, -- TypedElement::type
673 => 6, -- NamedElement::visibility
others => 0),
AMF.Internals.Tables.OCL_Types.E_OCL_Ordered_Set_Type =>
(530 => 12, -- Classifier::isAbstract
531 => 13, -- Classifier::isFinalSpecialization
772 => 11, -- RedefinableElement::isLeaf
669 => 2, -- NamedElement::name
670 => 3, -- NamedElement::nameExpression
671 => 4, -- NamedElement::namespace
532 => 14, -- Classifier::ownedTemplateSignature
831 => 10, -- TemplateableElement::ownedTemplateSignature
577 => 1, -- Element::owner
718 => 8, -- ParameterableElement::owningTemplateParameter
853 => 7, -- Type::package
672 => 5, -- NamedElement::qualifiedName
533 => 15, -- Classifier::representation
534 => 16, -- Classifier::templateParameter
719 => 9, -- ParameterableElement::templateParameter
673 => 6, -- NamedElement::visibility
710 => 6, -- PackageableElement::visibility
others => 0),
AMF.Internals.Tables.OCL_Types.E_OCL_Property_Call_Exp =>
(669 => 2, -- NamedElement::name
670 => 3, -- NamedElement::nameExpression
671 => 4, -- NamedElement::namespace
577 => 1, -- Element::owner
672 => 5, -- NamedElement::qualifiedName
854 => 7, -- TypedElement::type
673 => 6, -- NamedElement::visibility
others => 0),
AMF.Internals.Tables.OCL_Types.E_OCL_Real_Literal_Exp =>
(669 => 2, -- NamedElement::name
670 => 3, -- NamedElement::nameExpression
671 => 4, -- NamedElement::namespace
577 => 1, -- Element::owner
672 => 5, -- NamedElement::qualifiedName
854 => 7, -- TypedElement::type
673 => 6, -- NamedElement::visibility
others => 0),
AMF.Internals.Tables.OCL_Types.E_OCL_Sequence_Type =>
(530 => 12, -- Classifier::isAbstract
531 => 13, -- Classifier::isFinalSpecialization
772 => 11, -- RedefinableElement::isLeaf
669 => 2, -- NamedElement::name
670 => 3, -- NamedElement::nameExpression
671 => 4, -- NamedElement::namespace
532 => 14, -- Classifier::ownedTemplateSignature
831 => 10, -- TemplateableElement::ownedTemplateSignature
577 => 1, -- Element::owner
718 => 8, -- ParameterableElement::owningTemplateParameter
853 => 7, -- Type::package
672 => 5, -- NamedElement::qualifiedName
533 => 15, -- Classifier::representation
534 => 16, -- Classifier::templateParameter
719 => 9, -- ParameterableElement::templateParameter
673 => 6, -- NamedElement::visibility
710 => 6, -- PackageableElement::visibility
others => 0),
AMF.Internals.Tables.OCL_Types.E_OCL_Set_Type =>
(530 => 12, -- Classifier::isAbstract
531 => 13, -- Classifier::isFinalSpecialization
772 => 11, -- RedefinableElement::isLeaf
669 => 2, -- NamedElement::name
670 => 3, -- NamedElement::nameExpression
671 => 4, -- NamedElement::namespace
532 => 14, -- Classifier::ownedTemplateSignature
831 => 10, -- TemplateableElement::ownedTemplateSignature
577 => 1, -- Element::owner
718 => 8, -- ParameterableElement::owningTemplateParameter
853 => 7, -- Type::package
672 => 5, -- NamedElement::qualifiedName
533 => 15, -- Classifier::representation
534 => 16, -- Classifier::templateParameter
719 => 9, -- ParameterableElement::templateParameter
673 => 6, -- NamedElement::visibility
710 => 6, -- PackageableElement::visibility
others => 0),
AMF.Internals.Tables.OCL_Types.E_OCL_State_Exp =>
(669 => 2, -- NamedElement::name
670 => 3, -- NamedElement::nameExpression
671 => 4, -- NamedElement::namespace
577 => 1, -- Element::owner
672 => 5, -- NamedElement::qualifiedName
854 => 7, -- TypedElement::type
673 => 6, -- NamedElement::visibility
others => 0),
AMF.Internals.Tables.OCL_Types.E_OCL_String_Literal_Exp =>
(669 => 2, -- NamedElement::name
670 => 3, -- NamedElement::nameExpression
671 => 4, -- NamedElement::namespace
577 => 1, -- Element::owner
672 => 5, -- NamedElement::qualifiedName
854 => 7, -- TypedElement::type
673 => 6, -- NamedElement::visibility
others => 0),
AMF.Internals.Tables.OCL_Types.E_OCL_Template_Parameter_Type =>
(530 => 12, -- Classifier::isAbstract
531 => 13, -- Classifier::isFinalSpecialization
772 => 11, -- RedefinableElement::isLeaf
669 => 2, -- NamedElement::name
670 => 3, -- NamedElement::nameExpression
671 => 4, -- NamedElement::namespace
532 => 14, -- Classifier::ownedTemplateSignature
831 => 10, -- TemplateableElement::ownedTemplateSignature
577 => 1, -- Element::owner
718 => 8, -- ParameterableElement::owningTemplateParameter
853 => 7, -- Type::package
672 => 5, -- NamedElement::qualifiedName
533 => 15, -- Classifier::representation
534 => 16, -- Classifier::templateParameter
719 => 9, -- ParameterableElement::templateParameter
673 => 6, -- NamedElement::visibility
710 => 6, -- PackageableElement::visibility
others => 0),
AMF.Internals.Tables.OCL_Types.E_OCL_Tuple_Literal_Exp =>
(669 => 2, -- NamedElement::name
670 => 3, -- NamedElement::nameExpression
671 => 4, -- NamedElement::namespace
577 => 1, -- Element::owner
672 => 5, -- NamedElement::qualifiedName
854 => 7, -- TypedElement::type
673 => 6, -- NamedElement::visibility
others => 0),
AMF.Internals.Tables.OCL_Types.E_OCL_Tuple_Literal_Part =>
(669 => 2, -- NamedElement::name
670 => 3, -- NamedElement::nameExpression
671 => 4, -- NamedElement::namespace
577 => 1, -- Element::owner
672 => 5, -- NamedElement::qualifiedName
854 => 7, -- TypedElement::type
673 => 6, -- NamedElement::visibility
others => 0),
AMF.Internals.Tables.OCL_Types.E_OCL_Tuple_Type =>
(530 => 12, -- Classifier::isAbstract
531 => 13, -- Classifier::isFinalSpecialization
772 => 11, -- RedefinableElement::isLeaf
669 => 2, -- NamedElement::name
670 => 3, -- NamedElement::nameExpression
671 => 4, -- NamedElement::namespace
532 => 14, -- Classifier::ownedTemplateSignature
831 => 10, -- TemplateableElement::ownedTemplateSignature
577 => 1, -- Element::owner
718 => 8, -- ParameterableElement::owningTemplateParameter
853 => 7, -- Type::package
672 => 5, -- NamedElement::qualifiedName
533 => 15, -- Classifier::representation
534 => 16, -- Classifier::templateParameter
719 => 9, -- ParameterableElement::templateParameter
673 => 6, -- NamedElement::visibility
710 => 6, -- PackageableElement::visibility
others => 0),
AMF.Internals.Tables.OCL_Types.E_OCL_Type_Exp =>
(669 => 2, -- NamedElement::name
670 => 3, -- NamedElement::nameExpression
671 => 4, -- NamedElement::namespace
577 => 1, -- Element::owner
672 => 5, -- NamedElement::qualifiedName
854 => 7, -- TypedElement::type
673 => 6, -- NamedElement::visibility
others => 0),
AMF.Internals.Tables.OCL_Types.E_OCL_Unlimited_Natural_Literal_Exp =>
(669 => 2, -- NamedElement::name
670 => 3, -- NamedElement::nameExpression
671 => 4, -- NamedElement::namespace
577 => 1, -- Element::owner
672 => 5, -- NamedElement::qualifiedName
854 => 7, -- TypedElement::type
673 => 6, -- NamedElement::visibility
others => 0),
AMF.Internals.Tables.OCL_Types.E_OCL_Unspecified_Value_Exp =>
(669 => 2, -- NamedElement::name
670 => 3, -- NamedElement::nameExpression
671 => 4, -- NamedElement::namespace
577 => 1, -- Element::owner
672 => 5, -- NamedElement::qualifiedName
854 => 7, -- TypedElement::type
673 => 6, -- NamedElement::visibility
others => 0),
AMF.Internals.Tables.OCL_Types.E_OCL_Variable =>
(669 => 2, -- NamedElement::name
670 => 3, -- NamedElement::nameExpression
671 => 4, -- NamedElement::namespace
577 => 1, -- Element::owner
672 => 5, -- NamedElement::qualifiedName
854 => 7, -- TypedElement::type
673 => 6, -- NamedElement::visibility
others => 0),
AMF.Internals.Tables.OCL_Types.E_OCL_Variable_Exp =>
(669 => 2, -- NamedElement::name
670 => 3, -- NamedElement::nameExpression
671 => 4, -- NamedElement::namespace
577 => 1, -- Element::owner
672 => 5, -- NamedElement::qualifiedName
854 => 7, -- TypedElement::type
673 => 6, -- NamedElement::visibility
others => 0),
AMF.Internals.Tables.OCL_Types.E_OCL_Void_Type =>
(530 => 12, -- Classifier::isAbstract
531 => 13, -- Classifier::isFinalSpecialization
772 => 11, -- RedefinableElement::isLeaf
669 => 2, -- NamedElement::name
670 => 3, -- NamedElement::nameExpression
671 => 4, -- NamedElement::namespace
532 => 14, -- Classifier::ownedTemplateSignature
831 => 10, -- TemplateableElement::ownedTemplateSignature
577 => 1, -- Element::owner
718 => 8, -- ParameterableElement::owningTemplateParameter
853 => 7, -- Type::package
672 => 5, -- NamedElement::qualifiedName
533 => 15, -- Classifier::representation
534 => 16, -- Classifier::templateParameter
719 => 9, -- ParameterableElement::templateParameter
673 => 6, -- NamedElement::visibility
710 => 6, -- PackageableElement::visibility
others => 0));
end AMF.Internals.Tables.OCL_Attribute_Mappings;
|
with Person_Handling; use Person_Handling;
package Person_Sorted_List is
CANTFIND_ERROR: exception;
type List_Type is private;
function Empty(List: List_Type)
return Boolean;
function Member(List: List_Type; Search: Person)
return Boolean;
function Find(List: List_Type; Search: Person)
return Person;
function Length(List: List_Type)
return Integer;
procedure Insert(List: in out List_Type; Data: in Person);
procedure Put(List: in List_Type);
procedure Remove(List: in out List_Type; Search: in Person);
procedure Delete(List: in out List_Type);
procedure Find(List: in List_Type; Search: in Person; Data: out Person);
private
type Post;
type List_Type is
access Post;
type Post is
record
Data: Person;
Point: List_Type;
end record;
end Person_Sorted_List;
|
with Progress_Indicators.Work_Trackers;
package SP.Progress is
package PI renames Progress_Indicators;
task type Update_Progress (Work : access PI.Work_Trackers.Work_Tracker) with CPU => 1 is
entry Stop;
end Update_Progress;
end SP.Progress;
|
with AUnit;
with AUnit.Simple_Test_Cases;
package Remote_Node_Test is
type Test is new AUnit.Simple_Test_Cases.Test_Case with null record;
function Name (T : Test) return AUnit.Message_String;
procedure Run_Test (T : in out Test);
end Remote_Node_Test;
|
--------------------------------------------------------------------------------------------------------------------
-- Copyright (c) 2013-2020, Luke A. Guest
--
-- This software is provided 'as-is', without any express or implied
-- warranty. In no event will the authors be held liable for any damages
-- arising from the use of this software.
--
-- Permission is granted to anyone to use this software for any purpose,
-- including commercial applications, and to alter it and redistribute it
-- freely, subject to the following restrictions:
--
-- 1. The origin of this software must not be misrepresented; you must not
-- claim that you wrote the original software. If you use this software
-- in a product, an acknowledgment in the product documentation would be
-- appreciated but is not required.
--
-- 2. Altered source versions must be plainly marked as such, and must not be
-- misrepresented as being the original software.
--
-- 3. This notice may not be removed or altered from any source
-- distribution.
--------------------------------------------------------------------------------------------------------------------
-- SDL.Inputs.Joysticks
--------------------------------------------------------------------------------------------------------------------
with Ada.Finalization;
private with SDL.C_Pointers;
with SDL.Events.Joysticks;
package SDL.Inputs.Joysticks is
Joystick_Error : exception;
-- Use to determine whether there are no joysticks.
type All_Devices is range 0 .. 2 ** 31 - 1 with
Convention => C,
Size => 32;
-- This range is the range of all connected joysticks.
subtype Devices is All_Devices range All_Devices'First + 1 .. All_Devices'Last;
-- SDL_Joystick_ID = instance ID.
type Instances is range 0 .. 2 ** 31 - 1 with
Convention => C,
Size => 32;
type GUID_Element is range 0 .. 255 with
convention => C,
Size => 8;
type GUID_Array is array (1 .. 16) of aliased GUID_Element with
Convention => C;
-- Pack => True;
type GUIDs is
record
Data : GUID_Array;
end record with
Convention => C_Pass_By_Copy;
-- Device specific information.
function Total return All_Devices;
function Name (Device : in Devices) return String;
function GUID (Device : in Devices) return GUIDs;
-- GUID utilities.
function Image (GUID : in GUIDs) return String;
function Value (GUID : in String) return GUIDs;
-- Joysticks.
type Joystick is new Ada.Finalization.Limited_Controlled with private;
Null_Joystick : constant Joystick;
function "=" (Left, Right : in Joystick) return Boolean with
Inline => True;
procedure Close (Self : in out Joystick);
-- Information.
function Axes (Self : in Joystick) return SDL.Events.Joysticks.Axes;
function Balls (Self : in Joystick) return SDL.Events.Joysticks.Balls;
function Buttons (Self : in Joystick) return SDL.Events.Joysticks.Buttons;
function Hats (Self : in Joystick) return SDL.Events.Joysticks.Hats;
function Name (Self : in Joystick) return String;
function Is_Haptic (Self : in Joystick) return Boolean;
function Is_Attached (Self : in Joystick) return Boolean with
Inline => True;
function GUID (Self : in Joystick) return GUIDs with
Inline => True;
function Instance (Self : in Joystick) return Instances;
-- Data.
function Axis_Value (Self : in Joystick;
Axis : in SDL.Events.Joysticks.Axes) return SDL.Events.Joysticks.Axes_Values;
procedure Ball_Value (Self : in Joystick;
Ball : in SDL.Events.Joysticks.Balls;
Delta_X, Delta_Y : out SDL.Events.Joysticks.Ball_Values);
function Hat_Value (Self : in Joystick;
Hat : in SDL.Events.Joysticks.Hats) return SDL.Events.Joysticks.Hat_Positions;
function Is_Button_Pressed (Self : in Joystick; Button : in SDL.Events.Joysticks.Buttons)
return SDL.Events.Button_State;
private
type Joystick is new Ada.Finalization.Limited_Controlled with
record
Internal : SDL.C_Pointers.Joystick_Pointer := null;
Owns : Boolean := True;
end record;
Null_Joystick : constant Joystick := (Ada.Finalization.Limited_Controlled with Internal => null, Owns => True);
end SDL.Inputs.Joysticks;
|
-- A program for generating Luhn checksums with an Ada_GUI UI
-- An Ada_GUI demo program
--
-- Copyright (C) 2021 by PragmAda Software Ebgineering
-- Released under the terms of the BSD 3-Clause license; see https://opensource.org/licenses
--
with Ada.Exceptions;
with Ada.Text_IO;
with Ada_GUI;
procedure Luhn_Gen is
Input : Ada_GUI.Widget_ID;
Err : Ada_GUI.Widget_ID;
Checksum : Ada_GUI.Widget_ID;
Gen : Ada_GUI.Widget_ID;
Quit : Ada_GUI.Widget_ID;
procedure Generate;
Err_Msg : constant String := "Enter some digits";
procedure Generate is
subtype Digit is Character range '0' .. '9';
function Reversed (Value : String) return String;
-- Reverses Value.
function Squeezed (Value : String) return String;
-- Keeps the Digits of Value and discards any other characters.
function D2N (D : Digit) return Natural is (Character'Pos (D) - Character'Pos ('0') );
function Reversed (Value : String) return String is
Result : String (Value'Range);
Last : Natural := Value'Last;
begin -- Reversed
if Value = "" then
return "";
end if;
Swap : for First in Value'First .. Value'First + (Value'Length - 1) / 2 loop
Result (First) := Value (Last);
Result (Last) := Value (First);
Last := Last - 1;
end loop Swap;
return Result;
end Reversed;
function Squeezed (Value : String) return String is
Result : String (1 .. Value'Length);
Last : Natural := 0;
begin -- Squeezed
All_Chars : for I in Value'Range loop
if Value (I) in Digit then
Last := Last + 1;
Result (Last) := Value (I);
end if;
end loop All_Chars;
return Result (1 .. Last);
end Squeezed;
Forward : constant String := Input.Text;
Value : constant String := Squeezed (Reversed (Forward) );
Sum : Natural := 0;
D : Natural;
begin -- Generate
Err.Set_Text (Text => "");
Err.Set_Visibility (Visible => False);
Checksum.Set_Text (Text => "");
if Value'Length = 0 then
Err.Set_Visibility (Visible => True);
Err.Set_Text (Text => Err_Msg);
return;
end if;
All_Digits : for I in Value'Range loop
D := D2N (Value (I) );
if I rem 2 = 1 then
D := 2 * D;
if D > 9 then
D := D - 9;
end if;
end if;
Sum := Sum + D;
end loop All_Digits;
Checksum.Set_Text (Text => Integer'Image ( (9 * Sum) rem 10) );
exception -- Generate
when E : others =>
Ada.Text_IO.Put_Line (Item => "Generate: " & Ada.Exceptions.Exception_Information (E) );
end Generate;
Event : Ada_GUI.Next_Result_Info;
use type Ada_GUI.Event_Kind_ID;
use type Ada_GUI.Widget_ID;
begin -- Luhn_Gen
Ada_GUI.Set_Up (Title => "Luhn Checksum Generator");
Input := Ada_GUI.New_Text_Box (Label => "Input :", Placeholder => Err_Msg);
Err := Ada_GUI.New_Background_Text (Break_Before => True);
Err.Set_Foreground_Color (Color => Ada_GUI.To_Color (Ada_GUI.Red) );
Err.Set_Visibility (Visible => False);
Checksum := Ada_GUI.New_Text_Box (Label => "Checksum :", Break_Before => True);
Gen := Ada_GUI.New_Button (Text => "Generate", Break_Before => True);
Quit := Ada_GUI.New_Button (Text => "Quit", Break_Before => True);
All_Events : loop
Event := Ada_GUI.Next_Event (Timeout => 1.0);
if not Event.Timed_Out then
exit All_Events when Event.Event.Kind = Ada_GUI.Window_Closed;
if Event.Event.Kind = Ada_GUI.Left_Click then
if Event.Event.ID = Gen then
Generate;
end if;
exit All_Events when Event.Event.ID = Quit;
end if;
end if;
end loop All_Events;
Ada_GUI.End_GUI;
exception -- Luhn_Gen
when E : others =>
Ada.Text_IO.Put_Line (Item => Ada.Exceptions.Exception_Information (E) );
end Luhn_Gen;
--
-- This 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.
-- This software 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. 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.
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.