content
stringlengths 23
1.05M
|
|---|
pragma License (Unrestricted);
-- extended unit
package Ada.Strings.East_Asian_Width is
-- Unicode property "east asian width".
pragma Pure;
type Width_Kind is (
Neutral,
Narrow,
Half_Width,
Ambiguous,
Wide,
Full_Width);
function Kind (C : Wide_Wide_Character) return Width_Kind;
function Is_Full_Width (W : Width_Kind; East_Asian : Boolean)
return Boolean;
pragma Inline (Is_Full_Width);
end Ada.Strings.East_Asian_Width;
|
with Asis.Elements;
with Asis.Statements;
with Ada.Text_IO;
package body Asis_Adapter.Element.Statements is
------------
-- EXPORTED:
------------
procedure Do_Pre_Child_Processing
(Element : in Asis.Element; State : in out Class)
is
Parent_Name : constant String := Module_Name;
Module_Name : constant String := Parent_Name & ".Do_Pre_Child_Processing";
Result : a_nodes_h.Statement_Struct :=
a_nodes_h.Support.Default_Statement_Struct;
Statement_Kind : constant Asis.Statement_Kinds :=
Asis.Elements.Statement_Kind (Element);
-- Supporting procedures are in alphabetical order:
procedure Add_Aborted_Tasks is
begin
Add_Element_List
(This => State,
Elements_In => Asis.Statements.Aborted_Tasks (Element),
Dot_Label_Name => "Aborted_Tasks",
List_Out => Result.Aborted_Tasks,
Add_Edges => True);
end;
procedure Add_Accept_Body_Exception_Handlers is
begin
Add_Element_List
(This => State,
Elements_In => Asis.Statements.Accept_Body_Exception_Handlers (Element),
Dot_Label_Name => "Accept_Body_Exception_Handlers",
List_Out => Result.Accept_Body_Exception_Handlers,
Add_Edges => True);
end;
procedure Add_Accept_Body_Statements is
begin
Add_Element_List
(This => State,
Elements_In => Asis.Statements.Accept_Body_Statements (Element),
Dot_Label_Name => "Accept_Body_Statements",
List_Out => Result.Accept_Body_Statements,
Add_Edges => True);
end;
procedure Add_Accept_Entry_Direct_Name is
ID : constant a_nodes_h.Element_ID :=
Get_Element_ID (Asis.Statements.Accept_Entry_Direct_Name (Element));
begin
State.Add_To_Dot_Label_And_Edge ("Accept_Entry_Direct_Name", ID);
Result.Accept_Entry_Direct_Name := ID;
end;
procedure Add_Accept_Entry_Index is
ID : constant a_nodes_h.Element_ID :=
Get_Element_ID (Asis.Statements.Accept_Entry_Index (Element));
begin
State.Add_To_Dot_Label_And_Edge ("Accept_Entry_Index", ID);
Result.Accept_Entry_Index := ID;
end;
procedure Add_Accept_Parameters is
begin
Add_Element_List
(This => State,
Elements_In => Asis.Statements.Accept_Parameters (Element),
Dot_Label_Name => "Accept_Parameters",
List_Out => Result.Accept_Parameters,
Add_Edges => True);
end;
procedure Add_Assignment_Expression is
ID : constant a_nodes_h.Element_ID :=
Get_Element_ID (Asis.Statements.Assignment_Expression (Element));
begin
State.Add_To_Dot_Label_And_Edge ("Assignment_Expression", ID);
Result.Assignment_Expression := ID;
end;
procedure Add_Assignment_Variable_Name is
ID : constant a_nodes_h.Element_ID :=
Get_Element_ID (Asis.Statements.Assignment_Variable_Name (Element));
begin
State.Add_To_Dot_Label_And_Edge ("Assignment_Variable_Name", ID);
Result.Assignment_Variable_Name := ID;
end;
procedure Add_Associated_Message is
ID : constant a_nodes_h.Element_ID :=
Get_Element_ID (Asis.Statements.Associated_Message (Element));
begin
State.Add_To_Dot_Label_And_Edge ("Associated_Message", ID);
Result.Associated_Message := ID;
end;
procedure Add_Block_Declarative_Items is
begin
Add_Element_List
(This => State,
Elements_In => Asis.Statements.Block_Declarative_Items (Element),
Dot_Label_Name => "Block_Declarative_Items",
List_Out => Result.Block_Declarative_Items,
Add_Edges => True);
end;
procedure Add_Block_Exception_Handlers is begin
Add_Element_List
(This => State,
Elements_In => Asis.Statements.Block_Exception_Handlers (Element),
Dot_Label_Name => "Block_Exception_Handlers",
List_Out => Result.Block_Exception_Handlers,
Add_Edges => True);
end;
procedure Add_Block_Statements is
begin
Add_Element_List
(This => State,
Elements_In => Asis.Statements.Block_Statements (Element),
Dot_Label_Name => "Block_Statements",
List_Out => Result.Block_Statements,
Add_Edges => True);
end;
procedure Add_Call_Statement_Parameters is
begin
Add_Element_List
(This => State,
Elements_In => Asis.Statements.Call_Statement_Parameters (Element),
Dot_Label_Name => "Call_Statement_Parameters",
List_Out => Result.Call_Statement_Parameters,
Add_Edges => True);
end;
procedure Add_Called_Name is
ID : constant a_nodes_h.Element_ID :=
Get_Element_ID (Asis.Statements.Called_Name (Element));
begin
State.Add_To_Dot_Label_And_Edge ("Called_Name", ID);
Result.Called_Name := ID;
end;
procedure Add_Case_Expression is
ID : constant a_nodes_h.Element_ID :=
Get_Element_ID (Asis.Statements.Case_Expression (Element));
begin
State.Add_To_Dot_Label_And_Edge ("Case_Expression", ID);
Result.Case_Expression := ID;
end;
procedure Add_Corresponding_Called_Entity is
ID : constant a_nodes_h.Element_ID :=
Get_Element_ID (Asis.Statements.Corresponding_Called_Entity (Element));
begin
State.Add_To_Dot_Label ("Corresponding_Called_Entity", To_String (ID));
Result.Corresponding_Called_Entity := ID;
end;
procedure Add_Corresponding_Destination_Statement is
ID : constant a_nodes_h.Element_ID :=
Get_Element_ID (Asis.Statements.Corresponding_Destination_Statement(Element));
begin
State.Add_To_Dot_Label ("Corresponding_Destination_Statement", To_String (ID));
Result.Corresponding_Destination_Statement := ID;
end;
procedure Add_Corresponding_Entry is
ID : constant a_nodes_h.Element_ID :=
Get_Element_ID (Asis.Statements.Corresponding_Entry (Element));
begin
State.Add_To_Dot_Label ("Corresponding_Entry", To_String (ID));
Result.Corresponding_Entry := ID;
end;
procedure Add_Corresponding_Loop_Exited is
ID : constant a_nodes_h.Element_ID :=
Get_Element_ID (Asis.Statements.Corresponding_Loop_Exited (Element));
begin
State.Add_To_Dot_Label ("Corresponding_Loop_Exited", To_String (ID));
Result.Corresponding_Loop_Exited := ID;
end;
procedure Add_Delay_Expression is
ID : constant a_nodes_h.Element_ID :=
Get_Element_ID (Asis.Statements.Delay_Expression (Element));
begin
State.Add_To_Dot_Label_And_Edge ("Delay_Expression", ID);
Result.Delay_Expression := ID;
end;
procedure Add_Exit_Condition is
ID : constant a_nodes_h.Element_ID :=
Get_Element_ID (Asis.Statements.Exit_Condition (Element));
begin
State.Add_To_Dot_Label_And_Edge ("Exit_Condition", ID);
Result.Exit_Condition := ID;
end;
procedure Add_Exit_Loop_Name is
ID : constant a_nodes_h.Element_ID :=
Get_Element_ID (Asis.Statements.Exit_Loop_Name (Element));
begin
State.Add_To_Dot_Label_And_Edge ("Exit_Loop_Name", ID);
Result.Exit_Loop_Name := ID;
end;
procedure Add_For_Loop_Parameter_Specification is
ID : constant a_nodes_h.Element_ID :=
Get_Element_ID (Asis.Statements.For_Loop_Parameter_Specification (Element));
begin
State.Add_To_Dot_Label_And_Edge ("For_Loop_Parameter_Specification", ID);
Result.For_Loop_Parameter_Specification := ID;
end;
procedure Add_Goto_Label is
ID : constant a_nodes_h.Element_ID :=
Get_Element_ID (Asis.Statements.Goto_Label (Element));
begin
State.Add_To_Dot_Label_And_Edge ("Goto_Label", ID);
Result.Goto_Label := ID;
end;
procedure Add_Is_Declare_Block is
Value : constant Boolean := Asis.Statements.Is_Declare_Block (Element);
begin
State.Add_To_Dot_Label ("Is_Declare_Block", Value);
Result.Is_Declare_Block := a_nodes_h.Support.To_bool (Value);
end;
procedure Add_Is_Dispatching_Call is
Value : constant Boolean := Asis.Statements.Is_Dispatching_Call (Element);
begin
State.Add_To_Dot_Label ("Is_Dispatching_Call", Value);
Result.Is_Dispatching_Call := a_nodes_h.Support.To_bool (Value);
end;
procedure Add_Is_Call_On_Dispatching_Operation is
Value : constant Boolean := Asis.Statements.Is_Call_On_Dispatching_Operation (Element);
begin
State.Add_To_Dot_Label ("Is_Call_On_Dispatching_Operation", Value);
Result.Is_Call_On_Dispatching_Operation := a_nodes_h.Support.To_bool (Value);
end;
--In a declaration this says if the block name is repeated on the
--end line or not. e.g. end MyBlock;
procedure Add_Is_Name_Repeated is
Value : constant Boolean := Asis.Statements.Is_Name_Repeated (Element);
begin
State.Add_To_Dot_Label ("Is_Name_Repeated", Value);
Result.Is_Name_Repeated := a_nodes_h.Support.To_bool (Value);
end;
procedure Add_Label_Names is
begin
Add_Element_List
(This => State,
Elements_In => Asis.Statements.Label_Names (Element),
Dot_Label_Name => "Label_Names",
List_Out => Result.Label_Names,
Add_Edges => True);
end;
procedure Add_Loop_Statements is
begin
Add_Element_List
(This => State,
Elements_In => Asis.Statements.Loop_Statements (Element),
Dot_Label_Name => "Loop_Statements",
List_Out => Result.Loop_Statements,
Add_Edges => True);
end;
procedure Add_Qualified_Expression is
ID : constant a_nodes_h.Element_ID :=
Get_Element_ID (Asis.Statements.Qualified_Expression (Element));
begin
State.Add_To_Dot_Label_And_Edge ("Qualified_Expression", ID);
Result.Qualified_Expression := ID;
end;
procedure Add_Raised_Exception is
ID : constant a_nodes_h.Element_ID :=
Get_Element_ID (Asis.Statements.Raised_Exception (Element));
begin
State.Add_To_Dot_Label_And_Edge ("Raised_Exception", ID);
Result.Raised_Exception := ID;
end;
procedure Add_Requeue_Entry_Name is
ID : constant a_nodes_h.Element_ID :=
Get_Element_ID (Asis.Statements.Requeue_Entry_Name (Element));
begin
State.Add_To_Dot_Label_And_Edge ("Requeue_Entry_Name", ID);
Result.Requeue_Entry_Name := ID;
end;
procedure Add_Return_Expression is
ID : constant a_nodes_h.Element_ID :=
Get_Element_ID (Asis.Statements.Return_Expression (Element));
begin
State.Add_To_Dot_Label_And_Edge ("Return_Expression", ID);
Result.Return_Expression := ID;
end;
procedure Add_Statement_Identifier is
ID : constant a_nodes_h.Element_ID :=
Get_Element_ID (Asis.Statements.Statement_Identifier (Element));
begin
State.Add_To_Dot_Label_And_Edge ("Statement_Identifier", ID);
Result.Statement_Identifier := ID;
end;
procedure Add_Statement_Paths is
begin
Add_Element_List
(This => State,
Elements_In => Asis.Statements.Statement_Paths (Element),
Dot_Label_Name => "Statement_Paths",
List_Out => Result.Statement_Paths,
Add_Edges => True);
end;
procedure Add_While_Condition is
ID : constant a_nodes_h.Element_ID :=
Get_Element_ID (Asis.Statements.While_Condition (Element));
begin
State.Add_To_Dot_Label_And_Edge ("While_Condition", ID);
Result.While_Condition := ID;
end;
procedure Add_Common_Items is
begin
State.Add_To_Dot_Label ("Statement_Kind", Statement_Kind'Image);
Result.Statement_Kind := To_Statement_Kinds (Statement_Kind);
Add_Label_Names;
end Add_Common_Items;
procedure Add_Common_Loop_Items is
begin
Add_Statement_Identifier;
Add_Is_Name_Repeated;
Add_Loop_Statements;
end Add_Common_Loop_Items;
use all type Asis.Statement_Kinds;
begin
If Statement_Kind /= Not_A_Statement then
Add_Common_Items;
end if;
case Statement_Kind is
when Not_A_Statement =>
raise Program_Error with
Module_Name & " called with: " & Statement_Kind'Image;
when A_Null_Statement =>
null; -- No more info.
when An_Assignment_Statement =>
Add_Assignment_Variable_Name;
Add_Assignment_Expression;
when An_If_Statement =>
Add_Statement_Paths;
when A_Case_Statement =>
Add_Case_Expression;
Add_Statement_Paths;
when A_Loop_Statement =>
Add_Common_Loop_Items;
when A_While_Loop_Statement =>
Add_While_Condition;
Add_Common_Loop_Items;
when A_For_Loop_Statement =>
Add_For_Loop_Parameter_Specification;
Add_Common_Loop_Items;
when A_Block_Statement =>
Add_Statement_Identifier;
Add_Is_Name_Repeated;
Add_Is_Declare_Block;
Add_Block_Declarative_Items;
Add_Block_Statements;
Add_Block_Exception_Handlers;
when An_Exit_Statement =>
Add_Exit_Condition;
Add_Exit_Loop_Name;
Add_Corresponding_Loop_Exited;
when A_Goto_Statement =>
Add_Goto_Label;
Add_Corresponding_Destination_Statement;
when A_Procedure_Call_Statement =>
Add_Called_Name;
Add_Corresponding_Called_Entity;
Add_Call_Statement_Parameters;
Add_Is_Dispatching_Call;
Add_Is_Call_On_Dispatching_Operation;
when A_Return_Statement =>
Add_Return_Expression;
when An_Extended_Return_Statement => -- A2005
State.Add_Not_Implemented (Ada_2005);
when An_Accept_Statement =>
Add_Accept_Entry_Index;
Add_Accept_Entry_Direct_Name;
Add_Accept_Parameters;
Add_Accept_Body_Statements;
Add_Accept_Body_Exception_Handlers;
Add_Corresponding_Entry;
when An_Entry_Call_Statement =>
Add_Called_Name;
Add_Corresponding_Called_Entity;
Add_Call_Statement_Parameters;
when A_Requeue_Statement =>
Add_Requeue_Entry_Name;
when A_Requeue_Statement_With_Abort =>
Add_Requeue_Entry_Name;
when A_Delay_Until_Statement =>
Add_Delay_Expression;
when A_Delay_Relative_Statement =>
Add_Delay_Expression;
when A_Terminate_Alternative_Statement =>
null; -- No more info
when A_Selective_Accept_Statement =>
Add_Statement_Paths;
when A_Timed_Entry_Call_Statement =>
Add_Statement_Paths;
when A_Conditional_Entry_Call_Statement =>
Add_Statement_Paths;
when An_Asynchronous_Select_Statement =>
Add_Statement_Paths;
when An_Abort_Statement =>
Add_Aborted_Tasks;
when A_Raise_Statement =>
Add_Raised_Exception;
Add_Associated_Message;
when A_Code_Statement =>
Add_Qualified_Expression;
end case;
State.A_Element.Element_Kind := a_nodes_h.A_Statement;
State.A_Element.the_union.statement := Result;
end Do_Pre_Child_Processing;
end Asis_Adapter.Element.Statements;
|
------------------------------------------------------------------------------
-- --
-- GNAT EXAMPLE --
-- --
-- Copyright (C) 2013, 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 Interfaces; use Interfaces;
with Commands; use Commands;
with Console; use Console;
with Term; use Term;
with Dumps; use Dumps;
with System.Machine_Code; use System.Machine_Code;
pragma Warnings (Off);
with System.Text_IO;
pragma Warnings (On);
with Srec;
package body Mpc55xx is
procedure Disable_Watchdog is
begin
Set_Tcr (Get_Tcr and not 16#c01e_0000#);
end Disable_Watchdog;
function Field (V : Unsigned_32; F, L : Natural) return Unsigned_32 is
begin
return Shift_Right (V, 63 - L)
and Shift_Right (16#ffff_ffff#, 32 - (L - F + 1));
end Field;
procedure Put_Bit (V : Unsigned_32; F : Natural; Name : Character) is
begin
Put_Bit (Field (V, F, F) = 1, Name);
end Put_Bit;
procedure Proc_Cr is
begin
Put_Line ("PIR: " & Image8 (Get_Pir));
Put_Line ("PVR: " & Image8 (Get_Pvr));
Put_Line ("SVR: " & Image8 (Get_Svr));
Put_Line ("MSR: " & Image8 (Get_Msr));
New_Line;
Put_Line ("HID0: " & Image8 (Get_Hid0));
Put_Line ("HID1: " & Image8 (Get_Hid1));
end Proc_Cr;
procedure Set_L1csr0 (V : Unsigned_32) is
begin
Asm ("msync" & ASCII.LF & ASCII.HT &
"isync" & ASCII.LF & ASCII.HT &
"mtspr 1010,%0",
Inputs => Unsigned_32'Asm_Input ("r", V),
Volatile => True);
end Set_L1csr0;
procedure Proc_Cache is
begin
Next_Word;
if Line (Pos .. End_Pos) = "on" then
Put_Line ("Invalidating and enabling cache");
Set_L1csr0 (2#10#);
loop
exit when (Get_L1csr0 and 2#10#) = 0;
end loop;
if (Get_L1csr0 and 2#100#) /= 0 then
Put_Line ("cache operation aborted");
return;
end if;
Put_Line ("Enabling");
Set_L1csr0 (2#1#);
else
Put_Register
("L1CFG0", Get_L1cfg0,
"2:carch,cwpa,cfaha,cfiswa,2,2:cbsize,2:crepl," &
"cla,cpa,8:cnway,11:csize");
Put_Register
("L1CSR0", Get_L1csr0,
"4:wid,4:wdd,awid,awdd,1,cwm,dpb,dsb," &
"dstrm,cpe,5,cul,clo,clfr,5,cabt,cfi,ce");
end if;
end Proc_Cache;
procedure Proc_Timer is
begin
Put_Line ("TCR: " & Image8 (Get_Tcr));
Put_Line ("TSR: " & Image8 (Get_Tsr));
Put_Line ("TBU: " & Image8 (Get_Tbu) & " TBL: " & Image8 (Get_Tbl));
end Proc_Timer;
procedure Proc_Pll is
FMPLL_SYNCR : Unsigned_32;
for FMPLL_SYNCR'Address use System'To_Address (16#c3f8_0000#);
pragma Import (Ada, FMPLL_SYNCR);
pragma Volatile (FMPLL_SYNCR);
FMPLL_SYNSR : Unsigned_32;
for FMPLL_SYNSR'Address use System'To_Address (16#c3f8_0004#);
pragma Import (Ada, FMPLL_SYNSR);
pragma Volatile (FMPLL_SYNSR);
begin
Put_Line ("SYNCR: " & Image8 (FMPLL_SYNCR));
Put_Line ("SYNSR: " & Image8 (FMPLL_SYNSR));
end Proc_Pll;
procedure Proc_Tlb is
Val : Unsigned_32;
Npids : Unsigned_32;
Ntlbs : Unsigned_32;
Nent : Unsigned_32;
begin
Val := Get_Mmucfg;
Put_Line ("MMUCFG: " & Image8 (Val));
Npids := Field (Val, 49, 52);
Ntlbs := 1 + Field (Val, 60, 61);
Put ("NPIDS: " & Image8 (Npids));
Put (", PIDSIZE: " & Image8 (1 + Field (Val, 53, 57)));
Put (", NTLBS: " & Image8 (Ntlbs));
Put (", MAVN: " & Image8 (1 + Field (Val, 62, 63)));
New_Line;
Put ("PID0: " & Image8 (Get_Pid0));
if Npids > 1 then
Put (", PID1: " & Image8 (Get_Pid1));
if Npids > 2 then
Put (", PID2: " & Image8 (Get_Pid2));
end if;
end if;
New_Line;
for I in 0 .. Ntlbs - 1 loop
case I is
when 0 => Val := Get_Tlb0cfg;
when 1 => Val := Get_Tlb1cfg;
when others => exit;
end case;
Put_Line ("TLB" & Character'Val (48 + I) & "CFG: " & Image8 (Val));
Put (" Assoc: " & Image4 (Field (Val, 32, 39)));
Put (", MinSz: " & Image1 (Field (Val, 40, 43)));
Put (", MaxSz: " & Image1 (Field (Val, 44, 47)));
Put (", Iprot: " & Image1 (Field (Val, 48, 48)));
Put (", Avail: " & Image1 (Field (Val, 49, 49)));
Put (", Nentry: " & Image4 (Field (Val, 52, 63)));
New_Line;
end loop;
New_Line;
Put_Line ("TLB1:");
Val := Get_Tlb1cfg;
Nent := Field (Val, 52, 63);
Put_Line (" #: P Pid S VA Flags PA U USUSUS");
for I in 0 .. Nent - 1 loop
Set_Mas0 (2 ** 28 + I * 2 ** 16);
Asm ("tlbre", Volatile => True);
Val := Get_Mas1;
if Field (Val, 32, 32) = 1 then
declare
Sz : Unsigned_32;
Mask : Unsigned_32;
begin
-- Valid
Put (Image4 (I) & ": ");
Put_Bit (Val, 33, 'P'); -- Protected
Put (' ');
Put (Image4 (Field (Val, 34, 47))); -- PID
Put (' ');
Put (Image1 (Field (Val, 51, 51))); -- Space
Put (' ');
Sz := Field (Val, 52, 55);
Mask := Shift_Right (16#ffff_ffff#,
Natural (32 - (10 + 2 * Sz)));
Val := Get_Mas2;
Put (Image8 (Val and not Mask)); -- VA
Put ('-');
Put (Image8 (Val or Mask));
Put (' ');
Put (Image1 (Field (Val, 56, 57)));
Put_Bit (Val, 58, 'V'); -- VLE
Put_Bit (Val, 59, 'W'); -- Write through
Put_Bit (Val, 60, 'I'); -- Cache inhibited
Put_Bit (Val, 61, 'M'); -- Memory coherence
Put_Bit (Val, 62, 'G'); -- Guarded
Put_Bit (Val, 63, 'E'); -- Endian
Put (' ');
Val := Get_Mas3;
Put (Image8 (Val and not Mask));
Put (' ');
Put (Image1 (Field (Val, 54, 57))); -- User flags
Put (' ');
Put_Bit (Val, 58, 'x');
Put_Bit (Val, 59, 'X');
Put_Bit (Val, 60, 'w');
Put_Bit (Val, 61, 'W');
Put_Bit (Val, 62, 'r');
Put_Bit (Val, 63, 'R');
New_Line;
end;
end if;
end loop;
New_Line;
end Proc_Tlb;
SIU_PCR : array (0 .. 230) of Unsigned_16;
for SIU_PCR'Address use System'To_Address (16#c3f9_0040#);
pragma Import (Ada, SIU_PCR);
pragma Volatile (SIU_PCR);
EBI_BR0 : Unsigned_32;
for EBI_BR0'Address use System'To_Address (16#c3f8_4010#);
pragma Import (Ada, EBI_BR0);
pragma Volatile (EBI_BR0);
EBI_OR0 : Unsigned_32;
for EBI_OR0'Address use System'To_Address (16#c3f8_4014#);
pragma Import (Ada, EBI_OR0);
pragma Volatile (EBI_OR0);
procedure Extsram is
begin
-- SIU
-- 0x440: primary assignment, 10pF drive strength
-- 0x443: likewise + weak pull-up
-- PCR 4-27 (Addresses) = 0x440
-- PCR 28-43 (Data) = 0x440
for I in 4 .. 43 loop
SIU_PCR (I) := 16#440#;
end loop;
-- PCR 62,63 (RD/WR, BDIP) = 0x440
for I in 62 .. 63 loop
SIU_PCR (I) := 16#440#;
end loop;
-- PCR 64-65 (W[0-1]) = 0x443
-- PCR 68-69 (OE, TS) = 0x443
for I in 64 .. 69 loop
SIU_PCR (I) := 16#443#;
end loop;
-- PCR 0-3 (CS[0-3]) = 0x443
for I in 0 .. 3 loop
SIU_PCR (I) := 16#443#;
end loop;
-- EBI CS
-- EBI_CR0 =
-- EBI_OR0 =
-- Note that burst cannot be enabled, as burst length is at least
-- 4*4 bytes, while SRAM burst is only 4*2 bytes.
EBI_BR0 := 16#0000_0843#; -- BA=0,PS=1,BL=1,WEBS=0,TBDIP=0,BI=1,V=1
EBI_OR0 := 16#fff8_0000#; -- AM=fff8 (512KB),SCY=0,BSCY=0
-- MMU
-- use tlb#2, Enable cache
Set_Mas0 (2 ** 28 + 2 * 2 ** 16);
Set_Mas1 (2 ** 31 + 2 ** 30 + 7 * 2 ** 8); -- TSIZE=16MB
Set_Mas2 (16#2000_0000#); -- Cachable
Set_Mas3 (16#2000_003f#); -- RWX
Asm ("tlbwe", Volatile => True);
end Extsram;
ESCI_CR1 : Unsigned_32;
for ESCI_CR1'Address use System'To_Address (16#Fffb_0000# + 0);
pragma Import (Ada, ESCI_CR1);
pragma Volatile (ESCI_CR1);
procedure Serial_Br (Baud : Unsigned_32) is
begin
-- 8 bits, no parity, Tx & Rx enabled, br = Fsys/(16 * baud)
ESCI_CR1 := 16#000c# + (Fsys / (16 * Baud)) * 2 ** 16;
end Serial_Br;
procedure Proc_Br is
Speed : Unsigned_32;
Ok : Boolean;
begin
Next_Word;
if End_Pos <= Line_Len then
Parse_Unsigned32 (Speed, Ok);
if not Ok then
return;
end if;
Serial_Br (Speed);
else
Put ("Speed: ");
Put (Natural (Fsys / (16 * (ESCI_CR1 / 2 ** 16))));
New_Line;
end if;
end Proc_Br;
procedure Sync is
begin
Asm ("msync", Volatile => True);
Asm ("isync", Volatile => True);
end Sync;
procedure Proc_Load is
begin
Put_Line ("Waiting for srec.");
Srec.Read_Srec;
Sync;
end Proc_Load;
Commands : aliased Command_List :=
(7,
((new String'("tlb - Display TLB configuration and content"),
Proc_Tlb'Access),
(new String'("cache [on] - Display cache registers or enable cache"),
Proc_Cache'Access),
(new String'("cr - Display some config registers"),
Proc_Cr'Access),
(new String'("timer - Display time registers"),
Proc_Timer'Access),
(new String'("pll - Display PLL registers"),
Proc_Pll'Access),
(new String'("br [SPEED] - Display or set uart baud rate"),
Proc_Br'Access),
(new String'("load - S-Record loader"),
Proc_Load'Access)),
null);
begin
-- Set speed
Serial_Br (57600);
-- Disable watchdog (in case of running from BAM)
Disable_Watchdog;
-- Enable external ram
Extsram;
Register_Commands (Commands'Access);
end Mpc55xx;
|
------------------------------------------------------------------------------
-- --
-- GNAT RUN-TIME LIBRARY (GNARL) COMPONENTS --
-- --
-- S Y S T E M . B B . B O A R D _ S U P P O R T --
-- --
-- B o d y --
-- --
-- Copyright (C) 1999-2002 Universidad Politecnica de Madrid --
-- Copyright (C) 2003-2006 The European Space Agency --
-- Copyright (C) 2003-2017, AdaCore --
-- --
-- GNARL is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
-- ware Foundation; either version 3, or (at your option) any later ver- --
-- sion. GNARL is distributed in the hope that it will be useful, but WITH- --
-- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY --
-- or FITNESS FOR A PARTICULAR PURPOSE. --
-- --
-- As a special exception under Section 7 of GPL version 3, you are granted --
-- additional permissions described in the GCC Runtime Library Exception, --
-- version 3.1, as published by the Free Software Foundation. --
-- --
-- You should have received a copy of the GNU General Public License and --
-- a copy of the GCC Runtime Library Exception along with this program; --
-- see the files COPYING3 and COPYING.RUNTIME respectively. If not, see --
-- <http://www.gnu.org/licenses/>. --
-- --
-- GNARL was developed by the GNARL team at Florida State University. --
-- Extensive contributions were provided by Ada Core Technologies, Inc. --
-- --
-- The port of GNARL to bare board targets was initially developed by the --
-- Real-Time Systems Group at the Technical University of Madrid. --
-- --
------------------------------------------------------------------------------
pragma Restrictions (No_Elaboration_Code);
with System.BB.Board_Support.LEON; use System.BB.Board_Support.LEON;
with System.BB.Board_Parameters;
with System.BB.CPU_Primitives;
package body System.BB.Board_Support is
use BB.CPU_Primitives;
use BB.Interrupts;
-----------------------
-- Local Definitions --
-----------------------
Periodic_Count : constant := 2**24 - 2;
-- Value to be loaded in the clock counter to accomplish the
-- Clock_Interrupt_Period.
--
-- One is subtracted from Timers_Counter'Last (2**24 -1) because the
-- timeout period will count an extra cycle for reloading the counter.
-- Constants defining the external interrupts
General_Purpose_Timer : constant := 8;
----------------------
-- Initialize_Board --
----------------------
procedure Initialize_Board is
Prescaler : constant Prescaler_Register :=
(Value => Board_Parameters.Prescaler_Min,
Reserved => (others => False));
-- Minimum prescaler to be used to achieve best granularity
Real_Time_Clock_Reload : constant Timer_Register :=
(Timer_Value => Periodic_Count,
Reserved => (others => False));
-- Periodic count to be used for the clock
Real_Time_Clock_Control : constant Timer_Control_Register :=
(Enable => True,
Reload_Counter => True,
Load_Counter => True,
Reserved => (others => False));
-- Program the timer in periodic mode to serve as a clock
begin
-- Set the prescaler value to achieve the required granularity
Prescaler_Reload := Prescaler;
-- Load the counter for the real-time clock
Timer_2_Reload := Real_Time_Clock_Reload;
-- Enable Timer 2
Timer_2_Control := Real_Time_Clock_Control;
end Initialize_Board;
package body Time is
Alarm_Interrupt_ID : constant Interrupt_ID := General_Purpose_Timer;
---------------------------
-- Install_Alarm_Handler --
---------------------------
procedure Install_Alarm_Handler
(Handler : BB.Interrupts.Interrupt_Handler) is
begin
BB.Interrupts.Attach_Handler
(Handler,
Alarm_Interrupt_ID,
Interrupts.Priority_Of_Interrupt (Alarm_Interrupt_ID));
end Install_Alarm_Handler;
---------------------------
-- Clear_Alarm_Interrupt --
---------------------------
procedure Clear_Alarm_Interrupt is
begin
-- Interrupts are cleared automatically when they are acknowledged
null;
end Clear_Alarm_Interrupt;
------------------------
-- Max_Timer_Interval --
------------------------
function Max_Timer_Interval return Timer_Interval is
begin
return Periodic_Count;
end Max_Timer_Interval;
----------------
-- Read_Clock --
----------------
function Read_Clock return BB.Time.Time is
Timer_Counter : constant Timer_Register := Timer_2_Counter;
-- Make copy of atomic variable to avoid warning on partial access
begin
return BB.Time.Time (Periodic_Count - Timer_Counter.Timer_Value);
end Read_Clock;
---------------
-- Set_Alarm --
---------------
procedure Set_Alarm (Ticks : Timer_Interval) is
Timer_Reload_Aux : constant Timer_Register :=
(Timer_Value => Timers_Counter (Ticks),
Reserved => (others => False));
-- Load the required ticks
Timer_Control_Aux : constant Timer_Control_Register :=
(Enable => True,
Reload_Counter => False,
Load_Counter => True,
Reserved => (others => False));
-- Program the timer in one-shot mode
Interrupt_Mask_Aux : Interrupt_Mask_and_Priority_Register;
begin
-- Alarm Clock downcount will reach 0 in Ticks. The granularity of
-- time intervals is equal to Clock Period.
-- Set the prescaler: already done in Initialize_Clock
-- Load the counter
Timer_1_Reload := Timer_Reload_Aux;
-- Write Timer Control Register
Timer_1_Control := Timer_Control_Aux;
-- Enable Timer 1 Interrupts
Interrupt_Mask_Aux := Interrupt_Mask_and_Priority;
Interrupt_Mask_Aux.Timer_1 := True;
Interrupt_Mask_and_Priority := Interrupt_Mask_Aux;
end Set_Alarm;
end Time;
package body Interrupts is
procedure Interrupt_Handler (Vector : CPU_Primitives.Vector_Id);
-- Low level interrupt handler
----------------
-- Power_Down --
----------------
procedure Power_Down is
begin
null;
end Power_Down;
---------------------------
-- Priority_Of_Interrupt --
---------------------------
function Priority_Of_Interrupt
(Interrupt : System.BB.Interrupts.Interrupt_ID)
return System.Any_Priority is
begin
-- Assert that it is a real interrupt
pragma Assert (Interrupt /= System.BB.Interrupts.No_Interrupt);
return (Any_Priority (Interrupt) + Interrupt_Priority'First - 1);
end Priority_Of_Interrupt;
--------------------------
-- Set_Current_Priority --
--------------------------
procedure Set_Current_Priority (Priority : Integer) is
begin
null; -- No board-specific actions necessary
end Set_Current_Priority;
-----------------------
-- Interrupt_Handler --
-----------------------
procedure Interrupt_Handler (Vector : CPU_Primitives.Vector_Id) is
Id : Interrupt_ID;
begin
-- The range corresponding to asynchronous traps is 16#11# .. 16#1F#
pragma Assert (Vector in 16#11# .. 16#1F#);
Id := System.BB.Interrupts.Interrupt_ID (Vector - 16#10#);
Interrupt_Wrapper (Id);
end Interrupt_Handler;
-------------------------------
-- Install_Interrupt_Handler --
-------------------------------
procedure Install_Interrupt_Handler
(Interrupt : Interrupt_ID;
Prio : Interrupt_Priority)
is
pragma Unreferenced (Prio);
begin
CPU_Primitives.Install_Trap_Handler
(Interrupt_Handler'Address,
CPU_Primitives.Vector_Id (Interrupt + 16#10#));
end Install_Interrupt_Handler;
end Interrupts;
package body Multiprocessors is separate;
end System.BB.Board_Support;
|
with System.Machine_Code; use System.Machine_Code;
package body Pkg is
procedure func_gamma (x: in out Gamma) is
begin
asm ("# func_gamma");
x.data_gamma := 1;
end func_gamma;
procedure func_beta (x: in out Gamma) is
begin
asm ("# func_beta");
end func_beta;
procedure func_alpha (x: in out Gamma) is
begin
asm ("# func_alpha");
x.data_alpha := 1;
end func_alpha;
end Pkg;
|
pragma Check_Policy (Trace => Disable);
with Ada.Exception_Identification.From_Here;
with Ada.Unchecked_Conversion;
with Ada.Unchecked_Deallocation;
with System.Address_To_Named_Access_Conversions;
with System.Formatting.Address;
with System.Long_Long_Integer_Types;
with System.Native_Time;
with System.Runtime_Context;
with System.Shared_Locking;
with System.Stack;
with System.Standard_Allocators;
with System.Storage_Barriers;
with System.Synchronous_Control;
with System.Synchronous_Objects.Abortable;
with System.Termination;
with System.Unbounded_Stack_Allocators;
with System.Unwind.Occurrences;
package body System.Tasks is
use Ada.Exception_Identification.From_Here;
use type Long_Long_Integer_Types.Word_Unsigned;
use type Synchronous_Objects.Queue_Node_Access;
use type Storage_Elements.Storage_Offset;
subtype Word_Unsigned is Long_Long_Integer_Types.Word_Unsigned;
-- Use sequentially consistent model.
Order : constant := Storage_Barriers.ATOMIC_SEQ_CST;
function atomic_add_fetch (
ptr : not null access Counter;
val : Counter;
memorder : Integer := Order)
return Counter
with Import,
Convention => Intrinsic, External_Name => "__atomic_add_fetch_4";
function atomic_compare_exchange (
ptr : not null access Activation_State;
expected : not null access Activation_State;
desired : Activation_State;
weak : Boolean := False;
success_memorder : Integer := Order;
failure_memorder : Integer := Order)
return Boolean
with Import,
Convention => Intrinsic,
External_Name => "__atomic_compare_exchange_1";
function atomic_compare_exchange (
ptr : not null access Termination_State;
expected : not null access Termination_State;
desired : Termination_State;
weak : Boolean := False;
success_memorder : Integer := Order;
failure_memorder : Integer := Order)
return Boolean
with Import,
Convention => Intrinsic,
External_Name => "__atomic_compare_exchange_1";
-- delay statement
procedure Delay_For (D : Duration);
procedure Delay_For (D : Duration) is
Aborted : Boolean;
begin
Enable_Abort;
declare
Abort_Event : constant access Synchronous_Objects.Event :=
Tasks.Abort_Event;
begin
if Abort_Event /= null then
Synchronous_Objects.Wait (
Abort_Event.all,
Timeout => D,
Value => Aborted);
else
Native_Time.Simple_Delay_For (D);
Aborted := Is_Aborted;
end if;
end;
Disable_Abort (Aborted);
end Delay_For;
-- shared lock
Shared_Lock : Synchronous_Objects.Mutex; -- uninitialized
procedure Shared_Lock_Enter;
procedure Shared_Lock_Enter is
begin
Synchronous_Objects.Enter (Shared_Lock);
end Shared_Lock_Enter;
procedure Shared_Lock_Leave;
procedure Shared_Lock_Leave is
begin
Synchronous_Objects.Leave (Shared_Lock);
end Shared_Lock_Leave;
-- attributes
generic
type Element_Type is private;
type Fixed_Array_Type is array (Natural) of Element_Type;
type Array_Access is access all Fixed_Array_Type;
package Simple_Vectors is
procedure Expand (
Data : in out Array_Access;
Length : in out Natural;
New_Length : Natural;
New_Item : Element_Type);
procedure Clear (Data : in out Array_Access; Length : in out Natural);
end Simple_Vectors;
package body Simple_Vectors is
package AA_Conv is
new Address_To_Named_Access_Conversions (
Fixed_Array_Type,
Array_Access);
procedure Expand (
Data : in out Array_Access;
Length : in out Natural;
New_Length : Natural;
New_Item : Element_Type) is
begin
if New_Length > Length then
Data := AA_Conv.To_Pointer (
Standard_Allocators.Reallocate (
AA_Conv.To_Address (Data),
Storage_Elements.Storage_Offset (New_Length)
* (
Fixed_Array_Type'Component_Size
/ Standard'Storage_Unit)));
for I in Length .. New_Length - 1 loop
Data (I) := New_Item;
end loop;
Length := New_Length;
end if;
end Expand;
procedure Clear (Data : in out Array_Access; Length : in out Natural) is
begin
Standard_Allocators.Free (AA_Conv.To_Address (Data));
Data := null;
Length := 0;
end Clear;
end Simple_Vectors;
package Attribute_Vectors is
new Simple_Vectors (
Attribute,
Fixed_Attribute_Array,
Attribute_Array_Access);
procedure Clear_Attributes (Item : Task_Id);
procedure Clear_Attributes (Item : Task_Id) is
begin
for I in 0 .. Item.Attributes_Length - 1 loop
declare
A : Attribute
renames Item.Attributes (I);
begin
if A.Index /= null then
Clear (Item, A.Index.all);
end if;
end;
end loop;
Attribute_Vectors.Clear (Item.Attributes, Item.Attributes_Length);
end Clear_Attributes;
Attribute_Indexes_Lock : Synchronous_Objects.Mutex; -- uninitialized
type Fixed_Attribute_Index_Set is array (Natural) of Word_Unsigned;
pragma Suppress_Initialization (Fixed_Attribute_Index_Set);
type Attribute_Index_Set_Access is access all Fixed_Attribute_Index_Set;
Attribute_Indexes : Attribute_Index_Set_Access := null;
Attribute_Indexes_Length : Natural := 0;
package Attribute_Index_Sets is
new Simple_Vectors (
Word_Unsigned,
Fixed_Attribute_Index_Set,
Attribute_Index_Set_Access);
-- task record
package Task_Id_Conv is
new Address_To_Named_Access_Conversions (Task_Record, Task_Id);
procedure Append_To_Completion_List (
Master : Master_Access;
Item : Task_Id);
procedure Append_To_Completion_List (
Master : Master_Access;
Item : Task_Id) is
begin
Synchronous_Objects.Enter (Master.Mutex);
if Master.List = null then
-- making a ringed list
Item.Previous_At_Same_Level := Item;
Item.Next_At_Same_Level := Item;
Master.List := Item;
else
-- append to last
Item.Previous_At_Same_Level := Master.List.Previous_At_Same_Level;
Item.Previous_At_Same_Level.Next_At_Same_Level := Item;
Item.Next_At_Same_Level := Master.List;
Item.Next_At_Same_Level.Previous_At_Same_Level := Item;
end if;
Item.Master_Of_Parent := Master;
Synchronous_Objects.Leave (Master.Mutex);
end Append_To_Completion_List;
procedure Remove_From_Completion_List_No_Sync (Item : Task_Id);
procedure Remove_From_Completion_List_No_Sync (Item : Task_Id) is
begin
if Item = Item.Master_Of_Parent.List then
-- first-in, first-out
if Item = Item.Next_At_Same_Level then
Item.Master_Of_Parent.List := null;
goto Cleared;
else
Item.Master_Of_Parent.List := Item.Next_At_Same_Level;
end if;
end if;
Item.Previous_At_Same_Level.Next_At_Same_Level :=
Item.Next_At_Same_Level;
Item.Next_At_Same_Level.Previous_At_Same_Level :=
Item.Previous_At_Same_Level;
<<Cleared>>
Item.Master_Of_Parent := null;
Item.Previous_At_Same_Level := null;
Item.Next_At_Same_Level := null;
end Remove_From_Completion_List_No_Sync;
procedure Remove_From_Completion_List (Item : Task_Id);
procedure Remove_From_Completion_List (Item : Task_Id) is
begin
if Item.Master_Of_Parent /= null then
declare
Mutex_Ref : constant not null access Synchronous_Objects.Mutex :=
Item.Master_Of_Parent.Mutex'Access;
begin
Synchronous_Objects.Enter (Mutex_Ref.all);
Remove_From_Completion_List_No_Sync (Item);
Synchronous_Objects.Leave (Mutex_Ref.all);
end;
end if;
end Remove_From_Completion_List;
procedure Free (Item : in out Task_Id);
procedure Free (Item : in out Task_Id) is
procedure Unchecked_Free is
new Ada.Unchecked_Deallocation (String, String_Access);
procedure Unchecked_Free is
new Ada.Unchecked_Deallocation (Rendezvous_Record, Rendezvous_Access);
procedure Unchecked_Free is
new Ada.Unchecked_Deallocation (Task_Record, Task_Id);
begin
-- detach from master
Remove_From_Completion_List (Item);
-- finalize abort
Synchronous_Objects.Finalize (Item.Abort_Event);
-- free attributes
Clear_Attributes (Item);
-- free task record
if Item.Rendezvous /= null then
Synchronous_Objects.Finalize (Item.Rendezvous.Calling);
Synchronous_Objects.Finalize (Item.Rendezvous.Mutex);
Unchecked_Free (Item.Rendezvous);
end if;
Unchecked_Free (Item.Name);
Unchecked_Free (Item);
end Free;
-- thead id
TLS_Current_Task_Id : Task_Id := null;
pragma Thread_Local_Storage (TLS_Current_Task_Id);
Environment_Task_Record : aliased Task_Record (Environment);
-- task local storage (secondary stack and exception occurrence)
TLS_Data : Runtime_Context.Task_Local_Storage_Access := null;
pragma Thread_Local_Storage (TLS_Data);
function Get_TLS
return not null Runtime_Context.Task_Local_Storage_Access;
function Get_TLS
return not null Runtime_Context.Task_Local_Storage_Access is
begin
return TLS_Data;
end Get_TLS;
-- name
Environment_Task_Name : aliased constant String := "*environment";
Null_Name : aliased constant String := "";
-- signal handler
procedure Abort_Signal_Handler;
procedure Abort_Signal_Handler is
T : constant Task_Id := TLS_Current_Task_Id;
begin
pragma Check (Trace, Ada.Debug.Put (Name (T).all));
T.Aborted := True;
if T.Abort_Handler /= null then
T.Abort_Handler (T);
end if;
if T.Kind = Environment then
Native_Tasks.Uninstall_Abort_Handler;
declare
Error : Boolean; -- ignored
begin
Native_Tasks.Resend_Abort_Signal (T.Handle, Error => Error);
end;
end if;
end Abort_Signal_Handler;
-- registration
type Registered_State_Type is (Single_Task, Registered, Unregistered);
pragma Discard_Names (Registered_State_Type);
Registered_State : Registered_State_Type := Single_Task;
pragma Atomic (Registered_State);
procedure Unregister;
procedure Unregister is
begin
pragma Check (Trace, Ada.Debug.Put ("enter"));
-- environment task id
if Environment_Task_Record.Master_Top /= null then
pragma Assert (
Environment_Task_Record.Master_Top.Within = Library_Task_Level);
Leave_Master;
pragma Assert (Environment_Task_Record.Master_Top = null);
end if;
Clear_Attributes (Environment_Task_Record'Access);
pragma Assert (Environment_Task_Record.Abort_Locking = 2);
TLS_Current_Task_Id := null;
-- shared lock
Synchronous_Objects.Finalize (Shared_Lock);
Shared_Locking.Enter_Hook := Shared_Locking.Nop'Access;
Shared_Locking.Leave_Hook := Shared_Locking.Nop'Access;
-- yield
Synchronous_Control.Yield_Hook := Synchronous_Control.Nop'Access;
-- delay statement
Native_Time.Delay_For_Hook := Native_Time.Simple_Delay_For'Access;
-- attribute indexes
Synchronous_Objects.Finalize (Attribute_Indexes_Lock);
Attribute_Index_Sets.Clear (Attribute_Indexes, Attribute_Indexes_Length);
-- task local storage (secondary stack and exception occurrence)
Runtime_Context.Get_Task_Local_Storage_Hook :=
Runtime_Context.Get_Environment_Task_Local_Storage'Access;
-- environment task id
Synchronous_Objects.Finalize (Environment_Task_Record.Abort_Event);
-- signal handler
Native_Tasks.Uninstall_Abort_Handler;
-- clear
Registered_State := Unregistered;
pragma Check (Trace, Ada.Debug.Put ("leave"));
end Unregister;
procedure Register;
procedure Register is
begin
if Registered_State /= Registered then
pragma Check (Trace, Ada.Debug.Put ("enter"));
-- still it is single thread
Registered_State := Registered;
Termination.Register_Exit (Unregister'Access);
-- shared lock
Synchronous_Objects.Initialize (Shared_Lock);
Shared_Locking.Enter_Hook := Shared_Lock_Enter'Access;
Shared_Locking.Leave_Hook := Shared_Lock_Leave'Access;
-- yield
Synchronous_Control.Yield_Hook := Native_Tasks.Yield'Access;
-- delay statement
Native_Time.Delay_For_Hook := Delay_For'Access;
-- attribute indexes
Synchronous_Objects.Initialize (Attribute_Indexes_Lock);
-- task local storage (secondary stack and exception occurrence)
TLS_Data := Runtime_Context.Get_Environment_Task_Local_Storage;
Runtime_Context.Get_Task_Local_Storage_Hook := Get_TLS'Access;
-- environment task id
TLS_Current_Task_Id := Environment_Task_Record'Access;
Environment_Task_Record.Handle := Native_Tasks.Current;
Environment_Task_Record.Aborted := False;
Environment_Task_Record.Abort_Handler := null;
Environment_Task_Record.Abort_Locking := 2;
Environment_Task_Record.Attributes := null;
Environment_Task_Record.Attributes_Length := 0;
Environment_Task_Record.Activation_State := AS_Active;
Environment_Task_Record.Termination_State := TS_Active;
Environment_Task_Record.Master_Level := Environment_Task_Level;
Environment_Task_Record.Master_Top := null; -- from Library_Task_Level
Synchronous_Objects.Initialize (Environment_Task_Record.Abort_Event);
-- signal handler
Native_Tasks.Install_Abort_Handler (Abort_Signal_Handler'Access);
pragma Check (Trace, Ada.Debug.Put ("leave"));
end if;
end Register;
-- thread body
procedure Invoke_Handler (
Cause : Cause_Of_Termination;
T : Task_Id;
X : Ada.Exceptions.Exception_Occurrence;
Handled : out Boolean);
procedure Invoke_Handler (
Cause : Cause_Of_Termination;
T : Task_Id;
X : Ada.Exceptions.Exception_Occurrence;
Handled : out Boolean) is
begin
if T.Specific_Handler /= null then
T.Specific_Handler (Cause, T, X);
Handled := True;
else
declare
P : Task_Id := T;
begin
loop
P := Parent (P);
if P = null then
Handled := False;
exit;
end if;
if P.Dependents_Fallback_Handler /= null then
P.Dependents_Fallback_Handler (Cause, T, X);
Handled := True;
exit;
end if;
end loop;
end;
end if;
end Invoke_Handler;
procedure Report (
T : not null Task_Id;
X : Ada.Exceptions.Exception_Occurrence);
procedure Report (
T : not null Task_Id;
X : Ada.Exceptions.Exception_Occurrence)
is
function Cast is
new Ada.Unchecked_Conversion (
Ada.Exceptions.Exception_Occurrence,
Unwind.Exception_Occurrence);
Name_Prefix : constant String := "Task ";
Name : String (
1 ..
Name_Prefix'Length
+ (if T.Name /= null then T.Name'Length + 1 else 0)
+ Formatting.Address.Address_String'Length);
Name_Last : Natural;
begin
Name_Last := Name_Prefix'Length;
Name (1 .. Name_Last) := Name_Prefix;
if T.Name /= null then
Name (Name_Last + 1 .. Name_Last + T.Name'Length) := T.Name.all;
Name_Last := Name_Last + T.Name'Length + 1;
Name (Name_Last) := ':';
end if;
Formatting.Address.Image (
Task_Id_Conv.To_Address (T),
Name (
Name_Last + 1 ..
Name_Last + Formatting.Address.Address_String'Length),
Set => Formatting.Upper_Case);
Name_Last := Name_Last + Formatting.Address.Address_String'Length;
Unwind.Occurrences.Report (Cast (X), Name (1 .. Name_Last));
end Report;
-- Native_Tasks.Result_Type is void * in POSIX, or DWORD in Windows.
-- Long_Integer is register size in POSIX, and 32bit in Windows.
TR_Freed : constant := 0;
TR_Not_Freed : constant := 1;
function Thread (Rec : Native_Tasks.Parameter_Type)
return Native_Tasks.Result_Type
with Convention => Thread_Body_CC;
function Thread (Rec : Native_Tasks.Parameter_Type)
return Native_Tasks.Result_Type
is
function To_Address is
new Ada.Unchecked_Conversion (Native_Tasks.Parameter_Type, Address);
function To_Result is
new Ada.Unchecked_Conversion (Long_Integer, Native_Tasks.Result_Type);
Result : Native_Tasks.Result_Type;
SEH : aliased array (1 .. 2) of Integer;
Local : aliased Runtime_Context.Task_Local_Storage;
T : Task_Id := Task_Id_Conv.To_Pointer (To_Address (Rec));
No_Detached : Boolean;
Cause : Cause_Of_Termination;
begin
TLS_Current_Task_Id := T;
-- block abort signal
Native_Tasks.Block_Abort_Signal (T.Abort_Event);
T.Abort_Locking := 1;
-- setup secondary stack
Local.Secondary_Stack := Null_Address;
Local.Overlaid_Allocation := Null_Address;
Local.Machine_Occurrence := null;
Local.Triggered_By_Abort := False;
TLS_Data := Local'Unchecked_Access;
-- setup signal stack
Unwind.Mapping.Install_Task_Exception_Handler (
SEH'Address,
T.Signal_Stack'Access);
-- execute
declare
procedure On_Exception (T : not null Task_Id);
procedure On_Exception (T : not null Task_Id) is
Aborted : Boolean; -- ignored
begin
if T.Activation_State < AS_Active then
pragma Check (Trace,
Check =>
Ada.Debug.Put (Name (T).all & " has not been activated"));
pragma Assert (T.Abort_Locking = 1);
-- an exception was raised until calling Accept_Activation
T.Activation_Chain.Error := Any_Exception;
Accept_Activation (Aborted => Aborted);
end if;
end On_Exception;
begin
if T.Activation_Chain /= null then
-- Abort_Undefer will be called on activation
T.Abort_Locking := T.Abort_Locking + 1;
end if;
pragma Check (Trace, Ada.Debug.Put (Name (T).all & " begin"));
T.Process (T.Params);
pragma Check (Trace, Ada.Debug.Put (Name (T).all & " end"));
Cause := Normal;
exception
when Standard'Abort_Signal =>
pragma Check (Trace,
Check => Ada.Debug.Put (Name (T).all & " Abort_Signal"));
-- Abort_Undefer will not be called by compiler
if not ZCX_By_Default then
T.Abort_Locking := T.Abort_Locking - 1;
end if;
On_Exception (T);
Cause := Abnormal;
when E : others =>
pragma Check (Trace, Ada.Debug.Put (Name (T).all & " exception"));
On_Exception (T);
declare
Handled : Boolean;
begin
Invoke_Handler (Unhandled_Exception, T, E, Handled);
if not Handled then
Report (T, E);
end if;
Cause := Unhandled_Exception;
end;
end;
if Cause /= Unhandled_Exception then
declare
Handled : Boolean; -- ignored
begin
Invoke_Handler (Cause, T, Ada.Exceptions.Null_Occurrence, Handled);
end;
end if;
pragma Assert (T.Abort_Locking = 1);
-- cancel calling queue
Cancel_Calls;
-- deactivate and set 'Terminated to False
declare
Expected : aliased Termination_State := TS_Active;
begin
No_Detached := atomic_compare_exchange (
T.Termination_State'Access,
Expected'Access,
TS_Terminated);
end;
-- free
if No_Detached then
Result := To_Result (TR_Not_Freed); -- caller or master may wait
else -- detached
if T.Master_Of_Parent /= null then
declare
Mutex_Ref : constant
not null access Synchronous_Objects.Mutex :=
T.Master_Of_Parent.Mutex'Access;
begin
Synchronous_Objects.Enter (Mutex_Ref.all);
if T.Auto_Detach then
Remove_From_Completion_List_No_Sync (T);
declare
Error : Boolean;
begin
Native_Tasks.Detach (T.Handle, Error);
-- error should be reported?
end;
end if;
Synchronous_Objects.Leave (Mutex_Ref.all);
end;
if not T.Auto_Detach then
-- master already has been waiting
Result := To_Result (TR_Not_Freed);
else
Free (T);
Result := To_Result (TR_Freed);
end if;
else
Free (T);
Result := To_Result (TR_Freed);
end if;
end if;
-- cleanup secondary stack
Unbounded_Stack_Allocators.Clear (Local.Secondary_Stack);
-- return
return Result;
end Thread;
type Execution_Error is (None, Aborted, Elaboration_Error, Done);
pragma Discard_Names (Execution_Error);
procedure Execute (T : Task_Id; Error : out Execution_Error);
procedure Execute (T : Task_Id; Error : out Execution_Error) is
function To_Parameter is
new Ada.Unchecked_Conversion (Address, Native_Tasks.Parameter_Type);
Expected : aliased Activation_State := AS_Suspended;
Creation_Error : Boolean;
begin
if not atomic_compare_exchange (
T.Activation_State'Access,
Expected'Access,
AS_Created)
then
Error := Done;
elsif T.Aborted then -- aborted before activation
Error := Aborted;
T.Activation_State := AS_Error;
T.Termination_State := TS_Terminated; -- C9A004A
else
Native_Tasks.Create (
T.Handle,
To_Parameter (Task_Id_Conv.To_Address (T)),
Thread'Access,
Error => Creation_Error);
if Creation_Error then
Error := Elaboration_Error;
T.Activation_State := AS_Error;
else
Error := None;
end if;
end if;
end Execute;
procedure Wait (T : Task_Id; Free_Task_Id : out Task_Id);
procedure Wait (T : Task_Id; Free_Task_Id : out Task_Id) is
function To_Long_Integer is
new Ada.Unchecked_Conversion (Native_Tasks.Result_Type, Long_Integer);
Rec : aliased Native_Tasks.Result_Type;
Error : Boolean;
begin
if T.Activation_State = AS_Error then
Free_Task_Id := T;
else
Native_Tasks.Join (
T.Handle,
Abort_Event,
Rec,
Error);
if Error then
Raise_Exception (Tasking_Error'Identity);
end if;
if To_Long_Integer (Rec) = TR_Freed then
Free_Task_Id := null;
else -- Rec = TR_Not_Freed
Free_Task_Id := T;
end if;
end if;
end Wait;
-- abort
procedure Set_Abort_Recursively (T : Task_Id);
procedure Set_Abort_Recursively (T : Task_Id) is
begin
T.Aborted := True;
declare
M : Master_Access := T.Master_Top;
begin
while M /= null loop
Synchronous_Objects.Enter (M.Mutex);
declare
L : Task_Id := M.List;
begin
if L /= null then
loop
Set_Abort_Recursively (L);
L := L.Next_At_Same_Level;
exit when L = M.List;
end loop;
end if;
end;
Synchronous_Objects.Leave (M.Mutex);
M := M.Previous;
end loop;
end;
end Set_Abort_Recursively;
procedure Abort_Handler_On_Leave_Master (T : Task_Id);
procedure Abort_Handler_On_Leave_Master (T : Task_Id) is
M : constant Master_Access := T.Master_Top;
Top_Child : Task_Id;
Error : Boolean; -- ignored
begin
-- This is called only from Abort_Signal_Handler while Leave_Master is
-- waiting a child task.
-- So M.Mutex is unlocked and M.List is a waited task.
Top_Child := M.List;
Native_Tasks.Send_Abort_Signal (
Top_Child.Handle,
Top_Child.Abort_Event,
Error);
end Abort_Handler_On_Leave_Master;
-- activation
procedure Remove_From_Merged_Activation_Chain_List (
C : not null Activation_Chain);
procedure Remove_From_Merged_Activation_Chain_List (
C : not null Activation_Chain)
is
Chain : constant access Activation_Chain := C.Self;
begin
if Chain.all = C then
Chain.all := Chain.all.Merged;
else
declare
I : Activation_Chain := Chain.all;
begin
while I.Merged /= C loop
I := I.Merged;
end loop;
I.Merged := C.Merged;
end;
end if;
end Remove_From_Merged_Activation_Chain_List;
procedure Release (C : in out Activation_Chain);
procedure Release (C : in out Activation_Chain) is
procedure Free (Item : in out Activation_Chain);
procedure Free (Item : in out Activation_Chain) is
procedure Unchecked_Free is
new Ada.Unchecked_Deallocation (
Activation_Chain_Data,
Activation_Chain);
begin
Synchronous_Objects.Finalize (Item.Mutex);
Synchronous_Objects.Finalize (Item.Condition_Variable);
Unchecked_Free (Item);
end Free;
begin
if atomic_add_fetch (C.Release_Count'Access, 1) > C.Task_Count then
Free (C);
end if;
end Release;
procedure Set_Active (T : not null Task_Id; State : Activation_State);
procedure Set_Active (T : not null Task_Id; State : Activation_State) is
begin
if not Elaborated (T) then
pragma Check (Trace, Ada.Debug.Put (Name (T).all & " elab error"));
T.Activation_Chain.Error := Elaboration_Error;
end if;
T.Activation_State := State;
end Set_Active;
procedure Set_Active (C : not null Activation_Chain);
procedure Set_Active (C : not null Activation_Chain) is
I : Task_Id := C.List;
begin
while I /= null loop
if I.Activation_State < AS_Active then
Set_Active (I, AS_Active);
end if;
I := I.Next_Of_Activation_Chain;
end loop;
end Set_Active;
procedure Activate (
Chain : not null access Activation_Chain;
Error : out Activation_Error;
Aborted : out Boolean);
procedure Activate (
Chain : not null access Activation_Chain;
Error : out Activation_Error;
Aborted : out Boolean)
is
C : Activation_Chain := Chain.all;
begin
Error := None;
Aborted := False;
while C /= null loop
pragma Assert (C.Self = Chain);
Synchronous_Objects.Enter (C.Mutex);
declare
I : Task_Id := C.List;
Error_On_Execute : Execution_Error;
begin
while I /= null loop
Execute (I, Error_On_Execute);
if Error_On_Execute /= None
and then Error_On_Execute /= Done
then
C.Task_Count := C.Task_Count - 1;
if Error_On_Execute = Elaboration_Error then
Error := Elaboration_Error;
end if;
end if;
I.Activation_Chain_Living := False; -- will free in here
I := I.Next_Of_Activation_Chain;
end loop;
end;
C.Activated_Count := C.Activated_Count + 1;
if C.Activated_Count > C.Task_Count then
Set_Active (C);
Synchronous_Objects.Notify_All (C.Condition_Variable);
else
loop
Synchronous_Objects.Wait (C.Condition_Variable, C.Mutex);
Aborted := Is_Aborted; -- is this check worthwhile?
exit when C.Activated_Count > C.Task_Count or else Aborted;
end loop;
end if;
Error := Activation_Error'Max (Error, C.Error);
Remove_From_Merged_Activation_Chain_List (C);
Synchronous_Objects.Leave (C.Mutex);
-- cleanup
declare
Merged : constant Activation_Chain := C.Merged;
begin
Release (C);
C := Merged;
end;
end loop;
end Activate;
procedure Activate (T : Task_Id; Error : out Activation_Error);
-- This procedure does not free activation chain,
-- so it must call above Activate for taking activation chain.
procedure Activate (T : Task_Id; Error : out Activation_Error) is
Error_On_Execute : Execution_Error;
begin
Error := None;
Execute (T, Error_On_Execute);
if Error_On_Execute /= Done then
declare
C : constant Activation_Chain := T.Activation_Chain;
begin
Synchronous_Objects.Enter (C.Mutex);
if Error_On_Execute /= None then
C.Task_Count := C.Task_Count - 1;
if Error_On_Execute = Elaboration_Error then
Error := Elaboration_Error;
end if;
else
Set_Active (T, AS_Active_Before_Activation);
Synchronous_Objects.Notify_All (C.Condition_Variable);
end if;
Error := Activation_Error'Max (Error, C.Error);
Synchronous_Objects.Leave (C.Mutex);
end;
end if;
end Activate;
-- completion
procedure Free (Item : in out Master_Access);
procedure Free (Item : in out Master_Access) is
procedure Unchecked_Free is
new Ada.Unchecked_Deallocation (Master_Record, Master_Access);
begin
Synchronous_Objects.Finalize (Item.Mutex);
Unchecked_Free (Item);
end Free;
-- queue
package QNA_Conv is
new Address_To_Named_Access_Conversions (
Synchronous_Objects.Queue_Node,
Synchronous_Objects.Queue_Node_Access);
function Uncall_Filter (
The_Node : not null Synchronous_Objects.Queue_Node_Access;
Params : Address)
return Boolean;
function Uncall_Filter (
The_Node : not null Synchronous_Objects.Queue_Node_Access;
Params : Address)
return Boolean is
begin
return The_Node = QNA_Conv.To_Pointer (Params);
end Uncall_Filter;
-- implementation
procedure Raise_Abort_Signal is
TLS : constant not null Runtime_Context.Task_Local_Storage_Access :=
Get_TLS; -- Runtime_Context.Get_Task_Local_Storage
begin
TLS.Triggered_By_Abort := True;
raise Standard'Abort_Signal;
end Raise_Abort_Signal;
procedure When_Abort_Signal is
begin
if not ZCX_By_Default then
Unlock_Abort;
end if;
end When_Abort_Signal;
function Current_Task_Id return Task_Id is
begin
Register;
return TLS_Current_Task_Id;
end Current_Task_Id;
function Environment_Task_Id return Task_Id is
begin
Register;
return Environment_Task_Record'Access;
end Environment_Task_Id;
procedure Create (
T : out Task_Id;
Params : Address;
Process : not null access procedure (Params : Address);
Name : String := "";
Chain : Activation_Chain_Access := null;
Elaborated : Boolean_Access := null;
Master : Master_Access := null;
Entry_Last_Index : Task_Entry_Index := 0)
is
type P is access procedure (Params : Address);
function To_Process_Handler is
new Ada.Unchecked_Conversion (P, Process_Handler);
Name_Data : String_Access := null;
Chain_Data : Activation_Chain := null;
Level : Master_Level := Library_Task_Level;
Rendezvous : Rendezvous_Access := null;
Error : Execution_Error;
begin
Register;
-- name
if Name'Length /= 0 then
Name_Data := new String'(Name);
end if;
-- activation chain
if Chain /= null then
Chain_Data := Chain.all;
if Chain_Data = null then
pragma Check (Trace, Ada.Debug.Put ("new chain"));
Chain_Data := new Activation_Chain_Data'(
List => null,
Task_Count => 0,
Activated_Count => 0,
Release_Count => 0,
Mutex => <>, -- uninitialized
Condition_Variable => <>, -- uninitialized
Error => None,
Merged => null,
Self => Chain);
Synchronous_Objects.Initialize (Chain_Data.Mutex);
Synchronous_Objects.Initialize (Chain_Data.Condition_Variable);
Chain.all := Chain_Data;
end if;
end if;
-- master
if Master /= null then
Level := Master.Within;
pragma Assert (Level /= Foreign_Task_Level + 2); -- ???
end if;
-- rendezvous
if Entry_Last_Index > 0 then
Rendezvous := new Rendezvous_Record'(
Mutex => <>, -- uninitialized
Calling => <>); -- uninitialized
Synchronous_Objects.Initialize (Rendezvous.Mutex);
Synchronous_Objects.Initialize (
Rendezvous.Calling,
Rendezvous.Mutex'Access);
end if;
-- task record
T := new Task_Record'(
Kind => Sub,
Handle => <>, -- uninitialized
Aborted => False,
Abort_Handler => null,
Abort_Locking => 0,
Attributes => null,
Attributes_Length => 0,
Activation_State => AS_Suspended, -- unexecuted
Termination_State => TS_Active,
Master_Level => Level,
Master_Top => null,
Dependents_Fallback_Handler => null,
Params => Params,
Process => To_Process_Handler (Process),
Preferred_Free_Mode => Detach,
Name => Name_Data,
Activation_Chain => Chain_Data,
Next_Of_Activation_Chain => null,
Activation_Chain_Living => False,
Elaborated => Elaborated,
Master_Of_Parent => Master,
Previous_At_Same_Level => null,
Next_At_Same_Level => null,
Auto_Detach => False,
Rendezvous => Rendezvous,
Specific_Handler => null,
Abort_Event => <>, -- uninitialized
Signal_Stack => <>); -- uninitialized
-- for master
if Master /= null then
-- append to the parent's master
Append_To_Completion_List (Master, T);
end if;
-- for abort
Synchronous_Objects.Initialize (T.Abort_Event);
-- for activation
if Chain_Data /= null then
-- apeend to activation chain
pragma Check (Trace, Ada.Debug.Put ("append to the chain"));
T.Activation_Chain_Living := True;
T.Next_Of_Activation_Chain := Chain_Data.List;
Chain_Data.List := T;
Chain_Data.Task_Count := Chain_Data.Task_Count + 1;
else
-- try to create
Execute (T, Error);
if Error /= None then
if Master /= null then
Remove_From_Completion_List (T); -- rollback
end if;
Free (T); -- and remove from parent's master
Raise_Exception (Tasking_Error'Identity);
else
T.Activation_State := AS_Active;
end if;
end if;
end Create;
procedure Wait (T : in out Task_Id; Aborted : out Boolean) is
begin
if T /= null then
pragma Assert (T.Kind = Sub);
declare
T2 : constant Task_Id := T;
Free_Task_Id : Task_Id;
begin
T := null; -- clear before raising any exception
Wait (T2, Free_Task_Id);
if Free_Task_Id /= null then
Free (Free_Task_Id);
end if;
end;
end if;
Aborted := Is_Aborted;
end Wait;
procedure Detach (T : in out Task_Id) is
begin
if T /= null then
pragma Assert (T.Kind = Sub);
declare
Expected : aliased Termination_State := TS_Active;
begin
if atomic_compare_exchange (
T.Termination_State'Access,
Expected'Access,
TS_Detached)
then
if T.Master_Of_Parent /= null then
Synchronous_Objects.Enter (T.Master_Of_Parent.Mutex);
T.Auto_Detach := True;
Synchronous_Objects.Leave (T.Master_Of_Parent.Mutex);
else
declare
Orig_T : constant Task_Id := T;
Error : Boolean;
begin
T := null;
Native_Tasks.Detach (Orig_T.Handle, Error);
if Error then
Raise_Exception (Tasking_Error'Identity);
end if;
end;
end if;
else
declare
Aborted : Boolean; -- ignored
begin
Wait (T, Aborted => Aborted); -- release by caller
end;
end if;
end;
end if;
end Detach;
function Terminated (T : Task_Id) return Boolean is
begin
if T = null then
raise Program_Error; -- RM C.7.1(15)
elsif Registered_State = Unregistered then
-- environment task has been terminated
return True;
else
return T.Termination_State = TS_Terminated;
end if;
end Terminated;
function Activated (T : Task_Id) return Boolean is
begin
if T = null then
raise Program_Error; -- RM C.7.1(15)
elsif Registered_State = Unregistered then
-- environment task has been terminated
return True;
else
return T.Activation_State in AS_Active_Before_Activation .. AS_Active;
end if;
end Activated;
function Preferred_Free_Mode (T : not null Task_Id) return Free_Mode is
begin
return T.Preferred_Free_Mode;
end Preferred_Free_Mode;
procedure Set_Preferred_Free_Mode (
T : not null Task_Id;
Mode : Free_Mode) is
begin
T.Preferred_Free_Mode := Mode;
end Set_Preferred_Free_Mode;
procedure Get_Stack (
T : not null Task_Id;
Addr : out Address;
Size : out Storage_Elements.Storage_Count)
is
Top, Bottom : Address;
begin
Stack.Get (Native_Tasks.Info_Block (T.Handle),
Top => Top, Bottom => Bottom);
Addr := Top;
Size := Bottom - Top;
end Get_Stack;
function Name (T : not null Task_Id)
return not null access constant String is
begin
if T.Kind = Environment then
return Environment_Task_Name'Access;
elsif T.Name = null then
return Null_Name'Access;
else
return T.Name;
end if;
end Name;
procedure Send_Abort (T : not null Task_Id) is
Current_Task_Id : constant Task_Id := TLS_Current_Task_Id;
Error : Boolean;
begin
pragma Check (Trace,
Check =>
Ada.Debug.Put (
Name (Current_Task_Id).all & " aborts " & Name (T).all));
if T = Current_Task_Id then
Set_Abort_Recursively (T);
Raise_Abort_Signal;
elsif T.Activation_State = AS_Suspended then
T.Aborted := True;
else
Native_Tasks.Send_Abort_Signal (T.Handle, T.Abort_Event, Error);
if Error then
Raise_Exception (Tasking_Error'Identity);
end if;
Set_Abort_Recursively (T); -- set 'Callable to false, C9A009H
-- abort myself if parent task is aborted, C9A007A
declare
P : Task_Id := Current_Task_Id;
begin
loop
P := Parent (P);
exit when P = null;
if P = T then
pragma Assert (Current_Task_Id.Aborted);
Raise_Abort_Signal;
end if;
end loop;
end;
end if;
end Send_Abort;
procedure Enable_Abort is
T : constant Task_Id := TLS_Current_Task_Id;
begin
if T /= null then
pragma Check (Trace,
Check =>
Ada.Debug.Put (
Name (T).all
& Natural'Image (T.Abort_Locking)
& " =>"
& Natural'Image (T.Abort_Locking - 1)));
pragma Assert (T.Abort_Locking > 0);
T.Abort_Locking := T.Abort_Locking - 1;
if T.Kind = Sub and then T.Abort_Locking = 0 then
Native_Tasks.Unblock_Abort_Signal;
end if;
end if;
end Enable_Abort;
procedure Disable_Abort (Aborted : Boolean) is
T : constant Task_Id := TLS_Current_Task_Id;
begin
if T /= null then
pragma Check (Trace,
Check =>
Ada.Debug.Put (
Name (T).all
& Natural'Image (T.Abort_Locking)
& " =>"
& Natural'Image (T.Abort_Locking + 1)));
if T.Kind = Sub and then T.Abort_Locking = 0 then
Native_Tasks.Block_Abort_Signal (T.Abort_Event);
end if;
T.Abort_Locking := T.Abort_Locking + 1;
if Aborted then
-- Cover the case that the signal is not arrived yet.
T.Aborted := True;
-- Trigger.
if T.Abort_Locking = 1 then
Raise_Abort_Signal;
end if;
end if;
end if;
end Disable_Abort;
procedure Lock_Abort is
T : constant Task_Id := Current_Task_Id; -- and register
begin
pragma Check (Trace,
Check =>
Ada.Debug.Put (
Name (T).all
& Natural'Image (T.Abort_Locking)
& " =>"
& Natural'Image (T.Abort_Locking + 1)));
T.Abort_Locking := T.Abort_Locking + 1;
end Lock_Abort;
procedure Unlock_Abort is
T : constant Task_Id := TLS_Current_Task_Id;
begin
pragma Check (Trace,
Check =>
Ada.Debug.Put (
Name (T).all
& Natural'Image (T.Abort_Locking)
& " =>"
& Natural'Image (T.Abort_Locking - 1)));
T.Abort_Locking := T.Abort_Locking - 1;
end Unlock_Abort;
function Is_Aborted return Boolean is
T : constant Task_Id := TLS_Current_Task_Id;
begin
return T /= null and then T.Aborted;
end Is_Aborted;
function Abort_Event return access Synchronous_Objects.Event is
T : constant Task_Id := TLS_Current_Task_Id;
begin
if T /= null and then Registered_State = Registered then
return T.Abort_Event'Access;
else
return null;
end if;
end Abort_Event;
function Elaborated (T : not null Task_Id) return Boolean is
begin
return T.Elaborated = null or else T.Elaborated.all;
end Elaborated;
procedure Accept_Activation (Aborted : out Boolean) is
T : constant Task_Id := TLS_Current_Task_Id;
C : Activation_Chain := T.Activation_Chain;
begin
pragma Assert (C /= null);
Synchronous_Objects.Enter (C.Mutex);
Aborted := T.Aborted;
C.Activated_Count := C.Activated_Count + 1;
if C.Activated_Count > C.Task_Count then
Set_Active (C);
Synchronous_Objects.Notify_All (C.Condition_Variable);
else
while T.Activation_State <= AS_Created and then not Aborted loop
Synchronous_Objects.Wait (C.Condition_Variable, C.Mutex);
Aborted := T.Aborted; -- is this check worthwhile?
end loop;
end if;
-- elaboration error shold be delivered, but other exceptions should not
Aborted := Aborted or else C.Error = Elaboration_Error;
Synchronous_Objects.Leave (C.Mutex);
-- cleanup
Release (C);
pragma Check (Trace,
Check =>
Ada.Debug.Put (
Name (T).all & " aborted = " & Boolean'Image (Aborted)));
end Accept_Activation;
procedure Activate (
Chain : not null Activation_Chain_Access;
Aborted : out Boolean)
is
Error : Activation_Error;
begin
pragma Check (Trace, Ada.Debug.Put ("enter"));
Activate (Chain, Error, Aborted => Aborted);
case Error is
when None =>
null;
when Elaboration_Error =>
raise Program_Error; -- C39008A, RM 3.11(14)
when Any_Exception =>
Raise_Exception (Tasking_Error'Identity); -- C93004A
end case;
pragma Check (Trace, Ada.Debug.Put ("leave"));
end Activate;
procedure Activate (T : not null Task_Id) is
Error : Activation_Error;
begin
Activate (T, Error);
case Error is
when None =>
null;
when Elaboration_Error =>
raise Program_Error;
when Any_Exception =>
Raise_Exception (Tasking_Error'Identity);
end case;
end Activate;
procedure Move (
From, To : not null Activation_Chain_Access;
New_Master : Master_Access) is
begin
pragma Check (Trace, Ada.Debug.Put ("enter"));
-- keep master level of tasks because it's meaningless
if From.all /= null then
-- change completion lists
declare
A : Activation_Chain := From.all;
begin
loop
A.Self := To;
declare
I : Task_Id := A.List;
begin
while I /= null loop
if I.Master_Of_Parent /= null then
Remove_From_Completion_List (I);
Append_To_Completion_List (New_Master, I);
end if;
I := I.Next_Of_Activation_Chain;
end loop;
end;
A := A.Merged;
exit when A = null;
end loop;
end;
-- merge lists
if To.all = null then
To.all := From.all;
else
declare
I : Activation_Chain := To.all;
begin
while I.Merged /= null loop
I := I.Merged;
end loop;
I.Merged := From.all;
end;
end if;
From.all := null;
end if;
pragma Check (Trace, Ada.Debug.Put ("leave"));
end Move;
function Parent (T : not null Task_Id) return Task_Id is
begin
if T.Kind = Environment or else T.Master_Of_Parent = null then
return null;
else
return T.Master_Of_Parent.Parent;
end if;
end Parent;
function Master_Level_Of (T : not null Task_Id) return Master_Level is
begin
return T.Master_Level;
end Master_Level_Of;
function Master_Within return Master_Level is
T : constant Task_Id := Current_Task_Id;
begin
if T.Master_Top = null then
return T.Master_Level + 1;
else
return T.Master_Top.Within;
end if;
end Master_Within;
procedure Enter_Master is
T : constant Task_Id := Current_Task_Id; -- and register
begin
pragma Check (Trace, Ada.Debug.Put (Name (T).all & " enter"));
declare
New_Master : constant Master_Access :=
new Master_Record'(
Previous => T.Master_Top,
Parent => T,
Within =>
Master_Level'Max (Master_Within, Library_Task_Level) + 1,
List => null,
Mutex => <>); -- uninitialized
begin
Synchronous_Objects.Initialize (New_Master.Mutex);
T.Master_Top := New_Master;
end;
pragma Check (Trace, Ada.Debug.Put (Name (T).all & " leave"));
end Enter_Master;
procedure Leave_Master is
T : constant Task_Id := TLS_Current_Task_Id;
pragma Check (Trace, Ada.Debug.Put (Name (T).all & " enter"));
M : Master_Access := T.Master_Top;
Free_List : Task_Id := null;
begin
pragma Assert (T.Abort_Handler = null);
Synchronous_Objects.Enter (M.Mutex);
while M.List /= null loop
declare
Taken : constant Task_Id := M.List;
Free_Task_Id : Task_Id;
A_Error : Activation_Error; -- ignored
S_Error : Boolean; -- ignored
Aborted : Boolean; -- ignored
begin
Taken.Auto_Detach := False; -- mark inside mutex
Synchronous_Objects.Leave (M.Mutex);
if Taken.Activation_State = AS_Suspended then
pragma Assert (Taken.Activation_Chain /= null);
-- the task has not been activated
Taken.Activation_Chain.Error := Elaboration_Error;
if Taken.Activation_Chain_Living then
Activate (
Taken.Activation_Chain.Self,
Error => A_Error,
Aborted => Aborted);
end if;
elsif T.Aborted then
-- If current task is already aborted, abort a child task.
-- C9A007A
Native_Tasks.Send_Abort_Signal (
Taken.Handle,
Taken.Abort_Event,
Error => S_Error);
else
-- If current task is aboted during waiting a child task,
-- abort a waited task quickly.
T.Abort_Handler := Abort_Handler_On_Leave_Master'Access;
if T.Kind = Sub then
-- Normally, T.Abort_Locking = 2.
Native_Tasks.Unblock_Abort_Signal;
end if;
end if;
Wait (Taken, Free_Task_Id);
if T.Abort_Handler /= null then
if T.Kind = Sub then
-- In Windows and in this loop, This is only where T.Abort
-- will be updated.
Native_Tasks.Block_Abort_Signal (T.Abort_Event);
end if;
T.Abort_Handler := null;
end if;
if Free_Task_Id /= null then
Remove_From_Completion_List (Free_Task_Id);
Free_Task_Id.Next_At_Same_Level := Free_List;
Free_List := Free_Task_Id;
end if;
Synchronous_Objects.Enter (M.Mutex);
end;
end loop;
Synchronous_Objects.Leave (M.Mutex);
while Free_List /= null loop
declare
Next : constant Task_Id := Free_List.Next_At_Same_Level;
begin
Free (Free_List);
Free_List := Next;
end;
end loop;
declare
Previous : constant Master_Access := M.Previous;
begin
Free (M);
T.Master_Top := Previous;
end;
pragma Check (Trace, Ada.Debug.Put (Name (T).all & " leave"));
end Leave_Master;
procedure Leave_All_Masters is
T : constant Task_Id := TLS_Current_Task_Id;
begin
if T.Master_Top /= null then
Leave_Master;
pragma Assert (T.Master_Top = null);
end if;
end Leave_All_Masters;
function Master_Of_Parent (Level : Master_Level) return Master_Access is
Parent : Task_Id := TLS_Current_Task_Id;
Result : Master_Access;
begin
while Parent.Master_Level >= Level loop
pragma Assert (Parent.Kind = Sub);
pragma Assert (Parent.Master_Of_Parent /= null);
pragma Assert (Parent.Master_Of_Parent.Parent /= null);
Parent := Parent.Master_Of_Parent.Parent;
end loop;
Result := Parent.Master_Top;
while Result /= null and then Result.Within > Level loop
Result := Result.Previous;
end loop;
if Result = null then
-- library-level
pragma Assert (Parent = Environment_Task_Record'Access);
if Parent.Master_Top = null then
Enter_Master;
pragma Assert (Parent.Master_Top.Within = Library_Task_Level + 1);
Parent.Master_Top.Within := Library_Task_Level;
end if;
Result := Parent.Master_Top;
end if;
return Result;
end Master_Of_Parent;
procedure Cancel_Calls is
T : constant Task_Id := TLS_Current_Task_Id;
begin
if T.Rendezvous /= null then
Synchronous_Objects.Cancel (
T.Rendezvous.Calling,
Cancel_Node => Cancel_Call_Hook);
end if;
end Cancel_Calls;
procedure Call (
T : not null Task_Id;
Item : not null Synchronous_Objects.Queue_Node_Access)
is
Canceled : Boolean;
begin
Synchronous_Objects.Add (T.Rendezvous.Calling, Item, Canceled);
if Canceled then
Raise_Exception (Tasking_Error'Identity);
end if;
end Call;
procedure Uncall (
T : not null Task_Id;
Item : not null Synchronous_Objects.Queue_Node_Access;
Already_Taken : out Boolean)
is
Taken : Synchronous_Objects.Queue_Node_Access;
begin
Synchronous_Objects.Take (
T.Rendezvous.Calling,
Taken,
QNA_Conv.To_Address (Item),
Uncall_Filter'Access);
Already_Taken := Taken = null;
pragma Assert (Taken = null or else Taken = Item);
end Uncall;
procedure Accept_Call (
Item : out Synchronous_Objects.Queue_Node_Access;
Params : Address;
Filter : Synchronous_Objects.Queue_Filter;
Aborted : out Boolean)
is
T : constant Task_Id := TLS_Current_Task_Id;
begin
Synchronous_Objects.Abortable.Take (
T.Rendezvous.Calling,
Item,
Params,
Filter,
Aborted);
end Accept_Call;
function Call_Count (
T : not null Task_Id;
Params : Address;
Filter : Synchronous_Objects.Queue_Filter)
return Natural is
begin
if not Callable (T) or else T.Rendezvous = null then
return 0;
else
return Synchronous_Objects.Count (
T.Rendezvous.Calling,
Params,
Filter);
end if;
end Call_Count;
function Callable (T : not null Task_Id) return Boolean is
begin
return not Terminated (T)
and then T.Kind = Sub
and then not T.Aborted
and then (
T.Rendezvous = null
or else not Synchronous_Objects.Canceled (T.Rendezvous.Calling));
end Callable;
-- attribute
procedure Allocate (Index : in out Attribute_Index) is
begin
Register; -- Ada.Task_Attributes can be instantiated before tasks
Synchronous_Objects.Enter (Attribute_Indexes_Lock);
-- initialization because Suppress_Initialization
Index.List := null;
Synchronous_Objects.Initialize (Index.Mutex);
-- search unused index
for I in 0 .. Attribute_Indexes_Length - 1 loop
if Attribute_Indexes (I) /= not 0 then
for J in Integer range 0 .. Standard'Word_Size - 1 loop
if (Attribute_Indexes (I) and (2 ** J)) = 0 then
Attribute_Indexes (I) := Attribute_Indexes (I) or (2 ** J);
Index.Index := I * Standard'Word_Size + J;
goto Found;
end if;
end loop;
end if;
end loop;
-- not found
Index.Index := Standard'Word_Size * Attribute_Indexes_Length;
declare
P : constant Natural := Attribute_Indexes_Length;
B : constant Natural := 0;
begin
Attribute_Index_Sets.Expand (
Attribute_Indexes,
Attribute_Indexes_Length,
P + 1,
0);
Attribute_Indexes (P) := Attribute_Indexes (P) or (2 ** B);
end;
<<Found>>
Synchronous_Objects.Leave (Attribute_Indexes_Lock);
end Allocate;
procedure Free (Index : in out Attribute_Index) is
begin
if Registered_State /= Unregistered then
Synchronous_Objects.Enter (Attribute_Indexes_Lock);
end if;
while Index.List /= null loop
declare
Next : constant Task_Id :=
Index.List.Attributes (Index.Index).Next;
begin
declare
A : Attribute
renames Index.List.Attributes (Index.Index);
begin
A.Finalize (A.Item);
A.Index := null;
end;
Index.List := Next;
end;
end loop;
if Registered_State /= Unregistered then
declare
P : constant Natural := Index.Index / Standard'Word_Size;
B : constant Natural := Index.Index mod Standard'Word_Size;
begin
Attribute_Indexes (P) := Attribute_Indexes (P) and not (2 ** B);
end;
end if;
Synchronous_Objects.Finalize (Index.Mutex);
if Registered_State /= Unregistered then
Synchronous_Objects.Leave (Attribute_Indexes_Lock);
end if;
end Free;
procedure Query (
T : not null Task_Id;
Index : aliased in out Attribute_Index;
Process : not null access procedure (Item : Address))
is
Value : Address;
begin
Synchronous_Objects.Enter (Index.Mutex);
if T.Attributes_Length > Index.Index
and then T.Attributes (Index.Index).Index = Index'Unchecked_Access
then
Value := T.Attributes (Index.Index).Item;
else
Value := Null_Address;
end if;
Process (Value);
Synchronous_Objects.Leave (Index.Mutex);
end Query;
procedure Set (
T : not null Task_Id;
Index : aliased in out Attribute_Index;
New_Item : not null access function return Address;
Finalize : not null access procedure (Item : Address))
is
type F is access procedure (Item : Address);
function To_Finalize_Handler is
new Ada.Unchecked_Conversion (F, Finalize_Handler);
begin
Synchronous_Objects.Enter (Index.Mutex);
Attribute_Vectors.Expand (
T.Attributes,
T.Attributes_Length,
Index.Index + 1,
Attribute'(Index => null, others => <>));
declare
A : Attribute
renames T.Attributes (Index.Index);
begin
if A.Index = Index'Unchecked_Access then
A.Finalize (A.Item);
end if;
A.Item := New_Item.all;
A.Finalize := To_Finalize_Handler (Finalize);
if A.Index /= Index'Unchecked_Access then
A.Index := Index'Unchecked_Access;
A.Previous := null;
A.Next := Index.List;
if Index.List /= null then
Index.List.Attributes (Index.Index).Previous := T;
end if;
Index.List := T;
end if;
end;
Synchronous_Objects.Leave (Index.Mutex);
end Set;
procedure Reference (
T : not null Task_Id;
Index : aliased in out Attribute_Index;
New_Item : not null access function return Address;
Finalize : not null access procedure (Item : Address);
Result : out Address)
is
type F is access procedure (Item : Address);
function To_Finalize_Handler is
new Ada.Unchecked_Conversion (F, Finalize_Handler);
begin
Synchronous_Objects.Enter (Index.Mutex);
Attribute_Vectors.Expand (
T.Attributes,
T.Attributes_Length,
Index.Index + 1,
Attribute'(Index => null, others => <>));
declare
A : Attribute
renames T.Attributes (Index.Index);
begin
if A.Index /= Index'Unchecked_Access then
A.Item := New_Item.all;
A.Finalize := To_Finalize_Handler (Finalize);
if A.Index /= Index'Unchecked_Access then
A.Index := Index'Unchecked_Access;
A.Previous := null;
A.Next := Index.List;
if Index.List /= null then
Index.List.Attributes (Index.Index).Previous := T;
end if;
Index.List := T;
end if;
end if;
Result := A.Item;
end;
Synchronous_Objects.Leave (Index.Mutex);
end Reference;
procedure Clear (
T : not null Task_Id;
Index : aliased in out Attribute_Index) is
begin
Synchronous_Objects.Enter (Index.Mutex);
if T.Attributes_Length > Index.Index
and then T.Attributes (Index.Index).Index = Index'Unchecked_Access
then
declare
A : Attribute
renames T.Attributes (Index.Index);
begin
A.Finalize (A.Item);
if A.Previous /= null then
A.Previous.Attributes (Index.Index).Next := A.Next;
else
A.Index.List := A.Next;
end if;
if A.Next /= null then
A.Next.Attributes (Index.Index).Previous := A.Previous;
end if;
A.Index := null;
end;
end if;
Synchronous_Objects.Leave (Index.Mutex);
end Clear;
-- termination handler
procedure Set_Dependents_Fallback_Handler (
T : Task_Id;
Handler : Termination_Handler) is
begin
T.Dependents_Fallback_Handler := Handler;
end Set_Dependents_Fallback_Handler;
function Dependents_Fallback_Handler (T : Task_Id)
return Termination_Handler is
begin
return T.Dependents_Fallback_Handler;
end Dependents_Fallback_Handler;
procedure Set_Specific_Handler (
T : Task_Id;
Handler : Termination_Handler) is
begin
T.Specific_Handler := Handler;
end Set_Specific_Handler;
function Specific_Handler (T : Task_Id) return Termination_Handler is
begin
return T.Specific_Handler;
end Specific_Handler;
end System.Tasks;
|
with Ada.Containers.Formal_Doubly_Linked_Lists;
package wrap with SPARK_Mode is
type Element_Type is (ONE, TWO);
function My_Eq (Left : Element_Type; Right : Element_Type) return Boolean is (Left = Right);
package My_Lists is new Ada.Containers.Formal_Doubly_Linked_Lists (Element_Type, My_Eq);
use My_Lists;
li : My_Lists.List (10);
procedure foo;
end wrap;
|
package body COBS.Stream.Encoder is
subtype Dispatch is Instance'Class;
procedure Do_Flush (This : in out Instance);
procedure Do_Flush (This : in out Instance) is
begin
Dispatch (This).Flush
(This.Buffer (This.Buffer'First .. This.Encode_Pointer - 1));
This.Code_Pointer := This.Buffer'First;
This.Encode_Pointer := This.Code_Pointer + 1;
end Do_Flush;
----------
-- Push --
----------
procedure Push (This : in out Instance; Data : Storage_Element) is
begin
if Data /= 0 then
This.Buffer (This.Encode_Pointer) := Data;
This.Encode_Pointer := This.Encode_Pointer + 1;
This.Code := This.Code + 1;
end if;
if Data = 0 or else This.Code = 16#FF# then
This.Buffer (This.Code_Pointer) := This.Code;
This.Prev_Code := This.Code;
Do_Flush (This);
This.Code := 1;
end if;
end Push;
---------------
-- End_Frame --
---------------
procedure End_Frame (This : in out Instance) is
begin
if This.Code /= 1 or else This.Prev_Code /= 16#FF# then
This.Buffer (This.Code_Pointer) := This.Code;
This.Buffer (This.Encode_Pointer) := 0;
This.Encode_Pointer := This.Encode_Pointer + 1;
else
This.Buffer (This.Code_Pointer) := 0;
end if;
Do_Flush (This);
This.Code := 1;
This.Prev_Code := 1;
end End_Frame;
end COBS.Stream.Encoder;
|
-- SPDX-License-Identifier: Apache-2.0
--
-- Copyright (c) 2012 Felix Krause <contact@flyx.org>
--
-- Licensed under the Apache License, Version 2.0 (the "License");
-- you may not use this file except in compliance with the License.
-- You may obtain a copy of the License at
--
-- http://www.apache.org/licenses/LICENSE-2.0
--
-- Unless required by applicable law or agreed to in writing, software
-- distributed under the License is distributed on an "AS IS" BASIS,
-- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-- See the License for the specific language governing permissions and
-- limitations under the License.
private with GL.Low_Level;
package GL.Enums.Textures is
pragma Preelaborate;
type Parameter is (Border_Color, Mag_Filter, Min_Filter, Wrap_S,
Wrap_T, Wrap_R, Min_LoD, Max_LoD,
Base_Level, Max_Level, Immutable_Levels, Max_Anisotropy,
LoD_Bias, Compare_Mode, Compare_Func, Cube_Map_Seamless);
type Compare_Kind is (None, Compare_R_To_Texture);
type Level_Parameter is (Width, Height, Internal_Format, Depth,
Compressed_Image_Size, Compressed,
Samples, Fixed_Sample_Locations,
Buffer_Offset, Buffer_Size);
private
for Parameter use (Border_Color => 16#1004#,
Mag_Filter => 16#2800#,
Min_Filter => 16#2801#,
Wrap_S => 16#2802#,
Wrap_T => 16#2803#,
Wrap_R => 16#8072#,
Min_LoD => 16#813A#,
Max_LoD => 16#813B#,
Base_Level => 16#813C#,
Max_Level => 16#813D#,
Immutable_Levels => 16#82DF#,
Max_Anisotropy => 16#84FE#,
LoD_Bias => 16#8501#,
Compare_Mode => 16#884C#,
Compare_Func => 16#884D#,
Cube_Map_Seamless => 16#884F#);
for Parameter'Size use Low_Level.Enum'Size;
for Compare_Kind use (None => 0, Compare_R_To_Texture => 16#884E#);
for Compare_Kind'Size use Low_Level.Enum'Size;
for Level_Parameter use (Width => 16#1000#,
Height => 16#1001#,
Internal_Format => 16#1003#,
Depth => 16#8071#,
Compressed_Image_Size => 16#86A0#,
Compressed => 16#86A1#,
Samples => 16#9106#,
Fixed_Sample_Locations => 16#9107#,
Buffer_Offset => 16#919D#,
Buffer_Size => 16#919E#);
for Level_Parameter'Size use Low_Level.Enum'Size;
end GL.Enums.Textures;
|
with Tkmrpc.Transport.Client;
with Tkmrpc.Request.Ike.Tkm_Version.Convert;
with Tkmrpc.Request.Ike.Tkm_Limits.Convert;
with Tkmrpc.Request.Ike.Tkm_Reset.Convert;
with Tkmrpc.Request.Ike.Nc_Reset.Convert;
with Tkmrpc.Request.Ike.Nc_Create.Convert;
with Tkmrpc.Request.Ike.Dh_Reset.Convert;
with Tkmrpc.Request.Ike.Dh_Create.Convert;
with Tkmrpc.Request.Ike.Dh_Generate_Key.Convert;
with Tkmrpc.Request.Ike.Cc_Reset.Convert;
with Tkmrpc.Request.Ike.Cc_Set_User_Certificate.Convert;
with Tkmrpc.Request.Ike.Cc_Add_Certificate.Convert;
with Tkmrpc.Request.Ike.Cc_Check_Ca.Convert;
with Tkmrpc.Request.Ike.Ae_Reset.Convert;
with Tkmrpc.Request.Ike.Isa_Reset.Convert;
with Tkmrpc.Request.Ike.Isa_Create.Convert;
with Tkmrpc.Request.Ike.Isa_Sign.Convert;
with Tkmrpc.Request.Ike.Isa_Auth.Convert;
with Tkmrpc.Request.Ike.Isa_Create_Child.Convert;
with Tkmrpc.Request.Ike.Isa_Skip_Create_First.Convert;
with Tkmrpc.Request.Ike.Esa_Reset.Convert;
with Tkmrpc.Request.Ike.Esa_Create.Convert;
with Tkmrpc.Request.Ike.Esa_Create_No_Pfs.Convert;
with Tkmrpc.Request.Ike.Esa_Create_First.Convert;
with Tkmrpc.Request.Ike.Esa_Select.Convert;
with Tkmrpc.Response.Ike.Tkm_Version.Convert;
with Tkmrpc.Response.Ike.Tkm_Limits.Convert;
with Tkmrpc.Response.Ike.Tkm_Reset.Convert;
with Tkmrpc.Response.Ike.Nc_Reset.Convert;
with Tkmrpc.Response.Ike.Nc_Create.Convert;
with Tkmrpc.Response.Ike.Dh_Reset.Convert;
with Tkmrpc.Response.Ike.Dh_Create.Convert;
with Tkmrpc.Response.Ike.Dh_Generate_Key.Convert;
with Tkmrpc.Response.Ike.Cc_Reset.Convert;
with Tkmrpc.Response.Ike.Cc_Set_User_Certificate.Convert;
with Tkmrpc.Response.Ike.Cc_Add_Certificate.Convert;
with Tkmrpc.Response.Ike.Cc_Check_Ca.Convert;
with Tkmrpc.Response.Ike.Ae_Reset.Convert;
with Tkmrpc.Response.Ike.Isa_Reset.Convert;
with Tkmrpc.Response.Ike.Isa_Create.Convert;
with Tkmrpc.Response.Ike.Isa_Sign.Convert;
with Tkmrpc.Response.Ike.Isa_Auth.Convert;
with Tkmrpc.Response.Ike.Isa_Create_Child.Convert;
with Tkmrpc.Response.Ike.Isa_Skip_Create_First.Convert;
with Tkmrpc.Response.Ike.Esa_Reset.Convert;
with Tkmrpc.Response.Ike.Esa_Create.Convert;
with Tkmrpc.Response.Ike.Esa_Create_No_Pfs.Convert;
with Tkmrpc.Response.Ike.Esa_Create_First.Convert;
with Tkmrpc.Response.Ike.Esa_Select.Convert;
package body Tkmrpc.Clients.Ike is
-------------------------------------------------------------------------
procedure Ae_Reset
(Result : out Results.Result_Type;
Ae_Id : Types.Ae_Id_Type)
is
Req : Request.Ike.Ae_Reset.Request_Type;
Res : Response.Ike.Ae_Reset.Response_Type;
Data : Response.Data_Type;
begin
if not (Ae_Id'Valid) then
Result := Results.Invalid_Parameter;
return;
end if;
Req := Request.Ike.Ae_Reset.Null_Request;
Req.Data.Ae_Id := Ae_Id;
Transport.Client.Send_Receive
(Req_Data => Request.Ike.Ae_Reset.Convert.To_Request (S => Req),
Res_Data => Data);
Res := Response.Ike.Ae_Reset.Convert.From_Response (S => Data);
Result := Res.Header.Result;
end Ae_Reset;
-------------------------------------------------------------------------
procedure Cc_Add_Certificate
(Result : out Results.Result_Type;
Cc_Id : Types.Cc_Id_Type;
Autha_Id : Types.Autha_Id_Type;
Certificate : Types.Certificate_Type)
is
Req : Request.Ike.Cc_Add_Certificate.Request_Type;
Res : Response.Ike.Cc_Add_Certificate.Response_Type;
Data : Response.Data_Type;
begin
if not (Cc_Id'Valid and Autha_Id'Valid and Certificate.Size'Valid) then
Result := Results.Invalid_Parameter;
return;
end if;
Req := Request.Ike.Cc_Add_Certificate.Null_Request;
Req.Data.Cc_Id := Cc_Id;
Req.Data.Autha_Id := Autha_Id;
Req.Data.Certificate := Certificate;
Transport.Client.Send_Receive
(Req_Data =>
Request.Ike.Cc_Add_Certificate.Convert.To_Request (S => Req),
Res_Data => Data);
Res :=
Response.Ike.Cc_Add_Certificate.Convert.From_Response (S => Data);
Result := Res.Header.Result;
end Cc_Add_Certificate;
-------------------------------------------------------------------------
procedure Cc_Check_Ca
(Result : out Results.Result_Type;
Cc_Id : Types.Cc_Id_Type;
Ca_Id : Types.Ca_Id_Type)
is
Req : Request.Ike.Cc_Check_Ca.Request_Type;
Res : Response.Ike.Cc_Check_Ca.Response_Type;
Data : Response.Data_Type;
begin
if not (Cc_Id'Valid and Ca_Id'Valid) then
Result := Results.Invalid_Parameter;
return;
end if;
Req := Request.Ike.Cc_Check_Ca.Null_Request;
Req.Data.Cc_Id := Cc_Id;
Req.Data.Ca_Id := Ca_Id;
Transport.Client.Send_Receive
(Req_Data => Request.Ike.Cc_Check_Ca.Convert.To_Request (S => Req),
Res_Data => Data);
Res := Response.Ike.Cc_Check_Ca.Convert.From_Response (S => Data);
Result := Res.Header.Result;
end Cc_Check_Ca;
-------------------------------------------------------------------------
procedure Cc_Reset
(Result : out Results.Result_Type;
Cc_Id : Types.Cc_Id_Type)
is
Req : Request.Ike.Cc_Reset.Request_Type;
Res : Response.Ike.Cc_Reset.Response_Type;
Data : Response.Data_Type;
begin
if not (Cc_Id'Valid) then
Result := Results.Invalid_Parameter;
return;
end if;
Req := Request.Ike.Cc_Reset.Null_Request;
Req.Data.Cc_Id := Cc_Id;
Transport.Client.Send_Receive
(Req_Data => Request.Ike.Cc_Reset.Convert.To_Request (S => Req),
Res_Data => Data);
Res := Response.Ike.Cc_Reset.Convert.From_Response (S => Data);
Result := Res.Header.Result;
end Cc_Reset;
-------------------------------------------------------------------------
procedure Cc_Set_User_Certificate
(Result : out Results.Result_Type;
Cc_Id : Types.Cc_Id_Type;
Ri_Id : Types.Ri_Id_Type;
Autha_Id : Types.Autha_Id_Type;
Certificate : Types.Certificate_Type)
is
Req : Request.Ike.Cc_Set_User_Certificate.Request_Type;
Res : Response.Ike.Cc_Set_User_Certificate.Response_Type;
Data : Response.Data_Type;
begin
if not (Cc_Id'Valid and
Ri_Id'Valid and
Autha_Id'Valid and
Certificate.Size'Valid)
then
Result := Results.Invalid_Parameter;
return;
end if;
Req :=
Request.Ike.Cc_Set_User_Certificate.Null_Request;
Req.Data.Cc_Id := Cc_Id;
Req.Data.Ri_Id := Ri_Id;
Req.Data.Autha_Id := Autha_Id;
Req.Data.Certificate := Certificate;
Transport.Client.Send_Receive
(Req_Data =>
Request.Ike.Cc_Set_User_Certificate.Convert.To_Request (S => Req),
Res_Data => Data);
Res :=
Response.Ike.Cc_Set_User_Certificate.Convert.From_Response
(S => Data);
Result := Res.Header.Result;
end Cc_Set_User_Certificate;
-------------------------------------------------------------------------
procedure Dh_Create
(Result : out Results.Result_Type;
Dh_Id : Types.Dh_Id_Type;
Dha_Id : Types.Dha_Id_Type;
Pubvalue : out Types.Dh_Pubvalue_Type)
is
use type Tkmrpc.Results.Result_Type;
Req : Request.Ike.Dh_Create.Request_Type;
Res : Response.Ike.Dh_Create.Response_Type;
Data : Response.Data_Type;
begin
if not (Dh_Id'Valid and Dha_Id'Valid) then
Result := Results.Invalid_Parameter;
return;
end if;
Req := Request.Ike.Dh_Create.Null_Request;
Req.Data.Dh_Id := Dh_Id;
Req.Data.Dha_Id := Dha_Id;
Transport.Client.Send_Receive
(Req_Data => Request.Ike.Dh_Create.Convert.To_Request (S => Req),
Res_Data => Data);
Res := Response.Ike.Dh_Create.Convert.From_Response (S => Data);
Result := Res.Header.Result;
if Result = Results.Ok then
Pubvalue := Res.Data.Pubvalue;
end if;
end Dh_Create;
-------------------------------------------------------------------------
procedure Dh_Generate_Key
(Result : out Results.Result_Type;
Dh_Id : Types.Dh_Id_Type;
Pubvalue : Types.Dh_Pubvalue_Type)
is
Req : Request.Ike.Dh_Generate_Key.Request_Type;
Res : Response.Ike.Dh_Generate_Key.Response_Type;
Data : Response.Data_Type;
begin
if not (Dh_Id'Valid and Pubvalue.Size'Valid) then
Result := Results.Invalid_Parameter;
return;
end if;
Req := Request.Ike.Dh_Generate_Key.Null_Request;
Req.Data.Dh_Id := Dh_Id;
Req.Data.Pubvalue := Pubvalue;
Transport.Client.Send_Receive
(Req_Data =>
Request.Ike.Dh_Generate_Key.Convert.To_Request (S => Req),
Res_Data => Data);
Res := Response.Ike.Dh_Generate_Key.Convert.From_Response (S => Data);
Result := Res.Header.Result;
end Dh_Generate_Key;
-------------------------------------------------------------------------
procedure Dh_Reset
(Result : out Results.Result_Type;
Dh_Id : Types.Dh_Id_Type)
is
Req : Request.Ike.Dh_Reset.Request_Type;
Res : Response.Ike.Dh_Reset.Response_Type;
Data : Response.Data_Type;
begin
if not (Dh_Id'Valid) then
Result := Results.Invalid_Parameter;
return;
end if;
Req := Request.Ike.Dh_Reset.Null_Request;
Req.Data.Dh_Id := Dh_Id;
Transport.Client.Send_Receive
(Req_Data => Request.Ike.Dh_Reset.Convert.To_Request (S => Req),
Res_Data => Data);
Res := Response.Ike.Dh_Reset.Convert.From_Response (S => Data);
Result := Res.Header.Result;
end Dh_Reset;
-------------------------------------------------------------------------
procedure Esa_Create
(Result : out Results.Result_Type;
Esa_Id : Types.Esa_Id_Type;
Isa_Id : Types.Isa_Id_Type;
Sp_Id : Types.Sp_Id_Type;
Ea_Id : Types.Ea_Id_Type;
Dh_Id : Types.Dh_Id_Type;
Nc_Loc_Id : Types.Nc_Id_Type;
Nonce_Rem : Types.Nonce_Type;
Initiator : Types.Init_Type;
Esp_Spi_Loc : Types.Esp_Spi_Type;
Esp_Spi_Rem : Types.Esp_Spi_Type)
is
Req : Request.Ike.Esa_Create.Request_Type;
Res : Response.Ike.Esa_Create.Response_Type;
Data : Response.Data_Type;
begin
if not (Esa_Id'Valid and
Isa_Id'Valid and
Sp_Id'Valid and
Ea_Id'Valid and
Dh_Id'Valid and
Nc_Loc_Id'Valid and
Nonce_Rem.Size'Valid and
Initiator'Valid and
Esp_Spi_Loc'Valid and
Esp_Spi_Rem'Valid)
then
Result := Results.Invalid_Parameter;
return;
end if;
Req := Request.Ike.Esa_Create.Null_Request;
Req.Data.Esa_Id := Esa_Id;
Req.Data.Isa_Id := Isa_Id;
Req.Data.Sp_Id := Sp_Id;
Req.Data.Ea_Id := Ea_Id;
Req.Data.Dh_Id := Dh_Id;
Req.Data.Nc_Loc_Id := Nc_Loc_Id;
Req.Data.Nonce_Rem := Nonce_Rem;
Req.Data.Initiator := Initiator;
Req.Data.Esp_Spi_Loc := Esp_Spi_Loc;
Req.Data.Esp_Spi_Rem := Esp_Spi_Rem;
Transport.Client.Send_Receive
(Req_Data => Request.Ike.Esa_Create.Convert.To_Request (S => Req),
Res_Data => Data);
Res := Response.Ike.Esa_Create.Convert.From_Response (S => Data);
Result := Res.Header.Result;
end Esa_Create;
-------------------------------------------------------------------------
procedure Esa_Create_First
(Result : out Results.Result_Type;
Esa_Id : Types.Esa_Id_Type;
Isa_Id : Types.Isa_Id_Type;
Sp_Id : Types.Sp_Id_Type;
Ea_Id : Types.Ea_Id_Type;
Esp_Spi_Loc : Types.Esp_Spi_Type;
Esp_Spi_Rem : Types.Esp_Spi_Type)
is
Req : Request.Ike.Esa_Create_First.Request_Type;
Res : Response.Ike.Esa_Create_First.Response_Type;
Data : Response.Data_Type;
begin
if not (Esa_Id'Valid and
Isa_Id'Valid and
Sp_Id'Valid and
Ea_Id'Valid and
Esp_Spi_Loc'Valid and
Esp_Spi_Rem'Valid)
then
Result := Results.Invalid_Parameter;
return;
end if;
Req := Request.Ike.Esa_Create_First.Null_Request;
Req.Data.Esa_Id := Esa_Id;
Req.Data.Isa_Id := Isa_Id;
Req.Data.Sp_Id := Sp_Id;
Req.Data.Ea_Id := Ea_Id;
Req.Data.Esp_Spi_Loc := Esp_Spi_Loc;
Req.Data.Esp_Spi_Rem := Esp_Spi_Rem;
Transport.Client.Send_Receive
(Req_Data =>
Request.Ike.Esa_Create_First.Convert.To_Request (S => Req),
Res_Data => Data);
Res := Response.Ike.Esa_Create_First.Convert.From_Response (S => Data);
Result := Res.Header.Result;
end Esa_Create_First;
-------------------------------------------------------------------------
procedure Esa_Create_No_Pfs
(Result : out Results.Result_Type;
Esa_Id : Types.Esa_Id_Type;
Isa_Id : Types.Isa_Id_Type;
Sp_Id : Types.Sp_Id_Type;
Ea_Id : Types.Ea_Id_Type;
Nc_Loc_Id : Types.Nc_Id_Type;
Nonce_Rem : Types.Nonce_Type;
Initiator : Types.Init_Type;
Esp_Spi_Loc : Types.Esp_Spi_Type;
Esp_Spi_Rem : Types.Esp_Spi_Type)
is
Req : Request.Ike.Esa_Create_No_Pfs.Request_Type;
Res : Response.Ike.Esa_Create_No_Pfs.Response_Type;
Data : Response.Data_Type;
begin
if not (Esa_Id'Valid and
Isa_Id'Valid and
Sp_Id'Valid and
Ea_Id'Valid and
Nc_Loc_Id'Valid and
Nonce_Rem.Size'Valid and
Initiator'Valid and
Esp_Spi_Loc'Valid and
Esp_Spi_Rem'Valid)
then
Result := Results.Invalid_Parameter;
return;
end if;
Req := Request.Ike.Esa_Create_No_Pfs.Null_Request;
Req.Data.Esa_Id := Esa_Id;
Req.Data.Isa_Id := Isa_Id;
Req.Data.Sp_Id := Sp_Id;
Req.Data.Ea_Id := Ea_Id;
Req.Data.Nc_Loc_Id := Nc_Loc_Id;
Req.Data.Nonce_Rem := Nonce_Rem;
Req.Data.Initiator := Initiator;
Req.Data.Esp_Spi_Loc := Esp_Spi_Loc;
Req.Data.Esp_Spi_Rem := Esp_Spi_Rem;
Transport.Client.Send_Receive
(Req_Data =>
Request.Ike.Esa_Create_No_Pfs.Convert.To_Request (S => Req),
Res_Data => Data);
Res := Response.Ike.Esa_Create_No_Pfs.Convert.From_Response (S => Data);
Result := Res.Header.Result;
end Esa_Create_No_Pfs;
-------------------------------------------------------------------------
procedure Esa_Reset
(Result : out Results.Result_Type;
Esa_Id : Types.Esa_Id_Type)
is
Req : Request.Ike.Esa_Reset.Request_Type;
Res : Response.Ike.Esa_Reset.Response_Type;
Data : Response.Data_Type;
begin
if not (Esa_Id'Valid) then
Result := Results.Invalid_Parameter;
return;
end if;
Req := Request.Ike.Esa_Reset.Null_Request;
Req.Data.Esa_Id := Esa_Id;
Transport.Client.Send_Receive
(Req_Data => Request.Ike.Esa_Reset.Convert.To_Request (S => Req),
Res_Data => Data);
Res := Response.Ike.Esa_Reset.Convert.From_Response (S => Data);
Result := Res.Header.Result;
end Esa_Reset;
-------------------------------------------------------------------------
procedure Esa_Select
(Result : out Results.Result_Type;
Esa_Id : Types.Esa_Id_Type)
is
Req : Request.Ike.Esa_Select.Request_Type;
Res : Response.Ike.Esa_Select.Response_Type;
Data : Response.Data_Type;
begin
if not (Esa_Id'Valid) then
Result := Results.Invalid_Parameter;
return;
end if;
Req := Request.Ike.Esa_Select.Null_Request;
Req.Data.Esa_Id := Esa_Id;
Transport.Client.Send_Receive
(Req_Data => Request.Ike.Esa_Select.Convert.To_Request (S => Req),
Res_Data => Data);
Res := Response.Ike.Esa_Select.Convert.From_Response (S => Data);
Result := Res.Header.Result;
end Esa_Select;
-------------------------------------------------------------------------
procedure Init
(Result : out Results.Result_Type;
Address : Interfaces.C.Strings.chars_ptr) is separate;
-------------------------------------------------------------------------
procedure Isa_Auth
(Result : out Results.Result_Type;
Isa_Id : Types.Isa_Id_Type;
Cc_Id : Types.Cc_Id_Type;
Init_Message : Types.Init_Message_Type;
Signature : Types.Signature_Type)
is
Req : Request.Ike.Isa_Auth.Request_Type;
Res : Response.Ike.Isa_Auth.Response_Type;
Data : Response.Data_Type;
begin
if not (Isa_Id'Valid and
Cc_Id'Valid and
Init_Message.Size'Valid and
Signature.Size'Valid)
then
Result := Results.Invalid_Parameter;
return;
end if;
Req := Request.Ike.Isa_Auth.Null_Request;
Req.Data.Isa_Id := Isa_Id;
Req.Data.Cc_Id := Cc_Id;
Req.Data.Init_Message := Init_Message;
Req.Data.Signature := Signature;
Transport.Client.Send_Receive
(Req_Data => Request.Ike.Isa_Auth.Convert.To_Request (S => Req),
Res_Data => Data);
Res := Response.Ike.Isa_Auth.Convert.From_Response (S => Data);
Result := Res.Header.Result;
end Isa_Auth;
-------------------------------------------------------------------------
procedure Isa_Create
(Result : out Results.Result_Type;
Isa_Id : Types.Isa_Id_Type;
Ae_Id : Types.Ae_Id_Type;
Ia_Id : Types.Ia_Id_Type;
Dh_Id : Types.Dh_Id_Type;
Nc_Loc_Id : Types.Nc_Id_Type;
Nonce_Rem : Types.Nonce_Type;
Initiator : Types.Init_Type;
Spi_Loc : Types.Ike_Spi_Type;
Spi_Rem : Types.Ike_Spi_Type;
Sk_Ai : out Types.Key_Type;
Sk_Ar : out Types.Key_Type;
Sk_Ei : out Types.Key_Type;
Sk_Er : out Types.Key_Type)
is
use type Tkmrpc.Results.Result_Type;
Req : Request.Ike.Isa_Create.Request_Type;
Res : Response.Ike.Isa_Create.Response_Type;
Data : Response.Data_Type;
begin
if not (Isa_Id'Valid and
Ae_Id'Valid and
Ia_Id'Valid and
Dh_Id'Valid and
Nc_Loc_Id'Valid and
Nonce_Rem.Size'Valid and
Initiator'Valid and
Spi_Loc'Valid and
Spi_Rem'Valid)
then
Result := Results.Invalid_Parameter;
return;
end if;
Req := Request.Ike.Isa_Create.Null_Request;
Req.Data.Isa_Id := Isa_Id;
Req.Data.Ae_Id := Ae_Id;
Req.Data.Ia_Id := Ia_Id;
Req.Data.Dh_Id := Dh_Id;
Req.Data.Nc_Loc_Id := Nc_Loc_Id;
Req.Data.Nonce_Rem := Nonce_Rem;
Req.Data.Initiator := Initiator;
Req.Data.Spi_Loc := Spi_Loc;
Req.Data.Spi_Rem := Spi_Rem;
Transport.Client.Send_Receive
(Req_Data => Request.Ike.Isa_Create.Convert.To_Request (S => Req),
Res_Data => Data);
Res := Response.Ike.Isa_Create.Convert.From_Response (S => Data);
Result := Res.Header.Result;
if Result = Results.Ok then
Sk_Ai := Res.Data.Sk_Ai;
Sk_Ar := Res.Data.Sk_Ar;
Sk_Ei := Res.Data.Sk_Ei;
Sk_Er := Res.Data.Sk_Er;
end if;
end Isa_Create;
-------------------------------------------------------------------------
procedure Isa_Create_Child
(Result : out Results.Result_Type;
Isa_Id : Types.Isa_Id_Type;
Parent_Isa_Id : Types.Isa_Id_Type;
Ia_Id : Types.Ia_Id_Type;
Dh_Id : Types.Dh_Id_Type;
Nc_Loc_Id : Types.Nc_Id_Type;
Nonce_Rem : Types.Nonce_Type;
Initiator : Types.Init_Type;
Spi_Loc : Types.Ike_Spi_Type;
Spi_Rem : Types.Ike_Spi_Type;
Sk_Ai : out Types.Key_Type;
Sk_Ar : out Types.Key_Type;
Sk_Ei : out Types.Key_Type;
Sk_Er : out Types.Key_Type)
is
use type Tkmrpc.Results.Result_Type;
Req : Request.Ike.Isa_Create_Child.Request_Type;
Res : Response.Ike.Isa_Create_Child.Response_Type;
Data : Response.Data_Type;
begin
if not (Isa_Id'Valid and
Parent_Isa_Id'Valid and
Ia_Id'Valid and
Dh_Id'Valid and
Nc_Loc_Id'Valid and
Nonce_Rem.Size'Valid and
Initiator'Valid and
Spi_Loc'Valid and
Spi_Rem'Valid)
then
Result := Results.Invalid_Parameter;
return;
end if;
Req := Request.Ike.Isa_Create_Child.Null_Request;
Req.Data.Isa_Id := Isa_Id;
Req.Data.Parent_Isa_Id := Parent_Isa_Id;
Req.Data.Ia_Id := Ia_Id;
Req.Data.Dh_Id := Dh_Id;
Req.Data.Nc_Loc_Id := Nc_Loc_Id;
Req.Data.Nonce_Rem := Nonce_Rem;
Req.Data.Initiator := Initiator;
Req.Data.Spi_Loc := Spi_Loc;
Req.Data.Spi_Rem := Spi_Rem;
Transport.Client.Send_Receive
(Req_Data =>
Request.Ike.Isa_Create_Child.Convert.To_Request (S => Req),
Res_Data => Data);
Res := Response.Ike.Isa_Create_Child.Convert.From_Response (S => Data);
Result := Res.Header.Result;
if Result = Results.Ok then
Sk_Ai := Res.Data.Sk_Ai;
Sk_Ar := Res.Data.Sk_Ar;
Sk_Ei := Res.Data.Sk_Ei;
Sk_Er := Res.Data.Sk_Er;
end if;
end Isa_Create_Child;
-------------------------------------------------------------------------
procedure Isa_Reset
(Result : out Results.Result_Type;
Isa_Id : Types.Isa_Id_Type)
is
Req : Request.Ike.Isa_Reset.Request_Type;
Res : Response.Ike.Isa_Reset.Response_Type;
Data : Response.Data_Type;
begin
if not (Isa_Id'Valid) then
Result := Results.Invalid_Parameter;
return;
end if;
Req := Request.Ike.Isa_Reset.Null_Request;
Req.Data.Isa_Id := Isa_Id;
Transport.Client.Send_Receive
(Req_Data => Request.Ike.Isa_Reset.Convert.To_Request (S => Req),
Res_Data => Data);
Res := Response.Ike.Isa_Reset.Convert.From_Response (S => Data);
Result := Res.Header.Result;
end Isa_Reset;
-------------------------------------------------------------------------
procedure Isa_Sign
(Result : out Results.Result_Type;
Isa_Id : Types.Isa_Id_Type;
Lc_Id : Types.Lc_Id_Type;
Init_Message : Types.Init_Message_Type;
Signature : out Types.Signature_Type)
is
use type Tkmrpc.Results.Result_Type;
Req : Request.Ike.Isa_Sign.Request_Type;
Res : Response.Ike.Isa_Sign.Response_Type;
Data : Response.Data_Type;
begin
if not (Isa_Id'Valid and Lc_Id'Valid and Init_Message.Size'Valid) then
Result := Results.Invalid_Parameter;
return;
end if;
Req := Request.Ike.Isa_Sign.Null_Request;
Req.Data.Isa_Id := Isa_Id;
Req.Data.Lc_Id := Lc_Id;
Req.Data.Init_Message := Init_Message;
Transport.Client.Send_Receive
(Req_Data => Request.Ike.Isa_Sign.Convert.To_Request (S => Req),
Res_Data => Data);
Res := Response.Ike.Isa_Sign.Convert.From_Response (S => Data);
Result := Res.Header.Result;
if Result = Results.Ok then
Signature := Res.Data.Signature;
end if;
end Isa_Sign;
-------------------------------------------------------------------------
procedure Isa_Skip_Create_First
(Result : out Results.Result_Type;
Isa_Id : Types.Isa_Id_Type)
is
Req : Request.Ike.Isa_Skip_Create_First.Request_Type;
Res : Response.Ike.Isa_Skip_Create_First.Response_Type;
Data : Response.Data_Type;
begin
if not (Isa_Id'Valid) then
Result := Results.Invalid_Parameter;
return;
end if;
Req := Request.Ike.Isa_Skip_Create_First.Null_Request;
Req.Data.Isa_Id := Isa_Id;
Transport.Client.Send_Receive
(Req_Data =>
Request.Ike.Isa_Skip_Create_First.Convert.To_Request (S => Req),
Res_Data => Data);
Res :=
Response.Ike.Isa_Skip_Create_First.Convert.From_Response (S => Data);
Result := Res.Header.Result;
end Isa_Skip_Create_First;
-------------------------------------------------------------------------
procedure Nc_Create
(Result : out Results.Result_Type;
Nc_Id : Types.Nc_Id_Type;
Nonce_Length : Types.Nonce_Length_Type;
Nonce : out Types.Nonce_Type)
is
use type Tkmrpc.Results.Result_Type;
Req : Request.Ike.Nc_Create.Request_Type;
Res : Response.Ike.Nc_Create.Response_Type;
Data : Response.Data_Type;
begin
if not (Nc_Id'Valid and Nonce_Length'Valid) then
Result := Results.Invalid_Parameter;
return;
end if;
Req := Request.Ike.Nc_Create.Null_Request;
Req.Data.Nc_Id := Nc_Id;
Req.Data.Nonce_Length := Nonce_Length;
Transport.Client.Send_Receive
(Req_Data => Request.Ike.Nc_Create.Convert.To_Request (S => Req),
Res_Data => Data);
Res := Response.Ike.Nc_Create.Convert.From_Response (S => Data);
Result := Res.Header.Result;
if Result = Results.Ok then
Nonce := Res.Data.Nonce;
end if;
end Nc_Create;
-------------------------------------------------------------------------
procedure Nc_Reset
(Result : out Results.Result_Type;
Nc_Id : Types.Nc_Id_Type)
is
Req : Request.Ike.Nc_Reset.Request_Type;
Res : Response.Ike.Nc_Reset.Response_Type;
Data : Response.Data_Type;
begin
if not (Nc_Id'Valid) then
Result := Results.Invalid_Parameter;
return;
end if;
Req := Request.Ike.Nc_Reset.Null_Request;
Req.Data.Nc_Id := Nc_Id;
Transport.Client.Send_Receive
(Req_Data => Request.Ike.Nc_Reset.Convert.To_Request (S => Req),
Res_Data => Data);
Res := Response.Ike.Nc_Reset.Convert.From_Response (S => Data);
Result := Res.Header.Result;
end Nc_Reset;
-------------------------------------------------------------------------
procedure Tkm_Limits
(Result : out Results.Result_Type;
Max_Active_Requests : out Types.Active_Requests_Type;
Nc_Contexts : out Types.Nc_Id_Type;
Dh_Contexts : out Types.Dh_Id_Type;
Cc_Contexts : out Types.Cc_Id_Type;
Ae_Contexts : out Types.Ae_Id_Type;
Isa_Contexts : out Types.Isa_Id_Type;
Esa_Contexts : out Types.Esa_Id_Type)
is
use type Tkmrpc.Results.Result_Type;
Req : Request.Ike.Tkm_Limits.Request_Type;
Res : Response.Ike.Tkm_Limits.Response_Type;
Data : Response.Data_Type;
begin
Req := Request.Ike.Tkm_Limits.Null_Request;
Transport.Client.Send_Receive
(Req_Data => Request.Ike.Tkm_Limits.Convert.To_Request (S => Req),
Res_Data => Data);
Res := Response.Ike.Tkm_Limits.Convert.From_Response (S => Data);
Result := Res.Header.Result;
if Result = Results.Ok then
Max_Active_Requests := Res.Data.Max_Active_Requests;
Nc_Contexts := Res.Data.Nc_Contexts;
Dh_Contexts := Res.Data.Dh_Contexts;
Cc_Contexts := Res.Data.Cc_Contexts;
Ae_Contexts := Res.Data.Ae_Contexts;
Isa_Contexts := Res.Data.Isa_Contexts;
Esa_Contexts := Res.Data.Esa_Contexts;
end if;
end Tkm_Limits;
-------------------------------------------------------------------------
procedure Tkm_Reset (Result : out Results.Result_Type) is
Req : Request.Ike.Tkm_Reset.Request_Type;
Res : Response.Ike.Tkm_Reset.Response_Type;
Data : Response.Data_Type;
begin
Req := Request.Ike.Tkm_Reset.Null_Request;
Transport.Client.Send_Receive
(Req_Data => Request.Ike.Tkm_Reset.Convert.To_Request (S => Req),
Res_Data => Data);
Res := Response.Ike.Tkm_Reset.Convert.From_Response (S => Data);
Result := Res.Header.Result;
end Tkm_Reset;
-------------------------------------------------------------------------
procedure Tkm_Version
(Result : out Results.Result_Type;
Version : out Types.Version_Type)
is
use type Tkmrpc.Results.Result_Type;
Req : Request.Ike.Tkm_Version.Request_Type;
Res : Response.Ike.Tkm_Version.Response_Type;
Data : Response.Data_Type;
begin
Req := Request.Ike.Tkm_Version.Null_Request;
Transport.Client.Send_Receive
(Req_Data => Request.Ike.Tkm_Version.Convert.To_Request (S => Req),
Res_Data => Data);
Res := Response.Ike.Tkm_Version.Convert.From_Response (S => Data);
Result := Res.Header.Result;
if Result = Results.Ok then
Version := Res.Data.Version;
end if;
end Tkm_Version;
end Tkmrpc.Clients.Ike;
|
pragma License (Unrestricted);
package Ada.Strings.Unbounded.Aux is
pragma Preelaborate;
subtype Big_String is String (1 .. Positive'Last);
type Big_String_Access is access all Big_String;
for Big_String_Access'Storage_Size use 0;
procedure Get_String (
U : Unbounded_String;
S : out Big_String_Access;
L : out Natural);
end Ada.Strings.Unbounded.Aux;
|
------------------------------------------------------------------------------
-- --
-- GNAT COMPILER COMPONENTS --
-- --
-- E X P _ D I S P --
-- --
-- S p e c --
-- --
-- $Revision$
-- --
-- Copyright (C) 1992-1998 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. --
-- --
------------------------------------------------------------------------------
-- This package contains routines involved in tagged types and dynamic
-- dispatching expansion
with Types; use Types;
package Exp_Disp is
type DT_Access_Action is
(CW_Membership,
DT_Entry_Size,
DT_Prologue_Size,
Get_Expanded_Name,
Get_External_Tag,
Get_Prim_Op_Address,
Get_RC_Offset,
Get_Remotely_Callable,
Get_TSD,
Inherit_DT,
Inherit_TSD,
Register_Tag,
Set_Expanded_Name,
Set_External_Tag,
Set_Prim_Op_Address,
Set_RC_Offset,
Set_Remotely_Callable,
Set_TSD,
TSD_Entry_Size,
TSD_Prologue_Size);
function Fill_DT_Entry
(Loc : Source_Ptr;
Prim : Entity_Id)
return Node_Id;
-- Generate the code necessary to fill the appropriate entry of the
-- dispatch table of Prim's controlling type with Prim's address.
function Make_DT_Access_Action
(Typ : Entity_Id;
Action : DT_Access_Action;
Args : List_Id)
return Node_Id;
-- Generate a call to one of the Dispatch Table Access Subprograms defined
-- in Ada.Tags or in Interfaces.Cpp
function Make_DT (Typ : Entity_Id) return List_Id;
-- Expand the declarations for the Dispatch Table (or the Vtable in
-- the case of type whose ancestor is a CPP_Class)
procedure Set_All_DT_Position (Typ : Entity_Id);
-- Set the DT_Position field for each primitive operation. In the CPP
-- Class case check that no pragma CPP_Virtual is missing and that the
-- DT_Position are coherent
procedure Expand_Dispatch_Call (Call_Node : Node_Id);
-- Expand the call to the operation through the dispatch table and perform
-- the required tag checks when appropriate. For CPP types the call is
-- done through the Vtable (tag checks are not relevant)
procedure Set_Default_Constructor (Typ : Entity_Id);
-- Typ is a CPP_Class type. Create the Init procedure of that type to
-- be the default constructor (i.e. the function returning this type,
-- having a pragma CPP_Constructor and no parameter)
function Get_Remotely_Callable (Obj : Node_Id) return Node_Id;
-- Return an expression that holds True if the object can be transmitted
-- onto another partition according to E.4 (18)
end Exp_Disp;
|
------------------------------------------------------------------------------
-- --
-- Unicode Utilities --
-- --
-- General Category Query Utility --
-- --
-- ------------------------------------------------------------------------ --
-- --
-- Copyright (C) 2019, ANNEXI-STRAYLINE Trans-Human Ltd. --
-- All rights reserved. --
-- --
-- Original Contributors: --
-- * Richard Wai (ANNEXI-STRAYLINE) --
-- --
-- Redistribution and use in source and binary forms, with or without --
-- modification, are permitted provided that the following conditions are --
-- met: --
-- --
-- * Redistributions of source code must retain the above copyright --
-- notice, this list of conditions and the following disclaimer. --
-- --
-- * Redistributions in binary form must reproduce the above copyright --
-- notice, this list of conditions and the following disclaimer in --
-- the documentation and/or other materials provided with the --
-- distribution. --
-- --
-- * Neither the name of the copyright holder nor the names of its --
-- contributors may be used to endorse or promote products derived --
-- from this software without specific prior written permission. --
-- --
-- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS --
-- "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT --
-- LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A --
-- PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT --
-- OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, --
-- SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT --
-- LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, --
-- DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY --
-- THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT --
-- (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE --
-- OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. --
-- --
------------------------------------------------------------------------------
-- Generated: 2019-08-13
-- UnicodeData.txt source:
-- https://www.unicode.org/Public/UCD/latest/ucd/UnicodeData.txt
-- ********** THIS FILE IS AUTOMATICALLY GENERATED ********* --
-- - See Unicode.UCD.Generate_General_Category_Body - --
-- UnicodeData.txt Load Statistics --
-- LETTER_UPPERCASE (Lu) = 1788
-- LETTER_LOWERCASE (Ll) = 2151
-- LETTER_TITLECASE (Lt) = 31
-- LETTER_MODIFIER (Lm) = 259
-- LETTER_OTHER (Lo) = 121414
-- MARK_NONSPACING (Mn) = 1826
-- MARK_SPACING_COMBINING (Mc) = 429
-- MARK_ENCLOSING (Me) = 13
-- NUMBER_DECIMAL_DIGIT (Nd) = 630
-- NUMBER_LETTER (Nl) = 236
-- NUMBER_OTHER (No) = 888
-- PUNCTUATION_CONNECTOR (Pc) = 10
-- PUNCTUATION_DASH (Pd) = 24
-- PUNCTUATION_OPEN (Ps) = 75
-- PUNCTUATION_CLOSE (Pe) = 73
-- PUNCTUATION_INITIAL_QUOTE (Pi) = 12
-- PUNCTUATION_FINAL_QUOTE (Pf) = 10
-- PUNCTUATION_OTHER (Po) = 588
-- SYMBOL_MATH (Sm) = 948
-- SYMBOL_CURRENCY (Sc) = 62
-- SYMBOL_MODIFIER (Sk) = 121
-- SYMBOL_OTHER (So) = 6161
-- SEPARATOR_SPACE (Zs) = 17
-- SEPARATOR_LINE (Zl) = 1
-- SEPARATOR_PARAGRAPH (Zp) = 1
-- OTHER_CONTROL (Cc) = 65
-- OTHER_FORMAT (Cf) = 161
-- OTHER_SURROGATE (Cs) = 2048
-- OTHER_PRIVATE_USE (Co) = 137468
-- OTHER_NOT_ASSIGNED (Cn) = 836602
----------------------------------------------
-- Grand Total = 1114112
--
-- Sanity Checks --
-- [PASS] Grand total = 16#110000# (U+000000 .. U+10FFFF)
-- [PASS] Total loaded ( 277510 ) = Hash table totals excluding Cn ( 277510 )
package body Unicode.General_Category is
type Codepoint is mod 2**24;
function Plane_00_Lookup (C: Codepoint) return General_Category_Type is
(case C is
when 16#000000# .. 16#00001F# => OTHER_CONTROL,
when 16#000020# => SEPARATOR_SPACE,
when 16#000021# .. 16#000023# => PUNCTUATION_OTHER,
when 16#000024# => SYMBOL_CURRENCY,
when 16#000025# .. 16#000027# => PUNCTUATION_OTHER,
when 16#000028# => PUNCTUATION_OPEN,
when 16#000029# => PUNCTUATION_CLOSE,
when 16#00002A# => PUNCTUATION_OTHER,
when 16#00002B# => SYMBOL_MATH,
when 16#00002C# => PUNCTUATION_OTHER,
when 16#00002D# => PUNCTUATION_DASH,
when 16#00002E# .. 16#00002F# => PUNCTUATION_OTHER,
when 16#000030# .. 16#000039# => NUMBER_DECIMAL_DIGIT,
when 16#00003A# .. 16#00003B# => PUNCTUATION_OTHER,
when 16#00003C# .. 16#00003E# => SYMBOL_MATH,
when 16#00003F# .. 16#000040# => PUNCTUATION_OTHER,
when 16#000041# .. 16#00005A# => LETTER_UPPERCASE,
when 16#00005B# => PUNCTUATION_OPEN,
when 16#00005C# => PUNCTUATION_OTHER,
when 16#00005D# => PUNCTUATION_CLOSE,
when 16#00005E# => SYMBOL_MODIFIER,
when 16#00005F# => PUNCTUATION_CONNECTOR,
when 16#000060# => SYMBOL_MODIFIER,
when 16#000061# .. 16#00007A# => LETTER_LOWERCASE,
when 16#00007B# => PUNCTUATION_OPEN,
when 16#00007C# => SYMBOL_MATH,
when 16#00007D# => PUNCTUATION_CLOSE,
when 16#00007E# => SYMBOL_MATH,
when 16#00007F# .. 16#00009F# => OTHER_CONTROL,
when 16#0000A0# => SEPARATOR_SPACE,
when 16#0000A1# => PUNCTUATION_OTHER,
when 16#0000A2# .. 16#0000A5# => SYMBOL_CURRENCY,
when 16#0000A6# => SYMBOL_OTHER,
when 16#0000A7# => PUNCTUATION_OTHER,
when 16#0000A8# => SYMBOL_MODIFIER,
when 16#0000A9# => SYMBOL_OTHER,
when 16#0000AA# => LETTER_OTHER,
when 16#0000AB# => PUNCTUATION_INITIAL_QUOTE,
when 16#0000AC# => SYMBOL_MATH,
when 16#0000AD# => OTHER_FORMAT,
when 16#0000AE# => SYMBOL_OTHER,
when 16#0000AF# => SYMBOL_MODIFIER,
when 16#0000B0# => SYMBOL_OTHER,
when 16#0000B1# => SYMBOL_MATH,
when 16#0000B2# .. 16#0000B3# => NUMBER_OTHER,
when 16#0000B4# => SYMBOL_MODIFIER,
when 16#0000B5# => LETTER_LOWERCASE,
when 16#0000B6# .. 16#0000B7# => PUNCTUATION_OTHER,
when 16#0000B8# => SYMBOL_MODIFIER,
when 16#0000B9# => NUMBER_OTHER,
when 16#0000BA# => LETTER_OTHER,
when 16#0000BB# => PUNCTUATION_FINAL_QUOTE,
when 16#0000BC# .. 16#0000BE# => NUMBER_OTHER,
when 16#0000BF# => PUNCTUATION_OTHER,
when 16#0000C0# .. 16#0000D6# => LETTER_UPPERCASE,
when 16#0000D7# => SYMBOL_MATH,
when 16#0000D8# .. 16#0000DE# => LETTER_UPPERCASE,
when 16#0000DF# .. 16#0000F6# => LETTER_LOWERCASE,
when 16#0000F7# => SYMBOL_MATH,
when 16#0000F8# .. 16#0000FF# => LETTER_LOWERCASE,
when 16#000100# => LETTER_UPPERCASE,
when 16#000101# => LETTER_LOWERCASE,
when 16#000102# => LETTER_UPPERCASE,
when 16#000103# => LETTER_LOWERCASE,
when 16#000104# => LETTER_UPPERCASE,
when 16#000105# => LETTER_LOWERCASE,
when 16#000106# => LETTER_UPPERCASE,
when 16#000107# => LETTER_LOWERCASE,
when 16#000108# => LETTER_UPPERCASE,
when 16#000109# => LETTER_LOWERCASE,
when 16#00010A# => LETTER_UPPERCASE,
when 16#00010B# => LETTER_LOWERCASE,
when 16#00010C# => LETTER_UPPERCASE,
when 16#00010D# => LETTER_LOWERCASE,
when 16#00010E# => LETTER_UPPERCASE,
when 16#00010F# => LETTER_LOWERCASE,
when 16#000110# => LETTER_UPPERCASE,
when 16#000111# => LETTER_LOWERCASE,
when 16#000112# => LETTER_UPPERCASE,
when 16#000113# => LETTER_LOWERCASE,
when 16#000114# => LETTER_UPPERCASE,
when 16#000115# => LETTER_LOWERCASE,
when 16#000116# => LETTER_UPPERCASE,
when 16#000117# => LETTER_LOWERCASE,
when 16#000118# => LETTER_UPPERCASE,
when 16#000119# => LETTER_LOWERCASE,
when 16#00011A# => LETTER_UPPERCASE,
when 16#00011B# => LETTER_LOWERCASE,
when 16#00011C# => LETTER_UPPERCASE,
when 16#00011D# => LETTER_LOWERCASE,
when 16#00011E# => LETTER_UPPERCASE,
when 16#00011F# => LETTER_LOWERCASE,
when 16#000120# => LETTER_UPPERCASE,
when 16#000121# => LETTER_LOWERCASE,
when 16#000122# => LETTER_UPPERCASE,
when 16#000123# => LETTER_LOWERCASE,
when 16#000124# => LETTER_UPPERCASE,
when 16#000125# => LETTER_LOWERCASE,
when 16#000126# => LETTER_UPPERCASE,
when 16#000127# => LETTER_LOWERCASE,
when 16#000128# => LETTER_UPPERCASE,
when 16#000129# => LETTER_LOWERCASE,
when 16#00012A# => LETTER_UPPERCASE,
when 16#00012B# => LETTER_LOWERCASE,
when 16#00012C# => LETTER_UPPERCASE,
when 16#00012D# => LETTER_LOWERCASE,
when 16#00012E# => LETTER_UPPERCASE,
when 16#00012F# => LETTER_LOWERCASE,
when 16#000130# => LETTER_UPPERCASE,
when 16#000131# => LETTER_LOWERCASE,
when 16#000132# => LETTER_UPPERCASE,
when 16#000133# => LETTER_LOWERCASE,
when 16#000134# => LETTER_UPPERCASE,
when 16#000135# => LETTER_LOWERCASE,
when 16#000136# => LETTER_UPPERCASE,
when 16#000137# .. 16#000138# => LETTER_LOWERCASE,
when 16#000139# => LETTER_UPPERCASE,
when 16#00013A# => LETTER_LOWERCASE,
when 16#00013B# => LETTER_UPPERCASE,
when 16#00013C# => LETTER_LOWERCASE,
when 16#00013D# => LETTER_UPPERCASE,
when 16#00013E# => LETTER_LOWERCASE,
when 16#00013F# => LETTER_UPPERCASE,
when 16#000140# => LETTER_LOWERCASE,
when 16#000141# => LETTER_UPPERCASE,
when 16#000142# => LETTER_LOWERCASE,
when 16#000143# => LETTER_UPPERCASE,
when 16#000144# => LETTER_LOWERCASE,
when 16#000145# => LETTER_UPPERCASE,
when 16#000146# => LETTER_LOWERCASE,
when 16#000147# => LETTER_UPPERCASE,
when 16#000148# .. 16#000149# => LETTER_LOWERCASE,
when 16#00014A# => LETTER_UPPERCASE,
when 16#00014B# => LETTER_LOWERCASE,
when 16#00014C# => LETTER_UPPERCASE,
when 16#00014D# => LETTER_LOWERCASE,
when 16#00014E# => LETTER_UPPERCASE,
when 16#00014F# => LETTER_LOWERCASE,
when 16#000150# => LETTER_UPPERCASE,
when 16#000151# => LETTER_LOWERCASE,
when 16#000152# => LETTER_UPPERCASE,
when 16#000153# => LETTER_LOWERCASE,
when 16#000154# => LETTER_UPPERCASE,
when 16#000155# => LETTER_LOWERCASE,
when 16#000156# => LETTER_UPPERCASE,
when 16#000157# => LETTER_LOWERCASE,
when 16#000158# => LETTER_UPPERCASE,
when 16#000159# => LETTER_LOWERCASE,
when 16#00015A# => LETTER_UPPERCASE,
when 16#00015B# => LETTER_LOWERCASE,
when 16#00015C# => LETTER_UPPERCASE,
when 16#00015D# => LETTER_LOWERCASE,
when 16#00015E# => LETTER_UPPERCASE,
when 16#00015F# => LETTER_LOWERCASE,
when 16#000160# => LETTER_UPPERCASE,
when 16#000161# => LETTER_LOWERCASE,
when 16#000162# => LETTER_UPPERCASE,
when 16#000163# => LETTER_LOWERCASE,
when 16#000164# => LETTER_UPPERCASE,
when 16#000165# => LETTER_LOWERCASE,
when 16#000166# => LETTER_UPPERCASE,
when 16#000167# => LETTER_LOWERCASE,
when 16#000168# => LETTER_UPPERCASE,
when 16#000169# => LETTER_LOWERCASE,
when 16#00016A# => LETTER_UPPERCASE,
when 16#00016B# => LETTER_LOWERCASE,
when 16#00016C# => LETTER_UPPERCASE,
when 16#00016D# => LETTER_LOWERCASE,
when 16#00016E# => LETTER_UPPERCASE,
when 16#00016F# => LETTER_LOWERCASE,
when 16#000170# => LETTER_UPPERCASE,
when 16#000171# => LETTER_LOWERCASE,
when 16#000172# => LETTER_UPPERCASE,
when 16#000173# => LETTER_LOWERCASE,
when 16#000174# => LETTER_UPPERCASE,
when 16#000175# => LETTER_LOWERCASE,
when 16#000176# => LETTER_UPPERCASE,
when 16#000177# => LETTER_LOWERCASE,
when 16#000178# .. 16#000179# => LETTER_UPPERCASE,
when 16#00017A# => LETTER_LOWERCASE,
when 16#00017B# => LETTER_UPPERCASE,
when 16#00017C# => LETTER_LOWERCASE,
when 16#00017D# => LETTER_UPPERCASE,
when 16#00017E# .. 16#000180# => LETTER_LOWERCASE,
when 16#000181# .. 16#000182# => LETTER_UPPERCASE,
when 16#000183# => LETTER_LOWERCASE,
when 16#000184# => LETTER_UPPERCASE,
when 16#000185# => LETTER_LOWERCASE,
when 16#000186# .. 16#000187# => LETTER_UPPERCASE,
when 16#000188# => LETTER_LOWERCASE,
when 16#000189# .. 16#00018B# => LETTER_UPPERCASE,
when 16#00018C# .. 16#00018D# => LETTER_LOWERCASE,
when 16#00018E# .. 16#000191# => LETTER_UPPERCASE,
when 16#000192# => LETTER_LOWERCASE,
when 16#000193# .. 16#000194# => LETTER_UPPERCASE,
when 16#000195# => LETTER_LOWERCASE,
when 16#000196# .. 16#000198# => LETTER_UPPERCASE,
when 16#000199# .. 16#00019B# => LETTER_LOWERCASE,
when 16#00019C# .. 16#00019D# => LETTER_UPPERCASE,
when 16#00019E# => LETTER_LOWERCASE,
when 16#00019F# .. 16#0001A0# => LETTER_UPPERCASE,
when 16#0001A1# => LETTER_LOWERCASE,
when 16#0001A2# => LETTER_UPPERCASE,
when 16#0001A3# => LETTER_LOWERCASE,
when 16#0001A4# => LETTER_UPPERCASE,
when 16#0001A5# => LETTER_LOWERCASE,
when 16#0001A6# .. 16#0001A7# => LETTER_UPPERCASE,
when 16#0001A8# => LETTER_LOWERCASE,
when 16#0001A9# => LETTER_UPPERCASE,
when 16#0001AA# .. 16#0001AB# => LETTER_LOWERCASE,
when 16#0001AC# => LETTER_UPPERCASE,
when 16#0001AD# => LETTER_LOWERCASE,
when 16#0001AE# .. 16#0001AF# => LETTER_UPPERCASE,
when 16#0001B0# => LETTER_LOWERCASE,
when 16#0001B1# .. 16#0001B3# => LETTER_UPPERCASE,
when 16#0001B4# => LETTER_LOWERCASE,
when 16#0001B5# => LETTER_UPPERCASE,
when 16#0001B6# => LETTER_LOWERCASE,
when 16#0001B7# .. 16#0001B8# => LETTER_UPPERCASE,
when 16#0001B9# .. 16#0001BA# => LETTER_LOWERCASE,
when 16#0001BB# => LETTER_OTHER,
when 16#0001BC# => LETTER_UPPERCASE,
when 16#0001BD# .. 16#0001BF# => LETTER_LOWERCASE,
when 16#0001C0# .. 16#0001C3# => LETTER_OTHER,
when 16#0001C4# => LETTER_UPPERCASE,
when 16#0001C5# => LETTER_TITLECASE,
when 16#0001C6# => LETTER_LOWERCASE,
when 16#0001C7# => LETTER_UPPERCASE,
when 16#0001C8# => LETTER_TITLECASE,
when 16#0001C9# => LETTER_LOWERCASE,
when 16#0001CA# => LETTER_UPPERCASE,
when 16#0001CB# => LETTER_TITLECASE,
when 16#0001CC# => LETTER_LOWERCASE,
when 16#0001CD# => LETTER_UPPERCASE,
when 16#0001CE# => LETTER_LOWERCASE,
when 16#0001CF# => LETTER_UPPERCASE,
when 16#0001D0# => LETTER_LOWERCASE,
when 16#0001D1# => LETTER_UPPERCASE,
when 16#0001D2# => LETTER_LOWERCASE,
when 16#0001D3# => LETTER_UPPERCASE,
when 16#0001D4# => LETTER_LOWERCASE,
when 16#0001D5# => LETTER_UPPERCASE,
when 16#0001D6# => LETTER_LOWERCASE,
when 16#0001D7# => LETTER_UPPERCASE,
when 16#0001D8# => LETTER_LOWERCASE,
when 16#0001D9# => LETTER_UPPERCASE,
when 16#0001DA# => LETTER_LOWERCASE,
when 16#0001DB# => LETTER_UPPERCASE,
when 16#0001DC# .. 16#0001DD# => LETTER_LOWERCASE,
when 16#0001DE# => LETTER_UPPERCASE,
when 16#0001DF# => LETTER_LOWERCASE,
when 16#0001E0# => LETTER_UPPERCASE,
when 16#0001E1# => LETTER_LOWERCASE,
when 16#0001E2# => LETTER_UPPERCASE,
when 16#0001E3# => LETTER_LOWERCASE,
when 16#0001E4# => LETTER_UPPERCASE,
when 16#0001E5# => LETTER_LOWERCASE,
when 16#0001E6# => LETTER_UPPERCASE,
when 16#0001E7# => LETTER_LOWERCASE,
when 16#0001E8# => LETTER_UPPERCASE,
when 16#0001E9# => LETTER_LOWERCASE,
when 16#0001EA# => LETTER_UPPERCASE,
when 16#0001EB# => LETTER_LOWERCASE,
when 16#0001EC# => LETTER_UPPERCASE,
when 16#0001ED# => LETTER_LOWERCASE,
when 16#0001EE# => LETTER_UPPERCASE,
when 16#0001EF# .. 16#0001F0# => LETTER_LOWERCASE,
when 16#0001F1# => LETTER_UPPERCASE,
when 16#0001F2# => LETTER_TITLECASE,
when 16#0001F3# => LETTER_LOWERCASE,
when 16#0001F4# => LETTER_UPPERCASE,
when 16#0001F5# => LETTER_LOWERCASE,
when 16#0001F6# .. 16#0001F8# => LETTER_UPPERCASE,
when 16#0001F9# => LETTER_LOWERCASE,
when 16#0001FA# => LETTER_UPPERCASE,
when 16#0001FB# => LETTER_LOWERCASE,
when 16#0001FC# => LETTER_UPPERCASE,
when 16#0001FD# => LETTER_LOWERCASE,
when 16#0001FE# => LETTER_UPPERCASE,
when 16#0001FF# => LETTER_LOWERCASE,
when 16#000200# => LETTER_UPPERCASE,
when 16#000201# => LETTER_LOWERCASE,
when 16#000202# => LETTER_UPPERCASE,
when 16#000203# => LETTER_LOWERCASE,
when 16#000204# => LETTER_UPPERCASE,
when 16#000205# => LETTER_LOWERCASE,
when 16#000206# => LETTER_UPPERCASE,
when 16#000207# => LETTER_LOWERCASE,
when 16#000208# => LETTER_UPPERCASE,
when 16#000209# => LETTER_LOWERCASE,
when 16#00020A# => LETTER_UPPERCASE,
when 16#00020B# => LETTER_LOWERCASE,
when 16#00020C# => LETTER_UPPERCASE,
when 16#00020D# => LETTER_LOWERCASE,
when 16#00020E# => LETTER_UPPERCASE,
when 16#00020F# => LETTER_LOWERCASE,
when 16#000210# => LETTER_UPPERCASE,
when 16#000211# => LETTER_LOWERCASE,
when 16#000212# => LETTER_UPPERCASE,
when 16#000213# => LETTER_LOWERCASE,
when 16#000214# => LETTER_UPPERCASE,
when 16#000215# => LETTER_LOWERCASE,
when 16#000216# => LETTER_UPPERCASE,
when 16#000217# => LETTER_LOWERCASE,
when 16#000218# => LETTER_UPPERCASE,
when 16#000219# => LETTER_LOWERCASE,
when 16#00021A# => LETTER_UPPERCASE,
when 16#00021B# => LETTER_LOWERCASE,
when 16#00021C# => LETTER_UPPERCASE,
when 16#00021D# => LETTER_LOWERCASE,
when 16#00021E# => LETTER_UPPERCASE,
when 16#00021F# => LETTER_LOWERCASE,
when 16#000220# => LETTER_UPPERCASE,
when 16#000221# => LETTER_LOWERCASE,
when 16#000222# => LETTER_UPPERCASE,
when 16#000223# => LETTER_LOWERCASE,
when 16#000224# => LETTER_UPPERCASE,
when 16#000225# => LETTER_LOWERCASE,
when 16#000226# => LETTER_UPPERCASE,
when 16#000227# => LETTER_LOWERCASE,
when 16#000228# => LETTER_UPPERCASE,
when 16#000229# => LETTER_LOWERCASE,
when 16#00022A# => LETTER_UPPERCASE,
when 16#00022B# => LETTER_LOWERCASE,
when 16#00022C# => LETTER_UPPERCASE,
when 16#00022D# => LETTER_LOWERCASE,
when 16#00022E# => LETTER_UPPERCASE,
when 16#00022F# => LETTER_LOWERCASE,
when 16#000230# => LETTER_UPPERCASE,
when 16#000231# => LETTER_LOWERCASE,
when 16#000232# => LETTER_UPPERCASE,
when 16#000233# .. 16#000239# => LETTER_LOWERCASE,
when 16#00023A# .. 16#00023B# => LETTER_UPPERCASE,
when 16#00023C# => LETTER_LOWERCASE,
when 16#00023D# .. 16#00023E# => LETTER_UPPERCASE,
when 16#00023F# .. 16#000240# => LETTER_LOWERCASE,
when 16#000241# => LETTER_UPPERCASE,
when 16#000242# => LETTER_LOWERCASE,
when 16#000243# .. 16#000246# => LETTER_UPPERCASE,
when 16#000247# => LETTER_LOWERCASE,
when 16#000248# => LETTER_UPPERCASE,
when 16#000249# => LETTER_LOWERCASE,
when 16#00024A# => LETTER_UPPERCASE,
when 16#00024B# => LETTER_LOWERCASE,
when 16#00024C# => LETTER_UPPERCASE,
when 16#00024D# => LETTER_LOWERCASE,
when 16#00024E# => LETTER_UPPERCASE,
when 16#00024F# .. 16#000293# => LETTER_LOWERCASE,
when 16#000294# => LETTER_OTHER,
when 16#000295# .. 16#0002AF# => LETTER_LOWERCASE,
when 16#0002B0# .. 16#0002C1# => LETTER_MODIFIER,
when 16#0002C2# .. 16#0002C5# => SYMBOL_MODIFIER,
when 16#0002C6# .. 16#0002D1# => LETTER_MODIFIER,
when 16#0002D2# .. 16#0002DF# => SYMBOL_MODIFIER,
when 16#0002E0# .. 16#0002E4# => LETTER_MODIFIER,
when 16#0002E5# .. 16#0002EB# => SYMBOL_MODIFIER,
when 16#0002EC# => LETTER_MODIFIER,
when 16#0002ED# => SYMBOL_MODIFIER,
when 16#0002EE# => LETTER_MODIFIER,
when 16#0002EF# .. 16#0002FF# => SYMBOL_MODIFIER,
when 16#000300# .. 16#00036F# => MARK_NONSPACING,
when 16#000370# => LETTER_UPPERCASE,
when 16#000371# => LETTER_LOWERCASE,
when 16#000372# => LETTER_UPPERCASE,
when 16#000373# => LETTER_LOWERCASE,
when 16#000374# => LETTER_MODIFIER,
when 16#000375# => SYMBOL_MODIFIER,
when 16#000376# => LETTER_UPPERCASE,
when 16#000377# => LETTER_LOWERCASE,
when 16#00037A# => LETTER_MODIFIER,
when 16#00037B# .. 16#00037D# => LETTER_LOWERCASE,
when 16#00037E# => PUNCTUATION_OTHER,
when 16#00037F# => LETTER_UPPERCASE,
when 16#000384# .. 16#000385# => SYMBOL_MODIFIER,
when 16#000386# => LETTER_UPPERCASE,
when 16#000387# => PUNCTUATION_OTHER,
when 16#000388# .. 16#00038A# => LETTER_UPPERCASE,
when 16#00038C# => LETTER_UPPERCASE,
when 16#00038E# .. 16#00038F# => LETTER_UPPERCASE,
when 16#000390# => LETTER_LOWERCASE,
when 16#000391# .. 16#0003A1# => LETTER_UPPERCASE,
when 16#0003A3# .. 16#0003AB# => LETTER_UPPERCASE,
when 16#0003AC# .. 16#0003CE# => LETTER_LOWERCASE,
when 16#0003CF# => LETTER_UPPERCASE,
when 16#0003D0# .. 16#0003D1# => LETTER_LOWERCASE,
when 16#0003D2# .. 16#0003D4# => LETTER_UPPERCASE,
when 16#0003D5# .. 16#0003D7# => LETTER_LOWERCASE,
when 16#0003D8# => LETTER_UPPERCASE,
when 16#0003D9# => LETTER_LOWERCASE,
when 16#0003DA# => LETTER_UPPERCASE,
when 16#0003DB# => LETTER_LOWERCASE,
when 16#0003DC# => LETTER_UPPERCASE,
when 16#0003DD# => LETTER_LOWERCASE,
when 16#0003DE# => LETTER_UPPERCASE,
when 16#0003DF# => LETTER_LOWERCASE,
when 16#0003E0# => LETTER_UPPERCASE,
when 16#0003E1# => LETTER_LOWERCASE,
when 16#0003E2# => LETTER_UPPERCASE,
when 16#0003E3# => LETTER_LOWERCASE,
when 16#0003E4# => LETTER_UPPERCASE,
when 16#0003E5# => LETTER_LOWERCASE,
when 16#0003E6# => LETTER_UPPERCASE,
when 16#0003E7# => LETTER_LOWERCASE,
when 16#0003E8# => LETTER_UPPERCASE,
when 16#0003E9# => LETTER_LOWERCASE,
when 16#0003EA# => LETTER_UPPERCASE,
when 16#0003EB# => LETTER_LOWERCASE,
when 16#0003EC# => LETTER_UPPERCASE,
when 16#0003ED# => LETTER_LOWERCASE,
when 16#0003EE# => LETTER_UPPERCASE,
when 16#0003EF# .. 16#0003F3# => LETTER_LOWERCASE,
when 16#0003F4# => LETTER_UPPERCASE,
when 16#0003F5# => LETTER_LOWERCASE,
when 16#0003F6# => SYMBOL_MATH,
when 16#0003F7# => LETTER_UPPERCASE,
when 16#0003F8# => LETTER_LOWERCASE,
when 16#0003F9# .. 16#0003FA# => LETTER_UPPERCASE,
when 16#0003FB# .. 16#0003FC# => LETTER_LOWERCASE,
when 16#0003FD# .. 16#00042F# => LETTER_UPPERCASE,
when 16#000430# .. 16#00045F# => LETTER_LOWERCASE,
when 16#000460# => LETTER_UPPERCASE,
when 16#000461# => LETTER_LOWERCASE,
when 16#000462# => LETTER_UPPERCASE,
when 16#000463# => LETTER_LOWERCASE,
when 16#000464# => LETTER_UPPERCASE,
when 16#000465# => LETTER_LOWERCASE,
when 16#000466# => LETTER_UPPERCASE,
when 16#000467# => LETTER_LOWERCASE,
when 16#000468# => LETTER_UPPERCASE,
when 16#000469# => LETTER_LOWERCASE,
when 16#00046A# => LETTER_UPPERCASE,
when 16#00046B# => LETTER_LOWERCASE,
when 16#00046C# => LETTER_UPPERCASE,
when 16#00046D# => LETTER_LOWERCASE,
when 16#00046E# => LETTER_UPPERCASE,
when 16#00046F# => LETTER_LOWERCASE,
when 16#000470# => LETTER_UPPERCASE,
when 16#000471# => LETTER_LOWERCASE,
when 16#000472# => LETTER_UPPERCASE,
when 16#000473# => LETTER_LOWERCASE,
when 16#000474# => LETTER_UPPERCASE,
when 16#000475# => LETTER_LOWERCASE,
when 16#000476# => LETTER_UPPERCASE,
when 16#000477# => LETTER_LOWERCASE,
when 16#000478# => LETTER_UPPERCASE,
when 16#000479# => LETTER_LOWERCASE,
when 16#00047A# => LETTER_UPPERCASE,
when 16#00047B# => LETTER_LOWERCASE,
when 16#00047C# => LETTER_UPPERCASE,
when 16#00047D# => LETTER_LOWERCASE,
when 16#00047E# => LETTER_UPPERCASE,
when 16#00047F# => LETTER_LOWERCASE,
when 16#000480# => LETTER_UPPERCASE,
when 16#000481# => LETTER_LOWERCASE,
when 16#000482# => SYMBOL_OTHER,
when 16#000483# .. 16#000487# => MARK_NONSPACING,
when 16#000488# .. 16#000489# => MARK_ENCLOSING,
when 16#00048A# => LETTER_UPPERCASE,
when 16#00048B# => LETTER_LOWERCASE,
when 16#00048C# => LETTER_UPPERCASE,
when 16#00048D# => LETTER_LOWERCASE,
when 16#00048E# => LETTER_UPPERCASE,
when 16#00048F# => LETTER_LOWERCASE,
when 16#000490# => LETTER_UPPERCASE,
when 16#000491# => LETTER_LOWERCASE,
when 16#000492# => LETTER_UPPERCASE,
when 16#000493# => LETTER_LOWERCASE,
when 16#000494# => LETTER_UPPERCASE,
when 16#000495# => LETTER_LOWERCASE,
when 16#000496# => LETTER_UPPERCASE,
when 16#000497# => LETTER_LOWERCASE,
when 16#000498# => LETTER_UPPERCASE,
when 16#000499# => LETTER_LOWERCASE,
when 16#00049A# => LETTER_UPPERCASE,
when 16#00049B# => LETTER_LOWERCASE,
when 16#00049C# => LETTER_UPPERCASE,
when 16#00049D# => LETTER_LOWERCASE,
when 16#00049E# => LETTER_UPPERCASE,
when 16#00049F# => LETTER_LOWERCASE,
when 16#0004A0# => LETTER_UPPERCASE,
when 16#0004A1# => LETTER_LOWERCASE,
when 16#0004A2# => LETTER_UPPERCASE,
when 16#0004A3# => LETTER_LOWERCASE,
when 16#0004A4# => LETTER_UPPERCASE,
when 16#0004A5# => LETTER_LOWERCASE,
when 16#0004A6# => LETTER_UPPERCASE,
when 16#0004A7# => LETTER_LOWERCASE,
when 16#0004A8# => LETTER_UPPERCASE,
when 16#0004A9# => LETTER_LOWERCASE,
when 16#0004AA# => LETTER_UPPERCASE,
when 16#0004AB# => LETTER_LOWERCASE,
when 16#0004AC# => LETTER_UPPERCASE,
when 16#0004AD# => LETTER_LOWERCASE,
when 16#0004AE# => LETTER_UPPERCASE,
when 16#0004AF# => LETTER_LOWERCASE,
when 16#0004B0# => LETTER_UPPERCASE,
when 16#0004B1# => LETTER_LOWERCASE,
when 16#0004B2# => LETTER_UPPERCASE,
when 16#0004B3# => LETTER_LOWERCASE,
when 16#0004B4# => LETTER_UPPERCASE,
when 16#0004B5# => LETTER_LOWERCASE,
when 16#0004B6# => LETTER_UPPERCASE,
when 16#0004B7# => LETTER_LOWERCASE,
when 16#0004B8# => LETTER_UPPERCASE,
when 16#0004B9# => LETTER_LOWERCASE,
when 16#0004BA# => LETTER_UPPERCASE,
when 16#0004BB# => LETTER_LOWERCASE,
when 16#0004BC# => LETTER_UPPERCASE,
when 16#0004BD# => LETTER_LOWERCASE,
when 16#0004BE# => LETTER_UPPERCASE,
when 16#0004BF# => LETTER_LOWERCASE,
when 16#0004C0# .. 16#0004C1# => LETTER_UPPERCASE,
when 16#0004C2# => LETTER_LOWERCASE,
when 16#0004C3# => LETTER_UPPERCASE,
when 16#0004C4# => LETTER_LOWERCASE,
when 16#0004C5# => LETTER_UPPERCASE,
when 16#0004C6# => LETTER_LOWERCASE,
when 16#0004C7# => LETTER_UPPERCASE,
when 16#0004C8# => LETTER_LOWERCASE,
when 16#0004C9# => LETTER_UPPERCASE,
when 16#0004CA# => LETTER_LOWERCASE,
when 16#0004CB# => LETTER_UPPERCASE,
when 16#0004CC# => LETTER_LOWERCASE,
when 16#0004CD# => LETTER_UPPERCASE,
when 16#0004CE# .. 16#0004CF# => LETTER_LOWERCASE,
when 16#0004D0# => LETTER_UPPERCASE,
when 16#0004D1# => LETTER_LOWERCASE,
when 16#0004D2# => LETTER_UPPERCASE,
when 16#0004D3# => LETTER_LOWERCASE,
when 16#0004D4# => LETTER_UPPERCASE,
when 16#0004D5# => LETTER_LOWERCASE,
when 16#0004D6# => LETTER_UPPERCASE,
when 16#0004D7# => LETTER_LOWERCASE,
when 16#0004D8# => LETTER_UPPERCASE,
when 16#0004D9# => LETTER_LOWERCASE,
when 16#0004DA# => LETTER_UPPERCASE,
when 16#0004DB# => LETTER_LOWERCASE,
when 16#0004DC# => LETTER_UPPERCASE,
when 16#0004DD# => LETTER_LOWERCASE,
when 16#0004DE# => LETTER_UPPERCASE,
when 16#0004DF# => LETTER_LOWERCASE,
when 16#0004E0# => LETTER_UPPERCASE,
when 16#0004E1# => LETTER_LOWERCASE,
when 16#0004E2# => LETTER_UPPERCASE,
when 16#0004E3# => LETTER_LOWERCASE,
when 16#0004E4# => LETTER_UPPERCASE,
when 16#0004E5# => LETTER_LOWERCASE,
when 16#0004E6# => LETTER_UPPERCASE,
when 16#0004E7# => LETTER_LOWERCASE,
when 16#0004E8# => LETTER_UPPERCASE,
when 16#0004E9# => LETTER_LOWERCASE,
when 16#0004EA# => LETTER_UPPERCASE,
when 16#0004EB# => LETTER_LOWERCASE,
when 16#0004EC# => LETTER_UPPERCASE,
when 16#0004ED# => LETTER_LOWERCASE,
when 16#0004EE# => LETTER_UPPERCASE,
when 16#0004EF# => LETTER_LOWERCASE,
when 16#0004F0# => LETTER_UPPERCASE,
when 16#0004F1# => LETTER_LOWERCASE,
when 16#0004F2# => LETTER_UPPERCASE,
when 16#0004F3# => LETTER_LOWERCASE,
when 16#0004F4# => LETTER_UPPERCASE,
when 16#0004F5# => LETTER_LOWERCASE,
when 16#0004F6# => LETTER_UPPERCASE,
when 16#0004F7# => LETTER_LOWERCASE,
when 16#0004F8# => LETTER_UPPERCASE,
when 16#0004F9# => LETTER_LOWERCASE,
when 16#0004FA# => LETTER_UPPERCASE,
when 16#0004FB# => LETTER_LOWERCASE,
when 16#0004FC# => LETTER_UPPERCASE,
when 16#0004FD# => LETTER_LOWERCASE,
when 16#0004FE# => LETTER_UPPERCASE,
when 16#0004FF# => LETTER_LOWERCASE,
when 16#000500# => LETTER_UPPERCASE,
when 16#000501# => LETTER_LOWERCASE,
when 16#000502# => LETTER_UPPERCASE,
when 16#000503# => LETTER_LOWERCASE,
when 16#000504# => LETTER_UPPERCASE,
when 16#000505# => LETTER_LOWERCASE,
when 16#000506# => LETTER_UPPERCASE,
when 16#000507# => LETTER_LOWERCASE,
when 16#000508# => LETTER_UPPERCASE,
when 16#000509# => LETTER_LOWERCASE,
when 16#00050A# => LETTER_UPPERCASE,
when 16#00050B# => LETTER_LOWERCASE,
when 16#00050C# => LETTER_UPPERCASE,
when 16#00050D# => LETTER_LOWERCASE,
when 16#00050E# => LETTER_UPPERCASE,
when 16#00050F# => LETTER_LOWERCASE,
when 16#000510# => LETTER_UPPERCASE,
when 16#000511# => LETTER_LOWERCASE,
when 16#000512# => LETTER_UPPERCASE,
when 16#000513# => LETTER_LOWERCASE,
when 16#000514# => LETTER_UPPERCASE,
when 16#000515# => LETTER_LOWERCASE,
when 16#000516# => LETTER_UPPERCASE,
when 16#000517# => LETTER_LOWERCASE,
when 16#000518# => LETTER_UPPERCASE,
when 16#000519# => LETTER_LOWERCASE,
when 16#00051A# => LETTER_UPPERCASE,
when 16#00051B# => LETTER_LOWERCASE,
when 16#00051C# => LETTER_UPPERCASE,
when 16#00051D# => LETTER_LOWERCASE,
when 16#00051E# => LETTER_UPPERCASE,
when 16#00051F# => LETTER_LOWERCASE,
when 16#000520# => LETTER_UPPERCASE,
when 16#000521# => LETTER_LOWERCASE,
when 16#000522# => LETTER_UPPERCASE,
when 16#000523# => LETTER_LOWERCASE,
when 16#000524# => LETTER_UPPERCASE,
when 16#000525# => LETTER_LOWERCASE,
when 16#000526# => LETTER_UPPERCASE,
when 16#000527# => LETTER_LOWERCASE,
when 16#000528# => LETTER_UPPERCASE,
when 16#000529# => LETTER_LOWERCASE,
when 16#00052A# => LETTER_UPPERCASE,
when 16#00052B# => LETTER_LOWERCASE,
when 16#00052C# => LETTER_UPPERCASE,
when 16#00052D# => LETTER_LOWERCASE,
when 16#00052E# => LETTER_UPPERCASE,
when 16#00052F# => LETTER_LOWERCASE,
when 16#000531# .. 16#000556# => LETTER_UPPERCASE,
when 16#000559# => LETTER_MODIFIER,
when 16#00055A# .. 16#00055F# => PUNCTUATION_OTHER,
when 16#000560# .. 16#000588# => LETTER_LOWERCASE,
when 16#000589# => PUNCTUATION_OTHER,
when 16#00058A# => PUNCTUATION_DASH,
when 16#00058D# .. 16#00058E# => SYMBOL_OTHER,
when 16#00058F# => SYMBOL_CURRENCY,
when 16#000591# .. 16#0005BD# => MARK_NONSPACING,
when 16#0005BE# => PUNCTUATION_DASH,
when 16#0005BF# => MARK_NONSPACING,
when 16#0005C0# => PUNCTUATION_OTHER,
when 16#0005C1# .. 16#0005C2# => MARK_NONSPACING,
when 16#0005C3# => PUNCTUATION_OTHER,
when 16#0005C4# .. 16#0005C5# => MARK_NONSPACING,
when 16#0005C6# => PUNCTUATION_OTHER,
when 16#0005C7# => MARK_NONSPACING,
when 16#0005D0# .. 16#0005EA# => LETTER_OTHER,
when 16#0005EF# .. 16#0005F2# => LETTER_OTHER,
when 16#0005F3# .. 16#0005F4# => PUNCTUATION_OTHER,
when 16#000600# .. 16#000605# => OTHER_FORMAT,
when 16#000606# .. 16#000608# => SYMBOL_MATH,
when 16#000609# .. 16#00060A# => PUNCTUATION_OTHER,
when 16#00060B# => SYMBOL_CURRENCY,
when 16#00060C# .. 16#00060D# => PUNCTUATION_OTHER,
when 16#00060E# .. 16#00060F# => SYMBOL_OTHER,
when 16#000610# .. 16#00061A# => MARK_NONSPACING,
when 16#00061B# => PUNCTUATION_OTHER,
when 16#00061C# => OTHER_FORMAT,
when 16#00061E# .. 16#00061F# => PUNCTUATION_OTHER,
when 16#000620# .. 16#00063F# => LETTER_OTHER,
when 16#000640# => LETTER_MODIFIER,
when 16#000641# .. 16#00064A# => LETTER_OTHER,
when 16#00064B# .. 16#00065F# => MARK_NONSPACING,
when 16#000660# .. 16#000669# => NUMBER_DECIMAL_DIGIT,
when 16#00066A# .. 16#00066D# => PUNCTUATION_OTHER,
when 16#00066E# .. 16#00066F# => LETTER_OTHER,
when 16#000670# => MARK_NONSPACING,
when 16#000671# .. 16#0006D3# => LETTER_OTHER,
when 16#0006D4# => PUNCTUATION_OTHER,
when 16#0006D5# => LETTER_OTHER,
when 16#0006D6# .. 16#0006DC# => MARK_NONSPACING,
when 16#0006DD# => OTHER_FORMAT,
when 16#0006DE# => SYMBOL_OTHER,
when 16#0006DF# .. 16#0006E4# => MARK_NONSPACING,
when 16#0006E5# .. 16#0006E6# => LETTER_MODIFIER,
when 16#0006E7# .. 16#0006E8# => MARK_NONSPACING,
when 16#0006E9# => SYMBOL_OTHER,
when 16#0006EA# .. 16#0006ED# => MARK_NONSPACING,
when 16#0006EE# .. 16#0006EF# => LETTER_OTHER,
when 16#0006F0# .. 16#0006F9# => NUMBER_DECIMAL_DIGIT,
when 16#0006FA# .. 16#0006FC# => LETTER_OTHER,
when 16#0006FD# .. 16#0006FE# => SYMBOL_OTHER,
when 16#0006FF# => LETTER_OTHER,
when 16#000700# .. 16#00070D# => PUNCTUATION_OTHER,
when 16#00070F# => OTHER_FORMAT,
when 16#000710# => LETTER_OTHER,
when 16#000711# => MARK_NONSPACING,
when 16#000712# .. 16#00072F# => LETTER_OTHER,
when 16#000730# .. 16#00074A# => MARK_NONSPACING,
when 16#00074D# .. 16#0007A5# => LETTER_OTHER,
when 16#0007A6# .. 16#0007B0# => MARK_NONSPACING,
when 16#0007B1# => LETTER_OTHER,
when 16#0007C0# .. 16#0007C9# => NUMBER_DECIMAL_DIGIT,
when 16#0007CA# .. 16#0007EA# => LETTER_OTHER,
when 16#0007EB# .. 16#0007F3# => MARK_NONSPACING,
when 16#0007F4# .. 16#0007F5# => LETTER_MODIFIER,
when 16#0007F6# => SYMBOL_OTHER,
when 16#0007F7# .. 16#0007F9# => PUNCTUATION_OTHER,
when 16#0007FA# => LETTER_MODIFIER,
when 16#0007FD# => MARK_NONSPACING,
when 16#0007FE# .. 16#0007FF# => SYMBOL_CURRENCY,
when 16#000800# .. 16#000815# => LETTER_OTHER,
when 16#000816# .. 16#000819# => MARK_NONSPACING,
when 16#00081A# => LETTER_MODIFIER,
when 16#00081B# .. 16#000823# => MARK_NONSPACING,
when 16#000824# => LETTER_MODIFIER,
when 16#000825# .. 16#000827# => MARK_NONSPACING,
when 16#000828# => LETTER_MODIFIER,
when 16#000829# .. 16#00082D# => MARK_NONSPACING,
when 16#000830# .. 16#00083E# => PUNCTUATION_OTHER,
when 16#000840# .. 16#000858# => LETTER_OTHER,
when 16#000859# .. 16#00085B# => MARK_NONSPACING,
when 16#00085E# => PUNCTUATION_OTHER,
when 16#000860# .. 16#00086A# => LETTER_OTHER,
when 16#0008A0# .. 16#0008B4# => LETTER_OTHER,
when 16#0008B6# .. 16#0008BD# => LETTER_OTHER,
when 16#0008D3# .. 16#0008E1# => MARK_NONSPACING,
when 16#0008E2# => OTHER_FORMAT,
when 16#0008E3# .. 16#000902# => MARK_NONSPACING,
when 16#000903# => MARK_SPACING_COMBINING,
when 16#000904# .. 16#000939# => LETTER_OTHER,
when 16#00093A# => MARK_NONSPACING,
when 16#00093B# => MARK_SPACING_COMBINING,
when 16#00093C# => MARK_NONSPACING,
when 16#00093D# => LETTER_OTHER,
when 16#00093E# .. 16#000940# => MARK_SPACING_COMBINING,
when 16#000941# .. 16#000948# => MARK_NONSPACING,
when 16#000949# .. 16#00094C# => MARK_SPACING_COMBINING,
when 16#00094D# => MARK_NONSPACING,
when 16#00094E# .. 16#00094F# => MARK_SPACING_COMBINING,
when 16#000950# => LETTER_OTHER,
when 16#000951# .. 16#000957# => MARK_NONSPACING,
when 16#000958# .. 16#000961# => LETTER_OTHER,
when 16#000962# .. 16#000963# => MARK_NONSPACING,
when 16#000964# .. 16#000965# => PUNCTUATION_OTHER,
when 16#000966# .. 16#00096F# => NUMBER_DECIMAL_DIGIT,
when 16#000970# => PUNCTUATION_OTHER,
when 16#000971# => LETTER_MODIFIER,
when 16#000972# .. 16#000980# => LETTER_OTHER,
when 16#000981# => MARK_NONSPACING,
when 16#000982# .. 16#000983# => MARK_SPACING_COMBINING,
when 16#000985# .. 16#00098C# => LETTER_OTHER,
when 16#00098F# .. 16#000990# => LETTER_OTHER,
when 16#000993# .. 16#0009A8# => LETTER_OTHER,
when 16#0009AA# .. 16#0009B0# => LETTER_OTHER,
when 16#0009B2# => LETTER_OTHER,
when 16#0009B6# .. 16#0009B9# => LETTER_OTHER,
when 16#0009BC# => MARK_NONSPACING,
when 16#0009BD# => LETTER_OTHER,
when 16#0009BE# .. 16#0009C0# => MARK_SPACING_COMBINING,
when 16#0009C1# .. 16#0009C4# => MARK_NONSPACING,
when 16#0009C7# .. 16#0009C8# => MARK_SPACING_COMBINING,
when 16#0009CB# .. 16#0009CC# => MARK_SPACING_COMBINING,
when 16#0009CD# => MARK_NONSPACING,
when 16#0009CE# => LETTER_OTHER,
when 16#0009D7# => MARK_SPACING_COMBINING,
when 16#0009DC# .. 16#0009DD# => LETTER_OTHER,
when 16#0009DF# .. 16#0009E1# => LETTER_OTHER,
when 16#0009E2# .. 16#0009E3# => MARK_NONSPACING,
when 16#0009E6# .. 16#0009EF# => NUMBER_DECIMAL_DIGIT,
when 16#0009F0# .. 16#0009F1# => LETTER_OTHER,
when 16#0009F2# .. 16#0009F3# => SYMBOL_CURRENCY,
when 16#0009F4# .. 16#0009F9# => NUMBER_OTHER,
when 16#0009FA# => SYMBOL_OTHER,
when 16#0009FB# => SYMBOL_CURRENCY,
when 16#0009FC# => LETTER_OTHER,
when 16#0009FD# => PUNCTUATION_OTHER,
when 16#0009FE# => MARK_NONSPACING,
when 16#000A01# .. 16#000A02# => MARK_NONSPACING,
when 16#000A03# => MARK_SPACING_COMBINING,
when 16#000A05# .. 16#000A0A# => LETTER_OTHER,
when 16#000A0F# .. 16#000A10# => LETTER_OTHER,
when 16#000A13# .. 16#000A28# => LETTER_OTHER,
when 16#000A2A# .. 16#000A30# => LETTER_OTHER,
when 16#000A32# .. 16#000A33# => LETTER_OTHER,
when 16#000A35# .. 16#000A36# => LETTER_OTHER,
when 16#000A38# .. 16#000A39# => LETTER_OTHER,
when 16#000A3C# => MARK_NONSPACING,
when 16#000A3E# .. 16#000A40# => MARK_SPACING_COMBINING,
when 16#000A41# .. 16#000A42# => MARK_NONSPACING,
when 16#000A47# .. 16#000A48# => MARK_NONSPACING,
when 16#000A4B# .. 16#000A4D# => MARK_NONSPACING,
when 16#000A51# => MARK_NONSPACING,
when 16#000A59# .. 16#000A5C# => LETTER_OTHER,
when 16#000A5E# => LETTER_OTHER,
when 16#000A66# .. 16#000A6F# => NUMBER_DECIMAL_DIGIT,
when 16#000A70# .. 16#000A71# => MARK_NONSPACING,
when 16#000A72# .. 16#000A74# => LETTER_OTHER,
when 16#000A75# => MARK_NONSPACING,
when 16#000A76# => PUNCTUATION_OTHER,
when 16#000A81# .. 16#000A82# => MARK_NONSPACING,
when 16#000A83# => MARK_SPACING_COMBINING,
when 16#000A85# .. 16#000A8D# => LETTER_OTHER,
when 16#000A8F# .. 16#000A91# => LETTER_OTHER,
when 16#000A93# .. 16#000AA8# => LETTER_OTHER,
when 16#000AAA# .. 16#000AB0# => LETTER_OTHER,
when 16#000AB2# .. 16#000AB3# => LETTER_OTHER,
when 16#000AB5# .. 16#000AB9# => LETTER_OTHER,
when 16#000ABC# => MARK_NONSPACING,
when 16#000ABD# => LETTER_OTHER,
when 16#000ABE# .. 16#000AC0# => MARK_SPACING_COMBINING,
when 16#000AC1# .. 16#000AC5# => MARK_NONSPACING,
when 16#000AC7# .. 16#000AC8# => MARK_NONSPACING,
when 16#000AC9# => MARK_SPACING_COMBINING,
when 16#000ACB# .. 16#000ACC# => MARK_SPACING_COMBINING,
when 16#000ACD# => MARK_NONSPACING,
when 16#000AD0# => LETTER_OTHER,
when 16#000AE0# .. 16#000AE1# => LETTER_OTHER,
when 16#000AE2# .. 16#000AE3# => MARK_NONSPACING,
when 16#000AE6# .. 16#000AEF# => NUMBER_DECIMAL_DIGIT,
when 16#000AF0# => PUNCTUATION_OTHER,
when 16#000AF1# => SYMBOL_CURRENCY,
when 16#000AF9# => LETTER_OTHER,
when 16#000AFA# .. 16#000AFF# => MARK_NONSPACING,
when 16#000B01# => MARK_NONSPACING,
when 16#000B02# .. 16#000B03# => MARK_SPACING_COMBINING,
when 16#000B05# .. 16#000B0C# => LETTER_OTHER,
when 16#000B0F# .. 16#000B10# => LETTER_OTHER,
when 16#000B13# .. 16#000B28# => LETTER_OTHER,
when 16#000B2A# .. 16#000B30# => LETTER_OTHER,
when 16#000B32# .. 16#000B33# => LETTER_OTHER,
when 16#000B35# .. 16#000B39# => LETTER_OTHER,
when 16#000B3C# => MARK_NONSPACING,
when 16#000B3D# => LETTER_OTHER,
when 16#000B3E# => MARK_SPACING_COMBINING,
when 16#000B3F# => MARK_NONSPACING,
when 16#000B40# => MARK_SPACING_COMBINING,
when 16#000B41# .. 16#000B44# => MARK_NONSPACING,
when 16#000B47# .. 16#000B48# => MARK_SPACING_COMBINING,
when 16#000B4B# .. 16#000B4C# => MARK_SPACING_COMBINING,
when 16#000B4D# => MARK_NONSPACING,
when 16#000B56# => MARK_NONSPACING,
when 16#000B57# => MARK_SPACING_COMBINING,
when 16#000B5C# .. 16#000B5D# => LETTER_OTHER,
when 16#000B5F# .. 16#000B61# => LETTER_OTHER,
when 16#000B62# .. 16#000B63# => MARK_NONSPACING,
when 16#000B66# .. 16#000B6F# => NUMBER_DECIMAL_DIGIT,
when 16#000B70# => SYMBOL_OTHER,
when 16#000B71# => LETTER_OTHER,
when 16#000B72# .. 16#000B77# => NUMBER_OTHER,
when 16#000B82# => MARK_NONSPACING,
when 16#000B83# => LETTER_OTHER,
when 16#000B85# .. 16#000B8A# => LETTER_OTHER,
when 16#000B8E# .. 16#000B90# => LETTER_OTHER,
when 16#000B92# .. 16#000B95# => LETTER_OTHER,
when 16#000B99# .. 16#000B9A# => LETTER_OTHER,
when 16#000B9C# => LETTER_OTHER,
when 16#000B9E# .. 16#000B9F# => LETTER_OTHER,
when 16#000BA3# .. 16#000BA4# => LETTER_OTHER,
when 16#000BA8# .. 16#000BAA# => LETTER_OTHER,
when 16#000BAE# .. 16#000BB9# => LETTER_OTHER,
when 16#000BBE# .. 16#000BBF# => MARK_SPACING_COMBINING,
when 16#000BC0# => MARK_NONSPACING,
when 16#000BC1# .. 16#000BC2# => MARK_SPACING_COMBINING,
when 16#000BC6# .. 16#000BC8# => MARK_SPACING_COMBINING,
when 16#000BCA# .. 16#000BCC# => MARK_SPACING_COMBINING,
when 16#000BCD# => MARK_NONSPACING,
when 16#000BD0# => LETTER_OTHER,
when 16#000BD7# => MARK_SPACING_COMBINING,
when 16#000BE6# .. 16#000BEF# => NUMBER_DECIMAL_DIGIT,
when 16#000BF0# .. 16#000BF2# => NUMBER_OTHER,
when 16#000BF3# .. 16#000BF8# => SYMBOL_OTHER,
when 16#000BF9# => SYMBOL_CURRENCY,
when 16#000BFA# => SYMBOL_OTHER,
when 16#000C00# => MARK_NONSPACING,
when 16#000C01# .. 16#000C03# => MARK_SPACING_COMBINING,
when 16#000C04# => MARK_NONSPACING,
when 16#000C05# .. 16#000C0C# => LETTER_OTHER,
when 16#000C0E# .. 16#000C10# => LETTER_OTHER,
when 16#000C12# .. 16#000C28# => LETTER_OTHER,
when 16#000C2A# .. 16#000C39# => LETTER_OTHER,
when 16#000C3D# => LETTER_OTHER,
when 16#000C3E# .. 16#000C40# => MARK_NONSPACING,
when 16#000C41# .. 16#000C44# => MARK_SPACING_COMBINING,
when 16#000C46# .. 16#000C48# => MARK_NONSPACING,
when 16#000C4A# .. 16#000C4D# => MARK_NONSPACING,
when 16#000C55# .. 16#000C56# => MARK_NONSPACING,
when 16#000C58# .. 16#000C5A# => LETTER_OTHER,
when 16#000C60# .. 16#000C61# => LETTER_OTHER,
when 16#000C62# .. 16#000C63# => MARK_NONSPACING,
when 16#000C66# .. 16#000C6F# => NUMBER_DECIMAL_DIGIT,
when 16#000C77# => PUNCTUATION_OTHER,
when 16#000C78# .. 16#000C7E# => NUMBER_OTHER,
when 16#000C7F# => SYMBOL_OTHER,
when 16#000C80# => LETTER_OTHER,
when 16#000C81# => MARK_NONSPACING,
when 16#000C82# .. 16#000C83# => MARK_SPACING_COMBINING,
when 16#000C84# => PUNCTUATION_OTHER,
when 16#000C85# .. 16#000C8C# => LETTER_OTHER,
when 16#000C8E# .. 16#000C90# => LETTER_OTHER,
when 16#000C92# .. 16#000CA8# => LETTER_OTHER,
when 16#000CAA# .. 16#000CB3# => LETTER_OTHER,
when 16#000CB5# .. 16#000CB9# => LETTER_OTHER,
when 16#000CBC# => MARK_NONSPACING,
when 16#000CBD# => LETTER_OTHER,
when 16#000CBE# => MARK_SPACING_COMBINING,
when 16#000CBF# => MARK_NONSPACING,
when 16#000CC0# .. 16#000CC4# => MARK_SPACING_COMBINING,
when 16#000CC6# => MARK_NONSPACING,
when 16#000CC7# .. 16#000CC8# => MARK_SPACING_COMBINING,
when 16#000CCA# .. 16#000CCB# => MARK_SPACING_COMBINING,
when 16#000CCC# .. 16#000CCD# => MARK_NONSPACING,
when 16#000CD5# .. 16#000CD6# => MARK_SPACING_COMBINING,
when 16#000CDE# => LETTER_OTHER,
when 16#000CE0# .. 16#000CE1# => LETTER_OTHER,
when 16#000CE2# .. 16#000CE3# => MARK_NONSPACING,
when 16#000CE6# .. 16#000CEF# => NUMBER_DECIMAL_DIGIT,
when 16#000CF1# .. 16#000CF2# => LETTER_OTHER,
when 16#000D00# .. 16#000D01# => MARK_NONSPACING,
when 16#000D02# .. 16#000D03# => MARK_SPACING_COMBINING,
when 16#000D05# .. 16#000D0C# => LETTER_OTHER,
when 16#000D0E# .. 16#000D10# => LETTER_OTHER,
when 16#000D12# .. 16#000D3A# => LETTER_OTHER,
when 16#000D3B# .. 16#000D3C# => MARK_NONSPACING,
when 16#000D3D# => LETTER_OTHER,
when 16#000D3E# .. 16#000D40# => MARK_SPACING_COMBINING,
when 16#000D41# .. 16#000D44# => MARK_NONSPACING,
when 16#000D46# .. 16#000D48# => MARK_SPACING_COMBINING,
when 16#000D4A# .. 16#000D4C# => MARK_SPACING_COMBINING,
when 16#000D4D# => MARK_NONSPACING,
when 16#000D4E# => LETTER_OTHER,
when 16#000D4F# => SYMBOL_OTHER,
when 16#000D54# .. 16#000D56# => LETTER_OTHER,
when 16#000D57# => MARK_SPACING_COMBINING,
when 16#000D58# .. 16#000D5E# => NUMBER_OTHER,
when 16#000D5F# .. 16#000D61# => LETTER_OTHER,
when 16#000D62# .. 16#000D63# => MARK_NONSPACING,
when 16#000D66# .. 16#000D6F# => NUMBER_DECIMAL_DIGIT,
when 16#000D70# .. 16#000D78# => NUMBER_OTHER,
when 16#000D79# => SYMBOL_OTHER,
when 16#000D7A# .. 16#000D7F# => LETTER_OTHER,
when 16#000D82# .. 16#000D83# => MARK_SPACING_COMBINING,
when 16#000D85# .. 16#000D96# => LETTER_OTHER,
when 16#000D9A# .. 16#000DB1# => LETTER_OTHER,
when 16#000DB3# .. 16#000DBB# => LETTER_OTHER,
when 16#000DBD# => LETTER_OTHER,
when 16#000DC0# .. 16#000DC6# => LETTER_OTHER,
when 16#000DCA# => MARK_NONSPACING,
when 16#000DCF# .. 16#000DD1# => MARK_SPACING_COMBINING,
when 16#000DD2# .. 16#000DD4# => MARK_NONSPACING,
when 16#000DD6# => MARK_NONSPACING,
when 16#000DD8# .. 16#000DDF# => MARK_SPACING_COMBINING,
when 16#000DE6# .. 16#000DEF# => NUMBER_DECIMAL_DIGIT,
when 16#000DF2# .. 16#000DF3# => MARK_SPACING_COMBINING,
when 16#000DF4# => PUNCTUATION_OTHER,
when 16#000E01# .. 16#000E30# => LETTER_OTHER,
when 16#000E31# => MARK_NONSPACING,
when 16#000E32# .. 16#000E33# => LETTER_OTHER,
when 16#000E34# .. 16#000E3A# => MARK_NONSPACING,
when 16#000E3F# => SYMBOL_CURRENCY,
when 16#000E40# .. 16#000E45# => LETTER_OTHER,
when 16#000E46# => LETTER_MODIFIER,
when 16#000E47# .. 16#000E4E# => MARK_NONSPACING,
when 16#000E4F# => PUNCTUATION_OTHER,
when 16#000E50# .. 16#000E59# => NUMBER_DECIMAL_DIGIT,
when 16#000E5A# .. 16#000E5B# => PUNCTUATION_OTHER,
when 16#000E81# .. 16#000E82# => LETTER_OTHER,
when 16#000E84# => LETTER_OTHER,
when 16#000E86# .. 16#000E8A# => LETTER_OTHER,
when 16#000E8C# .. 16#000EA3# => LETTER_OTHER,
when 16#000EA5# => LETTER_OTHER,
when 16#000EA7# .. 16#000EB0# => LETTER_OTHER,
when 16#000EB1# => MARK_NONSPACING,
when 16#000EB2# .. 16#000EB3# => LETTER_OTHER,
when 16#000EB4# .. 16#000EBC# => MARK_NONSPACING,
when 16#000EBD# => LETTER_OTHER,
when 16#000EC0# .. 16#000EC4# => LETTER_OTHER,
when 16#000EC6# => LETTER_MODIFIER,
when 16#000EC8# .. 16#000ECD# => MARK_NONSPACING,
when 16#000ED0# .. 16#000ED9# => NUMBER_DECIMAL_DIGIT,
when 16#000EDC# .. 16#000EDF# => LETTER_OTHER,
when 16#000F00# => LETTER_OTHER,
when 16#000F01# .. 16#000F03# => SYMBOL_OTHER,
when 16#000F04# .. 16#000F12# => PUNCTUATION_OTHER,
when 16#000F13# => SYMBOL_OTHER,
when 16#000F14# => PUNCTUATION_OTHER,
when 16#000F15# .. 16#000F17# => SYMBOL_OTHER,
when 16#000F18# .. 16#000F19# => MARK_NONSPACING,
when 16#000F1A# .. 16#000F1F# => SYMBOL_OTHER,
when 16#000F20# .. 16#000F29# => NUMBER_DECIMAL_DIGIT,
when 16#000F2A# .. 16#000F33# => NUMBER_OTHER,
when 16#000F34# => SYMBOL_OTHER,
when 16#000F35# => MARK_NONSPACING,
when 16#000F36# => SYMBOL_OTHER,
when 16#000F37# => MARK_NONSPACING,
when 16#000F38# => SYMBOL_OTHER,
when 16#000F39# => MARK_NONSPACING,
when 16#000F3A# => PUNCTUATION_OPEN,
when 16#000F3B# => PUNCTUATION_CLOSE,
when 16#000F3C# => PUNCTUATION_OPEN,
when 16#000F3D# => PUNCTUATION_CLOSE,
when 16#000F3E# .. 16#000F3F# => MARK_SPACING_COMBINING,
when 16#000F40# .. 16#000F47# => LETTER_OTHER,
when 16#000F49# .. 16#000F6C# => LETTER_OTHER,
when 16#000F71# .. 16#000F7E# => MARK_NONSPACING,
when 16#000F7F# => MARK_SPACING_COMBINING,
when 16#000F80# .. 16#000F84# => MARK_NONSPACING,
when 16#000F85# => PUNCTUATION_OTHER,
when 16#000F86# .. 16#000F87# => MARK_NONSPACING,
when 16#000F88# .. 16#000F8C# => LETTER_OTHER,
when 16#000F8D# .. 16#000F97# => MARK_NONSPACING,
when 16#000F99# .. 16#000FBC# => MARK_NONSPACING,
when 16#000FBE# .. 16#000FC5# => SYMBOL_OTHER,
when 16#000FC6# => MARK_NONSPACING,
when 16#000FC7# .. 16#000FCC# => SYMBOL_OTHER,
when 16#000FCE# .. 16#000FCF# => SYMBOL_OTHER,
when 16#000FD0# .. 16#000FD4# => PUNCTUATION_OTHER,
when 16#000FD5# .. 16#000FD8# => SYMBOL_OTHER,
when 16#000FD9# .. 16#000FDA# => PUNCTUATION_OTHER,
when 16#001000# .. 16#00102A# => LETTER_OTHER,
when 16#00102B# .. 16#00102C# => MARK_SPACING_COMBINING,
when 16#00102D# .. 16#001030# => MARK_NONSPACING,
when 16#001031# => MARK_SPACING_COMBINING,
when 16#001032# .. 16#001037# => MARK_NONSPACING,
when 16#001038# => MARK_SPACING_COMBINING,
when 16#001039# .. 16#00103A# => MARK_NONSPACING,
when 16#00103B# .. 16#00103C# => MARK_SPACING_COMBINING,
when 16#00103D# .. 16#00103E# => MARK_NONSPACING,
when 16#00103F# => LETTER_OTHER,
when 16#001040# .. 16#001049# => NUMBER_DECIMAL_DIGIT,
when 16#00104A# .. 16#00104F# => PUNCTUATION_OTHER,
when 16#001050# .. 16#001055# => LETTER_OTHER,
when 16#001056# .. 16#001057# => MARK_SPACING_COMBINING,
when 16#001058# .. 16#001059# => MARK_NONSPACING,
when 16#00105A# .. 16#00105D# => LETTER_OTHER,
when 16#00105E# .. 16#001060# => MARK_NONSPACING,
when 16#001061# => LETTER_OTHER,
when 16#001062# .. 16#001064# => MARK_SPACING_COMBINING,
when 16#001065# .. 16#001066# => LETTER_OTHER,
when 16#001067# .. 16#00106D# => MARK_SPACING_COMBINING,
when 16#00106E# .. 16#001070# => LETTER_OTHER,
when 16#001071# .. 16#001074# => MARK_NONSPACING,
when 16#001075# .. 16#001081# => LETTER_OTHER,
when 16#001082# => MARK_NONSPACING,
when 16#001083# .. 16#001084# => MARK_SPACING_COMBINING,
when 16#001085# .. 16#001086# => MARK_NONSPACING,
when 16#001087# .. 16#00108C# => MARK_SPACING_COMBINING,
when 16#00108D# => MARK_NONSPACING,
when 16#00108E# => LETTER_OTHER,
when 16#00108F# => MARK_SPACING_COMBINING,
when 16#001090# .. 16#001099# => NUMBER_DECIMAL_DIGIT,
when 16#00109A# .. 16#00109C# => MARK_SPACING_COMBINING,
when 16#00109D# => MARK_NONSPACING,
when 16#00109E# .. 16#00109F# => SYMBOL_OTHER,
when 16#0010A0# .. 16#0010C5# => LETTER_UPPERCASE,
when 16#0010C7# => LETTER_UPPERCASE,
when 16#0010CD# => LETTER_UPPERCASE,
when 16#0010D0# .. 16#0010FA# => LETTER_LOWERCASE,
when 16#0010FB# => PUNCTUATION_OTHER,
when 16#0010FC# => LETTER_MODIFIER,
when 16#0010FD# .. 16#0010FF# => LETTER_LOWERCASE,
when 16#001100# .. 16#001248# => LETTER_OTHER,
when 16#00124A# .. 16#00124D# => LETTER_OTHER,
when 16#001250# .. 16#001256# => LETTER_OTHER,
when 16#001258# => LETTER_OTHER,
when 16#00125A# .. 16#00125D# => LETTER_OTHER,
when 16#001260# .. 16#001288# => LETTER_OTHER,
when 16#00128A# .. 16#00128D# => LETTER_OTHER,
when 16#001290# .. 16#0012B0# => LETTER_OTHER,
when 16#0012B2# .. 16#0012B5# => LETTER_OTHER,
when 16#0012B8# .. 16#0012BE# => LETTER_OTHER,
when 16#0012C0# => LETTER_OTHER,
when 16#0012C2# .. 16#0012C5# => LETTER_OTHER,
when 16#0012C8# .. 16#0012D6# => LETTER_OTHER,
when 16#0012D8# .. 16#001310# => LETTER_OTHER,
when 16#001312# .. 16#001315# => LETTER_OTHER,
when 16#001318# .. 16#00135A# => LETTER_OTHER,
when 16#00135D# .. 16#00135F# => MARK_NONSPACING,
when 16#001360# .. 16#001368# => PUNCTUATION_OTHER,
when 16#001369# .. 16#00137C# => NUMBER_OTHER,
when 16#001380# .. 16#00138F# => LETTER_OTHER,
when 16#001390# .. 16#001399# => SYMBOL_OTHER,
when 16#0013A0# .. 16#0013F5# => LETTER_UPPERCASE,
when 16#0013F8# .. 16#0013FD# => LETTER_LOWERCASE,
when 16#001400# => PUNCTUATION_DASH,
when 16#001401# .. 16#00166C# => LETTER_OTHER,
when 16#00166D# => SYMBOL_OTHER,
when 16#00166E# => PUNCTUATION_OTHER,
when 16#00166F# .. 16#00167F# => LETTER_OTHER,
when 16#001680# => SEPARATOR_SPACE,
when 16#001681# .. 16#00169A# => LETTER_OTHER,
when 16#00169B# => PUNCTUATION_OPEN,
when 16#00169C# => PUNCTUATION_CLOSE,
when 16#0016A0# .. 16#0016EA# => LETTER_OTHER,
when 16#0016EB# .. 16#0016ED# => PUNCTUATION_OTHER,
when 16#0016EE# .. 16#0016F0# => NUMBER_LETTER,
when 16#0016F1# .. 16#0016F8# => LETTER_OTHER,
when 16#001700# .. 16#00170C# => LETTER_OTHER,
when 16#00170E# .. 16#001711# => LETTER_OTHER,
when 16#001712# .. 16#001714# => MARK_NONSPACING,
when 16#001720# .. 16#001731# => LETTER_OTHER,
when 16#001732# .. 16#001734# => MARK_NONSPACING,
when 16#001735# .. 16#001736# => PUNCTUATION_OTHER,
when 16#001740# .. 16#001751# => LETTER_OTHER,
when 16#001752# .. 16#001753# => MARK_NONSPACING,
when 16#001760# .. 16#00176C# => LETTER_OTHER,
when 16#00176E# .. 16#001770# => LETTER_OTHER,
when 16#001772# .. 16#001773# => MARK_NONSPACING,
when 16#001780# .. 16#0017B3# => LETTER_OTHER,
when 16#0017B4# .. 16#0017B5# => MARK_NONSPACING,
when 16#0017B6# => MARK_SPACING_COMBINING,
when 16#0017B7# .. 16#0017BD# => MARK_NONSPACING,
when 16#0017BE# .. 16#0017C5# => MARK_SPACING_COMBINING,
when 16#0017C6# => MARK_NONSPACING,
when 16#0017C7# .. 16#0017C8# => MARK_SPACING_COMBINING,
when 16#0017C9# .. 16#0017D3# => MARK_NONSPACING,
when 16#0017D4# .. 16#0017D6# => PUNCTUATION_OTHER,
when 16#0017D7# => LETTER_MODIFIER,
when 16#0017D8# .. 16#0017DA# => PUNCTUATION_OTHER,
when 16#0017DB# => SYMBOL_CURRENCY,
when 16#0017DC# => LETTER_OTHER,
when 16#0017DD# => MARK_NONSPACING,
when 16#0017E0# .. 16#0017E9# => NUMBER_DECIMAL_DIGIT,
when 16#0017F0# .. 16#0017F9# => NUMBER_OTHER,
when 16#001800# .. 16#001805# => PUNCTUATION_OTHER,
when 16#001806# => PUNCTUATION_DASH,
when 16#001807# .. 16#00180A# => PUNCTUATION_OTHER,
when 16#00180B# .. 16#00180D# => MARK_NONSPACING,
when 16#00180E# => OTHER_FORMAT,
when 16#001810# .. 16#001819# => NUMBER_DECIMAL_DIGIT,
when 16#001820# .. 16#001842# => LETTER_OTHER,
when 16#001843# => LETTER_MODIFIER,
when 16#001844# .. 16#001878# => LETTER_OTHER,
when 16#001880# .. 16#001884# => LETTER_OTHER,
when 16#001885# .. 16#001886# => MARK_NONSPACING,
when 16#001887# .. 16#0018A8# => LETTER_OTHER,
when 16#0018A9# => MARK_NONSPACING,
when 16#0018AA# => LETTER_OTHER,
when 16#0018B0# .. 16#0018F5# => LETTER_OTHER,
when 16#001900# .. 16#00191E# => LETTER_OTHER,
when 16#001920# .. 16#001922# => MARK_NONSPACING,
when 16#001923# .. 16#001926# => MARK_SPACING_COMBINING,
when 16#001927# .. 16#001928# => MARK_NONSPACING,
when 16#001929# .. 16#00192B# => MARK_SPACING_COMBINING,
when 16#001930# .. 16#001931# => MARK_SPACING_COMBINING,
when 16#001932# => MARK_NONSPACING,
when 16#001933# .. 16#001938# => MARK_SPACING_COMBINING,
when 16#001939# .. 16#00193B# => MARK_NONSPACING,
when 16#001940# => SYMBOL_OTHER,
when 16#001944# .. 16#001945# => PUNCTUATION_OTHER,
when 16#001946# .. 16#00194F# => NUMBER_DECIMAL_DIGIT,
when 16#001950# .. 16#00196D# => LETTER_OTHER,
when 16#001970# .. 16#001974# => LETTER_OTHER,
when 16#001980# .. 16#0019AB# => LETTER_OTHER,
when 16#0019B0# .. 16#0019C9# => LETTER_OTHER,
when 16#0019D0# .. 16#0019D9# => NUMBER_DECIMAL_DIGIT,
when 16#0019DA# => NUMBER_OTHER,
when 16#0019DE# .. 16#0019FF# => SYMBOL_OTHER,
when 16#001A00# .. 16#001A16# => LETTER_OTHER,
when 16#001A17# .. 16#001A18# => MARK_NONSPACING,
when 16#001A19# .. 16#001A1A# => MARK_SPACING_COMBINING,
when 16#001A1B# => MARK_NONSPACING,
when 16#001A1E# .. 16#001A1F# => PUNCTUATION_OTHER,
when 16#001A20# .. 16#001A54# => LETTER_OTHER,
when 16#001A55# => MARK_SPACING_COMBINING,
when 16#001A56# => MARK_NONSPACING,
when 16#001A57# => MARK_SPACING_COMBINING,
when 16#001A58# .. 16#001A5E# => MARK_NONSPACING,
when 16#001A60# => MARK_NONSPACING,
when 16#001A61# => MARK_SPACING_COMBINING,
when 16#001A62# => MARK_NONSPACING,
when 16#001A63# .. 16#001A64# => MARK_SPACING_COMBINING,
when 16#001A65# .. 16#001A6C# => MARK_NONSPACING,
when 16#001A6D# .. 16#001A72# => MARK_SPACING_COMBINING,
when 16#001A73# .. 16#001A7C# => MARK_NONSPACING,
when 16#001A7F# => MARK_NONSPACING,
when 16#001A80# .. 16#001A89# => NUMBER_DECIMAL_DIGIT,
when 16#001A90# .. 16#001A99# => NUMBER_DECIMAL_DIGIT,
when 16#001AA0# .. 16#001AA6# => PUNCTUATION_OTHER,
when 16#001AA7# => LETTER_MODIFIER,
when 16#001AA8# .. 16#001AAD# => PUNCTUATION_OTHER,
when 16#001AB0# .. 16#001ABD# => MARK_NONSPACING,
when 16#001ABE# => MARK_ENCLOSING,
when 16#001B00# .. 16#001B03# => MARK_NONSPACING,
when 16#001B04# => MARK_SPACING_COMBINING,
when 16#001B05# .. 16#001B33# => LETTER_OTHER,
when 16#001B34# => MARK_NONSPACING,
when 16#001B35# => MARK_SPACING_COMBINING,
when 16#001B36# .. 16#001B3A# => MARK_NONSPACING,
when 16#001B3B# => MARK_SPACING_COMBINING,
when 16#001B3C# => MARK_NONSPACING,
when 16#001B3D# .. 16#001B41# => MARK_SPACING_COMBINING,
when 16#001B42# => MARK_NONSPACING,
when 16#001B43# .. 16#001B44# => MARK_SPACING_COMBINING,
when 16#001B45# .. 16#001B4B# => LETTER_OTHER,
when 16#001B50# .. 16#001B59# => NUMBER_DECIMAL_DIGIT,
when 16#001B5A# .. 16#001B60# => PUNCTUATION_OTHER,
when 16#001B61# .. 16#001B6A# => SYMBOL_OTHER,
when 16#001B6B# .. 16#001B73# => MARK_NONSPACING,
when 16#001B74# .. 16#001B7C# => SYMBOL_OTHER,
when 16#001B80# .. 16#001B81# => MARK_NONSPACING,
when 16#001B82# => MARK_SPACING_COMBINING,
when 16#001B83# .. 16#001BA0# => LETTER_OTHER,
when 16#001BA1# => MARK_SPACING_COMBINING,
when 16#001BA2# .. 16#001BA5# => MARK_NONSPACING,
when 16#001BA6# .. 16#001BA7# => MARK_SPACING_COMBINING,
when 16#001BA8# .. 16#001BA9# => MARK_NONSPACING,
when 16#001BAA# => MARK_SPACING_COMBINING,
when 16#001BAB# .. 16#001BAD# => MARK_NONSPACING,
when 16#001BAE# .. 16#001BAF# => LETTER_OTHER,
when 16#001BB0# .. 16#001BB9# => NUMBER_DECIMAL_DIGIT,
when 16#001BBA# .. 16#001BE5# => LETTER_OTHER,
when 16#001BE6# => MARK_NONSPACING,
when 16#001BE7# => MARK_SPACING_COMBINING,
when 16#001BE8# .. 16#001BE9# => MARK_NONSPACING,
when 16#001BEA# .. 16#001BEC# => MARK_SPACING_COMBINING,
when 16#001BED# => MARK_NONSPACING,
when 16#001BEE# => MARK_SPACING_COMBINING,
when 16#001BEF# .. 16#001BF1# => MARK_NONSPACING,
when 16#001BF2# .. 16#001BF3# => MARK_SPACING_COMBINING,
when 16#001BFC# .. 16#001BFF# => PUNCTUATION_OTHER,
when 16#001C00# .. 16#001C23# => LETTER_OTHER,
when 16#001C24# .. 16#001C2B# => MARK_SPACING_COMBINING,
when 16#001C2C# .. 16#001C33# => MARK_NONSPACING,
when 16#001C34# .. 16#001C35# => MARK_SPACING_COMBINING,
when 16#001C36# .. 16#001C37# => MARK_NONSPACING,
when 16#001C3B# .. 16#001C3F# => PUNCTUATION_OTHER,
when 16#001C40# .. 16#001C49# => NUMBER_DECIMAL_DIGIT,
when 16#001C4D# .. 16#001C4F# => LETTER_OTHER,
when 16#001C50# .. 16#001C59# => NUMBER_DECIMAL_DIGIT,
when 16#001C5A# .. 16#001C77# => LETTER_OTHER,
when 16#001C78# .. 16#001C7D# => LETTER_MODIFIER,
when 16#001C7E# .. 16#001C7F# => PUNCTUATION_OTHER,
when 16#001C80# .. 16#001C88# => LETTER_LOWERCASE,
when 16#001C90# .. 16#001CBA# => LETTER_UPPERCASE,
when 16#001CBD# .. 16#001CBF# => LETTER_UPPERCASE,
when 16#001CC0# .. 16#001CC7# => PUNCTUATION_OTHER,
when 16#001CD0# .. 16#001CD2# => MARK_NONSPACING,
when 16#001CD3# => PUNCTUATION_OTHER,
when 16#001CD4# .. 16#001CE0# => MARK_NONSPACING,
when 16#001CE1# => MARK_SPACING_COMBINING,
when 16#001CE2# .. 16#001CE8# => MARK_NONSPACING,
when 16#001CE9# .. 16#001CEC# => LETTER_OTHER,
when 16#001CED# => MARK_NONSPACING,
when 16#001CEE# .. 16#001CF3# => LETTER_OTHER,
when 16#001CF4# => MARK_NONSPACING,
when 16#001CF5# .. 16#001CF6# => LETTER_OTHER,
when 16#001CF7# => MARK_SPACING_COMBINING,
when 16#001CF8# .. 16#001CF9# => MARK_NONSPACING,
when 16#001CFA# => LETTER_OTHER,
when 16#001D00# .. 16#001D2B# => LETTER_LOWERCASE,
when 16#001D2C# .. 16#001D6A# => LETTER_MODIFIER,
when 16#001D6B# .. 16#001D77# => LETTER_LOWERCASE,
when 16#001D78# => LETTER_MODIFIER,
when 16#001D79# .. 16#001D9A# => LETTER_LOWERCASE,
when 16#001D9B# .. 16#001DBF# => LETTER_MODIFIER,
when 16#001DC0# .. 16#001DF9# => MARK_NONSPACING,
when 16#001DFB# .. 16#001DFF# => MARK_NONSPACING,
when 16#001E00# => LETTER_UPPERCASE,
when 16#001E01# => LETTER_LOWERCASE,
when 16#001E02# => LETTER_UPPERCASE,
when 16#001E03# => LETTER_LOWERCASE,
when 16#001E04# => LETTER_UPPERCASE,
when 16#001E05# => LETTER_LOWERCASE,
when 16#001E06# => LETTER_UPPERCASE,
when 16#001E07# => LETTER_LOWERCASE,
when 16#001E08# => LETTER_UPPERCASE,
when 16#001E09# => LETTER_LOWERCASE,
when 16#001E0A# => LETTER_UPPERCASE,
when 16#001E0B# => LETTER_LOWERCASE,
when 16#001E0C# => LETTER_UPPERCASE,
when 16#001E0D# => LETTER_LOWERCASE,
when 16#001E0E# => LETTER_UPPERCASE,
when 16#001E0F# => LETTER_LOWERCASE,
when 16#001E10# => LETTER_UPPERCASE,
when 16#001E11# => LETTER_LOWERCASE,
when 16#001E12# => LETTER_UPPERCASE,
when 16#001E13# => LETTER_LOWERCASE,
when 16#001E14# => LETTER_UPPERCASE,
when 16#001E15# => LETTER_LOWERCASE,
when 16#001E16# => LETTER_UPPERCASE,
when 16#001E17# => LETTER_LOWERCASE,
when 16#001E18# => LETTER_UPPERCASE,
when 16#001E19# => LETTER_LOWERCASE,
when 16#001E1A# => LETTER_UPPERCASE,
when 16#001E1B# => LETTER_LOWERCASE,
when 16#001E1C# => LETTER_UPPERCASE,
when 16#001E1D# => LETTER_LOWERCASE,
when 16#001E1E# => LETTER_UPPERCASE,
when 16#001E1F# => LETTER_LOWERCASE,
when 16#001E20# => LETTER_UPPERCASE,
when 16#001E21# => LETTER_LOWERCASE,
when 16#001E22# => LETTER_UPPERCASE,
when 16#001E23# => LETTER_LOWERCASE,
when 16#001E24# => LETTER_UPPERCASE,
when 16#001E25# => LETTER_LOWERCASE,
when 16#001E26# => LETTER_UPPERCASE,
when 16#001E27# => LETTER_LOWERCASE,
when 16#001E28# => LETTER_UPPERCASE,
when 16#001E29# => LETTER_LOWERCASE,
when 16#001E2A# => LETTER_UPPERCASE,
when 16#001E2B# => LETTER_LOWERCASE,
when 16#001E2C# => LETTER_UPPERCASE,
when 16#001E2D# => LETTER_LOWERCASE,
when 16#001E2E# => LETTER_UPPERCASE,
when 16#001E2F# => LETTER_LOWERCASE,
when 16#001E30# => LETTER_UPPERCASE,
when 16#001E31# => LETTER_LOWERCASE,
when 16#001E32# => LETTER_UPPERCASE,
when 16#001E33# => LETTER_LOWERCASE,
when 16#001E34# => LETTER_UPPERCASE,
when 16#001E35# => LETTER_LOWERCASE,
when 16#001E36# => LETTER_UPPERCASE,
when 16#001E37# => LETTER_LOWERCASE,
when 16#001E38# => LETTER_UPPERCASE,
when 16#001E39# => LETTER_LOWERCASE,
when 16#001E3A# => LETTER_UPPERCASE,
when 16#001E3B# => LETTER_LOWERCASE,
when 16#001E3C# => LETTER_UPPERCASE,
when 16#001E3D# => LETTER_LOWERCASE,
when 16#001E3E# => LETTER_UPPERCASE,
when 16#001E3F# => LETTER_LOWERCASE,
when 16#001E40# => LETTER_UPPERCASE,
when 16#001E41# => LETTER_LOWERCASE,
when 16#001E42# => LETTER_UPPERCASE,
when 16#001E43# => LETTER_LOWERCASE,
when 16#001E44# => LETTER_UPPERCASE,
when 16#001E45# => LETTER_LOWERCASE,
when 16#001E46# => LETTER_UPPERCASE,
when 16#001E47# => LETTER_LOWERCASE,
when 16#001E48# => LETTER_UPPERCASE,
when 16#001E49# => LETTER_LOWERCASE,
when 16#001E4A# => LETTER_UPPERCASE,
when 16#001E4B# => LETTER_LOWERCASE,
when 16#001E4C# => LETTER_UPPERCASE,
when 16#001E4D# => LETTER_LOWERCASE,
when 16#001E4E# => LETTER_UPPERCASE,
when 16#001E4F# => LETTER_LOWERCASE,
when 16#001E50# => LETTER_UPPERCASE,
when 16#001E51# => LETTER_LOWERCASE,
when 16#001E52# => LETTER_UPPERCASE,
when 16#001E53# => LETTER_LOWERCASE,
when 16#001E54# => LETTER_UPPERCASE,
when 16#001E55# => LETTER_LOWERCASE,
when 16#001E56# => LETTER_UPPERCASE,
when 16#001E57# => LETTER_LOWERCASE,
when 16#001E58# => LETTER_UPPERCASE,
when 16#001E59# => LETTER_LOWERCASE,
when 16#001E5A# => LETTER_UPPERCASE,
when 16#001E5B# => LETTER_LOWERCASE,
when 16#001E5C# => LETTER_UPPERCASE,
when 16#001E5D# => LETTER_LOWERCASE,
when 16#001E5E# => LETTER_UPPERCASE,
when 16#001E5F# => LETTER_LOWERCASE,
when 16#001E60# => LETTER_UPPERCASE,
when 16#001E61# => LETTER_LOWERCASE,
when 16#001E62# => LETTER_UPPERCASE,
when 16#001E63# => LETTER_LOWERCASE,
when 16#001E64# => LETTER_UPPERCASE,
when 16#001E65# => LETTER_LOWERCASE,
when 16#001E66# => LETTER_UPPERCASE,
when 16#001E67# => LETTER_LOWERCASE,
when 16#001E68# => LETTER_UPPERCASE,
when 16#001E69# => LETTER_LOWERCASE,
when 16#001E6A# => LETTER_UPPERCASE,
when 16#001E6B# => LETTER_LOWERCASE,
when 16#001E6C# => LETTER_UPPERCASE,
when 16#001E6D# => LETTER_LOWERCASE,
when 16#001E6E# => LETTER_UPPERCASE,
when 16#001E6F# => LETTER_LOWERCASE,
when 16#001E70# => LETTER_UPPERCASE,
when 16#001E71# => LETTER_LOWERCASE,
when 16#001E72# => LETTER_UPPERCASE,
when 16#001E73# => LETTER_LOWERCASE,
when 16#001E74# => LETTER_UPPERCASE,
when 16#001E75# => LETTER_LOWERCASE,
when 16#001E76# => LETTER_UPPERCASE,
when 16#001E77# => LETTER_LOWERCASE,
when 16#001E78# => LETTER_UPPERCASE,
when 16#001E79# => LETTER_LOWERCASE,
when 16#001E7A# => LETTER_UPPERCASE,
when 16#001E7B# => LETTER_LOWERCASE,
when 16#001E7C# => LETTER_UPPERCASE,
when 16#001E7D# => LETTER_LOWERCASE,
when 16#001E7E# => LETTER_UPPERCASE,
when 16#001E7F# => LETTER_LOWERCASE,
when 16#001E80# => LETTER_UPPERCASE,
when 16#001E81# => LETTER_LOWERCASE,
when 16#001E82# => LETTER_UPPERCASE,
when 16#001E83# => LETTER_LOWERCASE,
when 16#001E84# => LETTER_UPPERCASE,
when 16#001E85# => LETTER_LOWERCASE,
when 16#001E86# => LETTER_UPPERCASE,
when 16#001E87# => LETTER_LOWERCASE,
when 16#001E88# => LETTER_UPPERCASE,
when 16#001E89# => LETTER_LOWERCASE,
when 16#001E8A# => LETTER_UPPERCASE,
when 16#001E8B# => LETTER_LOWERCASE,
when 16#001E8C# => LETTER_UPPERCASE,
when 16#001E8D# => LETTER_LOWERCASE,
when 16#001E8E# => LETTER_UPPERCASE,
when 16#001E8F# => LETTER_LOWERCASE,
when 16#001E90# => LETTER_UPPERCASE,
when 16#001E91# => LETTER_LOWERCASE,
when 16#001E92# => LETTER_UPPERCASE,
when 16#001E93# => LETTER_LOWERCASE,
when 16#001E94# => LETTER_UPPERCASE,
when 16#001E95# .. 16#001E9D# => LETTER_LOWERCASE,
when 16#001E9E# => LETTER_UPPERCASE,
when 16#001E9F# => LETTER_LOWERCASE,
when 16#001EA0# => LETTER_UPPERCASE,
when 16#001EA1# => LETTER_LOWERCASE,
when 16#001EA2# => LETTER_UPPERCASE,
when 16#001EA3# => LETTER_LOWERCASE,
when 16#001EA4# => LETTER_UPPERCASE,
when 16#001EA5# => LETTER_LOWERCASE,
when 16#001EA6# => LETTER_UPPERCASE,
when 16#001EA7# => LETTER_LOWERCASE,
when 16#001EA8# => LETTER_UPPERCASE,
when 16#001EA9# => LETTER_LOWERCASE,
when 16#001EAA# => LETTER_UPPERCASE,
when 16#001EAB# => LETTER_LOWERCASE,
when 16#001EAC# => LETTER_UPPERCASE,
when 16#001EAD# => LETTER_LOWERCASE,
when 16#001EAE# => LETTER_UPPERCASE,
when 16#001EAF# => LETTER_LOWERCASE,
when 16#001EB0# => LETTER_UPPERCASE,
when 16#001EB1# => LETTER_LOWERCASE,
when 16#001EB2# => LETTER_UPPERCASE,
when 16#001EB3# => LETTER_LOWERCASE,
when 16#001EB4# => LETTER_UPPERCASE,
when 16#001EB5# => LETTER_LOWERCASE,
when 16#001EB6# => LETTER_UPPERCASE,
when 16#001EB7# => LETTER_LOWERCASE,
when 16#001EB8# => LETTER_UPPERCASE,
when 16#001EB9# => LETTER_LOWERCASE,
when 16#001EBA# => LETTER_UPPERCASE,
when 16#001EBB# => LETTER_LOWERCASE,
when 16#001EBC# => LETTER_UPPERCASE,
when 16#001EBD# => LETTER_LOWERCASE,
when 16#001EBE# => LETTER_UPPERCASE,
when 16#001EBF# => LETTER_LOWERCASE,
when 16#001EC0# => LETTER_UPPERCASE,
when 16#001EC1# => LETTER_LOWERCASE,
when 16#001EC2# => LETTER_UPPERCASE,
when 16#001EC3# => LETTER_LOWERCASE,
when 16#001EC4# => LETTER_UPPERCASE,
when 16#001EC5# => LETTER_LOWERCASE,
when 16#001EC6# => LETTER_UPPERCASE,
when 16#001EC7# => LETTER_LOWERCASE,
when 16#001EC8# => LETTER_UPPERCASE,
when 16#001EC9# => LETTER_LOWERCASE,
when 16#001ECA# => LETTER_UPPERCASE,
when 16#001ECB# => LETTER_LOWERCASE,
when 16#001ECC# => LETTER_UPPERCASE,
when 16#001ECD# => LETTER_LOWERCASE,
when 16#001ECE# => LETTER_UPPERCASE,
when 16#001ECF# => LETTER_LOWERCASE,
when 16#001ED0# => LETTER_UPPERCASE,
when 16#001ED1# => LETTER_LOWERCASE,
when 16#001ED2# => LETTER_UPPERCASE,
when 16#001ED3# => LETTER_LOWERCASE,
when 16#001ED4# => LETTER_UPPERCASE,
when 16#001ED5# => LETTER_LOWERCASE,
when 16#001ED6# => LETTER_UPPERCASE,
when 16#001ED7# => LETTER_LOWERCASE,
when 16#001ED8# => LETTER_UPPERCASE,
when 16#001ED9# => LETTER_LOWERCASE,
when 16#001EDA# => LETTER_UPPERCASE,
when 16#001EDB# => LETTER_LOWERCASE,
when 16#001EDC# => LETTER_UPPERCASE,
when 16#001EDD# => LETTER_LOWERCASE,
when 16#001EDE# => LETTER_UPPERCASE,
when 16#001EDF# => LETTER_LOWERCASE,
when 16#001EE0# => LETTER_UPPERCASE,
when 16#001EE1# => LETTER_LOWERCASE,
when 16#001EE2# => LETTER_UPPERCASE,
when 16#001EE3# => LETTER_LOWERCASE,
when 16#001EE4# => LETTER_UPPERCASE,
when 16#001EE5# => LETTER_LOWERCASE,
when 16#001EE6# => LETTER_UPPERCASE,
when 16#001EE7# => LETTER_LOWERCASE,
when 16#001EE8# => LETTER_UPPERCASE,
when 16#001EE9# => LETTER_LOWERCASE,
when 16#001EEA# => LETTER_UPPERCASE,
when 16#001EEB# => LETTER_LOWERCASE,
when 16#001EEC# => LETTER_UPPERCASE,
when 16#001EED# => LETTER_LOWERCASE,
when 16#001EEE# => LETTER_UPPERCASE,
when 16#001EEF# => LETTER_LOWERCASE,
when 16#001EF0# => LETTER_UPPERCASE,
when 16#001EF1# => LETTER_LOWERCASE,
when 16#001EF2# => LETTER_UPPERCASE,
when 16#001EF3# => LETTER_LOWERCASE,
when 16#001EF4# => LETTER_UPPERCASE,
when 16#001EF5# => LETTER_LOWERCASE,
when 16#001EF6# => LETTER_UPPERCASE,
when 16#001EF7# => LETTER_LOWERCASE,
when 16#001EF8# => LETTER_UPPERCASE,
when 16#001EF9# => LETTER_LOWERCASE,
when 16#001EFA# => LETTER_UPPERCASE,
when 16#001EFB# => LETTER_LOWERCASE,
when 16#001EFC# => LETTER_UPPERCASE,
when 16#001EFD# => LETTER_LOWERCASE,
when 16#001EFE# => LETTER_UPPERCASE,
when 16#001EFF# .. 16#001F07# => LETTER_LOWERCASE,
when 16#001F08# .. 16#001F0F# => LETTER_UPPERCASE,
when 16#001F10# .. 16#001F15# => LETTER_LOWERCASE,
when 16#001F18# .. 16#001F1D# => LETTER_UPPERCASE,
when 16#001F20# .. 16#001F27# => LETTER_LOWERCASE,
when 16#001F28# .. 16#001F2F# => LETTER_UPPERCASE,
when 16#001F30# .. 16#001F37# => LETTER_LOWERCASE,
when 16#001F38# .. 16#001F3F# => LETTER_UPPERCASE,
when 16#001F40# .. 16#001F45# => LETTER_LOWERCASE,
when 16#001F48# .. 16#001F4D# => LETTER_UPPERCASE,
when 16#001F50# .. 16#001F57# => LETTER_LOWERCASE,
when 16#001F59# => LETTER_UPPERCASE,
when 16#001F5B# => LETTER_UPPERCASE,
when 16#001F5D# => LETTER_UPPERCASE,
when 16#001F5F# => LETTER_UPPERCASE,
when 16#001F60# .. 16#001F67# => LETTER_LOWERCASE,
when 16#001F68# .. 16#001F6F# => LETTER_UPPERCASE,
when 16#001F70# .. 16#001F7D# => LETTER_LOWERCASE,
when 16#001F80# .. 16#001F87# => LETTER_LOWERCASE,
when 16#001F88# .. 16#001F8F# => LETTER_TITLECASE,
when 16#001F90# .. 16#001F97# => LETTER_LOWERCASE,
when 16#001F98# .. 16#001F9F# => LETTER_TITLECASE,
when 16#001FA0# .. 16#001FA7# => LETTER_LOWERCASE,
when 16#001FA8# .. 16#001FAF# => LETTER_TITLECASE,
when 16#001FB0# .. 16#001FB4# => LETTER_LOWERCASE,
when 16#001FB6# .. 16#001FB7# => LETTER_LOWERCASE,
when 16#001FB8# .. 16#001FBB# => LETTER_UPPERCASE,
when 16#001FBC# => LETTER_TITLECASE,
when 16#001FBD# => SYMBOL_MODIFIER,
when 16#001FBE# => LETTER_LOWERCASE,
when 16#001FBF# .. 16#001FC1# => SYMBOL_MODIFIER,
when 16#001FC2# .. 16#001FC4# => LETTER_LOWERCASE,
when 16#001FC6# .. 16#001FC7# => LETTER_LOWERCASE,
when 16#001FC8# .. 16#001FCB# => LETTER_UPPERCASE,
when 16#001FCC# => LETTER_TITLECASE,
when 16#001FCD# .. 16#001FCF# => SYMBOL_MODIFIER,
when 16#001FD0# .. 16#001FD3# => LETTER_LOWERCASE,
when 16#001FD6# .. 16#001FD7# => LETTER_LOWERCASE,
when 16#001FD8# .. 16#001FDB# => LETTER_UPPERCASE,
when 16#001FDD# .. 16#001FDF# => SYMBOL_MODIFIER,
when 16#001FE0# .. 16#001FE7# => LETTER_LOWERCASE,
when 16#001FE8# .. 16#001FEC# => LETTER_UPPERCASE,
when 16#001FED# .. 16#001FEF# => SYMBOL_MODIFIER,
when 16#001FF2# .. 16#001FF4# => LETTER_LOWERCASE,
when 16#001FF6# .. 16#001FF7# => LETTER_LOWERCASE,
when 16#001FF8# .. 16#001FFB# => LETTER_UPPERCASE,
when 16#001FFC# => LETTER_TITLECASE,
when 16#001FFD# .. 16#001FFE# => SYMBOL_MODIFIER,
when 16#002000# .. 16#00200A# => SEPARATOR_SPACE,
when 16#00200B# .. 16#00200F# => OTHER_FORMAT,
when 16#002010# .. 16#002015# => PUNCTUATION_DASH,
when 16#002016# .. 16#002017# => PUNCTUATION_OTHER,
when 16#002018# => PUNCTUATION_INITIAL_QUOTE,
when 16#002019# => PUNCTUATION_FINAL_QUOTE,
when 16#00201A# => PUNCTUATION_OPEN,
when 16#00201B# .. 16#00201C# => PUNCTUATION_INITIAL_QUOTE,
when 16#00201D# => PUNCTUATION_FINAL_QUOTE,
when 16#00201E# => PUNCTUATION_OPEN,
when 16#00201F# => PUNCTUATION_INITIAL_QUOTE,
when 16#002020# .. 16#002027# => PUNCTUATION_OTHER,
when 16#002028# => SEPARATOR_LINE,
when 16#002029# => SEPARATOR_PARAGRAPH,
when 16#00202A# .. 16#00202E# => OTHER_FORMAT,
when 16#00202F# => SEPARATOR_SPACE,
when 16#002030# .. 16#002038# => PUNCTUATION_OTHER,
when 16#002039# => PUNCTUATION_INITIAL_QUOTE,
when 16#00203A# => PUNCTUATION_FINAL_QUOTE,
when 16#00203B# .. 16#00203E# => PUNCTUATION_OTHER,
when 16#00203F# .. 16#002040# => PUNCTUATION_CONNECTOR,
when 16#002041# .. 16#002043# => PUNCTUATION_OTHER,
when 16#002044# => SYMBOL_MATH,
when 16#002045# => PUNCTUATION_OPEN,
when 16#002046# => PUNCTUATION_CLOSE,
when 16#002047# .. 16#002051# => PUNCTUATION_OTHER,
when 16#002052# => SYMBOL_MATH,
when 16#002053# => PUNCTUATION_OTHER,
when 16#002054# => PUNCTUATION_CONNECTOR,
when 16#002055# .. 16#00205E# => PUNCTUATION_OTHER,
when 16#00205F# => SEPARATOR_SPACE,
when 16#002060# .. 16#002064# => OTHER_FORMAT,
when 16#002066# .. 16#00206F# => OTHER_FORMAT,
when 16#002070# => NUMBER_OTHER,
when 16#002071# => LETTER_MODIFIER,
when 16#002074# .. 16#002079# => NUMBER_OTHER,
when 16#00207A# .. 16#00207C# => SYMBOL_MATH,
when 16#00207D# => PUNCTUATION_OPEN,
when 16#00207E# => PUNCTUATION_CLOSE,
when 16#00207F# => LETTER_MODIFIER,
when 16#002080# .. 16#002089# => NUMBER_OTHER,
when 16#00208A# .. 16#00208C# => SYMBOL_MATH,
when 16#00208D# => PUNCTUATION_OPEN,
when 16#00208E# => PUNCTUATION_CLOSE,
when 16#002090# .. 16#00209C# => LETTER_MODIFIER,
when 16#0020A0# .. 16#0020BF# => SYMBOL_CURRENCY,
when 16#0020D0# .. 16#0020DC# => MARK_NONSPACING,
when 16#0020DD# .. 16#0020E0# => MARK_ENCLOSING,
when 16#0020E1# => MARK_NONSPACING,
when 16#0020E2# .. 16#0020E4# => MARK_ENCLOSING,
when 16#0020E5# .. 16#0020F0# => MARK_NONSPACING,
when 16#002100# .. 16#002101# => SYMBOL_OTHER,
when 16#002102# => LETTER_UPPERCASE,
when 16#002103# .. 16#002106# => SYMBOL_OTHER,
when 16#002107# => LETTER_UPPERCASE,
when 16#002108# .. 16#002109# => SYMBOL_OTHER,
when 16#00210A# => LETTER_LOWERCASE,
when 16#00210B# .. 16#00210D# => LETTER_UPPERCASE,
when 16#00210E# .. 16#00210F# => LETTER_LOWERCASE,
when 16#002110# .. 16#002112# => LETTER_UPPERCASE,
when 16#002113# => LETTER_LOWERCASE,
when 16#002114# => SYMBOL_OTHER,
when 16#002115# => LETTER_UPPERCASE,
when 16#002116# .. 16#002117# => SYMBOL_OTHER,
when 16#002118# => SYMBOL_MATH,
when 16#002119# .. 16#00211D# => LETTER_UPPERCASE,
when 16#00211E# .. 16#002123# => SYMBOL_OTHER,
when 16#002124# => LETTER_UPPERCASE,
when 16#002125# => SYMBOL_OTHER,
when 16#002126# => LETTER_UPPERCASE,
when 16#002127# => SYMBOL_OTHER,
when 16#002128# => LETTER_UPPERCASE,
when 16#002129# => SYMBOL_OTHER,
when 16#00212A# .. 16#00212D# => LETTER_UPPERCASE,
when 16#00212E# => SYMBOL_OTHER,
when 16#00212F# => LETTER_LOWERCASE,
when 16#002130# .. 16#002133# => LETTER_UPPERCASE,
when 16#002134# => LETTER_LOWERCASE,
when 16#002135# .. 16#002138# => LETTER_OTHER,
when 16#002139# => LETTER_LOWERCASE,
when 16#00213A# .. 16#00213B# => SYMBOL_OTHER,
when 16#00213C# .. 16#00213D# => LETTER_LOWERCASE,
when 16#00213E# .. 16#00213F# => LETTER_UPPERCASE,
when 16#002140# .. 16#002144# => SYMBOL_MATH,
when 16#002145# => LETTER_UPPERCASE,
when 16#002146# .. 16#002149# => LETTER_LOWERCASE,
when 16#00214A# => SYMBOL_OTHER,
when 16#00214B# => SYMBOL_MATH,
when 16#00214C# .. 16#00214D# => SYMBOL_OTHER,
when 16#00214E# => LETTER_LOWERCASE,
when 16#00214F# => SYMBOL_OTHER,
when 16#002150# .. 16#00215F# => NUMBER_OTHER,
when 16#002160# .. 16#002182# => NUMBER_LETTER,
when 16#002183# => LETTER_UPPERCASE,
when 16#002184# => LETTER_LOWERCASE,
when 16#002185# .. 16#002188# => NUMBER_LETTER,
when 16#002189# => NUMBER_OTHER,
when 16#00218A# .. 16#00218B# => SYMBOL_OTHER,
when 16#002190# .. 16#002194# => SYMBOL_MATH,
when 16#002195# .. 16#002199# => SYMBOL_OTHER,
when 16#00219A# .. 16#00219B# => SYMBOL_MATH,
when 16#00219C# .. 16#00219F# => SYMBOL_OTHER,
when 16#0021A0# => SYMBOL_MATH,
when 16#0021A1# .. 16#0021A2# => SYMBOL_OTHER,
when 16#0021A3# => SYMBOL_MATH,
when 16#0021A4# .. 16#0021A5# => SYMBOL_OTHER,
when 16#0021A6# => SYMBOL_MATH,
when 16#0021A7# .. 16#0021AD# => SYMBOL_OTHER,
when 16#0021AE# => SYMBOL_MATH,
when 16#0021AF# .. 16#0021CD# => SYMBOL_OTHER,
when 16#0021CE# .. 16#0021CF# => SYMBOL_MATH,
when 16#0021D0# .. 16#0021D1# => SYMBOL_OTHER,
when 16#0021D2# => SYMBOL_MATH,
when 16#0021D3# => SYMBOL_OTHER,
when 16#0021D4# => SYMBOL_MATH,
when 16#0021D5# .. 16#0021F3# => SYMBOL_OTHER,
when 16#0021F4# .. 16#0022FF# => SYMBOL_MATH,
when 16#002300# .. 16#002307# => SYMBOL_OTHER,
when 16#002308# => PUNCTUATION_OPEN,
when 16#002309# => PUNCTUATION_CLOSE,
when 16#00230A# => PUNCTUATION_OPEN,
when 16#00230B# => PUNCTUATION_CLOSE,
when 16#00230C# .. 16#00231F# => SYMBOL_OTHER,
when 16#002320# .. 16#002321# => SYMBOL_MATH,
when 16#002322# .. 16#002328# => SYMBOL_OTHER,
when 16#002329# => PUNCTUATION_OPEN,
when 16#00232A# => PUNCTUATION_CLOSE,
when 16#00232B# .. 16#00237B# => SYMBOL_OTHER,
when 16#00237C# => SYMBOL_MATH,
when 16#00237D# .. 16#00239A# => SYMBOL_OTHER,
when 16#00239B# .. 16#0023B3# => SYMBOL_MATH,
when 16#0023B4# .. 16#0023DB# => SYMBOL_OTHER,
when 16#0023DC# .. 16#0023E1# => SYMBOL_MATH,
when 16#0023E2# .. 16#002426# => SYMBOL_OTHER,
when 16#002440# .. 16#00244A# => SYMBOL_OTHER,
when 16#002460# .. 16#00249B# => NUMBER_OTHER,
when 16#00249C# .. 16#0024E9# => SYMBOL_OTHER,
when 16#0024EA# .. 16#0024FF# => NUMBER_OTHER,
when 16#002500# .. 16#0025B6# => SYMBOL_OTHER,
when 16#0025B7# => SYMBOL_MATH,
when 16#0025B8# .. 16#0025C0# => SYMBOL_OTHER,
when 16#0025C1# => SYMBOL_MATH,
when 16#0025C2# .. 16#0025F7# => SYMBOL_OTHER,
when 16#0025F8# .. 16#0025FF# => SYMBOL_MATH,
when 16#002600# .. 16#00266E# => SYMBOL_OTHER,
when 16#00266F# => SYMBOL_MATH,
when 16#002670# .. 16#002767# => SYMBOL_OTHER,
when 16#002768# => PUNCTUATION_OPEN,
when 16#002769# => PUNCTUATION_CLOSE,
when 16#00276A# => PUNCTUATION_OPEN,
when 16#00276B# => PUNCTUATION_CLOSE,
when 16#00276C# => PUNCTUATION_OPEN,
when 16#00276D# => PUNCTUATION_CLOSE,
when 16#00276E# => PUNCTUATION_OPEN,
when 16#00276F# => PUNCTUATION_CLOSE,
when 16#002770# => PUNCTUATION_OPEN,
when 16#002771# => PUNCTUATION_CLOSE,
when 16#002772# => PUNCTUATION_OPEN,
when 16#002773# => PUNCTUATION_CLOSE,
when 16#002774# => PUNCTUATION_OPEN,
when 16#002775# => PUNCTUATION_CLOSE,
when 16#002776# .. 16#002793# => NUMBER_OTHER,
when 16#002794# .. 16#0027BF# => SYMBOL_OTHER,
when 16#0027C0# .. 16#0027C4# => SYMBOL_MATH,
when 16#0027C5# => PUNCTUATION_OPEN,
when 16#0027C6# => PUNCTUATION_CLOSE,
when 16#0027C7# .. 16#0027E5# => SYMBOL_MATH,
when 16#0027E6# => PUNCTUATION_OPEN,
when 16#0027E7# => PUNCTUATION_CLOSE,
when 16#0027E8# => PUNCTUATION_OPEN,
when 16#0027E9# => PUNCTUATION_CLOSE,
when 16#0027EA# => PUNCTUATION_OPEN,
when 16#0027EB# => PUNCTUATION_CLOSE,
when 16#0027EC# => PUNCTUATION_OPEN,
when 16#0027ED# => PUNCTUATION_CLOSE,
when 16#0027EE# => PUNCTUATION_OPEN,
when 16#0027EF# => PUNCTUATION_CLOSE,
when 16#0027F0# .. 16#0027FF# => SYMBOL_MATH,
when 16#002800# .. 16#0028FF# => SYMBOL_OTHER,
when 16#002900# .. 16#002982# => SYMBOL_MATH,
when 16#002983# => PUNCTUATION_OPEN,
when 16#002984# => PUNCTUATION_CLOSE,
when 16#002985# => PUNCTUATION_OPEN,
when 16#002986# => PUNCTUATION_CLOSE,
when 16#002987# => PUNCTUATION_OPEN,
when 16#002988# => PUNCTUATION_CLOSE,
when 16#002989# => PUNCTUATION_OPEN,
when 16#00298A# => PUNCTUATION_CLOSE,
when 16#00298B# => PUNCTUATION_OPEN,
when 16#00298C# => PUNCTUATION_CLOSE,
when 16#00298D# => PUNCTUATION_OPEN,
when 16#00298E# => PUNCTUATION_CLOSE,
when 16#00298F# => PUNCTUATION_OPEN,
when 16#002990# => PUNCTUATION_CLOSE,
when 16#002991# => PUNCTUATION_OPEN,
when 16#002992# => PUNCTUATION_CLOSE,
when 16#002993# => PUNCTUATION_OPEN,
when 16#002994# => PUNCTUATION_CLOSE,
when 16#002995# => PUNCTUATION_OPEN,
when 16#002996# => PUNCTUATION_CLOSE,
when 16#002997# => PUNCTUATION_OPEN,
when 16#002998# => PUNCTUATION_CLOSE,
when 16#002999# .. 16#0029D7# => SYMBOL_MATH,
when 16#0029D8# => PUNCTUATION_OPEN,
when 16#0029D9# => PUNCTUATION_CLOSE,
when 16#0029DA# => PUNCTUATION_OPEN,
when 16#0029DB# => PUNCTUATION_CLOSE,
when 16#0029DC# .. 16#0029FB# => SYMBOL_MATH,
when 16#0029FC# => PUNCTUATION_OPEN,
when 16#0029FD# => PUNCTUATION_CLOSE,
when 16#0029FE# .. 16#002AFF# => SYMBOL_MATH,
when 16#002B00# .. 16#002B2F# => SYMBOL_OTHER,
when 16#002B30# .. 16#002B44# => SYMBOL_MATH,
when 16#002B45# .. 16#002B46# => SYMBOL_OTHER,
when 16#002B47# .. 16#002B4C# => SYMBOL_MATH,
when 16#002B4D# .. 16#002B73# => SYMBOL_OTHER,
when 16#002B76# .. 16#002B95# => SYMBOL_OTHER,
when 16#002B98# .. 16#002BFF# => SYMBOL_OTHER,
when 16#002C00# .. 16#002C2E# => LETTER_UPPERCASE,
when 16#002C30# .. 16#002C5E# => LETTER_LOWERCASE,
when 16#002C60# => LETTER_UPPERCASE,
when 16#002C61# => LETTER_LOWERCASE,
when 16#002C62# .. 16#002C64# => LETTER_UPPERCASE,
when 16#002C65# .. 16#002C66# => LETTER_LOWERCASE,
when 16#002C67# => LETTER_UPPERCASE,
when 16#002C68# => LETTER_LOWERCASE,
when 16#002C69# => LETTER_UPPERCASE,
when 16#002C6A# => LETTER_LOWERCASE,
when 16#002C6B# => LETTER_UPPERCASE,
when 16#002C6C# => LETTER_LOWERCASE,
when 16#002C6D# .. 16#002C70# => LETTER_UPPERCASE,
when 16#002C71# => LETTER_LOWERCASE,
when 16#002C72# => LETTER_UPPERCASE,
when 16#002C73# .. 16#002C74# => LETTER_LOWERCASE,
when 16#002C75# => LETTER_UPPERCASE,
when 16#002C76# .. 16#002C7B# => LETTER_LOWERCASE,
when 16#002C7C# .. 16#002C7D# => LETTER_MODIFIER,
when 16#002C7E# .. 16#002C80# => LETTER_UPPERCASE,
when 16#002C81# => LETTER_LOWERCASE,
when 16#002C82# => LETTER_UPPERCASE,
when 16#002C83# => LETTER_LOWERCASE,
when 16#002C84# => LETTER_UPPERCASE,
when 16#002C85# => LETTER_LOWERCASE,
when 16#002C86# => LETTER_UPPERCASE,
when 16#002C87# => LETTER_LOWERCASE,
when 16#002C88# => LETTER_UPPERCASE,
when 16#002C89# => LETTER_LOWERCASE,
when 16#002C8A# => LETTER_UPPERCASE,
when 16#002C8B# => LETTER_LOWERCASE,
when 16#002C8C# => LETTER_UPPERCASE,
when 16#002C8D# => LETTER_LOWERCASE,
when 16#002C8E# => LETTER_UPPERCASE,
when 16#002C8F# => LETTER_LOWERCASE,
when 16#002C90# => LETTER_UPPERCASE,
when 16#002C91# => LETTER_LOWERCASE,
when 16#002C92# => LETTER_UPPERCASE,
when 16#002C93# => LETTER_LOWERCASE,
when 16#002C94# => LETTER_UPPERCASE,
when 16#002C95# => LETTER_LOWERCASE,
when 16#002C96# => LETTER_UPPERCASE,
when 16#002C97# => LETTER_LOWERCASE,
when 16#002C98# => LETTER_UPPERCASE,
when 16#002C99# => LETTER_LOWERCASE,
when 16#002C9A# => LETTER_UPPERCASE,
when 16#002C9B# => LETTER_LOWERCASE,
when 16#002C9C# => LETTER_UPPERCASE,
when 16#002C9D# => LETTER_LOWERCASE,
when 16#002C9E# => LETTER_UPPERCASE,
when 16#002C9F# => LETTER_LOWERCASE,
when 16#002CA0# => LETTER_UPPERCASE,
when 16#002CA1# => LETTER_LOWERCASE,
when 16#002CA2# => LETTER_UPPERCASE,
when 16#002CA3# => LETTER_LOWERCASE,
when 16#002CA4# => LETTER_UPPERCASE,
when 16#002CA5# => LETTER_LOWERCASE,
when 16#002CA6# => LETTER_UPPERCASE,
when 16#002CA7# => LETTER_LOWERCASE,
when 16#002CA8# => LETTER_UPPERCASE,
when 16#002CA9# => LETTER_LOWERCASE,
when 16#002CAA# => LETTER_UPPERCASE,
when 16#002CAB# => LETTER_LOWERCASE,
when 16#002CAC# => LETTER_UPPERCASE,
when 16#002CAD# => LETTER_LOWERCASE,
when 16#002CAE# => LETTER_UPPERCASE,
when 16#002CAF# => LETTER_LOWERCASE,
when 16#002CB0# => LETTER_UPPERCASE,
when 16#002CB1# => LETTER_LOWERCASE,
when 16#002CB2# => LETTER_UPPERCASE,
when 16#002CB3# => LETTER_LOWERCASE,
when 16#002CB4# => LETTER_UPPERCASE,
when 16#002CB5# => LETTER_LOWERCASE,
when 16#002CB6# => LETTER_UPPERCASE,
when 16#002CB7# => LETTER_LOWERCASE,
when 16#002CB8# => LETTER_UPPERCASE,
when 16#002CB9# => LETTER_LOWERCASE,
when 16#002CBA# => LETTER_UPPERCASE,
when 16#002CBB# => LETTER_LOWERCASE,
when 16#002CBC# => LETTER_UPPERCASE,
when 16#002CBD# => LETTER_LOWERCASE,
when 16#002CBE# => LETTER_UPPERCASE,
when 16#002CBF# => LETTER_LOWERCASE,
when 16#002CC0# => LETTER_UPPERCASE,
when 16#002CC1# => LETTER_LOWERCASE,
when 16#002CC2# => LETTER_UPPERCASE,
when 16#002CC3# => LETTER_LOWERCASE,
when 16#002CC4# => LETTER_UPPERCASE,
when 16#002CC5# => LETTER_LOWERCASE,
when 16#002CC6# => LETTER_UPPERCASE,
when 16#002CC7# => LETTER_LOWERCASE,
when 16#002CC8# => LETTER_UPPERCASE,
when 16#002CC9# => LETTER_LOWERCASE,
when 16#002CCA# => LETTER_UPPERCASE,
when 16#002CCB# => LETTER_LOWERCASE,
when 16#002CCC# => LETTER_UPPERCASE,
when 16#002CCD# => LETTER_LOWERCASE,
when 16#002CCE# => LETTER_UPPERCASE,
when 16#002CCF# => LETTER_LOWERCASE,
when 16#002CD0# => LETTER_UPPERCASE,
when 16#002CD1# => LETTER_LOWERCASE,
when 16#002CD2# => LETTER_UPPERCASE,
when 16#002CD3# => LETTER_LOWERCASE,
when 16#002CD4# => LETTER_UPPERCASE,
when 16#002CD5# => LETTER_LOWERCASE,
when 16#002CD6# => LETTER_UPPERCASE,
when 16#002CD7# => LETTER_LOWERCASE,
when 16#002CD8# => LETTER_UPPERCASE,
when 16#002CD9# => LETTER_LOWERCASE,
when 16#002CDA# => LETTER_UPPERCASE,
when 16#002CDB# => LETTER_LOWERCASE,
when 16#002CDC# => LETTER_UPPERCASE,
when 16#002CDD# => LETTER_LOWERCASE,
when 16#002CDE# => LETTER_UPPERCASE,
when 16#002CDF# => LETTER_LOWERCASE,
when 16#002CE0# => LETTER_UPPERCASE,
when 16#002CE1# => LETTER_LOWERCASE,
when 16#002CE2# => LETTER_UPPERCASE,
when 16#002CE3# .. 16#002CE4# => LETTER_LOWERCASE,
when 16#002CE5# .. 16#002CEA# => SYMBOL_OTHER,
when 16#002CEB# => LETTER_UPPERCASE,
when 16#002CEC# => LETTER_LOWERCASE,
when 16#002CED# => LETTER_UPPERCASE,
when 16#002CEE# => LETTER_LOWERCASE,
when 16#002CEF# .. 16#002CF1# => MARK_NONSPACING,
when 16#002CF2# => LETTER_UPPERCASE,
when 16#002CF3# => LETTER_LOWERCASE,
when 16#002CF9# .. 16#002CFC# => PUNCTUATION_OTHER,
when 16#002CFD# => NUMBER_OTHER,
when 16#002CFE# .. 16#002CFF# => PUNCTUATION_OTHER,
when 16#002D00# .. 16#002D25# => LETTER_LOWERCASE,
when 16#002D27# => LETTER_LOWERCASE,
when 16#002D2D# => LETTER_LOWERCASE,
when 16#002D30# .. 16#002D67# => LETTER_OTHER,
when 16#002D6F# => LETTER_MODIFIER,
when 16#002D70# => PUNCTUATION_OTHER,
when 16#002D7F# => MARK_NONSPACING,
when 16#002D80# .. 16#002D96# => LETTER_OTHER,
when 16#002DA0# .. 16#002DA6# => LETTER_OTHER,
when 16#002DA8# .. 16#002DAE# => LETTER_OTHER,
when 16#002DB0# .. 16#002DB6# => LETTER_OTHER,
when 16#002DB8# .. 16#002DBE# => LETTER_OTHER,
when 16#002DC0# .. 16#002DC6# => LETTER_OTHER,
when 16#002DC8# .. 16#002DCE# => LETTER_OTHER,
when 16#002DD0# .. 16#002DD6# => LETTER_OTHER,
when 16#002DD8# .. 16#002DDE# => LETTER_OTHER,
when 16#002DE0# .. 16#002DFF# => MARK_NONSPACING,
when 16#002E00# .. 16#002E01# => PUNCTUATION_OTHER,
when 16#002E02# => PUNCTUATION_INITIAL_QUOTE,
when 16#002E03# => PUNCTUATION_FINAL_QUOTE,
when 16#002E04# => PUNCTUATION_INITIAL_QUOTE,
when 16#002E05# => PUNCTUATION_FINAL_QUOTE,
when 16#002E06# .. 16#002E08# => PUNCTUATION_OTHER,
when 16#002E09# => PUNCTUATION_INITIAL_QUOTE,
when 16#002E0A# => PUNCTUATION_FINAL_QUOTE,
when 16#002E0B# => PUNCTUATION_OTHER,
when 16#002E0C# => PUNCTUATION_INITIAL_QUOTE,
when 16#002E0D# => PUNCTUATION_FINAL_QUOTE,
when 16#002E0E# .. 16#002E16# => PUNCTUATION_OTHER,
when 16#002E17# => PUNCTUATION_DASH,
when 16#002E18# .. 16#002E19# => PUNCTUATION_OTHER,
when 16#002E1A# => PUNCTUATION_DASH,
when 16#002E1B# => PUNCTUATION_OTHER,
when 16#002E1C# => PUNCTUATION_INITIAL_QUOTE,
when 16#002E1D# => PUNCTUATION_FINAL_QUOTE,
when 16#002E1E# .. 16#002E1F# => PUNCTUATION_OTHER,
when 16#002E20# => PUNCTUATION_INITIAL_QUOTE,
when 16#002E21# => PUNCTUATION_FINAL_QUOTE,
when 16#002E22# => PUNCTUATION_OPEN,
when 16#002E23# => PUNCTUATION_CLOSE,
when 16#002E24# => PUNCTUATION_OPEN,
when 16#002E25# => PUNCTUATION_CLOSE,
when 16#002E26# => PUNCTUATION_OPEN,
when 16#002E27# => PUNCTUATION_CLOSE,
when 16#002E28# => PUNCTUATION_OPEN,
when 16#002E29# => PUNCTUATION_CLOSE,
when 16#002E2A# .. 16#002E2E# => PUNCTUATION_OTHER,
when 16#002E2F# => LETTER_MODIFIER,
when 16#002E30# .. 16#002E39# => PUNCTUATION_OTHER,
when 16#002E3A# .. 16#002E3B# => PUNCTUATION_DASH,
when 16#002E3C# .. 16#002E3F# => PUNCTUATION_OTHER,
when 16#002E40# => PUNCTUATION_DASH,
when 16#002E41# => PUNCTUATION_OTHER,
when 16#002E42# => PUNCTUATION_OPEN,
when 16#002E43# .. 16#002E4F# => PUNCTUATION_OTHER,
when 16#002E80# .. 16#002E99# => SYMBOL_OTHER,
when 16#002E9B# .. 16#002EF3# => SYMBOL_OTHER,
when 16#002F00# .. 16#002FD5# => SYMBOL_OTHER,
when 16#002FF0# .. 16#002FFB# => SYMBOL_OTHER,
when 16#003000# => SEPARATOR_SPACE,
when 16#003001# .. 16#003003# => PUNCTUATION_OTHER,
when 16#003004# => SYMBOL_OTHER,
when 16#003005# => LETTER_MODIFIER,
when 16#003006# => LETTER_OTHER,
when 16#003007# => NUMBER_LETTER,
when 16#003008# => PUNCTUATION_OPEN,
when 16#003009# => PUNCTUATION_CLOSE,
when 16#00300A# => PUNCTUATION_OPEN,
when 16#00300B# => PUNCTUATION_CLOSE,
when 16#00300C# => PUNCTUATION_OPEN,
when 16#00300D# => PUNCTUATION_CLOSE,
when 16#00300E# => PUNCTUATION_OPEN,
when 16#00300F# => PUNCTUATION_CLOSE,
when 16#003010# => PUNCTUATION_OPEN,
when 16#003011# => PUNCTUATION_CLOSE,
when 16#003012# .. 16#003013# => SYMBOL_OTHER,
when 16#003014# => PUNCTUATION_OPEN,
when 16#003015# => PUNCTUATION_CLOSE,
when 16#003016# => PUNCTUATION_OPEN,
when 16#003017# => PUNCTUATION_CLOSE,
when 16#003018# => PUNCTUATION_OPEN,
when 16#003019# => PUNCTUATION_CLOSE,
when 16#00301A# => PUNCTUATION_OPEN,
when 16#00301B# => PUNCTUATION_CLOSE,
when 16#00301C# => PUNCTUATION_DASH,
when 16#00301D# => PUNCTUATION_OPEN,
when 16#00301E# .. 16#00301F# => PUNCTUATION_CLOSE,
when 16#003020# => SYMBOL_OTHER,
when 16#003021# .. 16#003029# => NUMBER_LETTER,
when 16#00302A# .. 16#00302D# => MARK_NONSPACING,
when 16#00302E# .. 16#00302F# => MARK_SPACING_COMBINING,
when 16#003030# => PUNCTUATION_DASH,
when 16#003031# .. 16#003035# => LETTER_MODIFIER,
when 16#003036# .. 16#003037# => SYMBOL_OTHER,
when 16#003038# .. 16#00303A# => NUMBER_LETTER,
when 16#00303B# => LETTER_MODIFIER,
when 16#00303C# => LETTER_OTHER,
when 16#00303D# => PUNCTUATION_OTHER,
when 16#00303E# .. 16#00303F# => SYMBOL_OTHER,
when 16#003041# .. 16#003096# => LETTER_OTHER,
when 16#003099# .. 16#00309A# => MARK_NONSPACING,
when 16#00309B# .. 16#00309C# => SYMBOL_MODIFIER,
when 16#00309D# .. 16#00309E# => LETTER_MODIFIER,
when 16#00309F# => LETTER_OTHER,
when 16#0030A0# => PUNCTUATION_DASH,
when 16#0030A1# .. 16#0030FA# => LETTER_OTHER,
when 16#0030FB# => PUNCTUATION_OTHER,
when 16#0030FC# .. 16#0030FE# => LETTER_MODIFIER,
when 16#0030FF# => LETTER_OTHER,
when 16#003105# .. 16#00312F# => LETTER_OTHER,
when 16#003131# .. 16#00318E# => LETTER_OTHER,
when 16#003190# .. 16#003191# => SYMBOL_OTHER,
when 16#003192# .. 16#003195# => NUMBER_OTHER,
when 16#003196# .. 16#00319F# => SYMBOL_OTHER,
when 16#0031A0# .. 16#0031BA# => LETTER_OTHER,
when 16#0031C0# .. 16#0031E3# => SYMBOL_OTHER,
when 16#0031F0# .. 16#0031FF# => LETTER_OTHER,
when 16#003200# .. 16#00321E# => SYMBOL_OTHER,
when 16#003220# .. 16#003229# => NUMBER_OTHER,
when 16#00322A# .. 16#003247# => SYMBOL_OTHER,
when 16#003248# .. 16#00324F# => NUMBER_OTHER,
when 16#003250# => SYMBOL_OTHER,
when 16#003251# .. 16#00325F# => NUMBER_OTHER,
when 16#003260# .. 16#00327F# => SYMBOL_OTHER,
when 16#003280# .. 16#003289# => NUMBER_OTHER,
when 16#00328A# .. 16#0032B0# => SYMBOL_OTHER,
when 16#0032B1# .. 16#0032BF# => NUMBER_OTHER,
when 16#0032C0# .. 16#0033FF# => SYMBOL_OTHER,
when 16#003400# .. 16#004DB5# => LETTER_OTHER,
when 16#004DC0# .. 16#004DFF# => SYMBOL_OTHER,
when 16#004E00# .. 16#009FEF# => LETTER_OTHER,
when 16#00A000# .. 16#00A014# => LETTER_OTHER,
when 16#00A015# => LETTER_MODIFIER,
when 16#00A016# .. 16#00A48C# => LETTER_OTHER,
when 16#00A490# .. 16#00A4C6# => SYMBOL_OTHER,
when 16#00A4D0# .. 16#00A4F7# => LETTER_OTHER,
when 16#00A4F8# .. 16#00A4FD# => LETTER_MODIFIER,
when 16#00A4FE# .. 16#00A4FF# => PUNCTUATION_OTHER,
when 16#00A500# .. 16#00A60B# => LETTER_OTHER,
when 16#00A60C# => LETTER_MODIFIER,
when 16#00A60D# .. 16#00A60F# => PUNCTUATION_OTHER,
when 16#00A610# .. 16#00A61F# => LETTER_OTHER,
when 16#00A620# .. 16#00A629# => NUMBER_DECIMAL_DIGIT,
when 16#00A62A# .. 16#00A62B# => LETTER_OTHER,
when 16#00A640# => LETTER_UPPERCASE,
when 16#00A641# => LETTER_LOWERCASE,
when 16#00A642# => LETTER_UPPERCASE,
when 16#00A643# => LETTER_LOWERCASE,
when 16#00A644# => LETTER_UPPERCASE,
when 16#00A645# => LETTER_LOWERCASE,
when 16#00A646# => LETTER_UPPERCASE,
when 16#00A647# => LETTER_LOWERCASE,
when 16#00A648# => LETTER_UPPERCASE,
when 16#00A649# => LETTER_LOWERCASE,
when 16#00A64A# => LETTER_UPPERCASE,
when 16#00A64B# => LETTER_LOWERCASE,
when 16#00A64C# => LETTER_UPPERCASE,
when 16#00A64D# => LETTER_LOWERCASE,
when 16#00A64E# => LETTER_UPPERCASE,
when 16#00A64F# => LETTER_LOWERCASE,
when 16#00A650# => LETTER_UPPERCASE,
when 16#00A651# => LETTER_LOWERCASE,
when 16#00A652# => LETTER_UPPERCASE,
when 16#00A653# => LETTER_LOWERCASE,
when 16#00A654# => LETTER_UPPERCASE,
when 16#00A655# => LETTER_LOWERCASE,
when 16#00A656# => LETTER_UPPERCASE,
when 16#00A657# => LETTER_LOWERCASE,
when 16#00A658# => LETTER_UPPERCASE,
when 16#00A659# => LETTER_LOWERCASE,
when 16#00A65A# => LETTER_UPPERCASE,
when 16#00A65B# => LETTER_LOWERCASE,
when 16#00A65C# => LETTER_UPPERCASE,
when 16#00A65D# => LETTER_LOWERCASE,
when 16#00A65E# => LETTER_UPPERCASE,
when 16#00A65F# => LETTER_LOWERCASE,
when 16#00A660# => LETTER_UPPERCASE,
when 16#00A661# => LETTER_LOWERCASE,
when 16#00A662# => LETTER_UPPERCASE,
when 16#00A663# => LETTER_LOWERCASE,
when 16#00A664# => LETTER_UPPERCASE,
when 16#00A665# => LETTER_LOWERCASE,
when 16#00A666# => LETTER_UPPERCASE,
when 16#00A667# => LETTER_LOWERCASE,
when 16#00A668# => LETTER_UPPERCASE,
when 16#00A669# => LETTER_LOWERCASE,
when 16#00A66A# => LETTER_UPPERCASE,
when 16#00A66B# => LETTER_LOWERCASE,
when 16#00A66C# => LETTER_UPPERCASE,
when 16#00A66D# => LETTER_LOWERCASE,
when 16#00A66E# => LETTER_OTHER,
when 16#00A66F# => MARK_NONSPACING,
when 16#00A670# .. 16#00A672# => MARK_ENCLOSING,
when 16#00A673# => PUNCTUATION_OTHER,
when 16#00A674# .. 16#00A67D# => MARK_NONSPACING,
when 16#00A67E# => PUNCTUATION_OTHER,
when 16#00A67F# => LETTER_MODIFIER,
when 16#00A680# => LETTER_UPPERCASE,
when 16#00A681# => LETTER_LOWERCASE,
when 16#00A682# => LETTER_UPPERCASE,
when 16#00A683# => LETTER_LOWERCASE,
when 16#00A684# => LETTER_UPPERCASE,
when 16#00A685# => LETTER_LOWERCASE,
when 16#00A686# => LETTER_UPPERCASE,
when 16#00A687# => LETTER_LOWERCASE,
when 16#00A688# => LETTER_UPPERCASE,
when 16#00A689# => LETTER_LOWERCASE,
when 16#00A68A# => LETTER_UPPERCASE,
when 16#00A68B# => LETTER_LOWERCASE,
when 16#00A68C# => LETTER_UPPERCASE,
when 16#00A68D# => LETTER_LOWERCASE,
when 16#00A68E# => LETTER_UPPERCASE,
when 16#00A68F# => LETTER_LOWERCASE,
when 16#00A690# => LETTER_UPPERCASE,
when 16#00A691# => LETTER_LOWERCASE,
when 16#00A692# => LETTER_UPPERCASE,
when 16#00A693# => LETTER_LOWERCASE,
when 16#00A694# => LETTER_UPPERCASE,
when 16#00A695# => LETTER_LOWERCASE,
when 16#00A696# => LETTER_UPPERCASE,
when 16#00A697# => LETTER_LOWERCASE,
when 16#00A698# => LETTER_UPPERCASE,
when 16#00A699# => LETTER_LOWERCASE,
when 16#00A69A# => LETTER_UPPERCASE,
when 16#00A69B# => LETTER_LOWERCASE,
when 16#00A69C# .. 16#00A69D# => LETTER_MODIFIER,
when 16#00A69E# .. 16#00A69F# => MARK_NONSPACING,
when 16#00A6A0# .. 16#00A6E5# => LETTER_OTHER,
when 16#00A6E6# .. 16#00A6EF# => NUMBER_LETTER,
when 16#00A6F0# .. 16#00A6F1# => MARK_NONSPACING,
when 16#00A6F2# .. 16#00A6F7# => PUNCTUATION_OTHER,
when 16#00A700# .. 16#00A716# => SYMBOL_MODIFIER,
when 16#00A717# .. 16#00A71F# => LETTER_MODIFIER,
when 16#00A720# .. 16#00A721# => SYMBOL_MODIFIER,
when 16#00A722# => LETTER_UPPERCASE,
when 16#00A723# => LETTER_LOWERCASE,
when 16#00A724# => LETTER_UPPERCASE,
when 16#00A725# => LETTER_LOWERCASE,
when 16#00A726# => LETTER_UPPERCASE,
when 16#00A727# => LETTER_LOWERCASE,
when 16#00A728# => LETTER_UPPERCASE,
when 16#00A729# => LETTER_LOWERCASE,
when 16#00A72A# => LETTER_UPPERCASE,
when 16#00A72B# => LETTER_LOWERCASE,
when 16#00A72C# => LETTER_UPPERCASE,
when 16#00A72D# => LETTER_LOWERCASE,
when 16#00A72E# => LETTER_UPPERCASE,
when 16#00A72F# .. 16#00A731# => LETTER_LOWERCASE,
when 16#00A732# => LETTER_UPPERCASE,
when 16#00A733# => LETTER_LOWERCASE,
when 16#00A734# => LETTER_UPPERCASE,
when 16#00A735# => LETTER_LOWERCASE,
when 16#00A736# => LETTER_UPPERCASE,
when 16#00A737# => LETTER_LOWERCASE,
when 16#00A738# => LETTER_UPPERCASE,
when 16#00A739# => LETTER_LOWERCASE,
when 16#00A73A# => LETTER_UPPERCASE,
when 16#00A73B# => LETTER_LOWERCASE,
when 16#00A73C# => LETTER_UPPERCASE,
when 16#00A73D# => LETTER_LOWERCASE,
when 16#00A73E# => LETTER_UPPERCASE,
when 16#00A73F# => LETTER_LOWERCASE,
when 16#00A740# => LETTER_UPPERCASE,
when 16#00A741# => LETTER_LOWERCASE,
when 16#00A742# => LETTER_UPPERCASE,
when 16#00A743# => LETTER_LOWERCASE,
when 16#00A744# => LETTER_UPPERCASE,
when 16#00A745# => LETTER_LOWERCASE,
when 16#00A746# => LETTER_UPPERCASE,
when 16#00A747# => LETTER_LOWERCASE,
when 16#00A748# => LETTER_UPPERCASE,
when 16#00A749# => LETTER_LOWERCASE,
when 16#00A74A# => LETTER_UPPERCASE,
when 16#00A74B# => LETTER_LOWERCASE,
when 16#00A74C# => LETTER_UPPERCASE,
when 16#00A74D# => LETTER_LOWERCASE,
when 16#00A74E# => LETTER_UPPERCASE,
when 16#00A74F# => LETTER_LOWERCASE,
when 16#00A750# => LETTER_UPPERCASE,
when 16#00A751# => LETTER_LOWERCASE,
when 16#00A752# => LETTER_UPPERCASE,
when 16#00A753# => LETTER_LOWERCASE,
when 16#00A754# => LETTER_UPPERCASE,
when 16#00A755# => LETTER_LOWERCASE,
when 16#00A756# => LETTER_UPPERCASE,
when 16#00A757# => LETTER_LOWERCASE,
when 16#00A758# => LETTER_UPPERCASE,
when 16#00A759# => LETTER_LOWERCASE,
when 16#00A75A# => LETTER_UPPERCASE,
when 16#00A75B# => LETTER_LOWERCASE,
when 16#00A75C# => LETTER_UPPERCASE,
when 16#00A75D# => LETTER_LOWERCASE,
when 16#00A75E# => LETTER_UPPERCASE,
when 16#00A75F# => LETTER_LOWERCASE,
when 16#00A760# => LETTER_UPPERCASE,
when 16#00A761# => LETTER_LOWERCASE,
when 16#00A762# => LETTER_UPPERCASE,
when 16#00A763# => LETTER_LOWERCASE,
when 16#00A764# => LETTER_UPPERCASE,
when 16#00A765# => LETTER_LOWERCASE,
when 16#00A766# => LETTER_UPPERCASE,
when 16#00A767# => LETTER_LOWERCASE,
when 16#00A768# => LETTER_UPPERCASE,
when 16#00A769# => LETTER_LOWERCASE,
when 16#00A76A# => LETTER_UPPERCASE,
when 16#00A76B# => LETTER_LOWERCASE,
when 16#00A76C# => LETTER_UPPERCASE,
when 16#00A76D# => LETTER_LOWERCASE,
when 16#00A76E# => LETTER_UPPERCASE,
when 16#00A76F# => LETTER_LOWERCASE,
when 16#00A770# => LETTER_MODIFIER,
when 16#00A771# .. 16#00A778# => LETTER_LOWERCASE,
when 16#00A779# => LETTER_UPPERCASE,
when 16#00A77A# => LETTER_LOWERCASE,
when 16#00A77B# => LETTER_UPPERCASE,
when 16#00A77C# => LETTER_LOWERCASE,
when 16#00A77D# .. 16#00A77E# => LETTER_UPPERCASE,
when 16#00A77F# => LETTER_LOWERCASE,
when 16#00A780# => LETTER_UPPERCASE,
when 16#00A781# => LETTER_LOWERCASE,
when 16#00A782# => LETTER_UPPERCASE,
when 16#00A783# => LETTER_LOWERCASE,
when 16#00A784# => LETTER_UPPERCASE,
when 16#00A785# => LETTER_LOWERCASE,
when 16#00A786# => LETTER_UPPERCASE,
when 16#00A787# => LETTER_LOWERCASE,
when 16#00A788# => LETTER_MODIFIER,
when 16#00A789# .. 16#00A78A# => SYMBOL_MODIFIER,
when 16#00A78B# => LETTER_UPPERCASE,
when 16#00A78C# => LETTER_LOWERCASE,
when 16#00A78D# => LETTER_UPPERCASE,
when 16#00A78E# => LETTER_LOWERCASE,
when 16#00A78F# => LETTER_OTHER,
when 16#00A790# => LETTER_UPPERCASE,
when 16#00A791# => LETTER_LOWERCASE,
when 16#00A792# => LETTER_UPPERCASE,
when 16#00A793# .. 16#00A795# => LETTER_LOWERCASE,
when 16#00A796# => LETTER_UPPERCASE,
when 16#00A797# => LETTER_LOWERCASE,
when 16#00A798# => LETTER_UPPERCASE,
when 16#00A799# => LETTER_LOWERCASE,
when 16#00A79A# => LETTER_UPPERCASE,
when 16#00A79B# => LETTER_LOWERCASE,
when 16#00A79C# => LETTER_UPPERCASE,
when 16#00A79D# => LETTER_LOWERCASE,
when 16#00A79E# => LETTER_UPPERCASE,
when 16#00A79F# => LETTER_LOWERCASE,
when 16#00A7A0# => LETTER_UPPERCASE,
when 16#00A7A1# => LETTER_LOWERCASE,
when 16#00A7A2# => LETTER_UPPERCASE,
when 16#00A7A3# => LETTER_LOWERCASE,
when 16#00A7A4# => LETTER_UPPERCASE,
when 16#00A7A5# => LETTER_LOWERCASE,
when 16#00A7A6# => LETTER_UPPERCASE,
when 16#00A7A7# => LETTER_LOWERCASE,
when 16#00A7A8# => LETTER_UPPERCASE,
when 16#00A7A9# => LETTER_LOWERCASE,
when 16#00A7AA# .. 16#00A7AE# => LETTER_UPPERCASE,
when 16#00A7AF# => LETTER_LOWERCASE,
when 16#00A7B0# .. 16#00A7B4# => LETTER_UPPERCASE,
when 16#00A7B5# => LETTER_LOWERCASE,
when 16#00A7B6# => LETTER_UPPERCASE,
when 16#00A7B7# => LETTER_LOWERCASE,
when 16#00A7B8# => LETTER_UPPERCASE,
when 16#00A7B9# => LETTER_LOWERCASE,
when 16#00A7BA# => LETTER_UPPERCASE,
when 16#00A7BB# => LETTER_LOWERCASE,
when 16#00A7BC# => LETTER_UPPERCASE,
when 16#00A7BD# => LETTER_LOWERCASE,
when 16#00A7BE# => LETTER_UPPERCASE,
when 16#00A7BF# => LETTER_LOWERCASE,
when 16#00A7C2# => LETTER_UPPERCASE,
when 16#00A7C3# => LETTER_LOWERCASE,
when 16#00A7C4# .. 16#00A7C6# => LETTER_UPPERCASE,
when 16#00A7F7# => LETTER_OTHER,
when 16#00A7F8# .. 16#00A7F9# => LETTER_MODIFIER,
when 16#00A7FA# => LETTER_LOWERCASE,
when 16#00A7FB# .. 16#00A801# => LETTER_OTHER,
when 16#00A802# => MARK_NONSPACING,
when 16#00A803# .. 16#00A805# => LETTER_OTHER,
when 16#00A806# => MARK_NONSPACING,
when 16#00A807# .. 16#00A80A# => LETTER_OTHER,
when 16#00A80B# => MARK_NONSPACING,
when 16#00A80C# .. 16#00A822# => LETTER_OTHER,
when 16#00A823# .. 16#00A824# => MARK_SPACING_COMBINING,
when 16#00A825# .. 16#00A826# => MARK_NONSPACING,
when 16#00A827# => MARK_SPACING_COMBINING,
when 16#00A828# .. 16#00A82B# => SYMBOL_OTHER,
when 16#00A830# .. 16#00A835# => NUMBER_OTHER,
when 16#00A836# .. 16#00A837# => SYMBOL_OTHER,
when 16#00A838# => SYMBOL_CURRENCY,
when 16#00A839# => SYMBOL_OTHER,
when 16#00A840# .. 16#00A873# => LETTER_OTHER,
when 16#00A874# .. 16#00A877# => PUNCTUATION_OTHER,
when 16#00A880# .. 16#00A881# => MARK_SPACING_COMBINING,
when 16#00A882# .. 16#00A8B3# => LETTER_OTHER,
when 16#00A8B4# .. 16#00A8C3# => MARK_SPACING_COMBINING,
when 16#00A8C4# .. 16#00A8C5# => MARK_NONSPACING,
when 16#00A8CE# .. 16#00A8CF# => PUNCTUATION_OTHER,
when 16#00A8D0# .. 16#00A8D9# => NUMBER_DECIMAL_DIGIT,
when 16#00A8E0# .. 16#00A8F1# => MARK_NONSPACING,
when 16#00A8F2# .. 16#00A8F7# => LETTER_OTHER,
when 16#00A8F8# .. 16#00A8FA# => PUNCTUATION_OTHER,
when 16#00A8FB# => LETTER_OTHER,
when 16#00A8FC# => PUNCTUATION_OTHER,
when 16#00A8FD# .. 16#00A8FE# => LETTER_OTHER,
when 16#00A8FF# => MARK_NONSPACING,
when 16#00A900# .. 16#00A909# => NUMBER_DECIMAL_DIGIT,
when 16#00A90A# .. 16#00A925# => LETTER_OTHER,
when 16#00A926# .. 16#00A92D# => MARK_NONSPACING,
when 16#00A92E# .. 16#00A92F# => PUNCTUATION_OTHER,
when 16#00A930# .. 16#00A946# => LETTER_OTHER,
when 16#00A947# .. 16#00A951# => MARK_NONSPACING,
when 16#00A952# .. 16#00A953# => MARK_SPACING_COMBINING,
when 16#00A95F# => PUNCTUATION_OTHER,
when 16#00A960# .. 16#00A97C# => LETTER_OTHER,
when 16#00A980# .. 16#00A982# => MARK_NONSPACING,
when 16#00A983# => MARK_SPACING_COMBINING,
when 16#00A984# .. 16#00A9B2# => LETTER_OTHER,
when 16#00A9B3# => MARK_NONSPACING,
when 16#00A9B4# .. 16#00A9B5# => MARK_SPACING_COMBINING,
when 16#00A9B6# .. 16#00A9B9# => MARK_NONSPACING,
when 16#00A9BA# .. 16#00A9BB# => MARK_SPACING_COMBINING,
when 16#00A9BC# .. 16#00A9BD# => MARK_NONSPACING,
when 16#00A9BE# .. 16#00A9C0# => MARK_SPACING_COMBINING,
when 16#00A9C1# .. 16#00A9CD# => PUNCTUATION_OTHER,
when 16#00A9CF# => LETTER_MODIFIER,
when 16#00A9D0# .. 16#00A9D9# => NUMBER_DECIMAL_DIGIT,
when 16#00A9DE# .. 16#00A9DF# => PUNCTUATION_OTHER,
when 16#00A9E0# .. 16#00A9E4# => LETTER_OTHER,
when 16#00A9E5# => MARK_NONSPACING,
when 16#00A9E6# => LETTER_MODIFIER,
when 16#00A9E7# .. 16#00A9EF# => LETTER_OTHER,
when 16#00A9F0# .. 16#00A9F9# => NUMBER_DECIMAL_DIGIT,
when 16#00A9FA# .. 16#00A9FE# => LETTER_OTHER,
when 16#00AA00# .. 16#00AA28# => LETTER_OTHER,
when 16#00AA29# .. 16#00AA2E# => MARK_NONSPACING,
when 16#00AA2F# .. 16#00AA30# => MARK_SPACING_COMBINING,
when 16#00AA31# .. 16#00AA32# => MARK_NONSPACING,
when 16#00AA33# .. 16#00AA34# => MARK_SPACING_COMBINING,
when 16#00AA35# .. 16#00AA36# => MARK_NONSPACING,
when 16#00AA40# .. 16#00AA42# => LETTER_OTHER,
when 16#00AA43# => MARK_NONSPACING,
when 16#00AA44# .. 16#00AA4B# => LETTER_OTHER,
when 16#00AA4C# => MARK_NONSPACING,
when 16#00AA4D# => MARK_SPACING_COMBINING,
when 16#00AA50# .. 16#00AA59# => NUMBER_DECIMAL_DIGIT,
when 16#00AA5C# .. 16#00AA5F# => PUNCTUATION_OTHER,
when 16#00AA60# .. 16#00AA6F# => LETTER_OTHER,
when 16#00AA70# => LETTER_MODIFIER,
when 16#00AA71# .. 16#00AA76# => LETTER_OTHER,
when 16#00AA77# .. 16#00AA79# => SYMBOL_OTHER,
when 16#00AA7A# => LETTER_OTHER,
when 16#00AA7B# => MARK_SPACING_COMBINING,
when 16#00AA7C# => MARK_NONSPACING,
when 16#00AA7D# => MARK_SPACING_COMBINING,
when 16#00AA7E# .. 16#00AAAF# => LETTER_OTHER,
when 16#00AAB0# => MARK_NONSPACING,
when 16#00AAB1# => LETTER_OTHER,
when 16#00AAB2# .. 16#00AAB4# => MARK_NONSPACING,
when 16#00AAB5# .. 16#00AAB6# => LETTER_OTHER,
when 16#00AAB7# .. 16#00AAB8# => MARK_NONSPACING,
when 16#00AAB9# .. 16#00AABD# => LETTER_OTHER,
when 16#00AABE# .. 16#00AABF# => MARK_NONSPACING,
when 16#00AAC0# => LETTER_OTHER,
when 16#00AAC1# => MARK_NONSPACING,
when 16#00AAC2# => LETTER_OTHER,
when 16#00AADB# .. 16#00AADC# => LETTER_OTHER,
when 16#00AADD# => LETTER_MODIFIER,
when 16#00AADE# .. 16#00AADF# => PUNCTUATION_OTHER,
when 16#00AAE0# .. 16#00AAEA# => LETTER_OTHER,
when 16#00AAEB# => MARK_SPACING_COMBINING,
when 16#00AAEC# .. 16#00AAED# => MARK_NONSPACING,
when 16#00AAEE# .. 16#00AAEF# => MARK_SPACING_COMBINING,
when 16#00AAF0# .. 16#00AAF1# => PUNCTUATION_OTHER,
when 16#00AAF2# => LETTER_OTHER,
when 16#00AAF3# .. 16#00AAF4# => LETTER_MODIFIER,
when 16#00AAF5# => MARK_SPACING_COMBINING,
when 16#00AAF6# => MARK_NONSPACING,
when 16#00AB01# .. 16#00AB06# => LETTER_OTHER,
when 16#00AB09# .. 16#00AB0E# => LETTER_OTHER,
when 16#00AB11# .. 16#00AB16# => LETTER_OTHER,
when 16#00AB20# .. 16#00AB26# => LETTER_OTHER,
when 16#00AB28# .. 16#00AB2E# => LETTER_OTHER,
when 16#00AB30# .. 16#00AB5A# => LETTER_LOWERCASE,
when 16#00AB5B# => SYMBOL_MODIFIER,
when 16#00AB5C# .. 16#00AB5F# => LETTER_MODIFIER,
when 16#00AB60# .. 16#00AB67# => LETTER_LOWERCASE,
when 16#00AB70# .. 16#00ABBF# => LETTER_LOWERCASE,
when 16#00ABC0# .. 16#00ABE2# => LETTER_OTHER,
when 16#00ABE3# .. 16#00ABE4# => MARK_SPACING_COMBINING,
when 16#00ABE5# => MARK_NONSPACING,
when 16#00ABE6# .. 16#00ABE7# => MARK_SPACING_COMBINING,
when 16#00ABE8# => MARK_NONSPACING,
when 16#00ABE9# .. 16#00ABEA# => MARK_SPACING_COMBINING,
when 16#00ABEB# => PUNCTUATION_OTHER,
when 16#00ABEC# => MARK_SPACING_COMBINING,
when 16#00ABED# => MARK_NONSPACING,
when 16#00ABF0# .. 16#00ABF9# => NUMBER_DECIMAL_DIGIT,
when 16#00AC00# .. 16#00D7A3# => LETTER_OTHER,
when 16#00D7B0# .. 16#00D7C6# => LETTER_OTHER,
when 16#00D7CB# .. 16#00D7FB# => LETTER_OTHER,
when 16#00D800# .. 16#00DFFF# => OTHER_SURROGATE,
when 16#00E000# .. 16#00F8FF# => OTHER_PRIVATE_USE,
when 16#00F900# .. 16#00FA6D# => LETTER_OTHER,
when 16#00FA70# .. 16#00FAD9# => LETTER_OTHER,
when 16#00FB00# .. 16#00FB06# => LETTER_LOWERCASE,
when 16#00FB13# .. 16#00FB17# => LETTER_LOWERCASE,
when 16#00FB1D# => LETTER_OTHER,
when 16#00FB1E# => MARK_NONSPACING,
when 16#00FB1F# .. 16#00FB28# => LETTER_OTHER,
when 16#00FB29# => SYMBOL_MATH,
when 16#00FB2A# .. 16#00FB36# => LETTER_OTHER,
when 16#00FB38# .. 16#00FB3C# => LETTER_OTHER,
when 16#00FB3E# => LETTER_OTHER,
when 16#00FB40# .. 16#00FB41# => LETTER_OTHER,
when 16#00FB43# .. 16#00FB44# => LETTER_OTHER,
when 16#00FB46# .. 16#00FBB1# => LETTER_OTHER,
when 16#00FBB2# .. 16#00FBC1# => SYMBOL_MODIFIER,
when 16#00FBD3# .. 16#00FD3D# => LETTER_OTHER,
when 16#00FD3E# => PUNCTUATION_CLOSE,
when 16#00FD3F# => PUNCTUATION_OPEN,
when 16#00FD50# .. 16#00FD8F# => LETTER_OTHER,
when 16#00FD92# .. 16#00FDC7# => LETTER_OTHER,
when 16#00FDF0# .. 16#00FDFB# => LETTER_OTHER,
when 16#00FDFC# => SYMBOL_CURRENCY,
when 16#00FDFD# => SYMBOL_OTHER,
when 16#00FE00# .. 16#00FE0F# => MARK_NONSPACING,
when 16#00FE10# .. 16#00FE16# => PUNCTUATION_OTHER,
when 16#00FE17# => PUNCTUATION_OPEN,
when 16#00FE18# => PUNCTUATION_CLOSE,
when 16#00FE19# => PUNCTUATION_OTHER,
when 16#00FE20# .. 16#00FE2F# => MARK_NONSPACING,
when 16#00FE30# => PUNCTUATION_OTHER,
when 16#00FE31# .. 16#00FE32# => PUNCTUATION_DASH,
when 16#00FE33# .. 16#00FE34# => PUNCTUATION_CONNECTOR,
when 16#00FE35# => PUNCTUATION_OPEN,
when 16#00FE36# => PUNCTUATION_CLOSE,
when 16#00FE37# => PUNCTUATION_OPEN,
when 16#00FE38# => PUNCTUATION_CLOSE,
when 16#00FE39# => PUNCTUATION_OPEN,
when 16#00FE3A# => PUNCTUATION_CLOSE,
when 16#00FE3B# => PUNCTUATION_OPEN,
when 16#00FE3C# => PUNCTUATION_CLOSE,
when 16#00FE3D# => PUNCTUATION_OPEN,
when 16#00FE3E# => PUNCTUATION_CLOSE,
when 16#00FE3F# => PUNCTUATION_OPEN,
when 16#00FE40# => PUNCTUATION_CLOSE,
when 16#00FE41# => PUNCTUATION_OPEN,
when 16#00FE42# => PUNCTUATION_CLOSE,
when 16#00FE43# => PUNCTUATION_OPEN,
when 16#00FE44# => PUNCTUATION_CLOSE,
when 16#00FE45# .. 16#00FE46# => PUNCTUATION_OTHER,
when 16#00FE47# => PUNCTUATION_OPEN,
when 16#00FE48# => PUNCTUATION_CLOSE,
when 16#00FE49# .. 16#00FE4C# => PUNCTUATION_OTHER,
when 16#00FE4D# .. 16#00FE4F# => PUNCTUATION_CONNECTOR,
when 16#00FE50# .. 16#00FE52# => PUNCTUATION_OTHER,
when 16#00FE54# .. 16#00FE57# => PUNCTUATION_OTHER,
when 16#00FE58# => PUNCTUATION_DASH,
when 16#00FE59# => PUNCTUATION_OPEN,
when 16#00FE5A# => PUNCTUATION_CLOSE,
when 16#00FE5B# => PUNCTUATION_OPEN,
when 16#00FE5C# => PUNCTUATION_CLOSE,
when 16#00FE5D# => PUNCTUATION_OPEN,
when 16#00FE5E# => PUNCTUATION_CLOSE,
when 16#00FE5F# .. 16#00FE61# => PUNCTUATION_OTHER,
when 16#00FE62# => SYMBOL_MATH,
when 16#00FE63# => PUNCTUATION_DASH,
when 16#00FE64# .. 16#00FE66# => SYMBOL_MATH,
when 16#00FE68# => PUNCTUATION_OTHER,
when 16#00FE69# => SYMBOL_CURRENCY,
when 16#00FE6A# .. 16#00FE6B# => PUNCTUATION_OTHER,
when 16#00FE70# .. 16#00FE74# => LETTER_OTHER,
when 16#00FE76# .. 16#00FEFC# => LETTER_OTHER,
when 16#00FEFF# => OTHER_FORMAT,
when 16#00FF01# .. 16#00FF03# => PUNCTUATION_OTHER,
when 16#00FF04# => SYMBOL_CURRENCY,
when 16#00FF05# .. 16#00FF07# => PUNCTUATION_OTHER,
when 16#00FF08# => PUNCTUATION_OPEN,
when 16#00FF09# => PUNCTUATION_CLOSE,
when 16#00FF0A# => PUNCTUATION_OTHER,
when 16#00FF0B# => SYMBOL_MATH,
when 16#00FF0C# => PUNCTUATION_OTHER,
when 16#00FF0D# => PUNCTUATION_DASH,
when 16#00FF0E# .. 16#00FF0F# => PUNCTUATION_OTHER,
when 16#00FF10# .. 16#00FF19# => NUMBER_DECIMAL_DIGIT,
when 16#00FF1A# .. 16#00FF1B# => PUNCTUATION_OTHER,
when 16#00FF1C# .. 16#00FF1E# => SYMBOL_MATH,
when 16#00FF1F# .. 16#00FF20# => PUNCTUATION_OTHER,
when 16#00FF21# .. 16#00FF3A# => LETTER_UPPERCASE,
when 16#00FF3B# => PUNCTUATION_OPEN,
when 16#00FF3C# => PUNCTUATION_OTHER,
when 16#00FF3D# => PUNCTUATION_CLOSE,
when 16#00FF3E# => SYMBOL_MODIFIER,
when 16#00FF3F# => PUNCTUATION_CONNECTOR,
when 16#00FF40# => SYMBOL_MODIFIER,
when 16#00FF41# .. 16#00FF5A# => LETTER_LOWERCASE,
when 16#00FF5B# => PUNCTUATION_OPEN,
when 16#00FF5C# => SYMBOL_MATH,
when 16#00FF5D# => PUNCTUATION_CLOSE,
when 16#00FF5E# => SYMBOL_MATH,
when 16#00FF5F# => PUNCTUATION_OPEN,
when 16#00FF60# => PUNCTUATION_CLOSE,
when 16#00FF61# => PUNCTUATION_OTHER,
when 16#00FF62# => PUNCTUATION_OPEN,
when 16#00FF63# => PUNCTUATION_CLOSE,
when 16#00FF64# .. 16#00FF65# => PUNCTUATION_OTHER,
when 16#00FF66# .. 16#00FF6F# => LETTER_OTHER,
when 16#00FF70# => LETTER_MODIFIER,
when 16#00FF71# .. 16#00FF9D# => LETTER_OTHER,
when 16#00FF9E# .. 16#00FF9F# => LETTER_MODIFIER,
when 16#00FFA0# .. 16#00FFBE# => LETTER_OTHER,
when 16#00FFC2# .. 16#00FFC7# => LETTER_OTHER,
when 16#00FFCA# .. 16#00FFCF# => LETTER_OTHER,
when 16#00FFD2# .. 16#00FFD7# => LETTER_OTHER,
when 16#00FFDA# .. 16#00FFDC# => LETTER_OTHER,
when 16#00FFE0# .. 16#00FFE1# => SYMBOL_CURRENCY,
when 16#00FFE2# => SYMBOL_MATH,
when 16#00FFE3# => SYMBOL_MODIFIER,
when 16#00FFE4# => SYMBOL_OTHER,
when 16#00FFE5# .. 16#00FFE6# => SYMBOL_CURRENCY,
when 16#00FFE8# => SYMBOL_OTHER,
when 16#00FFE9# .. 16#00FFEC# => SYMBOL_MATH,
when 16#00FFED# .. 16#00FFEE# => SYMBOL_OTHER,
when 16#00FFF9# .. 16#00FFFB# => OTHER_FORMAT,
when 16#00FFFC# .. 16#00FFFD# => SYMBOL_OTHER,
when others => OTHER_NOT_ASSIGNED)
with Inline;
function Plane_01_Lookup (C: Codepoint) return General_Category_Type is
(case C is
when 16#010000# .. 16#01000B# => LETTER_OTHER,
when 16#01000D# .. 16#010026# => LETTER_OTHER,
when 16#010028# .. 16#01003A# => LETTER_OTHER,
when 16#01003C# .. 16#01003D# => LETTER_OTHER,
when 16#01003F# .. 16#01004D# => LETTER_OTHER,
when 16#010050# .. 16#01005D# => LETTER_OTHER,
when 16#010080# .. 16#0100FA# => LETTER_OTHER,
when 16#010100# .. 16#010102# => PUNCTUATION_OTHER,
when 16#010107# .. 16#010133# => NUMBER_OTHER,
when 16#010137# .. 16#01013F# => SYMBOL_OTHER,
when 16#010140# .. 16#010174# => NUMBER_LETTER,
when 16#010175# .. 16#010178# => NUMBER_OTHER,
when 16#010179# .. 16#010189# => SYMBOL_OTHER,
when 16#01018A# .. 16#01018B# => NUMBER_OTHER,
when 16#01018C# .. 16#01018E# => SYMBOL_OTHER,
when 16#010190# .. 16#01019B# => SYMBOL_OTHER,
when 16#0101A0# => SYMBOL_OTHER,
when 16#0101D0# .. 16#0101FC# => SYMBOL_OTHER,
when 16#0101FD# => MARK_NONSPACING,
when 16#010280# .. 16#01029C# => LETTER_OTHER,
when 16#0102A0# .. 16#0102D0# => LETTER_OTHER,
when 16#0102E0# => MARK_NONSPACING,
when 16#0102E1# .. 16#0102FB# => NUMBER_OTHER,
when 16#010300# .. 16#01031F# => LETTER_OTHER,
when 16#010320# .. 16#010323# => NUMBER_OTHER,
when 16#01032D# .. 16#010340# => LETTER_OTHER,
when 16#010341# => NUMBER_LETTER,
when 16#010342# .. 16#010349# => LETTER_OTHER,
when 16#01034A# => NUMBER_LETTER,
when 16#010350# .. 16#010375# => LETTER_OTHER,
when 16#010376# .. 16#01037A# => MARK_NONSPACING,
when 16#010380# .. 16#01039D# => LETTER_OTHER,
when 16#01039F# => PUNCTUATION_OTHER,
when 16#0103A0# .. 16#0103C3# => LETTER_OTHER,
when 16#0103C8# .. 16#0103CF# => LETTER_OTHER,
when 16#0103D0# => PUNCTUATION_OTHER,
when 16#0103D1# .. 16#0103D5# => NUMBER_LETTER,
when 16#010400# .. 16#010427# => LETTER_UPPERCASE,
when 16#010428# .. 16#01044F# => LETTER_LOWERCASE,
when 16#010450# .. 16#01049D# => LETTER_OTHER,
when 16#0104A0# .. 16#0104A9# => NUMBER_DECIMAL_DIGIT,
when 16#0104B0# .. 16#0104D3# => LETTER_UPPERCASE,
when 16#0104D8# .. 16#0104FB# => LETTER_LOWERCASE,
when 16#010500# .. 16#010527# => LETTER_OTHER,
when 16#010530# .. 16#010563# => LETTER_OTHER,
when 16#01056F# => PUNCTUATION_OTHER,
when 16#010600# .. 16#010736# => LETTER_OTHER,
when 16#010740# .. 16#010755# => LETTER_OTHER,
when 16#010760# .. 16#010767# => LETTER_OTHER,
when 16#010800# .. 16#010805# => LETTER_OTHER,
when 16#010808# => LETTER_OTHER,
when 16#01080A# .. 16#010835# => LETTER_OTHER,
when 16#010837# .. 16#010838# => LETTER_OTHER,
when 16#01083C# => LETTER_OTHER,
when 16#01083F# .. 16#010855# => LETTER_OTHER,
when 16#010857# => PUNCTUATION_OTHER,
when 16#010858# .. 16#01085F# => NUMBER_OTHER,
when 16#010860# .. 16#010876# => LETTER_OTHER,
when 16#010877# .. 16#010878# => SYMBOL_OTHER,
when 16#010879# .. 16#01087F# => NUMBER_OTHER,
when 16#010880# .. 16#01089E# => LETTER_OTHER,
when 16#0108A7# .. 16#0108AF# => NUMBER_OTHER,
when 16#0108E0# .. 16#0108F2# => LETTER_OTHER,
when 16#0108F4# .. 16#0108F5# => LETTER_OTHER,
when 16#0108FB# .. 16#0108FF# => NUMBER_OTHER,
when 16#010900# .. 16#010915# => LETTER_OTHER,
when 16#010916# .. 16#01091B# => NUMBER_OTHER,
when 16#01091F# => PUNCTUATION_OTHER,
when 16#010920# .. 16#010939# => LETTER_OTHER,
when 16#01093F# => PUNCTUATION_OTHER,
when 16#010980# .. 16#0109B7# => LETTER_OTHER,
when 16#0109BC# .. 16#0109BD# => NUMBER_OTHER,
when 16#0109BE# .. 16#0109BF# => LETTER_OTHER,
when 16#0109C0# .. 16#0109CF# => NUMBER_OTHER,
when 16#0109D2# .. 16#0109FF# => NUMBER_OTHER,
when 16#010A00# => LETTER_OTHER,
when 16#010A01# .. 16#010A03# => MARK_NONSPACING,
when 16#010A05# .. 16#010A06# => MARK_NONSPACING,
when 16#010A0C# .. 16#010A0F# => MARK_NONSPACING,
when 16#010A10# .. 16#010A13# => LETTER_OTHER,
when 16#010A15# .. 16#010A17# => LETTER_OTHER,
when 16#010A19# .. 16#010A35# => LETTER_OTHER,
when 16#010A38# .. 16#010A3A# => MARK_NONSPACING,
when 16#010A3F# => MARK_NONSPACING,
when 16#010A40# .. 16#010A48# => NUMBER_OTHER,
when 16#010A50# .. 16#010A58# => PUNCTUATION_OTHER,
when 16#010A60# .. 16#010A7C# => LETTER_OTHER,
when 16#010A7D# .. 16#010A7E# => NUMBER_OTHER,
when 16#010A7F# => PUNCTUATION_OTHER,
when 16#010A80# .. 16#010A9C# => LETTER_OTHER,
when 16#010A9D# .. 16#010A9F# => NUMBER_OTHER,
when 16#010AC0# .. 16#010AC7# => LETTER_OTHER,
when 16#010AC8# => SYMBOL_OTHER,
when 16#010AC9# .. 16#010AE4# => LETTER_OTHER,
when 16#010AE5# .. 16#010AE6# => MARK_NONSPACING,
when 16#010AEB# .. 16#010AEF# => NUMBER_OTHER,
when 16#010AF0# .. 16#010AF6# => PUNCTUATION_OTHER,
when 16#010B00# .. 16#010B35# => LETTER_OTHER,
when 16#010B39# .. 16#010B3F# => PUNCTUATION_OTHER,
when 16#010B40# .. 16#010B55# => LETTER_OTHER,
when 16#010B58# .. 16#010B5F# => NUMBER_OTHER,
when 16#010B60# .. 16#010B72# => LETTER_OTHER,
when 16#010B78# .. 16#010B7F# => NUMBER_OTHER,
when 16#010B80# .. 16#010B91# => LETTER_OTHER,
when 16#010B99# .. 16#010B9C# => PUNCTUATION_OTHER,
when 16#010BA9# .. 16#010BAF# => NUMBER_OTHER,
when 16#010C00# .. 16#010C48# => LETTER_OTHER,
when 16#010C80# .. 16#010CB2# => LETTER_UPPERCASE,
when 16#010CC0# .. 16#010CF2# => LETTER_LOWERCASE,
when 16#010CFA# .. 16#010CFF# => NUMBER_OTHER,
when 16#010D00# .. 16#010D23# => LETTER_OTHER,
when 16#010D24# .. 16#010D27# => MARK_NONSPACING,
when 16#010D30# .. 16#010D39# => NUMBER_DECIMAL_DIGIT,
when 16#010E60# .. 16#010E7E# => NUMBER_OTHER,
when 16#010F00# .. 16#010F1C# => LETTER_OTHER,
when 16#010F1D# .. 16#010F26# => NUMBER_OTHER,
when 16#010F27# => LETTER_OTHER,
when 16#010F30# .. 16#010F45# => LETTER_OTHER,
when 16#010F46# .. 16#010F50# => MARK_NONSPACING,
when 16#010F51# .. 16#010F54# => NUMBER_OTHER,
when 16#010F55# .. 16#010F59# => PUNCTUATION_OTHER,
when 16#010FE0# .. 16#010FF6# => LETTER_OTHER,
when 16#011000# => MARK_SPACING_COMBINING,
when 16#011001# => MARK_NONSPACING,
when 16#011002# => MARK_SPACING_COMBINING,
when 16#011003# .. 16#011037# => LETTER_OTHER,
when 16#011038# .. 16#011046# => MARK_NONSPACING,
when 16#011047# .. 16#01104D# => PUNCTUATION_OTHER,
when 16#011052# .. 16#011065# => NUMBER_OTHER,
when 16#011066# .. 16#01106F# => NUMBER_DECIMAL_DIGIT,
when 16#01107F# .. 16#011081# => MARK_NONSPACING,
when 16#011082# => MARK_SPACING_COMBINING,
when 16#011083# .. 16#0110AF# => LETTER_OTHER,
when 16#0110B0# .. 16#0110B2# => MARK_SPACING_COMBINING,
when 16#0110B3# .. 16#0110B6# => MARK_NONSPACING,
when 16#0110B7# .. 16#0110B8# => MARK_SPACING_COMBINING,
when 16#0110B9# .. 16#0110BA# => MARK_NONSPACING,
when 16#0110BB# .. 16#0110BC# => PUNCTUATION_OTHER,
when 16#0110BD# => OTHER_FORMAT,
when 16#0110BE# .. 16#0110C1# => PUNCTUATION_OTHER,
when 16#0110CD# => OTHER_FORMAT,
when 16#0110D0# .. 16#0110E8# => LETTER_OTHER,
when 16#0110F0# .. 16#0110F9# => NUMBER_DECIMAL_DIGIT,
when 16#011100# .. 16#011102# => MARK_NONSPACING,
when 16#011103# .. 16#011126# => LETTER_OTHER,
when 16#011127# .. 16#01112B# => MARK_NONSPACING,
when 16#01112C# => MARK_SPACING_COMBINING,
when 16#01112D# .. 16#011134# => MARK_NONSPACING,
when 16#011136# .. 16#01113F# => NUMBER_DECIMAL_DIGIT,
when 16#011140# .. 16#011143# => PUNCTUATION_OTHER,
when 16#011144# => LETTER_OTHER,
when 16#011145# .. 16#011146# => MARK_SPACING_COMBINING,
when 16#011150# .. 16#011172# => LETTER_OTHER,
when 16#011173# => MARK_NONSPACING,
when 16#011174# .. 16#011175# => PUNCTUATION_OTHER,
when 16#011176# => LETTER_OTHER,
when 16#011180# .. 16#011181# => MARK_NONSPACING,
when 16#011182# => MARK_SPACING_COMBINING,
when 16#011183# .. 16#0111B2# => LETTER_OTHER,
when 16#0111B3# .. 16#0111B5# => MARK_SPACING_COMBINING,
when 16#0111B6# .. 16#0111BE# => MARK_NONSPACING,
when 16#0111BF# .. 16#0111C0# => MARK_SPACING_COMBINING,
when 16#0111C1# .. 16#0111C4# => LETTER_OTHER,
when 16#0111C5# .. 16#0111C8# => PUNCTUATION_OTHER,
when 16#0111C9# .. 16#0111CC# => MARK_NONSPACING,
when 16#0111CD# => PUNCTUATION_OTHER,
when 16#0111D0# .. 16#0111D9# => NUMBER_DECIMAL_DIGIT,
when 16#0111DA# => LETTER_OTHER,
when 16#0111DB# => PUNCTUATION_OTHER,
when 16#0111DC# => LETTER_OTHER,
when 16#0111DD# .. 16#0111DF# => PUNCTUATION_OTHER,
when 16#0111E1# .. 16#0111F4# => NUMBER_OTHER,
when 16#011200# .. 16#011211# => LETTER_OTHER,
when 16#011213# .. 16#01122B# => LETTER_OTHER,
when 16#01122C# .. 16#01122E# => MARK_SPACING_COMBINING,
when 16#01122F# .. 16#011231# => MARK_NONSPACING,
when 16#011232# .. 16#011233# => MARK_SPACING_COMBINING,
when 16#011234# => MARK_NONSPACING,
when 16#011235# => MARK_SPACING_COMBINING,
when 16#011236# .. 16#011237# => MARK_NONSPACING,
when 16#011238# .. 16#01123D# => PUNCTUATION_OTHER,
when 16#01123E# => MARK_NONSPACING,
when 16#011280# .. 16#011286# => LETTER_OTHER,
when 16#011288# => LETTER_OTHER,
when 16#01128A# .. 16#01128D# => LETTER_OTHER,
when 16#01128F# .. 16#01129D# => LETTER_OTHER,
when 16#01129F# .. 16#0112A8# => LETTER_OTHER,
when 16#0112A9# => PUNCTUATION_OTHER,
when 16#0112B0# .. 16#0112DE# => LETTER_OTHER,
when 16#0112DF# => MARK_NONSPACING,
when 16#0112E0# .. 16#0112E2# => MARK_SPACING_COMBINING,
when 16#0112E3# .. 16#0112EA# => MARK_NONSPACING,
when 16#0112F0# .. 16#0112F9# => NUMBER_DECIMAL_DIGIT,
when 16#011300# .. 16#011301# => MARK_NONSPACING,
when 16#011302# .. 16#011303# => MARK_SPACING_COMBINING,
when 16#011305# .. 16#01130C# => LETTER_OTHER,
when 16#01130F# .. 16#011310# => LETTER_OTHER,
when 16#011313# .. 16#011328# => LETTER_OTHER,
when 16#01132A# .. 16#011330# => LETTER_OTHER,
when 16#011332# .. 16#011333# => LETTER_OTHER,
when 16#011335# .. 16#011339# => LETTER_OTHER,
when 16#01133B# .. 16#01133C# => MARK_NONSPACING,
when 16#01133D# => LETTER_OTHER,
when 16#01133E# .. 16#01133F# => MARK_SPACING_COMBINING,
when 16#011340# => MARK_NONSPACING,
when 16#011341# .. 16#011344# => MARK_SPACING_COMBINING,
when 16#011347# .. 16#011348# => MARK_SPACING_COMBINING,
when 16#01134B# .. 16#01134D# => MARK_SPACING_COMBINING,
when 16#011350# => LETTER_OTHER,
when 16#011357# => MARK_SPACING_COMBINING,
when 16#01135D# .. 16#011361# => LETTER_OTHER,
when 16#011362# .. 16#011363# => MARK_SPACING_COMBINING,
when 16#011366# .. 16#01136C# => MARK_NONSPACING,
when 16#011370# .. 16#011374# => MARK_NONSPACING,
when 16#011400# .. 16#011434# => LETTER_OTHER,
when 16#011435# .. 16#011437# => MARK_SPACING_COMBINING,
when 16#011438# .. 16#01143F# => MARK_NONSPACING,
when 16#011440# .. 16#011441# => MARK_SPACING_COMBINING,
when 16#011442# .. 16#011444# => MARK_NONSPACING,
when 16#011445# => MARK_SPACING_COMBINING,
when 16#011446# => MARK_NONSPACING,
when 16#011447# .. 16#01144A# => LETTER_OTHER,
when 16#01144B# .. 16#01144F# => PUNCTUATION_OTHER,
when 16#011450# .. 16#011459# => NUMBER_DECIMAL_DIGIT,
when 16#01145B# => PUNCTUATION_OTHER,
when 16#01145D# => PUNCTUATION_OTHER,
when 16#01145E# => MARK_NONSPACING,
when 16#01145F# => LETTER_OTHER,
when 16#011480# .. 16#0114AF# => LETTER_OTHER,
when 16#0114B0# .. 16#0114B2# => MARK_SPACING_COMBINING,
when 16#0114B3# .. 16#0114B8# => MARK_NONSPACING,
when 16#0114B9# => MARK_SPACING_COMBINING,
when 16#0114BA# => MARK_NONSPACING,
when 16#0114BB# .. 16#0114BE# => MARK_SPACING_COMBINING,
when 16#0114BF# .. 16#0114C0# => MARK_NONSPACING,
when 16#0114C1# => MARK_SPACING_COMBINING,
when 16#0114C2# .. 16#0114C3# => MARK_NONSPACING,
when 16#0114C4# .. 16#0114C5# => LETTER_OTHER,
when 16#0114C6# => PUNCTUATION_OTHER,
when 16#0114C7# => LETTER_OTHER,
when 16#0114D0# .. 16#0114D9# => NUMBER_DECIMAL_DIGIT,
when 16#011580# .. 16#0115AE# => LETTER_OTHER,
when 16#0115AF# .. 16#0115B1# => MARK_SPACING_COMBINING,
when 16#0115B2# .. 16#0115B5# => MARK_NONSPACING,
when 16#0115B8# .. 16#0115BB# => MARK_SPACING_COMBINING,
when 16#0115BC# .. 16#0115BD# => MARK_NONSPACING,
when 16#0115BE# => MARK_SPACING_COMBINING,
when 16#0115BF# .. 16#0115C0# => MARK_NONSPACING,
when 16#0115C1# .. 16#0115D7# => PUNCTUATION_OTHER,
when 16#0115D8# .. 16#0115DB# => LETTER_OTHER,
when 16#0115DC# .. 16#0115DD# => MARK_NONSPACING,
when 16#011600# .. 16#01162F# => LETTER_OTHER,
when 16#011630# .. 16#011632# => MARK_SPACING_COMBINING,
when 16#011633# .. 16#01163A# => MARK_NONSPACING,
when 16#01163B# .. 16#01163C# => MARK_SPACING_COMBINING,
when 16#01163D# => MARK_NONSPACING,
when 16#01163E# => MARK_SPACING_COMBINING,
when 16#01163F# .. 16#011640# => MARK_NONSPACING,
when 16#011641# .. 16#011643# => PUNCTUATION_OTHER,
when 16#011644# => LETTER_OTHER,
when 16#011650# .. 16#011659# => NUMBER_DECIMAL_DIGIT,
when 16#011660# .. 16#01166C# => PUNCTUATION_OTHER,
when 16#011680# .. 16#0116AA# => LETTER_OTHER,
when 16#0116AB# => MARK_NONSPACING,
when 16#0116AC# => MARK_SPACING_COMBINING,
when 16#0116AD# => MARK_NONSPACING,
when 16#0116AE# .. 16#0116AF# => MARK_SPACING_COMBINING,
when 16#0116B0# .. 16#0116B5# => MARK_NONSPACING,
when 16#0116B6# => MARK_SPACING_COMBINING,
when 16#0116B7# => MARK_NONSPACING,
when 16#0116B8# => LETTER_OTHER,
when 16#0116C0# .. 16#0116C9# => NUMBER_DECIMAL_DIGIT,
when 16#011700# .. 16#01171A# => LETTER_OTHER,
when 16#01171D# .. 16#01171F# => MARK_NONSPACING,
when 16#011720# .. 16#011721# => MARK_SPACING_COMBINING,
when 16#011722# .. 16#011725# => MARK_NONSPACING,
when 16#011726# => MARK_SPACING_COMBINING,
when 16#011727# .. 16#01172B# => MARK_NONSPACING,
when 16#011730# .. 16#011739# => NUMBER_DECIMAL_DIGIT,
when 16#01173A# .. 16#01173B# => NUMBER_OTHER,
when 16#01173C# .. 16#01173E# => PUNCTUATION_OTHER,
when 16#01173F# => SYMBOL_OTHER,
when 16#011800# .. 16#01182B# => LETTER_OTHER,
when 16#01182C# .. 16#01182E# => MARK_SPACING_COMBINING,
when 16#01182F# .. 16#011837# => MARK_NONSPACING,
when 16#011838# => MARK_SPACING_COMBINING,
when 16#011839# .. 16#01183A# => MARK_NONSPACING,
when 16#01183B# => PUNCTUATION_OTHER,
when 16#0118A0# .. 16#0118BF# => LETTER_UPPERCASE,
when 16#0118C0# .. 16#0118DF# => LETTER_LOWERCASE,
when 16#0118E0# .. 16#0118E9# => NUMBER_DECIMAL_DIGIT,
when 16#0118EA# .. 16#0118F2# => NUMBER_OTHER,
when 16#0118FF# => LETTER_OTHER,
when 16#0119A0# .. 16#0119A7# => LETTER_OTHER,
when 16#0119AA# .. 16#0119D0# => LETTER_OTHER,
when 16#0119D1# .. 16#0119D3# => MARK_SPACING_COMBINING,
when 16#0119D4# .. 16#0119D7# => MARK_NONSPACING,
when 16#0119DA# .. 16#0119DB# => MARK_NONSPACING,
when 16#0119DC# .. 16#0119DF# => MARK_SPACING_COMBINING,
when 16#0119E0# => MARK_NONSPACING,
when 16#0119E1# => LETTER_OTHER,
when 16#0119E2# => PUNCTUATION_OTHER,
when 16#0119E3# => LETTER_OTHER,
when 16#0119E4# => MARK_SPACING_COMBINING,
when 16#011A00# => LETTER_OTHER,
when 16#011A01# .. 16#011A0A# => MARK_NONSPACING,
when 16#011A0B# .. 16#011A32# => LETTER_OTHER,
when 16#011A33# .. 16#011A38# => MARK_NONSPACING,
when 16#011A39# => MARK_SPACING_COMBINING,
when 16#011A3A# => LETTER_OTHER,
when 16#011A3B# .. 16#011A3E# => MARK_NONSPACING,
when 16#011A3F# .. 16#011A46# => PUNCTUATION_OTHER,
when 16#011A47# => MARK_NONSPACING,
when 16#011A50# => LETTER_OTHER,
when 16#011A51# .. 16#011A56# => MARK_NONSPACING,
when 16#011A57# .. 16#011A58# => MARK_SPACING_COMBINING,
when 16#011A59# .. 16#011A5B# => MARK_NONSPACING,
when 16#011A5C# .. 16#011A89# => LETTER_OTHER,
when 16#011A8A# .. 16#011A96# => MARK_NONSPACING,
when 16#011A97# => MARK_SPACING_COMBINING,
when 16#011A98# .. 16#011A99# => MARK_NONSPACING,
when 16#011A9A# .. 16#011A9C# => PUNCTUATION_OTHER,
when 16#011A9D# => LETTER_OTHER,
when 16#011A9E# .. 16#011AA2# => PUNCTUATION_OTHER,
when 16#011AC0# .. 16#011AF8# => LETTER_OTHER,
when 16#011C00# .. 16#011C08# => LETTER_OTHER,
when 16#011C0A# .. 16#011C2E# => LETTER_OTHER,
when 16#011C2F# => MARK_SPACING_COMBINING,
when 16#011C30# .. 16#011C36# => MARK_NONSPACING,
when 16#011C38# .. 16#011C3D# => MARK_NONSPACING,
when 16#011C3E# => MARK_SPACING_COMBINING,
when 16#011C3F# => MARK_NONSPACING,
when 16#011C40# => LETTER_OTHER,
when 16#011C41# .. 16#011C45# => PUNCTUATION_OTHER,
when 16#011C50# .. 16#011C59# => NUMBER_DECIMAL_DIGIT,
when 16#011C5A# .. 16#011C6C# => NUMBER_OTHER,
when 16#011C70# .. 16#011C71# => PUNCTUATION_OTHER,
when 16#011C72# .. 16#011C8F# => LETTER_OTHER,
when 16#011C92# .. 16#011CA7# => MARK_NONSPACING,
when 16#011CA9# => MARK_SPACING_COMBINING,
when 16#011CAA# .. 16#011CB0# => MARK_NONSPACING,
when 16#011CB1# => MARK_SPACING_COMBINING,
when 16#011CB2# .. 16#011CB3# => MARK_NONSPACING,
when 16#011CB4# => MARK_SPACING_COMBINING,
when 16#011CB5# .. 16#011CB6# => MARK_NONSPACING,
when 16#011D00# .. 16#011D06# => LETTER_OTHER,
when 16#011D08# .. 16#011D09# => LETTER_OTHER,
when 16#011D0B# .. 16#011D30# => LETTER_OTHER,
when 16#011D31# .. 16#011D36# => MARK_NONSPACING,
when 16#011D3A# => MARK_NONSPACING,
when 16#011D3C# .. 16#011D3D# => MARK_NONSPACING,
when 16#011D3F# .. 16#011D45# => MARK_NONSPACING,
when 16#011D46# => LETTER_OTHER,
when 16#011D47# => MARK_NONSPACING,
when 16#011D50# .. 16#011D59# => NUMBER_DECIMAL_DIGIT,
when 16#011D60# .. 16#011D65# => LETTER_OTHER,
when 16#011D67# .. 16#011D68# => LETTER_OTHER,
when 16#011D6A# .. 16#011D89# => LETTER_OTHER,
when 16#011D8A# .. 16#011D8E# => MARK_SPACING_COMBINING,
when 16#011D90# .. 16#011D91# => MARK_NONSPACING,
when 16#011D93# .. 16#011D94# => MARK_SPACING_COMBINING,
when 16#011D95# => MARK_NONSPACING,
when 16#011D96# => MARK_SPACING_COMBINING,
when 16#011D97# => MARK_NONSPACING,
when 16#011D98# => LETTER_OTHER,
when 16#011DA0# .. 16#011DA9# => NUMBER_DECIMAL_DIGIT,
when 16#011EE0# .. 16#011EF2# => LETTER_OTHER,
when 16#011EF3# .. 16#011EF4# => MARK_NONSPACING,
when 16#011EF5# .. 16#011EF6# => MARK_SPACING_COMBINING,
when 16#011EF7# .. 16#011EF8# => PUNCTUATION_OTHER,
when 16#011FC0# .. 16#011FD4# => NUMBER_OTHER,
when 16#011FD5# .. 16#011FDC# => SYMBOL_OTHER,
when 16#011FDD# .. 16#011FE0# => SYMBOL_CURRENCY,
when 16#011FE1# .. 16#011FF1# => SYMBOL_OTHER,
when 16#011FFF# => PUNCTUATION_OTHER,
when 16#012000# .. 16#012399# => LETTER_OTHER,
when 16#012400# .. 16#01246E# => NUMBER_LETTER,
when 16#012470# .. 16#012474# => PUNCTUATION_OTHER,
when 16#012480# .. 16#012543# => LETTER_OTHER,
when 16#013000# .. 16#01342E# => LETTER_OTHER,
when 16#013430# .. 16#013438# => OTHER_FORMAT,
when 16#014400# .. 16#014646# => LETTER_OTHER,
when 16#016800# .. 16#016A38# => LETTER_OTHER,
when 16#016A40# .. 16#016A5E# => LETTER_OTHER,
when 16#016A60# .. 16#016A69# => NUMBER_DECIMAL_DIGIT,
when 16#016A6E# .. 16#016A6F# => PUNCTUATION_OTHER,
when 16#016AD0# .. 16#016AED# => LETTER_OTHER,
when 16#016AF0# .. 16#016AF4# => MARK_NONSPACING,
when 16#016AF5# => PUNCTUATION_OTHER,
when 16#016B00# .. 16#016B2F# => LETTER_OTHER,
when 16#016B30# .. 16#016B36# => MARK_NONSPACING,
when 16#016B37# .. 16#016B3B# => PUNCTUATION_OTHER,
when 16#016B3C# .. 16#016B3F# => SYMBOL_OTHER,
when 16#016B40# .. 16#016B43# => LETTER_MODIFIER,
when 16#016B44# => PUNCTUATION_OTHER,
when 16#016B45# => SYMBOL_OTHER,
when 16#016B50# .. 16#016B59# => NUMBER_DECIMAL_DIGIT,
when 16#016B5B# .. 16#016B61# => NUMBER_OTHER,
when 16#016B63# .. 16#016B77# => LETTER_OTHER,
when 16#016B7D# .. 16#016B8F# => LETTER_OTHER,
when 16#016E40# .. 16#016E5F# => LETTER_UPPERCASE,
when 16#016E60# .. 16#016E7F# => LETTER_LOWERCASE,
when 16#016E80# .. 16#016E96# => NUMBER_OTHER,
when 16#016E97# .. 16#016E9A# => PUNCTUATION_OTHER,
when 16#016F00# .. 16#016F4A# => LETTER_OTHER,
when 16#016F4F# => MARK_NONSPACING,
when 16#016F50# => LETTER_OTHER,
when 16#016F51# .. 16#016F87# => MARK_SPACING_COMBINING,
when 16#016F8F# .. 16#016F92# => MARK_NONSPACING,
when 16#016F93# .. 16#016F9F# => LETTER_MODIFIER,
when 16#016FE0# .. 16#016FE1# => LETTER_MODIFIER,
when 16#016FE2# => PUNCTUATION_OTHER,
when 16#016FE3# => LETTER_MODIFIER,
when 16#017000# .. 16#0187F7# => LETTER_OTHER,
when 16#018800# .. 16#018AF2# => LETTER_OTHER,
when 16#01B000# .. 16#01B11E# => LETTER_OTHER,
when 16#01B150# .. 16#01B152# => LETTER_OTHER,
when 16#01B164# .. 16#01B167# => LETTER_OTHER,
when 16#01B170# .. 16#01B2FB# => LETTER_OTHER,
when 16#01BC00# .. 16#01BC6A# => LETTER_OTHER,
when 16#01BC70# .. 16#01BC7C# => LETTER_OTHER,
when 16#01BC80# .. 16#01BC88# => LETTER_OTHER,
when 16#01BC90# .. 16#01BC99# => LETTER_OTHER,
when 16#01BC9C# => SYMBOL_OTHER,
when 16#01BC9D# .. 16#01BC9E# => MARK_NONSPACING,
when 16#01BC9F# => PUNCTUATION_OTHER,
when 16#01BCA0# .. 16#01BCA3# => OTHER_FORMAT,
when 16#01D000# .. 16#01D0F5# => SYMBOL_OTHER,
when 16#01D100# .. 16#01D126# => SYMBOL_OTHER,
when 16#01D129# .. 16#01D164# => SYMBOL_OTHER,
when 16#01D165# .. 16#01D166# => MARK_SPACING_COMBINING,
when 16#01D167# .. 16#01D169# => MARK_NONSPACING,
when 16#01D16A# .. 16#01D16C# => SYMBOL_OTHER,
when 16#01D16D# .. 16#01D172# => MARK_SPACING_COMBINING,
when 16#01D173# .. 16#01D17A# => OTHER_FORMAT,
when 16#01D17B# .. 16#01D182# => MARK_NONSPACING,
when 16#01D183# .. 16#01D184# => SYMBOL_OTHER,
when 16#01D185# .. 16#01D18B# => MARK_NONSPACING,
when 16#01D18C# .. 16#01D1A9# => SYMBOL_OTHER,
when 16#01D1AA# .. 16#01D1AD# => MARK_NONSPACING,
when 16#01D1AE# .. 16#01D1E8# => SYMBOL_OTHER,
when 16#01D200# .. 16#01D241# => SYMBOL_OTHER,
when 16#01D242# .. 16#01D244# => MARK_NONSPACING,
when 16#01D245# => SYMBOL_OTHER,
when 16#01D2E0# .. 16#01D2F3# => NUMBER_OTHER,
when 16#01D300# .. 16#01D356# => SYMBOL_OTHER,
when 16#01D360# .. 16#01D378# => NUMBER_OTHER,
when 16#01D400# .. 16#01D419# => LETTER_UPPERCASE,
when 16#01D41A# .. 16#01D433# => LETTER_LOWERCASE,
when 16#01D434# .. 16#01D44D# => LETTER_UPPERCASE,
when 16#01D44E# .. 16#01D454# => LETTER_LOWERCASE,
when 16#01D456# .. 16#01D467# => LETTER_LOWERCASE,
when 16#01D468# .. 16#01D481# => LETTER_UPPERCASE,
when 16#01D482# .. 16#01D49B# => LETTER_LOWERCASE,
when 16#01D49C# => LETTER_UPPERCASE,
when 16#01D49E# .. 16#01D49F# => LETTER_UPPERCASE,
when 16#01D4A2# => LETTER_UPPERCASE,
when 16#01D4A5# .. 16#01D4A6# => LETTER_UPPERCASE,
when 16#01D4A9# .. 16#01D4AC# => LETTER_UPPERCASE,
when 16#01D4AE# .. 16#01D4B5# => LETTER_UPPERCASE,
when 16#01D4B6# .. 16#01D4B9# => LETTER_LOWERCASE,
when 16#01D4BB# => LETTER_LOWERCASE,
when 16#01D4BD# .. 16#01D4C3# => LETTER_LOWERCASE,
when 16#01D4C5# .. 16#01D4CF# => LETTER_LOWERCASE,
when 16#01D4D0# .. 16#01D4E9# => LETTER_UPPERCASE,
when 16#01D4EA# .. 16#01D503# => LETTER_LOWERCASE,
when 16#01D504# .. 16#01D505# => LETTER_UPPERCASE,
when 16#01D507# .. 16#01D50A# => LETTER_UPPERCASE,
when 16#01D50D# .. 16#01D514# => LETTER_UPPERCASE,
when 16#01D516# .. 16#01D51C# => LETTER_UPPERCASE,
when 16#01D51E# .. 16#01D537# => LETTER_LOWERCASE,
when 16#01D538# .. 16#01D539# => LETTER_UPPERCASE,
when 16#01D53B# .. 16#01D53E# => LETTER_UPPERCASE,
when 16#01D540# .. 16#01D544# => LETTER_UPPERCASE,
when 16#01D546# => LETTER_UPPERCASE,
when 16#01D54A# .. 16#01D550# => LETTER_UPPERCASE,
when 16#01D552# .. 16#01D56B# => LETTER_LOWERCASE,
when 16#01D56C# .. 16#01D585# => LETTER_UPPERCASE,
when 16#01D586# .. 16#01D59F# => LETTER_LOWERCASE,
when 16#01D5A0# .. 16#01D5B9# => LETTER_UPPERCASE,
when 16#01D5BA# .. 16#01D5D3# => LETTER_LOWERCASE,
when 16#01D5D4# .. 16#01D5ED# => LETTER_UPPERCASE,
when 16#01D5EE# .. 16#01D607# => LETTER_LOWERCASE,
when 16#01D608# .. 16#01D621# => LETTER_UPPERCASE,
when 16#01D622# .. 16#01D63B# => LETTER_LOWERCASE,
when 16#01D63C# .. 16#01D655# => LETTER_UPPERCASE,
when 16#01D656# .. 16#01D66F# => LETTER_LOWERCASE,
when 16#01D670# .. 16#01D689# => LETTER_UPPERCASE,
when 16#01D68A# .. 16#01D6A5# => LETTER_LOWERCASE,
when 16#01D6A8# .. 16#01D6C0# => LETTER_UPPERCASE,
when 16#01D6C1# => SYMBOL_MATH,
when 16#01D6C2# .. 16#01D6DA# => LETTER_LOWERCASE,
when 16#01D6DB# => SYMBOL_MATH,
when 16#01D6DC# .. 16#01D6E1# => LETTER_LOWERCASE,
when 16#01D6E2# .. 16#01D6FA# => LETTER_UPPERCASE,
when 16#01D6FB# => SYMBOL_MATH,
when 16#01D6FC# .. 16#01D714# => LETTER_LOWERCASE,
when 16#01D715# => SYMBOL_MATH,
when 16#01D716# .. 16#01D71B# => LETTER_LOWERCASE,
when 16#01D71C# .. 16#01D734# => LETTER_UPPERCASE,
when 16#01D735# => SYMBOL_MATH,
when 16#01D736# .. 16#01D74E# => LETTER_LOWERCASE,
when 16#01D74F# => SYMBOL_MATH,
when 16#01D750# .. 16#01D755# => LETTER_LOWERCASE,
when 16#01D756# .. 16#01D76E# => LETTER_UPPERCASE,
when 16#01D76F# => SYMBOL_MATH,
when 16#01D770# .. 16#01D788# => LETTER_LOWERCASE,
when 16#01D789# => SYMBOL_MATH,
when 16#01D78A# .. 16#01D78F# => LETTER_LOWERCASE,
when 16#01D790# .. 16#01D7A8# => LETTER_UPPERCASE,
when 16#01D7A9# => SYMBOL_MATH,
when 16#01D7AA# .. 16#01D7C2# => LETTER_LOWERCASE,
when 16#01D7C3# => SYMBOL_MATH,
when 16#01D7C4# .. 16#01D7C9# => LETTER_LOWERCASE,
when 16#01D7CA# => LETTER_UPPERCASE,
when 16#01D7CB# => LETTER_LOWERCASE,
when 16#01D7CE# .. 16#01D7FF# => NUMBER_DECIMAL_DIGIT,
when 16#01D800# .. 16#01D9FF# => SYMBOL_OTHER,
when 16#01DA00# .. 16#01DA36# => MARK_NONSPACING,
when 16#01DA37# .. 16#01DA3A# => SYMBOL_OTHER,
when 16#01DA3B# .. 16#01DA6C# => MARK_NONSPACING,
when 16#01DA6D# .. 16#01DA74# => SYMBOL_OTHER,
when 16#01DA75# => MARK_NONSPACING,
when 16#01DA76# .. 16#01DA83# => SYMBOL_OTHER,
when 16#01DA84# => MARK_NONSPACING,
when 16#01DA85# .. 16#01DA86# => SYMBOL_OTHER,
when 16#01DA87# .. 16#01DA8B# => PUNCTUATION_OTHER,
when 16#01DA9B# .. 16#01DA9F# => MARK_NONSPACING,
when 16#01DAA1# .. 16#01DAAF# => MARK_NONSPACING,
when 16#01E000# .. 16#01E006# => MARK_NONSPACING,
when 16#01E008# .. 16#01E018# => MARK_NONSPACING,
when 16#01E01B# .. 16#01E021# => MARK_NONSPACING,
when 16#01E023# .. 16#01E024# => MARK_NONSPACING,
when 16#01E026# .. 16#01E02A# => MARK_NONSPACING,
when 16#01E100# .. 16#01E12C# => LETTER_OTHER,
when 16#01E130# .. 16#01E136# => MARK_NONSPACING,
when 16#01E137# .. 16#01E13D# => LETTER_MODIFIER,
when 16#01E140# .. 16#01E149# => NUMBER_DECIMAL_DIGIT,
when 16#01E14E# => LETTER_OTHER,
when 16#01E14F# => SYMBOL_OTHER,
when 16#01E2C0# .. 16#01E2EB# => LETTER_OTHER,
when 16#01E2EC# .. 16#01E2EF# => MARK_NONSPACING,
when 16#01E2F0# .. 16#01E2F9# => NUMBER_DECIMAL_DIGIT,
when 16#01E2FF# => SYMBOL_CURRENCY,
when 16#01E800# .. 16#01E8C4# => LETTER_OTHER,
when 16#01E8C7# .. 16#01E8CF# => NUMBER_OTHER,
when 16#01E8D0# .. 16#01E8D6# => MARK_NONSPACING,
when 16#01E900# .. 16#01E921# => LETTER_UPPERCASE,
when 16#01E922# .. 16#01E943# => LETTER_LOWERCASE,
when 16#01E944# .. 16#01E94A# => MARK_NONSPACING,
when 16#01E94B# => LETTER_MODIFIER,
when 16#01E950# .. 16#01E959# => NUMBER_DECIMAL_DIGIT,
when 16#01E95E# .. 16#01E95F# => PUNCTUATION_OTHER,
when 16#01EC71# .. 16#01ECAB# => NUMBER_OTHER,
when 16#01ECAC# => SYMBOL_OTHER,
when 16#01ECAD# .. 16#01ECAF# => NUMBER_OTHER,
when 16#01ECB0# => SYMBOL_CURRENCY,
when 16#01ECB1# .. 16#01ECB4# => NUMBER_OTHER,
when 16#01ED01# .. 16#01ED2D# => NUMBER_OTHER,
when 16#01ED2E# => SYMBOL_OTHER,
when 16#01ED2F# .. 16#01ED3D# => NUMBER_OTHER,
when 16#01EE00# .. 16#01EE03# => LETTER_OTHER,
when 16#01EE05# .. 16#01EE1F# => LETTER_OTHER,
when 16#01EE21# .. 16#01EE22# => LETTER_OTHER,
when 16#01EE24# => LETTER_OTHER,
when 16#01EE27# => LETTER_OTHER,
when 16#01EE29# .. 16#01EE32# => LETTER_OTHER,
when 16#01EE34# .. 16#01EE37# => LETTER_OTHER,
when 16#01EE39# => LETTER_OTHER,
when 16#01EE3B# => LETTER_OTHER,
when 16#01EE42# => LETTER_OTHER,
when 16#01EE47# => LETTER_OTHER,
when 16#01EE49# => LETTER_OTHER,
when 16#01EE4B# => LETTER_OTHER,
when 16#01EE4D# .. 16#01EE4F# => LETTER_OTHER,
when 16#01EE51# .. 16#01EE52# => LETTER_OTHER,
when 16#01EE54# => LETTER_OTHER,
when 16#01EE57# => LETTER_OTHER,
when 16#01EE59# => LETTER_OTHER,
when 16#01EE5B# => LETTER_OTHER,
when 16#01EE5D# => LETTER_OTHER,
when 16#01EE5F# => LETTER_OTHER,
when 16#01EE61# .. 16#01EE62# => LETTER_OTHER,
when 16#01EE64# => LETTER_OTHER,
when 16#01EE67# .. 16#01EE6A# => LETTER_OTHER,
when 16#01EE6C# .. 16#01EE72# => LETTER_OTHER,
when 16#01EE74# .. 16#01EE77# => LETTER_OTHER,
when 16#01EE79# .. 16#01EE7C# => LETTER_OTHER,
when 16#01EE7E# => LETTER_OTHER,
when 16#01EE80# .. 16#01EE89# => LETTER_OTHER,
when 16#01EE8B# .. 16#01EE9B# => LETTER_OTHER,
when 16#01EEA1# .. 16#01EEA3# => LETTER_OTHER,
when 16#01EEA5# .. 16#01EEA9# => LETTER_OTHER,
when 16#01EEAB# .. 16#01EEBB# => LETTER_OTHER,
when 16#01EEF0# .. 16#01EEF1# => SYMBOL_MATH,
when 16#01F000# .. 16#01F02B# => SYMBOL_OTHER,
when 16#01F030# .. 16#01F093# => SYMBOL_OTHER,
when 16#01F0A0# .. 16#01F0AE# => SYMBOL_OTHER,
when 16#01F0B1# .. 16#01F0BF# => SYMBOL_OTHER,
when 16#01F0C1# .. 16#01F0CF# => SYMBOL_OTHER,
when 16#01F0D1# .. 16#01F0F5# => SYMBOL_OTHER,
when 16#01F100# .. 16#01F10C# => NUMBER_OTHER,
when 16#01F110# .. 16#01F16C# => SYMBOL_OTHER,
when 16#01F170# .. 16#01F1AC# => SYMBOL_OTHER,
when 16#01F1E6# .. 16#01F202# => SYMBOL_OTHER,
when 16#01F210# .. 16#01F23B# => SYMBOL_OTHER,
when 16#01F240# .. 16#01F248# => SYMBOL_OTHER,
when 16#01F250# .. 16#01F251# => SYMBOL_OTHER,
when 16#01F260# .. 16#01F265# => SYMBOL_OTHER,
when 16#01F300# .. 16#01F3FA# => SYMBOL_OTHER,
when 16#01F3FB# .. 16#01F3FF# => SYMBOL_MODIFIER,
when 16#01F400# .. 16#01F6D5# => SYMBOL_OTHER,
when 16#01F6E0# .. 16#01F6EC# => SYMBOL_OTHER,
when 16#01F6F0# .. 16#01F6FA# => SYMBOL_OTHER,
when 16#01F700# .. 16#01F773# => SYMBOL_OTHER,
when 16#01F780# .. 16#01F7D8# => SYMBOL_OTHER,
when 16#01F7E0# .. 16#01F7EB# => SYMBOL_OTHER,
when 16#01F800# .. 16#01F80B# => SYMBOL_OTHER,
when 16#01F810# .. 16#01F847# => SYMBOL_OTHER,
when 16#01F850# .. 16#01F859# => SYMBOL_OTHER,
when 16#01F860# .. 16#01F887# => SYMBOL_OTHER,
when 16#01F890# .. 16#01F8AD# => SYMBOL_OTHER,
when 16#01F900# .. 16#01F90B# => SYMBOL_OTHER,
when 16#01F90D# .. 16#01F971# => SYMBOL_OTHER,
when 16#01F973# .. 16#01F976# => SYMBOL_OTHER,
when 16#01F97A# .. 16#01F9A2# => SYMBOL_OTHER,
when 16#01F9A5# .. 16#01F9AA# => SYMBOL_OTHER,
when 16#01F9AE# .. 16#01F9CA# => SYMBOL_OTHER,
when 16#01F9CD# .. 16#01FA53# => SYMBOL_OTHER,
when 16#01FA60# .. 16#01FA6D# => SYMBOL_OTHER,
when 16#01FA70# .. 16#01FA73# => SYMBOL_OTHER,
when 16#01FA78# .. 16#01FA7A# => SYMBOL_OTHER,
when 16#01FA80# .. 16#01FA82# => SYMBOL_OTHER,
when 16#01FA90# .. 16#01FA95# => SYMBOL_OTHER,
when others => OTHER_NOT_ASSIGNED)
with Inline;
function Plane_02_Lookup (C: Codepoint) return General_Category_Type is
(case C is
when 16#020000# .. 16#02A6D6# => LETTER_OTHER,
when 16#02A700# .. 16#02B734# => LETTER_OTHER,
when 16#02B740# .. 16#02B81D# => LETTER_OTHER,
when 16#02B820# .. 16#02CEA1# => LETTER_OTHER,
when 16#02CEB0# .. 16#02EBE0# => LETTER_OTHER,
when 16#02F800# .. 16#02FA1D# => LETTER_OTHER,
when others => OTHER_NOT_ASSIGNED)
with Inline;
function Plane_03_Lookup (C: Codepoint) return General_Category_Type is
(OTHER_NOT_ASSIGNED) with Inline;
function Plane_04_Lookup (C: Codepoint) return General_Category_Type is
(OTHER_NOT_ASSIGNED) with Inline;
function Plane_05_Lookup (C: Codepoint) return General_Category_Type is
(OTHER_NOT_ASSIGNED) with Inline;
function Plane_06_Lookup (C: Codepoint) return General_Category_Type is
(OTHER_NOT_ASSIGNED) with Inline;
function Plane_07_Lookup (C: Codepoint) return General_Category_Type is
(OTHER_NOT_ASSIGNED) with Inline;
function Plane_08_Lookup (C: Codepoint) return General_Category_Type is
(OTHER_NOT_ASSIGNED) with Inline;
function Plane_09_Lookup (C: Codepoint) return General_Category_Type is
(OTHER_NOT_ASSIGNED) with Inline;
function Plane_0A_Lookup (C: Codepoint) return General_Category_Type is
(OTHER_NOT_ASSIGNED) with Inline;
function Plane_0B_Lookup (C: Codepoint) return General_Category_Type is
(OTHER_NOT_ASSIGNED) with Inline;
function Plane_0C_Lookup (C: Codepoint) return General_Category_Type is
(OTHER_NOT_ASSIGNED) with Inline;
function Plane_0D_Lookup (C: Codepoint) return General_Category_Type is
(OTHER_NOT_ASSIGNED) with Inline;
function Plane_0E_Lookup (C: Codepoint) return General_Category_Type is
(case C is
when 16#0E0001# => OTHER_FORMAT,
when 16#0E0020# .. 16#0E007F# => OTHER_FORMAT,
when 16#0E0100# .. 16#0E01EF# => MARK_NONSPACING,
when others => OTHER_NOT_ASSIGNED)
with Inline;
function Plane_0F_Lookup (C: Codepoint) return General_Category_Type is
(case C is
when 16#0F0000# .. 16#0FFFFD# => OTHER_PRIVATE_USE,
when others => OTHER_NOT_ASSIGNED)
with Inline;
function Plane_10_Lookup (C: Codepoint) return General_Category_Type is
(case C is
when 16#100000# .. 16#10FFFD# => OTHER_PRIVATE_USE,
when others => OTHER_NOT_ASSIGNED)
with Inline;
----------------------
-- General_Category --
----------------------
function General_Category (C: Wide_Wide_Character)
return General_Category_Type
is
CP: constant Codepoint := Codepoint (Wide_Wide_Character'Pos(C));
begin
return
(case CP is
when 16#000000# .. 16#00FFFF# => Plane_00_Lookup (CP),
when 16#010000# .. 16#01FFFF# => Plane_01_Lookup (CP),
when 16#020000# .. 16#02FFFF# => Plane_02_Lookup (CP),
when 16#030000# .. 16#03FFFF# => Plane_03_Lookup (CP),
when 16#040000# .. 16#04FFFF# => Plane_04_Lookup (CP),
when 16#050000# .. 16#05FFFF# => Plane_05_Lookup (CP),
when 16#060000# .. 16#06FFFF# => Plane_06_Lookup (CP),
when 16#070000# .. 16#07FFFF# => Plane_07_Lookup (CP),
when 16#080000# .. 16#08FFFF# => Plane_08_Lookup (CP),
when 16#090000# .. 16#09FFFF# => Plane_09_Lookup (CP),
when 16#0A0000# .. 16#0AFFFF# => Plane_0A_Lookup (CP),
when 16#0B0000# .. 16#0BFFFF# => Plane_0B_Lookup (CP),
when 16#0C0000# .. 16#0CFFFF# => Plane_0C_Lookup (CP),
when 16#0D0000# .. 16#0DFFFF# => Plane_0D_Lookup (CP),
when 16#0E0000# .. 16#0EFFFF# => Plane_0E_Lookup (CP),
when 16#0F0000# .. 16#0FFFFF# => Plane_0F_Lookup (CP),
when 16#100000# .. 16#10FFFF# => Plane_10_Lookup (CP),
when others => OTHER_NOT_ASSIGNED);
end General_Category;
end Unicode.General_Category;
|
with Dds.Topic;
with DDS.Entity_Params;
package DDS.Request_Reply.Replier is
type Ref is limited interface;
type Ref_Access is access all Ref;
function Create_Writer_Topic
(Self : not null access Ref;
Params : DDS.Entity_Params.EntityParams;
Name : DDS.String) return DDS.Topic.Ref_Access is abstract;
function Create_Reader_Topic
(Self : not null access Ref;
Params : DDS.Entity_Params.EntityParams;
Name : DDS.String) return DDS.Topic.Ref_Access is abstract;
procedure Wait_For_Requests
(Self : not null access Ref;
Min_Count : DDS.Integer;
Max_Wait : DDS.Duration_T) is abstract;
end DDS.Request_Reply.Replier;
|
with System;
with TLSF.Block.Types;
package TLSF.Context with SPARK_Mode, Pure, Preelaborate is
package BT renames TLSF.Block.Types;
type Memory_Context is
record
Base : System.Address;
Region : BT.Address_Space;
end record;
type Context is
record
Memory : Memory_Context;
end record;
end TLSF.Context;
|
------------------------------------------------------------------------------
-- --
-- Ada User Repository Annex (AURA) --
-- Reference Implementation --
-- --
-- ------------------------------------------------------------------------ --
-- --
-- Copyright (C) 2020, ANNEXI-STRAYLINE Trans-Human Ltd. --
-- All rights reserved. --
-- --
-- Original Contributors: --
-- * Richard Wai (ANNEXI-STRAYLINE) --
-- --
-- Redistribution and use in source and binary forms, with or without --
-- modification, are permitted provided that the following conditions are --
-- met: --
-- --
-- * Redistributions of source code must retain the above copyright --
-- notice, this list of conditions and the following disclaimer. --
-- --
-- * Redistributions in binary form must reproduce the above copyright --
-- notice, this list of conditions and the following disclaimer in --
-- the documentation and/or other materials provided with the --
-- distribution. --
-- --
-- * Neither the name of the copyright holder nor the names of its --
-- contributors may be used to endorse or promote products derived --
-- from this software without specific prior written permission. --
-- --
-- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS --
-- "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT --
-- LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A --
-- PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT --
-- OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, --
-- SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT --
-- LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, --
-- DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY --
-- THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT --
-- (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE --
-- OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. --
-- --
------------------------------------------------------------------------------
with Ada.Text_IO;
with Platform_Info;
with Registrar.Registration;
separate (Repositories)
procedure Generate_AURA_Spec is
package TIO renames Ada.Text_IO;
package FIO is new TIO.Enumeration_IO (Repository_Format);
Spec: TIO.File_Type;
procedure Put (Item: in String) with Inline is
begin
TIO.Put (File => Spec, Item => Item);
end;
procedure Put (Item: in Repository_Format) with Inline is
begin
FIO.Put (File => Spec,
Item => Item,
Set => TIO.Lower_Case);
end;
procedure Put_Line (Item: in String) with Inline is
begin
TIO.Put_Line (File => Spec, Item => Item);
end;
procedure New_Line (File : in TIO.File_Type := Spec;
Spacing: in TIO.Positive_Count := 1)
renames TIO.New_Line;
-- We cannot use TIO.Set_Output since this is a very multi-tasking program,
-- and the CLI driver will inject random stuff into the spec if we try.
-- I know because I tried.
Tab: constant String := (1 .. 4 => ' ');
begin
TIO.Create (File => Spec,
Name => "aura.ads");
Put_Line
("-- This specification was automatically generated by the AURA CLI");
Put_Line
("-- DO NOT MODIFY");
New_Line;
Put_Line ("package AURA with Pure is");
-- Repository format
New_Line;
Put (Tab & "type Repository_Format is (");
for Format in Repository_Format loop
if Format /= Repository_Format'First then
Put (", ");
end if;
Put (Format);
end loop;
Put_Line (");");
New_Line;
-- Platform info
declare
package PI renames Platform_Info;
procedure CS (Name, Value: in String) is
begin
Put (Tab & Name & ": constant String := """ & Value & """;");
New_Line;
end CS;
begin
CS (Name => "Platform_Family", Value => PI.Platform_Family);
CS (Name => "Platform_Flavor", Value => PI.Platform_Flavor);
CS (Name => "Platform_Version", Value => PI.Platform_Version);
CS (Name => "Platform_Architecture", Value => PI.Platform_Architecture);
end;
New_Line;
Put ("end AURA;");
TIO.Close (Spec);
-- Now that the spec file has been created, we need to find the
-- directory entry to submit to Enter_Unit
declare
use Ada.Directories;
Search: Search_Type;
Spec : Directory_Entry_Type;
begin
Start_Search (Search => Search,
Directory => Current_Directory,
Pattern => "aura.ads");
Assert (Check => More_Entries (Search),
Message => "Error generating AURA spec - cannot find "
& "generated file!");
Get_Next_Entry (Search => Search, Directory_Entry => Spec);
Registrar.Registration.Enter_Unit (Spec);
End_Search (Search);
end;
end Generate_AURA_Spec;
|
-------------------------------------------------------------------------------
-- package Chi_Gaussian_CDF, CDF of Normal and Chi-square distributions
-- Copyright (C) 1995-2018 Jonathan S. Parker
--
-- Permission to use, copy, modify, and/or distribute this software for any
-- purpose with or without fee is hereby granted, provided that the above
-- copyright notice and this permission notice appear in all copies.
-- THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
-- WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
-- MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
-- ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
-- WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
-- ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
-- OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
-------------------------------------------------------------------------------
-- package Chi_Gaussian_CDF
--
-- The Incomplete Gamma function for calculating area under the chi
-- squared distribution, and also the area under the normalized
-- Gaussian with unit width (the normal distribution).
--
-- The purpose of this package is to provide the cummulative distribution
-- functions (CDF) for the Chi squared distribution, and for the standard
-- normal distribution, so that p-values can be reliably calculated.
-- The area under the chi squared distribution is calculated by
-- function Chi_Squared_CDF. The area under the normal distribution
-- is calculated by function Normal_CDF.
--
--
-- Function Normal_CDF:
--
-- Evaluates the tail area of the standardized normal distribution
-- (normalized gaussian with unit width) from -inf to x.
--
-- The normal distribution:
--
-- Phi(x) = Exp (-(x-mu)^2/(2*Sigma^2)) / Sqrt(2*Pi*Sigma^2)
--
-- has variance = Sigma^2, and mean = mu.
-- The Standard Normal Distribution has
-- variance = Sigma^2 = 1, and mean = mu = 0. Phi(x) is normalized.
--
-- The cumulative normal distribution function (area under Phi(x) from -inf to x)
--
-- Phi_CDF(x) = Phi_CDF_stnd ((x-mu)/Sigma)
--
-- where Phi_CDF_stnd is the cumulative distribution function of the standard
-- normal distribution (mu=0, Sigma=1). Notice as x -> inf, Phi_CDF -> 1 since
-- Phi is normalized.
--
-- Notes on Algorithm:
--
-- Sums a series at small argument X (see Abramowitz, Stegun 6.5.29),
-- and uses Gauss's continued fraction for large argument X.
-- Seems to be good to about 14 significant figures, when Real'Digits = 15.
--
-- Remember that this package provides a continuous distribution. If
-- the p-values are obtained by testing discrete distributions then they
-- won't behave exactly as predicted for continuous distributions. If there
-- are a large number of degrees of freedom, you might need (for example) to
-- divide interval over which statistic is measured into (say) 2**10 to 2**20
-- segments to get discrete behaviour to approach that of continuous
-- distribution.
--
--
-- Inc_Gamma(a, w) = Int{from 0 to w} [exp(-t) t**(a-1) dt] / Gamma(a)
--
-- Gamma(0.5) = Sqrt(pi) and let t = u*u/2:
--
-- Inc_Gamma(0.5, w) = Int{from 0 to sqrt(2w)} [2 exp(-v*v/2) dv] / Sqrt(2 pi)
--
-- Inc_Gamma(0.5, x*x/2) / 2 = Int{from 0 to x)} [exp(-v*v/2) dv] / Sqrt(2 pi)
--
generic
type Real is digits <>;
-- Anything up to 16 digit floats is appropriate here; 18 is probably OK.
-- Haven't tried 32 digit floats, tho they should work in principal.
package Chi_Gaussian_CDF is
function Incomplete_Gamma_C (a : Real; x : Real) return Real;
function Incomplete_Gamma (a : Real; x : Real) return Real;
function Chi_Squared_CDF
(True_Degrees_Freedom : Real;
Chi_Squared : Real)
return Real;
-- Calculate the Chi-Squared statistic, plug it into this function,
-- and you get a p-value, a distribution that is uniformly distributed
-- on [0, 1] if the statistic follows the standard Chi-squared probability
-- distribution.
function Normal_CDF (x : Real) return Real;
procedure Test_Normal_CDF (x_0 : in Real; Error : out Real);
end Chi_Gaussian_CDF;
|
with Ada.Text_IO;
----------------------------
-- Agar(Object) -> Animal --
----------------------------
--
-- Ada implementation of the Agar object class "Animal".
--
package body Animal is
package C_obj is new System.Address_To_Access_Conversions (Animal);
package T_IO renames Ada.Text_IO;
function Create_Class return OBJ.Class_Not_Null_Access is
begin
--
-- Register our "Animal" class with the Agar object system.
--
Generic_Object_Class := OBJ.Create_Class
(Hierarchy => "Animal",
Object_Size => Animal'Size,
Class_Size => Animal_Class'Size,
Major => 1,
Minor => 2,
Init_Func => Init'Access,
Destroy_Func => Destroy'Access,
Load_Func => Load'Access,
Save_Func => Save'Access);
--
-- Initialize our derived class description structure. This will be
-- shared between all instances of Animal.
--
Animal_Object_Class := C_cls.To_Pointer(Generic_Object_Class.all'Address);
Animal_Object_Class.Ecological_Group := Undefined;
Animal_Object_Class.Description := (others => '_');
return Generic_Object_Class;
end;
procedure Destroy_Class is
begin
OBJ.Destroy_Class (Generic_Object_Class);
Generic_Object_Class := null;
Animal_Object_Class := null;
end;
--
-- Initialize an instance of the Animal class.
--
procedure Init (Object : OBJ.Object_Access)
is
Ani : constant C_obj.Object_Pointer := C_obj.To_Pointer(Object.all'Address);
begin
T_IO.Put_Line("Animal init");
Ani.Age := 123;
Ani.Exp := 11111;
Ani.Name := "Here is Ada string! ";
Ani.Bio := (others => 'x');
Ani.X := 3.14159265358979323846;
Ani.Y := 3.40282346638528860e+38;
Ani.Z := -1.0;
end;
--
-- Release all resources allocated by an instance of Animal.
--
procedure Destroy (Object : OBJ.Object_Access)
is begin
T_IO.Put_Line("Animal destroy");
end;
--
-- Serialize an Animal to a machine-independent format.
--
function Save
(Object : OBJ.Object_Access;
Dest : DS.Data_Source_Access) return C.int
is
Ani : constant C_obj.Object_Pointer := C_obj.To_Pointer(Object.all'Address);
begin
DS.Write_Unsigned_8 (Dest, Ani.Age);
DS.Write_Unsigned_16 (Dest, Ani.Exp);
DS.Write_Padded_String (Dest, Ani.Name, 40);
DS.Write_String (Dest, Ani.Bio);
DS.Write_Double (Dest, Ani.X);
DS.Write_Double (Dest, Ani.Y);
DS.Write_Double (Dest, Ani.Z);
return Success;
end;
--
-- Deserialize an Animal from machine-independent format.
--
function Load
(Object : OBJ.Object_Access;
Source : DS.Data_Source_Access;
Version : OBJ.Version_Access) return C.int
is
Ani : constant C_obj.Object_Pointer := C_obj.To_Pointer(Object.all'Address);
begin
Ani.Age := DS.Read_Unsigned_8 (Source);
Ani.Exp := DS.Read_Unsigned_16 (Source);
Ani.Name := DS.Read_Padded_String (Source, 40);
Ani.Bio := DS.Read_String (Source);
Ani.X := DS.Read_Double (Source);
Ani.Y := DS.Read_Double (Source);
Ani.Z := DS.Read_Double (Source);
return Success;
end;
end Animal;
|
-- The Cupcake GUI Toolkit
-- (c) Kristian Klomsten Skordal 2012 <kristian.skordal@gmail.com>
-- Report bugs and issues on <http://github.com/skordal/cupcake/issues>
-- vim:ts=3:sw=3:et:si:sta
with Ada.Numerics;
with System;
with Cupcake.Colors;
with Cupcake.Primitives;
package Cupcake.Backends is
use Ada.Numerics;
-- Interface implemented by backends:
type Backend is limited interface;
type Backend_Access is access all Backend'Class;
-- Backend exceptions:
Initialization_Error : exception;
-- Gets and sets the backend to be used for operations:
function Get_Backend return Backend_Access with Inline, Pure_Function;
procedure Set_Backend (Use_Backend : in Backend_Access) with Inline;
---- GENERAL BACKEND OPERATIONS: ----
-- Gets the name of the backend:
function Get_Name (This : in Backend) return String is abstract;
-- Initializes the backend:
procedure Initialize (This : in out Backend) is abstract;
-- Checks if the backend has been initialized:
function Is_Initialized (This : in Backend) return Boolean is abstract;
-- Finalizes the backend:
procedure Finalize (This : in out Backend) is abstract;
-- Enters the main loop:
procedure Enter_Main_Loop (This : in out Backend) is abstract;
-- Exits the main loop:
procedure Exit_Main_Loop (This : in out Backend) is abstract;
---- BACKEND WINDOW OPERATIONS: ----
-- Backend window type:
type Window_Data_Pointer is new System.Address;
Null_Window_Data_Pointer : constant Window_Data_Pointer
:= Window_Data_Pointer (System.Null_Address);
-- Type used for window IDs:
type Window_ID_Type is mod 2**32;
for Window_ID_Type'Size use 32;
-- Creates a new window:
function New_Window (This : in Backend;
Title : in String;
Size : in Primitives.Dimension;
Position : in Primitives.Point := (0, 0);
Parent : in Window_Data_Pointer := Null_Window_Data_Pointer)
return Window_Data_Pointer is abstract;
-- Destroys a window:
procedure Destroy_Window (This : in out Backend;
Window_Data : in out Window_Data_Pointer)
is abstract;
-- Gets the ID of a window:
function Get_Window_ID (This : in Backend;
Window_Data : in Window_Data_Pointer)
return Window_ID_Type is abstract;
-- Sets the title of a window:
procedure Set_Window_Title (This : in Backend;
Window_Data : in Window_Data_Pointer;
Title : in String) is abstract;
-- Sets the size of a window:
procedure Set_Window_Size (This : in Backend;
Window_Data : in Window_Data_Pointer;
Size : in Primitives.Dimension) is abstract;
-- Sets the window visibility on screen:
procedure Set_Window_Visibility (This : in Backend;
Window_Data : in Window_Data_Pointer;
Visibility : in Boolean) is abstract;
---- WINDOW DRAWING OPERATIONS: ----
-- Draws a straight line between two points:
procedure Draw_Line (This : in out Backend;
Window_Data : in Window_Data_Pointer;
Origin, Destination : in Primitives.Point;
Color : in Colors.Color := Colors.BLACK;
Line_Width : in Float := 1.0) is abstract;
-- Draws a circle with specified centre and radius; draws the circle
-- between 0 and the specified amount of radians. This value can be
-- negative, in which case the circle will be drawn counter-clockwise:
procedure Draw_Circle (This : in out Backend;
Window_Data : in Window_Data_Pointer;
Origin : in Primitives.Point;
Radius : in Float; Arc : in Float := 2.0 * Pi;
Color : in Colors.Color := Colors.BLACK;
Line_Width : in Float := 1.0) is abstract;
-- Fills the specified area with the specified color:
procedure Fill_Area (This : in out Backend;
Window_Data : in Window_Data_Pointer;
Area : in Primitives.Rectangle;
Color : in Colors.Color) is abstract;
---- FONT OPERATIONS: ----
-- Backend font type:
type Font_Data_Pointer is new System.Address;
private
-- The active backend:
Active_Backend : Backend_Access := null;
end Cupcake.Backends;
|
with Ada.Text_IO; use Ada.Text_IO;
with Sf.Config; use Sf.Config;
with Sf.System.Thread; use Sf.System.Thread;
with Sf.System.Sleep; use Sf.System.Sleep;
with Sf.System.Types; use Sf.System.Types;
procedure Main is
procedure Thread_Func (Arg : sfVoid_Ptr) is
begin
for I in 1 .. 10 loop
Put_Line ("I'm thread 1");
sfSleep (0.001);
end loop;
end Thread_Func;
Thread : sfThread_Ptr;
TFunc : sfThreadFunc_Ptr := Thread_Func'UNRESTRICTED_ACCESS;
UData : sfVoid_Ptr;
begin
Thread := sfThread_Create (TFunc, UData);
sfThread_Launch (Thread);
for I in 1 .. 10 loop
Put_Line ("I'm main thread");
sfSleep (0.001);
end loop;
sfThread_Destroy (Thread);
end Main;
|
-- Copyright (c) 2017-2020 Maxim Reznik <reznikmm@gmail.com>
--
-- SPDX-License-Identifier: MIT
-- License-Filename: LICENSE
-------------------------------------------------------------
with WebDriver.Sessions;
with League.JSON.Values;
package WebDriver.Drivers is
type Driver is limited interface;
not overriding function New_Session
(Self : access Driver;
Capabilities : League.JSON.Values.JSON_Value :=
League.JSON.Values.Empty_JSON_Value)
return WebDriver.Sessions.Session_Access is abstract;
-- Create a new WebDriver session
end WebDriver.Drivers;
|
-- NORX_Check_Padding
-- Ensure that headers and trailers of different lengths are accepted
-- and messages of different lengths correctly decrypted (to check padding)
-- Copyright (c) 2016, James Humphry - see LICENSE file for details
with Ada.Text_IO;
use Ada.Text_IO;
with Test_Input_Lengths;
with NORX0841;
with NORX1641;
with NORX3241;
with NORX3261;
with NORX6441;
with NORX6461;
procedure NORX_Check_Padding is
procedure NORX0841_Test is new Test_Input_Lengths(Norx_Package => NORX0841);
procedure NORX1641_Test is new Test_Input_Lengths(Norx_Package => NORX1641);
procedure NORX3241_Test is new Test_Input_Lengths(Norx_Package => NORX3241);
procedure NORX3261_Test is new Test_Input_Lengths(Norx_Package => NORX3261);
procedure NORX6441_Test is new Test_Input_Lengths(Norx_Package => NORX6441);
procedure NORX6461_Test is new Test_Input_Lengths(Norx_Package => NORX6461);
begin
Put_Line("Checking padding and input-length flexibility for NORX routines");
New_Line;
Put("Header, message and trailer lengths from 0-2000 are checked for " &
"correct authenticated encryption and decryption. While the length " &
"of one input is being varied, the lengths of the others are held " &
"constant.");
New_Line;
Put_Line("----------");
Put_Line("NORX08-4-1");
Put_Line("----------");
NORX0841_Test;
Put_Line("----------");
Put_Line("NORX16-4-1");
Put_Line("----------");
NORX1641_Test;
Put_Line("----------");
Put_Line("NORX32-4-1");
Put_Line("----------");
NORX3241_Test;
Put_Line("----------");
Put_Line("NORX32-6-1");
Put_Line("----------");
NORX3261_Test;
Put_Line("----------");
Put_Line("NORX64-4-1");
Put_Line("----------");
NORX6441_Test;
Put_Line("----------");
Put_Line("NORX64-6-1");
Put_Line("----------");
NORX6461_Test;
end NORX_Check_Padding;
|
with Ada.Numerics.Generic_Elementary_Functions;
package body Vectors2D is
function "=" (Left, Right : Vec2D) return Boolean is
begin
return (Left.x = Right.x) and (Left.y = Right.y);
end "=";
function "+" (Left, Right : Vec2D) return Vec2D is
begin
return Vec2D'(x => Left.x + Right.x, y => Left.y + Right.y);
end "+";
function "-" (Left, Right : Vec2D) return Vec2D is
begin
return Vec2D'(x => Left.x - Right.x, y => Left.y - Right.y);
end "-";
-- unary minus
function "-" (Right : Vec2D) return Vec2D is
begin
return Vec2D'(x => -Right.x, y => -Right.y);
end "-";
-- unary plus, replacement for 'Image
function "+" (Right : Vec2D) return String is
begin
return "[" & Right.x'Image & ";" & Right.y'Image & "]";
end "+";
-- scalar product
function "*" (Left, Right : Vec2D) return Float is
begin
return (Left.x * Right.x) + (Left.y * Right.y);
end "*";
function "*" (Left : Float; Right : Vec2D) return Vec2D is
begin
return Vec2D'(x => Left * Right.x, y => Left * Right.y);
end "*";
function "*" (Left : Vec2D; Right : Float) return Vec2D is
begin
return Vec2D'(x => Left.x * Right, y => Left.y * Right);
end "*";
function "/" (Left : Vec2D; Right : Float) return Vec2D is
begin
return Vec2D'(x => Left.x / Right, y => Left.y / Right);
end "/";
function MagSq(This : Vec2D) return Float is
begin
return (This.x * This.x) + (This.y * This.y);
end MagSq;
function Mag(This : Vec2D) return Float is
package flGEF is new Ada.Numerics.Generic_Elementary_Functions(Float);
begin
return flGEF.Sqrt(MagSq(This));
end Mag;
function Sq(This : Vec2D) return Vec2D is
SignX : constant Float := (if This.x >= 0.0 then 1.0 else -1.0);
SignY : constant Float := (if This.y >= 0.0 then 1.0 else -1.0);
begin
return ((SignX * This.x * This.x), (SignY * This.y * This.y));
end Sq;
function Normalize(This : Vec2D) return Vec2D is
Norm : constant Float := Mag(This);
begin
if Norm = 0.0 then return This; end if;
return This / Norm;
end Normalize;
function Normal(This : Vec2D) return Vec2D is
begin
return (-This.y, This.x);
end Normal;
function Clamp(Value, Min, Max : Float) return Float
is
begin
if Value < Min then return Min; end if;
if Value > Max then return Max; end if;
return Value;
end Clamp;
function ClampVec(This : Vec2D; Max : Vec2D) return Vec2D is
pragma Assume(This.x'Valid and This.y'Valid and Max.x'Valid and Max.y'Valid);
begin
return (x => (if Max.x = 0.0 then This.x else Clamp(This.x, -Max.x, Max.x)),
y => (if Max.y = 0.0 then This.y else Clamp(This.y, -Max.y, Max.y)));
end ClampVec;
end Vectors2D;
|
with Ada.Real_Time; use Ada.Real_Time;
package Tasks is
protected Protect is
procedure Go;
entry Wait;
private
Active : Boolean := False;
end Protect;
task T with Storage_Size => 512;
end Tasks;
|
-- { dg-do compile }
with Ada.Finalization; use Ada;
package ai_116 is
pragma Preelaborate;
type Buffer_Type is limited interface;
type Handle is new Finalization.Limited_Controlled and Buffer_Type with
private;
pragma Preelaborable_Initialization(Handle);
type Ptr is access all String;
Null_Handle : constant Handle;
private
type Handle is new Finalization.Limited_Controlled and Buffer_Type with
record
Data : Ptr := null;
end record;
Null_Handle : constant Handle :=
(Finalization.Limited_Controlled with Data => null);
end ai_116;
|
package body STM32GD.SPI.Peripheral is
procedure Init is
begin
null;
end Init;
procedure Send (Data : in Byte) is
begin
null;
end Send;
procedure Send (Data : in SPI_Data_8b) is
begin
null;
end Send;
procedure Receive (Data : out Byte) is
begin
null;
end Receive;
procedure Receive (Data : out SPI_Data_8b) is
begin
null;
end Receive;
procedure Transfer (Data : in out SPI_Data_8b) is
begin
null;
end Transfer;
end STM32GD.SPI.Peripheral;
|
pragma License (Unrestricted);
with Ada.Numerics.MT19937;
generic
type Result_Subtype is (<>);
package Ada.Numerics.Discrete_Random is
-- Basic facilities
-- type Generator is limited private;
type Generator is new MT19937.Generator;
function Random (Gen : Generator) return Result_Subtype;
function Random (Gen : Generator; First, Last : Result_Subtype)
return Result_Subtype;
-- with Post => Random'Result in First .. Last;
-- AI12-0144-1
-- procedure Reset (Gen : Generator; Initiator : Integer);
-- procedure Reset (Gen : Generator);
-- procedure Reset is inherited
-- Advanced facilities
-- type State is private;
subtype State is MT19937.State;
-- procedure Save (Gen : Generator; To_State : out State);
-- procedure Reset (Gen : Generator; From_State : State);
-- procedure Save and Load are inherited
Max_Image_Width : constant := MT19937.Max_Image_Width;
function Image (Of_State : State) return String
renames MT19937.Image;
function Value (Coded_State : String) return State
renames MT19937.Value;
end Ada.Numerics.Discrete_Random;
|
-- Copyright 2017-2021 Jeff Foley. All rights reserved.
-- Use of this source code is governed by Apache 2 LICENSE that can be found in the LICENSE file.
local json = require("json")
name = "Chaos"
type = "api"
function start()
set_rate_limit(10)
end
function check()
local c
local cfg = datasrc_config()
if cfg ~= nil then
c = cfg.credentials
end
if (c ~= nil and c.key ~= nil and c.key ~= "") then
return true
end
return false
end
function vertical(ctx, domain)
local c
local cfg = datasrc_config()
if cfg ~= nil then
c = cfg.credentials
end
local resp, err = request(ctx, {
['url']=api_url(domain),
headers={['Authorization']=c['key']},
})
if (err ~= nil and err ~= "") then
log(ctx, "vertical request to service failed: " .. err)
return
end
local d = json.decode(resp)
if (d == nil or d.subdomains == nil or #(d.subdomains) == 0) then
return
end
for i, sub in pairs(d.subdomains) do
new_name(ctx, sub .. "." .. d.domain)
end
end
function api_url(domain)
return "https://dns.projectdiscovery.io/dns/" .. domain .. "/subdomains"
end
|
-- part of AdaYaml, (c) 2017 Felix Krause
-- released under the terms of the MIT license, see the file "copying.txt"
with Ada.Containers.Indefinite_Vectors;
package Yaml.Dom.Vectors is new Ada.Containers.Indefinite_Vectors
(Positive, Document_Reference);
|
-- NORX_Test_Vectors
-- Copyright (c) 2016, James Humphry - see LICENSE file for details
with Ada.Text_IO;
use Ada.Text_IO;
with Display_NORX_Traces;
with NORX0841;
with NORX1641;
with NORX3241;
with NORX3261;
with NORX6441;
with NORX6461;
procedure NORX_Test_Vectors is
procedure NORX0841_Display is
new Display_NORX_Traces(NORX_Package => NORX0841);
procedure NORX1641_Display is
new Display_NORX_Traces(NORX_Package => NORX1641);
procedure NORX3241_Display is
new Display_NORX_Traces(NORX_Package => NORX3241);
procedure NORX3261_Display is
new Display_NORX_Traces(NORX_Package => NORX3261);
procedure NORX6441_Display is
new Display_NORX_Traces(NORX_Package => NORX6441);
procedure NORX6461_Display is
new Display_NORX_Traces(NORX_Package => NORX6461);
begin
Put_Line("NORX Test Vectors");
New_Line;
Put_Line("----------");
Put_Line("NORX08-4-1");
Put_Line("----------");
NORX0841_Display;
Put_Line("----------");
Put_Line("NORX16-4-1");
Put_Line("----------");
NORX1641_Display;
Put_Line("----------");
Put_Line("NORX32-4-1");
Put_Line("----------");
NORX3241_Display;
Put_Line("----------");
Put_Line("NORX32-6-1");
Put_Line("----------");
NORX3261_Display;
Put_Line("----------");
Put_Line("NORX64-4-1");
Put_Line("----------");
NORX6441_Display;
Put_Line("----------");
Put_Line("NORX64-6-1");
Put_Line("----------");
NORX6461_Display;
end NORX_Test_Vectors;
|
with Ada.Text_IO; use Ada.Text_IO;
procedure Test_Short_Circuit is
function A (Value : Boolean) return Boolean is
begin
Put (" A=" & Boolean'Image (Value));
return Value;
end A;
function B (Value : Boolean) return Boolean is
begin
Put (" B=" & Boolean'Image (Value));
return Value;
end B;
begin
for I in Boolean'Range loop
for J in Boolean'Range loop
Put (" (A and then B)=" & Boolean'Image (A (I) and then B (J)));
New_Line;
end loop;
end loop;
for I in Boolean'Range loop
for J in Boolean'Range loop
Put (" (A or else B)=" & Boolean'Image (A (I) or else B (J)));
New_Line;
end loop;
end loop;
end Test_Short_Circuit;
|
with Ada.Text_IO;
procedure hello is
begin
Ada.Text_IO.Put_Line ("hello, world");
end hello;
|
-- This file is generated by SWIG. Please do *not* modify by hand.
--
with fann_c.Pointers;
with interfaces.C;
package fann_c.pointer_Pointers is
-- FILE_Pointer_Pointer
--
type FILE_Pointer_Pointer is access all fann_c.Pointers.FILE_Pointer;
-- fann_type_Pointer_Pointer
--
type fann_type_Pointer_Pointer is access all fann_c.Pointers.fann_type_Pointer;
-- fann_errno_enum_Pointer_Pointer
--
type fann_errno_enum_Pointer_Pointer is access all fann_c.Pointers.fann_errno_enum_Pointer;
-- fann_train_enum_Pointer_Pointer
--
type fann_train_enum_Pointer_Pointer is access all fann_c.Pointers.fann_train_enum_Pointer;
-- fann_activationfunc_enum_Pointer_Pointer
--
type fann_activationfunc_enum_Pointer_Pointer is access all fann_c.Pointers.fann_activationfunc_enum_Pointer;
-- fann_errorfunc_enum_Pointer_Pointer
--
type fann_errorfunc_enum_Pointer_Pointer is access all fann_c.Pointers.fann_errorfunc_enum_Pointer;
-- fann_stopfunc_enum_Pointer_Pointer
--
type fann_stopfunc_enum_Pointer_Pointer is access all fann_c.Pointers.fann_stopfunc_enum_Pointer;
-- fann_nettype_enum_Pointer_Pointer
--
type fann_nettype_enum_Pointer_Pointer is access all fann_c.Pointers.fann_nettype_enum_Pointer;
end fann_c.pointer_Pointers;
|
-- Copyright (C) 2019 Thierry Rascle <thierr26@free.fr>
-- MIT license. Please refer to the LICENSE file.
with Ada.Strings.Fixed;
package body Apsepp.Debug_Trace_Class.Stub is
----------------------------------------------------------------------------
overriding
function Clock_String
(Obj : Debug_Trace_Stub;
Reset_Elapsed : Boolean := False) return String is
use Ada.Strings.Fixed;
Date : Time;
Time_Zone : Time_Offset;
Elapsed_Time : Duration;
Par_Index : Positive;
pragma Unreferenced (Obj);
begin
Reset_Date_Handler.Get (Date, Time_Zone, Elapsed_Time, Reset_Elapsed);
return Ret : String := To_ISO_8601 (Date => Date,
Time_Zone => Time_Zone,
Include_Time_Fraction => True)
& " ("
& Duration'Image (Elapsed_Time)
& ")" do
Par_Index := Index (Ret, "(");
Ret(Par_Index + 1) := '+';
end return;
end Clock_String;
----------------------------------------------------------------------------
overriding
procedure Trace_E (Obj : in out Debug_Trace_Stub;
E : Exception_Occurrence;
Entity_Name : String := "") is
begin
Debug_Trace_Stub'Class (Obj).Trace
(Debug_Trace_Stub'Class (Obj).E_To_String (E), Entity_Name);
end Trace_E;
----------------------------------------------------------------------------
overriding
procedure Set_Time_Zone (Obj : in out Debug_Trace_Stub;
Time_Zone : Time_Offset) is
pragma Unreferenced (Obj);
begin
Reset_Date_Handler.Set_Time_Zone (Time_Zone);
end Set_Time_Zone;
----------------------------------------------------------------------------
overriding
procedure Set_Local_Time_Zone (Obj : in out Debug_Trace_Stub) is
begin
Debug_Trace_Stub'Class (Obj).Set_Time_Zone (UTC_Time_Offset);
exception
when others => -- Probably Unknown_Zone_Error.
Debug_Trace_Stub'Class (Obj).Set_Time_Zone (0);
end Set_Local_Time_Zone;
----------------------------------------------------------------------------
overriding
procedure Trace_Time
(Obj : in out Debug_Trace_Stub;
Entity_Name : String := "";
Reset_Elapsed : Boolean := False) is
begin
Debug_Trace_Stub'Class (Obj).Trace
(Debug_Trace_Stub'Class (Obj).Clock_String (Reset_Elapsed),
Entity_Name);
end Trace_Time;
----------------------------------------------------------------------------
end Apsepp.Debug_Trace_Class.Stub;
|
PROCEDURE test1 IS
BEGIN
-- missing declaration of n causes this program to crash
FOR i IN 1..n LOOP
NULL;
END LOOP;
END test1;
|
------------------------------------------------------------------------------
-- --
-- GNAT RUN-TIME LIBRARY (GNARL) COMPONENTS --
-- --
-- S Y S T E M . I N T E R R U P T S --
-- --
-- S p e c --
-- --
-- Copyright (C) 2001-2021, AdaCore --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
-- ware Foundation; either version 3, or (at your option) any later ver- --
-- sion. GNAT is distributed in the hope that it will be useful, but WITH- --
-- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY --
-- or FITNESS FOR A PARTICULAR PURPOSE. --
-- --
-- --
-- --
-- --
-- --
-- You should have received a copy of the GNU General Public License and --
-- a copy of the GCC Runtime Library Exception along with this program; --
-- see the files COPYING3 and COPYING.RUNTIME respectively. If not, see --
-- <http://www.gnu.org/licenses/>. --
-- --
-- GNARL was developed by the GNARL team at Florida State University. --
-- Extensive contributions were provided by Ada Core Technologies, Inc. --
-- --
------------------------------------------------------------------------------
-- This is the Ravenscar version of this package
-- Note: the compiler generates direct calls to this interface, via Rtsfind.
-- Any changes to this interface may require corresponding compiler changes.
-- This package encapsulates the implementation of interrupt or signal
-- handlers. It is logically an extension of the body of Ada.Interrupts.
-- It is made a child of System to allow visibility of various
-- runtime system internal data and operations.
with System.OS_Interface;
-- used for Max_Interrupt
package System.Interrupts is
pragma Elaborate_Body;
-------------------------
-- Constants and types --
-------------------------
Default_Interrupt_Priority : constant System.Interrupt_Priority :=
System.Interrupt_Priority'Last;
-- Default value used when a pragma Interrupt_Handler or Attach_Handler is
-- specified without an Interrupt_Priority pragma, see D.3(10).
type Ada_Interrupt_ID is new System.OS_Interface.Interrupt_Range;
-- Avoid inheritance by Ada.Interrupts.Interrupt_ID of unwanted operations
type Interrupt_ID is new System.OS_Interface.Interrupt_Range;
-- The following renaming is introduced so that the type is accessible
-- through rtsfind, otherwise the name clashes with its homonym in
-- ada.interrupts.
subtype System_Interrupt_Id is Interrupt_ID;
type Parameterless_Handler is access protected procedure;
type Handler_Index is range 0 .. Integer'Last;
type Handler_Item is record
Interrupt : Interrupt_ID;
Handler : Parameterless_Handler;
end record;
-- Contains all the information from an Attach_Handler pragma
type Handler_Array is array (Handler_Index range <>) of Handler_Item;
--------------------------------
-- Interrupt entries services --
--------------------------------
-----------------------------
-- Interrupt entry service --
-----------------------------
procedure Install_Restricted_Handlers
(Prio : Interrupt_Priority;
Handlers : Handler_Array);
-- Install the static Handlers for the given Interrupts. There is one call
-- per protected object, and one element in Handlers for each handler of
-- the protected object (typically only one). Prio is the priority of
-- the protected object, so that interrupt controler can be set to that
-- priority (if possible).
procedure Install_Restricted_Handlers_Sequential;
pragma Export (C, Install_Restricted_Handlers_Sequential,
"__gnat_attach_all_handlers");
-- When the partition elaboration policy is sequential, attachment of
-- interrupts handlers is deferred until the end of elaboration. The
-- binder will call this procedure at the end of elaboration, just before
-- activating the tasks (if any).
end System.Interrupts;
|
-- SPDX-License-Identifier: BSD-3-Clause
--
-- Copyright (c) 2017 Eric Bruneton
-- All rights reserved.
--
-- Redistribution and use in source and binary forms, with or without
-- modification, are permitted provided that the following conditions
-- are met:
-- 1. Redistributions of source code must retain the above copyright
-- notice, this list of conditions and the following disclaimer.
-- 2. Redistributions in binary form must reproduce the above copyright
-- notice, this list of conditions and the following disclaimer in the
-- documentation and/or other materials provided with the distribution.
-- 3. Neither the name of the copyright holders 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.
-- The shader returned by Get_Shader provides the following
-- functions (that you need to forward declare in your own shaders to be able to
-- compile them separately):
--
-- // Returns the radiance of the Sun, outside the atmosphere.
-- vec3 GetSolarRadiance();
--
-- // Returns the sky radiance along the segment from 'camera' to the nearest
-- // atmosphere boundary in direction 'view_ray', as well as the transmittance
-- // along this segment.
-- vec3 GetSkyRadiance(vec3 camera, vec3 view_ray, double shadow_length,
-- vec3 sun_direction, out vec3 transmittance, out bool intersects_ground);
--
-- // Returns the sky radiance along the segment from 'camera' to 'p', as well as
-- // the transmittance along this segment.
-- vec3 GetSkyRadianceToPoint(vec3 camera, vec3 p, double shadow_length,
-- vec3 sun_direction, out vec3 transmittance);
--
-- // Returns the sun and sky irradiance received on a surface patch located at 'p'
-- // and whose normal vector is 'normal'.
-- vec3 GetSunAndSkyIrradiance(vec3 p, vec3 normal, vec3 sun_direction,
-- out vec3 sky_irradiance);
--
-- // Returns the luminance of the Sun, outside the atmosphere.
-- vec3 GetSolarLuminance();
--
-- // Returns the sky luminance along the segment from 'camera' to the nearest
-- // atmosphere boundary in direction 'view_ray', as well as the transmittance
-- // along this segment.
-- vec3 GetSkyLuminance(vec3 camera, vec3 view_ray, double shadow_length,
-- vec3 sun_direction, out vec3 transmittance, out bool intersects_ground);
--
-- // Returns the sky luminance along the segment from 'camera' to 'p', as well as
-- // the transmittance along this segment.
-- vec3 GetSkyLuminanceToPoint(vec3 camera, vec3 p, double shadow_length,
-- vec3 sun_direction, out vec3 transmittance);
--
-- // Returns the sun and sky illuminance received on a surface patch located at
-- // 'p' and whose normal vector is 'normal'.
-- vec3 GetSunAndSkyIlluminance(vec3 p, vec3 normal, vec3 sun_direction,
-- out vec3 sky_illuminance);
--
-- where
--
-- - camera and p must be expressed in a reference frame where the planet center
-- is at the origin, and measured in the unit passed to the constructor's
-- length_unit_in_meters argument. camera can be in space, but p must be
-- inside the atmosphere
--
-- - view_ray, sun_direction and normal are unit direction vectors expressed
-- in the same reference frame (with sun_direction pointing *towards* the Sun)
--
-- - shadow_length is the length along the segment which is in shadow, measured
-- in the unit passed to the constructor's length_unit_in_meters argument
--
-- and where
--
-- - the first 4 functions return spectral radiance and irradiance values
-- (in $W.m^{-2}.sr^{-1}.nm^{-1}$ and $W.m^{-2}.nm^{-1}$), at the 3 wavelengths
-- K_Lambda_R, K_Lambda_G, K_Lambda_B (in this order)
--
-- - the other functions return luminance and illuminance values (in
-- $cd.m^{-2}$ and $lx$) in linear [sRGB](https://en.wikipedia.org/wiki/SRGB)
-- space (i.e. before adjustments for gamma correction)
--
-- - all the functions return the (unitless) transmittance of the atmosphere
-- along the specified segment at the 3 wavelengths K_Lambda_R,
-- K_Lambda_G, K_Lambda_B (in this order)
--
-- Note: The precomputed atmosphere textures can store either irradiance
-- or illuminance values (see the Num_Precomputed_Wavelengths parameter):
--
-- - when using irradiance values, the RGB channels of these textures contain
-- spectral irradiance values, in $W.m^{-2}.nm^{-1}$, at the 3 wavelengths
-- K_Lambda_R, K_Lambda_G, K_Lambda_B (in this order). The API functions
-- returning radiance values return these precomputed values (times the
-- phase functions), while the API functions returning luminance values use
-- the approximation described in
-- "A Qualitative and Quantitative Evaluation of 8 Clear Sky Models" [1],
-- section 14.3, to convert 3 radiance values to linear sRGB luminance values
--
-- - when using illuminance values, the RGB channels of these textures contain
-- illuminance values, in $lx$, in linear sRGB space. These illuminance values
-- are precomputed as described in
-- "Real-time Spectral Scattering in Large-scale Natural Participating Media" [2],
-- section 4.4 (i.e. Num_Precomputed_Wavelengths irradiance values are
-- precomputed, and then converted to sRGB via a numerical integration of this
-- spectrum with the CIE color matching functions). The API functions returning
-- luminance values return these precomputed values (times the phase functions),
-- while *the API functions returning radiance values are not provided*
--
-- [1] https://arxiv.org/pdf/1612.04336.pdf
-- [2] http://www.oskee.wz.cz/stranka/uploads/SCCG10ElekKmoch.pdf
private with GL.Low_Level.Enums;
private with GL.Objects.Textures;
private with GL.Objects.Samplers;
with Ada.Containers.Vectors;
with GL.Types;
with Orka.Resources.Locations;
with Orka.Rendering.Programs.Modules;
package Orka.Features.Atmosphere is
pragma Preelaborate;
type Luminance_Type is (None, Approximate, Precomputed);
use GL.Types;
type Density_Profile_Layer is record
Width, Exp_Term, Exp_Scale, Linear_Term, Constant_Term : Double := 0.0;
end record;
-- An atmosphere layer of Width (in m), and whose density is defined as
-- Exp_Term * exp(Exp_Scale * h) + Linear_Term * h + Constant_Term,
-- clamped to [0,1], and where h is the altitude (in m). Exp_Term and
-- Constant_Term are unitless, while Exp_Scale and Linear_Term are in m^-1.
use type Ada.Containers.Count_Type;
package Double_Vectors is new Ada.Containers.Vectors (Natural, Double);
package Density_Vectors is new Ada.Containers.Vectors (Natural, Density_Profile_Layer);
type Model_Data (Samples : Ada.Containers.Count_Type) is record
Luminance : Luminance_Type;
Wavelengths : Double_Vectors.Vector;
-- The wavelength values, in nanometers, and sorted in increasing order, for
-- which the solar_irradiance, rayleigh_scattering, mie_scattering,
-- mie_extinction and ground_albedo samples are provided. If your shaders
-- use luminance values (as opposed to radiance values, see above), use a
-- large number of wavelengths (e.g. between 15 and 50) to get accurate
-- results (this number of wavelengths has absolutely no impact on the
-- shader performance).
Solar_Irradiance : Double_Vectors.Vector;
-- Solar irradiance at the top of the atmosphere, in W/m^2/nm. This
-- vector must have the same size as the wavelengths parameter.
Sun_Angular_Radius : Double;
-- Sun's angular radius in radians. Warning: the implementation uses
-- approximations that are valid only if this value is smaller than 0.1.
Bottom_Radius : Double;
-- Distance between the planet center and the bottom of the atmosphere, in m
Top_Radius : Double;
-- Distance between the planet center and the top of the atmosphere, in m
Rayleigh_Density : Density_Vectors.Vector;
-- The density profile of air molecules, i.e. a function from altitude to
-- dimensionless values between 0 (null density) and 1 (maximum density).
-- Layers must be sorted from bottom to top. The width of the last layer is
-- ignored, i.e. it always extend to the top atmosphere boundary. At most 2
-- layers can be specified.
Rayleigh_Scattering : Double_Vectors.Vector;
-- The scattering coefficient of air molecules at the altitude where their
-- density is maximum (usually the bottom of the atmosphere), as a function
-- of wavelength, in m^-1. The scattering coefficient at altitude h is equal
-- to 'rayleigh_scattering' times 'rayleigh_density' at this altitude. This
-- vector must have the same size as the wavelengths parameter.
Mie_Density : Density_Vectors.Vector;
-- The density profile of aerosols, i.e. a function from altitude to
-- dimensionless values between 0 (null density) and 1 (maximum density).
-- Layers must be sorted from bottom to top. The width of the last layer is
-- ignored, i.e. it always extend to the top atmosphere boundary. At most 2
-- layers can be specified.
Mie_Scattering : Double_Vectors.Vector;
-- The scattering coefficient of aerosols at the altitude where their
-- density is maximum (usually the bottom of the atmosphere), as a function
-- of wavelength, in m^-1. The scattering coefficient at altitude h is equal
-- to 'mie_scattering' times 'mie_density' at this altitude. This vector
-- must have the same size as the wavelengths parameter.
Mie_Extinction : Double_Vectors.Vector;
-- The extinction coefficient of aerosols at the altitude where their
-- density is maximum (usually the bottom of the atmosphere), as a function
-- of wavelength, in m^-1. The extinction coefficient at altitude h is equal
-- to 'mie_extinction' times 'mie_density' at this altitude. This vector
-- must have the same size as the wavelengths parameter.
Mie_Phase_Function_G : Double;
-- The asymetry parameter for the Cornette-Shanks phase function for the
-- aerosols.
Absorption_Density : Density_Vectors.Vector;
-- The density profile of air molecules that absorb light (e.g. ozone), i.e.
-- a function from altitude to dimensionless values between 0 (null density)
-- and 1 (maximum density). Layers must be sorted from bottom to top. The
-- width of the last layer is ignored, i.e. it always extend to the top
-- atmosphere boundary. At most 2 layers can be specified.
Absorption_Extinction : Double_Vectors.Vector;
-- The extinction coefficient of molecules that absorb light (e.g. ozone) at
-- the altitude where their density is maximum, as a function of wavelength,
-- in m^-1. The extinction coefficient at altitude h is equal to
-- 'absorption_extinction' times 'absorption_density' at this altitude. This
-- vector must have the same size as the wavelengths parameter.
Ground_Albedo : Double_Vectors.Vector;
-- The average albedo of the ground, as a function of wavelength. This
-- vector must have the same size as the wavelengths parameter.
Max_Sun_Zenith_Angle : Double;
-- The maximum Sun zenith angle for which atmospheric scattering must be
-- precomputed, in radians (for maximum precision, use the smallest Sun
-- zenith angle yielding negligible sky light radiance values. For instance,
-- for the Earth case, 102 degrees is a good choice for most cases (120
-- degrees is necessary for very high exposure values).
Length_Unit_In_Meters : Double;
-- The length unit used in your shaders and meshes. This is the length unit
-- which must be used when calling the atmosphere model shader functions.
Num_Precomputed_Wavelengths : GL.Types.UInt;
-- The number of wavelengths for which atmospheric scattering must be
-- precomputed (the temporary GPU memory used during precomputations, and
-- the GPU memory used by the precomputed results, is independent of this
-- number, but the precomputation time is directly proportional to this
-- number):
-- - if this number is less than or equal to 3, scattering is precomputed
-- for 3 wavelengths, and stored as irradiance values. Then both the
-- radiance-based and the luminance-based API functions are provided (see
-- the above note).
-- - otherwise, scattering is precomputed for this number of wavelengths
-- (rounded up to a multiple of 3), integrated with the CIE color matching
-- functions, and stored as illuminance values. Then only the
-- luminance-based API functions are provided (see the above note).
Combine_Scattering_Textures : Boolean;
-- Whether to pack the (red component of the) single Mie scattering with the
-- Rayleigh and multiple scattering in a single texture, or to store the
-- (3 components of the) single Mie scattering in a separate texture.
Half_Precision : Boolean;
-- Whether to use half precision floats (16 bits) or single precision floats
-- (32 bits) for the precomputed textures. Half precision is sufficient for
-- most cases, except for very high exposure values.
end record
with Dynamic_Predicate =>
Model_Data.Rayleigh_Density.Length <= 2
and Model_Data.Absorption_Density.Length <= 2
and Model_Data.Sun_Angular_Radius < 0.1
and Model_Data.Wavelengths.Length = Model_Data.Samples
and Model_Data.Solar_Irradiance.Length = Model_Data.Samples
and Model_Data.Rayleigh_Scattering.Length = Model_Data.Samples
and Model_Data.Mie_Scattering.Length = Model_Data.Samples
and Model_Data.Mie_Extinction.Length = Model_Data.Samples
and Model_Data.Absorption_Extinction.Length = Model_Data.Samples
and Model_Data.Ground_Albedo.Length = Model_Data.Samples;
type Precomputed_Textures is private;
procedure Bind_Textures (Object : Precomputed_Textures);
type Model (Data : not null access constant Model_Data) is tagged limited private;
function Create_Model
(Data : not null access constant Model_Data;
Location : Resources.Locations.Location_Ptr) return Model;
function Compute_Textures (Object : Model; Scattering_Orders : Natural := 4)
return Precomputed_Textures;
function Get_Shader (Object : Model) return Rendering.Programs.Modules.Module;
procedure Convert_Spectrum_To_Linear_SRGB (Data : Model_Data; R, G, B : out Double);
-- Utility method to convert a function of the wavelength to linear sRGB
--
-- Wavelengths and solar irradiance must have the same size. The integral of
-- Spectrum times each CIE_2_Deg_Color_Matching_Functions (and times
-- Max_Luminous_Efficacy) is computed to get XYZ values, which are then
-- converted to linear sRGB with the XYZ_To_SRGB matrix.
--
-- For white balance, divide R, G, and B by the average of the three numbers
private
package Textures renames GL.Objects.Textures;
package LE renames GL.Low_Level.Enums;
type Precomputed_Textures is record
Sampler : GL.Objects.Samplers.Sampler;
Combine_Scattering : Boolean;
Transmittance_Texture : Textures.Texture (LE.Texture_2D);
Scattering_Texture : Textures.Texture (LE.Texture_3D);
Irradiance_Texture : Textures.Texture (LE.Texture_2D);
Optional_Single_Mie_Scattering_Texture : Textures.Texture (LE.Texture_3D);
-- Unused if Combine_Scattering is True
end record;
type Model (Data : not null access constant Model_Data) is tagged limited record
Data_Definitions : Resources.Byte_Array_Pointers.Pointer;
Data_Functions : Resources.Byte_Array_Pointers.Pointer;
Location : Resources.Locations.Location_Access;
Sky_K_R, Sky_K_G, Sky_K_B : GL.Types.Double;
Sun_K_R, Sun_K_G, Sun_K_B : GL.Types.Double;
end record;
function Create_Sampler return GL.Objects.Samplers.Sampler;
K_Lambda_Min : constant Double := 360.0;
K_Lambda_Max : constant Double := 830.0;
end Orka.Features.Atmosphere;
|
with AVR; use AVR;
with AVR.MCU;
with Interfaces;
package Hardware.Beacon is
-- Tick_Size indicates how many ticks in a 100ms beacon cycle
-- there are.
procedure Init (Tick_Size : in Interfaces.Unsigned_8);
procedure Trigger;
private
LED1_Bit : Bit_Number := 4;
LED2_Bit : Bit_Number := 5;
LED1 : Boolean renames MCU.PORTH_Bits (LED1_Bit);
LED2 : Boolean renames MCU.PORTH_Bits (LED2_Bit);
Tick : Interfaces.Unsigned_8;
Counter : Interfaces.Unsigned_8;
Resolution : Interfaces.Unsigned_8;
end Hardware.Beacon;
|
with Text_IO,ada.Text_IO;
use Text_IO,ada.Text_IO;
procedure Adadocker is
begin
Put_line("******************************");
New_Line(2);
Put_line("Ada running inside docker.");
New_Line(2);
Put_line("******************************");
end Adadocker;
|
-- Institution: Technische Universität München
-- Department: Realtime Computer Systems (RCS)
-- Project: StratoX
-- Module: Software Configuration
--
-- Authors: Martin Becker (becker@rcs.ei.tum.de)
with FM25v0x;
-- @summary
-- Target-specific types for the NVRAM in Pixracer V1.
package HIL.Devices.NVRAM with SPARK_Mode is
-- Pixracer has 256kbit FRAM
package FM25v02 is new FM25v0x (2**15);
subtype NVRAM_Address is FM25v02.Address;
end HIL.Devices.NVRAM;
|
with Ada.Unchecked_Conversion;
with bcm2835_h; use bcm2835_h;
package body Raspio.GPIO is
function Get_Pin_Number
(Pin_ID : Pin_ID_Type)
return x86_64_linux_gnu_bits_stdint_uintn_h.uint8_t;
function Get_Mode_Number is new Ada.Unchecked_Conversion
(Source => Mode_Type,
Target => x86_64_linux_gnu_bits_stdint_uintn_h.uint8_t);
function Get_Resistor_Number is new Ada.Unchecked_Conversion
(Source => Internal_Resistor_Type,
Target => x86_64_linux_gnu_bits_stdint_uintn_h.uint8_t);
function Create
(Pin_ID : Pin_ID_Type; Mode : Mode_Type;
Internal_Resistor : Internal_Resistor_Type) return Pin_Type
is
Pin_Number : constant x86_64_linux_gnu_bits_stdint_uintn_h.uint8_t :=
Get_Pin_Number (Pin_ID);
Pin_Mode : constant x86_64_linux_gnu_bits_stdint_uintn_h.uint8_t :=
Get_Mode_Number (Mode);
PUD : constant x86_64_linux_gnu_bits_stdint_uintn_h.uint8_t :=
Get_Resistor_Number (Internal_Resistor);
begin
bcm2835_h.bcm2835_gpio_fsel
(Pin_Number, Pin_Mode); -- /usr/local/include/bcm2835.h:602
bcm2835_h.bcm2835_gpio_set_pud (Pin_Number, PUD);
return (Pin => Pin_Number, Mode => Pin_Mode, PUD => PUD);
end Create;
function Get_Pin_Number
(Pin_ID : Pin_ID_Type) return x86_64_linux_gnu_bits_stdint_uintn_h.uint8_t
is
Lookup_Array : constant array
(Pin_ID_Type) of x86_64_linux_gnu_bits_stdint_uintn_h.uint8_t :=
(GPIO_P1_03 => 0, -- Version 1, Pin P1-03
GPIO_P1_05 => 1, -- Version 1, Pin P1-05
GPIO_P1_07 => 4, -- Version 1, Pin P1-07
GPIO_P1_08 =>
14, -- Version 1, Pin P1-08, defaults to alt function 0 UART0_TXD
GPIO_P1_10 =>
15, -- Version 1, Pin P1-10, defaults to alt function 0 UART0_RXD
GPIO_P1_11 => 17, -- Version 1, Pin P1-11
GPIO_P1_12 =>
18, -- Version 1, Pin P1-12, can be PWM channel 0 in ALT FUN 5
GPIO_P1_13 => 21, -- Version 1, Pin P1-13
GPIO_P1_15 => 22, -- Version 1, Pin P1-15
GPIO_P1_16 => 23, -- Version 1, Pin P1-16
GPIO_P1_18 => 24, -- Version 1, Pin P1-18
GPIO_P1_19 => 10, -- Version 1, Pin P1-19, MOSI when SPI0 in use
GPIO_P1_21 => 9, -- Version 1, Pin P1-21, MISO when SPI0 in use
GPIO_P1_22 => 25, -- Version 1, Pin P1-22
GPIO_P1_23 => 11, -- Version 1, Pin P1-23, CLK when SPI0 in use
GPIO_P1_24 => 8, -- Version 1, Pin P1-24, CE0 when SPI0 in use
GPIO_P1_26 => 7, -- Version 1, Pin P1-26, CE1 when SPI0 in use
V2_GPIO_P1_03 => 2, -- Version 2, Pin P1-03
V2_GPIO_P1_05 => 3, -- Version 2, Pin P1-05
V2_GPIO_P1_07 => 4, -- Version 2, Pin P1-07
V2_GPIO_P1_08 =>
14, -- Version 2, Pin P1-08, defaults to alt function 0 UART0_TXD
V2_GPIO_P1_10 =>
15, -- Version 2, Pin P1-10, defaults to alt function 0 UART0_RXD
V2_GPIO_P1_11 => 17, -- Version 2, Pin P1-11
V2_GPIO_P1_12 =>
18, -- Version 2, Pin P1-12, can be PWM channel 0 in ALT FUN 5
V2_GPIO_P1_13 => 27, -- Version 2, Pin P1-13
V2_GPIO_P1_15 => 22, -- Version 2, Pin P1-15
V2_GPIO_P1_16 => 23, -- Version 2, Pin P1-16
V2_GPIO_P1_18 => 24, -- Version 2, Pin P1-18
V2_GPIO_P1_19 => 10, -- Version 2, Pin P1-19, MOSI when SPI0 in use
V2_GPIO_P1_21 => 9, -- Version 2, Pin P1-21, MISO when SPI0 in use
V2_GPIO_P1_22 => 25, -- Version 2, Pin P1-22
V2_GPIO_P1_23 => 11, -- Version 2, Pin P1-23, CLK when SPI0 in use
V2_GPIO_P1_24 => 8, -- Version 2, Pin P1-24, CE0 when SPI0 in use
V2_GPIO_P1_26 => 7, -- Version 2, Pin P1-26, CE1 when SPI0 in use
V2_GPIO_P1_29 => 5, -- Version 2, Pin P1-29
V2_GPIO_P1_31 => 6, -- Version 2, Pin P1-31
V2_GPIO_P1_32 => 12, -- Version 2, Pin P1-32
V2_GPIO_P1_33 => 13, -- Version 2, Pin P1-33
V2_GPIO_P1_35 =>
19, -- Version 2, Pin P1-35, can be PWM channel 1 in ALT FUN 5
V2_GPIO_P1_36 => 16, -- Version 2, Pin P1-36
V2_GPIO_P1_37 => 26, -- Version 2, Pin P1-37
V2_GPIO_P1_38 => 20, -- Version 2, Pin P1-38
V2_GPIO_P1_40 => 21, -- Version 2, Pin P1-40
V2_GPIO_P5_03 => 28, -- Version 2, Pin P5-03
V2_GPIO_P5_04 => 29, -- Version 2, Pin P5-04
V2_GPIO_P5_05 => 30, -- Version 2, Pin P5-05
V2_GPIO_P5_06 => 31, -- Version 2, Pin P5-06
BPLUS_GPIO_J8_03 => 2, -- B+, Pin J8-03
BPLUS_GPIO_J8_05 => 3, -- B+, Pin J8-05
BPLUS_GPIO_J8_07 => 4, -- B+, Pin J8-07
BPLUS_GPIO_J8_08 =>
14, -- B+, Pin J8-08, defaults to alt function 0 UART0_TXD
BPLUS_GPIO_J8_10 =>
15, -- B+, Pin J8-10, defaults to alt function 0 UART0_RXD
BPLUS_GPIO_J8_11 => 17, -- B+, Pin J8-11
BPLUS_GPIO_J8_12 =>
18, -- B+, Pin J8-12, can be PWM channel 0 in ALT FUN 5
BPLUS_GPIO_J8_13 => 27, -- B+, Pin J8-13
BPLUS_GPIO_J8_15 => 22, -- B+, Pin J8-15
BPLUS_GPIO_J8_16 => 23, -- B+, Pin J8-16
BPLUS_GPIO_J8_18 => 24, -- B+, Pin J8-18
BPLUS_GPIO_J8_19 => 10, -- B+, Pin J8-19, MOSI when SPI0 in use
BPLUS_GPIO_J8_21 => 9, -- B+, Pin J8-21, MISO when SPI0 in use
BPLUS_GPIO_J8_22 => 25, -- B+, Pin J8-22
BPLUS_GPIO_J8_23 => 11, -- B+, Pin J8-23, CLK when SPI0 in use
BPLUS_GPIO_J8_24 => 8, -- B+, Pin J8-24, CE0 when SPI0 in use
BPLUS_GPIO_J8_26 => 7, -- B+, Pin J8-26, CE1 when SPI0 in use
BPLUS_GPIO_J8_29 => 5, -- B+, Pin J8-29,
BPLUS_GPIO_J8_31 => 6, -- B+, Pin J8-31,
BPLUS_GPIO_J8_32 => 12, -- B+, Pin J8-32,
BPLUS_GPIO_J8_33 => 13, -- B+, Pin J8-33,
BPLUS_GPIO_J8_35 =>
19, -- B+, Pin J8-35, can be PWM channel 1 in ALT FUN 5
BPLUS_GPIO_J8_36 => 16, -- B+, Pin J8-36,
BPLUS_GPIO_J8_37 => 26, -- B+, Pin J8-37,
BPLUS_GPIO_J8_38 => 20, -- B+, Pin J8-38,
BPLUS_GPIO_J8_40 =>
21 -- B+, Pin J8-40,
);
begin
return Lookup_Array (Pin_ID);
end Get_Pin_Number;
function Pin_Level_From_Uint is new Ada.Unchecked_Conversion
(Source => x86_64_linux_gnu_bits_stdint_uintn_h.uint8_t,
Target => Pin_State);
function Read (Pin : Pin_Type) return Pin_State is
begin
return Pin_Level_From_Uint (bcm2835_h.bcm2835_gpio_lev (Pin.Pin));
end Read;
procedure Turn_On (Pin : Pin_Type) is
begin
bcm2835_h.bcm2835_gpio_set (Pin.Pin);
end Turn_On;
procedure Turn_Off (Pin : Pin_Type) is
begin
bcm2835_h.bcm2835_gpio_clr (Pin.Pin);
end Turn_Off;
procedure Set (Pin : Pin_Type; State : Pin_State) is
begin
case State is
when On =>
Turn_On (Pin);
when Off =>
Turn_Off (Pin);
end case;
end Set;
end Raspio.GPIO;
|
-- reqrep_task_pool.ads
-- A task pool system for simple request-response activity
-- Copyright (c) 2015, James Humphry
--
-- 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 Profile(No_Implementation_Extensions);
with Ada.Exceptions;
with Ada.Task_Termination;
with Ada.Task_Identification;
package Reqrep_Task_Pools is
Default_Timeout : constant Duration := 60.0;
type Reqrep_Status is
(Ready, Enqueued, Active, Success, Failure, Unhandled_Exception, Timeout, Internal_Error);
subtype Reqrep_Return_Status is Reqrep_Status range Success .. Failure;
generic
type Reqrep is tagged private;
with function Execute
(R : in out Reqrep) return Reqrep_Return_Status is <>;
Number_Workers : Positive := 1;
package Task_Pool is
type Reqrep_Job is new Reqrep with private;
function Status (R : Reqrep_Job) return Reqrep_Status;
procedure Push_Job
(R : in Reqrep;
Timeout : Duration := Default_Timeout);
function Get_Result return Reqrep_Job
with Post => not (Status(Get_Result'Result) in Ready..Active);
function Get_Result return Reqrep;
procedure Get_Exception(E : out Ada.Exceptions.Exception_Occurrence);
procedure Discard_Exception;
procedure Shutdown;
function Active_Workers return Natural;
private
type Reqrep_Job is new Reqrep with record
Status : Reqrep_Status;
Timeout : Duration;
Shutdown : Boolean := False;
end record;
protected Termination_Handler is
procedure Handle_Termination(Cause : in Ada.Task_Termination.Cause_Of_Termination;
T : in Ada.Task_Identification.Task_Id;
X : in Ada.Exceptions.Exception_Occurrence);
end Termination_Handler;
Termination_Handler_Access : constant access protected procedure
(Cause : in Ada.Task_Termination.Cause_Of_Termination;
T : in Ada.Task_Identification.Task_Id;
X : in Ada.Exceptions.Exception_Occurrence)
:= Termination_Handler.Handle_Termination'Access;
end Task_Pool;
-- This exception is only used to test whether workers are restarted upon failure
Inject_Worker_Crash : exception;
end Reqrep_Task_Pools;
|
-----------------------------------------------------------------------
-- awa-images-servlets -- Serve files saved in the storage service
-- Copyright (C) 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.
-----------------------------------------------------------------------
package body AWA.Images.Servlets is
-- ------------------------------
-- Load the data content that correspond to the GET request and get the name as well
-- as mime-type and date.
-- ------------------------------
overriding
procedure Load (Server : in Image_Servlet;
Request : in out ASF.Requests.Request'Class;
Name : out Ada.Strings.Unbounded.Unbounded_String;
Mime : out Ada.Strings.Unbounded.Unbounded_String;
Date : out Ada.Calendar.Time;
Data : out ADO.Blob_Ref) is
begin
AWA.Storages.Servlets.Storage_Servlet (Server).Load (Request, Name, Mime, Date, Data);
Name := Ada.Strings.Unbounded.To_Unbounded_String ("");
end Load;
end AWA.Images.Servlets;
|
-- This file is covered by the Internet Software Consortium (ISC) License
-- Reference: ../License.txt
with Ada.Command_Line;
with Ada.Strings.Fixed;
with PortScan.Ops;
with PortScan.Packages;
with PortScan.Buildcycle.Ports;
with PortScan.Buildcycle.Pkgsrc;
with Signals;
with Unix;
package body PortScan.Pilot is
package CLI renames Ada.Command_Line;
package ASF renames Ada.Strings.Fixed;
package OPS renames PortScan.Ops;
package PKG renames PortScan.Packages;
package CYC renames PortScan.Buildcycle;
package FPC renames PortScan.Buildcycle.Ports;
package NPS renames PortScan.Buildcycle.Pkgsrc;
package SIG renames Signals;
---------------------
-- store_origins --
---------------------
function store_origins return Boolean
is
function trimmed_catport (S : String) return String;
function trimmed_catport (S : String) return String
is
last : constant Natural := S'Last;
begin
if S (last) = '/' then
return S (S'First .. last - 1);
else
return S (S'First .. last);
end if;
end trimmed_catport;
begin
if CLI.Argument_Count <= 1 then
return False;
end if;
portlist.Clear;
load_index_for_store_origins;
if CLI.Argument_Count = 2 then
-- Check if this is a file
declare
Arg2 : constant String := trimmed_catport (CLI.Argument (2));
vfresult : Boolean;
begin
if AD.Exists (Arg2) then
vfresult := valid_file (Arg2);
clear_store_origin_data;
return vfresult;
end if;
if input_origin_valid (candidate => Arg2) then
if Arg2 /= pkgng then
plinsert (Arg2, 2);
end if;
clear_store_origin_data;
return True;
else
suggest_flavor_for_bad_origin (candidate => Arg2);
clear_store_origin_data;
return False;
end if;
end;
end if;
for k in 2 .. CLI.Argument_Count loop
declare
Argk : constant String := trimmed_catport (CLI.Argument (k));
begin
if input_origin_valid (candidate => Argk) then
if Argk /= pkgng then
plinsert (Argk, k);
end if;
else
suggest_flavor_for_bad_origin (candidate => Argk);
clear_store_origin_data;
return False;
end if;
end;
end loop;
clear_store_origin_data;
return True;
end store_origins;
-------------------------------
-- prerequisites_available --
-------------------------------
function prerequisites_available return Boolean is
begin
case software_framework is
when ports_collection => return build_pkg8_as_necessary;
when pkgsrc => return build_pkgsrc_prerequisites;
end case;
end prerequisites_available;
-------------------------------
-- build_pkg8_as_necessary --
-------------------------------
function build_pkg8_as_necessary return Boolean
is
pkg_good : Boolean;
good_scan : Boolean;
stop_now : Boolean;
selection : PortScan.port_id;
result : Boolean := True;
begin
OPS.initialize_hooks;
REP.initialize (testmode => False, num_cores => PortScan.cores_available);
REP.launch_slave (id => PortScan.scan_slave, opts => noprocs);
good_scan := PortScan.scan_single_port (catport => pkgng,
always_build => False,
fatal => stop_now);
if good_scan then
PortScan.set_build_priority;
else
TIO.Put_Line ("Unexpected pkg(8) scan failure!");
result := False;
goto clean_exit;
end if;
PKG.limited_sanity_check
(repository => JT.USS (PM.configuration.dir_repository),
dry_run => False, suppress_remote => True);
if SIG.graceful_shutdown_requested or else PKG.queue_is_empty then
goto clean_exit;
end if;
CYC.initialize (test_mode => False, jail_env => REP.jail_environment);
selection := OPS.top_buildable_port;
if SIG.graceful_shutdown_requested or else selection = port_match_failed
then
goto clean_exit;
end if;
TIO.Put ("Stand by, building pkg(8) first ... ");
pkg_good := FPC.build_package (id => PortScan.scan_slave,
sequence_id => selection);
OPS.run_hook_after_build (pkg_good, selection);
if not pkg_good then
TIO.Put_Line ("Failed!!" & bailing);
result := False;
goto clean_exit;
end if;
TIO.Put_Line ("done!");
<<clean_exit>>
if SIG.graceful_shutdown_requested then
TIO.Put_Line (shutreq);
result := False;
end if;
REP.destroy_slave (id => PortScan.scan_slave, opts => noprocs);
REP.finalize;
reset_ports_tree;
return result;
end build_pkg8_as_necessary;
----------------------------------
-- build_pkgsrc_prerequisites --
----------------------------------
function build_pkgsrc_prerequisites return Boolean
is
function scan_it (the_catport : String) return Boolean;
function build_it (desc : String) return Boolean;
mk_files : constant String := "pkgtools/bootstrap-mk-files";
cp_bmake : constant String := "devel/bmake";
cp_digest : constant String := "pkgtools/digest";
result : Boolean := True;
function scan_it (the_catport : String) return Boolean
is
good_scan : Boolean;
stop_now : Boolean;
begin
good_scan := PortScan.scan_single_port (catport => the_catport,
always_build => False,
fatal => stop_now);
if good_scan then
PortScan.set_build_priority;
else
TIO.Put_Line ("Unexpected " & the_catport & " scan failure!");
return False;
end if;
PKG.limited_sanity_check
(repository => JT.USS (PM.configuration.dir_repository),
dry_run => False, suppress_remote => True);
if SIG.graceful_shutdown_requested then
return False;
end if;
return True;
end scan_it;
function build_it (desc : String) return Boolean
is
pkg_good : Boolean;
selection : PortScan.port_id;
begin
CYC.initialize (test_mode => False, jail_env => REP.jail_environment);
selection := OPS.top_buildable_port;
if SIG.graceful_shutdown_requested or else selection = port_match_failed
then
return False;
end if;
TIO.Put ("Stand by, building " & desc & " package ... ");
pkg_good := NPS.build_package (id => PortScan.scan_slave,
sequence_id => selection);
OPS.run_hook_after_build (pkg_good, selection);
if not pkg_good then
TIO.Put_Line ("Failed!!" & bailing);
return False;
end if;
TIO.Put_Line ("done!");
return True;
end build_it;
begin
OPS.initialize_hooks;
REP.initialize (testmode => False, num_cores => PortScan.cores_available);
REP.launch_slave (id => PortScan.scan_slave, opts => npsboot);
if not PLAT.host_pkgsrc_mk_install (id => PortScan.scan_slave) or else
not PLAT.host_pkgsrc_bmake_install (id => PortScan.scan_slave) or else
not PLAT.host_pkgsrc_pkg8_install (id => PortScan.scan_slave)
then
TIO.Put_Line ("Failed to install programs from host system.");
result := False;
goto clean_exit;
end if;
result := scan_it (mk_files);
if not result then
goto clean_exit;
end if;
if not PKG.queue_is_empty then
-- the mk files package does not exist or requires rebuilding
result := build_it ("mk files");
if not result then
goto clean_exit;
end if;
end if;
reset_ports_tree;
result := scan_it (cp_bmake);
if not result then
goto clean_exit;
end if;
if not PKG.queue_is_empty then
-- the bmake package does not exist or requires rebuilding
result := build_it ("bmake");
if not result then
goto clean_exit;
end if;
end if;
reset_ports_tree;
result := scan_it (cp_digest);
if not result then
goto clean_exit;
end if;
if not PKG.queue_is_empty then
-- the digest package does not exist or requires rebuilding
result := build_it ("digest");
if not result then
goto clean_exit;
end if;
end if;
reset_ports_tree;
result := scan_it (pkgng);
if not result then
goto clean_exit;
end if;
if not PKG.queue_is_empty then
-- the pkg(8) package does not exist or requires rebuilding
result := build_it ("pkg(8)");
end if;
<<clean_exit>>
if SIG.graceful_shutdown_requested then
TIO.Put_Line (shutreq);
result := False;
end if;
REP.destroy_slave (id => PortScan.scan_slave, opts => noprocs);
REP.finalize;
reset_ports_tree;
return result;
end build_pkgsrc_prerequisites;
----------------------------------
-- scan_stack_of_single_ports --
----------------------------------
function scan_stack_of_single_ports (testmode : Boolean;
always_build : Boolean := False)
return Boolean
is
procedure scan (plcursor : portkey_crate.Cursor);
successful : Boolean := True;
just_stop_now : Boolean;
procedure scan (plcursor : portkey_crate.Cursor)
is
origin : constant String := JT.USS (portkey_crate.Key (plcursor));
begin
if not successful then
return;
end if;
if origin = pkgng then
-- we've already built pkg(8) if we get here, just skip it
return;
end if;
if SIG.graceful_shutdown_requested then
successful := False;
return;
end if;
if not PortScan.scan_single_port (origin, always_build, just_stop_now)
then
if just_stop_now then
successful := False;
else
TIO.Put_Line
("Scan of " & origin & " failed" & PortScan.obvious_problem
(JT.USS (PM.configuration.dir_portsdir), origin) &
", it will not be considered.");
end if;
end if;
end scan;
begin
REP.initialize (testmode, PortScan.cores_available);
REP.launch_slave (id => PortScan.scan_slave, opts => noprocs);
if SIG.graceful_shutdown_requested then
goto clean_exit;
end if;
if not PLAT.standalone_pkg8_install (PortScan.scan_slave) then
TIO.Put_Line ("Failed to install pkg(8) scanner" & bailing);
successful := False;
goto clean_exit;
end if;
portlist.Iterate (Process => scan'Access);
if successful then
PortScan.set_build_priority;
if PKG.queue_is_empty then
successful := False;
TIO.Put_Line ("There are no valid ports to build." & bailing);
end if;
end if;
<<clean_exit>>
if SIG.graceful_shutdown_requested then
successful := False;
TIO.Put_Line (shutreq);
end if;
REP.destroy_slave (id => PortScan.scan_slave, opts => noprocs);
REP.finalize;
return successful;
end scan_stack_of_single_ports;
---------------------------------
-- sanity_check_then_prefail --
---------------------------------
function sanity_check_then_prefail (delete_first : Boolean := False;
dry_run : Boolean := False)
return Boolean
is
procedure force_delete (plcursor : portkey_crate.Cursor);
ptid : PortScan.port_id;
num_skipped : Natural;
block_remote : Boolean := True;
update_external_repo : constant String := host_pkg8 &
" update --quiet --repository ";
no_packages : constant String :=
"No prebuilt packages will be used as a result.";
procedure force_delete (plcursor : portkey_crate.Cursor)
is
origin : JT.Text := portkey_crate.Key (plcursor);
pndx : constant port_index := ports_keys.Element (origin);
tball : constant String := JT.USS (PM.configuration.dir_repository) &
"/" & JT.USS (all_ports (pndx).package_name);
begin
if AD.Exists (tball) then
AD.Delete_File (tball);
end if;
end force_delete;
begin
start_time := CAL.Clock;
if delete_first and then not dry_run then
portlist.Iterate (Process => force_delete'Access);
end if;
case software_framework is
when ports_collection =>
if not PKG.limited_cached_options_check then
-- Error messages emitted by function
return False;
end if;
when pkgsrc =>
-- There's no analog to cached options on pkgsc.
-- We could detect unused settings, but that's it.
-- And maybe that should be detected by the framework itself
null;
end case;
if PM.configuration.defer_prebuilt then
-- Before any remote operations, find the external repo
if PKG.located_external_repository then
block_remote := False;
-- We're going to use prebuilt packages if available, so let's
-- prepare for that case by updating the external repository
TIO.Put ("Stand by, updating external repository catalogs ... ");
if not Unix.external_command (update_external_repo &
PKG.top_external_repository)
then
TIO.Put_Line ("Failed!");
TIO.Put_Line ("The external repository could not be updated.");
TIO.Put_Line (no_packages);
block_remote := True;
else
TIO.Put_Line ("done.");
end if;
else
TIO.Put_Line ("The external repository does not seem to be " &
"configured.");
TIO.Put_Line (no_packages);
end if;
end if;
OPS.run_start_hook;
PKG.limited_sanity_check
(repository => JT.USS (PM.configuration.dir_repository),
dry_run => dry_run, suppress_remote => block_remote);
bld_counter := (OPS.queue_length, 0, 0, 0, 0);
if dry_run then
return True;
end if;
if SIG.graceful_shutdown_requested then
TIO.Put_Line (shutreq);
return False;
end if;
OPS.delete_existing_web_history_files;
start_logging (total);
start_logging (ignored);
start_logging (skipped);
start_logging (success);
start_logging (failure);
loop
ptid := OPS.next_ignored_port;
exit when ptid = PortScan.port_match_failed;
exit when SIG.graceful_shutdown_requested;
bld_counter (ignored) := bld_counter (ignored) + 1;
TIO.Put_Line (Flog (total), CYC.elapsed_now & " " &
OPS.port_name (ptid) & " has been ignored: " &
OPS.ignore_reason (ptid));
TIO.Put_Line (Flog (ignored), CYC.elapsed_now & " " &
OPS.port_name (ptid) & ": " &
OPS.ignore_reason (ptid));
OPS.cascade_failed_build (id => ptid,
numskipped => num_skipped,
logs => Flog);
OPS.record_history_ignored (elapsed => CYC.elapsed_now,
origin => OPS.port_name (ptid),
reason => OPS.ignore_reason (ptid),
skips => num_skipped);
bld_counter (skipped) := bld_counter (skipped) + num_skipped;
end loop;
stop_logging (ignored);
TIO.Put_Line (Flog (total), CYC.elapsed_now & " Sanity check complete. "
& "Ports remaining to build:" & OPS.queue_length'Img);
TIO.Flush (Flog (total));
if SIG.graceful_shutdown_requested then
TIO.Put_Line (shutreq);
else
if OPS.integrity_intact then
return True;
end if;
end if;
-- If here, we either got control-C or failed integrity check
if not SIG.graceful_shutdown_requested then
TIO.Put_Line ("Queue integrity lost! " & bailing);
end if;
stop_logging (total);
stop_logging (skipped);
stop_logging (success);
stop_logging (failure);
return False;
end sanity_check_then_prefail;
------------------------
-- perform_bulk_run --
------------------------
procedure perform_bulk_run (testmode : Boolean)
is
num_builders : constant builders := PM.configuration.num_builders;
show_tally : Boolean := True;
begin
if PKG.queue_is_empty then
TIO.Put_Line ("After inspection, it has been determined that there " &
"are no packages that");
TIO.Put_Line ("require rebuilding; the task is therefore complete.");
show_tally := False;
else
REP.initialize (testmode, PortScan.cores_available);
CYC.initialize (testmode, REP.jail_environment);
OPS.initialize_web_report (num_builders);
OPS.initialize_display (num_builders);
OPS.parallel_bulk_run (num_builders, Flog);
REP.finalize;
end if;
stop_time := CAL.Clock;
stop_logging (total);
stop_logging (success);
stop_logging (failure);
stop_logging (skipped);
if show_tally then
TIO.Put_Line (LAT.LF & LAT.LF);
TIO.Put_Line ("The task is complete. Final tally:");
TIO.Put_Line ("Initial queue size:" & bld_counter (total)'Img);
TIO.Put_Line (" packages built:" & bld_counter (success)'Img);
TIO.Put_Line (" ignored:" & bld_counter (ignored)'Img);
TIO.Put_Line (" skipped:" & bld_counter (skipped)'Img);
TIO.Put_Line (" failed:" & bld_counter (failure)'Img);
TIO.Put_Line ("");
TIO.Put_Line (CYC.log_duration (start_time, stop_time));
TIO.Put_Line ("The build logs can be found at: " &
JT.USS (PM.configuration.dir_logs));
end if;
end perform_bulk_run;
-------------------------------------------
-- verify_desire_to_rebuild_repository --
-------------------------------------------
function verify_desire_to_rebuild_repository return Boolean
is
answer : Boolean;
YN : Character;
screen_present : constant Boolean := Unix.screen_attached;
begin
if not screen_present then
return False;
end if;
if SIG.graceful_shutdown_requested then
-- catch previous shutdown request
return False;
end if;
Unix.cone_of_silence (deploy => False);
TIO.Put ("Would you like to rebuild the local repository (Y/N)? ");
loop
TIO.Get_Immediate (YN);
case YN is
when 'Y' | 'y' =>
answer := True;
exit;
when 'N' | 'n' =>
answer := False;
exit;
when others => null;
end case;
end loop;
TIO.Put (YN & LAT.LF);
Unix.cone_of_silence (deploy => True);
return answer;
end verify_desire_to_rebuild_repository;
-----------------------------------------
-- verify_desire_to_install_packages --
-----------------------------------------
function verify_desire_to_install_packages return Boolean is
answer : Boolean;
YN : Character;
begin
Unix.cone_of_silence (deploy => False);
TIO.Put ("Would you like to upgrade your system with the new packages now (Y/N)? ");
loop
TIO.Get_Immediate (YN);
case YN is
when 'Y' | 'y' =>
answer := True;
exit;
when 'N' | 'n' =>
answer := False;
exit;
when others => null;
end case;
end loop;
TIO.Put (YN & LAT.LF);
Unix.cone_of_silence (deploy => True);
return answer;
end verify_desire_to_install_packages;
-----------------------------
-- fully_scan_ports_tree --
-----------------------------
function fully_scan_ports_tree return Boolean
is
goodresult : Boolean;
begin
PortScan.reset_ports_tree;
REP.initialize (testmode => False, num_cores => PortScan.cores_available);
REP.launch_slave (id => PortScan.scan_slave, opts => noprocs);
case software_framework is
when ports_collection => null;
when pkgsrc =>
if not PLAT.standalone_pkg8_install (PortScan.scan_slave) then
TIO.Put_Line ("Full Tree Scan: Failed to bootstrap builder");
end if;
end case;
goodresult := PortScan.scan_entire_ports_tree
(JT.USS (PM.configuration.dir_portsdir));
REP.destroy_slave (id => PortScan.scan_slave, opts => noprocs);
REP.finalize;
if goodresult then
PortScan.set_build_priority;
return True;
else
if SIG.graceful_shutdown_requested then
TIO.Put_Line (shutreq);
else
TIO.Put_Line ("Failed to scan ports tree " & bailing);
end if;
CLI.Set_Exit_Status (1);
return False;
end if;
end fully_scan_ports_tree;
---------------------------------
-- rebuild_local_respository --
---------------------------------
function rebuild_local_respository (remove_invalid_packages : Boolean) return Boolean
is
repo : constant String := JT.USS (PM.configuration.dir_repository);
main : constant String := JT.USS (PM.configuration.dir_packages);
xz_meta : constant String := main & "/meta.txz";
xz_digest : constant String := main & "/digests.txz";
xz_pkgsite : constant String := main & "/packagesite.txz";
bs_error : constant String := "Rebuild Repository: Failed to bootstrap builder";
build_res : Boolean;
begin
if SIG.graceful_shutdown_requested then
-- In case it was previously requested
return False;
end if;
if remove_invalid_packages then
REP.initialize (testmode => False,
num_cores => PortScan.cores_available);
REP.launch_slave (id => PortScan.scan_slave, opts => noprocs);
case software_framework is
when ports_collection => null;
when pkgsrc =>
if not PLAT.standalone_pkg8_install (PortScan.scan_slave) then
TIO.Put_Line (bs_error);
end if;
end case;
PKG.preclean_repository (repo);
REP.destroy_slave (id => PortScan.scan_slave, opts => noprocs);
REP.finalize;
if SIG.graceful_shutdown_requested then
TIO.Put_Line (shutreq);
return False;
end if;
end if;
TIO.Put ("Stand by, recursively scanning");
if Natural (portlist.Length) = 1 then
TIO.Put (" 1 port");
else
TIO.Put (portlist.Length'Img & " ports");
end if;
TIO.Put_Line (" serially.");
PortScan.reset_ports_tree;
if scan_stack_of_single_ports (testmode => False) then
PKG.limited_sanity_check (repository => repo,
dry_run => False,
suppress_remote => True);
if SIG.graceful_shutdown_requested then
TIO.Put_Line (shutreq);
return False;
end if;
else
return False;
end if;
if AD.Exists (xz_meta) then
AD.Delete_File (xz_meta);
end if;
if AD.Exists (xz_digest) then
AD.Delete_File (xz_digest);
end if;
if AD.Exists (xz_pkgsite) then
AD.Delete_File (xz_pkgsite);
end if;
TIO.Put_Line ("Packages validated, rebuilding local repository.");
REP.initialize (testmode => False, num_cores => PortScan.cores_available);
REP.launch_slave (id => PortScan.scan_slave, opts => noprocs);
case software_framework is
when ports_collection => null;
when pkgsrc =>
if not PLAT.standalone_pkg8_install (PortScan.scan_slave) then
TIO.Put_Line (bs_error);
end if;
end case;
if valid_signing_command then
build_res := REP.build_repository (id => PortScan.scan_slave,
sign_command => signing_command);
elsif acceptable_RSA_signing_support then
build_res := REP.build_repository (PortScan.scan_slave);
else
build_res := False;
end if;
REP.destroy_slave (id => PortScan.scan_slave, opts => noprocs);
REP.finalize;
if build_res then
TIO.Put_Line ("Local repository successfully rebuilt");
return True;
else
TIO.Put_Line ("Failed to rebuild repository" & bailing);
return False;
end if;
end rebuild_local_respository;
------------------
-- valid_file --
------------------
function valid_file (path : String) return Boolean
is
handle : TIO.File_Type;
good : Boolean;
total : Natural := 0;
begin
TIO.Open (File => handle, Mode => TIO.In_File, Name => path);
good := True;
while not TIO.End_Of_File (handle) loop
declare
line : constant String := JT.trim (TIO.Get_Line (handle));
begin
if not JT.IsBlank (line) then
if input_origin_valid (candidate => line) then
plinsert (line, total);
total := total + 1;
else
suggest_flavor_for_bad_origin (candidate => line);
good := False;
exit;
end if;
end if;
end;
end loop;
TIO.Close (handle);
return (total > 0) and then good;
exception
when others => return False;
end valid_file;
----------------
-- plinsert --
----------------
procedure plinsert (key : String; dummy : Natural)
is
key2 : JT.Text := JT.SUS (key);
ptid : constant PortScan.port_id := PortScan.port_id (dummy);
begin
if not portlist.Contains (key2) then
portlist.Insert (key2, ptid);
duplist.Insert (key2, ptid);
end if;
end plinsert;
---------------------
-- start_logging --
---------------------
procedure start_logging (flavor : count_type)
is
logpath : constant String := JT.USS (PM.configuration.dir_logs)
& "/" & logname (flavor);
begin
if AD.Exists (logpath) then
AD.Delete_File (logpath);
end if;
TIO.Create (File => Flog (flavor),
Mode => TIO.Out_File,
Name => logpath);
if flavor = total then
TIO.Put_Line (Flog (flavor), "-=> Chronology of last build <=-");
TIO.Put_Line (Flog (flavor), "Started: " & timestamp (start_time));
TIO.Put_Line (Flog (flavor), "Ports to build:" &
PKG.original_queue_size'Img);
TIO.Put_Line (Flog (flavor), "");
TIO.Put_Line (Flog (flavor), "Purging any ignored/broken ports " &
"first ...");
TIO.Flush (Flog (flavor));
end if;
exception
when others =>
raise pilot_log
with "Failed to create or delete " & logpath & bailing;
end start_logging;
--------------------
-- stop_logging --
--------------------
procedure stop_logging (flavor : count_type) is
begin
if flavor = total then
TIO.Put_Line (Flog (flavor), "Finished: " & timestamp (stop_time));
TIO.Put_Line (Flog (flavor), CYC.log_duration (start => start_time,
stop => stop_time));
TIO.Put_Line
(Flog (flavor), LAT.LF &
"---------------------------" & LAT.LF &
"-- Final Statistics" & LAT.LF &
"---------------------------" & LAT.LF &
" Initial queue size:" & bld_counter (total)'Img & LAT.LF &
" packages built:" & bld_counter (success)'Img & LAT.LF &
" ignored:" & bld_counter (ignored)'Img & LAT.LF &
" skipped:" & bld_counter (skipped)'Img & LAT.LF &
" failed:" & bld_counter (failure)'Img);
end if;
TIO.Close (Flog (flavor));
end stop_logging;
-----------------------
-- purge_distfiles --
-----------------------
procedure purge_distfiles
is
type disktype is mod 2**64;
procedure scan (plcursor : portkey_crate.Cursor);
procedure kill (plcursor : portkey_crate.Cursor);
procedure walk (name : String);
function display_kmg (number : disktype) return String;
abort_purge : Boolean := False;
bytes_purged : disktype := 0;
distfiles : portkey_crate.Map;
rmfiles : portkey_crate.Map;
procedure scan (plcursor : portkey_crate.Cursor)
is
origin : JT.Text := portkey_crate.Key (plcursor);
tracker : constant port_id := portkey_crate.Element (plcursor);
pndx : constant port_index := ports_keys.Element (origin);
distinfo : constant String := JT.USS (PM.configuration.dir_portsdir) &
"/" & JT.USS (origin) & "/distinfo";
handle : TIO.File_Type;
bookend : Natural;
begin
TIO.Open (File => handle, Mode => TIO.In_File, Name => distinfo);
while not TIO.End_Of_File (handle) loop
declare
Line : String := TIO.Get_Line (handle);
begin
if Line (1 .. 4) = "SIZE" then
bookend := ASF.Index (Line, ")");
declare
S : JT.Text := JT.SUS (Line (7 .. bookend - 1));
begin
if not distfiles.Contains (S) then
distfiles.Insert (S, tracker);
end if;
exception
when failed : others =>
TIO.Put_Line ("purge_distfiles::scan: " & JT.USS (S));
TIO.Put_Line (EX.Exception_Information (failed));
end;
end if;
end;
end loop;
TIO.Close (handle);
exception
when others =>
if TIO.Is_Open (handle) then
TIO.Close (handle);
end if;
end scan;
procedure walk (name : String)
is
procedure walkdir (item : AD.Directory_Entry_Type);
procedure print (item : AD.Directory_Entry_Type);
uniqid : port_id := 0;
leftindent : Natural :=
JT.SU.Length (PM.configuration.dir_distfiles) + 2;
procedure walkdir (item : AD.Directory_Entry_Type) is
begin
if AD.Simple_Name (item) /= "." and then
AD.Simple_Name (item) /= ".."
then
walk (AD.Full_Name (item));
end if;
exception
when AD.Name_Error =>
abort_purge := True;
TIO.Put_Line ("walkdir: " & name & " directory does not exist");
end walkdir;
procedure print (item : AD.Directory_Entry_Type)
is
FN : constant String := AD.Full_Name (item);
tball : JT.Text := JT.SUS (FN (leftindent .. FN'Last));
begin
if not distfiles.Contains (tball) then
if not rmfiles.Contains (tball) then
uniqid := uniqid + 1;
rmfiles.Insert (Key => tball, New_Item => uniqid);
bytes_purged := bytes_purged + disktype (AD.Size (FN));
end if;
end if;
end print;
begin
AD.Search (name, "*", (AD.Ordinary_File => True, others => False),
print'Access);
AD.Search (name, "", (AD.Directory => True, others => False),
walkdir'Access);
exception
when AD.Name_Error =>
abort_purge := True;
TIO.Put_Line ("The " & name & " directory does not exist");
when AD.Use_Error =>
abort_purge := True;
TIO.Put_Line ("Searching " & name & " directory is not supported");
when failed : others =>
abort_purge := True;
TIO.Put_Line ("purge_distfiles: Unknown error - directory search");
TIO.Put_Line (EX.Exception_Information (failed));
end walk;
function display_kmg (number : disktype) return String
is
type kmgtype is delta 0.01 digits 6;
kilo : constant disktype := 1024;
mega : constant disktype := kilo * kilo;
giga : constant disktype := kilo * mega;
XXX : kmgtype;
begin
if number > giga then
XXX := kmgtype (number / giga);
return XXX'Img & " gigabytes";
elsif number > mega then
XXX := kmgtype (number / mega);
return XXX'Img & " megabytes";
else
XXX := kmgtype (number / kilo);
return XXX'Img & " kilobytes";
end if;
end display_kmg;
procedure kill (plcursor : portkey_crate.Cursor)
is
tarball : String := JT.USS (portkey_crate.Key (plcursor));
path : JT.Text := PM.configuration.dir_distfiles;
begin
JT.SU.Append (path, "/" & tarball);
TIO.Put_Line ("Deleting " & tarball);
AD.Delete_File (JT.USS (path));
end kill;
begin
read_flavor_index;
TIO.Put ("Scanning the distinfo file of every port in the tree ... ");
ports_keys.Iterate (Process => scan'Access);
TIO.Put_Line ("done");
walk (name => JT.USS (PM.configuration.dir_distfiles));
if abort_purge then
TIO.Put_Line ("Distfile purge operation aborted.");
else
rmfiles.Iterate (kill'Access);
TIO.Put_Line ("Recovered" & display_kmg (bytes_purged));
end if;
end purge_distfiles;
------------------------------------------
-- write_pkg_repos_configuration_file --
------------------------------------------
function write_pkg_repos_configuration_file return Boolean
is
repdir : constant String := get_repos_dir;
target : constant String := repdir & "/00_synth.conf";
pkgdir : constant String := JT.USS (PM.configuration.dir_packages);
pubkey : constant String := PM.synth_confdir & "/" &
JT.USS (PM.configuration.profile) & "-public.key";
keydir : constant String := PM.synth_confdir & "/keys";
tstdir : constant String := keydir & "/trusted";
autgen : constant String := "# Automatically generated." & LAT.LF;
fpfile : constant String := tstdir & "/fingerprint." &
JT.USS (PM.configuration.profile);
handle : TIO.File_Type;
vscmd : Boolean := False;
begin
if AD.Exists (target) then
AD.Delete_File (target);
elsif not AD.Exists (repdir) then
AD.Create_Path (repdir);
end if;
TIO.Create (File => handle, Mode => TIO.Out_File, Name => target);
TIO.Put_Line (handle, autgen);
TIO.Put_Line (handle, "Synth: {");
TIO.Put_Line (handle, " url : file://" & pkgdir & ",");
TIO.Put_Line (handle, " priority : 0,");
TIO.Put_Line (handle, " enabled : yes,");
if valid_signing_command then
vscmd := True;
TIO.Put_Line (handle, " signature_type : FINGERPRINTS,");
TIO.Put_Line (handle, " fingerprints : " & keydir);
elsif set_synth_conf_with_RSA then
TIO.Put_Line (handle, " signature_type : PUBKEY,");
TIO.Put_Line (handle, " pubkey : " & pubkey);
end if;
TIO.Put_Line (handle, "}");
TIO.Close (handle);
if vscmd then
if AD.Exists (fpfile) then
AD.Delete_File (fpfile);
elsif not AD.Exists (tstdir) then
AD.Create_Path (tstdir);
end if;
TIO.Create (File => handle, Mode => TIO.Out_File, Name => fpfile);
TIO.Put_Line (handle, autgen);
TIO.Put_Line (handle, "function : sha256");
TIO.Put_Line (handle, "fingerprint : " & profile_fingerprint);
TIO.Close (handle);
end if;
return True;
exception
when others =>
TIO.Put_Line ("Error: failed to create " & target);
if TIO.Is_Open (handle) then
TIO.Close (handle);
end if;
return False;
end write_pkg_repos_configuration_file;
---------------------------------
-- upgrade_system_everything --
---------------------------------
procedure upgrade_system_everything (skip_installation : Boolean := False;
dry_run : Boolean := False)
is
command : constant String := host_pkg8 &
" upgrade --yes --repository Synth";
query : constant String := host_pkg8 & " query -a %o:%n";
sorry : constant String := "Unfortunately, the system upgrade failed.";
begin
if not prescanned then
read_flavor_index;
end if;
portlist.Clear;
TIO.Put_Line ("Querying system about current package installations.");
begin
declare
comres : constant String := JT.USS (CYC.generic_system_command (query));
markers : JT.Line_Markers;
uniqid : Natural := 0;
begin
JT.initialize_markers (comres, markers);
loop
exit when not JT.next_line_present (comres, markers);
declare
line : constant String := JT.extract_line (comres, markers);
origin : constant String := JT.part_1 (line, ":");
pkgbase : constant String := JT.part_2 (line, ":");
flvquery : constant String := host_pkg8 & " query %At:%Av " & pkgbase;
errprefix : constant String := "Installed package ignored, ";
origintxt : JT.Text := JT.SUS (origin);
target_id : port_id := port_match_failed;
maxprobe : port_index := port_index (so_serial.Length) - 1;
found_it : Boolean := False;
flvresult : JT.Text;
begin
-- This approach isn't the greatest, but we're missing information.
-- At this port, all_ports array is not populated, so we can't compare the
-- package names to determine flavors. So what we do is search so_serial
-- for the origin. If it exists, the port has no flavors and we take the
-- target id. Otherwise, we have to query the system for the installed
-- flavor. It it fail on pre-flavor installations, though. Once all packages
-- are completely replaced, this approach should work fine.
if so_porthash.Contains (origintxt) then
if so_serial.Contains (origintxt) then
target_id := so_porthash.Element (origintxt);
found_it := True;
else
flvresult := CYC.generic_system_command (flvquery);
declare
contents : constant String := JT.USS (flvresult);
markers : JT.Line_Markers;
begin
JT.initialize_markers (contents, markers);
if JT.next_line_with_content_present (contents, "flavor:", markers) then
declare
line : constant String := JT.extract_line (contents, markers);
flvorigin : JT.Text;
begin
flvorigin := JT.SUS (origin & "@" & JT.part_2 (line, ":"));
if so_serial.Contains (flvorigin) then
target_id := so_serial.Find_Index (flvorigin);
found_it := True;
end if;
end;
end if;
end;
end if;
if found_it then
uniqid := uniqid + 1;
plinsert (get_catport (all_ports (target_id)), uniqid);
else
TIO.Put_Line (errprefix & origin & " package unmatched");
end if;
else
TIO.Put_Line (errprefix & "missing from ports: " & origin);
end if;
end;
end loop;
end;
exception
when others =>
TIO.Put_Line (sorry & " (system query)");
return;
end;
TIO.Put_Line ("Stand by, comparing installed packages against the ports tree.");
if prerequisites_available and then
scan_stack_of_single_ports (testmode => False) and then
sanity_check_then_prefail (delete_first => False, dry_run => dry_run)
then
if dry_run then
display_results_of_dry_run;
return;
else
perform_bulk_run (testmode => False);
end if;
else
if not SIG.graceful_shutdown_requested then
TIO.Put_Line (sorry);
end if;
return;
end if;
if SIG.graceful_shutdown_requested then
return;
end if;
if rebuild_local_respository (remove_invalid_packages => True) then
if not skip_installation then
if not Unix.external_command (command) then
TIO.Put_Line (sorry);
end if;
end if;
end if;
end upgrade_system_everything;
------------------------------
-- upgrade_system_exactly --
------------------------------
procedure upgrade_system_exactly
is
procedure build_train (plcursor : portkey_crate.Cursor);
base_command : constant String := host_pkg8 &
" install --yes --repository Synth";
caboose : JT.Text;
procedure build_train (plcursor : portkey_crate.Cursor)
is
full_origin : JT.Text renames portkey_crate.Key (plcursor);
pix : constant port_index := ports_keys.Element (full_origin);
pkgfile : constant String := JT.USS (all_ports (pix).package_name);
begin
JT.SU.Append (caboose, " " & JT.head (pkgfile, "."));
end build_train;
begin
duplist.Iterate (Process => build_train'Access);
declare
command : constant String := base_command & JT.USS (caboose);
begin
if not Unix.external_command (command) then
TIO.Put_Line ("Unfortunately, the system upgraded failed.");
end if;
end;
end upgrade_system_exactly;
-------------------------------
-- insufficient_privileges --
-------------------------------
function insufficient_privileges return Boolean
is
command : constant String := "/usr/bin/id -u";
result : JT.Text := CYC.generic_system_command (command);
topline : JT.Text;
begin
JT.nextline (lineblock => result, firstline => topline);
declare
resint : constant Integer := Integer'Value (JT.USS (topline));
begin
return (resint /= 0);
end;
end insufficient_privileges;
---------------
-- head_n1 --
---------------
function head_n1 (filename : String) return String
is
handle : TIO.File_Type;
begin
TIO.Open (File => handle, Mode => TIO.In_File, Name => filename);
if TIO.End_Of_File (handle) then
TIO.Close (handle);
return "";
end if;
declare
line : constant String := TIO.Get_Line (handle);
begin
TIO.Close (handle);
return line;
end;
end head_n1;
-----------------------
-- already_running --
-----------------------
function already_running return Boolean
is
pid : Integer;
comres : JT.Text;
begin
if AD.Exists (pidfile) then
declare
textpid : constant String := head_n1 (pidfile);
command : constant String := "/bin/ps -p " & textpid;
begin
-- test if valid by converting it (exception if fails)
pid := Integer'Value (textpid);
-- exception raised by line below if pid not found.
comres := CYC.generic_system_command (command);
if JT.contains (comres, "synth") then
return True;
else
-- pidfile is obsolete, remove it.
AD.Delete_File (pidfile);
return False;
end if;
exception
when others =>
-- pidfile contains garbage, remove it
AD.Delete_File (pidfile);
return False;
end;
end if;
return False;
end already_running;
-----------------------
-- destroy_pidfile --
-----------------------
procedure destroy_pidfile is
begin
if AD.Exists (pidfile) then
AD.Delete_File (pidfile);
end if;
exception
when others => null;
end destroy_pidfile;
----------------------
-- create_pidfile --
----------------------
procedure create_pidfile
is
pidtext : constant String := JT.int2str (Get_PID);
handle : TIO.File_Type;
begin
TIO.Create (File => handle, Mode => TIO.Out_File, Name => pidfile);
TIO.Put_Line (handle, pidtext);
TIO.Close (handle);
end create_pidfile;
------------------------------
-- set_replicant_platform --
------------------------------
procedure set_replicant_platform is
begin
REP.set_platform;
end set_replicant_platform;
------------------------------------
-- previous_run_mounts_detected --
------------------------------------
function previous_run_mounts_detected return Boolean is
begin
return REP.synth_mounts_exist;
end previous_run_mounts_detected;
-------------------------------------
-- previous_realfs_work_detected --
-------------------------------------
function previous_realfs_work_detected return Boolean is
begin
return REP.disk_workareas_exist;
end previous_realfs_work_detected;
---------------------------------------
-- old_mounts_successfully_removed --
---------------------------------------
function old_mounts_successfully_removed return Boolean is
begin
if REP.clear_existing_mounts then
TIO.Put_Line ("Dismounting successful!");
return True;
end if;
TIO.Put_Line ("The attempt failed. " &
"Check for stuck or ongoing processes and kill them.");
TIO.Put_Line ("After that, try running Synth again or just manually " &
"unmount everything");
TIO.Put_Line ("still attached to " &
JT.USS (PM.configuration.dir_buildbase));
return False;
end old_mounts_successfully_removed;
--------------------------------------------
-- old_realfs_work_successfully_removed --
--------------------------------------------
function old_realfs_work_successfully_removed return Boolean is
begin
if REP.clear_existing_workareas then
TIO.Put_Line ("Directory removal successful!");
return True;
end if;
TIO.Put_Line ("The attempt to remove the work directories located at ");
TIO.Put_Line (JT.USS (PM.configuration.dir_buildbase) & "failed.");
TIO.Put_Line ("Please remove them manually before continuing");
return False;
end old_realfs_work_successfully_removed;
-------------------------
-- synthexec_missing --
-------------------------
function synthexec_missing return Boolean
is
synthexec : constant String := host_localbase & "/libexec/synthexec";
begin
if AD.Exists (synthexec) then
return False;
end if;
TIO.Put_Line (synthexec & " missing!" & bailing);
return True;
end synthexec_missing;
----------------------------------
-- display_results_of_dry_run --
----------------------------------
procedure display_results_of_dry_run
is
procedure print (cursor : ranking_crate.Cursor);
listlog : TIO.File_Type;
filename : constant String := "/var/synth/synth_status_results.txt";
max_lots : constant scanners := get_max_lots;
elap_raw : constant String := CYC.log_duration (start => scan_start,
stop => scan_stop);
elapsed : constant String := elap_raw (elap_raw'First + 10 ..
elap_raw'Last);
goodlog : Boolean;
procedure print (cursor : ranking_crate.Cursor)
is
id : port_id := ranking_crate.Element (cursor).ap_index;
kind : verdiff;
diff : constant String := version_difference (id, kind);
origin : constant String := get_catport (all_ports (id));
begin
case kind is
when newbuild => TIO.Put_Line (" N => " & origin);
when rebuild => TIO.Put_Line (" R => " & origin);
when change => TIO.Put_Line (" U => " & origin & diff);
end case;
if goodlog then
TIO.Put_Line (listlog, origin & diff);
end if;
end print;
begin
begin
-- Try to defend malicious symlink: https://en.wikipedia.org/wiki/Symlink_race
if AD.Exists (filename) then
AD.Delete_File (filename);
end if;
TIO.Create (File => listlog, Mode => TIO.Out_File, Name => filename);
goodlog := True;
exception
when others => goodlog := False;
end;
TIO.Put_Line ("These are the ports that would be built ([N]ew, " &
"[R]ebuild, [U]pgrade):");
rank_queue.Iterate (print'Access);
TIO.Put_Line ("Total packages that would be built:" &
rank_queue.Length'Img);
if goodlog then
TIO.Put_Line
(listlog, LAT.LF &
"------------------------------" & LAT.LF &
"-- Statistics" & LAT.LF &
"------------------------------" & LAT.LF &
" Ports scanned :" & last_port'Img & LAT.LF &
" Elapsed time : " & elapsed & LAT.LF &
" Parallelism :" & max_lots'Img & " scanners" & LAT.LF &
" ncpu :" & number_cores'Img);
TIO.Close (listlog);
TIO.Put_Line ("The complete build list can also be found at:"
& LAT.LF & filename);
end if;
end display_results_of_dry_run;
---------------------
-- get_repos_dir --
---------------------
function get_repos_dir return String
is
command : String := host_pkg8 & " config repos_dir";
content : JT.Text;
topline : JT.Text;
crlen1 : Natural;
crlen2 : Natural;
begin
content := CYC.generic_system_command (command);
crlen1 := JT.SU.Length (content);
loop
JT.nextline (lineblock => content, firstline => topline);
crlen2 := JT.SU.Length (content);
exit when crlen1 = crlen2;
crlen1 := crlen2;
if not JT.equivalent (topline, "/etc/pkg/") then
return JT.USS (topline);
end if;
end loop;
-- fallback, use default
return host_localbase & "/etc/pkg/repos";
end get_repos_dir;
------------------------------------
-- interact_with_single_builder --
------------------------------------
function interact_with_single_builder return Boolean
is
EA_defined : constant Boolean := Unix.env_variable_defined (brkname);
begin
if Natural (portlist.Length) /= 1 then
return False;
end if;
if not EA_defined then
return False;
end if;
return CYC.valid_test_phase (Unix.env_variable_value (brkname));
end interact_with_single_builder;
----------------------------------------------
-- bulk_run_then_interact_with_final_port --
----------------------------------------------
procedure bulk_run_then_interact_with_final_port
is
uscatport : JT.Text := portkey_crate.Key (Position => portlist.First);
brkphase : constant String := Unix.env_variable_value (brkname);
buildres : Boolean;
ptid : port_id;
begin
if ports_keys.Contains (Key => uscatport) then
ptid := ports_keys.Element (Key => uscatport);
end if;
OPS.unlist_port (ptid);
perform_bulk_run (testmode => True);
if SIG.graceful_shutdown_requested then
return;
end if;
if bld_counter (ignored) > 0 or else
bld_counter (skipped) > 0 or else
bld_counter (failure) > 0
then
TIO.Put_Line ("It appears a prerequisite failed, so the interactive" &
" build of");
TIO.Put_Line (JT.USS (uscatport) & " has been cancelled.");
return;
end if;
TIO.Put_Line ("Starting interactive build of " & JT.USS (uscatport));
TIO.Put_Line ("Stand by, building up to the point requested ...");
REP.initialize (testmode => True, num_cores => PortScan.cores_available);
CYC.initialize (test_mode => True, jail_env => REP.jail_environment);
REP.launch_slave (id => PortScan.scan_slave, opts => noprocs);
Unix.cone_of_silence (deploy => False);
case software_framework is
when ports_collection =>
buildres := FPC.build_package (id => PortScan.scan_slave,
sequence_id => ptid,
interactive => True,
interphase => brkphase);
when pkgsrc =>
if PLAT.standalone_pkg8_install (PortScan.scan_slave) then
buildres := NPS.build_package (id => PortScan.scan_slave,
sequence_id => ptid,
interactive => True,
interphase => brkphase);
end if;
end case;
REP.destroy_slave (id => PortScan.scan_slave, opts => noprocs);
REP.finalize;
end bulk_run_then_interact_with_final_port;
--------------------------
-- synth_launch_clash --
--------------------------
function synth_launch_clash return Boolean
is
function get_usrlocal return String;
function get_usrlocal return String is
begin
if JT.equivalent (PM.configuration.dir_system, "/") then
return host_localbase;
end if;
return JT.USS (PM.configuration.dir_system) & host_localbase;
end get_usrlocal;
cwd : constant String := AD.Current_Directory;
usrlocal : constant String := get_usrlocal;
portsdir : constant String := JT.USS (PM.configuration.dir_portsdir);
ullen : constant Natural := usrlocal'Length;
pdlen : constant Natural := portsdir'Length;
begin
if cwd = usrlocal or else cwd = portsdir then
return True;
end if;
if cwd'Length > ullen and then
cwd (1 .. ullen + 1) = usrlocal & "/"
then
return True;
end if;
if cwd'Length > pdlen and then
cwd (1 .. pdlen + 1) = portsdir & "/"
then
return True;
end if;
return False;
exception
when others => return True;
end synth_launch_clash;
--------------------------
-- version_difference --
--------------------------
function version_difference (id : port_id; kind : out verdiff) return String
is
dir_pkg : constant String := JT.USS (PM.configuration.dir_repository);
current : constant String := JT.USS (all_ports (id).package_name);
version : constant String := JT.USS (all_ports (id).port_version);
begin
if AD.Exists (dir_pkg & "/" & current) then
kind := rebuild;
return " (rebuild " & version & ")";
end if;
declare
pkgbase : constant String := JT.head (current, "-");
pattern : constant String := pkgbase & "-*.txz";
upgrade : JT.Text;
pkg_search : AD.Search_Type;
dirent : AD.Directory_Entry_Type;
begin
AD.Start_Search (Search => pkg_search,
Directory => dir_pkg,
Filter => (AD.Ordinary_File => True, others => False),
Pattern => pattern);
while AD.More_Entries (Search => pkg_search) loop
AD.Get_Next_Entry (Search => pkg_search, Directory_Entry => dirent);
declare
sname : String := AD.Simple_Name (dirent);
testbase : String := PKG.query_pkgbase (dir_pkg & "/" & sname);
testver : String := JT.tail (JT.head (sname, "."), "-");
begin
if testbase = pkgbase then
upgrade := JT.SUS (" (" & testver & " => " & version & ")");
end if;
end;
end loop;
if not JT.IsBlank (upgrade) then
kind := change;
return JT.USS (upgrade);
end if;
end;
kind := newbuild;
return " (new " & version & ")";
end version_difference;
------------------------
-- file_permissions --
------------------------
function file_permissions (full_path : String) return String
is
command : constant String := "/usr/bin/stat -f %Lp " & full_path;
content : JT.Text;
topline : JT.Text;
status : Integer;
begin
content := Unix.piped_command (command, status);
if status /= 0 then
return "000";
end if;
JT.nextline (lineblock => content, firstline => topline);
return JT.USS (topline);
end file_permissions;
--------------------------------------
-- acceptable_RSA_signing_support --
--------------------------------------
function acceptable_RSA_signing_support return Boolean
is
file_prefix : constant String := PM.synth_confdir & "/" &
JT.USS (PM.configuration.profile) & "-";
key_private : constant String := file_prefix & "private.key";
key_public : constant String := file_prefix & "public.key";
found_private : constant Boolean := AD.Exists (key_private);
found_public : constant Boolean := AD.Exists (key_public);
sorry : constant String := "The generated repository will not " &
"be signed due to the misconfiguration.";
repo_key : constant String := JT.USS (PM.configuration.dir_buildbase)
& ss_base & "/etc/repo.key";
begin
if not found_private and then not found_public then
return True;
end if;
if found_public and then not found_private then
TIO.Put_Line ("A public RSA key file has been found without a " &
"corresponding private key file.");
TIO.Put_Line (sorry);
return True;
end if;
if found_private and then not found_public then
TIO.Put_Line ("A private RSA key file has been found without a " &
"corresponding public key file.");
TIO.Put_Line (sorry);
return True;
end if;
declare
mode : constant String := file_permissions (key_private);
begin
if mode /= "400" then
TIO.Put_Line ("The private RSA key file has insecure file " &
"permissions (" & mode & ")");
TIO.Put_Line ("Please change the mode of " & key_private &
" to 400 before continuing.");
return False;
end if;
end;
declare
begin
AD.Copy_File (Source_Name => key_private,
Target_Name => repo_key);
return True;
exception
when failed : others =>
TIO.Put_Line ("Failed to copy private RSA key to builder.");
TIO.Put_Line (EX.Exception_Information (failed));
return False;
end;
end acceptable_RSA_signing_support;
----------------------------------
-- acceptable_signing_command --
----------------------------------
function valid_signing_command return Boolean
is
file_prefix : constant String := PM.synth_confdir & "/" &
JT.USS (PM.configuration.profile) & "-";
fingerprint : constant String := file_prefix & "fingerprint";
ext_command : constant String := file_prefix & "signing_command";
found_finger : constant Boolean := AD.Exists (fingerprint);
found_command : constant Boolean := AD.Exists (ext_command);
sorry : constant String := "The generated repository will not " &
"be externally signed due to the misconfiguration.";
begin
if found_finger and then found_command then
if JT.IsBlank (one_line_file_contents (fingerprint)) or else
JT.IsBlank (one_line_file_contents (ext_command))
then
TIO.Put_Line ("At least one of the profile signing command " &
"files is blank");
TIO.Put_Line (sorry);
return False;
end if;
return True;
end if;
if found_finger then
TIO.Put_Line ("The profile fingerprint was found but not the " &
"signing command");
TIO.Put_Line (sorry);
elsif found_command then
TIO.Put_Line ("The profile signing command was found but not " &
"the fingerprint");
TIO.Put_Line (sorry);
end if;
return False;
end valid_signing_command;
-----------------------
-- signing_command --
-----------------------
function signing_command return String
is
filename : constant String := PM.synth_confdir & "/" &
JT.USS (PM.configuration.profile) & "-signing_command";
begin
return one_line_file_contents (filename);
end signing_command;
---------------------------
-- profile_fingerprint --
---------------------------
function profile_fingerprint return String
is
filename : constant String := PM.synth_confdir & "/" &
JT.USS (PM.configuration.profile) & "-fingerprint";
begin
return one_line_file_contents (filename);
end profile_fingerprint;
-------------------------------
-- set_synth_conf_with_RSA --
-------------------------------
function set_synth_conf_with_RSA return Boolean
is
file_prefix : constant String := PM.synth_confdir & "/" &
JT.USS (PM.configuration.profile) & "-";
key_private : constant String := file_prefix & "private.key";
key_public : constant String := file_prefix & "public.key";
found_private : constant Boolean := AD.Exists (key_private);
found_public : constant Boolean := AD.Exists (key_public);
begin
return
found_public and then
found_private and then
file_permissions (key_private) = "400";
end set_synth_conf_with_RSA;
------------------------------
-- one_line_file_contents --
------------------------------
function one_line_file_contents (filename : String) return String
is
target_file : TIO.File_Type;
contents : JT.Text := JT.blank;
begin
TIO.Open (File => target_file, Mode => TIO.In_File, Name => filename);
if not TIO.End_Of_File (target_file) then
contents := JT.SUS (TIO.Get_Line (target_file));
end if;
TIO.Close (target_file);
return JT.USS (contents);
end one_line_file_contents;
-------------------------
-- valid_system_root --
-------------------------
function valid_system_root return Boolean is
begin
if REP.boot_modules_directory_missing then
TIO.Put_Line ("The /boot directory is optional, but when it exists, " &
"the /boot/modules directory must also exist.");
TIO.Put ("Please create the ");
if not JT.equivalent (PM.configuration.dir_system, "/") then
TIO.Put (JT.USS (PM.configuration.dir_system));
end if;
TIO.Put_Line ("/boot/modules directory and retry.");
return False;
end if;
return True;
end valid_system_root;
------------------------------------------
-- host_pkg8_conservative_upgrade_set --
------------------------------------------
function host_pkg8_conservative_upgrade_set return Boolean
is
command : constant String := host_pkg8 & " config CONSERVATIVE_UPGRADE";
content : JT.Text;
topline : JT.Text;
begin
content := CYC.generic_system_command (command);
JT.nextline (lineblock => content, firstline => topline);
return JT.equivalent (topline, "yes");
end host_pkg8_conservative_upgrade_set;
-----------------------------------
-- TERM_defined_in_environment --
-----------------------------------
function TERM_defined_in_environment return Boolean
is
defined : constant Boolean := Unix.env_variable_defined ("TERM");
begin
if not defined then
TIO.Put_Line ("Please define TERM in environment first and retry.");
end if;
return defined;
end TERM_defined_in_environment;
-------------------------
-- ensure_port_index --
-------------------------
function ensure_port_index return Boolean
is
index_file : constant String := "/var/cache/synth/" &
JT.USS (PM.configuration.profile) & "-index";
needs_gen : Boolean := True;
tree_newer : Boolean;
valid_check : Boolean;
answer : Character;
portsdir : constant String := JT.USS (PM.configuration.dir_portsdir);
command : constant String := "/usr/bin/touch " & index_file;
stars : String (1 .. 67) := (others => '*');
msg1 : String := " The ports tree has at least one file newer than the flavor index.";
msg2 : String := " However, port directories perfectly match. Should the index be";
msg3 : String := " regenerated? (Y/N) ";
begin
if AD.Exists (index_file) then
tree_newer := index_out_of_date (index_file, valid_check);
if not valid_check then
return False;
end if;
if tree_newer then
if Unix.env_variable_defined ("TERM") then
if tree_directories_match (index_file, portsdir) then
TIO.Put_Line (stars);
TIO.Put_Line (msg1);
TIO.Put_Line (msg2);
TIO.Put (msg3);
loop
Ada.Text_IO.Get_Immediate (answer);
case answer is
when 'Y' | 'y' =>
TIO.Put_Line ("yes");
exit;
when 'N' | 'n' =>
TIO.Put_Line ("no");
if Unix.external_command (command) then
needs_gen := False;
end if;
exit;
when others => null;
end case;
end loop;
TIO.Put_Line (stars);
end if;
end if;
else
needs_gen := False;
end if;
end if;
if needs_gen then
return generate_ports_index (index_file, portsdir);
else
return True;
end if;
end ensure_port_index;
-------------------------
-- index_out_of_date --
-------------------------
function index_out_of_date (index_file : String; valid : out Boolean) return Boolean
is
index_file_modtime : CAL.Time;
result : Boolean;
begin
valid := False;
begin
index_file_modtime := AD.Modification_Time (index_file);
exception
when AD.Use_Error =>
TIO.Put_Line ("File system doesn't support modification times, must eject!");
return False;
when others =>
TIO.Put_Line ("index_out_of_date: problem getting index file modification time");
return False;
end;
result := PortScan.tree_newer_than_reference
(portsdir => JT.USS (PM.configuration.dir_portsdir),
reference => index_file_modtime,
valid => valid);
if valid then
return result;
else
TIO.Put_Line ("Failed to determine if index is out of date, must eject!");
return False;
end if;
end index_out_of_date;
------------------------------
-- tree_directories_match --
------------------------------
function tree_directories_match (index_file, portsdir : String) return Boolean
is
procedure flavor_line (cursor : string_crate.Cursor);
last_entry : JT.Text;
broken : Boolean := False;
procedure flavor_line (cursor : string_crate.Cursor)
is
line : constant String := JT.USS (string_crate.Element (Position => cursor));
catport : JT.Text := JT.SUS (JT.part_1 (line, "@"));
begin
if not broken then
if not JT.equivalent (last_entry, catport) then
last_entry := catport;
if ports_keys.Contains (catport) then
ports_keys.Delete (catport);
else
broken := True;
end if;
end if;
end if;
end flavor_line;
begin
load_index_for_store_origins;
prescan_ports_tree (portsdir);
so_serial.Iterate (flavor_line'Access);
if not broken then
-- Every port on the flavor index is present in the ports tree
-- We still need to check that there are not ports in the tree not listed in index
if not ports_keys.Is_Empty then
broken := True;
end if;
end if;
reset_ports_tree;
clear_store_origin_data;
return not broken;
end tree_directories_match;
end PortScan.Pilot;
|
package body Program is
procedure Run is
begin
loop
null;
end loop;
end Run;
end Program;
|
-----------------------------------------------------------------------
-- mat-testsuite - MAT Testsuite
-- Copyright (C) 2014 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 MAT.Readers.Tests;
with MAT.Targets.Tests;
with MAT.Frames.Tests;
with MAT.Memory.Tests;
with MAT.Expressions.Tests;
package body MAT.Testsuite is
Tests : aliased Util.Tests.Test_Suite;
function Suite return Util.Tests.Access_Test_Suite is
Result : constant Util.Tests.Access_Test_Suite := Tests'Access;
begin
MAT.Expressions.Tests.Add_Tests (Result);
MAT.Frames.Tests.Add_Tests (Result);
MAT.Memory.Tests.Add_Tests (Result);
MAT.Readers.Tests.Add_Tests (Result);
MAT.Targets.Tests.Add_Tests (Result);
return Result;
end Suite;
end MAT.Testsuite;
|
------------------------------------------------------------------------------
-- --
-- GNAT LIBRARY COMPONENTS --
-- --
-- A D A . C O N T A I N E R S . B O U N D E D _ H A S H E D _ S E T S --
-- --
-- B o d y --
-- --
-- Copyright (C) 2004-2019, Free Software Foundation, Inc. --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
-- ware Foundation; either version 3, or (at your option) any later ver- --
-- sion. GNAT is distributed in the hope that it will be useful, but WITH- --
-- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY --
-- or FITNESS FOR A PARTICULAR PURPOSE. --
-- --
-- As a special exception under Section 7 of GPL version 3, you are granted --
-- additional permissions described in the GCC Runtime Library Exception, --
-- version 3.1, as published by the Free Software Foundation. --
-- --
-- You should have received a copy of the GNU General Public License and --
-- a copy of the GCC Runtime Library Exception along with this program; --
-- see the files COPYING3 and COPYING.RUNTIME respectively. If not, see --
-- <http://www.gnu.org/licenses/>. --
-- --
-- This unit was originally developed by Matthew J Heaney. --
------------------------------------------------------------------------------
with Ada.Containers.Hash_Tables.Generic_Bounded_Operations;
pragma Elaborate_All (Ada.Containers.Hash_Tables.Generic_Bounded_Operations);
with Ada.Containers.Hash_Tables.Generic_Bounded_Keys;
pragma Elaborate_All (Ada.Containers.Hash_Tables.Generic_Bounded_Keys);
with Ada.Containers.Helpers; use Ada.Containers.Helpers;
with Ada.Containers.Prime_Numbers; use Ada.Containers.Prime_Numbers;
with System; use type System.Address;
package body Ada.Containers.Bounded_Hashed_Sets is
pragma Warnings (Off, "variable ""Busy*"" is not referenced");
pragma Warnings (Off, "variable ""Lock*"" is not referenced");
-- See comment in Ada.Containers.Helpers
-----------------------
-- Local Subprograms --
-----------------------
function Equivalent_Keys
(Key : Element_Type;
Node : Node_Type) return Boolean;
pragma Inline (Equivalent_Keys);
function Hash_Node (Node : Node_Type) return Hash_Type;
pragma Inline (Hash_Node);
procedure Insert
(Container : in out Set;
New_Item : Element_Type;
Node : out Count_Type;
Inserted : out Boolean);
function Is_In (HT : Set; Key : Node_Type) return Boolean;
pragma Inline (Is_In);
procedure Set_Element (Node : in out Node_Type; Item : Element_Type);
pragma Inline (Set_Element);
function Next (Node : Node_Type) return Count_Type;
pragma Inline (Next);
procedure Set_Next (Node : in out Node_Type; Next : Count_Type);
pragma Inline (Set_Next);
function Vet (Position : Cursor) return Boolean;
--------------------------
-- Local Instantiations --
--------------------------
package HT_Ops is new Hash_Tables.Generic_Bounded_Operations
(HT_Types => HT_Types,
Hash_Node => Hash_Node,
Next => Next,
Set_Next => Set_Next);
package Element_Keys is new Hash_Tables.Generic_Bounded_Keys
(HT_Types => HT_Types,
Next => Next,
Set_Next => Set_Next,
Key_Type => Element_Type,
Hash => Hash,
Equivalent_Keys => Equivalent_Keys);
procedure Replace_Element is
new Element_Keys.Generic_Replace_Element (Hash_Node, Set_Element);
---------
-- "=" --
---------
function "=" (Left, Right : Set) return Boolean is
function Find_Equal_Key
(R_HT : Hash_Table_Type'Class;
L_Node : Node_Type) return Boolean;
pragma Inline (Find_Equal_Key);
function Is_Equal is
new HT_Ops.Generic_Equal (Find_Equal_Key);
--------------------
-- Find_Equal_Key --
--------------------
function Find_Equal_Key
(R_HT : Hash_Table_Type'Class;
L_Node : Node_Type) return Boolean
is
R_Index : constant Hash_Type :=
Element_Keys.Index (R_HT, L_Node.Element);
R_Node : Count_Type := R_HT.Buckets (R_Index);
begin
loop
if R_Node = 0 then
return False;
end if;
if L_Node.Element = R_HT.Nodes (R_Node).Element then
return True;
end if;
R_Node := Next (R_HT.Nodes (R_Node));
end loop;
end Find_Equal_Key;
-- Start of processing for "="
begin
return Is_Equal (Left, Right);
end "=";
------------
-- Assign --
------------
procedure Assign (Target : in out Set; Source : Set) is
procedure Insert_Element (Source_Node : Count_Type);
procedure Insert_Elements is
new HT_Ops.Generic_Iteration (Insert_Element);
--------------------
-- Insert_Element --
--------------------
procedure Insert_Element (Source_Node : Count_Type) is
N : Node_Type renames Source.Nodes (Source_Node);
X : Count_Type;
B : Boolean;
begin
Insert (Target, N.Element, X, B);
pragma Assert (B);
end Insert_Element;
-- Start of processing for Assign
begin
if Target'Address = Source'Address then
return;
end if;
if Checks and then Target.Capacity < Source.Length then
raise Capacity_Error
with "Target capacity is less than Source length";
end if;
HT_Ops.Clear (Target);
Insert_Elements (Source);
end Assign;
--------------
-- Capacity --
--------------
function Capacity (Container : Set) return Count_Type is
begin
return Container.Capacity;
end Capacity;
-----------
-- Clear --
-----------
procedure Clear (Container : in out Set) is
begin
HT_Ops.Clear (Container);
end Clear;
------------------------
-- Constant_Reference --
------------------------
function Constant_Reference
(Container : aliased Set;
Position : Cursor) return Constant_Reference_Type
is
begin
if Checks and then Position.Container = null then
raise Constraint_Error with "Position cursor has no element";
end if;
if Checks and then Position.Container /= Container'Unrestricted_Access
then
raise Program_Error with
"Position cursor designates wrong container";
end if;
pragma Assert (Vet (Position), "bad cursor in Constant_Reference");
declare
N : Node_Type renames Container.Nodes (Position.Node);
TC : constant Tamper_Counts_Access :=
Container.TC'Unrestricted_Access;
begin
return R : constant Constant_Reference_Type :=
(Element => N.Element'Access,
Control => (Controlled with TC))
do
Lock (TC.all);
end return;
end;
end Constant_Reference;
--------------
-- Contains --
--------------
function Contains (Container : Set; Item : Element_Type) return Boolean is
begin
return Find (Container, Item) /= No_Element;
end Contains;
----------
-- Copy --
----------
function Copy
(Source : Set;
Capacity : Count_Type := 0;
Modulus : Hash_Type := 0) return Set
is
C : Count_Type;
M : Hash_Type;
begin
if Capacity = 0 then
C := Source.Length;
elsif Capacity >= Source.Length then
C := Capacity;
elsif Checks then
raise Capacity_Error with "Capacity value too small";
end if;
if Modulus = 0 then
M := Default_Modulus (C);
else
M := Modulus;
end if;
return Target : Set (Capacity => C, Modulus => M) do
Assign (Target => Target, Source => Source);
end return;
end Copy;
---------------------
-- Default_Modulus --
---------------------
function Default_Modulus (Capacity : Count_Type) return Hash_Type is
begin
return To_Prime (Capacity);
end Default_Modulus;
------------
-- Delete --
------------
procedure Delete
(Container : in out Set;
Item : Element_Type)
is
X : Count_Type;
begin
Element_Keys.Delete_Key_Sans_Free (Container, Item, X);
if Checks and then X = 0 then
raise Constraint_Error with "attempt to delete element not in set";
end if;
HT_Ops.Free (Container, X);
end Delete;
procedure Delete
(Container : in out Set;
Position : in out Cursor)
is
begin
if Checks and then Position.Node = 0 then
raise Constraint_Error with "Position cursor equals No_Element";
end if;
if Checks and then Position.Container /= Container'Unrestricted_Access
then
raise Program_Error with "Position cursor designates wrong set";
end if;
TC_Check (Container.TC);
pragma Assert (Vet (Position), "bad cursor in Delete");
HT_Ops.Delete_Node_Sans_Free (Container, Position.Node);
HT_Ops.Free (Container, Position.Node);
Position := No_Element;
end Delete;
----------------
-- Difference --
----------------
procedure Difference
(Target : in out Set;
Source : Set)
is
Tgt_Node, Src_Node : Count_Type;
Src : Set renames Source'Unrestricted_Access.all;
TN : Nodes_Type renames Target.Nodes;
SN : Nodes_Type renames Source.Nodes;
begin
if Target'Address = Source'Address then
HT_Ops.Clear (Target);
return;
end if;
if Source.Length = 0 then
return;
end if;
TC_Check (Target.TC);
if Source.Length < Target.Length then
Src_Node := HT_Ops.First (Source);
while Src_Node /= 0 loop
Tgt_Node := Element_Keys.Find (Target, SN (Src_Node).Element);
if Tgt_Node /= 0 then
HT_Ops.Delete_Node_Sans_Free (Target, Tgt_Node);
HT_Ops.Free (Target, Tgt_Node);
end if;
Src_Node := HT_Ops.Next (Src, Src_Node);
end loop;
else
Tgt_Node := HT_Ops.First (Target);
while Tgt_Node /= 0 loop
if Is_In (Source, TN (Tgt_Node)) then
declare
X : constant Count_Type := Tgt_Node;
begin
Tgt_Node := HT_Ops.Next (Target, Tgt_Node);
HT_Ops.Delete_Node_Sans_Free (Target, X);
HT_Ops.Free (Target, X);
end;
else
Tgt_Node := HT_Ops.Next (Target, Tgt_Node);
end if;
end loop;
end if;
end Difference;
function Difference (Left, Right : Set) return Set is
begin
if Left'Address = Right'Address then
return Empty_Set;
end if;
if Left.Length = 0 then
return Empty_Set;
end if;
if Right.Length = 0 then
return Left;
end if;
return Result : Set (Left.Length, To_Prime (Left.Length)) do
Iterate_Left : declare
procedure Process (L_Node : Count_Type);
procedure Iterate is
new HT_Ops.Generic_Iteration (Process);
-------------
-- Process --
-------------
procedure Process (L_Node : Count_Type) is
N : Node_Type renames Left.Nodes (L_Node);
X : Count_Type;
B : Boolean;
begin
if not Is_In (Right, N) then
Insert (Result, N.Element, X, B); -- optimize this ???
pragma Assert (B);
pragma Assert (X > 0);
end if;
end Process;
-- Start of processing for Iterate_Left
begin
Iterate (Left);
end Iterate_Left;
end return;
end Difference;
-------------
-- Element --
-------------
function Element (Position : Cursor) return Element_Type is
begin
if Checks and then Position.Node = 0 then
raise Constraint_Error with "Position cursor equals No_Element";
end if;
pragma Assert (Vet (Position), "bad cursor in function Element");
declare
S : Set renames Position.Container.all;
N : Node_Type renames S.Nodes (Position.Node);
begin
return N.Element;
end;
end Element;
---------------------
-- Equivalent_Sets --
---------------------
function Equivalent_Sets (Left, Right : Set) return Boolean is
function Find_Equivalent_Key
(R_HT : Hash_Table_Type'Class;
L_Node : Node_Type) return Boolean;
pragma Inline (Find_Equivalent_Key);
function Is_Equivalent is
new HT_Ops.Generic_Equal (Find_Equivalent_Key);
-------------------------
-- Find_Equivalent_Key --
-------------------------
function Find_Equivalent_Key
(R_HT : Hash_Table_Type'Class;
L_Node : Node_Type) return Boolean
is
R_Index : constant Hash_Type :=
Element_Keys.Index (R_HT, L_Node.Element);
R_Node : Count_Type := R_HT.Buckets (R_Index);
RN : Nodes_Type renames R_HT.Nodes;
begin
loop
if R_Node = 0 then
return False;
end if;
if Equivalent_Elements (L_Node.Element, RN (R_Node).Element) then
return True;
end if;
R_Node := Next (R_HT.Nodes (R_Node));
end loop;
end Find_Equivalent_Key;
-- Start of processing for Equivalent_Sets
begin
return Is_Equivalent (Left, Right);
end Equivalent_Sets;
-------------------------
-- Equivalent_Elements --
-------------------------
function Equivalent_Elements (Left, Right : Cursor)
return Boolean is
begin
if Checks and then Left.Node = 0 then
raise Constraint_Error with
"Left cursor of Equivalent_Elements equals No_Element";
end if;
if Checks and then Right.Node = 0 then
raise Constraint_Error with
"Right cursor of Equivalent_Elements equals No_Element";
end if;
pragma Assert (Vet (Left), "bad Left cursor in Equivalent_Elements");
pragma Assert (Vet (Right), "bad Right cursor in Equivalent_Elements");
-- AI05-0022 requires that a container implementation detect element
-- tampering by a generic actual subprogram. However, the following case
-- falls outside the scope of that AI. Randy Brukardt explained on the
-- ARG list on 2013/02/07 that:
-- (Begin Quote):
-- But for an operation like "<" [the ordered set analog of
-- Equivalent_Elements], there is no need to "dereference" a cursor
-- after the call to the generic formal parameter function, so nothing
-- bad could happen if tampering is undetected. And the operation can
-- safely return a result without a problem even if an element is
-- deleted from the container.
-- (End Quote).
declare
LN : Node_Type renames Left.Container.Nodes (Left.Node);
RN : Node_Type renames Right.Container.Nodes (Right.Node);
begin
return Equivalent_Elements (LN.Element, RN.Element);
end;
end Equivalent_Elements;
function Equivalent_Elements
(Left : Cursor;
Right : Element_Type) return Boolean
is
begin
if Checks and then Left.Node = 0 then
raise Constraint_Error with
"Left cursor of Equivalent_Elements equals No_Element";
end if;
pragma Assert (Vet (Left), "Left cursor in Equivalent_Elements is bad");
declare
LN : Node_Type renames Left.Container.Nodes (Left.Node);
begin
return Equivalent_Elements (LN.Element, Right);
end;
end Equivalent_Elements;
function Equivalent_Elements
(Left : Element_Type;
Right : Cursor) return Boolean
is
begin
if Checks and then Right.Node = 0 then
raise Constraint_Error with
"Right cursor of Equivalent_Elements equals No_Element";
end if;
pragma Assert
(Vet (Right),
"Right cursor of Equivalent_Elements is bad");
declare
RN : Node_Type renames Right.Container.Nodes (Right.Node);
begin
return Equivalent_Elements (Left, RN.Element);
end;
end Equivalent_Elements;
---------------------
-- Equivalent_Keys --
---------------------
function Equivalent_Keys
(Key : Element_Type;
Node : Node_Type) return Boolean
is
begin
return Equivalent_Elements (Key, Node.Element);
end Equivalent_Keys;
-------------
-- Exclude --
-------------
procedure Exclude
(Container : in out Set;
Item : Element_Type)
is
X : Count_Type;
begin
Element_Keys.Delete_Key_Sans_Free (Container, Item, X);
HT_Ops.Free (Container, X);
end Exclude;
--------------
-- Finalize --
--------------
procedure Finalize (Object : in out Iterator) is
begin
if Object.Container /= null then
Unbusy (Object.Container.TC);
end if;
end Finalize;
----------
-- Find --
----------
function Find
(Container : Set;
Item : Element_Type) return Cursor
is
Node : constant Count_Type :=
Element_Keys.Find (Container'Unrestricted_Access.all, Item);
begin
return (if Node = 0 then No_Element
else Cursor'(Container'Unrestricted_Access, Node));
end Find;
-----------
-- First --
-----------
function First (Container : Set) return Cursor is
Node : constant Count_Type := HT_Ops.First (Container);
begin
return (if Node = 0 then No_Element
else Cursor'(Container'Unrestricted_Access, Node));
end First;
overriding function First (Object : Iterator) return Cursor is
begin
return Object.Container.First;
end First;
------------------------
-- Get_Element_Access --
------------------------
function Get_Element_Access
(Position : Cursor) return not null Element_Access is
begin
return Position.Container.Nodes (Position.Node).Element'Access;
end Get_Element_Access;
-----------------
-- Has_Element --
-----------------
function Has_Element (Position : Cursor) return Boolean is
begin
pragma Assert (Vet (Position), "bad cursor in Has_Element");
return Position.Node /= 0;
end Has_Element;
---------------
-- Hash_Node --
---------------
function Hash_Node (Node : Node_Type) return Hash_Type is
begin
return Hash (Node.Element);
end Hash_Node;
-------------
-- Include --
-------------
procedure Include
(Container : in out Set;
New_Item : Element_Type)
is
Position : Cursor;
Inserted : Boolean;
begin
Insert (Container, New_Item, Position, Inserted);
if not Inserted then
TE_Check (Container.TC);
Container.Nodes (Position.Node).Element := New_Item;
end if;
end Include;
------------
-- Insert --
------------
procedure Insert
(Container : in out Set;
New_Item : Element_Type;
Position : out Cursor;
Inserted : out Boolean)
is
begin
Insert (Container, New_Item, Position.Node, Inserted);
Position.Container := Container'Unchecked_Access;
end Insert;
procedure Insert
(Container : in out Set;
New_Item : Element_Type)
is
Position : Cursor;
pragma Unreferenced (Position);
Inserted : Boolean;
begin
Insert (Container, New_Item, Position, Inserted);
if Checks and then not Inserted then
raise Constraint_Error with
"attempt to insert element already in set";
end if;
end Insert;
procedure Insert
(Container : in out Set;
New_Item : Element_Type;
Node : out Count_Type;
Inserted : out Boolean)
is
procedure Allocate_Set_Element (Node : in out Node_Type);
pragma Inline (Allocate_Set_Element);
function New_Node return Count_Type;
pragma Inline (New_Node);
procedure Local_Insert is
new Element_Keys.Generic_Conditional_Insert (New_Node);
procedure Allocate is
new HT_Ops.Generic_Allocate (Allocate_Set_Element);
---------------------------
-- Allocate_Set_Element --
---------------------------
procedure Allocate_Set_Element (Node : in out Node_Type) is
begin
Node.Element := New_Item;
end Allocate_Set_Element;
--------------
-- New_Node --
--------------
function New_Node return Count_Type is
Result : Count_Type;
begin
Allocate (Container, Result);
return Result;
end New_Node;
-- Start of processing for Insert
begin
-- The buckets array length is specified by the user as a discriminant
-- of the container type, so it is possible for the buckets array to
-- have a length of zero. We must check for this case specifically, in
-- order to prevent divide-by-zero errors later, when we compute the
-- buckets array index value for an element, given its hash value.
if Checks and then Container.Buckets'Length = 0 then
raise Capacity_Error with "No capacity for insertion";
end if;
Local_Insert (Container, New_Item, Node, Inserted);
end Insert;
------------------
-- Intersection --
------------------
procedure Intersection
(Target : in out Set;
Source : Set)
is
Tgt_Node : Count_Type;
TN : Nodes_Type renames Target.Nodes;
begin
if Target'Address = Source'Address then
return;
end if;
if Source.Length = 0 then
HT_Ops.Clear (Target);
return;
end if;
TC_Check (Target.TC);
Tgt_Node := HT_Ops.First (Target);
while Tgt_Node /= 0 loop
if Is_In (Source, TN (Tgt_Node)) then
Tgt_Node := HT_Ops.Next (Target, Tgt_Node);
else
declare
X : constant Count_Type := Tgt_Node;
begin
Tgt_Node := HT_Ops.Next (Target, Tgt_Node);
HT_Ops.Delete_Node_Sans_Free (Target, X);
HT_Ops.Free (Target, X);
end;
end if;
end loop;
end Intersection;
function Intersection (Left, Right : Set) return Set is
C : Count_Type;
begin
if Left'Address = Right'Address then
return Left;
end if;
C := Count_Type'Min (Left.Length, Right.Length);
if C = 0 then
return Empty_Set;
end if;
return Result : Set (C, To_Prime (C)) do
Iterate_Left : declare
procedure Process (L_Node : Count_Type);
procedure Iterate is
new HT_Ops.Generic_Iteration (Process);
-------------
-- Process --
-------------
procedure Process (L_Node : Count_Type) is
N : Node_Type renames Left.Nodes (L_Node);
X : Count_Type;
B : Boolean;
begin
if Is_In (Right, N) then
Insert (Result, N.Element, X, B); -- optimize ???
pragma Assert (B);
pragma Assert (X > 0);
end if;
end Process;
-- Start of processing for Iterate_Left
begin
Iterate (Left);
end Iterate_Left;
end return;
end Intersection;
--------------
-- Is_Empty --
--------------
function Is_Empty (Container : Set) return Boolean is
begin
return Container.Length = 0;
end Is_Empty;
-----------
-- Is_In --
-----------
function Is_In (HT : Set; Key : Node_Type) return Boolean is
begin
return Element_Keys.Find (HT'Unrestricted_Access.all, Key.Element) /= 0;
end Is_In;
---------------
-- Is_Subset --
---------------
function Is_Subset (Subset : Set; Of_Set : Set) return Boolean is
Subset_Node : Count_Type;
SN : Nodes_Type renames Subset.Nodes;
begin
if Subset'Address = Of_Set'Address then
return True;
end if;
if Subset.Length > Of_Set.Length then
return False;
end if;
Subset_Node := HT_Ops.First (Subset);
while Subset_Node /= 0 loop
if not Is_In (Of_Set, SN (Subset_Node)) then
return False;
end if;
Subset_Node := HT_Ops.Next
(Subset'Unrestricted_Access.all, Subset_Node);
end loop;
return True;
end Is_Subset;
-------------
-- Iterate --
-------------
procedure Iterate
(Container : Set;
Process : not null access procedure (Position : Cursor))
is
procedure Process_Node (Node : Count_Type);
pragma Inline (Process_Node);
procedure Iterate is
new HT_Ops.Generic_Iteration (Process_Node);
------------------
-- Process_Node --
------------------
procedure Process_Node (Node : Count_Type) is
begin
Process (Cursor'(Container'Unrestricted_Access, Node));
end Process_Node;
Busy : With_Busy (Container.TC'Unrestricted_Access);
-- Start of processing for Iterate
begin
Iterate (Container);
end Iterate;
function Iterate (Container : Set)
return Set_Iterator_Interfaces.Forward_Iterator'Class
is
begin
Busy (Container.TC'Unrestricted_Access.all);
return It : constant Iterator :=
Iterator'(Limited_Controlled with
Container => Container'Unrestricted_Access);
end Iterate;
------------
-- Length --
------------
function Length (Container : Set) return Count_Type is
begin
return Container.Length;
end Length;
----------
-- Move --
----------
procedure Move (Target : in out Set; Source : in out Set) is
begin
if Target'Address = Source'Address then
return;
end if;
TC_Check (Source.TC);
Target.Assign (Source);
Source.Clear;
end Move;
----------
-- Next --
----------
function Next (Node : Node_Type) return Count_Type is
begin
return Node.Next;
end Next;
function Next (Position : Cursor) return Cursor is
begin
if Position.Node = 0 then
return No_Element;
end if;
pragma Assert (Vet (Position), "bad cursor in Next");
declare
HT : Set renames Position.Container.all;
Node : constant Count_Type := HT_Ops.Next (HT, Position.Node);
begin
if Node = 0 then
return No_Element;
end if;
return Cursor'(Position.Container, Node);
end;
end Next;
procedure Next (Position : in out Cursor) is
begin
Position := Next (Position);
end Next;
function Next
(Object : Iterator;
Position : Cursor) return Cursor
is
begin
if Position.Container = null then
return No_Element;
end if;
if Checks and then Position.Container /= Object.Container then
raise Program_Error with
"Position cursor of Next designates wrong set";
end if;
return Next (Position);
end Next;
-------------
-- Overlap --
-------------
function Overlap (Left, Right : Set) return Boolean is
Left_Node : Count_Type;
begin
if Right.Length = 0 then
return False;
end if;
if Left'Address = Right'Address then
return True;
end if;
Left_Node := HT_Ops.First (Left);
while Left_Node /= 0 loop
if Is_In (Right, Left.Nodes (Left_Node)) then
return True;
end if;
Left_Node := HT_Ops.Next (Left'Unrestricted_Access.all, Left_Node);
end loop;
return False;
end Overlap;
----------------------
-- Pseudo_Reference --
----------------------
function Pseudo_Reference
(Container : aliased Set'Class) return Reference_Control_Type
is
TC : constant Tamper_Counts_Access :=
Container.TC'Unrestricted_Access;
begin
return R : constant Reference_Control_Type := (Controlled with TC) do
Lock (TC.all);
end return;
end Pseudo_Reference;
-------------------
-- Query_Element --
-------------------
procedure Query_Element
(Position : Cursor;
Process : not null access procedure (Element : Element_Type))
is
begin
if Checks and then Position.Node = 0 then
raise Constraint_Error with
"Position cursor of Query_Element equals No_Element";
end if;
pragma Assert (Vet (Position), "bad cursor in Query_Element");
declare
S : Set renames Position.Container.all;
Lock : With_Lock (S.TC'Unrestricted_Access);
begin
Process (S.Nodes (Position.Node).Element);
end;
end Query_Element;
----------
-- Read --
----------
procedure Read
(Stream : not null access Root_Stream_Type'Class;
Container : out Set)
is
function Read_Node (Stream : not null access Root_Stream_Type'Class)
return Count_Type;
procedure Read_Nodes is
new HT_Ops.Generic_Read (Read_Node);
---------------
-- Read_Node --
---------------
function Read_Node (Stream : not null access Root_Stream_Type'Class)
return Count_Type
is
procedure Read_Element (Node : in out Node_Type);
pragma Inline (Read_Element);
procedure Allocate is
new HT_Ops.Generic_Allocate (Read_Element);
procedure Read_Element (Node : in out Node_Type) is
begin
Element_Type'Read (Stream, Node.Element);
end Read_Element;
Node : Count_Type;
-- Start of processing for Read_Node
begin
Allocate (Container, Node);
return Node;
end Read_Node;
-- Start of processing for Read
begin
Read_Nodes (Stream, Container);
end Read;
procedure Read
(Stream : not null access Root_Stream_Type'Class;
Item : out Cursor)
is
begin
raise Program_Error with "attempt to stream set cursor";
end Read;
procedure Read
(Stream : not null access Root_Stream_Type'Class;
Item : out Constant_Reference_Type)
is
begin
raise Program_Error with "attempt to stream reference";
end Read;
-------------
-- Replace --
-------------
procedure Replace
(Container : in out Set;
New_Item : Element_Type)
is
Node : constant Count_Type := Element_Keys.Find (Container, New_Item);
begin
if Checks and then Node = 0 then
raise Constraint_Error with
"attempt to replace element not in set";
end if;
TE_Check (Container.TC);
Container.Nodes (Node).Element := New_Item;
end Replace;
procedure Replace_Element
(Container : in out Set;
Position : Cursor;
New_Item : Element_Type)
is
begin
if Checks and then Position.Node = 0 then
raise Constraint_Error with
"Position cursor equals No_Element";
end if;
if Checks and then Position.Container /= Container'Unrestricted_Access
then
raise Program_Error with
"Position cursor designates wrong set";
end if;
pragma Assert (Vet (Position), "bad cursor in Replace_Element");
Replace_Element (Container, Position.Node, New_Item);
end Replace_Element;
----------------------
-- Reserve_Capacity --
----------------------
procedure Reserve_Capacity
(Container : in out Set;
Capacity : Count_Type)
is
begin
if Checks and then Capacity > Container.Capacity then
raise Capacity_Error with "requested capacity is too large";
end if;
end Reserve_Capacity;
------------------
-- Set_Element --
------------------
procedure Set_Element (Node : in out Node_Type; Item : Element_Type) is
begin
Node.Element := Item;
end Set_Element;
--------------
-- Set_Next --
--------------
procedure Set_Next (Node : in out Node_Type; Next : Count_Type) is
begin
Node.Next := Next;
end Set_Next;
--------------------------
-- Symmetric_Difference --
--------------------------
procedure Symmetric_Difference
(Target : in out Set;
Source : Set)
is
procedure Process (Source_Node : Count_Type);
pragma Inline (Process);
procedure Iterate is
new HT_Ops.Generic_Iteration (Process);
-------------
-- Process --
-------------
procedure Process (Source_Node : Count_Type) is
N : Node_Type renames Source.Nodes (Source_Node);
X : Count_Type;
B : Boolean;
begin
if Is_In (Target, N) then
Delete (Target, N.Element);
else
Insert (Target, N.Element, X, B);
pragma Assert (B);
end if;
end Process;
-- Start of processing for Symmetric_Difference
begin
if Target'Address = Source'Address then
HT_Ops.Clear (Target);
return;
end if;
if Target.Length = 0 then
Assign (Target => Target, Source => Source);
return;
end if;
TC_Check (Target.TC);
Iterate (Source);
end Symmetric_Difference;
function Symmetric_Difference (Left, Right : Set) return Set is
C : Count_Type;
begin
if Left'Address = Right'Address then
return Empty_Set;
end if;
if Right.Length = 0 then
return Left;
end if;
if Left.Length = 0 then
return Right;
end if;
C := Left.Length + Right.Length;
return Result : Set (C, To_Prime (C)) do
Iterate_Left : declare
procedure Process (L_Node : Count_Type);
procedure Iterate is
new HT_Ops.Generic_Iteration (Process);
-------------
-- Process --
-------------
procedure Process (L_Node : Count_Type) is
N : Node_Type renames Left.Nodes (L_Node);
X : Count_Type;
B : Boolean;
begin
if not Is_In (Right, N) then
Insert (Result, N.Element, X, B);
pragma Assert (B);
end if;
end Process;
-- Start of processing for Iterate_Left
begin
Iterate (Left);
end Iterate_Left;
Iterate_Right : declare
procedure Process (R_Node : Count_Type);
procedure Iterate is
new HT_Ops.Generic_Iteration (Process);
-------------
-- Process --
-------------
procedure Process (R_Node : Count_Type) is
N : Node_Type renames Right.Nodes (R_Node);
X : Count_Type;
B : Boolean;
begin
if not Is_In (Left, N) then
Insert (Result, N.Element, X, B);
pragma Assert (B);
end if;
end Process;
-- Start of processing for Iterate_Right
begin
Iterate (Right);
end Iterate_Right;
end return;
end Symmetric_Difference;
------------
-- To_Set --
------------
function To_Set (New_Item : Element_Type) return Set is
X : Count_Type;
B : Boolean;
begin
return Result : Set (1, 1) do
Insert (Result, New_Item, X, B);
pragma Assert (B);
end return;
end To_Set;
-----------
-- Union --
-----------
procedure Union
(Target : in out Set;
Source : Set)
is
procedure Process (Src_Node : Count_Type);
procedure Iterate is
new HT_Ops.Generic_Iteration (Process);
-------------
-- Process --
-------------
procedure Process (Src_Node : Count_Type) is
N : Node_Type renames Source.Nodes (Src_Node);
X : Count_Type;
B : Boolean;
begin
Insert (Target, N.Element, X, B);
end Process;
-- Start of processing for Union
begin
if Target'Address = Source'Address then
return;
end if;
TC_Check (Target.TC);
-- ??? why is this code commented out ???
-- declare
-- N : constant Count_Type := Target.Length + Source.Length;
-- begin
-- if N > HT_Ops.Capacity (Target.HT) then
-- HT_Ops.Reserve_Capacity (Target.HT, N);
-- end if;
-- end;
Iterate (Source);
end Union;
function Union (Left, Right : Set) return Set is
C : Count_Type;
begin
if Left'Address = Right'Address then
return Left;
end if;
if Right.Length = 0 then
return Left;
end if;
if Left.Length = 0 then
return Right;
end if;
C := Left.Length + Right.Length;
return Result : Set (C, To_Prime (C)) do
Assign (Target => Result, Source => Left);
Union (Target => Result, Source => Right);
end return;
end Union;
---------
-- Vet --
---------
function Vet (Position : Cursor) return Boolean is
begin
if Position.Node = 0 then
return Position.Container = null;
end if;
if Position.Container = null then
return False;
end if;
declare
S : Set renames Position.Container.all;
N : Nodes_Type renames S.Nodes;
X : Count_Type;
begin
if S.Length = 0 then
return False;
end if;
if Position.Node > N'Last then
return False;
end if;
if N (Position.Node).Next = Position.Node then
return False;
end if;
X := S.Buckets (Element_Keys.Checked_Index
(S, N (Position.Node).Element));
for J in 1 .. S.Length loop
if X = Position.Node then
return True;
end if;
if X = 0 then
return False;
end if;
if X = N (X).Next then -- to prevent unnecessary looping
return False;
end if;
X := N (X).Next;
end loop;
return False;
end;
end Vet;
-----------
-- Write --
-----------
procedure Write
(Stream : not null access Root_Stream_Type'Class;
Container : Set)
is
procedure Write_Node
(Stream : not null access Root_Stream_Type'Class;
Node : Node_Type);
pragma Inline (Write_Node);
procedure Write_Nodes is
new HT_Ops.Generic_Write (Write_Node);
----------------
-- Write_Node --
----------------
procedure Write_Node
(Stream : not null access Root_Stream_Type'Class;
Node : Node_Type)
is
begin
Element_Type'Write (Stream, Node.Element);
end Write_Node;
-- Start of processing for Write
begin
Write_Nodes (Stream, Container);
end Write;
procedure Write
(Stream : not null access Root_Stream_Type'Class;
Item : Cursor)
is
begin
raise Program_Error with "attempt to stream set cursor";
end Write;
procedure Write
(Stream : not null access Root_Stream_Type'Class;
Item : Constant_Reference_Type)
is
begin
raise Program_Error with "attempt to stream reference";
end Write;
package body Generic_Keys is
-----------------------
-- Local Subprograms --
-----------------------
function Equivalent_Key_Node
(Key : Key_Type;
Node : Node_Type) return Boolean;
pragma Inline (Equivalent_Key_Node);
--------------------------
-- Local Instantiations --
--------------------------
package Key_Keys is
new Hash_Tables.Generic_Bounded_Keys
(HT_Types => HT_Types,
Next => Next,
Set_Next => Set_Next,
Key_Type => Key_Type,
Hash => Hash,
Equivalent_Keys => Equivalent_Key_Node);
------------------------
-- Constant_Reference --
------------------------
function Constant_Reference
(Container : aliased Set;
Key : Key_Type) return Constant_Reference_Type
is
Node : constant Count_Type :=
Key_Keys.Find (Container'Unrestricted_Access.all, Key);
begin
if Checks and then Node = 0 then
raise Constraint_Error with "key not in set";
end if;
declare
N : Node_Type renames Container.Nodes (Node);
TC : constant Tamper_Counts_Access :=
Container.TC'Unrestricted_Access;
begin
return R : constant Constant_Reference_Type :=
(Element => N.Element'Access,
Control => (Controlled with TC))
do
Lock (TC.all);
end return;
end;
end Constant_Reference;
--------------
-- Contains --
--------------
function Contains
(Container : Set;
Key : Key_Type) return Boolean
is
begin
return Find (Container, Key) /= No_Element;
end Contains;
------------
-- Delete --
------------
procedure Delete
(Container : in out Set;
Key : Key_Type)
is
X : Count_Type;
begin
Key_Keys.Delete_Key_Sans_Free (Container, Key, X);
if Checks and then X = 0 then
raise Constraint_Error with "attempt to delete key not in set";
end if;
HT_Ops.Free (Container, X);
end Delete;
-------------
-- Element --
-------------
function Element
(Container : Set;
Key : Key_Type) return Element_Type
is
Node : constant Count_Type :=
Key_Keys.Find (Container'Unrestricted_Access.all, Key);
begin
if Checks and then Node = 0 then
raise Constraint_Error with "key not in set";
end if;
return Container.Nodes (Node).Element;
end Element;
-------------------------
-- Equivalent_Key_Node --
-------------------------
function Equivalent_Key_Node
(Key : Key_Type;
Node : Node_Type) return Boolean
is
begin
return Equivalent_Keys (Key, Generic_Keys.Key (Node.Element));
end Equivalent_Key_Node;
-------------
-- Exclude --
-------------
procedure Exclude
(Container : in out Set;
Key : Key_Type)
is
X : Count_Type;
begin
Key_Keys.Delete_Key_Sans_Free (Container, Key, X);
HT_Ops.Free (Container, X);
end Exclude;
--------------
-- Finalize --
--------------
procedure Finalize (Control : in out Reference_Control_Type) is
begin
if Control.Container /= null then
Impl.Reference_Control_Type (Control).Finalize;
if Checks and then
Hash (Key (Element (Control.Old_Pos))) /= Control.Old_Hash
then
HT_Ops.Delete_Node_At_Index
(Control.Container.all, Control.Index, Control.Old_Pos.Node);
raise Program_Error with "key not preserved in reference";
end if;
Control.Container := null;
end if;
end Finalize;
----------
-- Find --
----------
function Find
(Container : Set;
Key : Key_Type) return Cursor
is
Node : constant Count_Type :=
Key_Keys.Find (Container'Unrestricted_Access.all, Key);
begin
return (if Node = 0 then No_Element
else Cursor'(Container'Unrestricted_Access, Node));
end Find;
---------
-- Key --
---------
function Key (Position : Cursor) return Key_Type is
begin
if Checks and then Position.Node = 0 then
raise Constraint_Error with
"Position cursor equals No_Element";
end if;
pragma Assert (Vet (Position), "bad cursor in function Key");
return Key (Position.Container.Nodes (Position.Node).Element);
end Key;
----------
-- Read --
----------
procedure Read
(Stream : not null access Root_Stream_Type'Class;
Item : out Reference_Type)
is
begin
raise Program_Error with "attempt to stream reference";
end Read;
------------------------------
-- Reference_Preserving_Key --
------------------------------
function Reference_Preserving_Key
(Container : aliased in out Set;
Position : Cursor) return Reference_Type
is
begin
if Checks and then Position.Container = null then
raise Constraint_Error with "Position cursor has no element";
end if;
if Checks and then Position.Container /= Container'Unrestricted_Access
then
raise Program_Error with
"Position cursor designates wrong container";
end if;
pragma Assert
(Vet (Position),
"bad cursor in function Reference_Preserving_Key");
declare
N : Node_Type renames Container.Nodes (Position.Node);
begin
return R : constant Reference_Type :=
(Element => N.Element'Unrestricted_Access,
Control =>
(Controlled with
Container.TC'Unrestricted_Access,
Container'Unrestricted_Access,
Index => Key_Keys.Index (Container, Key (Position)),
Old_Pos => Position,
Old_Hash => Hash (Key (Position))))
do
Lock (Container.TC);
end return;
end;
end Reference_Preserving_Key;
function Reference_Preserving_Key
(Container : aliased in out Set;
Key : Key_Type) return Reference_Type
is
Node : constant Count_Type := Key_Keys.Find (Container, Key);
begin
if Checks and then Node = 0 then
raise Constraint_Error with "key not in set";
end if;
declare
P : constant Cursor := Find (Container, Key);
begin
return R : constant Reference_Type :=
(Element => Container.Nodes (Node).Element'Unrestricted_Access,
Control =>
(Controlled with
Container.TC'Unrestricted_Access,
Container'Unrestricted_Access,
Index => Key_Keys.Index (Container, Key),
Old_Pos => P,
Old_Hash => Hash (Key)))
do
Lock (Container.TC);
end return;
end;
end Reference_Preserving_Key;
-------------
-- Replace --
-------------
procedure Replace
(Container : in out Set;
Key : Key_Type;
New_Item : Element_Type)
is
Node : constant Count_Type := Key_Keys.Find (Container, Key);
begin
if Checks and then Node = 0 then
raise Constraint_Error with
"attempt to replace key not in set";
end if;
Replace_Element (Container, Node, New_Item);
end Replace;
-----------------------------------
-- Update_Element_Preserving_Key --
-----------------------------------
procedure Update_Element_Preserving_Key
(Container : in out Set;
Position : Cursor;
Process : not null access
procedure (Element : in out Element_Type))
is
Indx : Hash_Type;
N : Nodes_Type renames Container.Nodes;
begin
if Checks and then Position.Node = 0 then
raise Constraint_Error with
"Position cursor equals No_Element";
end if;
if Checks and then Position.Container /= Container'Unrestricted_Access
then
raise Program_Error with
"Position cursor designates wrong set";
end if;
-- ??? why is this code commented out ???
-- if HT.Buckets = null
-- or else HT.Buckets'Length = 0
-- or else HT.Length = 0
-- or else Position.Node.Next = Position.Node
-- then
-- raise Program_Error with
-- "Position cursor is bad (set is empty)";
-- end if;
pragma Assert
(Vet (Position),
"bad cursor in Update_Element_Preserving_Key");
-- Per AI05-0022, the container implementation is required to detect
-- element tampering by a generic actual subprogram.
declare
E : Element_Type renames N (Position.Node).Element;
K : constant Key_Type := Key (E);
Lock : With_Lock (Container.TC'Unrestricted_Access);
begin
-- Record bucket now, in case key is changed
Indx := HT_Ops.Index (Container.Buckets, N (Position.Node));
Process (E);
if Equivalent_Keys (K, Key (E)) then
return;
end if;
end;
-- Key was modified, so remove this node from set.
if Container.Buckets (Indx) = Position.Node then
Container.Buckets (Indx) := N (Position.Node).Next;
else
declare
Prev : Count_Type := Container.Buckets (Indx);
begin
while N (Prev).Next /= Position.Node loop
Prev := N (Prev).Next;
if Checks and then Prev = 0 then
raise Program_Error with
"Position cursor is bad (node not found)";
end if;
end loop;
N (Prev).Next := N (Position.Node).Next;
end;
end if;
Container.Length := Container.Length - 1;
HT_Ops.Free (Container, Position.Node);
raise Program_Error with "key was modified";
end Update_Element_Preserving_Key;
-----------
-- Write --
-----------
procedure Write
(Stream : not null access Root_Stream_Type'Class;
Item : Reference_Type)
is
begin
raise Program_Error with "attempt to stream reference";
end Write;
end Generic_Keys;
end Ada.Containers.Bounded_Hashed_Sets;
|
------------------------------------------------------------------------------
-- --
-- ASIS-for-GNAT IMPLEMENTATION COMPONENTS --
-- --
-- A 4 G . A _ O S I N T --
-- --
-- S p e c --
-- --
-- Copyright (c) 1995-1999, 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). --
-- --
------------------------------------------------------------------------------
-- The original idea of this package was to be an ASIS analog of the GNAT
-- Osint package and to contain the low-level routines needed by different
-- components of the ASIS implementation. But its current version contains a
-- very few routines, so probably we should merge this package with some
-- other ASIS implementation utility package.
with GNAT.OS_Lib; use GNAT.OS_Lib;
with Types; use Types;
package A4G.A_Osint is
function Normalize_Directory_Name
(Directory : String)
return String;
-- Verify and normalize a directory name. If directory name is invalid,
-- this will return an empty string (not implemented for now - all the
-- checks should be made by a caller). Otherwise it will insure a
-- trailing directory separator and make other normalizations.
function Get_Max_File_Name_Length return Int;
-- yields the maximum file name length for system. Returns Int'Last,
-- if the system does not limit the maximum file name length.
procedure Free_Argument_List (List : in out Argument_List_Access);
-- if List is not null, frees the memory occupied by its content
end A4G.A_Osint;
|
package Rejuvenation.Nested is
function Remove_Nested_Flags (Source : String;
On_Flag : String;
Off_Flag : String;
Depth : Natural := 0
)
return String
with
Pre => On_Flag'Length > 0
and then Off_Flag'Length > 0
and then On_Flag /= Off_Flag;
-- Remove Nested Flags
-- An error is raised when Source doesn't end at Depth = 0
-- E.g. In case of pretty printing, the default mode is ON,
-- so the initial depth is one instead of zero.
end Rejuvenation.Nested;
|
------------------------------------------------------------------------------
-- --
-- GNAT RUN-TIME COMPONENTS --
-- --
-- G N A T . L I S T S --
-- --
-- B o d y --
-- --
-- Copyright (C) 2018-2020, Free Software Foundation, Inc. --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
-- ware Foundation; either version 3, or (at your option) any later ver- --
-- sion. GNAT is distributed in the hope that it will be useful, but WITH- --
-- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY --
-- or FITNESS FOR A PARTICULAR PURPOSE. --
-- --
-- As a special exception under Section 7 of GPL version 3, you are granted --
-- additional permissions described in the GCC Runtime Library Exception, --
-- version 3.1, as published by the Free Software Foundation. --
-- --
-- You should have received a copy of the GNU General Public License and --
-- a copy of the GCC Runtime Library Exception along with this program; --
-- see the files COPYING3 and COPYING.RUNTIME respectively. If not, see --
-- <http://www.gnu.org/licenses/>. --
-- --
-- GNAT was originally developed by the GNAT team at New York University. --
-- Extensive contributions were provided by Ada Core Technologies Inc. --
-- --
------------------------------------------------------------------------------
with Ada.Unchecked_Deallocation;
package body GNAT.Lists is
package body Doubly_Linked_Lists is
procedure Delete_Node
(L : Doubly_Linked_List;
Nod : Node_Ptr);
pragma Inline (Delete_Node);
-- Detach and delete node Nod from list L
procedure Ensure_Circular (Head : Node_Ptr);
pragma Inline (Ensure_Circular);
-- Ensure that dummy head Head is circular with respect to itself
procedure Ensure_Created (L : Doubly_Linked_List);
pragma Inline (Ensure_Created);
-- Verify that list L is created. Raise Not_Created if this is not the
-- case.
procedure Ensure_Full (L : Doubly_Linked_List);
pragma Inline (Ensure_Full);
-- Verify that list L contains at least one element. Raise List_Empty if
-- this is not the case.
procedure Ensure_Unlocked (L : Doubly_Linked_List);
pragma Inline (Ensure_Unlocked);
-- Verify that list L is unlocked. Raise Iterated if this is not the
-- case.
function Find_Node
(Head : Node_Ptr;
Elem : Element_Type) return Node_Ptr;
pragma Inline (Find_Node);
-- Travers a list indicated by dummy head Head to determine whethe there
-- exists a node with element Elem. If such a node exists, return it,
-- otherwise return null;
procedure Free is
new Ada.Unchecked_Deallocation
(Doubly_Linked_List_Attributes, Doubly_Linked_List);
procedure Free is new Ada.Unchecked_Deallocation (Node, Node_Ptr);
procedure Insert_Between
(L : Doubly_Linked_List;
Elem : Element_Type;
Left : Node_Ptr;
Right : Node_Ptr);
pragma Inline (Insert_Between);
-- Insert element Elem between nodes Left and Right of list L
function Is_Valid (Iter : Iterator) return Boolean;
pragma Inline (Is_Valid);
-- Determine whether iterator Iter refers to a valid element
function Is_Valid
(Nod : Node_Ptr;
Head : Node_Ptr) return Boolean;
pragma Inline (Is_Valid);
-- Determine whether node Nod is non-null and does not refer to dummy
-- head Head, thus making it valid.
procedure Lock (L : Doubly_Linked_List);
pragma Inline (Lock);
-- Lock all mutation functionality of list L
function Present (Nod : Node_Ptr) return Boolean;
pragma Inline (Present);
-- Determine whether node Nod exists
procedure Unlock (L : Doubly_Linked_List);
pragma Inline (Unlock);
-- Unlock all mutation functionality of list L
------------
-- Append --
------------
procedure Append
(L : Doubly_Linked_List;
Elem : Element_Type)
is
Head : Node_Ptr;
begin
Ensure_Created (L);
Ensure_Unlocked (L);
-- Ensure that the dummy head of an empty list is circular with
-- respect to itself.
Head := L.Nodes'Access;
Ensure_Circular (Head);
-- Append the node by inserting it between the last node and the
-- dummy head.
Insert_Between
(L => L,
Elem => Elem,
Left => Head.Prev,
Right => Head);
end Append;
------------
-- Create --
------------
function Create return Doubly_Linked_List is
begin
return new Doubly_Linked_List_Attributes;
end Create;
--------------
-- Contains --
--------------
function Contains
(L : Doubly_Linked_List;
Elem : Element_Type) return Boolean
is
Head : Node_Ptr;
Nod : Node_Ptr;
begin
Ensure_Created (L);
Head := L.Nodes'Access;
Nod := Find_Node (Head, Elem);
return Is_Valid (Nod, Head);
end Contains;
------------
-- Delete --
------------
procedure Delete
(L : Doubly_Linked_List;
Elem : Element_Type)
is
Head : Node_Ptr;
Nod : Node_Ptr;
begin
Ensure_Created (L);
Ensure_Full (L);
Ensure_Unlocked (L);
Head := L.Nodes'Access;
Nod := Find_Node (Head, Elem);
if Is_Valid (Nod, Head) then
Delete_Node (L, Nod);
end if;
end Delete;
------------------
-- Delete_First --
------------------
procedure Delete_First (L : Doubly_Linked_List) is
Head : Node_Ptr;
Nod : Node_Ptr;
begin
Ensure_Created (L);
Ensure_Full (L);
Ensure_Unlocked (L);
Head := L.Nodes'Access;
Nod := Head.Next;
if Is_Valid (Nod, Head) then
Delete_Node (L, Nod);
end if;
end Delete_First;
-----------------
-- Delete_Last --
-----------------
procedure Delete_Last (L : Doubly_Linked_List) is
Head : Node_Ptr;
Nod : Node_Ptr;
begin
Ensure_Created (L);
Ensure_Full (L);
Ensure_Unlocked (L);
Head := L.Nodes'Access;
Nod := Head.Prev;
if Is_Valid (Nod, Head) then
Delete_Node (L, Nod);
end if;
end Delete_Last;
-----------------
-- Delete_Node --
-----------------
procedure Delete_Node
(L : Doubly_Linked_List;
Nod : Node_Ptr)
is
Ref : Node_Ptr := Nod;
pragma Assert (Present (Ref));
Next : constant Node_Ptr := Ref.Next;
Prev : constant Node_Ptr := Ref.Prev;
begin
pragma Assert (Present (L));
pragma Assert (Present (Next));
pragma Assert (Present (Prev));
Prev.Next := Next; -- Prev ---> Next
Next.Prev := Prev; -- Prev <--> Next
Ref.Next := null;
Ref.Prev := null;
L.Elements := L.Elements - 1;
-- Invoke the element destructor before deallocating the node
Destroy_Element (Nod.Elem);
Free (Ref);
end Delete_Node;
-------------
-- Destroy --
-------------
procedure Destroy (L : in out Doubly_Linked_List) is
Head : Node_Ptr;
begin
Ensure_Created (L);
Ensure_Unlocked (L);
Head := L.Nodes'Access;
while Is_Valid (Head.Next, Head) loop
Delete_Node (L, Head.Next);
end loop;
Free (L);
end Destroy;
---------------------
-- Ensure_Circular --
---------------------
procedure Ensure_Circular (Head : Node_Ptr) is
pragma Assert (Present (Head));
begin
if not Present (Head.Next) and then not Present (Head.Prev) then
Head.Next := Head;
Head.Prev := Head;
end if;
end Ensure_Circular;
--------------------
-- Ensure_Created --
--------------------
procedure Ensure_Created (L : Doubly_Linked_List) is
begin
if not Present (L) then
raise Not_Created;
end if;
end Ensure_Created;
-----------------
-- Ensure_Full --
-----------------
procedure Ensure_Full (L : Doubly_Linked_List) is
begin
pragma Assert (Present (L));
if L.Elements = 0 then
raise List_Empty;
end if;
end Ensure_Full;
---------------------
-- Ensure_Unlocked --
---------------------
procedure Ensure_Unlocked (L : Doubly_Linked_List) is
begin
pragma Assert (Present (L));
-- The list has at least one outstanding iterator
if L.Iterators > 0 then
raise Iterated;
end if;
end Ensure_Unlocked;
-----------
-- Equal --
-----------
function Equal
(Left : Doubly_Linked_List;
Right : Doubly_Linked_List) return Boolean
is
Left_Head : Node_Ptr;
Left_Nod : Node_Ptr;
Right_Head : Node_Ptr;
Right_Nod : Node_Ptr;
begin
-- Two non-existent lists are considered equal
if Left = Nil and then Right = Nil then
return True;
-- A non-existent list is never equal to an already created list
elsif Left = Nil or else Right = Nil then
return False;
-- The two lists must contain the same number of elements to be equal
elsif Size (Left) /= Size (Right) then
return False;
end if;
-- Compare the two lists element by element
Left_Head := Left.Nodes'Access;
Left_Nod := Left_Head.Next;
Right_Head := Right.Nodes'Access;
Right_Nod := Right_Head.Next;
while Is_Valid (Left_Nod, Left_Head)
and then
Is_Valid (Right_Nod, Right_Head)
loop
if Left_Nod.Elem /= Right_Nod.Elem then
return False;
end if;
Left_Nod := Left_Nod.Next;
Right_Nod := Right_Nod.Next;
end loop;
return True;
end Equal;
---------------
-- Find_Node --
---------------
function Find_Node
(Head : Node_Ptr;
Elem : Element_Type) return Node_Ptr
is
pragma Assert (Present (Head));
Nod : Node_Ptr;
begin
-- Traverse the nodes of the list, looking for a matching element
Nod := Head.Next;
while Is_Valid (Nod, Head) loop
if Nod.Elem = Elem then
return Nod;
end if;
Nod := Nod.Next;
end loop;
return null;
end Find_Node;
-----------
-- First --
-----------
function First (L : Doubly_Linked_List) return Element_Type is
begin
Ensure_Created (L);
Ensure_Full (L);
return L.Nodes.Next.Elem;
end First;
--------------
-- Has_Next --
--------------
function Has_Next (Iter : Iterator) return Boolean is
Is_OK : constant Boolean := Is_Valid (Iter);
begin
-- The iterator is no longer valid which indicates that it has been
-- exhausted. Unlock all mutation functionality of the list because
-- the iterator cannot be advanced any further.
if not Is_OK then
Unlock (Iter.List);
end if;
return Is_OK;
end Has_Next;
------------------
-- Insert_After --
------------------
procedure Insert_After
(L : Doubly_Linked_List;
After : Element_Type;
Elem : Element_Type)
is
Head : Node_Ptr;
Nod : Node_Ptr;
begin
Ensure_Created (L);
Ensure_Unlocked (L);
Head := L.Nodes'Access;
Nod := Find_Node (Head, After);
if Is_Valid (Nod, Head) then
Insert_Between
(L => L,
Elem => Elem,
Left => Nod,
Right => Nod.Next);
end if;
end Insert_After;
-------------------
-- Insert_Before --
-------------------
procedure Insert_Before
(L : Doubly_Linked_List;
Before : Element_Type;
Elem : Element_Type)
is
Head : Node_Ptr;
Nod : Node_Ptr;
begin
Ensure_Created (L);
Ensure_Unlocked (L);
Head := L.Nodes'Access;
Nod := Find_Node (Head, Before);
if Is_Valid (Nod, Head) then
Insert_Between
(L => L,
Elem => Elem,
Left => Nod.Prev,
Right => Nod);
end if;
end Insert_Before;
--------------------
-- Insert_Between --
--------------------
procedure Insert_Between
(L : Doubly_Linked_List;
Elem : Element_Type;
Left : Node_Ptr;
Right : Node_Ptr)
is
pragma Assert (Present (L));
pragma Assert (Present (Left));
pragma Assert (Present (Right));
Nod : constant Node_Ptr :=
new Node'(Elem => Elem,
Next => Right, -- Left Nod ---> Right
Prev => Left); -- Left <--- Nod ---> Right
begin
Left.Next := Nod; -- Left <--> Nod ---> Right
Right.Prev := Nod; -- Left <--> Nod <--> Right
L.Elements := L.Elements + 1;
end Insert_Between;
--------------
-- Is_Empty --
--------------
function Is_Empty (L : Doubly_Linked_List) return Boolean is
begin
Ensure_Created (L);
return L.Elements = 0;
end Is_Empty;
--------------
-- Is_Valid --
--------------
function Is_Valid (Iter : Iterator) return Boolean is
begin
-- The invariant of Iterate and Next ensures that the iterator always
-- refers to a valid node if there exists one.
return Is_Valid (Iter.Curr_Nod, Iter.List.Nodes'Access);
end Is_Valid;
--------------
-- Is_Valid --
--------------
function Is_Valid
(Nod : Node_Ptr;
Head : Node_Ptr) return Boolean
is
begin
-- A node is valid if it is non-null, and does not refer to the dummy
-- head of some list.
return Present (Nod) and then Nod /= Head;
end Is_Valid;
-------------
-- Iterate --
-------------
function Iterate (L : Doubly_Linked_List) return Iterator is
begin
Ensure_Created (L);
-- Lock all mutation functionality of the list while it is being
-- iterated on.
Lock (L);
return (List => L, Curr_Nod => L.Nodes.Next);
end Iterate;
----------
-- Last --
----------
function Last (L : Doubly_Linked_List) return Element_Type is
begin
Ensure_Created (L);
Ensure_Full (L);
return L.Nodes.Prev.Elem;
end Last;
----------
-- Lock --
----------
procedure Lock (L : Doubly_Linked_List) is
begin
pragma Assert (Present (L));
-- The list may be locked multiple times if multiple iterators are
-- operating over it.
L.Iterators := L.Iterators + 1;
end Lock;
----------
-- Next --
----------
procedure Next
(Iter : in out Iterator;
Elem : out Element_Type)
is
Is_OK : constant Boolean := Is_Valid (Iter);
Saved : constant Node_Ptr := Iter.Curr_Nod;
begin
-- The iterator is no linger valid which indicates that it has been
-- exhausted. Unlock all mutation functionality of the list as the
-- iterator cannot be advanced any further.
if not Is_OK then
Unlock (Iter.List);
raise Iterator_Exhausted;
end if;
-- Advance to the next node along the list
Iter.Curr_Nod := Iter.Curr_Nod.Next;
Elem := Saved.Elem;
end Next;
-------------
-- Prepend --
-------------
procedure Prepend
(L : Doubly_Linked_List;
Elem : Element_Type)
is
Head : Node_Ptr;
begin
Ensure_Created (L);
Ensure_Unlocked (L);
-- Ensure that the dummy head of an empty list is circular with
-- respect to itself.
Head := L.Nodes'Access;
Ensure_Circular (Head);
-- Append the node by inserting it between the dummy head and the
-- first node.
Insert_Between
(L => L,
Elem => Elem,
Left => Head,
Right => Head.Next);
end Prepend;
-------------
-- Present --
-------------
function Present (L : Doubly_Linked_List) return Boolean is
begin
return L /= Nil;
end Present;
-------------
-- Present --
-------------
function Present (Nod : Node_Ptr) return Boolean is
begin
return Nod /= null;
end Present;
-------------
-- Replace --
-------------
procedure Replace
(L : Doubly_Linked_List;
Old_Elem : Element_Type;
New_Elem : Element_Type)
is
Head : Node_Ptr;
Nod : Node_Ptr;
begin
Ensure_Created (L);
Ensure_Unlocked (L);
Head := L.Nodes'Access;
Nod := Find_Node (Head, Old_Elem);
if Is_Valid (Nod, Head) then
Nod.Elem := New_Elem;
end if;
end Replace;
----------
-- Size --
----------
function Size (L : Doubly_Linked_List) return Natural is
begin
Ensure_Created (L);
return L.Elements;
end Size;
------------
-- Unlock --
------------
procedure Unlock (L : Doubly_Linked_List) is
begin
pragma Assert (Present (L));
-- The list may be locked multiple times if multiple iterators are
-- operating over it.
L.Iterators := L.Iterators - 1;
end Unlock;
end Doubly_Linked_Lists;
end GNAT.Lists;
|
-- WORDS, a Latin dictionary, by Colonel William Whitaker (USAF, Retired)
--
-- Copyright William A. Whitaker (1936–2010)
--
-- This is a free program, which means it is proper to copy it and pass
-- it on to your friends. Consider it a developmental item for which
-- there is no charge. However, just for form, it is Copyrighted
-- (c). Permission is hereby freely given for any and all use of program
-- and data. You can sell it as your own, but at least tell me.
--
-- This version is distributed without obligation, but the developer
-- would appreciate comments and suggestions.
--
-- All parts of the WORDS system, source code and data files, are made freely
-- available to anyone who wishes to use them, for whatever purpose.
with Ada.Strings.Fixed;
with Support_Utils.Word_Support_Package; use Support_Utils.Word_Support_Package;
with Latin_Utils.Strings_Package; use Latin_Utils.Strings_Package;
with Latin_Utils.Latin_File_Names; use Latin_Utils.Latin_File_Names;
with Support_Utils.Char_Utils;
with Latin_Utils.Preface;
package body Support_Utils.Line_Stuff is
procedure Load_Dictionary (Dict : in out Dictionary;
Dictionary_File_Name : String) is
-- For loading a DICTIONARY list from a file
-- Only used now for DICT.LOC
Dictionary_File : File_Type;
Blk_Stem : constant Stem_Type := Null_Stem_Type;
Sts : Stems_Type := Null_Stems_Type;
Pt : Part_Entry := Null_Part_Entry;
Tran : Translation_Record := Null_Translation_Record;
Value : constant Numeral_Value_Type := 0;
Mean : Meaning_Type := Null_Meaning_Type;
Fc1, Fc2, Fc3, Fc4 : Character;
Line, St_Line : String (1 .. 100) := (others => ' ');
Blank_Line : constant String (1 .. 100) := (others => ' ');
L, Ll, Lll, Last : Integer := 0;
Number_Of_Dictionary_Entries : Integer := 0;
procedure Get_Stem (S : in String;
Stem : out Stem_Type; Last : out Integer) is
I : Integer := 1;
L : Integer := Ada.Strings.Fixed.Index_Non_Blank (S);
begin
Stem := Null_Stem_Type;
-- Count until the first blank
-- Return that String
while L <= S'Last and then S (L) /= ' ' loop
Stem (I) := S (L);
I := I + 1;
L := L + 1;
end loop;
-- Return last
Last := L;
end Get_Stem;
begin
Open (Dictionary_File, In_File, Dictionary_File_Name);
Preface.Put ("Dictionary loading");
while not End_Of_File (Dictionary_File) loop
--TEXT_IO.PUT_LINE ("GETTING");
St_Line := Blank_Line;
Get_Non_Comment_Line (Dictionary_File, St_Line, Last); -- STEMS
Line := Blank_Line;
--TEXT_IO.PUT ("1 ");
Get_Non_Comment_Line (Dictionary_File, Line, L);
-- PART
--TEXT_IO.PUT ("2 ");
Part_Entry_IO.Get (Line (1 .. L), Pt, Ll);
--TEXT_IO.PUT ("3 ");
---- KIND_ENTRY_IO.GET (LINE (LL + 1 .. L), PT.POFS, KIND, LL);
--TEXT_IO.PUT ("4 ");
Translation_Record_IO.Get (Line (Ll + 1 .. L), Tran, Lll);
--TEXT_IO.PUT ("5 ");
--TEXT_IO.PUT_LINE ("READ PART");
-- Specialize for parts
-- If ADV then look if the CO is something other than X
-- If so (like POS) then only that stem is active,
-- and the others => xxx
-- Same for ADJ
-- If the ADJ or ADV stems have different first letters then make them
-- different dictionary entries -- Do this in LOAD and in DICT.DIC
--TEXT_IO.PUT_LINE ("GETTING STEMS IN LOAD_DICTIONARY");
Sts := Null_Stems_Type;
Ll := 1;
-- Extract up to 4 stems
for I in 1 .. Number_Of_Stems (Pt.Pofs) loop -- EXTRACT STEMS
Get_Stem (St_Line (Ll .. Last), Sts (I), Ll);
end loop;
--for I in 1 .. NUMBER_OF_STEMS (PT.POFS) loop
-- TEXT_IO.PUT (STS (I));
--end loop;
--TEXT_IO.NEW_LINE;
Line := Blank_Line;
Get_Non_Comment_Line (Dictionary_File, Line, L); -- MEANING
Mean := Head (Trim (Line (1 .. L)), Max_Meaning_Size);
--TEXT_IO.PUT_LINE ("READ MEANING");
-- Now take care of other first letters in a gross way
Fc1 := Lower_Case (Sts (1)(1));
Fc2 := Lower_Case (Sts (2)(1));
Fc3 := Lower_Case (Sts (3)(1));
Fc4 := Lower_Case (Sts (4)(1));
Char_Utils.V_To_U_And_J_To_I (Fc1);
Char_Utils.V_To_U_And_J_To_I (Fc2);
Char_Utils.V_To_U_And_J_To_I (Fc3);
Char_Utils.V_To_U_And_J_To_I (Fc4);
if Pt.Pofs = N then
if Sts (2)(1) /= Sts (1)(1) and then
Sts (2)(1) /= ' ' and then
Sts (2)(1 .. 3) /= ZZZ_Stem (1 .. 3)
then
Dict (Fc1) :=
new Dictionary_Item'(((Sts (1), ZZZ_Stem, Blk_Stem, Blk_Stem),
--PT, KIND, TRAN, MEAN), DICT (FC1));
Pt, Tran, Mean), Dict (Fc1));
Dict (Fc2) :=
new Dictionary_Item'(((ZZZ_Stem, Sts (2), Blk_Stem, Blk_Stem),
--PT, KIND, TRAN, MEAN), DICT (FC2) );
Pt, Tran, Mean), Dict (Fc2));
else
--DICT (FC1) := new DICTIONARY_ITEM'((STS, PT, KIND, TRAN, MEAN),
Dict (Fc1) := new Dictionary_Item'((Sts, Pt, Tran, Mean),
Dict (Fc1));
end if;
elsif Pt.Pofs = Pron or Pt.Pofs = Pack then
if Sts (2)(1) /= Sts (1)(1) and then
Sts (2)(1) /= ' ' and then
Sts (2)(1 .. 3) /= ZZZ_Stem (1 .. 3)
then
Dict (Fc1) :=
new Dictionary_Item'(((Sts (1), ZZZ_Stem, Blk_Stem, Blk_Stem),
--PT, KIND, TRAN, MEAN), DICT (FC1));
Pt, Tran, Mean), Dict (Fc1));
Dict (Fc2) :=
new Dictionary_Item'(((ZZZ_Stem, Sts (2), Blk_Stem, Blk_Stem),
--PT, KIND, TRAN, MEAN), DICT (FC2));
Pt, Tran, Mean), Dict (Fc2));
else
--DICT (FC1) := new DICTIONARY_ITEM'((STS, PT, KIND, TRAN, MEAN),
Dict (Fc1) := new Dictionary_Item'((Sts, Pt, Tran, Mean),
Dict (Fc1));
end if;
elsif Pt.Pofs = Adj then
if Pt.Adj.Co = X then -- X for all KINDs
if (Sts (2)(1) /= Sts (1)(1) and then
Sts (2)(1) /= ' ' and then
Sts (2)(1 .. 3) /= ZZZ_Stem (1 .. 3)) or
(Sts (3)(1) /= Sts (1)(1) and then
Sts (3)(1) /= ' ' and then
Sts (3)(1 .. 3) /= ZZZ_Stem (1 .. 3)) or
(Sts (4)(1) /= Sts (1)(1) and then
Sts (4)(1) /= ' ' and then
Sts (4)(1 .. 3) /= ZZZ_Stem (1 .. 3))
then
Dict (Fc1) :=
new Dictionary_Item'(((Sts (1), Blk_Stem,
Blk_Stem, Blk_Stem),
(Adj, (Pt.Adj.Decl, Pos)),
--KIND, TRAN, MEAN), DICT (FC1));
Tran, Mean), Dict (Fc1));
Dict (Fc2) :=
new Dictionary_Item'(((ZZZ_Stem, Sts (2),
Blk_Stem, Blk_Stem),
(Adj, (Pt.Adj.Decl, Pos)),
--KIND, TRAN, MEAN), DICT (FC2));
Tran, Mean), Dict (Fc2));
Dict (Fc3) :=
new Dictionary_Item'(((ZZZ_Stem, ZZZ_Stem,
Sts (3), Blk_Stem),
(Adj, (Pt.Adj.Decl, Comp)),
--KIND, TRAN, MEAN), DICT (FC3));
Tran, Mean), Dict (Fc3));
Dict (Fc4) :=
new Dictionary_Item'(((ZZZ_Stem, ZZZ_Stem,
ZZZ_Stem, Sts (4)),
(Adj, (Pt.Adj.Decl, Super)),
--KIND, TRAN, MEAN), DICT (FC4));
Tran, Mean), Dict (Fc4));
end if;
elsif Pt.Adj.Co = Pos then
Dict (Fc1) :=
new Dictionary_Item'(((Sts (1), Blk_Stem, Blk_Stem, Blk_Stem),
--(ADJ, (PT.ADJ.DECL, POS)), KIND, TRAN, MEAN),
(Adj, (Pt.Adj.Decl, Pos)), Tran, Mean),
Dict (Fc1));
Dict (Fc2) :=
new Dictionary_Item'(((Blk_Stem, Sts (2), Blk_Stem, Blk_Stem),
--(ADJ, (PT.ADJ.DECL, POS)), KIND, TRAN, MEAN),
(Adj, (Pt.Adj.Decl, Pos)), Tran, Mean),
Dict (Fc2));
elsif Pt.Adj.Co = Comp then
Dict (Fc1) :=
new Dictionary_Item'(((Blk_Stem, Blk_Stem, Sts (1), Blk_Stem),
--(ADJ, (PT.ADJ.DECL, COMP)), KIND, TRAN, MEAN),
(Adj, (Pt.Adj.Decl, Comp)), Tran, Mean),
Dict (Fc1));
elsif Pt.Adj.Co = Super then
Dict (Fc1) :=
new Dictionary_Item'(((Blk_Stem, Blk_Stem, Blk_Stem, Sts (1)),
--(ADJ, (PT.ADJ.DECL, SUPER)), KIND, TRAN, MEAN),
(Adj, (Pt.Adj.Decl, Super)), Tran, Mean),
Dict (Fc1));
else
--DICT (FC1) := new DICTIONARY_ITEM'((STS, PT, KIND, TRAN, MEAN),
Dict (Fc1) := new Dictionary_Item'((Sts, Pt, Tran, Mean),
Dict (Fc1));
end if;
elsif Pt.Pofs = Adv then
if Pt.Adv.Co = X then -- X for all KINDs
if (Sts (2)(1) /= Sts (1)(1) and then
Sts (2)(1) /= ' ' and then
Sts (2)(1 .. 3) /= ZZZ_Stem (1 .. 3)) or
(Sts (3)(1) /= Sts (1)(1) and then
Sts (3)(1) /= ' ' and then
Sts (3)(1 .. 3) /= ZZZ_Stem (1 .. 3))
then
Dict (Fc1) :=
new Dictionary_Item'(((Sts (1),
Blk_Stem, Blk_Stem, Blk_Stem),
--(ADV, (CO => POS)), KIND, TRAN, MEAN), DICT (FC1));
(Adv, (Co => Pos)), Tran, Mean), Dict (Fc1));
Dict (Fc2) :=
new Dictionary_Item'(((Sts (2),
Blk_Stem, Blk_Stem, Blk_Stem),
--(ADV, (CO => COMP)), KIND, TRAN, MEAN), DICT (FC2));
(Adv, (Co => Comp)), Tran, Mean), Dict (Fc2));
Dict (Fc3) :=
new Dictionary_Item'(((Sts (3),
Blk_Stem, Blk_Stem, Blk_Stem),
--(ADV, (CO => SUPER)), KIND, TRAN, MEAN), DICT (FC3));
(Adv, (Co => Super)), Tran, Mean), Dict (Fc3));
end if;
elsif Pt.Adv.Co = Pos then -- just a specific KIND
Dict (Fc1) :=
new Dictionary_Item'(((Sts (1), Blk_Stem, Blk_Stem, Blk_Stem),
--(ADV, (CO => POS)), KIND, TRAN, MEAN),
(Adv, (Co => Pos)), Tran, Mean),
Dict (Fc1));
elsif Pt.Adv.Co = Comp then
Dict (Fc1) :=
new Dictionary_Item'(((Blk_Stem, Sts (1), Blk_Stem, Blk_Stem),
--(ADV, (CO => COMP)), KIND, TRAN, MEAN),
(Adv, (Co => Comp)), Tran, Mean),
Dict (Fc1));
elsif Pt.Adv.Co = Super then
Dict (Fc1) :=
new Dictionary_Item'(((Blk_Stem, Blk_Stem, Sts (1), Blk_Stem),
--(ADV, (CO => SUPER)), KIND, TRAN, MEAN),
(Adv, (Co => Super)), Tran, Mean),
Dict (Fc1));
else
--DICT (FC1) := new DICTIONARY_ITEM'((STS, PT, KIND, TRAN, MEAN),
Dict (Fc1) := new Dictionary_Item'((Sts, Pt, Tran, Mean),
Dict (Fc1));
end if;
elsif Pt.Pofs = V then
if (Sts (2)(1) /= Sts (1)(1) and then
Sts (2)(1) /= ' ' and then
Sts (2)(1 .. 3) /= ZZZ_Stem (1 .. 3)) or
(Sts (3)(1) /= Sts (1)(1) and then
Sts (3)(1) /= ' ' and then
Sts (3)(1 .. 3) /= ZZZ_Stem (1 .. 3)) or
(Sts (4)(1) /= Sts (1)(1) and then
Sts (4)(1) /= ' ' and then
Sts (4)(1 .. 3) /= ZZZ_Stem (1 .. 3))
then
Dict (Fc1) :=
new Dictionary_Item'(((Sts (1), ZZZ_Stem, ZZZ_Stem, ZZZ_Stem),
--PT, KIND, TRAN, MEAN), DICT (FC1));
Pt, Tran, Mean), Dict (Fc1));
Dict (Fc2) :=
new Dictionary_Item'(((ZZZ_Stem, Sts (2), ZZZ_Stem, ZZZ_Stem),
--PT, KIND, TRAN, MEAN), DICT (FC2));
Pt, Tran, Mean), Dict (Fc2));
Dict (Fc3) :=
new Dictionary_Item'(((ZZZ_Stem, ZZZ_Stem, Sts (3), ZZZ_Stem),
--PT, KIND, TRAN, MEAN), DICT (FC3));
Pt, Tran, Mean), Dict (Fc3));
Dict (Fc4) :=
new Dictionary_Item'(((ZZZ_Stem, ZZZ_Stem, ZZZ_Stem, Sts (4)),
--PT, KIND, TRAN, MEAN), DICT (FC4));
Pt, Tran, Mean), Dict (Fc4));
else
--DICT (FC1) := new DICTIONARY_ITEM'((STS, PT, KIND, TRAN, MEAN),
Dict (Fc1) := new Dictionary_Item'((Sts, Pt, Tran, Mean),
Dict (Fc1));
end if;
elsif Pt.Pofs = Num then
if Pt.Num.Sort = X then -- X for all KINDs
if Sts (1)(1) /= ' ' and then
Sts (1)(1 .. 3) /= ZZZ_Stem (1 .. 3)
then
Dict (Fc1) :=
new Dictionary_Item'(((Sts (1), Blk_Stem,
Blk_Stem, Blk_Stem),
--(NUM, (PT.NUM.DECL, CARD)), KIND, TRAN, MEAN),
(Num, (Pt.Num.Decl, Card, Value)), Tran, Mean),
Dict (Fc1));
end if;
if Sts (2)(1) /= ' ' and then
Sts (2)(1 .. 3) /= ZZZ_Stem (1 .. 3)
then
Dict (Fc2) :=
new Dictionary_Item'(((ZZZ_Stem, Sts (2),
Blk_Stem, Blk_Stem),
--(NUM, ((0, 0), ORD)), KIND, TRAN, MEAN),
(Num, ((0, 0), Ord, Value)), Tran, Mean),
Dict (Fc2));
end if;
if Sts (3)(1) /= ' ' and then
Sts (3)(1 .. 3) /= ZZZ_Stem (1 .. 3)
then
Dict (Fc3) :=
new Dictionary_Item'(((ZZZ_Stem, ZZZ_Stem,
Sts (3), Blk_Stem),
--(NUM, (PT.NUM.DECL, DIST)), KIND, TRAN, MEAN),
(Num, (Pt.Num.Decl, Dist, Value)), Tran, Mean),
Dict (Fc3));
end if;
if Sts (4)(1) /= ' ' and then
Sts (4)(1 .. 3) /= ZZZ_Stem (1 .. 3)
then
Dict (Fc4) :=
new Dictionary_Item'(((ZZZ_Stem, ZZZ_Stem,
ZZZ_Stem, Sts (4)),
--(NUM, (PT.NUM.DECL, ADVERB)), KIND, TRAN, MEAN),
(Num, (Pt.Num.Decl, Adverb, Value)), Tran, Mean),
Dict (Fc4));
end if;
elsif Pt.Num.Sort = Card then
Dict (Fc1) :=
new Dictionary_Item'(((Sts (1), Blk_Stem, Blk_Stem, Blk_Stem),
--(NUM, (PT.NUM.DECL, CARD)), KIND, TRAN, MEAN),
(Num, (Pt.Num.Decl, Card, Value)), Tran, Mean),
Dict (Fc1));
elsif Pt.Num.Sort = Ord then
Dict (Fc1) :=
new Dictionary_Item'(((Blk_Stem, Sts (1), Blk_Stem, Blk_Stem),
--(NUM, (PT.NUM.DECL, ORD)), KIND, TRAN, MEAN),
(Num, (Pt.Num.Decl, Ord, Value)), Tran, Mean),
Dict (Fc1));
elsif Pt.Num.Sort = Dist then
Dict (Fc1) :=
new Dictionary_Item'(((Blk_Stem, Blk_Stem, Sts (1), Blk_Stem),
--(NUM, (PT.NUM.DECL, DIST)), KIND, TRAN, MEAN),
(Num, (Pt.Num.Decl, Dist, Value)), Tran, Mean),
Dict (Fc1));
elsif Pt.Num.Sort = Adverb then
Dict (Fc1) :=
new Dictionary_Item'(((Blk_Stem, Blk_Stem, Blk_Stem, Sts (1)),
--(NUM, (PT.NUM.DECL, ADVERB)), KIND, TRAN, MEAN),
(Num, (Pt.Num.Decl, Adverb, Value)), Tran, Mean),
Dict (Fc1));
end if;
else
--DICT (FC1) := new DICTIONARY_ITEM'((STS, PT, KIND, TRAN, MEAN),
Dict (Fc1) := new Dictionary_Item'((Sts, Pt, Tran, Mean),
Dict (Fc1));
end if;
Number_Of_Dictionary_Entries := Number_Of_Dictionary_Entries + 1;
end loop;
Close (Dictionary_File);
Preface.Set_Col (33); Preface.Put ("-- ");
Preface.Put (Number_Of_Dictionary_Entries, 6);
Preface.Put (" entries"); Preface.Set_Col (55);
Preface.Put_Line ("-- Loaded correctly");
exception
when others =>
Preface.Put_Line (" LOAD_DICTIONARY exception !!!!!!!!!!");
Preface.Put_Line (St_Line (1 .. Last));
Preface.Put_Line (Line (1 .. L));
Close (Dictionary_File);
Preface.Set_Col (33); Preface.Put ("-- ");
Preface.Put (Number_Of_Dictionary_Entries, 6);
Preface.Put (" entries"); Preface.Set_Col (55);
Preface.Put_Line ("-- Loaded anyway ");
end Load_Dictionary;
procedure Load_Stem_File (D_K : Dictionary_Kind) is
-- This is used to load a dictionary access file, like DIC.LOC
-- It uses the single first letter index rather than the two letter
-- This dictionary must be searched with a somewhat different procedure
-- Not used when one loads from a regular STEMFILE (which uses
-- two letters)
--use LATIN_DEBUG;
use Stem_Io;
use Dict_IO;
I : Stem_Io.Count := 1;
--M_P_R : MEANING_TYPE;
M : Dict_IO.Positive_Count := 1;
Dlc : Dictionary := Dict_Loc;
--DS : DICTIONARY_STEM;
begin
--PUT_LINE ("LOAD_STEM_FILE for LOC");
if Is_Open (Stem_File (D_K)) then
Delete (Stem_File (D_K));
end if;
Create (Stem_File (D_K), Inout_File,
Add_File_Name_Extension (Stem_File_Name,
Dictionary_Kind'Image (D_K)));
--PUT_LINE ("LOAD_STEM_FILE for LOC - Created STEM_FILE");
if Is_Open (Dict_File (D_K)) then
Delete (Dict_File (D_K));
end if;
Create (Dict_File (D_K), Inout_File,
Add_File_Name_Extension (Dict_File_Name,
Dictionary_Kind'Image (D_K)));
--PUT_LINE ("LOAD_STEM_FILE for LOC - Created DICT_FILE");
--PUT_LINE ("L_D_F Start M = " & INTEGER'IMAGE (INTEGER (M)));
for Fc in Character range 'a' .. 'z' loop
-- LOAD_DICTIONARY should have assured that all v were in u
--LATIN_DEBUG.PUT_LINE ("L_D_F Entering FC loop");
Ddlf (Fc, 'a', D_K) := I;
Ddll (Fc, 'a', D_K) := 0;
while Dlc (Fc) /= null loop
Dict_IO.Set_Index (Dict_File (D_K), M);
-- %%%%%%%%%%%!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!%%%%%%%%%%%%%%%%%%%
--PUT_LINE (DLC (FC).DE.TRAN.MEAN);
-- M_P_R := DLC (FC).DE.TRAN.MEAN;
--DICT_IO.WRITE (DICT_FILE (D_K), M_P_R); --@@@@@@@@@@@@@@@@@@@@@
Dict_IO.Write (Dict_File (D_K), Dlc (Fc).De);
for K in Stem_Key_Type range 1 .. 4 loop
if Dlc (Fc).De.Stems (K) /= Null_Stem_Type and
Dlc (Fc).De.Stems (K) /= ZZZ_Stem
then
Write (Stem_File (D_K),
(Dlc (Fc).De.Stems (K), Dlc (Fc).De.Part, K, M));
Ddll (Fc, 'a', D_K) := I;
I := I + 1;
end if;
end loop;
Dlc (Fc) := Dlc (Fc).Succ;
M := M + 1;
--PUT_LINE ("L_D_F 22222 M = " & INTEGER'IMAGE (INTEGER (M)));
end loop;
--PUT_LINE ("L_D_F 33333 M = " & INTEGER'IMAGE (INTEGER (M)));
end loop;
--PUT_LINE ("L_D_F 44444 M = " & INTEGER'IMAGE (INTEGER (M)));
end Load_Stem_File;
package body Tackon_Line_Io is separate;
package body Prefix_Line_Io is separate;
package body Suffix_Line_Io is separate;
package body Unique_Entry_Io is separate;
procedure Load_Uniques (Unq : in out Latin_Uniques; File_Name : in String) is
use Quality_Record_IO;
use Kind_Entry_IO;
use Dict_IO;
Uniques_File : Ada.Text_IO.File_Type;
Blanks : constant String (1 .. 100) := (others => ' ');
Line, Stem_Line : String (1 .. 100) := (others => ' ');
Last, L : Integer := 0;
Stem : Stem_Type := Null_Stem_Type;
Qual : Quality_Record;
Kind : Kind_Entry;
--PART : PART_ENTRY := NULL_PART_ENTRY;
Tran : Translation_Record := Null_Translation_Record;
MNPC : MNPC_Type := Null_MNPC;
Mean : Meaning_Type := Null_Meaning_Type;
M : Dict_IO.Positive_Count := 1;
Number_Of_Uniques_Entries : Integer := 0;
begin
--TEXT_IO.PUT_LINE ("UNIQUES started");
Ada.Text_IO.Open (Uniques_File, Ada.Text_IO.In_File, File_Name);
Preface.Set_Col (1);
Preface.Put ("UNIQUES file loading");
-- if DICT_IO.IS_OPEN (DICT_FILE (D_K)) then
-- DICT_IO.DELETE (DICT_FILE (D_K));
-- end if;
-- DICT_IO.CREATE (DICT_FILE (D_K), DICT_IO.INOUT_FILE, "");
--ADD_FILE_NAME_EXTENSION (DICT_FILE_NAME, DICTIONARY_KIND'IMAGE (D_K)));
while not End_Of_File (Uniques_File) loop
Stem_Line := Blanks;
Get_Line (Uniques_File, Stem_Line, Last); -- STEM
Stem := Head (Trim (Stem_Line (1 .. Last)), Max_Stem_Size);
Line := Blanks;
Get_Line (Uniques_File, Line, Last); -- QUAL, KIND, TRAN
Get (Line (1 .. Last), Qual, L);
Get (Line (L + 1 .. Last), Qual.Pofs, Kind, L);
-- FIXME: Why not Translation_Record_IO.Get ?
Age_Type_IO.Get (Line (L + 1 .. Last), Tran.Age, L);
Area_Type_IO.Get (Line (L + 1 .. Last), Tran.Area, L);
Geo_Type_IO.Get (Line (L + 1 .. Last), Tran.Geo, L);
Frequency_Type_IO.Get (Line (L + 1 .. Last), Tran.Freq, L);
Source_Type_IO.Get (Line (L + 1 .. Last), Tran.Source, L);
Line := Blanks;
Get_Line (Uniques_File, Line, L); -- MEAN
Mean := Head (Trim (Line (1 .. L)), Max_Meaning_Size);
--@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
declare
Unique_De : Dictionary_Entry;
Part : Part_Entry := Null_Part_Entry;
begin
case Part.Pofs is
when N =>
Part := (N, (Qual.Noun.Decl, Qual.Noun.Gender, Kind.N_Kind));
when Pron =>
Part := (Pron, (Qual.Pron.Decl, Kind.Pron_Kind));
when Pack =>
Part := (Pack, (Qual.Pack.Decl, Kind.Pack_Kind));
when Adj =>
Part := (Adj, (Qual.Adj.Decl, Qual.Adj.Comparison));
when Num =>
Part := (Num, (Qual.Num.Decl, Qual.Num.Sort, Kind.Num_Value));
when Adv =>
Part := (Adv, (Co => Qual.Adv.Comparison));
when V =>
Part := (V, (Qual.Verb.Con, Kind.V_Kind));
when others =>
Part := Null_Part_Entry;
end case;
Unique_De.Stems := (Stem,
Null_Stem_Type, Null_Stem_Type, Null_Stem_Type);
Unique_De.Part := Part;
--UNIQUE_DE.KIND := KIND;
Unique_De.Tran := Tran;
Unique_De.Mean := Mean;
-- DICT_IO.SET_INDEX (DICT_FILE (D_K), M);
-- DICT_IO.WRITE (DICT_FILE (D_K), UNIQUE_DE);
Uniques_De (M) := Unique_De;
end;
--@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
MNPC := M;
if Lower_Case (Stem (1)) = 'v' then
Unq ('u') :=
new Unique_Item'(Stem, Qual, Kind, MNPC, Unq (Lower_Case ('u')));
elsif Lower_Case (Stem (1)) = 'j' then
Unq ('i') :=
new Unique_Item'(Stem, Qual, Kind, MNPC, Unq (Lower_Case ('i')));
else
Unq (Lower_Case (Stem (1))) :=
new Unique_Item'(Stem, Qual, Kind, MNPC,
Unq (Lower_Case (Stem (1))));
end if;
M := M + 1;
Number_Of_Uniques_Entries := Integer (M) - 1;
end loop;
Close (Uniques_File);
Preface.Set_Col (33);
Preface.Put ("-- "); Preface.Put (Number_Of_Uniques_Entries, 6);
Preface.Put (" entries");
Preface.Set_Col (55); Preface.Put_Line ("-- Loaded correctly");
exception
when Ada.Text_IO.Name_Error =>
Preface.Put_Line ("There is no UNIQUES file");
when others =>
Preface.New_Line;
Preface.Put_Line
("LOAD_UNIQUES exception !!!!!!!!!!!!!!!!!!!!!");
Preface.Put_Line (Stem_Line (1 .. Last));
Preface.Put_Line (Line (1 .. L));
Close (Uniques_File);
Preface.Set_Col (33);
Preface.Put ("-- "); Preface.Put (Number_Of_Uniques_Entries, 6);
Preface.Put (" entries");
Preface.Set_Col (55); Preface.Put_Line ("-- Loaded before error");
--raise;
end Load_Uniques;
begin
-- PARSE_LINE_IO.DEFAULT_WIDTH :=
-- MAX_STEM_SIZE + 1 +
-- INFLECTION_RECORD_IO.DEFAULT_WIDTH + 1 +
-- DICTIONARY_KIND_IO.DEFAULT_WIDTH + 1 +
-- MAX_MEANING_SIZE;
Prefix_Line_Io.Default_Width := Part_Of_Speech_Type_IO.Default_Width + 1 +
Max_Stem_Size + 1 +
1 + 1 +
Prefix_Entry_Io.Default_Width + 1 +
Max_Meaning_Size;
Suffix_Line_Io.Default_Width := Part_Of_Speech_Type_IO.Default_Width + 1 +
Max_Stem_Size + 1 +
1 + 1 +
Suffix_Entry_Io.Default_Width + 1 +
Max_Meaning_Size;
Tackon_Line_Io.Default_Width := Part_Of_Speech_Type_IO.Default_Width + 1 +
Max_Stem_Size + 1 +
Tackon_Entry_Io.Default_Width + 1 +
Max_Meaning_Size;
Unique_Entry_Io.Default_Width := Max_Stem_Size + 1 +
Inflection_Record_IO.Default_Width + 1 +
Translation_Record_IO.Default_Width;
end Support_Utils.Line_Stuff;
|
-- openapi_ipify
-- OpenAPI client for ipify, a simple public IP address API
-- ------------ EDIT NOTE ------------
-- This file was generated with openapi-generator. You can modify it to implement
-- the server. After you modify this file, you should add the following line
-- to the .openapi-generator-ignore file:
--
-- src/.ads
--
-- Then, you can drop this edit note comment.
-- ------------ EDIT NOTE ------------
package is
end ;
|
with Case_Optimization_Pkg1; use Case_Optimization_Pkg1;
package Case_Optimization1 is
function Len (E : Element) return Integer;
end Case_Optimization1;
|
with AUnit; use AUnit;
with AUnit.Test_Cases; use AUnit.Test_Cases;
package Test_Navigation is
type Navigation_Test_Case is
new Test_Case with null record;
overriding procedure Register_Tests
(T : in out Navigation_Test_Case);
-- Register routines to be run
overriding function Name
(T : Navigation_Test_Case)
return Message_String;
-- Provide name identifying the test case
end Test_Navigation;
|
-----------------------------------------------------------------------
-- awa-mail-components-messages -- Mail UI Message
-- Copyright (C) 2012, 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.Unchecked_Deallocation;
with Ada.Strings.Unbounded;
with Util.Beans.Objects;
with ASF.Components.Base;
with AWA.Mail.Clients;
package body AWA.Mail.Components.Messages is
use Ada.Strings.Unbounded;
use type ASF.Components.Base.UIComponent_Access;
-- ------------------------------
-- Set the mail message instance.
-- ------------------------------
procedure Set_Message (UI : in out UIMailMessage;
Message : in AWA.Mail.Clients.Mail_Message_Access) is
begin
UI.Message := Message;
end Set_Message;
-- ------------------------------
-- Get the mail message instance.
-- ------------------------------
overriding
function Get_Message (UI : in UIMailMessage) return AWA.Mail.Clients.Mail_Message_Access is
begin
return UI.Message;
end Get_Message;
-- ------------------------------
-- Render the end of the input component. Closes the DL/DD list.
-- ------------------------------
overriding
procedure Encode_End (UI : in UIMailMessage;
Context : in out ASF.Contexts.Faces.Faces_Context'Class) is
use type AWA.Mail.Clients.Mail_Message_Access;
begin
if UI.Message /= null and UI.Is_Rendered (Context) then
UI.Message.Send;
end if;
end Encode_End;
-- ------------------------------
-- Finalize and release the mail message.
-- ------------------------------
overriding
procedure Finalize (UI : in out UIMailMessage) is
procedure Free is
new Ada.Unchecked_Deallocation (Object => AWA.Mail.Clients.Mail_Message'Class,
Name => AWA.Mail.Clients.Mail_Message_Access);
begin
Free (UI.Message);
UIMailComponent (UI).Finalize;
end Finalize;
-- ------------------------------
-- Render the mail subject and initializes the message with its content.
-- ------------------------------
overriding
procedure Encode_Children (UI : in UIMailSubject;
Context : in out ASF.Contexts.Faces.Faces_Context'Class) is
procedure Process (Content : in String);
procedure Process (Content : in String) is
Msg : constant AWA.Mail.Clients.Mail_Message_Access := UI.Get_Message;
begin
Msg.Set_Subject (Content);
end Process;
begin
UI.Wrap_Encode_Children (Context, Process'Access);
end Encode_Children;
-- ------------------------------
-- Render the mail body and initializes the message with its content.
-- ------------------------------
overriding
procedure Encode_Children (UI : in UIMailBody;
Context : in out ASF.Contexts.Faces.Faces_Context'Class) is
procedure Process (Content : in Unbounded_String);
procedure Process_Alternative (Content : in Unbounded_String);
Body_Type : Util.Beans.Objects.Object;
Alternative_Content : Unbounded_String;
procedure Process_Alternative (Content : in Unbounded_String) is
begin
Alternative_Content := Content;
end Process_Alternative;
procedure Process (Content : in Unbounded_String) is
Msg : constant AWA.Mail.Clients.Mail_Message_Access := UI.Get_Message;
Typ : constant String := Util.Beans.Objects.To_String (Body_Type);
begin
if not Util.Beans.Objects.Is_Empty (Body_Type) then
Msg.Set_Body (Content, Alternative_Content, Typ);
else
Msg.Set_Body (Content, Alternative_Content);
end if;
end Process;
Alternative_Facet : ASF.Components.Base.UIComponent_Access;
begin
Body_Type := UI.Get_Attribute (Name => "type", Context => Context);
Alternative_Facet := UI.Get_Facet (ALTERNATIVE_NAME);
if Alternative_Facet /= null then
Alternative_Facet.Wrap_Encode_Children (Context, Process_Alternative'Access);
end if;
UI.Wrap_Encode_Children (Context, Process'Access);
end Encode_Children;
end AWA.Mail.Components.Messages;
|
------------------------------------------------------------------------------
-- --
-- GNAT RUN-TIME LIBRARY (GNARL) COMPONENTS --
-- --
-- SYSTEM.BB.CPU_PRIMITIVES.INSTALL_TRAP_HANDLER --
-- --
-- B o d y --
-- --
-- Copyright (C) 1999-2002 Universidad Politecnica de Madrid --
-- Copyright (C) 2003-2005 The European Space Agency --
-- Copyright (C) 2003-2015, AdaCore --
-- --
-- GNARL is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
-- ware Foundation; either version 3, or (at your option) any later ver- --
-- sion. GNARL is distributed in the hope that it will be useful, but WITH- --
-- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY --
-- or FITNESS FOR A PARTICULAR PURPOSE. --
-- --
-- As a special exception under Section 7 of GPL version 3, you are granted --
-- additional permissions described in the GCC Runtime Library Exception, --
-- version 3.1, as published by the Free Software Foundation. --
-- --
-- You should have received a copy of the GNU General Public License and --
-- a copy of the GCC Runtime Library Exception along with this program; --
-- see the files COPYING3 and COPYING.RUNTIME respectively. If not, see --
-- <http://www.gnu.org/licenses/>. --
-- --
------------------------------------------------------------------------------
-- This is a SPARC (ERC32/LEON2/LEON3) bare board version of this procedure
with System.Machine_Code; use System.Machine_Code;
separate (System.BB.CPU_Primitives)
procedure Install_Trap_Handler
(Service_Routine : Address;
Vector : Vector_Id;
Synchronous : Boolean := False)
is
begin
-- The start up routine (crt0) has already installed entries in the trap
-- table for external interrupts (16#11# .. 16#1F#), and the following
-- synchronous traps mapped to Ada exceptions:
-- instruction access exception (16#01#)
-- illegal instruction (16#02#)
-- address not aligned (16#07#)
-- FP exception (16#08#)
-- data access exception (16#09#)
-- instruction access error (16#21#)
-- data access error (16#29#)
-- hardware division by zero (16#2A#)
-- data store error (16#2B#)
-- software division by zero (16#82#)
-- This way the trap table can be put in ROM.
if Vector not in
16#11# .. 16#1F# | 16#01# | 16#02# | 16#07# | 16#08# | 16#09# | 16#21#
| 16#29# | 16#2A# | 16#2B# | 16#82#
then
-- Install the 4 instructions in the SPARC trap table to point to the
-- shared interrupt service routine (Common_Handler).
-- mov Vector, %l3
Trap_Table (Vector).First_Instr :=
16#A6102000# + SSE.Integer_Address (Vector);
-- If the handler is for a synchronous trap then we set bit number
-- 8 (in l3) to 1. This bit indicates to the underlying trap handler
-- (common_handler) that this is a synchronous trap and it must return
-- to the instruction following the trap.
if Synchronous then
Trap_Table (Vector).First_Instr :=
Trap_Table (Vector).First_Instr + SSE.Integer_Address (16#100#);
end if;
-- sethi %hi(Common_Handler), %l4
-- The 22 most significant bits of Common_Handler are obtained shifting
-- 10 times to the right, which is equivalent to divide by 2**10.
Trap_Table (Vector).Second_Instr :=
16#29000000# + SSE.To_Integer (Common_Handler'Address) / 2**10;
-- jmp %l4 + %lo(Common_Handler)
-- The 10 least significant bits of Common_Handler are obtained by
-- masking, which is equivalent to mod by 2**10.
Trap_Table (Vector).Third_Instr :=
16#81C52000# + SSE.To_Integer (Common_Handler'Address) mod 2**10;
-- mov %psr, %l0
-- Note that reading the psr at the first instruction of the trap
-- handler would not be a good idea, because the trap may have happened
-- just after changing the psr.
Trap_Table (Vector).Fourth_Instr := 16#A1480000#;
-- Flush the instruction cache since we are modifying the memory area
-- corresponding to instructions (trap table). This is a good idea even
-- for systems where we don't support cache control, such as ERC32, as
-- there still may be variants with cache.
-- As installing interrupt handlers is not time critical, the few extra
-- instructions do not matter much.
Asm ("flush %0" & ASCII.LF & ASCII.HT &
"flush %0 + 4" & ASCII.LF & ASCII.HT &
"flush %0 + 8" & ASCII.LF & ASCII.HT &
"flush %0 + 12",
Outputs => No_Output_Operands,
Inputs => Address'Asm_Input ("r", Trap_Table (Vector)'Address),
Volatile => True);
end if;
-- Put the address of the user handler in the User_Vector_Table, so that
-- the Common_Handler can know where to jump when a trap (synchronous or
-- asynchronous) occurs.
User_Vector_Table (Vector) := Service_Routine;
end Install_Trap_Handler;
|
with Ada.Finalization;
with Ada.Streams;
with Interfaces;
package Google.Protobuf.Duration is
type Duration_Vector is tagged private
with Variable_Indexing => Get_Duration_Variable_Reference,
Constant_Indexing => Get_Duration_Constant_Reference;
type Duration is
record
Seconds : Interfaces.Integer_64 := 0;
Nanos : Interfaces.Integer_32 := 0;
end record;
type Optional_Duration (Is_Set : Boolean := False) is
record
case Is_Set is
when True =>
Value : Google.Protobuf.Duration.Duration;
when False =>
null;
end case;
end record;
function Length (Self : Duration_Vector) return Natural;
procedure Clear (Self : in out Duration_Vector);
procedure Append (Self : in out Duration_Vector; V : Duration);
type Duration_Variable_Reference (Element : not null access Duration) is
null record
with Implicit_Dereference => Element;
not overriding function Get_Duration_Variable_Reference
(Self : aliased in out Duration_Vector;
Index : Positive)
return Duration_Variable_Reference
with Inline;
type Duration_Constant_Reference
(Element : not null access constant Duration) is null record
with Implicit_Dereference => Element;
not overriding function Get_Duration_Constant_Reference
(Self : aliased Duration_Vector;
Index : Positive)
return Duration_Constant_Reference
with Inline;
private
procedure Read_Duration
(Stream : access Ada.Streams.Root_Stream_Type'Class;
V : out Duration);
procedure Write_Duration
(Stream : access Ada.Streams.Root_Stream_Type'Class;
V : Duration);
for Duration'Read use Read_Duration;
for Duration'Write use Write_Duration;
type Duration_Array is array (Positive range <>) of aliased Duration;
type Duration_Array_Access is access Duration_Array;
type Duration_Vector is
new Ada.Finalization.Controlled
with record
Data : Duration_Array_Access;
Length : Natural := 0;
end record;
overriding procedure Adjust (Self : in out Duration_Vector);
overriding procedure Finalize (Self : in out Duration_Vector);
end Google.Protobuf.Duration;
|
with
AdaM.Factory;
package body AdaM.a_Type.task_type
is
-- Storage Pool
--
record_Version : constant := 1;
pool_Size : constant := 5_000;
package Pool is new AdaM.Factory.Pools (storage_Folder => ".adam-store",
pool_Name => "task_types",
max_Items => pool_Size,
record_Version => record_Version,
Item => task_type.item,
View => task_type.view);
-- Forge
--
procedure define (Self : in out Item; Name : in String)
is
begin
Self.Name := +Name;
end define;
overriding
procedure destruct (Self : in out Item)
is
begin
null;
end destruct;
function new_Type (Name : in String := "") return task_type.View
is
new_View : constant task_type.view := Pool.new_Item;
begin
define (task_type.item (new_View.all), Name);
return new_View;
end new_Type;
procedure free (Self : in out task_type.view)
is
begin
destruct (a_Type.item (Self.all));
Pool.free (Self);
end free;
-- Attributes
--
overriding function Id (Self : access Item) return AdaM.Id
is
begin
return Pool.to_Id (Self);
end Id;
overriding
function to_Source (Self : in Item) return text_Vectors.Vector
is
pragma Unreferenced (Self);
the_Source : text_Vectors.Vector;
begin
raise Program_Error with "TODO";
return the_Source;
end to_Source;
-- Streams
--
procedure View_write (Stream : not null access Ada.Streams.Root_Stream_Type'Class;
Self : in View)
renames Pool.View_write;
procedure View_read (Stream : not null access Ada.Streams.Root_Stream_Type'Class;
Self : out View)
renames Pool.View_read;
end AdaM.a_Type.task_type;
|
with Ada.Text_IO;
procedure HelloWorld is
begin
Ada.Text_IO.Put_Line("Hello, world!");
end HelloWorld;
|
with Ada.Text_IO; use Ada.Text_IO;
procedure Test is
type R is record A: Integer; end record;
procedure P(X: in R) is begin X.A := 0; end;
v: R;
begin
P(v);
end;
|
package agar.gui.widget.box is
use type c.unsigned;
type type_t is (BOX_HORIZ, BOX_VERT);
for type_t use (BOX_HORIZ => 0, BOX_VERT => 1);
for type_t'size use c.unsigned'size;
pragma convention (c, type_t);
type flags_t is new c.unsigned;
BOX_HOMOGENOUS : constant flags_t := 16#01#;
BOX_HFILL : constant flags_t := 16#02#;
BOX_VFILL : constant flags_t := 16#04#;
BOX_FRAME : constant flags_t := 16#08#;
BOX_EXPAND : constant flags_t := BOX_HFILL or BOX_VFILL;
type box_t is limited private;
type box_access_t is access all box_t;
pragma convention (c, box_access_t);
function allocate
(parent : widget_access_t;
box_type : type_t;
flags : flags_t) return box_access_t;
pragma import (c, allocate, "AG_BoxNew");
function allocate_horizontal
(parent : widget_access_t;
flags : flags_t) return box_access_t;
pragma inline (allocate_horizontal);
function allocate_vertical
(parent : widget_access_t;
flags : flags_t) return box_access_t;
pragma inline (allocate_vertical);
procedure set_homogenous
(box : box_access_t;
homogenous : boolean);
pragma inline (set_homogenous);
procedure set_padding
(box : box_access_t;
padding : natural);
pragma inline (set_padding);
procedure set_spacing
(box : box_access_t;
spacing : natural);
pragma inline (set_spacing);
procedure set_depth
(box : box_access_t;
depth : natural);
pragma inline (set_depth);
function widget (box : box_access_t) return widget_access_t;
pragma inline (widget);
private
type box_t is record
widget : aliased widget_t;
box_type : type_t;
flags : flags_t;
padding : c.int;
spacing : c.int;
depth : c.int;
end record;
pragma convention (c, box_t);
end agar.gui.widget.box;
|
-----------------------------------------------------------------------
-- util-processes -- Process creation and control
-- 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.
-----------------------------------------------------------------------
with Ada.Unchecked_Deallocation;
with Util.Log.Loggers;
with Util.Strings;
with Util.Processes.Os;
package body Util.Processes is
use Util.Log;
use Ada.Strings.Unbounded;
-- The logger
Log : constant Loggers.Logger := Loggers.Create ("Util.Processes");
procedure Free is
new Ada.Unchecked_Deallocation (Object => Util.Processes.System_Process'Class,
Name => Util.Processes.System_Process_Access);
-- ------------------------------
-- Before launching the process, redirect the input stream of the process
-- to the specified file.
-- ------------------------------
procedure Set_Input_Stream (Proc : in out Process;
File : in String) is
begin
if Proc.Is_Running then
Log.Error ("Cannot set input stream to {0} while process is running", File);
raise Invalid_State with "Process is running";
end if;
Proc.In_File := To_Unbounded_String (File);
end Set_Input_Stream;
-- ------------------------------
-- Set the output stream of the process.
-- ------------------------------
procedure Set_Output_Stream (Proc : in out Process;
File : in String;
Append : in Boolean := False) is
begin
if Proc.Is_Running then
Log.Error ("Cannot set output stream to {0} while process is running", File);
raise Invalid_State with "Process is running";
end if;
Proc.Out_File := To_Unbounded_String (File);
Proc.Out_Append := Append;
end Set_Output_Stream;
-- ------------------------------
-- Set the error stream of the process.
-- ------------------------------
procedure Set_Error_Stream (Proc : in out Process;
File : in String;
Append : in Boolean := False) is
begin
if Proc.Is_Running then
Log.Error ("Cannot set error stream to {0} while process is running", File);
raise Invalid_State with "Process is running";
end if;
Proc.Err_File := To_Unbounded_String (File);
Proc.Err_Append := Append;
end Set_Error_Stream;
-- ------------------------------
-- Set the working directory that the process will use once it is created.
-- The directory must exist or the <b>Invalid_Directory</b> exception will be raised.
-- ------------------------------
procedure Set_Working_Directory (Proc : in out Process;
Path : in String) is
begin
if Proc.Is_Running then
Log.Error ("Cannot set working directory to {0} while process is running", Path);
raise Invalid_State with "Process is running";
end if;
Proc.Dir := To_Unbounded_String (Path);
end Set_Working_Directory;
-- ------------------------------
-- Append the argument to the current process argument list.
-- Raises <b>Invalid_State</b> if the process is running.
-- ------------------------------
procedure Append_Argument (Proc : in out Process;
Arg : in String) is
begin
if Proc.Is_Running then
Log.Error ("Cannot add argument '{0}' while process is running", Arg);
raise Invalid_State with "Process is running";
end if;
Proc.Sys.Append_Argument (Arg);
end Append_Argument;
-- ------------------------------
-- Spawn a new process with the given command and its arguments. The standard input, output
-- and error streams are either redirected to a file or to a stream object.
-- ------------------------------
procedure Spawn (Proc : in out Process;
Command : in String;
Arguments : in Argument_List) is
begin
if Is_Running (Proc) then
raise Invalid_State with "A process is running";
end if;
Log.Info ("Starting process {0}", Command);
if Proc.Sys /= null then
Proc.Sys.Finalize;
Free (Proc.Sys);
end if;
Proc.Sys := new Util.Processes.Os.System_Process;
-- Build the argc/argv table, terminate by NULL
for I in Arguments'Range loop
Proc.Sys.Append_Argument (Arguments (I).all);
end loop;
-- Prepare to redirect the input/output/error streams.
Proc.Sys.Set_Streams (Input => To_String (Proc.In_File),
Output => To_String (Proc.Out_File),
Error => To_String (Proc.Err_File),
Append_Output => Proc.Out_Append,
Append_Error => Proc.Err_Append);
-- System specific spawn
Proc.Exit_Value := -1;
Proc.Sys.Spawn (Proc);
end Spawn;
-- ------------------------------
-- Spawn a new process with the given command and its arguments. The standard input, output
-- and error streams are either redirected to a file or to a stream object.
-- ------------------------------
procedure Spawn (Proc : in out Process;
Command : in String;
Mode : in Pipe_Mode := NONE) is
Pos : Natural := Command'First;
N : Natural;
begin
if Is_Running (Proc) then
raise Invalid_State with "A process is running";
end if;
Log.Info ("Starting process {0}", Command);
if Proc.Sys /= null then
Proc.Sys.Finalize;
Free (Proc.Sys);
end if;
Proc.Sys := new Util.Processes.Os.System_Process;
-- Build the argc/argv table
while Pos <= Command'Last loop
N := Util.Strings.Index (Command, ' ', Pos);
if N = 0 then
N := Command'Last + 1;
end if;
Proc.Sys.Append_Argument (Command (Pos .. N - 1));
Pos := N + 1;
end loop;
-- Prepare to redirect the input/output/error streams.
-- The pipe mode takes precedence and will override these redirections.
Proc.Sys.Set_Streams (Input => To_String (Proc.In_File),
Output => To_String (Proc.Out_File),
Error => To_String (Proc.Err_File),
Append_Output => Proc.Out_Append,
Append_Error => Proc.Err_Append);
-- System specific spawn
Proc.Exit_Value := -1;
Proc.Sys.Spawn (Proc, Mode);
end Spawn;
-- ------------------------------
-- Wait for the process to terminate.
-- ------------------------------
procedure Wait (Proc : in out Process) is
begin
if not Is_Running (Proc) then
return;
end if;
Log.Info ("Waiting for process {0}", Process_Identifier'Image (Proc.Pid));
Proc.Sys.Wait (Proc, -1.0);
end Wait;
-- ------------------------------
-- Terminate the process by sending a signal on Unix and exiting the process on Windows.
-- This operation is not portable and has a different behavior between Unix and Windows.
-- Its intent is to stop the process.
-- ------------------------------
procedure Stop (Proc : in out Process;
Signal : in Positive := 15) is
begin
if Is_Running (Proc) then
Proc.Sys.Stop (Proc, Signal);
end if;
end Stop;
-- ------------------------------
-- Get the process exit status.
-- ------------------------------
function Get_Exit_Status (Proc : in Process) return Integer is
begin
return Proc.Exit_Value;
end Get_Exit_Status;
-- ------------------------------
-- Get the process identifier.
-- ------------------------------
function Get_Pid (Proc : in Process) return Process_Identifier is
begin
return Proc.Pid;
end Get_Pid;
-- ------------------------------
-- Returns True if the process is running.
-- ------------------------------
function Is_Running (Proc : in Process) return Boolean is
begin
return Proc.Pid > 0 and Proc.Exit_Value < 0;
end Is_Running;
-- ------------------------------
-- Get the process input stream allowing to write on the process standard input.
-- ------------------------------
function Get_Input_Stream (Proc : in Process) return Util.Streams.Output_Stream_Access is
begin
return Proc.Input;
end Get_Input_Stream;
-- ------------------------------
-- Get the process output stream allowing to read the process standard output.
-- ------------------------------
function Get_Output_Stream (Proc : in Process) return Util.Streams.Input_Stream_Access is
begin
return Proc.Output;
end Get_Output_Stream;
-- ------------------------------
-- Get the process error stream allowing to read the process standard output.
-- ------------------------------
function Get_Error_Stream (Proc : in Process) return Util.Streams.Input_Stream_Access is
begin
return Proc.Error;
end Get_Error_Stream;
-- ------------------------------
-- Initialize the process instance.
-- ------------------------------
overriding
procedure Initialize (Proc : in out Process) is
begin
Proc.Sys := new Util.Processes.Os.System_Process;
end Initialize;
-- ------------------------------
-- Deletes the process instance.
-- ------------------------------
overriding
procedure Finalize (Proc : in out Process) is
procedure Free is
new Ada.Unchecked_Deallocation (Object => Util.Streams.Input_Stream'Class,
Name => Util.Streams.Input_Stream_Access);
procedure Free is
new Ada.Unchecked_Deallocation (Object => Util.Streams.Output_Stream'Class,
Name => Util.Streams.Output_Stream_Access);
begin
if Proc.Sys /= null then
Proc.Sys.Finalize;
Free (Proc.Sys);
end if;
Free (Proc.Input);
Free (Proc.Output);
Free (Proc.Error);
end Finalize;
end Util.Processes;
|
------------------------------------------------------------------------------
-- --
-- Matreshka Project --
-- --
-- Web Framework --
-- --
-- Tools Component --
-- --
------------------------------------------------------------------------------
-- --
-- Copyright © 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$
------------------------------------------------------------------------------
with Asis.Declarations;
with Asis.Definitions;
with Asis.Elements;
with Properties.Tools;
with Properties.Expressions.Identifiers;
package body Properties.Definitions.Tagged_Record_Type is
function Is_Universal_String
(Engine : access Engines.Contexts.Context;
Element : Asis.Declaration) return Boolean;
function Is_Null_Procedure (Decl : Asis.Declaration) return Boolean;
----------
-- Code --
----------
function Code
(Engine : access Engines.Contexts.Context;
Element : Asis.Definition;
Name : Engines.Text_Property) return League.Strings.Universal_String
is
use type Asis.Type_Kinds;
Parent : Asis.Subtype_Indication := Asis.Nil_Element;
Result : League.Strings.Universal_String;
Text : League.Strings.Universal_String;
begin
if Asis.Elements.Type_Kind (Element) =
Asis.A_Derived_Record_Extension_Definition
then
Parent := Asis.Definitions.Parent_Subtype_Indication (Element);
end if;
Result.Append ("(function (){"); -- Wrapper
Result.Append ("var _result = function ("); -- Constructor
-- Declare type's discriminant
declare
List : constant Asis.Discriminant_Association_List :=
Properties.Tools.Corresponding_Type_Discriminants (Element);
begin
for J in List'Range loop
declare
Id : League.Strings.Universal_String;
Names : constant Asis.Defining_Name_List :=
Asis.Declarations.Names (List (J));
begin
for N in Names'Range loop
Id := Engine.Text.Get_Property (Names (N), Name);
Result.Append (Id);
if J /= List'Last or N /= Names'Last then
Result.Append (",");
end if;
end loop;
end;
end loop;
Result.Append ("){");
-- Copy type's discriminant
for J in List'Range loop
declare
Id : League.Strings.Universal_String;
Names : constant Asis.Defining_Name_List :=
Asis.Declarations.Names (List (J));
Init : constant Asis.Expression :=
Asis.Declarations.Initialization_Expression (List (J));
begin
for N in Names'Range loop
Id := Engine.Text.Get_Property (Names (N), Name);
if not Asis.Elements.Is_Nil (Init) then
Result.Append ("if (typeof ");
Result.Append (Id);
Result.Append ("=== 'undefined')");
Result.Append (Id);
Result.Append ("=");
Result.Append (Engine.Text.Get_Property (Init, Name));
Result.Append (";");
end if;
Result.Append ("this.");
Result.Append (Id);
Result.Append (" = ");
Result.Append (Id);
Result.Append (";");
end loop;
end;
end loop;
if not Asis.Elements.Is_Nil (Parent) then
Result.Append
(Engine.Text.Get_Property (Parent, Name));
Result.Append (".call (this");
for J in List'Range loop
declare
Id : League.Strings.Universal_String;
Names : constant Asis.Defining_Name_List :=
Asis.Declarations.Names (List (J));
begin
for N in Names'Range loop
Result.Append (",");
Id := Engine.Text.Get_Property (Names (N), Name);
Result.Append (Id);
end loop;
end;
end loop;
Result.Append (");");
end if;
end;
-- Initialize type's components
declare
Props : League.Strings.Universal_String;
List : constant Asis.Declaration_List :=
Properties.Tools.Corresponding_Type_Components (Element);
begin
Props.Append ("var _props = {");
for J in List'Range loop
declare
Id : League.Strings.Universal_String;
Init : constant Asis.Expression :=
Asis.Declarations.Initialization_Expression (List (J));
Names : constant Asis.Defining_Name_List :=
Asis.Declarations.Names (List (J));
Value : League.Strings.Universal_String;
begin
if not Asis.Elements.Is_Nil (Init) then
Value := Engine.Text.Get_Property (Init, Name);
end if;
for N in Names'Range loop
Id := Engine.Text.Get_Property (Names (N), Name);
Result.Append ("this.");
Result.Append (Id);
Result.Append (" = ");
if Asis.Elements.Is_Nil (Init) then
Result.Append
(Engine.Text.Get_Property
(List (J), Engines.Initialize));
else
Result.Append (Value);
end if;
Result.Append (";");
Props.Append ("_pos_");
Props.Append (Id);
Props.Append (": {value: '");
Props.Append (Id);
Props.Append ("'},");
end loop;
end;
end loop;
Result.Append ("};"); -- End of Constructor
Props.Append ("};");
Result.Append (Props);
end;
-- Set prototype
Result.Append ("_result.prototype = _ec._tag('");
Text := Engine.Text.Get_Property (Element, Engines.Tag_Name);
Result.Append (Text);
Text := League.Strings.Empty_Universal_String;
if not Asis.Elements.Is_Nil (Parent) then
Text := Engine.Text.Get_Property (Parent, Engines.Tag_Name);
end if;
Result.Append ("', '");
Result.Append (Text);
Result.Append ("');");
Result.Append ("Object.defineProperties(_result.prototype, _props);");
-- Define null and abstract methods
declare
List : constant Asis.Declaration_List :=
Properties.Tools.Corresponding_Type_Subprograms (Element);
begin
for J in List'Range loop
if Asis.Declarations.Is_Dispatching_Operation (List (J))
and then (Asis.Elements.Has_Abstract (List (J))
or else Is_Null_Procedure (List (J)))
then
Result.Append ("_result.prototype.");
Result.Append
(Engine.Text.Get_Property
(Asis.Declarations.Names (List (J)) (1),
Engines.Method_Name));
if Is_Null_Procedure (List (J)) then
declare
Params : constant Asis.Parameter_Specification_List :=
Asis.Declarations.Parameter_Profile (List (J));
begin
Result.Append (" = _ec._null_proc({");
for P in Params'Range loop
if Engine.Boolean.Get_Property
(Element => Params (P),
Name => Engines.Has_Simple_Output)
then
Result.Append ("'");
Result.Append
(Engine.Text.Get_Property
(Asis.Declarations.Names (Params (P)) (1), Name));
Result.Append ("':");
Result.Append (Natural'Wide_Wide_Image (J - 1));
Result.Append (",");
end if;
end loop;
Result.Append ("});");
end;
else
Result.Append (" = _ec._abstract;");
end if;
end if;
end loop;
end;
Result.Append ("return _result;");
Result.Append ("})();"); -- End of Wrapper and call it
return Result;
end Code;
----------------
-- Initialize --
----------------
function Initialize
(Engine : access Engines.Contexts.Context;
Element : Asis.Definition;
Name : Engines.Text_Property) return League.Strings.Universal_String
is
pragma Unreferenced (Name);
Decl : constant Asis.Declaration :=
Asis.Elements.Enclosing_Element (Element);
Result : League.Strings.Universal_String;
Text : League.Strings.Universal_String;
begin
if Is_Universal_String (Engine, Element) then
Result.Append ("""""");
return Result;
end if;
Result.Append (" new ");
Text :=
Properties.Expressions.Identifiers.Name_Prefix (Engine, Element, Decl);
Result.Append (Text);
Text := Engine.Text.Get_Property
(Asis.Declarations.Names (Decl) (1),
Engines.Code);
Result.Append (Text);
Result.Append ("()");
return Result;
end Initialize;
-----------------------
-- Is_Null_Procedure --
-----------------------
function Is_Null_Procedure (Decl : Asis.Declaration) return Boolean is
begin
return Asis.Elements.Declaration_Kind (Decl) in
Asis.A_Null_Procedure_Declaration;
end Is_Null_Procedure;
--------------------
-- Is_Simple_Type --
--------------------
function Is_Simple_Type
(Engine : access Engines.Contexts.Context;
Element : Asis.Declaration;
Name : Engines.Boolean_Property) return Boolean
is
pragma Unreferenced (Name);
begin
return Is_Universal_String (Engine, Element);
end Is_Simple_Type;
-------------------------
-- Is_Universal_String --
-------------------------
function Is_Universal_String
(Engine : access Engines.Contexts.Context;
Element : Asis.Declaration) return Boolean
is
Tag : constant League.Strings.Universal_String :=
Engine.Text.Get_Property (Element, Engines.Tag_Name);
begin
return Tag.To_Wide_Wide_String = "universal_string";
end Is_Universal_String;
--------------
-- Tag_Name --
--------------
function Tag_Name
(Engine : access Engines.Contexts.Context;
Element : Asis.Definition;
Name : Engines.Text_Property) return League.Strings.Universal_String
is
pragma Unreferenced (Name);
Decl : Asis.Declaration := Asis.Elements.Enclosing_Element (Element);
Text : League.Strings.Universal_String;
Result : League.Strings.Universal_String;
begin
Result := Engine.Text.Get_Property
(Asis.Declarations.Names (Decl) (1), Engines.Code);
while not Asis.Elements.Is_Nil (Decl)
and then Asis.Elements.Is_Part_Of_Instance (Decl)
loop
Decl := Tools.Enclosing_Declaration (Decl);
if Asis.Elements.Declaration_Kind (Decl) in
Asis.A_Generic_Instantiation
then
Text := Engine.Text.Get_Property
(Asis.Declarations.Names (Decl) (1), Engines.Code);
Text.Append (".");
Result.Prepend (Text);
end if;
end loop;
return Result;
end Tag_Name;
end Properties.Definitions.Tagged_Record_Type;
|
-- This file is covered by the Internet Software Consortium (ISC) License
-- Reference: ../License.txt
package PortScan.Buildcycle.Pkgsrc is
function build_package (id : builders;
sequence_id : port_id;
interactive : Boolean := False;
interphase : String := "") return Boolean;
-- Compile status of builder for the curses display
function builder_status (id : builders;
shutdown : Boolean := False;
idle : Boolean := False)
return Display.builder_rec;
-- Expose for build log
function last_build_phase (id : builders) return String;
private
type phases is (bootstrap_depends, fetch, checksum, depends, tools,
extract, patch, wrapper, configure, build, test,
stage_install, create_package, package_install,
deinstall);
type dim_phase_trackers is array (builders) of phases;
phase_trackers : dim_phase_trackers;
function exec_phase (id : builders; phase : phases;
time_limit : execution_limit;
phaseenv : String := "";
skip_header : Boolean := False;
skip_footer : Boolean := False)
return Boolean;
function exec_phase_generic (id : builders; phase : phases) return Boolean;
function exec_phase_deinstall (id : builders) return Boolean;
function exec_phase_build (id : builders) return Boolean;
function phase2str (phase : phases) return String;
function valid_test_phase (afterphase : String) return phases;
function max_time_without_output (phase : phases) return execution_limit;
end PortScan.Buildcycle.Pkgsrc;
|
package openGL.surface_Profile.privvy
is
-- function to_glx (Self : in Item'Class) return glx.GLXFBConfig;
procedure dummy;
end openGL.surface_Profile.privvy;
|
with
Ada.Strings.unbounded,
Ada.Strings.fixed;
package body AdaM.Assist
is
function identifier_Suffix (Id : in Identifier; Count : in Positive) return Identifier
is
use Ada.Strings,
Ada.Strings.fixed,
Ada.Strings.Unbounded;
the_Id : constant String := String (Id);
Dot : Natural := Index (the_Id, ".", Backward);
Depth : Positive := 1;
Last : Positive := Id'Last;
Suffix : Text;
begin
while Depth <= Count
loop
if Dot = 0
then
insert (Suffix, 1, the_Id (the_Id'First .. Last));
exit;
end if;
insert (Suffix, 1, the_Id (Dot + 1 .. Last));
if Depth /= Count
then
insert (Suffix, 1, ".");
end if;
Last := Dot - 1;
Dot := Index (the_Id, ".", from => Last, going => Backward);
Depth := Depth + 1;
end loop;
return +Suffix;
end identifier_Suffix;
-- function strip_standard_Prefix (Id : in Identifier) return Identifier
-- is
-- the_Id : constant String := String (Id);
-- Token : constant String := "Standard.";
-- begin
-- if the_Id (the_Id'First .. the_Id'First + Token'Length - 1) = Token
-- then
-- return the_Id (the_Id'First + Token'Length .. the_Id'Last);
-- else
-- return the_Id;
-- end if;
-- end strip_standard_Prefix;
function strip_standard_Prefix (Id : in Identifier) return Identifier
is
Token : constant Identifier := "Standard.";
begin
if Id'Length >= Token'Length
and then Id (Id'First .. Id'First + Token'Length - 1) = Token
then
return Id (Id'First + Token'Length .. Id'Last);
else
return Id;
end if;
end strip_standard_Prefix;
function Tail_of (the_full_Name : in Identifier) return Identifier
is
use Ada.Strings,
Ada.Strings.fixed;
Dot : constant Natural := Index (String (the_full_Name), ".", Backward);
begin
if Dot = 0
then
return the_full_Name;
else
return the_full_Name (Dot + 1 .. the_full_Name'Last);
end if;
end Tail_of;
function strip_Tail_of (the_full_Name : in Identifier) return Identifier
is
use Ada.Strings,
Ada.Strings.fixed;
Dot : constant Natural := Index (String (the_full_Name), ".", Backward);
begin
if Dot = 0 then
return the_full_Name;
else
return the_full_Name (the_full_Name'First .. Dot - 1);
end if;
end strip_Tail_of;
function type_button_Name_of (the_full_Name : in Identifier) return String
is
Tail : constant Identifier := Assist.Tail_of (the_full_Name);
begin
if the_full_Name'Length >= 9
and then the_full_Name (the_full_Name'First .. the_full_Name'First + 8) = "Standard."
then
return String (Tail);
end if;
declare
Head : constant Identifier := assist.strip_Tail_of (the_full_Name);
begin
return String (assist.Tail_of (Head) & "." & Tail);
end;
end type_button_Name_of;
function parent_Name (Id : in Identifier) return Identifier
is
use Ada.Strings,
Ada.Strings.fixed;
begin
if Id = "Standard"
then
return "";
end if;
declare
the_Id : constant String := String (Id);
I : constant Natural := Index (the_Id, ".", going => Backward);
begin
if I = 0
then
return "Standard";
end if;
return Identifier (the_Id (the_Id'First .. I - 1));
end;
end parent_Name;
function simple_Name (Id : in Identifier) return Identifier
is
use Ada.Strings,
Ada.Strings.fixed;
I : constant Natural := Index (String (Id), ".", going => Backward);
begin
if I = 0
then
return Id;
end if;
return Id (I + 1 .. Id'Last);
end simple_Name;
-- function Split (the_Text : in Identifier) return text_Lines
-- is
-- use ada.Strings.Fixed,
-- ada.Strings.Unbounded;
--
-- the_Lines : text_Lines;
-- Dot : Natural := Index (the_Text, ".");
-- First : Positive := 1;
-- Last : Positive;
--
-- begin
-- while Dot /= 0
-- loop
-- Last := Dot - 1;
-- the_Lines.append (+the_Text (First .. Last));
-- First := Dot + 1;
-- Dot := Index (the_Text, ".", First);
-- end loop;
--
-- the_Lines.append (+the_Text (First .. the_Text'Last));
-- return the_Lines;
-- end Split;
function Split (Id : in Identifier) return text_Lines
is
use Ada.Strings,
Ada.Strings.fixed;
the_Id : constant String := String (Id);
First : Natural := the_Id'First;
Last : Natural;
I : Natural;
Lines : text_Lines;
begin
loop
I := Index (the_Id, ".", from => First);
if I = 0
then
Last := the_Id'Last;
Lines.append (+the_Id (First .. Last));
exit;
end if;
Last := I - 1;
Lines.append (+the_Id (First .. Last));
First := I + 1;
end loop;
return Lines;
end Split;
end AdaM.Assist;
|
-- Test LU decomposition on a real valued square matrix.
with Ada.Numerics.Generic_elementary_functions;
with Crout_LU;
with Text_IO; use Text_IO;
with Test_Matrices;
procedure crout_lu_tst_2 is
type Real is digits 15;
subtype Index is Integer range 0..50;
Starting_Index : constant Index := Index'First + 0;
Final_Index : Index := Index'Last - 0;
type Matrix is array(Index, Index) of Real;
package math is new Ada.Numerics.Generic_elementary_functions(Real);
use math; --for sqrt
package lu is new crout_lu (Real, Index, Matrix);
use lu;
package rio is new Float_IO(Real);
use rio;
package iio is new Integer_IO(Integer);
use iio;
package Make_Square_Matrix is new Test_Matrices (Real, Index, Matrix);
use Make_Square_Matrix;
Zero : constant Real := +0.0;
One : constant Real := +1.0;
Two : constant Real := +2.0;
Min_Allowed_Real : constant Real := Two**(Real'Machine_Emin / 4);
Zero_Vector : constant Row_Vector := (others => Zero);
A, B, Err : Matrix := (others => (others => Zero));
Identity, B_inv : Matrix := (others => (others => Zero));
Relative_Err, Max_Error : Real;
IO_Final_Index : Integer := 4;
Scale_the_Matrix : constant Boolean := True;
Scale : Scale_Vectors;
-----------
-- Pause --
-----------
procedure Pause (s1,s2,s3,s4,s5,s6,s7,s8 : string := "") is
Continue : Character := ' ';
begin
New_Line;
if S1 /= "" then put_line (S1); end if;
if S2 /= "" then put_line (S2); end if;
if S3 /= "" then put_line (S3); end if;
if S4 /= "" then put_line (S4); end if;
if S5 /= "" then put_line (S5); end if;
if S6 /= "" then put_line (S6); end if;
if S7 /= "" then put_line (S7); end if;
if S8 /= "" then put_line (S8); end if;
new_line;
begin
put ("Enter a character to continue: ");
get_immediate (Continue);
new_line;
exception
when others => null;
end;
end pause;
-----------------------------------
-- Transpose_of_Left_Times_Right --
-----------------------------------
function Transpose_of_Left_Times_Right
(A, B : in Matrix;
Final_Row : in Index := Final_Index;
Final_Col : in Index := Final_Index;
Starting_Row : in Index := Starting_Index;
Starting_Col : in Index := Starting_Index)
return Matrix
is
Sum : Real := Zero;
Result : Matrix := (others => (others => Zero));
begin
for Row in Starting_Row .. Final_Row loop
for Col in Starting_Col .. Final_Col loop
Sum := Zero;
for k in Starting_Col .. Final_Col loop
Sum := Sum + A(k, Row) * B(k, Col);
end loop;
Result(Row, Col) := Sum;
end loop;
end loop;
return Result;
end Transpose_of_Left_Times_Right;
-------------
-- Product --
-------------
function Product
(A, B : in Matrix;
Final_Row : in Index := Final_Index;
Final_Col : in Index := Final_Index;
Starting_Row : in Index := Starting_Index;
Starting_Col : in Index := Starting_Index)
return Matrix
is
Sum : Real := Zero;
Result : Matrix := (others => (others => Zero));
begin
for Row in Starting_Row .. Final_Row loop
for Col in Starting_Col .. Final_Col loop
Sum := Zero;
for k in Starting_Col .. Final_Col loop
Sum := Sum + A(Row, k) * B(k, Col);
end loop;
Result(Row, Col) := Sum;
end loop;
end loop;
return Result;
end Product;
--------------------
-- Frobenius_Norm --
--------------------
function Frobenius_Norm
(A : in Matrix;
Final_Row : in Index := Final_Index;
Final_Col : in Index := Final_Index;
Starting_Row : in Index := Starting_Index;
Starting_Col : in Index := Starting_Index)
return Real
is
Max_A_Val : Real := Zero;
Sum, Scaling, tmp : Real := Zero;
begin
Max_A_Val := Zero;
for Row in Starting_Row .. Final_Row loop
for Col in Starting_Col .. Final_Col loop
if Max_A_Val < Abs A(Row, Col) then Max_A_Val := Abs A(Row, Col); end if;
end loop;
end loop;
Scaling := One / (Max_A_Val + Min_Allowed_Real);
Sum := Zero;
for Row in Starting_Row .. Final_Row loop
for Col in Starting_Col .. Final_Col loop
tmp := Scaling * A(Row, Col);
Sum := Sum + tmp * tmp;
end loop;
end loop;
return Sqrt (Sum) * Max_A_Val;
end Frobenius_Norm;
------------
-- Invert --
------------
-- Get Inverse of the Matrix:
procedure Invert
(M : in Matrix;
M_Inv : out Matrix;
Max_Error : out Real)
--Final_Index : in Index;
--Starting_Index : in Index)
is
Solution_Vector : Row_Vector;
Unit_Vector : Row_Vector := (others => 0.0);
Error : Col_Vector := (others => 0.0);
Scale : Scale_Vectors;
Permute : Rearrangement;
M_LU : Matrix := M;
begin
Max_Error := 0.0;
LU_decompose
(A => M_LU,
Scalings => Scale,
Row_Permutation => Permute,
Final_Index => Final_Index,
Starting_Index => Starting_Index,
Scaling_Desired => Scale_the_Matrix);
for I in Starting_Index..Final_Index loop
if I > Starting_Index then
Unit_Vector(I-1) := 0.0;
end if;
Unit_Vector(I) := 1.0;
-- Solve A*X = B:
LU_Solve
(X => Solution_Vector,
B => Unit_Vector,
A_LU => M_LU,
Scalings => Scale,
Row_Permutation => Permute,
Final_Index => Final_Index,
Starting_Index => Starting_Index);
-- Solve M*Solution_Vector = Unit_Vector (for Solution_Vector).
Error := Unit_Vector - Product (M, Solution_Vector,Final_Index,Starting_Index);
for I in Starting_Index..Final_Index loop
if Abs(Error(I)) > Max_Error then
Max_Error := Abs(Error(I));
end if;
end loop;
-- Solution vector is the I-th column of M_Inverse:
for J in Starting_Index..Final_Index loop
M_Inv (J, I) := Solution_Vector(J);
end loop;
end loop;
end Invert;
begin
for Col in Index loop
Identity(Col, Col) := One;
end loop;
put("Maximum matrix size is "&
Integer'Image (Zero_Vector'length-(Integer(Starting_Index)-Integer(Index'First))));
new_Line;
put("Input Size Of Matrix To Invert (enter an Integer)"); new_Line;
get(IO_Final_Index);
Final_Index := Starting_Index + Index (IO_Final_Index-1);
Pause(
"Test 1: LU Decomposition of matrix A = P*L*U is usually successful, but if A is",
"singular of ill-conditioned then the P*L*U is likely to be useless.",
"If A is singular or ill-conditioned then it's better to solve the normal equations,",
"in other words solve A'*A * X = A'*b instead of A * X = b, (where A' = Transpose(A)).",
"A'*A may still be ill-conditioned, but adding 'epsilon*I' to A'*A reliably removes the",
"singularity. Sometimes iterative refinement is used to get better solutions to A*X = b,",
"but in this test no iterative refinement is performed."
);
Pause(
"Final remark: if you work with the normal equations, A'*A * X = A'*b, then",
"Choleski decomposition is more appropriate, but the idea here is to test the",
"LU decomposition, LU_solve.",
"The matrices used in the following test are mostly ill-conditioned, so in most cases",
"the error does not approach machine precision (1.0e-16).",
" ",
"Equation solving is done with matrix B = A'*A + epsilon*I."
);
new_line;
for Chosen_Matrix in Matrix_id loop
put("For matrix originally of type ");
put(Matrix_id'Image(Chosen_Matrix)); Put(":");
new_line;
-- Get a non-singular B = A'*A + epsilon*I:
Init_Matrix (A, Chosen_Matrix, Starting_Index, Final_Index);
Scale_Cols_Then_Rows
(A => A,
Scalings => Scale,
Final_Index => Final_Index,
Starting_Index => Starting_Index);
B := Transpose_of_Left_Times_Right (A, A); -- get B = A'*A
-- Now B's eig vals are all >= 0. Add Eps*Identity to B: this
-- shifts all eigs plus Eps = Two**(-28), so all eigs >= Two**(-28):
for Col in Index loop
B(Col, Col) := Two**(-20) + B(Col, Col);
end loop;
-- Get A_inverse
Invert (B, B_inv, Max_Error);
for Row in Starting_Index .. Final_Index loop
for Col in Starting_Index .. Final_Index loop
Err (Row, Col) := Identity(Row, Col) - Product (B, B_inv)(Row, Col);
end loop;
end loop;
--Err := Transpose_of_Left_Times_Right (A, Err);
Relative_Err := Frobenius_Norm (Err) / (Frobenius_Norm (Identity));
put(" Err in I - B*B_inverse is ~ ||I - B*B_inverse|| / ||I|| =");
put(Relative_Err);
new_line;
for Row in Starting_Index .. Final_Index loop
for Col in Starting_Index .. Final_Index loop
Err (Row, Col) := Identity(Row, Col) - Product (B_inv, B)(Row, Col);
end loop;
end loop;
Relative_Err := Frobenius_Norm (Err) / (Frobenius_Norm (Identity));
put(" Err in I - B_inverse*B is ~ ||I - B_inverse*B|| / ||I|| =");
put(Relative_Err);
new_line;
end loop; -- Matrix_id
end;
|
------------------------------------------------------------------------------
-- --
-- GNAT RUN-TIME COMPONENTS --
-- --
-- ADA.DIRECTORIES.HIERARCHICAL_FILE_NAMES --
-- --
-- S p e c --
-- --
-- This specification is derived from the Ada Reference Manual for use with --
-- GNAT. In accordance with the copyright of that document, you can freely --
-- copy and modify this specification, provided that if you redistribute a --
-- modified version, any changes that you have made are clearly indicated. --
-- --
------------------------------------------------------------------------------
package Ada.Directories.Hierarchical_File_Names is
pragma Unimplemented_Unit;
function Is_Simple_Name (Name : String) return Boolean;
function Is_Root_Directory_Name (Name : String) return Boolean;
function Is_Parent_Directory_Name (Name : String) return Boolean;
function Is_Current_Directory_Name (Name : String) return Boolean;
function Is_Full_Name (Name : String) return Boolean;
function Is_Relative_Name (Name : String) return Boolean;
function Simple_Name (Name : String) return String
renames Ada.Directories.Simple_Name;
function Containing_Directory (Name : String) return String
renames Ada.Directories.Containing_Directory;
function Initial_Directory (Name : String) return String;
function Relative_Name (Name : String) return String;
function Compose
(Directory : String := "";
Relative_Name : String;
Extension : String := "") return String;
end Ada.Directories.Hierarchical_File_Names;
|
with Ada.Text_IO;
with Ada.Characters;
with Ada.Characters.Latin_1;
with GNAT.Calendar;
with GNAT.Calendar.Time_IO;
with Ada.Calendar.Time_Zones;
package body Utils is
function Clean_Text (Source : String) return String is
use Ada.Characters.Latin_1;
Result : String (1 .. 2 * Source'Length);
K : Natural := 0;
begin
for I in Source'Range loop
if Source (I) = LF then
K := K + 1;
Result (K) := '\';
K := K + 1;
Result (K) := 'n';
elsif Source (I) = CR then
null; -- skip
else
K := K + 1;
Result (K) := Source (I);
end if;
end loop;
return Result (1 .. K);
end Clean_Text;
function Get_Timezone return String is
begin
return Ada.Strings.Unbounded.To_String (Timezone);
end Get_Timezone;
function Shift (S : String) return String is
Result : constant String (1 .. S'Length) := S;
begin
return Result;
end Shift;
function To_String (N : Natural) return String is
S : constant String := Integer'Image (N);
begin
return S (2 .. S'Last);
end To_String;
function To_Time (Source : String) return Ada.Calendar.Time is
use GNAT.Calendar;
begin
return Time_IO.Value (Shift (Source));
exception
when Constraint_Error =>
return Time_Of (Year => 1999,
Month => 12,
Day => 31,
Hour => 23,
Minute => 59,
Second => 53);
end To_Time;
function Unescape (S : String) return String is
Result : String (1 .. S'Length);
I : Positive := S'First;
R : Positive := 1;
J : Positive;
begin
while I <= S'Last loop
if S (I) = '&' then
J := I + 1;
while S (J) /= ';' loop
J := J + 1;
end loop;
if S (I + 1 .. J - 1) = "gt" then
Result (R) := '>';
elsif S (I + 1 .. J - 1) = "lt" then
Result (R) := '<';
else
Result (R .. R + 2) := "###";
R := R + 2;
end if;
R := R + 1;
I := J + 1;
else
Result (R) := S (I);
R := R + 1;
I := I + 1;
end if;
end loop;
return Result (1 .. R - 1);
end Unescape;
function UTC_To_Local (T : Ada.Calendar.Time) return Local_Time is
use Ada.Calendar;
begin
return Local_Time (T
+ 60 * Duration (Time_Zones.UTC_Time_Offset (T)));
end UTC_To_Local;
procedure Warn (Text : String) is
use Ada.Text_IO;
begin
Put_Line (File => Standard_Error,
Item => "Warning: " & Text);
end Warn;
end Utils;
|
generic
package BitOperations.Shift.Axiom.Logic_Left
with SPARK_Mode, Pure, Ghost is
pragma Warnings (GNAT, Off, "postcondition does not check the outcome of calling");
procedure Equal_Mult_By_Power_2
(Value : Modular; Amount : Natural)
with Pre => Amount in 0 .. Modular'Size,
Post => (BitOperations.Shift.Logic_Left(Value, Amount)
= Modular'Mod(Value * (2 ** Amount)));
end BitOperations.Shift.Axiom.Logic_Left;
|
-- Copyright 2016-2021 Bartek thindil Jasicki
--
-- This file is part of Steam Sky.
--
-- Steam Sky 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.
--
-- Steam Sky 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 Steam Sky. If not, see <http://www.gnu.org/licenses/>.
with Ada.Characters.Handling; use Ada.Characters.Handling;
with Goals; use Goals;
with Ships; use Ships;
with Config; use Config;
package body Statistics is
procedure UpdateDestroyedShips(ShipName: Unbounded_String) is
Updated: Boolean := False;
ShipIndex: Unbounded_String;
begin
Proto_Ships_Loop :
for I in Proto_Ships_List.Iterate loop
if Proto_Ships_List(I).Name = ShipName then
ShipIndex := Proto_Ships_Container.Key(I);
GameStats.Points :=
GameStats.Points + (Proto_Ships_List(I).Combat_Value / 10);
exit Proto_Ships_Loop;
end if;
end loop Proto_Ships_Loop;
if ShipIndex = Null_Unbounded_String then
return;
end if;
Destroyed_Ships_Loop :
for DestroyedShip of GameStats.DestroyedShips loop
if DestroyedShip.Index = ShipIndex then
DestroyedShip.Amount := DestroyedShip.Amount + 1;
Updated := True;
exit Destroyed_Ships_Loop;
end if;
end loop Destroyed_Ships_Loop;
if not Updated then
GameStats.DestroyedShips.Append
(New_Item => (Index => ShipIndex, Amount => 1));
end if;
end UpdateDestroyedShips;
procedure ClearGameStats is
begin
GameStats.DestroyedShips.Clear;
GameStats.BasesVisited := 1;
GameStats.MapVisited := 1;
GameStats.DistanceTraveled := 0;
GameStats.CraftingOrders.Clear;
GameStats.AcceptedMissions := 0;
GameStats.FinishedMissions.Clear;
GameStats.FinishedGoals.Clear;
GameStats.KilledMobs.Clear;
GameStats.Points := 0;
end ClearGameStats;
procedure UpdateFinishedGoals(Index: Unbounded_String) is
Updated: Boolean := False;
begin
Find_Goal_Index_Loop :
for Goal of Goals_List loop
if Goal.Index = Index then
GameStats.Points :=
GameStats.Points + (Goal.Amount * Goal.Multiplier);
exit Find_Goal_Index_Loop;
end if;
end loop Find_Goal_Index_Loop;
Update_Finished_Goals_Loop :
for FinishedGoal of GameStats.FinishedGoals loop
if FinishedGoal.Index = Index then
FinishedGoal.Amount := FinishedGoal.Amount + 1;
Updated := True;
exit Update_Finished_Goals_Loop;
end if;
end loop Update_Finished_Goals_Loop;
if not Updated then
Add_Finished_Goal_Loop :
for Goal of Goals_List loop
if Goal.Index = Index then
GameStats.FinishedGoals.Append
(New_Item => (Index => Goal.Index, Amount => 1));
exit Add_Finished_Goal_Loop;
end if;
end loop Add_Finished_Goal_Loop;
end if;
end UpdateFinishedGoals;
procedure UpdateFinishedMissions(MType: Unbounded_String) is
Updated: Boolean := False;
begin
Update_Finished_Missions_Loop :
for FinishedMission of GameStats.FinishedMissions loop
if FinishedMission.Index = MType then
FinishedMission.Amount := FinishedMission.Amount + 1;
Updated := True;
exit Update_Finished_Missions_Loop;
end if;
end loop Update_Finished_Missions_Loop;
if not Updated then
GameStats.FinishedMissions.Append
(New_Item => (Index => MType, Amount => 1));
end if;
GameStats.Points := GameStats.Points + 50;
end UpdateFinishedMissions;
procedure UpdateCraftingOrders(Index: Unbounded_String) is
Updated: Boolean := False;
begin
Update_Crafting_Loop :
for CraftingOrder of GameStats.CraftingOrders loop
if CraftingOrder.Index = Index then
CraftingOrder.Amount := CraftingOrder.Amount + 1;
Updated := True;
exit Update_Crafting_Loop;
end if;
end loop Update_Crafting_Loop;
if not Updated then
GameStats.CraftingOrders.Append
(New_Item => (Index => Index, Amount => 1));
end if;
GameStats.Points := GameStats.Points + 5;
end UpdateCraftingOrders;
procedure UpdateKilledMobs
(Mob: Member_Data; FractionName: Unbounded_String) is
Updated: Boolean := False;
begin
Get_Attribute_Points_Loop :
for Attribute of Mob.Attributes loop
GameStats.Points := GameStats.Points + Attribute.Level;
end loop Get_Attribute_Points_Loop;
Get_Skill_Points_Loop :
for Skill of Mob.Skills loop
GameStats.Points := GameStats.Points + Skill.Level;
end loop Get_Skill_Points_Loop;
Update_Killed_Mobs_Loop :
for KilledMob of GameStats.KilledMobs loop
if To_Lower(To_String(KilledMob.Index)) = To_String(FractionName) then
KilledMob.Amount := KilledMob.Amount + 1;
Updated := True;
exit Update_Killed_Mobs_Loop;
end if;
end loop Update_Killed_Mobs_Loop;
if not Updated then
GameStats.KilledMobs.Append
(New_Item =>
(Index =>
To_Unbounded_String
(To_Upper(Slice(FractionName, 1, 1)) &
Slice(FractionName, 2, Length(FractionName))),
Amount => 1));
end if;
end UpdateKilledMobs;
function GetGamePoints return Natural is
MalusIndexes: constant array(Positive range <>) of Positive :=
(2, 4, 5, 6);
DifficultyValues: constant array(1 .. 7) of Bonus_Type :=
(New_Game_Settings.Enemy_Damage_Bonus,
New_Game_Settings.Player_Damage_Bonus,
New_Game_Settings.Enemy_Melee_Damage_Bonus,
New_Game_Settings.Player_Melee_Damage_Bonus,
New_Game_Settings.Experience_Bonus,
New_Game_Settings.Reputation_Bonus,
New_Game_Settings.Upgrade_Cost_Bonus);
PointsBonus, Value: Float := 0.0;
begin
Get_Game_Points_Loop :
for I in DifficultyValues'Range loop
Value := Float(DifficultyValues(I));
Update_Game_Points_Loop :
for J in MalusIndexes'Range loop
if I = MalusIndexes(J) then
if Value < 1.0 then
Value := 1.0 + ((1.0 - Value) * 4.0);
elsif Value > 1.0 then
Value := 1.0 - Value;
end if;
exit Update_Game_Points_Loop;
end if;
end loop Update_Game_Points_Loop;
PointsBonus := PointsBonus + Value;
end loop Get_Game_Points_Loop;
PointsBonus := PointsBonus / Float(DifficultyValues'Length);
if PointsBonus < 0.01 then
PointsBonus := 0.01;
end if;
return Natural(Float(GameStats.Points) * PointsBonus);
end GetGamePoints;
end Statistics;
|
------------------------------------------------------------------------------
-- --
-- GNAT RUNTIME COMPONENTS --
-- --
-- S Y S T E M . I M G _ D E C I M A L --
-- --
-- S p e c --
-- --
-- $Revision: 2 $ --
-- --
-- Copyright (c) 1992,1993,1994 NYU, All Rights Reserved --
-- --
-- The GNAT library is free software; you can redistribute it and/or modify --
-- it under terms of the GNU Library General Public License as published by --
-- the Free Software Foundation; either version 2, or (at your option) any --
-- later version. The GNAT 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 --
-- Library General Public License for more details. You should have --
-- received a copy of the GNU Library General Public License along with --
-- the GNAT library; see the file COPYING.LIB. If not, write to the Free --
-- Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. --
-- --
------------------------------------------------------------------------------
-- Image for decimal fixed types where the size of the corresponding integer
-- type does not exceed Integer'Size (also used for Text_IO.Decimal_IO output)
package System.Img_Decimal is
pragma Preelaborate (Img_Decimal);
function Image_Decimal
(V : Integer;
S : access String;
Scale : Integer)
return Natural;
-- Compute 'Image of V, the integer value (in units of delta) of a decimal
-- type whose Scale is as given. The image is stored in S (1 .. N), where
-- N is the returned result. The image is given by the rules in RM 3.5(34)
-- for fixed-point type image functions.
procedure Set_Image_Decimal
(V : Integer;
S : out String;
P : in out Natural;
Scale : Integer;
Fore : Natural;
Aft : Natural;
Exp : Natural);
-- Sets the image of V, where V is the integer value (in units of delta)
-- of a decimal type with the given Scale, starting at S (P + 1), updating
-- P to point to the last character stored, the caller promises that the
-- buffer is large enough and no check is made for this. Constraint_Error
-- will not necessarily be raised if this requirement is violated, since
-- it is perfectly valid to compile this unit with checks off. The Fore,
-- Aft and Exp values can be set to any valid values for the case of use
-- by Text_IO.Decimal_IO.
procedure Set_Decimal_Digits
(Digs : in out String;
NDigs : Natural;
S : out String;
P : in out Natural;
Scale : Integer;
Fore : Natural;
Aft : Natural;
Exp : Natural);
-- This procedure has the same semantics as Set_Image_Decimal, except that
-- the value in Digs (1 .. NDigs) is given as a string of decimal digits
-- preceded by either a minus sign or a space (i.e. the integer image of
-- the value in units of delta). The call may destroy the value in Digs,
-- which is why Digs is in-out (this happens if rounding is required).
-- Set_Decimal_Digits is shared by all the decimal image routines.
end System.Img_Decimal;
|
-- --
-- package Copyright (c) Dmitry A. Kazakov --
-- Object.Handle.Unbounded_Array Luebeck --
-- Implementation Spring, 2003 --
-- --
-- Last revision : 10:33 11 May 2019 --
-- --
-- This library is free software; you can redistribute it and/or --
-- modify it under the terms of the GNU General Public License as --
-- published by the Free Software Foundation; either version 2 of --
-- the License, or (at your option) any later version. This library --
-- is distributed in the hope that it will be useful, but WITHOUT --
-- ANY WARRANTY; without even the implied warranty of --
-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU --
-- General Public License for more details. You should have --
-- received a copy of the GNU General Public License along with --
-- this library; if not, write to the Free Software Foundation, --
-- Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. --
-- --
-- As a special exception, if other files instantiate generics from --
-- this unit, or you link this unit with other files to produce an --
-- executable, this unit does not by itself cause the resulting --
-- executable to be covered by the GNU General Public License. This --
-- exception does not however invalidate any other reasons why the --
-- executable file might be covered by the GNU Public License. --
--____________________________________________________________________--
with Ada.Unchecked_Deallocation;
package body Object.Handle.Generic_Unbounded_Array is
use type Object_Ptr_Array.Object_Array_Ptr;
procedure Free is
new Ada.Unchecked_Deallocation
( Unbounded_Array_Body,
Unbounded_Array_Body_Ptr
);
procedure Release (Ptr : in out Unbounded_Array_Body_Ptr) is
begin
if Ptr /= null then
declare
Object : Unbounded_Array_Body renames Ptr.all;
begin
case Object.Use_Count is
when 0 =>
raise Program_Error;
when 1 =>
Object.Use_Count := 0;
if Ptr.Data.Vector /= null then
declare
Vector : Object_Ptr_Array_Type renames
Ptr.Data.Vector.all;
begin
for Index in Vector'Range loop
Release (Vector (Index));
end loop;
end;
end if;
Free (Ptr);
when others =>
Object.Use_Count := Object.Use_Count - 1;
end case;
end;
end if;
end Release;
procedure Adjust (Container : in out Unbounded_Array) is
begin
if Container.Ptr /= null then
Container.Ptr.Use_Count := Container.Ptr.Use_Count + 1;
end if;
end Adjust;
procedure Erase (Container : in out Unbounded_Array)
renames Finalize;
procedure Finalize (Container : in out Unbounded_Array) is
begin
Release (Container.Ptr);
end Finalize;
function First (Container : Unbounded_Array)
return Index_Type is
begin
return Container.Ptr.Data.Vector'First;
end First;
function Get
( Container : Unbounded_Array;
Index : Index_Type
) return Object_Type_Ptr is
begin
if ( Container.Ptr = null
or else
Container.Ptr.Data.Vector = null
or else
Index not in Container.Ptr.Data.Vector'range
)
then
return null;
else
return Container.Ptr.Data.Vector (Index);
end if;
end Get;
function Last (Container : Unbounded_Array)
return Index_Type is
begin
return Container.Ptr.Data.Vector'Last;
end Last;
procedure Put
( Container : in out Unbounded_Array;
Index : Index_Type;
Element : Object_Type_Ptr
) is
begin
--
-- Check if the body is used elsewhere
--
if Container.Ptr = null then
--
-- There is no body. Create an empty one
--
Container.Ptr := new Unbounded_Array_Body;
Container.Ptr.Use_Count := 1;
else
if Container.Ptr.Use_Count /= 1 then
Container.Ptr.Use_Count :=
Container.Ptr.Use_Count - 1;
if Container.Ptr.Data.Vector /= null then
--
-- It is not an empty body and it is used somewhere else.
-- So let's clone it.
--
declare
Source : Object_Ptr_Array_Type
renames Container.Ptr.Data.Vector.all;
begin
Container.Ptr := new Unbounded_Array_Body;
Container.Ptr.Data.Vector :=
new Object_Ptr_Array_Type'(Source);
for Index in Source'Range loop
if Source (Index) /= null then
Increment_Count (Source (Index).all);
end if;
end loop;
end;
else
Container.Ptr := new Unbounded_Array_Body;
end if;
Container.Ptr.Use_Count := 1;
end if;
end if;
--
-- Do the operation. Here a body is always present
--
declare
Data : Object_Ptr_Array.Unbounded_Array
renames Container.Ptr.Data;
begin
if Data.Vector /= null and then Index in Data.Vector'Range then
if Element = null then
Release (Data.Vector (Index));
Data.Vector (Index) := null;
else
if ( Data.Vector (Index) /= null
and then
Equal
( Data.Vector (Index).all,
Element.all
) )
then
return;
end if;
Increment_Count (Element.all);
Release (Data.Vector (Index));
Data.Vector (Index) := Element;
end if;
else
if Element /= null then
Object_Ptr_Array.Put (Data, Index, Element);
Increment_Count (Element.all);
end if;
end if;
end;
end Put;
procedure Put
( Container : in out Unbounded_Array;
Index : Index_Type;
Element : Handle_Type
) is
begin
Put (Container, Index, Element.Ptr);
end Put;
function Ref
( Container : Unbounded_Array;
Index : Index_Type
) return Handle_Type is
Ptr : constant Object_Type_Ptr := Get (Container, Index);
begin
if Ptr = null then
raise Constraint_Error;
else
return Ref (Ptr);
end if;
end Ref;
end Object.Handle.Generic_Unbounded_Array;
|
-----------------------------------------------------------------------
-- Ada Labs --
-- --
-- Copyright (C) 2008-2009, AdaCore --
-- --
-- Labs 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 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, write to the Free Software Foundation, Inc., 59 Temple --
-- Place - Suite 330, Boston, MA 02111-1307, USA. --
-----------------------------------------------------------------------
with Ada.Text_IO; use Ada.Text_IO;
with Ada.Real_Time; use Ada.Real_Time;
with Display; use Display;
with Display.Basic; use Display.Basic;
with Libm_Single; use Libm_Single;
procedure Main is
-- QUESTION 1 - Part 1
-- define type Bodies_Enum_T as an enumeration of Sun, Earth, Moon, Satellite
-- define type Parameters_Enum_T as an enumeration of parameter X, Y,
-- Radius, Speed, Distance, Angle
-- define type Bodies_Array_T as an array of float indexed by bodies and
-- parameters
-- define type Colors_Array_T as an array of color (RGBA_T) indexed by bodies
-- declare variable Bodies which is an instance of Bodies_Array_T
-- declare variable Colors which is an instance of Colors_Array_T
-- declare a variable Next of type Time to store the Next step time
Next : Time;
-- declare a constant Period of 40 milliseconds of type Time_Span defining
-- the loop period
Period : constant Time_Span := Milliseconds (40);
-- reference to the application window
Window : Window_ID;
-- reference to the graphical canvas associated with the application window
Canvas : Canvas_ID;
begin
-- Create a window 240x320
Window :=
Create_Window (Width => 240, Height => 320, Name => "Solar System");
-- Retrieve the graphical canvas from the window
Canvas := Get_Canvas (Window);
-- QUESTION 1 - Part 2
-- initialize Bodies variable with parameters for each body using an aggregate
-- Sun Distance = 0.0, Angle = 0.0, Speed = 0.0, Radius = 20.0;
-- Earth Distance = 50.0, Angle = 0.0, Speed = 0.02, Radius = 5.0;
-- Moon Distance = 15.0, Angle = 0.0, Speed = 0.04, Radius = 2.0;
-- Satellite Distance = 8.0, Angle = 0.0, Speed = 0.1, Radius = 1.0;
-- QUESTION 1 - Part 3
-- initialize Colors variable with Sun is Yellow, Earth is Blue, Moon is
-- White, Satellite is Red
-- initialize the Next step time begin the current time (Clock) + the period
Next := Clock + Period;
while not Is_Killed loop
-- QUESTION 2 - part 1
-- create a loop to update each body position and angles
-- the position of an object around (0,0) at distance d with an angle a
-- is (d*cos(a), d*sin(a))
-- update angle parameter of each body adding speed to the previous angle
-- QUESTION 2 - part 2
-- create a loop to draw every objects
-- use the Draw_Sphere procedure to do it
-- update the screen using procedure Swap_Buffers
Swap_Buffers (Window);
-- wait until Next
delay until Next;
-- update the Next time adding the period for the next step
Next := Next + Period;
end loop;
end Main;
|
package Renaming4 is
type Big_Array is array (Natural range <>) of Integer;
subtype Index is Natural range 1..4;
subtype My_Array is Big_Array(Index);
A : constant My_Array := (1, 2, 3, 4);
subtype Small is Index range 1..2;
subtype Small_Array is Big_Array(Small);
B : Small_Array renames A(Index);
end Renaming4;
|
-- ___ _ ___ _ _ --
-- / __| |/ (_) | | Common SKilL implementation --
-- \__ \ ' <| | | |__ skills vector container implementation --
-- |___/_|\_\_|_|____| by: Dennis Przytarski, Timm Felden --
-- --
pragma Ada_2012;
with Ada.Containers.Hashed_Maps;
with Ada.Finalization;
with Ada.Unchecked_Conversion;
with Skill.Types;
with Ada.Containers;
-- sets used by skill; those are basically ada hashed sets with template aware boxing
generic
type K is private;
type V is private;
with function Hash (Element : K) return Ada.Containers.Hash_Type is <>;
with function Equals (Left, Right : K) return Boolean is <>;
with function "=" (Left, Right : V) return Boolean is <>;
package Skill.Containers.Maps is
pragma Warnings (Off);
use Skill.Types;
function CastK is new Ada.Unchecked_Conversion (Box, K);
function CastK is new Ada.Unchecked_Conversion (K, Box);
-- if K = V, we would be fucked, if we'd call both cast
function CastV is new Ada.Unchecked_Conversion (Box, V);
function CastV is new Ada.Unchecked_Conversion (V, Box);
package HS is new Ada.Containers.Hashed_Maps (K, V, Hash, Equals, "=");
type Iterator_T is new Map_Iterator_T with record
Cursor : Hs.Cursor;
end record;
function Has_Next (This : access Iterator_T) return Boolean is
(Hs.Has_Element(This.Cursor));
function Key (This : access Iterator_T) return Skill.Types.Box is
(CastK(Hs.Key(This.Cursor)));
function Value (This : access Iterator_T) return Skill.Types.Box is
(CastV(Hs.Element(This.Cursor)));
procedure Advance (This : access Iterator_T);
procedure Free (This : access Iterator_T);
type Map_T is new Boxed_Map_T with record
This : HS.Map;
end record;
type Ref is access Map_T;
function Contains
(This : access Map_T;
V : Skill.Types.Box) return Boolean is
(This.This.Contains (CastK (V)));
function Get
(This : access Map_T;
K : Skill.Types.Box) return Skill.Types.Box is
(CastV(This.This.Element(CastK(K))));
procedure Update
(This : access Map_T;
K : Skill.Types.Box;
V : Skill.Types.Box);
procedure Remove
(This : access Map_T;
K : Skill.Types.Box);
function Length
(This : access Map_T) return Natural is
(Natural (This.This.Length));
overriding
function Iterator (This : access Map_T) return Map_Iterator is
(new Iterator_T'(Cursor => This.This.First));
-- create a new container
function Make return Ref;
-- turn a box into a container of right type
function Unboxed is new Ada.Unchecked_Conversion (Box, Ref);
end Skill.Containers.Maps;
|
-- { dg-do compile }
-- { dg-options "-gnatws" }
package body volatile2 is
procedure Copy is
R : Result;
M : Integer;
subtype Get_Data is Command_Data (Get, R.Data'Last);
begin
declare
G : Get_Data;
for G'Address use M'Address;
begin
for I in 1 .. R.Data'Last loop
G.Data (I) := (Time => R.Data (I).Time);
end loop;
end;
end;
end volatile2;
|
-----------------------------------------------------------------------
-- babel-strategies-workers -- Tasks that perform strategy work
-- Copyright (C) 2014 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.Log.Loggers;
package body Babel.Strategies.Workers is
Log : constant Util.Log.Loggers.Logger := Util.Log.Loggers.Create ("Babel.Strategies.Workers");
procedure Configure (Worker : in out Worker_Type;
Process : not null access procedure (S : in out Worker_Strategy)) is
begin
for I in Worker.Workers'Range loop
Process (Worker.Strategies (I));
end loop;
end Configure;
procedure Start (Worker : in out Worker_Type) is
begin
for I in Worker.Workers'Range loop
Worker.Workers (I).Start (Worker.Strategies (I)'Unchecked_Access);
end loop;
end Start;
procedure Finish (Worker : in out Worker_Type;
Database : in out Babel.Base.Database'Class) is
begin
for I in Worker.Workers'Range loop
Worker.Workers (I).Finish (Database);
end loop;
end Finish;
task body Worker_Task is
S : Babel.Strategies.Strategy_Type_Access;
begin
Log.Info ("Strategy worker is started");
select
accept Start (Strategy : in Babel.Strategies.Strategy_Type_Access) do
S := Strategy;
end Start;
or
terminate;
end select;
loop
begin
S.Execute;
exception
when Babel.Files.Queues.File_Fifo.Timeout =>
Log.Info ("Strategy worker stopped on timeout");
exit;
when E : others =>
Log.Error ("Strategy worker received exception", E, True);
end;
end loop;
select
accept Finish (Database : in out Babel.Base.Database'Class) do
Database.Copy (S.Database);
end Finish;
or
terminate;
end select;
end Worker_Task;
end Babel.Strategies.Workers;
|
with
openGL.Palette,
openGL.Primitive.non_indexed;
package body openGL.Model.grid
is
function Line_Count (Extent : in Positive) return Positive
is
begin
if Extent mod 2 /= 0
then
return Extent;
else
return Extent + 1;
end if;
end Line_Count;
---------
--- Forge
--
function to_grid_Model (Color : openGL.Color;
Width : Integer;
Height : Integer) return Item
is
Self : Item;
vertex_Count : constant Positive := ( line_Count (Width)
+ line_Count (Height)) * 2;
half_Width : constant Real := Real (Width) / 2.0;
half_Height : constant Real := Real (Height) / 2.0;
begin
Self.Color := +Color;
Self.Width := Width;
Self.Height := Height;
Self.Bounds := (Ball => <>,
Box => (lower => (-half_Width, -half_Height, -0.01),
upper => ( half_Width, half_Height, 0.01)));
set_Ball_from_Box (Self.Bounds);
Self.Vertices := new Geometry.colored.Vertex_array (1 .. Index_t (vertex_Count));
return Self;
end to_grid_Model;
function new_grid_Model (Color : openGL.Color;
Width : Integer;
Height : Integer) return View
is
begin
return new Item' (to_grid_Model (Color, Width, Height));
end new_grid_Model;
--------------
--- 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
is
pragma unreferenced (Textures, Fonts);
use Palette,
Geometry.colored;
the_Primitive : Primitive.non_indexed.view;
begin
if Self.Geometry = null
then
Self.Geometry := Geometry.colored.new_Geometry;
end if;
set_Sites :
declare
row_Count : constant Positive := line_Count (Self.Height);
col_Count : constant Positive := line_Count (Self.Width);
vertex_Count : Index_t := 0;
half_Width : constant Real := Real (Self.Width) / 2.0;
half_Height : constant Real := Real (Self.Height) / 2.0;
x_Adjust,
y_Adjust : Real;
Color : openGL.rgb_Color := Self.Color;
begin
if Self.Width mod 2 = 0
then x_Adjust := 0.0;
else x_Adjust := 0.5;
end if;
if Self.Height mod 2 = 0
then y_Adjust := 0.0;
else y_Adjust := 0.5;
end if;
for Row in 1 .. row_Count
loop
if Row = row_Count / 2 + 1
then
Color := +White;
end if;
vertex_Count := vertex_Count + 1;
Self.Vertices (vertex_Count).Site := (-half_Width,
Real (Row - 1) - half_Height + y_Adjust,
0.16);
Self.Vertices (vertex_Count).Color := (primary => Color,
Alpha => opaque_Value);
vertex_Count := vertex_Count + 1;
Self.Vertices (vertex_Count).Site := (half_Width,
Real (Row - 1) - half_Height + y_Adjust,
0.16);
Self.Vertices (vertex_Count).Color := (primary => Color,
Alpha => opaque_Value);
if Row = row_Count / 2 + 1
then
Color := Self.Color;
end if;
end loop;
for Col in 1 .. col_Count
loop
if Col = col_Count / 2 + 1
then
Color := +White;
end if;
vertex_Count := vertex_Count + 1;
Self.Vertices (vertex_Count).Site := (Real (Col - 1) - half_Width + x_Adjust,
-half_Height,
0.16);
Self.Vertices (vertex_Count).Color := (primary => Color,
Alpha => opaque_Value);
vertex_Count := vertex_Count + 1;
Self.Vertices (vertex_Count).Site := (Real (Col - 1) - half_Width + x_Adjust,
half_Height,
0.16);
Self.Vertices (vertex_Count).Color := (primary => Color,
Alpha => opaque_Value);
if Col = col_Count / 2 + 1
then
Color := Self.Color;
end if;
end loop;
end set_Sites;
Self.Geometry.is_Transparent (False);
Vertices_are (Self.Geometry.all,
Self.Vertices.all);
the_Primitive := Primitive.non_indexed.new_Primitive (openGL.primitive.Lines,
Self.Vertices'Length);
Self.Geometry.add (Primitive.view (the_Primitive));
return (1 => Self.Geometry.all'Access);
end to_GL_Geometries;
end openGL.Model.grid;
|
-- This spec has been automatically generated from STM32WL5x_CM0P.svd
pragma Restrictions (No_Elaboration_Code);
pragma Ada_2012;
pragma Style_Checks (Off);
with HAL;
with System;
package STM32_SVD.RCC is
pragma Preelaborate;
---------------
-- Registers --
---------------
subtype CR_MSIRANGE_Field is HAL.UInt4;
-- Clock control register
type CR_Register is record
-- MSI clock enable
MSION : Boolean := True;
-- Read-only. MSI clock ready flag (After reset this bit will be read 1
-- once the MSI is ready)
MSIRDY : Boolean := False;
-- MSI clock PLL enable
MSIPLLEN : Boolean := False;
-- MSI range control selection
MSIRGSEL : Boolean := False;
-- MSI clock ranges
MSIRANGE : CR_MSIRANGE_Field := 16#6#;
-- HSI16 clock enable
HSION : Boolean := False;
-- HSI16 always enable for peripheral kernel clocks.
HSIKERON : Boolean := False;
-- Read-only. HSI16 clock ready flag. (After wakeup from Stop this bit
-- will be read 1 once the HSI16 is ready)
HSIRDY : Boolean := False;
-- HSI16 automatic start from Stop
HSIASFS : Boolean := False;
-- Read-only. HSI16 kernel clock ready flag for peripherals requests.
HSIKERDY : Boolean := False;
-- unspecified
Reserved_13_15 : HAL.UInt3 := 16#0#;
-- HSE32 clock enable
HSEON : Boolean := False;
-- Read-only. HSE32 clock ready flag
HSERDY : Boolean := False;
-- unspecified
Reserved_18_18 : HAL.Bit := 16#0#;
-- HSE32 Clock security system enable
CSSON : Boolean := False;
-- HSE32 sysclk prescaler
HSEPRE : Boolean := False;
-- Enable HSE32 VDDTCXO output on package pin PB0-VDDTCXO.
HSEBYPPWR : Boolean := False;
-- unspecified
Reserved_22_23 : HAL.UInt2 := 16#0#;
-- Main PLL enable
PLLON : Boolean := False;
-- Read-only. Main PLL clock ready flag
PLLRDY : Boolean := False;
-- unspecified
Reserved_26_31 : HAL.UInt6 := 16#0#;
end record
with Volatile_Full_Access, Object_Size => 32,
Bit_Order => System.Low_Order_First;
for CR_Register use record
MSION at 0 range 0 .. 0;
MSIRDY at 0 range 1 .. 1;
MSIPLLEN at 0 range 2 .. 2;
MSIRGSEL at 0 range 3 .. 3;
MSIRANGE at 0 range 4 .. 7;
HSION at 0 range 8 .. 8;
HSIKERON at 0 range 9 .. 9;
HSIRDY at 0 range 10 .. 10;
HSIASFS at 0 range 11 .. 11;
HSIKERDY at 0 range 12 .. 12;
Reserved_13_15 at 0 range 13 .. 15;
HSEON at 0 range 16 .. 16;
HSERDY at 0 range 17 .. 17;
Reserved_18_18 at 0 range 18 .. 18;
CSSON at 0 range 19 .. 19;
HSEPRE at 0 range 20 .. 20;
HSEBYPPWR at 0 range 21 .. 21;
Reserved_22_23 at 0 range 22 .. 23;
PLLON at 0 range 24 .. 24;
PLLRDY at 0 range 25 .. 25;
Reserved_26_31 at 0 range 26 .. 31;
end record;
subtype ICSCR_MSICAL_Field is HAL.UInt8;
subtype ICSCR_MSITRIM_Field is HAL.UInt8;
subtype ICSCR_HSICAL_Field is HAL.UInt8;
subtype ICSCR_HSITRIM_Field is HAL.UInt7;
-- Internal clock sources calibration register
type ICSCR_Register is record
-- Read-only. MSI clock calibration
MSICAL : ICSCR_MSICAL_Field := 16#0#;
-- MSI clock trimming
MSITRIM : ICSCR_MSITRIM_Field := 16#0#;
-- Read-only. HSI16 clock calibration
HSICAL : ICSCR_HSICAL_Field := 16#0#;
-- HSI16 clock trimming
HSITRIM : ICSCR_HSITRIM_Field := 16#40#;
-- unspecified
Reserved_31_31 : HAL.Bit := 16#0#;
end record
with Volatile_Full_Access, Object_Size => 32,
Bit_Order => System.Low_Order_First;
for ICSCR_Register use record
MSICAL at 0 range 0 .. 7;
MSITRIM at 0 range 8 .. 15;
HSICAL at 0 range 16 .. 23;
HSITRIM at 0 range 24 .. 30;
Reserved_31_31 at 0 range 31 .. 31;
end record;
subtype CFGR_SW_Field is HAL.UInt2;
subtype CFGR_SWS_Field is HAL.UInt2;
subtype CFGR_HPRE_Field is HAL.UInt4;
-- CFGR_PPRE array element
subtype CFGR_PPRE_Element is HAL.UInt3;
-- CFGR_PPRE array
type CFGR_PPRE_Field_Array is array (1 .. 2) of CFGR_PPRE_Element
with Component_Size => 3, Size => 6;
-- Type definition for CFGR_PPRE
type CFGR_PPRE_Field
(As_Array : Boolean := False)
is record
case As_Array is
when False =>
-- PPRE as a value
Val : HAL.UInt6;
when True =>
-- PPRE as an array
Arr : CFGR_PPRE_Field_Array;
end case;
end record
with Unchecked_Union, Size => 6;
for CFGR_PPRE_Field use record
Val at 0 range 0 .. 5;
Arr at 0 range 0 .. 5;
end record;
subtype CFGR_MCOSEL_Field is HAL.UInt4;
subtype CFGR_MCOPRE_Field is HAL.UInt3;
-- Clock configuration register
type CFGR_Register is record
-- System clock switch
SW : CFGR_SW_Field := 16#0#;
-- Read-only. System clock switch status
SWS : CFGR_SWS_Field := 16#0#;
-- HCLK1 prescaler (CPU1, AHB1, AHB2, and SRAM1.)
HPRE : CFGR_HPRE_Field := 16#0#;
-- PCLK1 low-speed prescaler (APB1)
PPRE : CFGR_PPRE_Field := (As_Array => False, Val => 16#0#);
-- unspecified
Reserved_14_14 : HAL.Bit := 16#0#;
-- Wakeup from Stop and CSS backup clock selection
STOPWUCK : Boolean := False;
-- Read-only. HCLK1 prescaler flag (CPU1, AHB1, AHB2, and SRAM1)
HPREF : Boolean := True;
-- Read-only. PCLK1 prescaler flag (APB1)
PPRE1F : Boolean := True;
-- Read-only. PCLK2 prescaler flag (APB2)
PPRE2F : Boolean := True;
-- unspecified
Reserved_19_23 : HAL.UInt5 := 16#0#;
-- Microcontroller clock output
MCOSEL : CFGR_MCOSEL_Field := 16#0#;
-- Microcontroller clock output prescaler
MCOPRE : CFGR_MCOPRE_Field := 16#0#;
-- unspecified
Reserved_31_31 : HAL.Bit := 16#0#;
end record
with Volatile_Full_Access, Object_Size => 32,
Bit_Order => System.Low_Order_First;
for CFGR_Register use record
SW at 0 range 0 .. 1;
SWS at 0 range 2 .. 3;
HPRE at 0 range 4 .. 7;
PPRE at 0 range 8 .. 13;
Reserved_14_14 at 0 range 14 .. 14;
STOPWUCK at 0 range 15 .. 15;
HPREF at 0 range 16 .. 16;
PPRE1F at 0 range 17 .. 17;
PPRE2F at 0 range 18 .. 18;
Reserved_19_23 at 0 range 19 .. 23;
MCOSEL at 0 range 24 .. 27;
MCOPRE at 0 range 28 .. 30;
Reserved_31_31 at 0 range 31 .. 31;
end record;
subtype PLLCFGR_PLLSRC_Field is HAL.UInt2;
subtype PLLCFGR_PLLM_Field is HAL.UInt3;
subtype PLLCFGR_PLLN_Field is HAL.UInt7;
subtype PLLCFGR_PLLP_Field is HAL.UInt5;
subtype PLLCFGR_PLLQ_Field is HAL.UInt3;
subtype PLLCFGR_PLLR_Field is HAL.UInt3;
-- PLL configuration register
type PLLCFGR_Register is record
-- Main PLL entry clock source
PLLSRC : PLLCFGR_PLLSRC_Field := 16#0#;
-- unspecified
Reserved_2_3 : HAL.UInt2 := 16#0#;
-- Division factor for the main PLL input clock
PLLM : PLLCFGR_PLLM_Field := 16#0#;
-- unspecified
Reserved_7_7 : HAL.Bit := 16#0#;
-- Main PLL multiplication factor for VCO
PLLN : PLLCFGR_PLLN_Field := 16#1#;
-- unspecified
Reserved_15_15 : HAL.Bit := 16#0#;
-- Main PLL PLLPCLK output enable
PLLPEN : Boolean := False;
-- Main PLL division factor for PLLPCLK.
PLLP : PLLCFGR_PLLP_Field := 16#2#;
-- unspecified
Reserved_22_23 : HAL.UInt2 := 16#0#;
-- Main PLL PLLQCLK output enable
PLLQEN : Boolean := False;
-- Main PLL division factor for PLLQCLK
PLLQ : PLLCFGR_PLLQ_Field := 16#1#;
-- Main PLL PLLRCLK output enable
PLLREN : Boolean := False;
-- Main PLL division factor for PLLRCLK
PLLR : PLLCFGR_PLLR_Field := 16#1#;
end record
with Volatile_Full_Access, Object_Size => 32,
Bit_Order => System.Low_Order_First;
for PLLCFGR_Register use record
PLLSRC at 0 range 0 .. 1;
Reserved_2_3 at 0 range 2 .. 3;
PLLM at 0 range 4 .. 6;
Reserved_7_7 at 0 range 7 .. 7;
PLLN at 0 range 8 .. 14;
Reserved_15_15 at 0 range 15 .. 15;
PLLPEN at 0 range 16 .. 16;
PLLP at 0 range 17 .. 21;
Reserved_22_23 at 0 range 22 .. 23;
PLLQEN at 0 range 24 .. 24;
PLLQ at 0 range 25 .. 27;
PLLREN at 0 range 28 .. 28;
PLLR at 0 range 29 .. 31;
end record;
-- Clock interrupt enable register
type CIER_Register is record
-- LSI ready interrupt enable
LSIRDYIE : Boolean := False;
-- LSE ready interrupt enable
LSERDYIE : Boolean := False;
-- MSI ready interrupt enable
MSIRDYIE : Boolean := False;
-- HSI16 ready interrupt enable
HSIRDYIE : Boolean := False;
-- HSE32 ready interrupt enable
HSERDYIE : Boolean := False;
-- PLL ready interrupt enable
PLLRDYIE : Boolean := False;
-- unspecified
Reserved_6_8 : HAL.UInt3 := 16#0#;
-- LSE clock security system interrupt enable
LSECSSIE : Boolean := False;
-- unspecified
Reserved_10_31 : HAL.UInt22 := 16#0#;
end record
with Volatile_Full_Access, Object_Size => 32,
Bit_Order => System.Low_Order_First;
for CIER_Register use record
LSIRDYIE at 0 range 0 .. 0;
LSERDYIE at 0 range 1 .. 1;
MSIRDYIE at 0 range 2 .. 2;
HSIRDYIE at 0 range 3 .. 3;
HSERDYIE at 0 range 4 .. 4;
PLLRDYIE at 0 range 5 .. 5;
Reserved_6_8 at 0 range 6 .. 8;
LSECSSIE at 0 range 9 .. 9;
Reserved_10_31 at 0 range 10 .. 31;
end record;
-- Clock interrupt flag register
type CIFR_Register is record
-- Read-only. LSI ready interrupt flag
LSIRDYF : Boolean;
-- Read-only. LSE ready interrupt flag
LSERDYF : Boolean;
-- Read-only. MSI ready interrupt flag
MSIRDYF : Boolean;
-- Read-only. HSI16 ready interrupt flag
HSIRDYF : Boolean;
-- Read-only. HSE32 ready interrupt flag
HSERDYF : Boolean;
-- Read-only. PLL ready interrupt flag
PLLRDYF : Boolean;
-- unspecified
Reserved_6_7 : HAL.UInt2;
-- Read-only. HSE32 Clock security system interrupt flag
CSSF : Boolean;
-- Read-only. LSE Clock security system interrupt flag
LSECSSF : Boolean;
-- unspecified
Reserved_10_31 : HAL.UInt22;
end record
with Volatile_Full_Access, Object_Size => 32,
Bit_Order => System.Low_Order_First;
for CIFR_Register use record
LSIRDYF at 0 range 0 .. 0;
LSERDYF at 0 range 1 .. 1;
MSIRDYF at 0 range 2 .. 2;
HSIRDYF at 0 range 3 .. 3;
HSERDYF at 0 range 4 .. 4;
PLLRDYF at 0 range 5 .. 5;
Reserved_6_7 at 0 range 6 .. 7;
CSSF at 0 range 8 .. 8;
LSECSSF at 0 range 9 .. 9;
Reserved_10_31 at 0 range 10 .. 31;
end record;
-- Clock interrupt clear register
type CICR_Register is record
-- Write-only. LSI ready interrupt clear
LSIRDYC : Boolean := False;
-- Write-only. LSE ready interrupt clear
LSERDYC : Boolean := False;
-- Write-only. MSI ready interrupt clear
MSIRDYC : Boolean := False;
-- Write-only. HSI16 ready interrupt clear
HSIRDYC : Boolean := False;
-- Write-only. HSE32 ready interrupt clear
HSERDYC : Boolean := False;
-- Write-only. PLL ready interrupt clear
PLLRDYC : Boolean := False;
-- unspecified
Reserved_6_7 : HAL.UInt2 := 16#0#;
-- Write-only. HSE32 Clock security system interrupt clear
CSSC : Boolean := False;
-- Write-only. LSE Clock security system interrupt clear
LSECSSC : Boolean := False;
-- unspecified
Reserved_10_31 : HAL.UInt22 := 16#0#;
end record
with Volatile_Full_Access, Object_Size => 32,
Bit_Order => System.Low_Order_First;
for CICR_Register use record
LSIRDYC at 0 range 0 .. 0;
LSERDYC at 0 range 1 .. 1;
MSIRDYC at 0 range 2 .. 2;
HSIRDYC at 0 range 3 .. 3;
HSERDYC at 0 range 4 .. 4;
PLLRDYC at 0 range 5 .. 5;
Reserved_6_7 at 0 range 6 .. 7;
CSSC at 0 range 8 .. 8;
LSECSSC at 0 range 9 .. 9;
Reserved_10_31 at 0 range 10 .. 31;
end record;
-- AHB1 peripheral reset register
type AHB1RSTR_Register is record
-- DMA1 reset
DMA1RST : Boolean := False;
-- DMA2 reset
DMA2RST : Boolean := False;
-- DMAMUX1 reset
DMAMUX1RST : Boolean := False;
-- unspecified
Reserved_3_11 : HAL.UInt9 := 16#0#;
-- CRC reset
CRCRST : Boolean := False;
-- unspecified
Reserved_13_31 : HAL.UInt19 := 16#0#;
end record
with Volatile_Full_Access, Object_Size => 32,
Bit_Order => System.Low_Order_First;
for AHB1RSTR_Register use record
DMA1RST at 0 range 0 .. 0;
DMA2RST at 0 range 1 .. 1;
DMAMUX1RST at 0 range 2 .. 2;
Reserved_3_11 at 0 range 3 .. 11;
CRCRST at 0 range 12 .. 12;
Reserved_13_31 at 0 range 13 .. 31;
end record;
-- AHB2 peripheral reset register
type AHB2RSTR_Register is record
-- IO port A reset
GPIOARST : Boolean := False;
-- IO port B reset
GPIOBRST : Boolean := False;
-- IO port C reset
GPIOCRST : Boolean := False;
-- unspecified
Reserved_3_6 : HAL.UInt4 := 16#0#;
-- IO port H reset
GPIOHRST : Boolean := False;
-- unspecified
Reserved_8_31 : HAL.UInt24 := 16#0#;
end record
with Volatile_Full_Access, Object_Size => 32,
Bit_Order => System.Low_Order_First;
for AHB2RSTR_Register use record
GPIOARST at 0 range 0 .. 0;
GPIOBRST at 0 range 1 .. 1;
GPIOCRST at 0 range 2 .. 2;
Reserved_3_6 at 0 range 3 .. 6;
GPIOHRST at 0 range 7 .. 7;
Reserved_8_31 at 0 range 8 .. 31;
end record;
-- AHB3 peripheral reset register
type AHB3RSTR_Register is record
-- unspecified
Reserved_0_15 : HAL.UInt16 := 16#0#;
-- PKARST
PKARST : Boolean := False;
-- AESRST
AESRST : Boolean := False;
-- RNGRST
RNGRST : Boolean := False;
-- HSEMRST
HSEMRST : Boolean := False;
-- IPCCRST
IPCCRST : Boolean := False;
-- unspecified
Reserved_21_24 : HAL.UInt4 := 16#0#;
-- Flash interface reset
FLASHRST : Boolean := False;
-- unspecified
Reserved_26_31 : HAL.UInt6 := 16#0#;
end record
with Volatile_Full_Access, Object_Size => 32,
Bit_Order => System.Low_Order_First;
for AHB3RSTR_Register use record
Reserved_0_15 at 0 range 0 .. 15;
PKARST at 0 range 16 .. 16;
AESRST at 0 range 17 .. 17;
RNGRST at 0 range 18 .. 18;
HSEMRST at 0 range 19 .. 19;
IPCCRST at 0 range 20 .. 20;
Reserved_21_24 at 0 range 21 .. 24;
FLASHRST at 0 range 25 .. 25;
Reserved_26_31 at 0 range 26 .. 31;
end record;
-- APB1 peripheral reset register 1
type APB1RSTR1_Register is record
-- TIM2 timer reset
TIM2RST : Boolean := False;
-- unspecified
Reserved_1_13 : HAL.UInt13 := 16#0#;
-- SPI2S2 reset
SPI2S2RST : Boolean := False;
-- unspecified
Reserved_15_16 : HAL.UInt2 := 16#0#;
-- USART2 reset
USART2RST : Boolean := False;
-- unspecified
Reserved_18_20 : HAL.UInt3 := 16#0#;
-- I2C1 reset
I2C1RST : Boolean := False;
-- I2C2 reset
I2C2RST : Boolean := False;
-- I2C3 reset
I2C3RST : Boolean := False;
-- unspecified
Reserved_24_28 : HAL.UInt5 := 16#0#;
-- DAC1 reset
DACRST : Boolean := False;
-- unspecified
Reserved_30_30 : HAL.Bit := 16#0#;
-- Low Power Timer 1 reset
LPTIM1RST : Boolean := False;
end record
with Volatile_Full_Access, Object_Size => 32,
Bit_Order => System.Low_Order_First;
for APB1RSTR1_Register use record
TIM2RST at 0 range 0 .. 0;
Reserved_1_13 at 0 range 1 .. 13;
SPI2S2RST at 0 range 14 .. 14;
Reserved_15_16 at 0 range 15 .. 16;
USART2RST at 0 range 17 .. 17;
Reserved_18_20 at 0 range 18 .. 20;
I2C1RST at 0 range 21 .. 21;
I2C2RST at 0 range 22 .. 22;
I2C3RST at 0 range 23 .. 23;
Reserved_24_28 at 0 range 24 .. 28;
DACRST at 0 range 29 .. 29;
Reserved_30_30 at 0 range 30 .. 30;
LPTIM1RST at 0 range 31 .. 31;
end record;
-- APB1 peripheral reset register 2
type APB1RSTR2_Register is record
-- Low-power UART 1 reset
LPUART1RST : Boolean := False;
-- unspecified
Reserved_1_4 : HAL.UInt4 := 16#0#;
-- Low-power timer 2 reset
LPTIM2RST : Boolean := False;
-- Low-power timer 3 reset
LPTIM3RST : Boolean := False;
-- unspecified
Reserved_7_31 : HAL.UInt25 := 16#0#;
end record
with Volatile_Full_Access, Object_Size => 32,
Bit_Order => System.Low_Order_First;
for APB1RSTR2_Register use record
LPUART1RST at 0 range 0 .. 0;
Reserved_1_4 at 0 range 1 .. 4;
LPTIM2RST at 0 range 5 .. 5;
LPTIM3RST at 0 range 6 .. 6;
Reserved_7_31 at 0 range 7 .. 31;
end record;
-- APB2 peripheral reset register
type APB2RSTR_Register is record
-- unspecified
Reserved_0_8 : HAL.UInt9 := 16#0#;
-- ADC reset
ADCRST : Boolean := False;
-- unspecified
Reserved_10_10 : HAL.Bit := 16#0#;
-- TIM1 timer reset
TIM1RST : Boolean := False;
-- SPI1 reset
SPI1RST : Boolean := False;
-- unspecified
Reserved_13_13 : HAL.Bit := 16#0#;
-- USART1 reset
USART1RST : Boolean := False;
-- unspecified
Reserved_15_16 : HAL.UInt2 := 16#0#;
-- TIM16 timer reset
TIM16RST : Boolean := False;
-- TIM17 timer reset
TIM17RST : Boolean := False;
-- unspecified
Reserved_19_31 : HAL.UInt13 := 16#0#;
end record
with Volatile_Full_Access, Object_Size => 32,
Bit_Order => System.Low_Order_First;
for APB2RSTR_Register use record
Reserved_0_8 at 0 range 0 .. 8;
ADCRST at 0 range 9 .. 9;
Reserved_10_10 at 0 range 10 .. 10;
TIM1RST at 0 range 11 .. 11;
SPI1RST at 0 range 12 .. 12;
Reserved_13_13 at 0 range 13 .. 13;
USART1RST at 0 range 14 .. 14;
Reserved_15_16 at 0 range 15 .. 16;
TIM16RST at 0 range 17 .. 17;
TIM17RST at 0 range 18 .. 18;
Reserved_19_31 at 0 range 19 .. 31;
end record;
-- APB3 peripheral reset register
type APB3RSTR_Register is record
-- Sub-GHz radio SPI reset
SUBGHZSPIRST : Boolean := False;
-- unspecified
Reserved_1_31 : HAL.UInt31 := 16#0#;
end record
with Volatile_Full_Access, Object_Size => 32,
Bit_Order => System.Low_Order_First;
for APB3RSTR_Register use record
SUBGHZSPIRST at 0 range 0 .. 0;
Reserved_1_31 at 0 range 1 .. 31;
end record;
-- AHB1 peripheral clock enable register
type AHB1ENR_Register is record
-- CPU1 DMA1 clock enable
DMA1EN : Boolean := False;
-- CPU1 DMA2 clock enable
DMA2EN : Boolean := False;
-- CPU1 DMAMUX1 clock enable
DMAMUX1EN : Boolean := False;
-- unspecified
Reserved_3_11 : HAL.UInt9 := 16#0#;
-- CPU1 CRC clock enable
CRCEN : Boolean := False;
-- unspecified
Reserved_13_31 : HAL.UInt19 := 16#0#;
end record
with Volatile_Full_Access, Object_Size => 32,
Bit_Order => System.Low_Order_First;
for AHB1ENR_Register use record
DMA1EN at 0 range 0 .. 0;
DMA2EN at 0 range 1 .. 1;
DMAMUX1EN at 0 range 2 .. 2;
Reserved_3_11 at 0 range 3 .. 11;
CRCEN at 0 range 12 .. 12;
Reserved_13_31 at 0 range 13 .. 31;
end record;
-- AHB2 peripheral clock enable register
type AHB2ENR_Register is record
-- CPU1 IO port A clock enable
GPIOAEN : Boolean := False;
-- CPU1 IO port B clock enable
GPIOBEN : Boolean := False;
-- CPU1 IO port C clock enable
GPIOCEN : Boolean := False;
-- unspecified
Reserved_3_6 : HAL.UInt4 := 16#0#;
-- CPU1 IO port H clock enable
GPIOHEN : Boolean := False;
-- unspecified
Reserved_8_31 : HAL.UInt24 := 16#0#;
end record
with Volatile_Full_Access, Object_Size => 32,
Bit_Order => System.Low_Order_First;
for AHB2ENR_Register use record
GPIOAEN at 0 range 0 .. 0;
GPIOBEN at 0 range 1 .. 1;
GPIOCEN at 0 range 2 .. 2;
Reserved_3_6 at 0 range 3 .. 6;
GPIOHEN at 0 range 7 .. 7;
Reserved_8_31 at 0 range 8 .. 31;
end record;
-- AHB3 peripheral clock enable register
type AHB3ENR_Register is record
-- unspecified
Reserved_0_15 : HAL.UInt16 := 16#0#;
-- PKAEN
PKAEN : Boolean := False;
-- AESEN
AESEN : Boolean := False;
-- RNGEN
RNGEN : Boolean := False;
-- HSEMEN
HSEMEN : Boolean := True;
-- IPCCEN
IPCCEN : Boolean := False;
-- unspecified
Reserved_21_24 : HAL.UInt4 := 16#0#;
-- CPU1 Flash interface clock enable
FLASHEN : Boolean := True;
-- unspecified
Reserved_26_31 : HAL.UInt6 := 16#0#;
end record
with Volatile_Full_Access, Object_Size => 32,
Bit_Order => System.Low_Order_First;
for AHB3ENR_Register use record
Reserved_0_15 at 0 range 0 .. 15;
PKAEN at 0 range 16 .. 16;
AESEN at 0 range 17 .. 17;
RNGEN at 0 range 18 .. 18;
HSEMEN at 0 range 19 .. 19;
IPCCEN at 0 range 20 .. 20;
Reserved_21_24 at 0 range 21 .. 24;
FLASHEN at 0 range 25 .. 25;
Reserved_26_31 at 0 range 26 .. 31;
end record;
-- APB1 peripheral clock enable register 1
type APB1ENR1_Register is record
-- CPU1 TIM2 timer clock enable
TIM2EN : Boolean := False;
-- unspecified
Reserved_1_9 : HAL.UInt9 := 16#0#;
-- CPU1 RTC APB clock enable
RTCAPBEN : Boolean := False;
-- CPU1 Window watchdog clock enable
WWDGEN : Boolean := False;
-- unspecified
Reserved_12_13 : HAL.UInt2 := 16#0#;
-- CPU1 SPI2S2 clock enable
SPI2S2EN : Boolean := False;
-- unspecified
Reserved_15_16 : HAL.UInt2 := 16#0#;
-- CPU1 USART2 clock enable
USART2EN : Boolean := False;
-- unspecified
Reserved_18_20 : HAL.UInt3 := 16#0#;
-- CPU1 I2C1 clocks enable
I2C1EN : Boolean := False;
-- CPU1 I2C2 clocks enable
I2C2EN : Boolean := False;
-- CPU1 I2C3 clocks enable
I2C3EN : Boolean := False;
-- unspecified
Reserved_24_28 : HAL.UInt5 := 16#0#;
-- CPU1 DAC1 clock enable
DAC1EN : Boolean := False;
-- unspecified
Reserved_30_30 : HAL.Bit := 16#0#;
-- CPU1 Low power timer 1 clocks enable
LPTIM1EN : Boolean := False;
end record
with Volatile_Full_Access, Object_Size => 32,
Bit_Order => System.Low_Order_First;
for APB1ENR1_Register use record
TIM2EN at 0 range 0 .. 0;
Reserved_1_9 at 0 range 1 .. 9;
RTCAPBEN at 0 range 10 .. 10;
WWDGEN at 0 range 11 .. 11;
Reserved_12_13 at 0 range 12 .. 13;
SPI2S2EN at 0 range 14 .. 14;
Reserved_15_16 at 0 range 15 .. 16;
USART2EN at 0 range 17 .. 17;
Reserved_18_20 at 0 range 18 .. 20;
I2C1EN at 0 range 21 .. 21;
I2C2EN at 0 range 22 .. 22;
I2C3EN at 0 range 23 .. 23;
Reserved_24_28 at 0 range 24 .. 28;
DAC1EN at 0 range 29 .. 29;
Reserved_30_30 at 0 range 30 .. 30;
LPTIM1EN at 0 range 31 .. 31;
end record;
-- APB1 peripheral clock enable register 2
type APB1ENR2_Register is record
-- CPU1 Low power UART 1 clocks enable
LPUART1EN : Boolean := False;
-- unspecified
Reserved_1_4 : HAL.UInt4 := 16#0#;
-- CPU1 Low power timer 2 clocks enable
LPTIM2EN : Boolean := False;
-- CPU1 Low power timer 3 clocks enable
LPTIM3EN : Boolean := False;
-- unspecified
Reserved_7_31 : HAL.UInt25 := 16#0#;
end record
with Volatile_Full_Access, Object_Size => 32,
Bit_Order => System.Low_Order_First;
for APB1ENR2_Register use record
LPUART1EN at 0 range 0 .. 0;
Reserved_1_4 at 0 range 1 .. 4;
LPTIM2EN at 0 range 5 .. 5;
LPTIM3EN at 0 range 6 .. 6;
Reserved_7_31 at 0 range 7 .. 31;
end record;
-- APB2 peripheral clock enable register
type APB2ENR_Register is record
-- unspecified
Reserved_0_8 : HAL.UInt9 := 16#0#;
-- CPU1 ADC clocks enable
ADCEN : Boolean := False;
-- unspecified
Reserved_10_10 : HAL.Bit := 16#0#;
-- CPU1 TIM1 timer clock enable
TIM1EN : Boolean := False;
-- CPU1 SPI1 clock enable
SPI1EN : Boolean := False;
-- unspecified
Reserved_13_13 : HAL.Bit := 16#0#;
-- CPU1 USART1clocks enable
USART1EN : Boolean := False;
-- unspecified
Reserved_15_16 : HAL.UInt2 := 16#0#;
-- CPU1 TIM16 timer clock enable
TIM16EN : Boolean := False;
-- CPU1 TIM17 timer clock enable
TIM17EN : Boolean := False;
-- unspecified
Reserved_19_31 : HAL.UInt13 := 16#0#;
end record
with Volatile_Full_Access, Object_Size => 32,
Bit_Order => System.Low_Order_First;
for APB2ENR_Register use record
Reserved_0_8 at 0 range 0 .. 8;
ADCEN at 0 range 9 .. 9;
Reserved_10_10 at 0 range 10 .. 10;
TIM1EN at 0 range 11 .. 11;
SPI1EN at 0 range 12 .. 12;
Reserved_13_13 at 0 range 13 .. 13;
USART1EN at 0 range 14 .. 14;
Reserved_15_16 at 0 range 15 .. 16;
TIM16EN at 0 range 17 .. 17;
TIM17EN at 0 range 18 .. 18;
Reserved_19_31 at 0 range 19 .. 31;
end record;
-- APB3 peripheral clock enable register
type APB3ENR_Register is record
-- sub-GHz radio SPI clock enable
SUBGHZSPIEN : Boolean := False;
-- unspecified
Reserved_1_31 : HAL.UInt31 := 16#0#;
end record
with Volatile_Full_Access, Object_Size => 32,
Bit_Order => System.Low_Order_First;
for APB3ENR_Register use record
SUBGHZSPIEN at 0 range 0 .. 0;
Reserved_1_31 at 0 range 1 .. 31;
end record;
-- AHB1 peripheral clocks enable in Sleep modes register
type AHB1SMENR_Register is record
-- DMA1 clock enable during CPU1 CSleep mode.
DMA1SMEN : Boolean := True;
-- DMA2 clock enable during CPU1 CSleep mode
DMA2SMEN : Boolean := True;
-- DMAMUX1 clock enable during CPU1 CSleep mode.
DMAMUX1SMEN : Boolean := True;
-- unspecified
Reserved_3_11 : HAL.UInt9 := 16#0#;
-- CRC clock enable during CPU1 CSleep mode.
CRCSMEN : Boolean := True;
-- unspecified
Reserved_13_31 : HAL.UInt19 := 16#0#;
end record
with Volatile_Full_Access, Object_Size => 32,
Bit_Order => System.Low_Order_First;
for AHB1SMENR_Register use record
DMA1SMEN at 0 range 0 .. 0;
DMA2SMEN at 0 range 1 .. 1;
DMAMUX1SMEN at 0 range 2 .. 2;
Reserved_3_11 at 0 range 3 .. 11;
CRCSMEN at 0 range 12 .. 12;
Reserved_13_31 at 0 range 13 .. 31;
end record;
-- AHB2 peripheral clocks enable in Sleep modes register
type AHB2SMENR_Register is record
-- IO port A clock enable during CPU1 CSleep mode.
GPIOASMEN : Boolean := True;
-- IO port B clock enable during CPU1 CSleep mode.
GPIOBSMEN : Boolean := True;
-- IO port C clock enable during CPU1 CSleep mode.
GPIOCSMEN : Boolean := True;
-- unspecified
Reserved_3_6 : HAL.UInt4 := 16#0#;
-- IO port H clock enable during CPU1 CSleep mode.
GPIOHSMEN : Boolean := True;
-- unspecified
Reserved_8_31 : HAL.UInt24 := 16#0#;
end record
with Volatile_Full_Access, Object_Size => 32,
Bit_Order => System.Low_Order_First;
for AHB2SMENR_Register use record
GPIOASMEN at 0 range 0 .. 0;
GPIOBSMEN at 0 range 1 .. 1;
GPIOCSMEN at 0 range 2 .. 2;
Reserved_3_6 at 0 range 3 .. 6;
GPIOHSMEN at 0 range 7 .. 7;
Reserved_8_31 at 0 range 8 .. 31;
end record;
-- AHB3 peripheral clocks enable in Sleep and Stop modes register
type AHB3SMENR_Register is record
-- unspecified
Reserved_0_15 : HAL.UInt16 := 16#0#;
-- PKA accelerator clock enable during CPU1 CSleep mode.
PKASMEN : Boolean := True;
-- AES accelerator clock enable during CPU1 CSleep mode.
AESSMEN : Boolean := True;
-- True RNG clocks enable during CPU1 Csleep and CStop modes
RNGSMEN : Boolean := True;
-- unspecified
Reserved_19_22 : HAL.UInt4 := 16#0#;
-- SRAM1 interface clock enable during CPU1 CSleep mode.
SRAM1SMEN : Boolean := True;
-- SRAM2 memory interface clock enable during CPU1 CSleep mode
SRAM2SMEN : Boolean := True;
-- Flash interface clock enable during CPU1 CSleep mode.
FLASHSMEN : Boolean := True;
-- unspecified
Reserved_26_31 : HAL.UInt6 := 16#0#;
end record
with Volatile_Full_Access, Object_Size => 32,
Bit_Order => System.Low_Order_First;
for AHB3SMENR_Register use record
Reserved_0_15 at 0 range 0 .. 15;
PKASMEN at 0 range 16 .. 16;
AESSMEN at 0 range 17 .. 17;
RNGSMEN at 0 range 18 .. 18;
Reserved_19_22 at 0 range 19 .. 22;
SRAM1SMEN at 0 range 23 .. 23;
SRAM2SMEN at 0 range 24 .. 24;
FLASHSMEN at 0 range 25 .. 25;
Reserved_26_31 at 0 range 26 .. 31;
end record;
-- APB1 peripheral clocks enable in Sleep mode register 1
type APB1SMENR1_Register is record
-- TIM2 timer clock enable during CPU1 CSleep mode.
TIM2SMEN : Boolean := True;
-- unspecified
Reserved_1_9 : HAL.UInt9 := 16#0#;
-- RTC bus clock enable during CPU1 CSleep mode.
RTCAPBSMEN : Boolean := True;
-- Window watchdog clocks enable during CPU1 CSleep mode.
WWDGSMEN : Boolean := True;
-- unspecified
Reserved_12_13 : HAL.UInt2 := 16#0#;
-- SPI2S2 clock enable during CPU1 CSleep mode.
SPI2S2SMEN : Boolean := True;
-- unspecified
Reserved_15_16 : HAL.UInt2 := 16#0#;
-- USART2 clock enable during CPU1 CSleep mode.
USART2SMEN : Boolean := True;
-- unspecified
Reserved_18_20 : HAL.UInt3 := 16#0#;
-- I2C1 clock enable during CPU1 Csleep and CStop modes
I2C1SMEN : Boolean := True;
-- I2C2 clock enable during CPU1 Csleep and CStop modes
I2C2SMEN : Boolean := True;
-- I2C3 clock enable during CPU1 Csleep and CStop modes
I2C3SMEN : Boolean := True;
-- unspecified
Reserved_24_28 : HAL.UInt5 := 16#0#;
-- DAC1 clock enable during CPU1 CSleep mode.
DACSMEN : Boolean := True;
-- unspecified
Reserved_30_30 : HAL.Bit := 16#0#;
-- Low power timer 1 clock enable during CPU1 Csleep and CStop mode
LPTIM1SMEN : Boolean := True;
end record
with Volatile_Full_Access, Object_Size => 32,
Bit_Order => System.Low_Order_First;
for APB1SMENR1_Register use record
TIM2SMEN at 0 range 0 .. 0;
Reserved_1_9 at 0 range 1 .. 9;
RTCAPBSMEN at 0 range 10 .. 10;
WWDGSMEN at 0 range 11 .. 11;
Reserved_12_13 at 0 range 12 .. 13;
SPI2S2SMEN at 0 range 14 .. 14;
Reserved_15_16 at 0 range 15 .. 16;
USART2SMEN at 0 range 17 .. 17;
Reserved_18_20 at 0 range 18 .. 20;
I2C1SMEN at 0 range 21 .. 21;
I2C2SMEN at 0 range 22 .. 22;
I2C3SMEN at 0 range 23 .. 23;
Reserved_24_28 at 0 range 24 .. 28;
DACSMEN at 0 range 29 .. 29;
Reserved_30_30 at 0 range 30 .. 30;
LPTIM1SMEN at 0 range 31 .. 31;
end record;
-- APB1 peripheral clocks enable in Sleep mode register 2
type APB1SMENR2_Register is record
-- Low power UART 1 clock enable during CPU1 Csleep and CStop modes.
LPUART1SMEN : Boolean := True;
-- unspecified
Reserved_1_4 : HAL.UInt4 := 16#0#;
-- Low power timer 2 clock enable during CPU1 Csleep and CStop modes
LPTIM2SMEN : Boolean := True;
-- Low power timer 3 clock enable during CPU1 Csleep and CStop modes
LPTIM3SMEN : Boolean := True;
-- unspecified
Reserved_7_31 : HAL.UInt25 := 16#0#;
end record
with Volatile_Full_Access, Object_Size => 32,
Bit_Order => System.Low_Order_First;
for APB1SMENR2_Register use record
LPUART1SMEN at 0 range 0 .. 0;
Reserved_1_4 at 0 range 1 .. 4;
LPTIM2SMEN at 0 range 5 .. 5;
LPTIM3SMEN at 0 range 6 .. 6;
Reserved_7_31 at 0 range 7 .. 31;
end record;
-- APB2 peripheral clocks enable in Sleep mode register
type APB2SMENR_Register is record
-- unspecified
Reserved_0_8 : HAL.UInt9 := 16#0#;
-- ADC clocks enable during CPU1 Csleep and CStop modes
ADCSMEN : Boolean := True;
-- unspecified
Reserved_10_10 : HAL.Bit := 16#0#;
-- TIM1 timer clock enable during CPU1 CSleep mode.
TIM1SMEN : Boolean := True;
-- SPI1 clock enable during CPU1 CSleep mode.
SPI1SMEN : Boolean := True;
-- unspecified
Reserved_13_13 : HAL.Bit := 16#0#;
-- USART1 clock enable during CPU1 Csleep and CStop modes.
USART1SMEN : Boolean := True;
-- unspecified
Reserved_15_16 : HAL.UInt2 := 16#0#;
-- TIM16 timer clock enable during CPU1 CSleep mode.
TIM16SMEN : Boolean := True;
-- TIM17 timer clock enable during CPU1 CSleep mode.
TIM17SMEN : Boolean := True;
-- unspecified
Reserved_19_31 : HAL.UInt13 := 16#0#;
end record
with Volatile_Full_Access, Object_Size => 32,
Bit_Order => System.Low_Order_First;
for APB2SMENR_Register use record
Reserved_0_8 at 0 range 0 .. 8;
ADCSMEN at 0 range 9 .. 9;
Reserved_10_10 at 0 range 10 .. 10;
TIM1SMEN at 0 range 11 .. 11;
SPI1SMEN at 0 range 12 .. 12;
Reserved_13_13 at 0 range 13 .. 13;
USART1SMEN at 0 range 14 .. 14;
Reserved_15_16 at 0 range 15 .. 16;
TIM16SMEN at 0 range 17 .. 17;
TIM17SMEN at 0 range 18 .. 18;
Reserved_19_31 at 0 range 19 .. 31;
end record;
-- APB3 peripheral clock enable in Sleep mode register
type APB3SMENR_Register is record
-- Sub-GHz radio SPI clock enable during Sleep and Stop modes
SUBGHZSPISMEN : Boolean := True;
-- unspecified
Reserved_1_31 : HAL.UInt31 := 16#0#;
end record
with Volatile_Full_Access, Object_Size => 32,
Bit_Order => System.Low_Order_First;
for APB3SMENR_Register use record
SUBGHZSPISMEN at 0 range 0 .. 0;
Reserved_1_31 at 0 range 1 .. 31;
end record;
subtype CCIPR_USART1SEL_Field is HAL.UInt2;
subtype CCIPR_USART2SEL_Field is HAL.UInt2;
subtype CCIPR_SPI2S2SEL_Field is HAL.UInt2;
subtype CCIPR_LPUART1SEL_Field is HAL.UInt2;
subtype CCIPR_I2C1SEL_Field is HAL.UInt2;
subtype CCIPR_I2C2SEL_Field is HAL.UInt2;
subtype CCIPR_I2C3SEL_Field is HAL.UInt2;
subtype CCIPR_LPTIM1SEL_Field is HAL.UInt2;
subtype CCIPR_LPTIM2SEL_Field is HAL.UInt2;
subtype CCIPR_LPTIM3SEL_Field is HAL.UInt2;
subtype CCIPR_ADCSEL_Field is HAL.UInt2;
subtype CCIPR_RNGSEL_Field is HAL.UInt2;
-- Peripherals independent clock configuration register
type CCIPR_Register is record
-- USART1 clock source selection
USART1SEL : CCIPR_USART1SEL_Field := 16#0#;
-- USART2 clock source selection
USART2SEL : CCIPR_USART2SEL_Field := 16#0#;
-- unspecified
Reserved_4_7 : HAL.UInt4 := 16#0#;
-- SPI2S2 I2S clock source selection
SPI2S2SEL : CCIPR_SPI2S2SEL_Field := 16#0#;
-- LPUART1 clock source selection
LPUART1SEL : CCIPR_LPUART1SEL_Field := 16#0#;
-- I2C1 clock source selection
I2C1SEL : CCIPR_I2C1SEL_Field := 16#0#;
-- I2C2 clock source selection
I2C2SEL : CCIPR_I2C2SEL_Field := 16#0#;
-- I2C3 clock source selection
I2C3SEL : CCIPR_I2C3SEL_Field := 16#0#;
-- Low power timer 1 clock source selection
LPTIM1SEL : CCIPR_LPTIM1SEL_Field := 16#0#;
-- Low power timer 2 clock source selection
LPTIM2SEL : CCIPR_LPTIM2SEL_Field := 16#0#;
-- Low power timer 3 clock source selection
LPTIM3SEL : CCIPR_LPTIM3SEL_Field := 16#0#;
-- unspecified
Reserved_24_27 : HAL.UInt4 := 16#0#;
-- ADC clock source selection
ADCSEL : CCIPR_ADCSEL_Field := 16#0#;
-- RNG clock source selection
RNGSEL : CCIPR_RNGSEL_Field := 16#0#;
end record
with Volatile_Full_Access, Object_Size => 32,
Bit_Order => System.Low_Order_First;
for CCIPR_Register use record
USART1SEL at 0 range 0 .. 1;
USART2SEL at 0 range 2 .. 3;
Reserved_4_7 at 0 range 4 .. 7;
SPI2S2SEL at 0 range 8 .. 9;
LPUART1SEL at 0 range 10 .. 11;
I2C1SEL at 0 range 12 .. 13;
I2C2SEL at 0 range 14 .. 15;
I2C3SEL at 0 range 16 .. 17;
LPTIM1SEL at 0 range 18 .. 19;
LPTIM2SEL at 0 range 20 .. 21;
LPTIM3SEL at 0 range 22 .. 23;
Reserved_24_27 at 0 range 24 .. 27;
ADCSEL at 0 range 28 .. 29;
RNGSEL at 0 range 30 .. 31;
end record;
subtype BDCR_LSEDRV_Field is HAL.UInt2;
subtype BDCR_RTCSEL_Field is HAL.UInt2;
-- Backup domain control register
type BDCR_Register is record
-- LSE oscillator enable
LSEON : Boolean := False;
-- Read-only. LSE oscillator ready
LSERDY : Boolean := False;
-- LSE oscillator bypass
LSEBYP : Boolean := False;
-- LSE oscillator drive capability
LSEDRV : BDCR_LSEDRV_Field := 16#0#;
-- CSS on LSE enable
LSECSSON : Boolean := False;
-- Read-only. CSS on LSE failure Detection
LSECSSD : Boolean := False;
-- LSE system clock enable
LSESYSEN : Boolean := False;
-- RTC clock source selection
RTCSEL : BDCR_RTCSEL_Field := 16#0#;
-- unspecified
Reserved_10_10 : HAL.Bit := 16#0#;
-- Read-only. LSE system clock ready
LSESYSRDY : Boolean := False;
-- unspecified
Reserved_12_14 : HAL.UInt3 := 16#0#;
-- RTC clock enable
RTCEN : Boolean := False;
-- Backup domain software reset
BDRST : Boolean := False;
-- unspecified
Reserved_17_23 : HAL.UInt7 := 16#0#;
-- Low speed clock output enable
LSCOEN : Boolean := False;
-- Low speed clock output selection
LSCOSEL : Boolean := False;
-- unspecified
Reserved_26_31 : HAL.UInt6 := 16#0#;
end record
with Volatile_Full_Access, Object_Size => 32,
Bit_Order => System.Low_Order_First;
for BDCR_Register use record
LSEON at 0 range 0 .. 0;
LSERDY at 0 range 1 .. 1;
LSEBYP at 0 range 2 .. 2;
LSEDRV at 0 range 3 .. 4;
LSECSSON at 0 range 5 .. 5;
LSECSSD at 0 range 6 .. 6;
LSESYSEN at 0 range 7 .. 7;
RTCSEL at 0 range 8 .. 9;
Reserved_10_10 at 0 range 10 .. 10;
LSESYSRDY at 0 range 11 .. 11;
Reserved_12_14 at 0 range 12 .. 14;
RTCEN at 0 range 15 .. 15;
BDRST at 0 range 16 .. 16;
Reserved_17_23 at 0 range 17 .. 23;
LSCOEN at 0 range 24 .. 24;
LSCOSEL at 0 range 25 .. 25;
Reserved_26_31 at 0 range 26 .. 31;
end record;
subtype CSR_MSISRANGE_Field is HAL.UInt4;
-- Control/status register
type CSR_Register is record
-- LSI oscillator enable
LSION : Boolean := False;
-- Read-only. LSI oscillator ready
LSIRDY : Boolean := False;
-- unspecified
Reserved_2_3 : HAL.UInt2 := 16#0#;
-- LSI frequency prescaler
LSIPRE : Boolean := False;
-- unspecified
Reserved_5_7 : HAL.UInt3 := 16#0#;
-- MSI clock ranges
MSISRANGE : CSR_MSISRANGE_Field := 16#6#;
-- unspecified
Reserved_12_13 : HAL.UInt2 := 16#0#;
-- Read-only. Radio in reset status flag
RFRSTF : Boolean := True;
-- Radio reset
RFRST : Boolean := True;
-- unspecified
Reserved_16_22 : HAL.UInt7 := 16#1#;
-- Remove reset flag
RMVF : Boolean := False;
-- Read-only. Radio illegal access flag
RFILARSTF : Boolean := False;
-- Read-only. Option byte loader reset flag
OBLRSTF : Boolean := False;
-- Read-only. Pin reset flag
PINRSTF : Boolean := True;
-- Read-only. BOR flag
BORRSTF : Boolean := True;
-- Read-only. Software reset flag
SFTRSTF : Boolean := False;
-- Read-only. Independent window watchdog reset flag
IWDGRSTF : Boolean := False;
-- Read-only. Window watchdog reset flag
WWDGRSTF : Boolean := False;
-- Read-only. Low-power reset flag
LPWRRSTF : Boolean := False;
end record
with Volatile_Full_Access, Object_Size => 32,
Bit_Order => System.Low_Order_First;
for CSR_Register use record
LSION at 0 range 0 .. 0;
LSIRDY at 0 range 1 .. 1;
Reserved_2_3 at 0 range 2 .. 3;
LSIPRE at 0 range 4 .. 4;
Reserved_5_7 at 0 range 5 .. 7;
MSISRANGE at 0 range 8 .. 11;
Reserved_12_13 at 0 range 12 .. 13;
RFRSTF at 0 range 14 .. 14;
RFRST at 0 range 15 .. 15;
Reserved_16_22 at 0 range 16 .. 22;
RMVF at 0 range 23 .. 23;
RFILARSTF at 0 range 24 .. 24;
OBLRSTF at 0 range 25 .. 25;
PINRSTF at 0 range 26 .. 26;
BORRSTF 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;
subtype EXTCFGR_SHDHPRE_Field is HAL.UInt4;
subtype EXTCFGR_C2HPRE_Field is HAL.UInt4;
-- Extended clock recovery register
type EXTCFGR_Register is record
-- HCLK3 shared prescaler (AHB3, Flash, and SRAM2)
SHDHPRE : EXTCFGR_SHDHPRE_Field := 16#0#;
-- [dual core device only] HCLK2 prescaler (CPU2)
C2HPRE : EXTCFGR_C2HPRE_Field := 16#0#;
-- unspecified
Reserved_8_15 : HAL.UInt8 := 16#0#;
-- Read-only. HCLK3 shared prescaler flag (AHB3, Flash, and SRAM2)
SHDHPREF : Boolean := True;
-- Read-only. CLK2 prescaler flag (CPU2)
C2HPREF : Boolean := True;
-- unspecified
Reserved_18_31 : HAL.UInt14 := 16#0#;
end record
with Volatile_Full_Access, Object_Size => 32,
Bit_Order => System.Low_Order_First;
for EXTCFGR_Register use record
SHDHPRE at 0 range 0 .. 3;
C2HPRE at 0 range 4 .. 7;
Reserved_8_15 at 0 range 8 .. 15;
SHDHPREF at 0 range 16 .. 16;
C2HPREF at 0 range 17 .. 17;
Reserved_18_31 at 0 range 18 .. 31;
end record;
-- CPU2 AHB1 peripheral clock enable register
type C2AHB1ENR_Register is record
-- CPU2 DMA1 clock enable
DMA1EN : Boolean := False;
-- CPU2 DMA2 clock enable
DMA2EN : Boolean := False;
-- CPU2 DMAMUX1 clock enable
DMAMUX1EN : Boolean := False;
-- unspecified
Reserved_3_11 : HAL.UInt9 := 16#0#;
-- CPU2 CRC clock enable
CRCEN : Boolean := False;
-- unspecified
Reserved_13_31 : HAL.UInt19 := 16#0#;
end record
with Volatile_Full_Access, Object_Size => 32,
Bit_Order => System.Low_Order_First;
for C2AHB1ENR_Register use record
DMA1EN at 0 range 0 .. 0;
DMA2EN at 0 range 1 .. 1;
DMAMUX1EN at 0 range 2 .. 2;
Reserved_3_11 at 0 range 3 .. 11;
CRCEN at 0 range 12 .. 12;
Reserved_13_31 at 0 range 13 .. 31;
end record;
-- CPU2 AHB2 peripheral clock enable register
type C2AHB2ENR_Register is record
-- CPU2 IO port A clock enable
GPIOAEN : Boolean := False;
-- CPU2 IO port B clock enable
GPIOBEN : Boolean := False;
-- CPU2 IO port C clock enable
GPIOCEN : Boolean := False;
-- unspecified
Reserved_3_6 : HAL.UInt4 := 16#0#;
-- CPU2 IO port H clock enable
GPIOHEN : Boolean := False;
-- unspecified
Reserved_8_31 : HAL.UInt24 := 16#0#;
end record
with Volatile_Full_Access, Object_Size => 32,
Bit_Order => System.Low_Order_First;
for C2AHB2ENR_Register use record
GPIOAEN at 0 range 0 .. 0;
GPIOBEN at 0 range 1 .. 1;
GPIOCEN at 0 range 2 .. 2;
Reserved_3_6 at 0 range 3 .. 6;
GPIOHEN at 0 range 7 .. 7;
Reserved_8_31 at 0 range 8 .. 31;
end record;
-- CPU2 AHB3 peripheral clock enable register [dual core device only]
type C2AHB3ENR_Register is record
-- unspecified
Reserved_0_15 : HAL.UInt16 := 16#0#;
-- CPU2 PKA accelerator clock enable
PKAEN : Boolean := False;
-- CPU2 AES accelerator clock enable
AESEN : Boolean := False;
-- CPU2 True RNG clocks enable
RNGEN : Boolean := False;
-- CPU2 HSEM clock enable
HSEMEN : Boolean := True;
-- CPU2 IPCC interface clock enable
IPCCEN : Boolean := False;
-- unspecified
Reserved_21_24 : HAL.UInt4 := 16#0#;
-- CPU2 Flash interface clock enable
FLASHEN : Boolean := True;
-- unspecified
Reserved_26_31 : HAL.UInt6 := 16#0#;
end record
with Volatile_Full_Access, Object_Size => 32,
Bit_Order => System.Low_Order_First;
for C2AHB3ENR_Register use record
Reserved_0_15 at 0 range 0 .. 15;
PKAEN at 0 range 16 .. 16;
AESEN at 0 range 17 .. 17;
RNGEN at 0 range 18 .. 18;
HSEMEN at 0 range 19 .. 19;
IPCCEN at 0 range 20 .. 20;
Reserved_21_24 at 0 range 21 .. 24;
FLASHEN at 0 range 25 .. 25;
Reserved_26_31 at 0 range 26 .. 31;
end record;
-- CPU2 APB1 peripheral clock enable register 1 [dual core device only]
type C2APB1ENR1_Register is record
-- CPU2 TIM2 timer clock enable
TIM2EN : Boolean := False;
-- unspecified
Reserved_1_9 : HAL.UInt9 := 16#0#;
-- CPU2 RTC APB clock enable
RTCAPBEN : Boolean := False;
-- unspecified
Reserved_11_13 : HAL.UInt3 := 16#0#;
-- CPU2 SPI2S2 clock enable
SPI2S2EN : Boolean := False;
-- unspecified
Reserved_15_16 : HAL.UInt2 := 16#0#;
-- CPU2 USART2 clock enable
USART2EN : Boolean := False;
-- unspecified
Reserved_18_20 : HAL.UInt3 := 16#0#;
-- CPU2 I2C1 clocks enable
I2C1EN : Boolean := False;
-- CPU2 I2C2 clocks enable
I2C2EN : Boolean := False;
-- CPU2 I2C3 clocks enable
I2C3EN : Boolean := False;
-- unspecified
Reserved_24_28 : HAL.UInt5 := 16#0#;
-- CPU2 DAC1 clock enable
DAC1EN : Boolean := False;
-- unspecified
Reserved_30_30 : HAL.Bit := 16#0#;
-- CPU2 Low power timer 1 clocks enable
LPTIM1EN : Boolean := False;
end record
with Volatile_Full_Access, Object_Size => 32,
Bit_Order => System.Low_Order_First;
for C2APB1ENR1_Register use record
TIM2EN at 0 range 0 .. 0;
Reserved_1_9 at 0 range 1 .. 9;
RTCAPBEN at 0 range 10 .. 10;
Reserved_11_13 at 0 range 11 .. 13;
SPI2S2EN at 0 range 14 .. 14;
Reserved_15_16 at 0 range 15 .. 16;
USART2EN at 0 range 17 .. 17;
Reserved_18_20 at 0 range 18 .. 20;
I2C1EN at 0 range 21 .. 21;
I2C2EN at 0 range 22 .. 22;
I2C3EN at 0 range 23 .. 23;
Reserved_24_28 at 0 range 24 .. 28;
DAC1EN at 0 range 29 .. 29;
Reserved_30_30 at 0 range 30 .. 30;
LPTIM1EN at 0 range 31 .. 31;
end record;
-- CPU2 APB1 peripheral clock enable register 2 [dual core device only]
type C2APB1ENR2_Register is record
-- CPU2 Low power UART 1 clocks enable
LPUART1EN : Boolean := False;
-- unspecified
Reserved_1_4 : HAL.UInt4 := 16#0#;
-- CPU2 Low power timer 2 clocks enable
LPTIM2EN : Boolean := False;
-- CPU2 Low power timer 3 clocks enable
LPTIM3EN : Boolean := False;
-- unspecified
Reserved_7_31 : HAL.UInt25 := 16#0#;
end record
with Volatile_Full_Access, Object_Size => 32,
Bit_Order => System.Low_Order_First;
for C2APB1ENR2_Register use record
LPUART1EN at 0 range 0 .. 0;
Reserved_1_4 at 0 range 1 .. 4;
LPTIM2EN at 0 range 5 .. 5;
LPTIM3EN at 0 range 6 .. 6;
Reserved_7_31 at 0 range 7 .. 31;
end record;
-- CPU2 APB2 peripheral clock enable register [dual core device only]
type C2APB2ENR_Register is record
-- unspecified
Reserved_0_8 : HAL.UInt9 := 16#0#;
-- ADC clocks enable
ADCEN : Boolean := False;
-- unspecified
Reserved_10_10 : HAL.Bit := 16#0#;
-- CPU2 TIM1 timer clock enable
TIM1EN : Boolean := False;
-- CPU2 SPI1 clock enable
SPI1EN : Boolean := False;
-- unspecified
Reserved_13_13 : HAL.Bit := 16#0#;
-- CPU2 USART1clocks enable
USART1EN : Boolean := False;
-- unspecified
Reserved_15_16 : HAL.UInt2 := 16#0#;
-- CPU2 TIM16 timer clock enable
TIM16EN : Boolean := False;
-- CPU2 TIM17 timer clock enable
TIM17EN : Boolean := False;
-- unspecified
Reserved_19_31 : HAL.UInt13 := 16#0#;
end record
with Volatile_Full_Access, Object_Size => 32,
Bit_Order => System.Low_Order_First;
for C2APB2ENR_Register use record
Reserved_0_8 at 0 range 0 .. 8;
ADCEN at 0 range 9 .. 9;
Reserved_10_10 at 0 range 10 .. 10;
TIM1EN at 0 range 11 .. 11;
SPI1EN at 0 range 12 .. 12;
Reserved_13_13 at 0 range 13 .. 13;
USART1EN at 0 range 14 .. 14;
Reserved_15_16 at 0 range 15 .. 16;
TIM16EN at 0 range 17 .. 17;
TIM17EN at 0 range 18 .. 18;
Reserved_19_31 at 0 range 19 .. 31;
end record;
-- CPU2 APB3 peripheral clock enable register [dual core device only]
type C2APB3ENR_Register is record
-- CPU2 sub-GHz radio SPI clock enable
SUBGHZSPIEN : Boolean := False;
-- unspecified
Reserved_1_31 : HAL.UInt31 := 16#0#;
end record
with Volatile_Full_Access, Object_Size => 32,
Bit_Order => System.Low_Order_First;
for C2APB3ENR_Register use record
SUBGHZSPIEN at 0 range 0 .. 0;
Reserved_1_31 at 0 range 1 .. 31;
end record;
-- CPU2 AHB1 peripheral clocks enable in Sleep modes register [dual core
-- device only]
type C2AHB1SMENR_Register is record
-- DMA1 clock enable during CPU2 CSleep mode.
DMA1SMEN : Boolean := True;
-- DMA2 clock enable during CPU2 CSleep mode.
DMA2SMEN : Boolean := True;
-- DMAMUX1 clock enable during CPU2 CSleep mode.
DMAMUX1SMEN : Boolean := True;
-- unspecified
Reserved_3_11 : HAL.UInt9 := 16#0#;
-- CRC clock enable during CPU2 CSleep mode.
CRCSMEN : Boolean := True;
-- unspecified
Reserved_13_31 : HAL.UInt19 := 16#0#;
end record
with Volatile_Full_Access, Object_Size => 32,
Bit_Order => System.Low_Order_First;
for C2AHB1SMENR_Register use record
DMA1SMEN at 0 range 0 .. 0;
DMA2SMEN at 0 range 1 .. 1;
DMAMUX1SMEN at 0 range 2 .. 2;
Reserved_3_11 at 0 range 3 .. 11;
CRCSMEN at 0 range 12 .. 12;
Reserved_13_31 at 0 range 13 .. 31;
end record;
-- CPU2 AHB2 peripheral clocks enable in Sleep modes register [dual core
-- device only]
type C2AHB2SMENR_Register is record
-- IO port A clock enable during CPU2 CSleep mode.
GPIOASMEN : Boolean := True;
-- IO port B clock enable during CPU2 CSleep mode.
GPIOBSMEN : Boolean := True;
-- IO port C clock enable during CPU2 CSleep mode.
GPIOCSMEN : Boolean := True;
-- unspecified
Reserved_3_6 : HAL.UInt4 := 16#0#;
-- IO port H clock enable during CPU2 CSleep mode.
GPIOHSMEN : Boolean := True;
-- unspecified
Reserved_8_31 : HAL.UInt24 := 16#0#;
end record
with Volatile_Full_Access, Object_Size => 32,
Bit_Order => System.Low_Order_First;
for C2AHB2SMENR_Register use record
GPIOASMEN at 0 range 0 .. 0;
GPIOBSMEN at 0 range 1 .. 1;
GPIOCSMEN at 0 range 2 .. 2;
Reserved_3_6 at 0 range 3 .. 6;
GPIOHSMEN at 0 range 7 .. 7;
Reserved_8_31 at 0 range 8 .. 31;
end record;
-- CPU2 AHB3 peripheral clocks enable in Sleep mode register [dual core
-- device only]
type C2AHB3SMENR_Register is record
-- unspecified
Reserved_0_15 : HAL.UInt16 := 16#0#;
-- PKA accelerator clock enable during CPU2 CSleep mode.
PKASMEN : Boolean := True;
-- AES accelerator clock enable during CPU2 CSleep mode.
AESSMEN : Boolean := True;
-- True RNG clock enable during CPU2 CSleep and CStop mode.
RNGSMEN : Boolean := True;
-- unspecified
Reserved_19_22 : HAL.UInt4 := 16#0#;
-- SRAM1 interface clock enable during CPU2 CSleep mode.
SRAM1SMEN : Boolean := True;
-- SRAM2 memory interface clock enable during CPU2 CSleep mode.
SRAM2SMEN : Boolean := True;
-- Flash interface clock enable during CPU2 CSleep mode.
FLASHSMEN : Boolean := True;
-- unspecified
Reserved_26_31 : HAL.UInt6 := 16#0#;
end record
with Volatile_Full_Access, Object_Size => 32,
Bit_Order => System.Low_Order_First;
for C2AHB3SMENR_Register use record
Reserved_0_15 at 0 range 0 .. 15;
PKASMEN at 0 range 16 .. 16;
AESSMEN at 0 range 17 .. 17;
RNGSMEN at 0 range 18 .. 18;
Reserved_19_22 at 0 range 19 .. 22;
SRAM1SMEN at 0 range 23 .. 23;
SRAM2SMEN at 0 range 24 .. 24;
FLASHSMEN at 0 range 25 .. 25;
Reserved_26_31 at 0 range 26 .. 31;
end record;
-- CPU2 APB1 peripheral clocks enable in Sleep mode register 1 [dual core
-- device only]
type C2APB1SMENR1_Register is record
-- TIM2 timer clock enable during CPU2 CSleep mode.
TIM2SMEN : Boolean := True;
-- unspecified
Reserved_1_9 : HAL.UInt9 := 16#0#;
-- RTC bus clock enable during CPU2 CSleep mode.
RTCAPBSMEN : Boolean := True;
-- unspecified
Reserved_11_13 : HAL.UInt3 := 16#0#;
-- SPI2S2 clock enable during CPU2 CSleep mode.
SPI2S2SMEN : Boolean := True;
-- unspecified
Reserved_15_16 : HAL.UInt2 := 16#0#;
-- USART2 clock enable during CPU2 CSleep mode.
USART2SMEN : Boolean := True;
-- unspecified
Reserved_18_20 : HAL.UInt3 := 16#0#;
-- I2C1 clock enable during CPU2 CSleep and CStop modes
I2C1SMEN : Boolean := True;
-- I2C2 clock enable during CPU2 CSleep and CStop modes
I2C2SMEN : Boolean := True;
-- I2C3 clock enable during CPU2 CSleep and CStop modes
I2C3SMEN : Boolean := True;
-- unspecified
Reserved_24_28 : HAL.UInt5 := 16#0#;
-- DAC1 clock enable during CPU2 CSleep mode.
DAC1SMEN : Boolean := True;
-- unspecified
Reserved_30_30 : HAL.Bit := 16#0#;
-- Low power timer 1 clock enable during CPU2 CSleep and CStop mode
LPTIM1SMEN : Boolean := True;
end record
with Volatile_Full_Access, Object_Size => 32,
Bit_Order => System.Low_Order_First;
for C2APB1SMENR1_Register use record
TIM2SMEN at 0 range 0 .. 0;
Reserved_1_9 at 0 range 1 .. 9;
RTCAPBSMEN at 0 range 10 .. 10;
Reserved_11_13 at 0 range 11 .. 13;
SPI2S2SMEN at 0 range 14 .. 14;
Reserved_15_16 at 0 range 15 .. 16;
USART2SMEN at 0 range 17 .. 17;
Reserved_18_20 at 0 range 18 .. 20;
I2C1SMEN at 0 range 21 .. 21;
I2C2SMEN at 0 range 22 .. 22;
I2C3SMEN at 0 range 23 .. 23;
Reserved_24_28 at 0 range 24 .. 28;
DAC1SMEN at 0 range 29 .. 29;
Reserved_30_30 at 0 range 30 .. 30;
LPTIM1SMEN at 0 range 31 .. 31;
end record;
-- CPU2 APB1 peripheral clocks enable in Sleep mode register 2 [dual core
-- device only]
type C2APB1SMENR2_Register is record
-- Low power UART 1 clock enable during CPU2 CSleep and CStop mode
LPUART1SMEN : Boolean := True;
-- unspecified
Reserved_1_4 : HAL.UInt4 := 16#0#;
-- Low power timer 2 clocks enable during CPU2 CSleep and CStop modes.
LPTIM2SMEN : Boolean := True;
-- Low power timer 3 clocks enable during CPU2 CSleep and CStop modes.
LPTIM3SMEN : Boolean := True;
-- unspecified
Reserved_7_31 : HAL.UInt25 := 16#0#;
end record
with Volatile_Full_Access, Object_Size => 32,
Bit_Order => System.Low_Order_First;
for C2APB1SMENR2_Register use record
LPUART1SMEN at 0 range 0 .. 0;
Reserved_1_4 at 0 range 1 .. 4;
LPTIM2SMEN at 0 range 5 .. 5;
LPTIM3SMEN at 0 range 6 .. 6;
Reserved_7_31 at 0 range 7 .. 31;
end record;
-- CPU2 APB2 peripheral clocks enable in Sleep mode register [dual core
-- device only]
type C2APB2SMENR_Register is record
-- unspecified
Reserved_0_8 : HAL.UInt9 := 16#0#;
-- ADC clocks enable during CPU2 Csleep and CStop modes
ADCSMEN : Boolean := True;
-- unspecified
Reserved_10_10 : HAL.Bit := 16#0#;
-- TIM1 timer clock enable during CPU2 CSleep mode
TIM1SMEN : Boolean := True;
-- SPI1 clock enable during CPU2 CSleep mode
SPI1SMEN : Boolean := True;
-- unspecified
Reserved_13_13 : HAL.Bit := 16#0#;
-- USART1clock enable during CPU2 CSleep and CStop mode
USART1SMEN : Boolean := True;
-- unspecified
Reserved_15_16 : HAL.UInt2 := 16#0#;
-- TIM16 timer clock enable during CPU2 CSleep mode
TIM16SMEN : Boolean := True;
-- TIM17 timer clock enable during CPU2 CSleep mode
TIM17SMEN : Boolean := True;
-- unspecified
Reserved_19_31 : HAL.UInt13 := 16#0#;
end record
with Volatile_Full_Access, Object_Size => 32,
Bit_Order => System.Low_Order_First;
for C2APB2SMENR_Register use record
Reserved_0_8 at 0 range 0 .. 8;
ADCSMEN at 0 range 9 .. 9;
Reserved_10_10 at 0 range 10 .. 10;
TIM1SMEN at 0 range 11 .. 11;
SPI1SMEN at 0 range 12 .. 12;
Reserved_13_13 at 0 range 13 .. 13;
USART1SMEN at 0 range 14 .. 14;
Reserved_15_16 at 0 range 15 .. 16;
TIM16SMEN at 0 range 17 .. 17;
TIM17SMEN at 0 range 18 .. 18;
Reserved_19_31 at 0 range 19 .. 31;
end record;
-- CPU2 APB3 peripheral clock enable in Sleep mode register [dual core
-- device only]
type C2APB3SMENR_Register is record
-- sub-GHz radio SPI clock enable during CPU2 CSleep and CStop modes
SUBGHZSPISMEN : Boolean := True;
-- unspecified
Reserved_1_31 : HAL.UInt31 := 16#0#;
end record
with Volatile_Full_Access, Object_Size => 32,
Bit_Order => System.Low_Order_First;
for C2APB3SMENR_Register use record
SUBGHZSPISMEN at 0 range 0 .. 0;
Reserved_1_31 at 0 range 1 .. 31;
end record;
-----------------
-- Peripherals --
-----------------
-- Reset and clock control
type RCC_Peripheral is record
-- Clock control register
CR : aliased CR_Register;
-- Internal clock sources calibration register
ICSCR : aliased ICSCR_Register;
-- Clock configuration register
CFGR : aliased CFGR_Register;
-- PLL configuration register
PLLCFGR : aliased PLLCFGR_Register;
-- Clock interrupt enable register
CIER : aliased CIER_Register;
-- Clock interrupt flag register
CIFR : aliased CIFR_Register;
-- Clock interrupt clear register
CICR : aliased CICR_Register;
-- AHB1 peripheral reset register
AHB1RSTR : aliased AHB1RSTR_Register;
-- AHB2 peripheral reset register
AHB2RSTR : aliased AHB2RSTR_Register;
-- AHB3 peripheral reset register
AHB3RSTR : aliased AHB3RSTR_Register;
-- APB1 peripheral reset register 1
APB1RSTR1 : aliased APB1RSTR1_Register;
-- APB1 peripheral reset register 2
APB1RSTR2 : aliased APB1RSTR2_Register;
-- APB2 peripheral reset register
APB2RSTR : aliased APB2RSTR_Register;
-- APB3 peripheral reset register
APB3RSTR : aliased APB3RSTR_Register;
-- AHB1 peripheral clock enable register
AHB1ENR : aliased AHB1ENR_Register;
-- AHB2 peripheral clock enable register
AHB2ENR : aliased AHB2ENR_Register;
-- AHB3 peripheral clock enable register
AHB3ENR : aliased AHB3ENR_Register;
-- APB1 peripheral clock enable register 1
APB1ENR1 : aliased APB1ENR1_Register;
-- APB1 peripheral clock enable register 2
APB1ENR2 : aliased APB1ENR2_Register;
-- APB2 peripheral clock enable register
APB2ENR : aliased APB2ENR_Register;
-- APB3 peripheral clock enable register
APB3ENR : aliased APB3ENR_Register;
-- AHB1 peripheral clocks enable in Sleep modes register
AHB1SMENR : aliased AHB1SMENR_Register;
-- AHB2 peripheral clocks enable in Sleep modes register
AHB2SMENR : aliased AHB2SMENR_Register;
-- AHB3 peripheral clocks enable in Sleep and Stop modes register
AHB3SMENR : aliased AHB3SMENR_Register;
-- APB1 peripheral clocks enable in Sleep mode register 1
APB1SMENR1 : aliased APB1SMENR1_Register;
-- APB1 peripheral clocks enable in Sleep mode register 2
APB1SMENR2 : aliased APB1SMENR2_Register;
-- APB2 peripheral clocks enable in Sleep mode register
APB2SMENR : aliased APB2SMENR_Register;
-- APB3 peripheral clock enable in Sleep mode register
APB3SMENR : aliased APB3SMENR_Register;
-- Peripherals independent clock configuration register
CCIPR : aliased CCIPR_Register;
-- Backup domain control register
BDCR : aliased BDCR_Register;
-- Control/status register
CSR : aliased CSR_Register;
-- Extended clock recovery register
EXTCFGR : aliased EXTCFGR_Register;
-- CPU2 AHB1 peripheral clock enable register
C2AHB1ENR : aliased C2AHB1ENR_Register;
-- CPU2 AHB2 peripheral clock enable register
C2AHB2ENR : aliased C2AHB2ENR_Register;
-- CPU2 AHB3 peripheral clock enable register [dual core device only]
C2AHB3ENR : aliased C2AHB3ENR_Register;
-- CPU2 APB1 peripheral clock enable register 1 [dual core device only]
C2APB1ENR1 : aliased C2APB1ENR1_Register;
-- CPU2 APB1 peripheral clock enable register 2 [dual core device only]
C2APB1ENR2 : aliased C2APB1ENR2_Register;
-- CPU2 APB2 peripheral clock enable register [dual core device only]
C2APB2ENR : aliased C2APB2ENR_Register;
-- CPU2 APB3 peripheral clock enable register [dual core device only]
C2APB3ENR : aliased C2APB3ENR_Register;
-- CPU2 AHB1 peripheral clocks enable in Sleep modes register [dual core
-- device only]
C2AHB1SMENR : aliased C2AHB1SMENR_Register;
-- CPU2 AHB2 peripheral clocks enable in Sleep modes register [dual core
-- device only]
C2AHB2SMENR : aliased C2AHB2SMENR_Register;
-- CPU2 AHB3 peripheral clocks enable in Sleep mode register [dual core
-- device only]
C2AHB3SMENR : aliased C2AHB3SMENR_Register;
-- CPU2 APB1 peripheral clocks enable in Sleep mode register 1 [dual
-- core device only]
C2APB1SMENR1 : aliased C2APB1SMENR1_Register;
-- CPU2 APB1 peripheral clocks enable in Sleep mode register 2 [dual
-- core device only]
C2APB1SMENR2 : aliased C2APB1SMENR2_Register;
-- CPU2 APB2 peripheral clocks enable in Sleep mode register [dual core
-- device only]
C2APB2SMENR : aliased C2APB2SMENR_Register;
-- CPU2 APB3 peripheral clock enable in Sleep mode register [dual core
-- device only]
C2APB3SMENR : aliased C2APB3SMENR_Register;
end record
with Volatile;
for RCC_Peripheral use record
CR at 16#0# range 0 .. 31;
ICSCR at 16#4# range 0 .. 31;
CFGR at 16#8# range 0 .. 31;
PLLCFGR at 16#C# range 0 .. 31;
CIER at 16#18# range 0 .. 31;
CIFR at 16#1C# range 0 .. 31;
CICR at 16#20# range 0 .. 31;
AHB1RSTR at 16#28# range 0 .. 31;
AHB2RSTR at 16#2C# range 0 .. 31;
AHB3RSTR at 16#30# range 0 .. 31;
APB1RSTR1 at 16#38# range 0 .. 31;
APB1RSTR2 at 16#3C# range 0 .. 31;
APB2RSTR at 16#40# range 0 .. 31;
APB3RSTR at 16#44# range 0 .. 31;
AHB1ENR at 16#48# range 0 .. 31;
AHB2ENR at 16#4C# range 0 .. 31;
AHB3ENR at 16#50# range 0 .. 31;
APB1ENR1 at 16#58# range 0 .. 31;
APB1ENR2 at 16#5C# range 0 .. 31;
APB2ENR at 16#60# range 0 .. 31;
APB3ENR at 16#64# range 0 .. 31;
AHB1SMENR at 16#68# range 0 .. 31;
AHB2SMENR at 16#6C# range 0 .. 31;
AHB3SMENR at 16#70# range 0 .. 31;
APB1SMENR1 at 16#78# range 0 .. 31;
APB1SMENR2 at 16#7C# range 0 .. 31;
APB2SMENR at 16#80# range 0 .. 31;
APB3SMENR at 16#84# range 0 .. 31;
CCIPR at 16#88# range 0 .. 31;
BDCR at 16#90# range 0 .. 31;
CSR at 16#94# range 0 .. 31;
EXTCFGR at 16#108# range 0 .. 31;
C2AHB1ENR at 16#148# range 0 .. 31;
C2AHB2ENR at 16#14C# range 0 .. 31;
C2AHB3ENR at 16#150# range 0 .. 31;
C2APB1ENR1 at 16#158# range 0 .. 31;
C2APB1ENR2 at 16#15C# range 0 .. 31;
C2APB2ENR at 16#160# range 0 .. 31;
C2APB3ENR at 16#164# range 0 .. 31;
C2AHB1SMENR at 16#168# range 0 .. 31;
C2AHB2SMENR at 16#16C# range 0 .. 31;
C2AHB3SMENR at 16#170# range 0 .. 31;
C2APB1SMENR1 at 16#178# range 0 .. 31;
C2APB1SMENR2 at 16#17C# range 0 .. 31;
C2APB2SMENR at 16#180# range 0 .. 31;
C2APB3SMENR at 16#184# range 0 .. 31;
end record;
-- Reset and clock control
RCC_Periph : aliased RCC_Peripheral
with Import, Address => RCC_Base;
end STM32_SVD.RCC;
|
------------------------------------------------------------------------------
-- --
-- GNAT COMPILER COMPONENTS --
-- --
-- P R J . T R E E --
-- --
-- S p e c --
-- --
-- $Revision$
-- --
-- Copyright (C) 2001 Free Software Foundation, Inc. --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
-- ware Foundation; either version 2, or (at your option) any later ver- --
-- sion. GNAT is distributed in the hope that it will be useful, but WITH- --
-- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY --
-- or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License --
-- for more details. You should have received a copy of the GNU General --
-- Public License distributed with GNAT; see file COPYING. If not, write --
-- to the Free Software Foundation, 59 Temple Place - Suite 330, Boston, --
-- MA 02111-1307, USA. --
-- --
-- GNAT was originally developed by the GNAT team at New York University. --
-- Extensive contributions were provided by Ada Core Technologies Inc. --
-- --
------------------------------------------------------------------------------
-- This package defines the structure of the Project File tree.
with GNAT.HTable;
with Prj.Attr; use Prj.Attr;
with Prj.Com; use Prj.Com;
with Types; use Types;
with Table;
package Prj.Tree is
Project_Nodes_Initial : constant := 1_000;
Project_Nodes_Increment : constant := 100;
-- Allocation parameters for initializing and extending number
-- of nodes in table Tree_Private_Part.Project_Nodes
Project_Node_Low_Bound : constant := 0;
Project_Node_High_Bound : constant := 099_999_999;
-- Range of values for project node id's (in practice infinite)
type Project_Node_Id is range
Project_Node_Low_Bound .. Project_Node_High_Bound;
-- The index of table Tree_Private_Part.Project_Nodes
Empty_Node : constant Project_Node_Id := Project_Node_Low_Bound;
-- Designates no node in table Project_Nodes
First_Node_Id : constant Project_Node_Id := Project_Node_Low_Bound;
subtype Variable_Node_Id is Project_Node_Id;
-- Used to designate a node whose expected kind is one of
-- N_Typed_Variable_Declaration, N_Variable_Declaration or
-- N_Variable_Reference.
subtype Package_Declaration_Id is Project_Node_Id;
-- Used to designate a node whose expected kind is N_Proect_Declaration
type Project_Node_Kind is
(N_Project,
N_With_Clause,
N_Project_Declaration,
N_Declarative_Item,
N_Package_Declaration,
N_String_Type_Declaration,
N_Literal_String,
N_Attribute_Declaration,
N_Typed_Variable_Declaration,
N_Variable_Declaration,
N_Expression,
N_Term,
N_Literal_String_List,
N_Variable_Reference,
N_External_Value,
N_Attribute_Reference,
N_Case_Construction,
N_Case_Item);
-- Each node in the tree is of a Project_Node_Kind
-- For the signification of the fields in each node of a
-- Project_Node_Kind, look at package Tree_Private_Part.
procedure Initialize;
-- Initialize the Project File tree: empty the Project_Nodes table
-- and reset the Projects_Htable.
function Default_Project_Node
(Of_Kind : Project_Node_Kind;
And_Expr_Kind : Variable_Kind := Undefined)
return Project_Node_Id;
-- Returns a Project_Node_Record with the specified Kind and
-- Expr_Kind; all the other components have default nil values.
----------------------
-- Access Functions --
----------------------
-- The following query functions are part of the abstract interface
-- of the Project File tree
function Name_Of (Node : Project_Node_Id) return Name_Id;
-- Valid for all non empty nodes. May return No_Name for nodes that have
-- no names.
function Kind_Of (Node : Project_Node_Id) return Project_Node_Kind;
-- Valid for all non empty nodes
function Location_Of (Node : Project_Node_Id) return Source_Ptr;
-- Valid for all non empty nodes
function Directory_Of (Node : Project_Node_Id) return Name_Id;
-- Only valid for N_Project nodes.
function Expression_Kind_Of (Node : Project_Node_Id) return Variable_Kind;
-- Only valid for N_Literal_String, N_Attribute_Declaration,
-- N_Variable_Declaration, N_Typed_Variable_Declaration, N_Expression,
-- N_Term, N_Variable_Reference or N_Attribute_Reference nodes.
function First_Variable_Of
(Node : Project_Node_Id)
return Variable_Node_Id;
-- Only valid for N_Project or N_Package_Declaration nodes
function First_Package_Of
(Node : Project_Node_Id)
return Package_Declaration_Id;
-- Only valid for N_Project nodes
function Package_Id_Of (Node : Project_Node_Id) return Package_Node_Id;
-- Only valid for N_Package_Declaration nodes
function Path_Name_Of (Node : Project_Node_Id) return Name_Id;
-- Only valid for N_Project and N_With_Clause nodes.
function String_Value_Of (Node : Project_Node_Id) return String_Id;
-- Only valid for N_With_Clause or N_Literal_String nodes.
function First_With_Clause_Of
(Node : Project_Node_Id)
return Project_Node_Id;
-- Only valid for N_Project nodes
function Project_Declaration_Of
(Node : Project_Node_Id)
return Project_Node_Id;
-- Only valid for N_Project nodes
function First_String_Type_Of
(Node : Project_Node_Id)
return Project_Node_Id;
-- Only valid for N_Project nodes
function Modified_Project_Path_Of
(Node : Project_Node_Id)
return String_Id;
-- Only valid for N_With_Clause nodes
function Project_Node_Of
(Node : Project_Node_Id)
return Project_Node_Id;
-- Only valid for N_Project nodes
function Next_With_Clause_Of
(Node : Project_Node_Id)
return Project_Node_Id;
-- Only valid for N_With_Clause nodes
function First_Declarative_Item_Of
(Node : Project_Node_Id)
return Project_Node_Id;
-- Only valid for N_With_Clause nodes
function Modified_Project_Of
(Node : Project_Node_Id)
return Project_Node_Id;
-- Only valid for N_With_Clause nodes
function Current_Item_Node
(Node : Project_Node_Id)
return Project_Node_Id;
-- Only valid for N_Declarative_Item nodes
function Next_Declarative_Item
(Node : Project_Node_Id)
return Project_Node_Id;
-- Only valid for N_Declarative_Item node
function Project_Of_Renamed_Package_Of
(Node : Project_Node_Id)
return Project_Node_Id;
-- Only valid for N_Package_Declaration nodes.
-- May return Empty_Node.
function Next_Package_In_Project
(Node : Project_Node_Id)
return Project_Node_Id;
-- Only valid for N_Package_Declaration nodes
function First_Literal_String
(Node : Project_Node_Id)
return Project_Node_Id;
-- Only valid for N_String_Type_Declaration nodes
function Next_String_Type
(Node : Project_Node_Id)
return Project_Node_Id;
-- Only valid for N_String_Type_Declaration nodes
function Next_Literal_String
(Node : Project_Node_Id)
return Project_Node_Id;
-- Only valid for N_Literal_String nodes
function Expression_Of
(Node : Project_Node_Id)
return Project_Node_Id;
-- Only valid for N_Attribute_Declaration, N_Typed_Variable_Declaration
-- or N_Variable_Declaration nodes
function Value_Is_Valid
(For_Typed_Variable : Project_Node_Id;
Value : String_Id)
return Boolean;
-- Only valid for N_Typed_Variable_Declaration. Returns True if Value is
-- in the list of allowed strings for For_Typed_Variable. False otherwise.
function Associative_Array_Index_Of
(Node : Project_Node_Id)
return String_Id;
-- Only valid for N_Attribute_Declaration.
-- Returns No_String for non associative array attributes.
function Next_Variable
(Node : Project_Node_Id)
return Project_Node_Id;
-- Only valid for N_Typed_Variable_Declaration or N_Variable_Declaration
-- nodes.
function First_Term
(Node : Project_Node_Id)
return Project_Node_Id;
-- Only valid for N_Expression nodes
function Next_Expression_In_List
(Node : Project_Node_Id)
return Project_Node_Id;
-- Only valid for N_Expression nodes
function Current_Term
(Node : Project_Node_Id)
return Project_Node_Id;
-- Only valid for N_Term nodes
function Next_Term
(Node : Project_Node_Id)
return Project_Node_Id;
-- Only valid for N_Term nodes
function First_Expression_In_List
(Node : Project_Node_Id)
return Project_Node_Id;
-- Only valid for N_Literal_String_List nodes
function Package_Node_Of
(Node : Project_Node_Id)
return Project_Node_Id;
-- Only valid for N_Variable_Reference or N_Attribute_Reference nodes.
-- May return Empty_Node.
function String_Type_Of
(Node : Project_Node_Id)
return Project_Node_Id;
-- Only valid for N_Variable_Reference or N_Typed_Variable_Declaration
-- nodes.
function External_Reference_Of
(Node : Project_Node_Id)
return Project_Node_Id;
-- Only valid for N_External_Value nodes
function External_Default_Of
(Node : Project_Node_Id)
return Project_Node_Id;
-- Only valid for N_External_Value nodes
function Case_Variable_Reference_Of
(Node : Project_Node_Id)
return Project_Node_Id;
-- Only valid for N_Case_Construction nodes
function First_Case_Item_Of
(Node : Project_Node_Id)
return Project_Node_Id;
-- Only valid for N_Case_Construction nodes
function First_Choice_Of
(Node : Project_Node_Id)
return Project_Node_Id;
-- Return the first choice in a N_Case_Item, or Empty_Node if
-- this is when others.
function Next_Case_Item
(Node : Project_Node_Id)
return Project_Node_Id;
-- Only valid for N_Case_Item nodes
function Case_Insensitive (Node : Project_Node_Id) return Boolean;
-- Only valid for N_Attribute_Declaration nodes
--------------------
-- Set Procedures --
--------------------
-- The following procedures are part of the abstract interface of
-- the Project File tree.
-- Each Set_* procedure is valid only for the same Project_Node_Kind
-- nodes as the corresponding query function above.
procedure Set_Name_Of
(Node : Project_Node_Id;
To : Name_Id);
procedure Set_Kind_Of
(Node : Project_Node_Id;
To : Project_Node_Kind);
procedure Set_Location_Of
(Node : Project_Node_Id;
To : Source_Ptr);
procedure Set_Directory_Of
(Node : Project_Node_Id;
To : Name_Id);
procedure Set_Expression_Kind_Of
(Node : Project_Node_Id;
To : Variable_Kind);
procedure Set_First_Variable_Of
(Node : Project_Node_Id;
To : Variable_Node_Id);
procedure Set_First_Package_Of
(Node : Project_Node_Id;
To : Package_Declaration_Id);
procedure Set_Package_Id_Of
(Node : Project_Node_Id;
To : Package_Node_Id);
procedure Set_Path_Name_Of
(Node : Project_Node_Id;
To : Name_Id);
procedure Set_String_Value_Of
(Node : Project_Node_Id;
To : String_Id);
procedure Set_First_With_Clause_Of
(Node : Project_Node_Id;
To : Project_Node_Id);
procedure Set_Project_Declaration_Of
(Node : Project_Node_Id;
To : Project_Node_Id);
procedure Set_First_String_Type_Of
(Node : Project_Node_Id;
To : Project_Node_Id);
procedure Set_Modified_Project_Path_Of
(Node : Project_Node_Id;
To : String_Id);
procedure Set_Project_Node_Of
(Node : Project_Node_Id;
To : Project_Node_Id);
procedure Set_Next_With_Clause_Of
(Node : Project_Node_Id;
To : Project_Node_Id);
procedure Set_First_Declarative_Item_Of
(Node : Project_Node_Id;
To : Project_Node_Id);
procedure Set_Modified_Project_Of
(Node : Project_Node_Id;
To : Project_Node_Id);
procedure Set_Current_Item_Node
(Node : Project_Node_Id;
To : Project_Node_Id);
procedure Set_Next_Declarative_Item
(Node : Project_Node_Id;
To : Project_Node_Id);
procedure Set_Project_Of_Renamed_Package_Of
(Node : Project_Node_Id;
To : Project_Node_Id);
procedure Set_Next_Package_In_Project
(Node : Project_Node_Id;
To : Project_Node_Id);
procedure Set_First_Literal_String
(Node : Project_Node_Id;
To : Project_Node_Id);
procedure Set_Next_String_Type
(Node : Project_Node_Id;
To : Project_Node_Id);
procedure Set_Next_Literal_String
(Node : Project_Node_Id;
To : Project_Node_Id);
procedure Set_Expression_Of
(Node : Project_Node_Id;
To : Project_Node_Id);
procedure Set_Associative_Array_Index_Of
(Node : Project_Node_Id;
To : String_Id);
procedure Set_Next_Variable
(Node : Project_Node_Id;
To : Project_Node_Id);
procedure Set_First_Term
(Node : Project_Node_Id;
To : Project_Node_Id);
procedure Set_Next_Expression_In_List
(Node : Project_Node_Id;
To : Project_Node_Id);
procedure Set_Current_Term
(Node : Project_Node_Id;
To : Project_Node_Id);
procedure Set_Next_Term
(Node : Project_Node_Id;
To : Project_Node_Id);
procedure Set_First_Expression_In_List
(Node : Project_Node_Id;
To : Project_Node_Id);
procedure Set_Package_Node_Of
(Node : Project_Node_Id;
To : Project_Node_Id);
procedure Set_String_Type_Of
(Node : Project_Node_Id;
To : Project_Node_Id);
procedure Set_External_Reference_Of
(Node : Project_Node_Id;
To : Project_Node_Id);
procedure Set_External_Default_Of
(Node : Project_Node_Id;
To : Project_Node_Id);
procedure Set_Case_Variable_Reference_Of
(Node : Project_Node_Id;
To : Project_Node_Id);
procedure Set_First_Case_Item_Of
(Node : Project_Node_Id;
To : Project_Node_Id);
procedure Set_First_Choice_Of
(Node : Project_Node_Id;
To : Project_Node_Id);
procedure Set_Next_Case_Item
(Node : Project_Node_Id;
To : Project_Node_Id);
procedure Set_Case_Insensitive
(Node : Project_Node_Id;
To : Boolean);
-------------------------------
-- Restricted Access Section --
-------------------------------
package Tree_Private_Part is
-- This is conceptually in the private part.
-- However, for efficiency, some packages are accessing it directly.
type Project_Node_Record is record
Kind : Project_Node_Kind;
Location : Source_Ptr := No_Location;
Directory : Name_Id := No_Name;
-- Only for N_Project
Expr_Kind : Variable_Kind := Undefined;
-- See below for what Project_Node_Kind it is used
Variables : Variable_Node_Id := Empty_Node;
-- First variable in a project or a package
Packages : Package_Declaration_Id := Empty_Node;
-- First package declaration in a project
Pkg_Id : Package_Node_Id := Empty_Package;
-- Only used for N_Package_Declaration
-- The component Pkg_Id is an entry into the table Package_Attributes
-- (in Prj.Attr). It is used to indicate all the attributes of the
-- package with their characteristics.
--
-- The tables Prj.Attr.Attributes and Prj.Attr.Package_Attributes
-- are built once and for all through a call (from Prj.Initialize)
-- to procedure Prj.Attr.Initialize. It is never modified after that.
Name : Name_Id := No_Name;
-- See below for what Project_Node_Kind it is used
Path_Name : Name_Id := No_Name;
-- See below for what Project_Node_Kind it is used
Value : String_Id := No_String;
-- See below for what Project_Node_Kind it is used
Field1 : Project_Node_Id := Empty_Node;
-- See below the meaning for each Project_Node_Kind
Field2 : Project_Node_Id := Empty_Node;
-- See below the meaning for each Project_Node_Kind
Field3 : Project_Node_Id := Empty_Node;
-- See below the meaning for each Project_Node_Kind
Case_Insensitive : Boolean := False;
-- Significant only for N_Attribute_Declaration
-- Indicates, for an associative array attribute, that the
-- index is case insensitive.
end record;
-- type Project_Node_Kind is
-- (N_Project,
-- -- Name: project name
-- -- Path_Name: project path name
-- -- Expr_Kind: Undefined
-- -- Field1: first with clause
-- -- Field2: project declaration
-- -- Field3: first string type
-- -- Value: modified project path name (if any)
-- N_With_Clause,
-- -- Name: imported project name
-- -- Path_Name: imported project path name
-- -- Expr_Kind: Undefined
-- -- Field1: project node
-- -- Field2: next with clause
-- -- Field3: not used
-- -- Value: literal string withed
-- N_Project_Declaration,
-- -- Name: not used
-- -- Path_Name: not used
-- -- Expr_Kind: Undefined
-- -- Field1: first declarative item
-- -- Field2: modified project
-- -- Field3: not used
-- -- Value: not used
-- N_Declarative_Item,
-- -- Name: not used
-- -- Path_Name: not used
-- -- Expr_Kind: Undefined
-- -- Field1: current item node
-- -- Field2: next declarative item
-- -- Field3: not used
-- -- Value: not used
-- N_Package_Declaration,
-- -- Name: package name
-- -- Path_Name: not used
-- -- Expr_Kind: Undefined
-- -- Field1: project of renamed package (if any)
-- -- Field2: first declarative item
-- -- Field3: next package in project
-- -- Value: not used
-- N_String_Type_Declaration,
-- -- Name: type name
-- -- Path_Name: not used
-- -- Expr_Kind: Undefined
-- -- Field1: first literal string
-- -- Field2: next string type
-- -- Field3: not used
-- -- Value: not used
-- N_Literal_String,
-- -- Name: not used
-- -- Path_Name: not used
-- -- Expr_Kind: Single
-- -- Field1: next literal string
-- -- Field2: not used
-- -- Field3: not used
-- -- Value: string value
-- N_Attribute_Declaration,
-- -- Name: attribute name
-- -- Path_Name: not used
-- -- Expr_Kind: attribute kind
-- -- Field1: expression
-- -- Field2: not used
-- -- Field3: not used
-- -- Value: associative array index
-- -- (if an associative array element)
-- N_Typed_Variable_Declaration,
-- -- Name: variable name
-- -- Path_Name: not used
-- -- Expr_Kind: Single
-- -- Field1: expression
-- -- Field2: type of variable (N_String_Type_Declaration)
-- -- Field3: next variable
-- -- Value: not used
-- N_Variable_Declaration,
-- -- Name: variable name
-- -- Path_Name: not used
-- -- Expr_Kind: variable kind
-- -- Field1: expression
-- -- Field2: not used
-- -- Field3 is used for next variable, instead of Field2,
-- -- so that it is the same field for
-- -- N_Variable_Declaration and
-- -- N_Typed_Variable_Declaration
-- -- Field3: next variable
-- -- Value: not used
-- N_Expression,
-- -- Name: not used
-- -- Path_Name: not used
-- -- Expr_Kind: expression kind
-- -- Field1: first term
-- -- Field2: next expression in list
-- -- Field3: not used
-- -- Value: not used
-- N_Term,
-- -- Name: not used
-- -- Path_Name: not used
-- -- Expr_Kind: term kind
-- -- Field1: current term
-- -- Field2: next term in the expression
-- -- Field3: not used
-- -- Value: not used
-- N_Literal_String_List,
-- -- Designates a list of string expressions between brackets
-- -- separated by commas. The string expressions are not necessarily
-- -- literal strings.
-- -- Name: not used
-- -- Path_Name: not used
-- -- Expr_Kind: List
-- -- Field1: first expression
-- -- Field2: not used
-- -- Field3: not used
-- -- Value: not used
-- N_Variable_Reference,
-- -- Name: variable name
-- -- Path_Name: not used
-- -- Expr_Kind: variable kind
-- -- Field1: project (if specified)
-- -- Field2: package (if specified)
-- -- Field3: type of variable (N_String_Type_Declaration), if any
-- -- Value: not used
-- N_External_Value,
-- -- Name: not used
-- -- Path_Name: not used
-- -- Expr_Kind: Single
-- -- Field1: Name of the external reference (literal string)
-- -- Field2: Default (literal string)
-- -- Field3: not used
-- -- Value: not used
-- N_Attribute_Reference,
-- -- Name: attribute name
-- -- Path_Name: not used
-- -- Expr_Kind: attribute kind
-- -- Field1: project
-- -- Field2: package (if attribute of a package)
-- -- Field3: not used
-- -- Value: not used
-- N_Case_Construction,
-- -- Name: not used
-- -- Path_Name: not used
-- -- Expr_Kind: Undefined
-- -- Field1: case variable reference
-- -- Field2: first case item
-- -- Field3: not used
-- -- Value: not used
-- N_Case_Item);
-- -- Name: not used
-- -- Path_Name: not used
-- -- Expr_Kind: not used
-- -- Field1: first choice (literal string), or Empty_Node
-- -- for when others
-- -- Field2: first declarative item
-- -- Field3: next case item
-- -- Value: not used
package Project_Nodes is
new Table.Table (Table_Component_Type => Project_Node_Record,
Table_Index_Type => Project_Node_Id,
Table_Low_Bound => First_Node_Id,
Table_Initial => Project_Nodes_Initial,
Table_Increment => Project_Nodes_Increment,
Table_Name => "Project_Nodes");
-- This table contains the syntactic tree of project data
-- from project files.
type Project_Name_And_Node is record
Name : Name_Id;
-- Name of the project
Node : Project_Node_Id;
-- Node of the project in table Project_Nodes
Modified : Boolean;
-- True when the project is being modified by another project
end record;
No_Project_Name_And_Node : constant Project_Name_And_Node :=
(Name => No_Name, Node => Empty_Node, Modified => True);
package Projects_Htable is new GNAT.HTable.Simple_HTable
(Header_Num => Header_Num,
Element => Project_Name_And_Node,
No_Element => No_Project_Name_And_Node,
Key => Name_Id,
Hash => Hash,
Equal => "=");
-- This hash table contains a mapping of project names to project nodes.
-- Note that this hash table contains only the nodes whose Kind is
-- N_Project. It is used to find the node of a project from its
-- name, and to verify if a project has already been parsed, knowing
-- its name.
end Tree_Private_Part;
end Prj.Tree;
|
with Tkmrpc.Request;
with Tkmrpc.Response;
package Tkmrpc.Operation_Handlers.Ees.Esa_Acquire is
procedure Handle (Req : Request.Data_Type; Res : out Response.Data_Type);
-- Handler for the esa_acquire operation.
end Tkmrpc.Operation_Handlers.Ees.Esa_Acquire;
|
with Ada.Text_IO; use Ada.Text_IO;
procedure Cellular_Automata is
type Petri_Dish is array (Positive range <>) of Boolean;
procedure Step (Culture : in out Petri_Dish) is
Left : Boolean := False;
This : Boolean;
Right : Boolean;
begin
for Index in Culture'First..Culture'Last - 1 loop
Right := Culture (Index + 1);
This := Culture (Index);
Culture (Index) := (This and (Left xor Right)) or (not This and Left and Right);
Left := This;
end loop;
Culture (Culture'Last) := Culture (Culture'Last) and not Left;
end Step;
procedure Put (Culture : Petri_Dish) is
begin
for Index in Culture'Range loop
if Culture (Index) then
Put ('#');
else
Put ('_');
end if;
end loop;
end Put;
Culture : Petri_Dish :=
( False, True, True, True, False, True, True, False, True, False, True,
False, True, False, True, False, False, True, False, False
);
begin
for Generation in 0..9 loop
Put ("Generation" & Integer'Image (Generation) & ' ');
Put (Culture);
New_Line;
Step (Culture);
end loop;
end Cellular_Automata;
|
-- { dg-do run }
-- { dg-options "-gnatws" }
procedure alignment1 is
type My_Integer is record
Element : Integer;
end record;
F : My_Integer;
begin
if F'Alignment /= F.Element'Alignment then
raise Program_Error;
end if;
end;
|
with
openGL.Renderer.lean,
openGL.Camera,
openGL.Visual,
openGL.Palette,
openGL.Model.box.colored,
openGL.Demo;
procedure launch_Camera_Demo
--
-- Exercise the camera.
--
is
use openGL,
openGL.Model,
openGL.Model.box,
openGL.Palette,
openGL.Math,
openGL.linear_Algebra_3d;
begin
Demo.print_Usage;
Demo.define ("openGL 'Camera' Demo");
-- Setup the camera.
--
Demo.Camera.Position_is ((5.0, 0.0, 10.0),
y_Rotation_from (to_Radians (0.0)));
declare
-- The Model.
--
the_box_Model : constant openGL.Model.Box.colored.view
:= openGL.Model.Box.colored.new_Box (size => (0.5, 0.5, 0.5),
faces => (front => (colors => (others => (Blue, Opaque))),
rear => (colors => (others => (light_Blue, Opaque))),
upper => (colors => (others => (Green, Opaque))),
lower => (colors => (others => (forest_Green, Opaque))),
left => (colors => (others => (Dark_Red, Opaque))),
right => (colors => (others => (Red, Opaque)))));
the_Sprite : constant openGL.Visual.view
:= openGL.Visual.Forge.new_Visual (the_box_Model.all'Access);
begin
the_Sprite.Site_is ((10.0, 0.0, 0.0));
-- Main loop.
--
while not Demo.Done
loop
Demo.Dolly.evolve;
Demo.Done := Demo.Dolly.quit_Requested;
-- Render all sprites.
--
Demo.Camera.render (Visuals => (1 => the_Sprite));
while not Demo.Camera.cull_Completed
loop
delay Duration'Small;
end loop;
Demo.Renderer.render;
end loop;
end;
Demo.destroy;
end launch_Camera_Demo;
|
with Ada.Text_IO;
with GNAT.Sockets;
with Interfaces;
with Kafka;
with Kafka.Config;
with Kafka.Topic;
with System;
--
-- Basic Kafka producer
--
procedure Simple_Producer is
Config : Kafka.Config_Type;
Handle : Kafka.Handle_Type;
Topic : Kafka.Topic_Type;
begin
Ada.Text_IO.Put_Line("Kafka version: " & Kafka.Version);
-- Create a new config object
Config := Kafka.Config.Create;
-- Configure your properties
Kafka.Config.Set(Config, "client.id", GNAT.Sockets.Host_name);
Kafka.Config.Set(Config, "bootstrap.servers", "localhost:9092");
-- Create handle
Handle := Kafka.Create_Handle(Kafka.RD_KAFKA_PRODUCER, Config);
-- Create topic handle
Topic := Kafka.Topic.Create_Topic_Handle(Handle, "test_topic"); -- topic must already exist
-- Producing a String
Kafka.Produce(Topic,
Kafka.RD_KAFKA_PARTITION_UA,
"World", -- payload
"Hello", -- key
System.Null_Address);
-- Producing binary data
declare
type Some_Message is record
A : Interfaces.Unsigned_32;
B : Interfaces.Unsigned_64;
C : Interfaces.Unsigned_8;
end record
with Convention => C;
for Some_Message use record
A at 0 range 0 .. 31;
B at 4 range 0 .. 63;
C at 12 range 0 .. 7;
end record;
for Some_Message'Bit_Order use System.High_Order_First;
for Some_Message'Scalar_Storage_Order use System.High_Order_First;
Message : Some_Message := (A => 55, B => 40002, C => 13);
begin
Kafka.Produce(Topic,
Kafka.RD_KAFKA_PARTITION_UA,
Kafka.RD_KAFKA_MSG_F_COPY,
Message'Address,
13,
System.Null_Address, -- key is optional
0,
System.Null_Address);
end;
Kafka.Poll(Handle, 0.0);
Kafka.Flush(Handle, 15.0);
Kafka.Destroy_Handle(Handle);
end Simple_Producer;
|
with
gel.Window.sdl,
gel.Applet.gui_world,
gel.Forge,
gel.Sprite,
openGL.Palette,
openGL.Model.text.lit_colored,
Physics;
pragma unreferenced (gel.Window.sdl);
procedure launch_text_sprite_Demo
--
-- Shows a few text sprites.
--
is
use gel.Math,
openGL.Palette;
the_Applet : constant gel.Applet.gui_World.view := gel.forge.new_gui_Applet ("text sprite Demo",
space_Kind => physics.Bullet);
the_Text_1 : constant gel.Sprite.view := gel.forge.new_text_Sprite (the_Applet.gui_World,
Origin_3D,
"Howdy",
the_Applet.Font,
Green);
the_Text_2 : constant gel.Sprite.view := gel.forge.new_text_Sprite (the_Applet.gui_World,
Origin_3D,
"Doody",
the_Applet.Font,
Green);
text_1_Model : constant openGL.Model.text.lit_colored.view
:= openGL.Model.text.lit_colored.view (the_Text_1.graphics_Model);
begin
the_Applet.gui_Camera.Site_is ((0.0, 0.0, 50.0)); -- Position the camera.
the_Applet.enable_simple_Dolly (1); -- Enable user camera control via keyboards.
the_Applet.gui_World.add (the_Text_1);
the_Applet.gui_World.add (the_Text_2);
the_Text_2.Site_is ((0.0, 10.0, 0.0));
while the_Applet.is_open
loop
if text_1_Model.Text = "Yay"
then
text_1_Model.Text_is ("Howdy");
else
text_1_Model.Text_is ("Yay");
end if;
the_Applet.gui_World.evolve;
the_Applet.freshen; -- Handle any new events and update the screen.
delay 0.5;
end loop;
the_Applet.destroy;
end launch_text_sprite_Demo;
|
------------------------------------------------------------------------------
-- --
-- Copyright (C) 2018, Universidad Politécnica de Madrid --
-- --
-- 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 Soft- --
-- ware Foundation; either version 3, or (at your option) any later ver- --
-- sion. This software 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 this software; see file --
-- COPYING3. If not, go to http://www.gnu.org/licenses for a complete copy --
-- of the license. --
-- --
------------------------------------------------------------------------------
with TTC;
with TTC_Data; use TTC_Data;
with HK_Data; use HK_Data;
with Storage;
with Ada.Real_Time; use Ada.Real_Time;
package body HK_TM is
-------------------------
-- Internal operations --
-------------------------
procedure Send_TM_Message;
-- Send a TM message with the last sensor data log.
----------------
-- HK_TM_Task --
----------------
task body HK_TM_Task is
begin
loop
Request.Wait;
Send_TM_Message;
end loop;
end HK_TM_Task;
-------------
-- Request --
-------------
protected body Request is
------------
-- Signal --
------------
procedure Signal is
begin
Pending := True;
end Signal;
----------
-- Wait --
----------
entry Wait when Pending is
begin
Pending := False;
end Wait;
end Request;
---------------------
-- Send_TM_Message --
---------------------
procedure Send_TM_Message is
Message : TM_Message (Housekeeping);
SC : Seconds_Count;
TS : Time_Span;
Data : Sensor_Data;
begin
Split (Clock, SC, TS);
Message.Timestamp := Mission_Time (SC);
for I in Message.Data_Log'Range loop
if not Storage.Empty then
Storage.Get (Data);
Message.Data_Log (I) := Data;
else
Message.Data_Log (I) := (Value => 0, Timestamp => 0);
end if;
end loop;
TTC.Send (Message);
end Send_TM_Message;
end HK_TM;
|
-- This unit provides a COBS encoder using lock-free BipBuffer (BBqueue).
with BBqueue;
package COBS.Queue.Encoder
with Preelaborate
is
Min_Buf_Size : constant := 255;
subtype Buffer_Size
is BBqueue.Buffer_Size range 2 * Min_Buf_Size ..
BBqueue.Buffer_Size'Last;
-- The idea behind "2 * Min_Buf_Size" is to make sure we can get a grant
-- for the worst case COBS frame, but I'm not 100% sure it makes sens...
type Instance (Size : Buffer_Size) is limited private;
procedure Push (This : in out Instance;
Data : Storage_Element;
Success : out Boolean);
-- Push an input byte into the decoder. The procedure can fail if there is
-- no more writable memory in the buffer.
procedure End_Frame (This : in out Instance;
Success : out Boolean);
-- Signal the end of the current frame. The procedure can fail if there is
-- no more writable memory in the buffer.
type Slice_Rec is record
Length : BBqueue.Count;
Addr : System.Address;
end record;
function Read_Slice (This : in out Instance) return Slice_Rec;
-- Get a slice of readable encoded data. Slice's Length can be zero if
-- there is no data to read.
procedure Release (This : in out Instance);
-- Release a slice of readable encoded data
generic
with procedure Process_Read (Data : Storage_Array;
To_Release : out BBqueue.Count);
procedure Read_CB (This : in out Instance;
Result : out BBqueue.Result_Kind);
-- Read from the buffer using a "callback". This procedure will call
-- Process_Read () on a readabled encoded data slice, if available. It will
-- then call Release with the value To_Release returned by Process_Read ().
private
type Instance (Size : Buffer_Size) is limited record
Buffer : Storage_Array (1 .. Size);
Queue : BBqueue.Offsets_Only (Size);
WG : BBqueue.Write_Grant := BBqueue.Empty;
RG : BBqueue.Read_Grant := BBqueue.Empty;
Code : Storage_Element := 1;
Prev_Code : Storage_Element := 1;
Code_Pointer : Storage_Offset;
Encode_Pointer : Storage_Offset;
end record;
end COBS.Queue.Encoder;
|
-- SPDX-License-Identifier: Apache-2.0
--
-- Copyright (c) 2020 onox <denkpadje@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 System;
with Interfaces.C.Strings;
with Ada.Calendar.Formatting;
with Ada.Calendar.Time_Zones;
with Ada.Unchecked_Conversion;
with Canberra;
with WeeChat;
package body Plugin_Canberra is
-- Play sounds when a message is received, nick name is highlighted, or
-- when client got (dis)connected to IRC server.
Sound_Message : constant String := "message";
-- Not away and new message:
Sound_Message_Highlight : constant String := "message-new-instant";
-- Not away and (PM or nick highlighted):
Sound_Message_Highlight_Away : constant String := "phone-incoming-call";
-- Away and (PM or nick highlighted) and current time is during office hours
Sound_Message_Reminder : constant String := "phone-outgoing-busy";
-- Away and (PM or nick highlighted) and current time outside office hours
-- (Played in the morning for x minutes or until not away)
Sound_Server_Connected : constant String := "service-login";
-- Plugin initalized or connected to IRC server:
Sound_Server_Disconnected : constant String := "service-logout";
-- Disconnected from IRC server:
Away_Duration : constant Duration := 30.0 * 60.0;
Retry_Duration : constant Duration := 30.0;
Reminder_Retries : constant Positive := 10;
Office_Hour_Start : constant Duration := Ada.Calendar.Formatting.Seconds_Of (7, 0);
Office_Hour_End : constant Duration := Ada.Calendar.Formatting.Seconds_Of (21, 0);
-----------------------------------------------------------------------------
Last_Key_Press : Ada.Calendar.Time := Ada.Calendar.Clock;
Is_Highlighted_While_Away : Boolean := False;
use Ada.Calendar;
function Image_Date (Date : Ada.Calendar.Time) return String is
(Formatting.Image (Date, Time_Zone => Time_Zones.UTC_Time_Offset));
function Image_Time (Time : Duration) return String is
(Formatting.Image (Time));
-----------------------------------------------------------------------------
Context : Canberra.Context := Canberra.Create;
procedure Play_Async (Event : String) is
S1 : Canberra.Sound;
begin
Context.Play (Event, S1);
end Play_Async;
-----------------------------------------------------------------------------
use WeeChat;
Reminder_Timer : Timer;
function Reminder_Repeated_Call_Handler
(Plugin : Plugin_Ptr;
Remaining_Calls : Integer) return Callback_Result is
begin
if Is_Highlighted_While_Away then
Play_Async (Sound_Message_Reminder);
if Remaining_Calls = 0 then
Reminder_Timer := No_Timer;
end if;
else
Cancel_Timer (Reminder_Timer);
Reminder_Timer := No_Timer;
end if;
return OK;
end Reminder_Repeated_Call_Handler;
function Reminder_First_Call_Handler
(Plugin : Plugin_Ptr;
Remaining_Calls : Integer) return Callback_Result is
begin
if Is_Highlighted_While_Away then
Play_Async (Sound_Message_Reminder);
Reminder_Timer := Set_Timer (Plugin, Retry_Duration, 0, Reminder_Retries,
Reminder_Repeated_Call_Handler'Access);
else
Reminder_Timer := No_Timer;
end if;
return OK;
end Reminder_First_Call_Handler;
-----------------------------------------------------------------------------
function On_Key_Press_Signal
(Plugin : Plugin_Ptr;
Signal : String;
Kind : Data_Kind;
Signal_Data : Void_Ptr) return Callback_Result is
begin
Is_Highlighted_While_Away := False;
Last_Key_Press := Ada.Calendar.Clock;
return OK;
end On_Key_Press_Signal;
function On_IRC_Signal
(Plugin : Plugin_Ptr;
Signal : String;
Kind : Data_Kind;
Signal_Data : Void_Ptr) return Callback_Result is
begin
if Signal = "irc_server_connected" then
Play_Async (Sound_Server_Connected);
elsif Signal = "irc_server_disconnected" then
Play_Async (Sound_Server_Disconnected);
end if;
return OK;
end On_IRC_Signal;
function On_IRC_Message_Signal
(Plugin : Plugin_Ptr;
Signal : String;
Kind : Data_Kind;
Signal_Data : Void_Ptr) return Callback_Result
is
Signal_Splitted : constant String_List :=
Split (Signal, Separator => ",", Maximum => 2);
use type SU.Unbounded_String;
Server_Name : SU.Unbounded_String renames Signal_Splitted (1);
Signal_Name : SU.Unbounded_String renames Signal_Splitted (2);
Nick_Name : constant String := Get_Info (Plugin, "irc_nick", +Server_Name);
begin
if Signal_Name /= "irc_in2_PRIVMSG" or Kind /= String_Type or Signal_Data = Null_Void then
return Error;
end if;
declare
use Interfaces.C.Strings;
function Convert is new Ada.Unchecked_Conversion (Void_Ptr, chars_ptr);
Message : constant String_List := Split (Value (Convert (Signal_Data)), Maximum => 4);
From_User : SU.Unbounded_String renames Message (1);
Primitive : SU.Unbounded_String renames Message (2);
Channel : SU.Unbounded_String renames Message (3);
Text : SU.Unbounded_String renames Message (4);
pragma Assert (Primitive = "PRIVMSG");
Is_Private_Message : constant Boolean := Channel = Nick_Name;
Is_Highlighted : constant Boolean := SU.Index (Text, ":" & Nick_Name & ": ") > 0;
Is_Away : constant Boolean := Clock - Last_Key_Press > Away_Duration;
begin
if Is_Private_Message or Is_Highlighted then
if not Is_Away then
Play_Async (Sound_Message);
Play_Async (Sound_Message_Highlight);
else
Is_Highlighted_While_Away := True;
if Seconds (Clock) in Office_Hour_Start .. Office_Hour_End then
if Reminder_Timer /= No_Timer then
Cancel_Timer (Reminder_Timer);
Reminder_Timer := No_Timer;
end if;
Play_Async (Sound_Message_Highlight_Away);
else
declare
Current_Time : constant Time := Clock;
Wake_Up_Date : constant Time := Current_Time - Seconds (Current_Time)
+ (if Seconds (Clock) >= Office_Hour_End then Day_Duration'Last else 0.0)
+ Office_Hour_Start;
In_Time : constant Duration := Wake_Up_Date - Current_Time;
Sender : constant String := Get_Nick (Host => +From_User);
begin
if Reminder_Timer = No_Timer then
Reminder_Timer := Set_Timer
(Plugin, In_Time, 60, 1, Reminder_First_Call_Handler'Access);
Send_Message
(Plugin, +Server_Name,
(if Is_Private_Message then Sender else +Channel),
(if Is_Private_Message then "" else Sender & ": ") &
"I'm currently away since " & Image_Date (Last_Key_Press) &
". I will try to notify myself in about " &
Image_Time (In_Time) & " hours");
end if;
end;
end if;
end if;
elsif not Is_Away then
Play_Async (Sound_Message);
end if;
end;
return OK;
end On_IRC_Message_Signal;
procedure Plugin_Initialize (Plugin : Plugin_Ptr) is
begin
On_Signal (Plugin, "key_pressed", On_Key_Press_Signal'Access);
On_Signal (Plugin, "irc_*", On_IRC_Signal'Access);
On_Signal (Plugin, "*,irc_in2_PRIVMSG", On_IRC_Message_Signal'Access);
Play_Async (Sound_Server_Connected);
end Plugin_Initialize;
procedure Plugin_Finalize (Plugin : Plugin_Ptr) is null;
Plugin_Name : constant C_String := "canberra" & L1.NUL
with Export, Convention => C, External_Name => "weechat_plugin_name";
Plugin_Author : constant C_String := "onox" & L1.NUL
with Export, Convention => C, External_Name => "weechat_plugin_author";
Plugin_Description : constant C_String := "Canberra sounds with Ada 2012" & L1.NUL
with Export, Convention => C, External_Name => "weechat_plugin_description";
Plugin_Version : constant C_String := "1.0" & L1.NUL
with Export, Convention => C, External_Name => "weechat_plugin_version";
Plugin_License : constant C_String := "Apache-2.0" & L1.NUL
with Export, Convention => C, External_Name => "weechat_plugin_license";
Plugin_API_Version : constant String := WeeChat.Plugin_API_Version
with Export, Convention => C, External_Name => "weechat_plugin_api_version";
function Plugin_Init
(Object : Plugin_Ptr;
Argc : Interfaces.C.int;
Argv : System.Address) return Callback_Result
with Export, Convention => C, External_Name => "weechat_plugin_init";
function Plugin_End (Object : Plugin_Ptr) return Callback_Result
with Export, Convention => C, External_Name => "weechat_plugin_end";
function Plugin_Init
(Object : Plugin_Ptr;
Argc : Interfaces.C.int;
Argv : System.Address) return Callback_Result is
begin
return Plugin_Init (Object, Plugin_Initialize'Access);
end Plugin_Init;
function Plugin_End (Object : Plugin_Ptr) return Callback_Result is
begin
return Plugin_End (Object, Plugin_Finalize'Access);
end Plugin_End;
end Plugin_Canberra;
|
with
eGL;
package opengl.Surface.privvy
is
function to_eGL (Self : in Surface.item'Class) return egl.EGLSurface;
end opengl.Surface.privvy;
|
------------------------------------------------------------------------------
-- --
-- GNAT COMPILER COMPONENTS --
-- --
-- E X P _ D B U G --
-- --
-- S p e c --
-- --
-- Copyright (C) 1996-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. --
-- --
------------------------------------------------------------------------------
-- Expand routines for generation of special declarations used by the
-- debugger. In accordance with the Dwarf 2.2 specification, certain
-- type names are encoded to provide information to the debugger.
with Namet; use Namet;
with Types; use Types;
with Uintp; use Uintp;
package Exp_Dbug is
-----------------------------------------------------
-- Encoding and Qualification of Names of Entities --
-----------------------------------------------------
-- This section describes how the names of entities are encoded in the
-- generated debugging information.
-- An entity in Ada has a name of the form X.Y.Z ... E where X,Y,Z are the
-- enclosing scopes (not including Standard at the start).
-- The encoding of the name follows this basic qualified naming scheme,
-- where the encoding of individual entity names is as described in Namet
-- (i.e. in particular names present in the original source are folded to
-- all lower case, with upper half and wide characters encoded as described
-- in Namet). Upper case letters are used only for entities generated by
-- the compiler.
-- There are two cases, global entities, and local entities. In more formal
-- terms, local entities are those which have a dynamic enclosing scope,
-- and global entities are at the library level, except that we always
-- consider procedures to be global entities, even if they are nested
-- (that's because at the debugger level a procedure name refers to the
-- code, and the code is indeed a global entity, including the case of
-- nested procedures.) In addition, we also consider all types to be global
-- entities, even if they are defined within a procedure.
-- The reason for treating all type names as global entities is that a
-- number of our type encodings work by having related type names, and we
-- need the full qualification to keep this unique.
-- For global entities, the encoded name includes all components of the
-- fully expanded name (but omitting Standard at the start). For example,
-- if a library-level child package P.Q has an embedded package R, and
-- there is an entity in this embedded package whose name is S, the encoded
-- name will include the components p.q.r.s.
-- For local entities, the encoded name only includes the components up to
-- the enclosing dynamic scope (other than a block). At run time, such a
-- dynamic scope is a subprogram, and the debugging formats know about
-- local variables of procedures, so it is not necessary to have full
-- qualification for such entities. In particular this means that direct
-- local variables of a procedure are not qualified.
-- For Ghost entities, the encoding adds a prefix "___ghost_" to aid the
-- detection of leaks of Ignored Ghost entities in the "living" space.
-- Ignored Ghost entities and any code associated with them should be
-- removed by the compiler in a post-processing pass. As a result,
-- object files should not contain any occurrences of this prefix.
-- As an example of the local name convention, consider a procedure V.W
-- with a local variable X, and a nested block Y containing an entity Z.
-- The fully qualified names of the entities X and Z are:
-- V.W.X
-- V.W.Y.Z
-- but since V.W is a subprogram, the encoded names will end up
-- encoding only
-- x
-- y.z
-- The separating dots are translated into double underscores
-----------------------------
-- Handling of Overloading --
-----------------------------
-- The above scheme is incomplete for overloaded subprograms, since
-- overloading can legitimately result in case of two entities with
-- exactly the same fully qualified names. To distinguish between
-- entries in a set of overloaded subprograms, the encoded names are
-- serialized by adding the suffix:
-- __nn (two underscores)
-- where nn is a serial number (2 for the second overloaded function,
-- 3 for the third, etc.). A suffix of __1 is always omitted (i.e. no
-- suffix implies the first instance).
-- These names are prefixed by the normal full qualification. So for
-- example, the third instance of the subprogram qrs in package yz
-- would have the name:
-- yz__qrs__3
-- A more subtle case arises with entities declared within overloaded
-- subprograms. If we have two overloaded subprograms, and both declare
-- an entity xyz, then the fully expanded name of the two xyz's is the
-- same. To distinguish these, we add the same __n suffix at the end of
-- the inner entity names.
-- In more complex cases, we can have multiple levels of overloading,
-- and we must make sure to distinguish which final declarative region
-- we are talking about. For this purpose, we use a more complex suffix
-- which has the form:
-- __nn_nn_nn ...
-- where the nn values are the homonym numbers as needed for any of the
-- qualifying entities, separated by a single underscore. If all the nn
-- values are 1, the suffix is omitted, Otherwise the suffix is present
-- (including any values of 1). The following example shows how this
-- suffixing works.
-- package body Yz is
-- procedure Qrs is -- Name is yz__qrs
-- procedure Tuv is ... end; -- Name is yz__qrs__tuv
-- begin ... end Qrs;
-- procedure Qrs (X: Int) is -- Name is yz__qrs__2
-- procedure Tuv is ... end; -- Name is yz__qrs__tuv__2_1
-- procedure Tuv (X: Int) is -- Name is yz__qrs__tuv__2_2
-- begin ... end Tuv;
-- procedure Tuv (X: Float) is -- Name is yz__qrs__tuv__2_3
-- type m is new float; -- Name is yz__qrs__tuv__m__2_3
-- begin ... end Tuv;
-- begin ... end Qrs;
-- end Yz;
--------------------
-- Operator Names --
--------------------
-- The above rules applied to operator names would result in names with
-- quotation marks, which are not typically allowed by assemblers and
-- linkers, and even if allowed would be odd and hard to deal with. To
-- avoid this problem, operator names are encoded as follows:
-- Oabs abs
-- Oand and
-- Omod mod
-- Onot not
-- Oor or
-- Orem rem
-- Oxor xor
-- Oeq =
-- One /=
-- Olt <
-- Ole <=
-- Ogt >
-- Oge >=
-- Oadd +
-- Osubtract -
-- Oconcat &
-- Omultiply *
-- Odivide /
-- Oexpon **
-- These names are prefixed by the normal full qualification, and
-- suffixed by the overloading identification. So for example, the
-- second operator "=" defined in package Extra.Messages would have
-- the name:
-- extra__messages__Oeq__2
----------------------------------
-- Resolving Other Name Clashes --
----------------------------------
-- It might be thought that the above scheme is complete, but in Ada 95,
-- full qualification is insufficient to uniquely identify an entity in
-- the program, even if it is not an overloaded subprogram. There are
-- two possible confusions:
-- a.b
-- interpretation 1: entity b in body of package a
-- interpretation 2: child procedure b of package a
-- a.b.c
-- interpretation 1: entity c in child package a.b
-- interpretation 2: entity c in nested package b in body of a
-- It is perfectly legal in both cases for both interpretations to be
-- valid within a single program. This is a bit of a surprise since
-- certainly in Ada 83, full qualification was sufficient, but not in
-- Ada 95. The result is that the above scheme can result in duplicate
-- names. This would not be so bad if the effect were just restricted
-- to debugging information, but in fact in both the above cases, it
-- is possible for both symbols to be external names, and so we have
-- a real problem of name clashes.
-- To deal with this situation, we provide two additional encoding
-- rules for names:
-- First: all library subprogram names are preceded by the string
-- _ada_ (which causes no duplications, since normal Ada names can
-- never start with an underscore. This not only solves the first
-- case of duplication, but also solves another pragmatic problem
-- which is that otherwise Ada procedures can generate names that
-- clash with existing system function names. Most notably, we can
-- have clashes in the case of procedure Main with the C main that
-- in some systems is always present.
-- Second, for the case where nested packages declared in package
-- bodies can cause trouble, we add a suffix which shows which
-- entities in the list are body-nested packages, i.e. packages
-- whose spec is within a package body. The rules are as follows,
-- given a list of names in a qualified name name1.name2....
-- If none are body-nested package entities, then there is no suffix
-- If at least one is a body-nested package entity, then the suffix
-- is X followed by a string of b's and n's (b = body-nested package
-- entity, n = not a body-nested package).
-- There is one element in this string for each entity in the encoded
-- expanded name except the first (the rules are such that the first
-- entity of the encoded expanded name can never be a body-nested'
-- package. Trailing n's are omitted, as is the last b (there must
-- be at least one b, or we would not be generating a suffix at all).
-- For example, suppose we have
-- package x is
-- pragma Elaborate_Body;
-- m1 : integer; -- #1
-- end x;
-- package body x is
-- package y is m2 : integer; end y; -- #2
-- package body y is
-- package z is r : integer; end z; -- #3
-- end;
-- m3 : integer; -- #4
-- end x;
-- package x.y is
-- pragma Elaborate_Body;
-- m2 : integer; -- #5
-- end x.y;
-- package body x.y is
-- m3 : integer; -- #6
-- procedure j is -- #7
-- package k is
-- z : integer; -- #8
-- end k;
-- begin
-- null;
-- end j;
-- end x.y;
-- procedure x.m3 is begin null; end; -- #9
-- Then the encodings would be:
-- #1. x__m1 (no BNPE's in sight)
-- #2. x__y__m2X (y is a BNPE)
-- #3. x__y__z__rXb (y is a BNPE, so is z)
-- #4. x__m3 (no BNPE's in sight)
-- #5. x__y__m2 (no BNPE's in sight)
-- #6. x__y__m3 (no BNPE's in signt)
-- #7. x__y__j (no BNPE's in sight)
-- #8. k__z (no BNPE's, only up to procedure)
-- #9 _ada_x__m3 (library-level subprogram)
-- Note that we have instances here of both kind of potential name
-- clashes, and the above examples show how the encodings avoid the
-- clash as follows:
-- Lines #4 and #9 both refer to the entity x.m3, but #9 is a library
-- level subprogram, so it is preceded by the string _ada_ which acts
-- to distinguish it from the package body entity.
-- Lines #2 and #5 both refer to the entity x.y.m2, but the first
-- instance is inside the body-nested package y, so there is an X
-- suffix to distinguish it from the child library entity.
-- Note that enumeration literals never need Xb type suffixes, since
-- they are never referenced using global external names.
---------------------
-- Interface Names --
---------------------
-- Note: if an interface name is present, then the external name is
-- taken from the specified interface name. Given current limitations of
-- the gcc backend, this means that the debugging name is also set to
-- the interface name, but conceptually, it would be possible (and
-- indeed desirable) to have the debugging information still use the Ada
-- name as qualified above, so we still fully qualify the name in the
-- front end.
-------------------------------------
-- Encodings Related to Task Types --
-------------------------------------
-- Each task object defined by a single task declaration is associated
-- with a prefix that is used to qualify procedures defined in that
-- task. Given
--
-- package body P is
-- task body TaskObj is
-- procedure F1 is ... end;
-- begin
-- B;
-- end TaskObj;
-- end P;
--
-- The name of subprogram TaskObj.F1 is encoded as p__taskobjTK__f1.
-- The body, B, is contained in a subprogram whose name is
-- p__taskobjTKB.
------------------------------------------
-- Encodings Related to Protected Types --
------------------------------------------
-- Each protected type has an associated record type, that describes
-- the actual layout of the private data. In addition to the private
-- components of the type, the Corresponding_Record_Type includes one
-- component of type Protection, which is the actual lock structure.
-- The run-time size of the protected type is the size of the corres-
-- ponding record.
-- For a protected type prot, the Corresponding_Record_Type is encoded
-- as protV.
-- The operations of a protected type are encoded as follows: each
-- operation results in two subprograms, a locking one that is called
-- from outside of the object, and a non-locking one that is used for
-- calls from other operations on the same object. The locking operation
-- simply acquires the lock, and then calls the non-locking version.
-- The names of all of these have a prefix constructed from the name of
-- the type, and a suffix which is P or N, depending on whether this is
-- the protected/non-locking version of the operation.
-- Operations generated for protected entries follow the same encoding.
-- Each entry results in two subprograms: a procedure that holds the
-- entry body, and a function that holds the evaluation of the barrier.
-- The names of these subprograms include the prefix '_E' or '_B' res-
-- pectively. The names also include a numeric suffix to render them
-- unique in the presence of overloaded entries.
-- Given the declaration:
-- protected type Lock is
-- function Get return Integer;
-- procedure Set (X: Integer);
-- entry Update (Val : Integer);
-- private
-- Value : Integer := 0;
-- end Lock;
-- the following operations are created:
-- lock_getN
-- lock_getP,
-- lock_setN
-- lock_setP
-- lock_update_E1s
-- lock_udpate_B2s
-- If the protected type implements at least one interface, the
-- following additional operations are created:
-- lock_get
-- lock_set
-- These operations are used to ensure overriding of interface level
-- subprograms and proper dispatching on interface class-wide objects.
-- The bodies of these operations contain calls to their respective
-- protected versions:
-- function lock_get return Integer is
-- begin
-- return lock_getP;
-- end lock_get;
-- procedure lock_set (X : Integer) is
-- begin
-- lock_setP (X);
-- end lock_set;
----------------------------------------------------
-- Conversion between Entities and External Names --
----------------------------------------------------
procedure Get_External_Name
(Entity : Entity_Id;
Has_Suffix : Boolean := False;
Suffix : String := "");
-- Set Name_Buffer and Name_Len to the external name of the entity. The
-- external name is the Interface_Name, if specified, unless the entity
-- has an address clause or Has_Suffix is true.
--
-- If the Interface is not present, or not used, the external name is the
-- concatenation of:
--
-- - the string "_ada_", if the entity is a library subprogram,
-- - the names of any enclosing scopes, each followed by "__",
-- or "X_" if the next entity is a subunit)
-- - the name of the entity
-- - the string "$" (or "__" if target does not allow "$"), followed
-- by homonym suffix, if the entity is an overloaded subprogram
-- or is defined within an overloaded subprogram.
-- - the string "___" followed by Suffix if Has_Suffix is true.
--
-- Note that a call to this procedure has no effect if we are not
-- generating code, since the necessary information for computing the
-- proper external name is not available in this case.
-- WARNING: There is a matching C declaration of this subprogram in fe.h
-------------------------------------
-- Encoding for translation into C --
-------------------------------------
-- In Modify_Tree_For_C mode we must add encodings to dismabiguate cases
-- where Ada block structure cannot be directly translated. These cases
-- are as follows:
-- a) A loop variable may hide a homonym in an enclosing block
-- b) A block-local variable may hide a homonym in an enclosing block
-- In C these constructs are not scopes and we must distinguish the names
-- explicitly. In the first case we create a qualified name with the suffix
-- 'L', in the second case with a suffix 'B'.
--------------------------------------------
-- Subprograms for Handling Qualification --
--------------------------------------------
procedure Qualify_Entity_Names (N : Node_Id);
-- Given a node N, that represents a block, subprogram body, or package
-- body or spec, or protected or task type, sets a fully qualified name
-- for the defining entity of given construct, and also sets fully
-- qualified names for all enclosed entities of the construct (using
-- First_Entity/Next_Entity). Note that the actual modifications of the
-- names is postponed till a subsequent call to Qualify_All_Entity_Names.
-- Note: this routine does not deal with prepending _ada_ to library
-- subprogram names. The reason for this is that we only prepend _ada_
-- to the library entity itself, and not to names built from this name.
procedure Qualify_All_Entity_Names;
-- When Qualify_Entity_Names is called, no actual name changes are made,
-- i.e. the actual calls to Qualify_Entity_Name are deferred until a call
-- is made to this procedure. The reason for this deferral is that when
-- names are changed semantic processing may be affected. By deferring
-- the changes till just before gigi is called, we avoid any concerns
-- about such effects. Gigi itself does not use the names except for
-- output of names for debugging purposes (which is why we are doing
-- the name changes in the first place).
-- Note: the routines Get_Unqualified_[Decoded]_Name_String in Namet are
-- useful to remove qualification from a name qualified by the call to
-- Qualify_All_Entity_Names.
--------------------------------
-- Handling of Numeric Values --
--------------------------------
-- All numeric values here are encoded as strings of decimal digits. Only
-- integer values need to be encoded. A negative value is encoded as the
-- corresponding positive value followed by a lower case m for minus to
-- indicate that the value is negative (e.g. 2m for -2).
-------------------------
-- Type Name Encodings --
-------------------------
-- In the following typ is the name of the type as normally encoded by the
-- debugger rules, i.e. a non-qualified name, all in lower case, with
-- standard encoding of upper half and wide characters
------------------------
-- Encapsulated Types --
------------------------
-- In some cases, the compiler encapsulates a type by wrapping it in a
-- structure. For example, this is used when a size or alignment
-- specification requires a larger type. Consider:
-- type y is mod 2 ** 64;
-- for y'size use 256;
-- In this case the compile generates a structure type y___PAD, which
-- has a single field whose name is F. This single field is 64 bits
-- long and contains the actual value. This kind of padding is used
-- when the logical value to be stored is shorter than the object in
-- which it is allocated. For example if a size clause is used to set
-- a size of 256 for a signed integer value, then a typical choice is
-- to wrap a 64-bit integer in a 256 bit PAD structure.
-- A similar encapsulation is done for some packed array types, in which
-- case the structure type is y___JM and the field name is OBJECT.
-- This is used in the case of a packed array stored using modular
-- representation (see section on representation of packed array
-- objects). In this case the JM wrapping is used to achieve correct
-- positioning of the packed array value (left or right justified in its
-- field depending on endianness.
-- When the debugger sees an object of a type whose name has a suffix of
-- ___PAD or ___JM, the type will be a record containing a single field,
-- and the name of that field will be all upper case. In this case, it
-- should look inside to get the value of the inner field, and neither
-- the outer structure name, nor the field name should appear when the
-- value is printed.
-- When the debugger sees a record named REP being a field inside
-- another record, it should treat the fields inside REP as being part
-- of the outer record (this REP field is only present for code
-- generation purposes). The REP record should not appear in the values
-- printed by the debugger.
-----------------------
-- Fixed-Point Types --
-----------------------
-- Fixed-point types are encoded using a suffix that indicates the
-- delta and small values. The actual type itself is a normal integer
-- type.
-- typ___XF_nn_dd
-- typ___XF_nn_dd_nn_dd
-- The first form is used when small = delta. The value of delta (and
-- small) is given by the rational nn/dd, where nn and dd are decimal
-- integers.
--
-- The second form is used if the small value is different from the
-- delta. In this case, the first nn/dd rational value is for delta,
-- and the second value is for small.
--------------------
-- Discrete Types --
--------------------
-- Discrete types are coded with a suffix indicating the range in the
-- case where one or both of the bounds are discriminants or variable.
-- Note: at the current time, we also encode compile time known bounds
-- if they do not match the natural machine type bounds, but this may
-- be removed in the future, since it is redundant for most debugging
-- formats. However, we do not ever need XD encoding for enumeration
-- base types, since here it is always clear what the bounds are from
-- the total number of enumeration literals.
-- typ___XD
-- typ___XDL_lowerbound
-- typ___XDU_upperbound
-- typ___XDLU_lowerbound__upperbound
-- If a discrete type is a natural machine type (i.e. its bounds
-- correspond in a natural manner to its size), then it is left
-- unencoded. The above encoding forms are used when there is a
-- constrained range that does not correspond to the size or that
-- has discriminant references or other compile time known bounds.
-- The first form is used if both bounds are dynamic, in which case two
-- constant objects are present whose names are typ___L and typ___U in
-- the same scope as typ, and the values of these constants indicate
-- the bounds. As far as the debugger is concerned, these are simply
-- variables that can be accessed like any other variables. In the
-- enumeration case, these values correspond to the Enum_Rep values for
-- the lower and upper bounds.
-- The second form is used if the upper bound is dynamic, but the lower
-- bound is either constant or depends on a discriminant of the record
-- with which the type is associated. The upper bound is stored in a
-- constant object of name typ___U as previously described, but the
-- lower bound is encoded directly into the name as either a decimal
-- integer, or as the discriminant name.
-- The third form is similarly used if the lower bound is dynamic, but
-- the upper bound is compile time known or a discriminant reference,
-- in which case the lower bound is stored in a constant object of name
-- typ___L, and the upper bound is encoded directly into the name as
-- either a decimal integer, or as the discriminant name.
-- The fourth form is used if both bounds are discriminant references
-- or compile time known values, with the encoding first for the lower
-- bound, then for the upper bound, as previously described.
-------------------
-- Modular Types --
-------------------
-- A type declared
-- type x is mod N;
-- Is encoded as a subrange of an unsigned base type with lower bound
-- zero and upper bound N. That is, there is no name encoding. We use
-- the standard encodings provided by the debugging format. Thus we
-- give these types a non-standard interpretation: the standard
-- interpretation of our encoding would not, in general, imply that
-- arithmetic on type x was to be performed modulo N (especially not
-- when N is not a power of 2).
------------------
-- Biased Types --
------------------
-- Only discrete types can be biased, and the fact that they are biased
-- is indicated by a suffix of the form:
-- typ___XB_lowerbound__upperbound
-- Here lowerbound and upperbound are decimal integers, with the usual
-- (postfix "m") encoding for negative numbers. Biased types are only
-- possible where the bounds are compile time known, and the values are
-- represented as unsigned offsets from the lower bound given. For
-- example:
-- type Q is range 10 .. 15;
-- for Q'size use 3;
-- The size clause will force values of type Q in memory to be stored
-- in biased form (e.g. 11 will be represented by the bit pattern 001).
----------------------------------------------
-- Record Types with Variable-Length Fields --
----------------------------------------------
-- The debugging formats do not fully support these types, and indeed
-- some formats simply generate no useful information at all for such
-- types. In order to provide information for the debugger, gigi creates
-- a parallel type in the same scope with one of the names
-- type___XVE
-- type___XVU
-- The former name is used for a record and the latter for the union
-- that is made for a variant record (see below) if that record or union
-- has a field of variable size or if the record or union itself has a
-- variable size. These encodings suffix any other encodings that that
-- might be suffixed to the type name.
-- The idea here is to provide all the needed information to interpret
-- objects of the original type in the form of a "fixed up" type, which
-- is representable using the normal debugging information.
-- There are three cases to be dealt with. First, some fields may have
-- variable positions because they appear after variable-length fields.
-- To deal with this, we encode *all* the field bit positions of the
-- special ___XV type in a non-standard manner.
-- The idea is to encode not the position, but rather information that
-- allows computing the position of a field from the position of the
-- previous field. The algorithm for computing the actual positions of
-- all fields and the length of the record is as follows. In this
-- description, let P represent the current bit position in the record.
-- 1. Initialize P to 0
-- 2. For each field in the record:
-- 2a. If an alignment is given (see below), then round P up, if
-- needed, to the next multiple of that alignment.
-- 2b. If a bit position is given, then increment P by that amount
-- (that is, treat it as an offset from the end of the preceding
-- record).
-- 2c. Assign P as the actual position of the field
-- 2d. Compute the length, L, of the represented field (see below)
-- and compute P'=P+L. Unless the field represents a variant part
-- (see below and also Variant Record Encoding), set P to P'.
-- The alignment, if present, is encoded in the field name of the
-- record, which has a suffix:
-- fieldname___XVAnn
-- where the nn after the XVA indicates the alignment value in storage
-- units. This encoding is present only if an alignment is present.
-- The size of the record described by an XVE-encoded type (in bits) is
-- generally the maximum value attained by P' in step 2d above, rounded
-- up according to the record's alignment.
-- Second, the variable-length fields themselves are represented by
-- replacing the type by a special access type. The designated type of
-- this access type is the original variable-length type, and the fact
-- that this field has been transformed in this way is signalled by
-- encoding the field name as:
-- field___XVL
-- where field is the original field name. If a field is both
-- variable-length and also needs an alignment encoding, then the
-- encodings are combined using:
-- field___XVLnn
-- Note: the reason that we change the type is so that the resulting
-- type has no variable-length fields. At least some of the formats used
-- for debugging information simply cannot tolerate variable- length
-- fields, so the encoded information would get lost.
-- Third, in the case of a variant record, the special union that
-- contains the variants is replaced by a normal C union. In this case,
-- the positions are all zero.
-- Discriminants appear before any variable-length fields that depend on
-- them, with one exception. In some cases, a discriminant governing the
-- choice of a variant clause may appear in the list of fields of an XVE
-- type after the entry for the variant clause itself (this can happen
-- in the presence of a representation clause for the record type in the
-- source program). However, when this happens, the discriminant's
-- position may be determined by first applying the rules described in
-- this section, ignoring the variant clause. As a result, discriminants
-- can always be located independently of the variable-length fields
-- that depend on them.
-- The size of the ___XVE or ___XVU record or union is set to the
-- alignment (in bytes) of the original object so that the debugger
-- can calculate the size of the original type.
-- As an example of this encoding, consider the declarations:
-- type Q is array (1 .. V1) of Float; -- alignment 4
-- type R is array (1 .. V2) of Long_Float; -- alignment 8
-- type X is record
-- A : Character;
-- B : Float;
-- C : String (1 .. V3);
-- D : Float;
-- E : Q;
-- F : R;
-- G : Float;
-- end record;
-- The encoded type looks like:
-- type anonymousQ is access Q;
-- type anonymousR is access R;
-- type X___XVE is record
-- A : Character; -- position contains 0
-- B : Float; -- position contains 24
-- C___XVL : access String (1 .. V3); -- position contains 0
-- D___XVA4 : Float; -- position contains 0
-- E___XVL4 : anonymousQ; -- position contains 0
-- F___XVL8 : anonymousR; -- position contains 0
-- G : Float; -- position contains 0
-- end record;
-- Any bit sizes recorded for fields other than dynamic fields and
-- variants are honored as for ordinary records.
-- Notes:
-- 1) The B field could also have been encoded by using a position of
-- zero and an alignment of 4, but in such a case the coding by position
-- is preferred (since it takes up less space). We have used the
-- (illegal) notation access xxx as field types in the example above.
-- 2) The E field does not actually need the alignment indication but
-- this may not be detected in this case by the conversion routines.
-- 3) Our conventions do not cover all XVE-encoded records in which
-- some, but not all, fields have representation clauses. Such records
-- may, therefore, be displayed incorrectly by debuggers. This situation
-- is not common.
-----------------------
-- Base Record Types --
-----------------------
-- Under certain circumstances, debuggers need two descriptions of a
-- record type, one that gives the actual details of the base type's
-- structure (as described elsewhere in these comments) and one that may
-- be used to obtain information about the particular subtype and the
-- size of the objects being typed. In such cases the compiler will
-- substitute type whose name is typically compiler-generated and
-- irrelevant except as a key for obtaining the actual type.
-- Specifically, if this name is x, then we produce a record type named
-- x___XVS consisting of one field. The name of this field is that of
-- the actual type being encoded, which we'll call y. The type of this
-- single field can be either an arbitrary non-reference type, e.g. an
-- integer type, or a reference type; in the latter case, the referenced
-- type is also the actual type being encoded y. Both x and y may have
-- corresponding ___XVE types.
-- The size of the objects typed as x should be obtained from the
-- structure of x (and x___XVE, if applicable) as for ordinary types
-- unless there is a variable named x___XVZ, which, if present, will
-- hold the size (in bytes) of x. In this latter case, the size of the
-- x___XVS type will not be a constant but a reference to x___XVZ.
-- The type x will either be a subtype of y (see also Subtypes of
-- Variant Records, below) or will contain a single field of type y,
-- or no fields at all. The layout, types, and positions of these
-- fields will be accurate, if present. (Currently, however, the GDB
-- debugger makes no use of x except to determine its size).
-- Among other uses, XVS types are used to encode unconstrained types.
-- For example, given:
--
-- subtype Int is INTEGER range 0..10;
-- type T1 (N: Int := 0) is record
-- F1: String (1 .. N);
-- end record;
-- type AT1 is array (INTEGER range <>) of T1;
--
-- the element type for AT1 might have a type defined as if it had
-- been written:
--
-- type at1___PAD is record F : T1; end record;
-- for at1___PAD'Size use 16 * 8;
--
-- and there would also be:
--
-- type at1___PAD___XVS is record t1: reft1; end record;
-- type t1 is ...
-- type reft1 is <reference to t1>
--
-- Had the subtype Int been dynamic:
--
-- subtype Int is INTEGER range 0 .. M; -- M a variable
--
-- Then the compiler would also generate a declaration whose effect
-- would be
--
-- at1___PAD___XVZ: constant Integer := 32 + M * 8 + padding term;
--
-- Not all unconstrained types are so encoded; the XVS convention may be
-- unnecessary for unconstrained types of fixed size. However, this
-- encoding is always necessary when a subcomponent type (array
-- element's type or record field's type) is an unconstrained record
-- type some of whose components depend on discriminant values.
-----------------
-- Array Types --
-----------------
-- Since there is no way for the debugger to obtain the index subtypes
-- for an array type, we produce a type that has the name of the array
-- type followed by "___XA" and is a record type whose field types are
-- the respective types for the bounds (and whose field names are the
-- names of these types).
-- To conserve space, we do not produce this type unless one of the
-- index types is either an enumeration type, has a variable lower or
-- upper bound or is a biased type.
-- Given the full encoding of these types (see above description for
-- the encoding of discrete types), this means that all necessary
-- information for addressing arrays is available. In some debugging
-- formats, some or all of the bounds information may be available
-- redundantly, particularly in the fixed-point case, but this
-- information can in any case be ignored by the debugger.
----------------------------
-- Note on Implicit Types --
----------------------------
-- The compiler creates implicit type names in many situations where a
-- type is present semantically, but no specific name is present. For
-- example:
-- S : Integer range M .. N;
-- Here the subtype of S is not integer, but rather an anonymous subtype
-- of Integer. Where possible, the compiler generates names for such
-- anonymous types that are related to the type from which the subtype
-- is obtained as follows:
-- T name suffix
-- where name is the name from which the subtype is obtained, using
-- lower case letters and underscores, and suffix starts with an upper
-- case letter. For example the name for the above declaration might be:
-- TintegerS4b
-- If the debugger is asked to give the type of an entity and the type
-- has the form T name suffix, it is probably appropriate to just use
-- "name" in the response since this is what is meaningful to the
-- programmer.
-------------------------------------------------
-- Subprograms for Handling Encoded Type Names --
-------------------------------------------------
procedure Get_Encoded_Name (E : Entity_Id);
-- If the entity is a typename, store the external name of the entity as in
-- Get_External_Name, followed by three underscores plus the type encoding
-- in Name_Buffer with the length in Name_Len, and an ASCII.NUL character
-- stored following the name. Otherwise set Name_Buffer and Name_Len to
-- hold the entity name. Note that a call to this procedure has no effect
-- if we are not generating code, since the necessary information for
-- computing the proper encoded name is not available in this case.
-- WARNING: There is a matching C declaration of this subprogram in fe.h
--------------
-- Renaming --
--------------
-- Debugging information is generated for exception, object, package, and
-- subprogram renaming (generic renamings are not significant, since
-- generic templates are not relevant at debugging time).
-- Consider a renaming declaration of the form
-- x : typ renames y;
-- There is one case in which no special debugging information is required,
-- namely the case of an object renaming where the back end allocates a
-- reference for the renamed variable, and the entity x is this reference.
-- The debugger can handle this case without any special processing or
-- encoding (it won't know it was a renaming, but that does not matter).
-- All other cases of renaming generate a dummy variable for an entity
-- whose name is of the form:
-- x___XR_... for an object renaming
-- x___XRE_... for an exception renaming
-- x___XRP_... for a package renaming
-- and where the "..." represents a suffix that describes the structure of
-- the object name given in the renaming (see details below).
-- The name is fully qualified in the usual manner, i.e. qualified in the
-- same manner as the entity x would be. In the case of a package renaming
-- where x is a child unit, the qualification includes the name of the
-- parent unit, to disambiguate child units with the same simple name and
-- (of necessity) different parents.
-- Note: subprogram renamings are not encoded at the present time
-- The suffix of the variable name describing the renamed object is defined
-- to use the following encoding:
-- For the simple entity case, where y is just an entity name, the suffix
-- is of the form:
-- y___XE
-- i.e. the suffix has a single field, the first part matching the
-- name y, followed by a "___" separator, ending with sequence XE.
-- The entity name portion is fully qualified in the usual manner.
-- This same naming scheme is followed for all forms of encoded
-- renamings that rename a simple entity.
-- For the object renaming case where y is a selected component or an
-- indexed component, the variable name is suffixed by additional fields
-- that give details of the components. The name starts as above with a
-- y___XE name indicating the outer level object entity. Then a series of
-- selections and indexing operations can be specified as follows:
-- Indexed component
-- A series of subscript values appear in sequence, the number
-- corresponds to the number of dimensions of the array. The
-- subscripts have one of the following two forms:
-- XSnnn
-- Here nnn is a constant value, encoded as a decimal integer
-- (pos value for enumeration type case). Negative values have
-- a trailing 'm' as usual.
-- XSe
-- Here e is the (unqualified) name of a constant entity in the
-- same scope as the renaming which contains the subscript value.
-- Slice
-- For the slice case, we have two entries. The first is for the
-- lower bound of the slice, and has the form:
-- XLnnn
-- XLe
-- Specifies the lower bound, using exactly the same encoding as
-- for an XS subscript as described above.
-- Then the upper bound appears in the usual XSnnn/XSe form
-- Selected component
-- For a selected component, we have a single entry
-- XRf
-- Here f is the field name for the selection
-- For an explicit dereference (.all), we have a single entry
-- XA
-- As an example, consider the declarations:
-- package p is
-- type q is record
-- m : string (2 .. 5);
-- end record;
--
-- type r is array (1 .. 10, 1 .. 20) of q;
--
-- g : r;
--
-- z : string renames g (1,5).m(2 ..3)
-- end p;
-- The generated variable entity would appear as
-- p__z___XR_p__g___XEXS1XS5XRmXL2XS3 : _renaming_type;
-- p__g___XE--------------------outer entity is g
-- XS1-----------------first subscript for g
-- XS5--------------second subscript for g
-- XRm-----------select field m
-- XL2--------lower bound of slice
-- XS3-----upper bound of slice
-- Note that the type of the variable is a special internal type named
-- _renaming_type. This type is an arbitrary type of zero size created
-- in package Standard (see cstand.adb) and is ignored by the debugger.
function Debug_Renaming_Declaration (N : Node_Id) return Node_Id;
-- The argument N is a renaming declaration. The result is a variable
-- declaration as described in the above paragraphs. If N is not a special
-- debug declaration, then Empty is returned. This function also takes care
-- of setting Materialize_Entity on the renamed entity where required.
---------------------------
-- Packed Array Encoding --
---------------------------
-- For every constrained packed array, two types are created, and both
-- appear in the debugging output:
-- The original declared array type is a perfectly normal array type, and
-- its index bounds indicate the original bounds of the array.
-- The corresponding packed array type, which may be a modular type, or
-- may be an array of bytes type (see Exp_Pakd for full details). This is
-- the type that is actually used in the generated code and for debugging
-- information for all objects of the packed type.
-- The name of the corresponding packed array type is:
-- ttt___XPnnn
-- where
-- ttt is the name of the original declared array
-- nnn is the component size in bits (1-31)
-- Note that if the packed array is not bit-packed, the name will simply
-- be tttP.
-- When the debugger sees that an object is of a type that is encoded in
-- this manner, it can use the original type to determine the bounds and
-- the component type, and the component size to determine the packing
-- details.
-- For an unconstrained packed array, the corresponding packed array type
-- is neither used in the generated code nor for debugging information,
-- only the original type is used. In order to convey the packing in the
-- debugging information, the compiler generates the associated fat- and
-- thin-pointer types (see the Pointers to Unconstrained Array section
-- below) using the name of the corresponding packed array type as the
-- base name, i.e. ttt___XPnnn___XUP and ttt___XPnnn___XUT respectively.
-- When the debugger sees that an object is of a type that is encoded in
-- this manner, it can use the type of the fields to determine the bounds
-- and the component type, and the component size to determine the packing
-- details.
-------------------------------------------
-- Packed Array Representation in Memory --
-------------------------------------------
-- Packed arrays are represented in tightly packed form, with no extra bits
-- between components. This is true even when the component size is not a
-- factor of the storage unit size, so that as a result it is possible for
-- components to cross storage unit boundaries.
-- The layout in storage is identical, regardless of whether the
-- implementation type is a modular type or an array-of-bytes type. See
-- Exp_Pakd for details of how these implementation types are used, but for
-- the purpose of the debugger, only the starting address of the object in
-- memory is significant.
-- The following example should show clearly how the packing works in
-- the little-endian and big-endian cases:
-- type B is range 0 .. 7;
-- for B'Size use 3;
-- type BA is array (0 .. 5) of B;
-- pragma Pack (BA);
-- BV : constant BA := (1,2,3,4,5,6);
-- Little endian case
-- BV'Address + 2 BV'Address + 1 BV'Address + 0
-- +-----------------+-----------------+-----------------+
-- | ? ? ? ? ? ? 1 1 | 0 1 0 1 1 0 0 0 | 1 1 0 1 0 0 0 1 |
-- +-----------------+-----------------+-----------------+
-- <---------> <-----> <---> <---> <-----> <---> <--->
-- unused bits BV(5) BV(4) BV(3) BV(2) BV(1) BV(0)
--
-- Big endian case
--
-- BV'Address + 0 BV'Address + 1 BV'Address + 2
-- +-----------------+-----------------+-----------------+
-- | 0 0 1 0 1 0 0 1 | 1 1 0 0 1 0 1 1 | 1 0 ? ? ? ? ? ? |
-- +-----------------+-----------------+-----------------+
-- <---> <---> <-----> <---> <---> <-----> <--------->
-- BV(0) BV(1) BV(2) BV(3) BV(4) BV(5) unused bits
-- Note that if a modular type is used to represent the array, the
-- allocation in memory is not the same as a normal modular type. The
-- difference occurs when the allocated object is larger than the size of
-- the array. For a normal modular type, we extend the value on the left
-- with zeroes.
-- For example, in the normal modular case, if we have a 6-bit modular
-- type, declared as mod 2**6, and we allocate an 8-bit object for this
-- type, then we extend the value with two bits on the most significant
-- end, and in either the little-endian or big-endian case, the value 63
-- is represented as 00111111 in binary in memory.
-- For a modular type used to represent a packed array, the rule is
-- different. In this case, if we have to extend the value, then we do it
-- with undefined bits (which are not initialized and whose value is
-- irrelevant to any generated code). Furthermore these bits are on the
-- right (least significant bits) in the big-endian case, and on the left
-- (most significant bits) in the little-endian case.
-- For example, if we have a packed boolean array of 6 bits, all set to
-- True, stored in an 8-bit object, then the value in memory in binary is
-- ??111111 in the little-endian case, and 111111?? in the big-endian case.
-- This is done so that the representation of packed arrays does not
-- depend on whether we use a modular representation or array of bytes
-- as previously described. This ensures that we can pass such values by
-- reference in the case where a subprogram has to be able to handle values
-- stored in either form.
-- Note that when we extract the value of such a modular packed array, we
-- expect to retrieve only the relevant bits, so in this same example, when
-- we extract the value we get 111111 in both cases, and the code generated
-- by the front end assumes this although it does not assume that any high
-- order bits are defined.
-- There are opportunities for optimization based on the knowledge that the
-- unused bits are irrelevant for these type of packed arrays. For example
-- if we have two such 6-bit-in-8-bit values and we do an assignment:
-- a := b;
-- Then logically, we extract the 6 bits and store only 6 bits in the
-- result, but the back end is free to simply assign the entire 8-bits in
-- this case, since we don't actually care about the undefined bits.
-- However, in the equality case, it is important to ensure that the
-- undefined bits do not participate in an equality test.
-- If a modular packed array value is assigned to a register then logically
-- it could always be held right justified, to avoid any need to shift,
-- e.g. when doing comparisons. But probably this is a bad choice, as it
-- would mean that an assignment such as a := above would require shifts
-- when one value is in a register and the other value is in memory.
------------------------------------------------------
-- Subprograms for Handling Packed Array Type Names --
------------------------------------------------------
function Make_Packed_Array_Impl_Type_Name
(Typ : Entity_Id;
Csize : Uint) return Name_Id;
-- This function is used in Exp_Pakd to create the name that is encoded as
-- described above. The entity Typ provides the name ttt, and the value
-- Csize is the component size that provides the nnn value.
--------------------------------------
-- Pointers to Unconstrained Arrays --
--------------------------------------
-- There are two kinds of pointers to arrays. The debugger can tell which
-- format is in use by the form of the type of the pointer.
-- Fat Pointers
-- Fat pointers are represented as a struct with two fields. This
-- struct has two distinguished field names:
-- P_ARRAY is a pointer to the array type. The name of this type is
-- the unconstrained type followed by "___XUA". This array will have
-- bounds which are the discriminants, and hence are unparsable, but
-- will give the number of subscripts and the component type.
-- P_BOUNDS is a pointer to a struct, the name of whose type is the
-- unconstrained array name followed by "___XUB" and which has
-- fields of the form
-- LBn (n a decimal integer) lower bound of n'th dimension
-- UBn (n a decimal integer) upper bound of n'th dimension
-- The bounds may be any integral type. In the case of an enumeration
-- type, Enum_Rep values are used.
-- For a given unconstrained array type, the compiler will generate one
-- fat-pointer type whose name is "arr___XUP", where "arr" is the name
-- of the array type, and use it to represent the array type itself in
-- the debugging information.
-- For each pointer to this unconstrained array type, the compiler will
-- generate a typedef that points to the above "arr___XUP" fat-pointer
-- type. As a consequence, when it comes to fat-pointer types:
-- 1. The type name is given by the typedef
-- 2. If the debugger is asked to output the type, the appropriate
-- form is "access arr", except if the type name is "arr___XUP"
-- for which it is the array definition.
-- Thin Pointers
-- The value of a thin pointer is a pointer to the second field of a
-- structure with two fields. The name of this structure's type is
-- "arr___XUT", where "arr" is the name of the unconstrained array
-- type. Even though it actually points into middle of this structure,
-- the thin pointer's type in debugging information is
-- pointer-to-arr___XUT.
-- The first field of arr___XUT is named BOUNDS, and has a type named
-- arr___XUB, with the structure described for such types in fat
-- pointers, as described above.
-- The second field of arr___XUT is named ARRAY, and contains the
-- actual array. Because this array has a dynamic size, determined by
-- the BOUNDS field that precedes it, all of the information about
-- arr___XUT is encoded in a parallel type named arr___XUT___XVE, with
-- fields BOUNDS and ARRAY___XVL. As for previously described ___XVE
-- types, ARRAY___XVL has a pointer-to-array type. However, the array
-- type in this case is named arr___XUA and only its element type is
-- meaningful, just as described for fat pointers.
--------------------------------------
-- Tagged Types and Type Extensions --
--------------------------------------
-- A type C derived from a tagged type P has a field named "_parent" of
-- type P that contains its inherited fields. The type of this field is
-- usually P (encoded as usual if it has a dynamic size), but may be a more
-- distant ancestor, if P is a null extension of that type.
-- The type tag of a tagged type is a field named _tag, of type void*. If
-- the type is derived from another tagged type, its _tag field is found in
-- its _parent field.
-----------------------------
-- Variant Record Encoding --
-----------------------------
-- The variant part of a variant record is encoded as a single field in the
-- enclosing record, whose name is:
-- discrim___XVN
-- where discrim is the unqualified name of the variant. This field name is
-- built by gigi (not by code in this unit). For Unchecked_Union record,
-- this discriminant will not appear in the record (see Unchecked Unions,
-- below).
-- The type corresponding to this field has a name that is obtained by
-- concatenating the type name with the above string and is similar to a C
-- union, in which each member of the union corresponds to one variant.
-- However, unlike a C union, the size of the type may be variable even if
-- each of the components are fixed size, since it includes a computation
-- of which variant is present. In that case, it will be encoded as above
-- and a type with the suffix "___XVN___XVU" will be present.
-- The name of the union member is encoded to indicate the choices, and
-- is a string given by the following grammar:
-- member_name ::= {choice} | others_choice
-- choice ::= simple_choice | range_choice
-- simple_choice ::= S number
-- range_choice ::= R number T number
-- number ::= {decimal_digit} [m]
-- others_choice ::= O (upper case letter O)
-- The m in a number indicates a negative value. As an example of this
-- encoding scheme, the choice 1 .. 4 | 7 | -10 would be represented by
-- R1T4S7S10m
-- In the case of enumeration values, the values used are the actual
-- representation values in the case where an enumeration type has an
-- enumeration representation spec (i.e. they are values that correspond
-- to the use of the Enum_Rep attribute).
-- The type of the inner record is given by the name of the union type (as
-- above) concatenated with the above string. Since that type may itself be
-- variable-sized, it may also be encoded as above with a new type with a
-- further suffix of "___XVU".
-- As an example, consider:
-- type Var (Disc : Boolean := True) is record
-- M : Integer;
-- case Disc is
-- when True =>
-- R : Integer;
-- S : Integer;
-- when False =>
-- T : Integer;
-- end case;
-- end record;
-- V1 : Var;
-- In this case, the type var is represented as a struct with three fields.
-- The first two are "disc" and "m", representing the values of these
-- record components. The third field is a union of two types, with field
-- names S1 and O. S1 is a struct with fields "r" and "s", and O is a
-- struct with field "t".
----------------------
-- Unchecked Unions --
----------------------
-- The encoding for variant records changes somewhat under the influence
-- of a "pragma Unchecked_Union" clause:
-- 1. The discriminant will not be present in the record, although its
-- name is still used in the encodings.
-- 2. Variants containing a single component named "x" of type "T" may
-- be encoded, as in ordinary C unions, as a single field of the
-- enclosing union type named "x" of type "T", dispensing with the
-- enclosing struct. In this case, of course, the discriminant values
-- corresponding to the variant are unavailable. As for normal
-- variants, the field name "x" may be suffixed with ___XVL if it
-- has dynamic size.
-- For example, the type Var in the preceding section, if followed by
-- "pragma Unchecked_Union (Var);" may be encoded as a struct with two
-- fields. The first is "m". The second field is a union of two types,
-- with field names S1 and "t". As before, S1 is a struct with fields
-- "r" and "s". "t" is a field of type Integer.
------------------------------------------------
-- Subprograms for Handling Variant Encodings --
------------------------------------------------
procedure Get_Variant_Encoding (V : Node_Id);
-- This procedure is called by Gigi with V being the variant node. The
-- corresponding encoding string is returned in Name_Buffer with the length
-- of the string in Name_Len, and an ASCII.NUL character stored following
-- the name.
-- WARNING: There is a matching C declaration of this subprogram in fe.h
---------------------------------
-- Subtypes of Variant Records --
---------------------------------
-- A subtype of a variant record is represented by a type in which the
-- union field from the base type is replaced by one of the possible
-- values. For example, if we have:
-- type Var (Disc : Boolean := True) is record
-- M : Integer;
-- case Disc is
-- when True =>
-- R : Integer;
-- S : Integer;
-- when False =>
-- T : Integer;
-- end case;
-- end record;
-- V1 : Var;
-- V2 : Var (True);
-- V3 : Var (False);
-- Here V2, for example, is represented with a subtype whose name is
-- something like TvarS3b, which is a struct with three fields. The first
-- two fields are "disc" and "m" as for the base type, and the third field
-- is S1, which contains the fields "r" and "s".
-- The debugger should simply ignore structs with names of the form
-- corresponding to variants, and consider the fields inside as belonging
-- to the containing record.
-----------------------------------------------
-- Extra renamings for subprogram instances --
-----------------------------------------------
procedure Build_Subprogram_Instance_Renamings
(N : Node_Id;
Wrapper : Entity_Id);
-- The debugger has difficulties in recovering the value of actuals of an
-- elementary type, from within the body of a subprogram instantiation.
-- This is because such actuals generate an object declaration that is
-- placed within the wrapper package of the instance, and the entity in
-- these declarations is encoded in a complex way that GDB does not handle
-- well. These new renaming declarations appear within the body of the
-- subprogram, and are redundant from a visibility point of view, but They
-- should have no measurable performance impact, and require no special
-- decoding in the debugger.
-------------------------------------------
-- Character literals in Character Types --
-------------------------------------------
-- Character types are enumeration types at least one of whose enumeration
-- literals is a character literal. Enumeration literals are usually simply
-- represented using their identifier names. If the enumeration literal is
-- a character literal, the name is encoded as described in the following
-- paragraph.
-- The characters 'a'..'z' and '0'..'9' are represented as Qc, where 'c'
-- stands for the character itself. A name QUhh, where each 'h' is a
-- lower-case hexadecimal digit, stands for a character whose Unicode
-- encoding is hh, and QWhhhh likewise stands for a wide character whose
-- encoding is hhhh. The representation values are encoded as for ordinary
-- enumeration literals (and have no necessary relationship to the values
-- encoded in the names).
-- For example, given the type declaration
-- type x is (A, 'C', 'b');
-- the second enumeration literal would be named QU43 and the value
-- assigned to it would be 1, and the third enumeration literal would be
-- named Qb and the value assigned to it would be 2.
-----------------------------------------------
-- Secondary Dispatch tables of tagged types --
-----------------------------------------------
procedure Get_Secondary_DT_External_Name
(Typ : Entity_Id;
Ancestor_Typ : Entity_Id;
Suffix_Index : Int);
-- Set Name_Buffer and Name_Len to the external name of one secondary
-- dispatch table of Typ. If the interface has been inherited from some
-- ancestor then Ancestor_Typ is such node (in this case the secondary DT
-- is needed to handle overridden primitives); if there is no such ancestor
-- then Ancestor_Typ is equal to Typ.
--
-- Internal rule followed for the generation of the external name:
--
-- Case 1. If the secondary dispatch has not been inherited from some
-- ancestor of Typ then the external name is composed as
-- follows:
-- External_Name (Typ) + Suffix_Number + 'P'
--
-- Case 2. if the secondary dispatch table has been inherited from some
-- ancestor then the external name is composed as follows:
-- External_Name (Typ) + '_' + External_Name (Ancestor_Typ)
-- + Suffix_Number + 'P'
--
-- Note: We have to use the external names (instead of simply their names)
-- to protect the frontend against programs that give the same name to all
-- the interfaces and use the expanded name to reference them. The
-- Suffix_Number is used to differentiate all the secondary dispatch
-- tables of a given type.
--
-- Examples:
--
-- package Pkg1 is | package Pkg2 is | package Pkg3 is
-- type Typ is | type Typ is | type Typ is
-- interface; | interface; | interface;
-- end Pkg1; | end Pkg; | end Pkg3;
--
-- with Pkg1, Pkg2, Pkg3;
-- package Case_1 is
-- type Typ is new Pkg1.Typ and Pkg2.Typ and Pkg3.Typ with ...
-- end Case_1;
--
-- with Case_1;
-- package Case_2 is
-- type Typ is new Case_1.Typ with ...
-- end Case_2;
--
-- These are the external names generated for Case_1.Typ (note that
-- Pkg1.Typ is associated with the Primary Dispatch Table, because it
-- is the parent of this type, and hence no external name is
-- generated for it).
-- case_1__typ0P (associated with Pkg2.Typ)
-- case_1__typ1P (associated with Pkg3.Typ)
--
-- These are the external names generated for Case_2.Typ:
-- case_2__typ_case_1__typ0P
-- case_2__typ_case_1__typ1P
----------------------------
-- Effect of Optimization --
----------------------------
-- If the program is compiled with optimization on (e.g. -O1 switch
-- specified), then there may be variations in the output from the above
-- specification. In particular, objects may disappear from the output.
-- This includes not only constants and variables that the program declares
-- at the source level, but also the x___L and x___U constants created to
-- describe the lower and upper bounds of subtypes with dynamic bounds.
-- This means for example, that array bounds may disappear if optimization
-- is turned on. The debugger is expected to recognize that these constants
-- are missing and deal as best as it can with the limited information
-- available.
---------------------------------
-- GNAT Extensions to DWARF2/3 --
---------------------------------
-- If the compiler switch "-gdwarf+" is specified, GNAT Vendor extensions
-- to DWARF2/3 are generated, with the following variations from the above
-- specification.
-- Change in the contents of the DW_AT_name attribute
-- The operators are represented in their natural form. (for example,
-- the addition operator is written as "+" instead of "Oadd"). The
-- component separator is "." instead of "__"
-- Introduction of DW_AT_GNAT_encoding, encoded with value 0x2301
-- Any debugging information entry representing a program entity, named
-- or implicit, may have a DW_AT_GNAT_encoding attribute. The value of
-- this attribute is a string representing the suffix internally added
-- by GNAT for various purposes, mainly for representing debug
-- information compatible with other formats. In particular this is
-- useful for IDEs which need to filter out information internal to
-- GNAT from their graphical interfaces.
-- If a debugging information entry has multiple encodings, all of them
-- will be listed in DW_AT_GNAT_encoding using the list separator ':'.
-- Introduction of DW_AT_GNAT_descriptive_type, encoded with value 0x2302
-- Any debugging information entry representing a type may have a
-- DW_AT_GNAT_descriptive_type attribute whose value is a reference,
-- pointing to a debugging information entry representing another type
-- associated to the type.
-- Modification of the contents of the DW_AT_producer string
-- When emitting full GNAT Vendor extensions to DWARF2/3, "-gdwarf+"
-- is appended to the DW_AT_producer string.
--
-- When emitting only DW_AT_GNAT_descriptive_type, "-gdwarf+-" is
-- appended to the DW_AT_producer string.
end Exp_Dbug;
|
with Ada.Text_IO; use Ada.Text_IO;
procedure Test is begin if true or 'a' then new_line; end if; end;
|
-- { dg-excess-errors "cannot generate code" }
package Concat1_Pkg is
function Id_For (Name : String) return Natural;
function Image_Of return String;
end Concat1_Pkg;
|
------------------------------------------------------------------------------
-- --
-- GNAT COMPILER COMPONENTS --
-- --
-- S Y S T E M . V A X _ F L O A T _ O P E R A T I O N S --
-- --
-- S p e c --
-- --
-- Copyright (C) 1997-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. --
-- --
-- --
-- --
-- --
-- --
-- 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 runtime routines for handling the non-IEEE
-- floating-point formats used on the Vax and the Alpha.
package System.Vax_Float_Operations is
pragma Warnings (Off);
-- Suppress warnings if not on Alpha/VAX
type D is digits 9;
pragma Float_Representation (VAX_Float, D);
-- D Float type on Vax
type G is digits 15;
pragma Float_Representation (VAX_Float, G);
-- G Float type on Vax
type F is digits 6;
pragma Float_Representation (VAX_Float, F);
-- F Float type on Vax
type S is digits 6;
pragma Float_Representation (IEEE_Float, S);
-- IEEE short
type T is digits 15;
pragma Float_Representation (IEEE_Float, T);
-- IEEE long
pragma Warnings (On);
type Q is range -2 ** 63 .. +(2 ** 63 - 1);
-- 64-bit signed integer
--------------------------
-- Conversion Functions --
--------------------------
function D_To_G (X : D) return G;
function G_To_D (X : G) return D;
-- Conversions between D float and G float
function G_To_F (X : G) return F;
function F_To_G (X : F) return G;
-- Conversions between F float and G float
function F_To_S (X : F) return S;
function S_To_F (X : S) return F;
-- Conversions between F float and IEEE short
function G_To_T (X : G) return T;
function T_To_G (X : T) return G;
-- Conversions between G float and IEEE long
function F_To_Q (X : F) return Q;
function Q_To_F (X : Q) return F;
-- Conversions between F float and 64-bit integer
function G_To_Q (X : G) return Q;
function Q_To_G (X : Q) return G;
-- Conversions between G float and 64-bit integer
function T_To_D (X : T) return D;
-- Conversion from IEEE long to D_Float (used for literals)
--------------------------
-- Arithmetic Functions --
--------------------------
function Abs_F (X : F) return F;
function Abs_G (X : G) return G;
-- Absolute value of F/G float
function Add_F (X, Y : F) return F;
function Add_G (X, Y : G) return G;
-- Addition of F/G float
function Div_F (X, Y : F) return F;
function Div_G (X, Y : G) return G;
-- Division of F/G float
function Mul_F (X, Y : F) return F;
function Mul_G (X, Y : G) return G;
-- Multiplication of F/G float
function Neg_F (X : F) return F;
function Neg_G (X : G) return G;
-- Negation of F/G float
function Sub_F (X, Y : F) return F;
function Sub_G (X, Y : G) return G;
-- Subtraction of F/G float
--------------------------
-- Comparison Functions --
--------------------------
function Eq_F (X, Y : F) return Boolean;
function Eq_G (X, Y : G) return Boolean;
-- Compares for X = Y
function Le_F (X, Y : F) return Boolean;
function Le_G (X, Y : G) return Boolean;
-- Compares for X <= Y
function Lt_F (X, Y : F) return Boolean;
function Lt_G (X, Y : G) return Boolean;
-- Compares for X < Y
function Ne_F (X, Y : F) return Boolean;
function Ne_G (X, Y : G) return Boolean;
-- Compares for X /= Y
----------------------
-- Return Functions --
----------------------
function Return_D (X : D) return D;
function Return_F (X : F) return F;
function Return_G (X : G) return G;
-- Deal with returned value for an imported function where the function
-- result is of VAX Float type. Usually nothing needs to be done, and these
-- functions return their argument unchanged. But for the case of VMS Alpha
-- the return value is already in $f0, so we need to trick the compiler
-- into thinking that we are moving X to $f0. See bodies for this case
-- for the Asm sequence generated to achieve this.
----------------------------------
-- Routines for Valid Attribute --
----------------------------------
function Valid_D (Arg : D) return Boolean;
function Valid_F (Arg : F) return Boolean;
function Valid_G (Arg : G) return Boolean;
-- Test whether Arg has a valid representation
----------------------
-- Debug Procedures --
----------------------
procedure Debug_Output_D (Arg : D);
procedure Debug_Output_F (Arg : F);
procedure Debug_Output_G (Arg : G);
pragma Export (Ada, Debug_Output_D);
pragma Export (Ada, Debug_Output_F);
pragma Export (Ada, Debug_Output_G);
-- These routines output their argument in decimal string form, with
-- no terminating line return. They are provided for implicit use by
-- the pre gnat-3.12w GDB, and are retained for backwards compatibility.
function Debug_String_D (Arg : D) return System.Address;
function Debug_String_F (Arg : F) return System.Address;
function Debug_String_G (Arg : G) return System.Address;
pragma Export (Ada, Debug_String_D);
pragma Export (Ada, Debug_String_F);
pragma Export (Ada, Debug_String_G);
-- These routines return a decimal C string image of their argument.
-- They are provided for implicit use by the debugger, in response to
-- the special encoding used for Vax floating-point types (see Exp_Dbug
-- for details). They supersede the above Debug_Output_D/F/G routines
-- which didn't work properly with GDBTK.
procedure pd (Arg : D);
procedure pf (Arg : F);
procedure pg (Arg : G);
pragma Export (Ada, pd);
pragma Export (Ada, pf);
pragma Export (Ada, pg);
-- These are like the Debug_Output_D/F/G procedures except that they
-- output a line return after the output. They were originally present
-- for direct use in GDB before GDB recognized Vax floating-point
-- types, and are retained for backwards compatibility.
private
pragma Inline_Always (D_To_G);
pragma Inline_Always (F_To_G);
pragma Inline_Always (F_To_Q);
pragma Inline_Always (F_To_S);
pragma Inline_Always (G_To_D);
pragma Inline_Always (G_To_F);
pragma Inline_Always (G_To_Q);
pragma Inline_Always (G_To_T);
pragma Inline_Always (Q_To_F);
pragma Inline_Always (Q_To_G);
pragma Inline_Always (S_To_F);
pragma Inline_Always (T_To_G);
pragma Inline_Always (Abs_F);
pragma Inline_Always (Abs_G);
pragma Inline_Always (Add_F);
pragma Inline_Always (Add_G);
pragma Inline_Always (Div_G);
pragma Inline_Always (Div_F);
pragma Inline_Always (Mul_F);
pragma Inline_Always (Mul_G);
pragma Inline_Always (Neg_G);
pragma Inline_Always (Neg_F);
pragma Inline_Always (Return_D);
pragma Inline_Always (Return_F);
pragma Inline_Always (Return_G);
pragma Inline_Always (Sub_F);
pragma Inline_Always (Sub_G);
pragma Inline_Always (Eq_F);
pragma Inline_Always (Eq_G);
pragma Inline_Always (Le_F);
pragma Inline_Always (Le_G);
pragma Inline_Always (Lt_F);
pragma Inline_Always (Lt_G);
pragma Inline_Always (Ne_F);
pragma Inline_Always (Ne_G);
pragma Inline_Always (Valid_D);
pragma Inline_Always (Valid_F);
pragma Inline_Always (Valid_G);
end System.Vax_Float_Operations;
|
-- ----------------------------------------------------------------- --
-- --
-- This 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 software 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. --
-- --
-- ----------------------------------------------------------------- --
-- ----------------------------------------------------------------- --
-- This is a translation, to the Ada programming language, of the --
-- original C test files written by Sam Lantinga - www.libsdl.org --
-- translation made by Antonio F. Vargas - www.adapower.net/~avargas --
-- ----------------------------------------------------------------- --
-- ---------------------------------------------------------------
-- This is a possible translation to Ada of the program loopwave.c
-- originally writen by -- Sam Lantinga.--
-- Translation made by -- A. M. F. Vargas --
-- ---------------------------------------------------------------
-- Program to load a wave file and loop playing it using SDL sound
-- This is only for simple WAVEs
-- ----------------------------------------------------------------- --
-- WARNING WARNING WARNING WARNING WARNING WARNING WARNING WARNING
-- ----------------------------------------------------------------- --
-- SERIOUS WARNING: The Ada code in this files may, at some points,
-- rely directly on pointer arithmetic which is considered very
-- unsafe and PRONE TO ERROR. The AdaSDL_Mixer examples are
-- more appropriate and easier to understand. They should be used in
-- replacement of this files. Please go there.
-- This file exists only for the sake of completness and to test
-- AdaSDL without the dependency of AdaSDL_Mixer.
-- ----------------------------------------------------------------- --
-- WARNING WARNING WARNING WARNING WARNING WARNING WARNING WARNING
-- ----------------------------------------------------------------- --
with System.OS_Interface;
with Interfaces.C.Strings;
with Ada.Command_Line; use Ada.Command_Line;
with Ada.Text_IO; use Ada.Text_IO;
with GNAT.OS_Lib;
with SDL.Types; use SDL.Types;
with SDL.Timer;
with SDL.Error;
with SDL.Audio;
with SDL.Quit;
with Lib_C;
with Loopwave_Callback; use Loopwave_Callback;
procedure Loopwave is
-- These could be avoided with use clauses.
-- but I like to trace the origin of things
package A renames SDL.Audio;
package C renames Interfaces.C;
package CS renames Interfaces.C.Strings;
package Er renames SDL.Error;
package T renames SDL.Timer;
use type C.int;
use type A.audiostatus;
use type A.AudioSpec_ptr;
-- -------------------------------------
name : CS.chars_ptr :=
CS.New_String (" ");
Valid_WAV : Boolean := True;
begin
-- Load the SDL library
if SDL.Init (SDL.INIT_AUDIO) < 0 then
Put_Line ("Couldn't load SDL: " & Er.Get_Error);
GNAT.OS_Lib.OS_Exit (1);
end if;
SDL.Quit.atexit (SDL.SDL_Quit'Access);
if Argument_Count = 0 then
Put_Line ("Usage: " & Command_Name & " <wavefile>");
GNAT.OS_Lib.OS_Exit (1);
end if;
-- Load the wave file into memory
-- A.Load_WAV (
-- CS.New_String (Argument (1)),
-- wave.spec,
-- wave.sound,
-- wave.soundlen,
-- Valid_WAV);
A.Load_WAV (
CS.New_String (Argument (1)),
wave.spec'Access,
wave.sound'Access,
wave.soundlen'Access,
Valid_WAV);
if not Valid_WAV then
Put_Line("Couldn't load " & Argument (1) & Er.Get_Error);
GNAT.OS_Lib.OS_Exit (1);
end if;
wave.spec.callback := fillerup'Access;
-- Set the signals
-- #ifdef SIGHUP
-- Lib_C.Set_Signal (System.OS_Interface.SIGHUP, poked'Access);
-- #endif
Lib_C.Set_Signal (System.OS_Interface.SIGINT, poked'Access);
-- #ifdef SIGQUIT
-- Lib_C.Set_Signal (System.OS_Interface.SIGQUIT, poked'Access);
-- #endif
Lib_C.Set_Signal (System.OS_Interface.SIGTERM, poked'Access);
-- Initialize fillrup variables
if A.OpenAudio(wave.spec'Access, null) < 0 then
Put_Line ("Couldn't open audio: " & Er.Get_Error);
A.FreeWAV (wave.sound);
GNAT.OS_Lib.OS_Exit (2);
end if;
A.PauseAudio (0);
-- Let the audio run
Put_Line ("using audio driver: " &
CS.Value (A.AudioDriverName (
name,
32)));
declare
i : Integer := 0;
begin
while done = 0 and A.GetAudioStatus = A.AUDIO_PLAYING loop
T.SDL_Delay (1000);
end loop;
end;
Put_Line ("Closing audio");
A.CloseAudio;
Put_Line ("Free WAV");
A.FreeWAV (wave.sound);
Put_Line ("The End");
end Loopwave;
|
-- BinToAsc_Example
-- Binary data to/from ASCII codecs example
-- Copyright (c) 2015, James Humphry - see LICENSE file for details
with Ada.Text_IO;
use Ada.Text_IO;
with String_To_Storage_Array;
with Storage_Array_To_String;
with Storage_Array_To_Hex_String;
with RFC4648, ASCII85;
use RFC4648, ASCII85;
with System.Storage_Elements;
procedure BinToAsc_Example is
Z85_Test_Vector : constant System.Storage_Elements.Storage_Array :=
(16#86#, 16#4F#, 16#D2#, 16#6F#,
16#B5#, 16#59#, 16#F7#, 16#5B#);
begin
Put_Line("Examples of using the BinToAsc package.");
New_Line;
-- Demonstrate coding into Base16
Put_Line("According to RFC4648 Base16('foobar') = '666F6F626172'");
Put("According to this package Base16('foobar') = '");
Put(Base16.To_String(String_To_Storage_Array("foobar")));
Put_Line("'");
New_Line;
-- Demonstrate decoding from Base16
Put_Line("According to RFC4648 Base16^{-1}('666F6F626172') = 'foobar'");
Put("According to this package Base16^{-1}('666F6F626172') = '");
Put(Storage_Array_To_String(Base16.To_Bin("666F6F626172")));
Put_Line("'");
New_Line;
-- Demonstrate coding into Base32
Put_Line("According to RFC4648 Base32('foobar') = 'MZXW6YTBOI======'");
Put("According to this package Base32('foobar') = '");
Put(Base32.To_String(String_To_Storage_Array("foobar")));
Put_Line("'");
New_Line;
-- Demonstrate decoding from Base32
Put_Line("According to RFC4648 Base32^{-1}('MZXW6YTBOI======') = 'foobar'");
Put("According to this package Base32^{-1}('MZXW6YTBOI======') = '");
Put(Storage_Array_To_String(Base32.To_Bin("MZXW6YTBOI======")));
Put_Line("'");
New_Line;
-- Demonstrate decoding from Base32 with homoglyphs
Put_Line("According to RFC4648 with homoglphs permitted Base32^{-1}('MZXW6YTB01======') = 'foobar'");
Put("According to this package with homoglphs permitted Base32^{-1}('MZXW6YTB01======') = '");
Put(Storage_Array_To_String(Base32_Allow_Homoglyphs.To_Bin("MZXW6YTB01======")));
Put_Line("'");
New_Line;
-- Demonstrate coding into Base32Hex
Put_Line("According to RFC4648 Base32Hex('foobar') = 'CPNMUOJ1E8======'");
Put("According to this package Base32Hex('foobar') = '");
Put(Base32Hex.To_String(String_To_Storage_Array("foobar")));
Put_Line("'");
New_Line;
-- Demonstrate decoding from Base32Hex
Put_Line("According to RFC4648 Base32Hex^{-1}('CPNMUOJ1E8======') = 'foobar'");
Put("According to this package Base32Hex^{-1}('CPNMUOJ1E8======') = '");
Put(Storage_Array_To_String(Base32Hex.To_Bin("CPNMUOJ1E8======")));
Put_Line("'");
New_Line;
-- Demonstrate coding into Base64
Put_Line("According to RFC4648 Base64('foobar') = 'Zm9vYmFy'");
Put("According to this package Base16('foobar') = '");
Put(Base64.To_String(String_To_Storage_Array("foobar")));
Put_Line("'");
New_Line;
Put_Line("According to RFC4648 Base64('foob') = 'Zm9vYg=='");
Put("According to this package Base16('foob') = '");
Put(Base64.To_String(String_To_Storage_Array("foob")));
Put_Line("'");
New_Line;
-- Demonstrate decoding from Base64
Put_Line("According to RFC4648 Base64^{-1}('Zm8=') = 'fo'");
Put("According to this package Base64^{-1}('Zm8=') = '");
Put(Storage_Array_To_String(Base64.To_Bin("Zm8=")));
Put_Line("'");
New_Line;
-- Demonstrate coding into Z85
Put_Line("According to Z85 spec Z85(86,4F,D2,6F,B5,59,F7,5B) = 'HelloWorld'");
Put("According to this package Z85(86,4F,D2,6F,B5,59,F7,5B) = '");
Put(Z85.To_String(Z85_Test_Vector));
Put_Line("'");
New_Line;
-- Demonstrate decoding from Z85
Put_Line("According to Z85 spec Z85^{-1}('HelloWorld') = '86,4F,D2,6F,B5,59,F7,5B'");
Put("According to this package Z85^{-1}('HelloWorld') = '");
Put(Storage_Array_To_Hex_String(Z85.To_Bin("HelloWorld")));
Put_Line("'");
New_Line;
end BinToAsc_Example;
|
with System.Address_To_Constant_Access_Conversions;
with System.Wide_Startup; -- force to be an unicode application
with System.Zero_Terminated_WStrings;
with C.winnt;
package body System.Native_Command_Line is
function Argument_Count return Natural is
begin
return Wide_Startup.wargc - 1;
end Argument_Count;
function Argument (Number : Natural) return String is
type Fixed_LPCWSTR_array is array (C.size_t) of C.winnt.LPCWSTR
with Convention => C;
type LPCWSTR_array_const_ptr is access constant Fixed_LPCWSTR_array
with Convention => C;
package Conv is
new Address_To_Constant_Access_Conversions (
Fixed_LPCWSTR_array,
LPCWSTR_array_const_ptr);
begin
return Zero_Terminated_WStrings.Value (
Conv.To_Pointer (Wide_Startup.wargv) (C.size_t (Number)));
end Argument;
end System.Native_Command_Line;
|
pragma Warnings (Off);
pragma Ada_95;
with System;
with System.Parameters;
with System.Secondary_Stack;
package ada_main is
gnat_argc : Integer;
gnat_argv : System.Address;
gnat_envp : System.Address;
pragma Import (C, gnat_argc);
pragma Import (C, gnat_argv);
pragma Import (C, gnat_envp);
gnat_exit_status : Integer;
pragma Import (C, gnat_exit_status);
GNAT_Version : constant String :=
"GNAT Version: Community 2018 (20180523-73)" & ASCII.NUL;
pragma Export (C, GNAT_Version, "__gnat_version");
Ada_Main_Program_Name : constant String := "_ada_swarm" & ASCII.NUL;
pragma Export (C, Ada_Main_Program_Name, "__gnat_ada_main_program_name");
procedure adainit;
pragma Export (C, adainit, "adainit");
procedure adafinal;
pragma Export (C, adafinal, "adafinal");
function main
(argc : Integer;
argv : System.Address;
envp : System.Address)
return Integer;
pragma Export (C, main, "main");
type Version_32 is mod 2 ** 32;
u00001 : constant Version_32 := 16#5ff99a27#;
pragma Export (C, u00001, "swarmB");
u00002 : constant Version_32 := 16#050ff2f0#;
pragma Export (C, u00002, "system__standard_libraryB");
u00003 : constant Version_32 := 16#0f7d71d4#;
pragma Export (C, u00003, "system__standard_libraryS");
u00004 : constant Version_32 := 16#f8088b52#;
pragma Export (C, u00004, "ada__exceptionsB");
u00005 : constant Version_32 := 16#16307b94#;
pragma Export (C, u00005, "ada__exceptionsS");
u00006 : constant Version_32 := 16#76789da1#;
pragma Export (C, u00006, "adaS");
u00007 : constant Version_32 := 16#5726abed#;
pragma Export (C, u00007, "ada__exceptions__last_chance_handlerB");
u00008 : constant Version_32 := 16#41e5552e#;
pragma Export (C, u00008, "ada__exceptions__last_chance_handlerS");
u00009 : constant Version_32 := 16#085b6ffb#;
pragma Export (C, u00009, "systemS");
u00010 : constant Version_32 := 16#ae860117#;
pragma Export (C, u00010, "system__soft_linksB");
u00011 : constant Version_32 := 16#4d58644d#;
pragma Export (C, u00011, "system__soft_linksS");
u00012 : constant Version_32 := 16#bd45c2cc#;
pragma Export (C, u00012, "system__secondary_stackB");
u00013 : constant Version_32 := 16#4dcf97e2#;
pragma Export (C, u00013, "system__secondary_stackS");
u00014 : constant Version_32 := 16#86dbf443#;
pragma Export (C, u00014, "system__parametersB");
u00015 : constant Version_32 := 16#40b73bd0#;
pragma Export (C, u00015, "system__parametersS");
u00016 : constant Version_32 := 16#ced09590#;
pragma Export (C, u00016, "system__storage_elementsB");
u00017 : constant Version_32 := 16#259825ff#;
pragma Export (C, u00017, "system__storage_elementsS");
u00018 : constant Version_32 := 16#75bf515c#;
pragma Export (C, u00018, "system__soft_links__initializeB");
u00019 : constant Version_32 := 16#5697fc2b#;
pragma Export (C, u00019, "system__soft_links__initializeS");
u00020 : constant Version_32 := 16#41837d1e#;
pragma Export (C, u00020, "system__stack_checkingB");
u00021 : constant Version_32 := 16#86e40413#;
pragma Export (C, u00021, "system__stack_checkingS");
u00022 : constant Version_32 := 16#34742901#;
pragma Export (C, u00022, "system__exception_tableB");
u00023 : constant Version_32 := 16#55f506b9#;
pragma Export (C, u00023, "system__exception_tableS");
u00024 : constant Version_32 := 16#ce4af020#;
pragma Export (C, u00024, "system__exceptionsB");
u00025 : constant Version_32 := 16#6038020d#;
pragma Export (C, u00025, "system__exceptionsS");
u00026 : constant Version_32 := 16#80916427#;
pragma Export (C, u00026, "system__exceptions__machineB");
u00027 : constant Version_32 := 16#3bad9081#;
pragma Export (C, u00027, "system__exceptions__machineS");
u00028 : constant Version_32 := 16#aa0563fc#;
pragma Export (C, u00028, "system__exceptions_debugB");
u00029 : constant Version_32 := 16#76d1963f#;
pragma Export (C, u00029, "system__exceptions_debugS");
u00030 : constant Version_32 := 16#6c2f8802#;
pragma Export (C, u00030, "system__img_intB");
u00031 : constant Version_32 := 16#0a808f39#;
pragma Export (C, u00031, "system__img_intS");
u00032 : constant Version_32 := 16#39df8c17#;
pragma Export (C, u00032, "system__tracebackB");
u00033 : constant Version_32 := 16#5679b13f#;
pragma Export (C, u00033, "system__tracebackS");
u00034 : constant Version_32 := 16#9ed49525#;
pragma Export (C, u00034, "system__traceback_entriesB");
u00035 : constant Version_32 := 16#0800998b#;
pragma Export (C, u00035, "system__traceback_entriesS");
u00036 : constant Version_32 := 16#bb296fbb#;
pragma Export (C, u00036, "system__traceback__symbolicB");
u00037 : constant Version_32 := 16#c84061d1#;
pragma Export (C, u00037, "system__traceback__symbolicS");
u00038 : constant Version_32 := 16#701f9d88#;
pragma Export (C, u00038, "ada__exceptions__tracebackB");
u00039 : constant Version_32 := 16#20245e75#;
pragma Export (C, u00039, "ada__exceptions__tracebackS");
u00040 : constant Version_32 := 16#a0d3d22b#;
pragma Export (C, u00040, "system__address_imageB");
u00041 : constant Version_32 := 16#a9b7f2c1#;
pragma Export (C, u00041, "system__address_imageS");
u00042 : constant Version_32 := 16#8c33a517#;
pragma Export (C, u00042, "system__wch_conB");
u00043 : constant Version_32 := 16#13264d29#;
pragma Export (C, u00043, "system__wch_conS");
u00044 : constant Version_32 := 16#9721e840#;
pragma Export (C, u00044, "system__wch_stwB");
u00045 : constant Version_32 := 16#3e376128#;
pragma Export (C, u00045, "system__wch_stwS");
u00046 : constant Version_32 := 16#a831679c#;
pragma Export (C, u00046, "system__wch_cnvB");
u00047 : constant Version_32 := 16#1c91f7da#;
pragma Export (C, u00047, "system__wch_cnvS");
u00048 : constant Version_32 := 16#5ab55268#;
pragma Export (C, u00048, "interfacesS");
u00049 : constant Version_32 := 16#ece6fdb6#;
pragma Export (C, u00049, "system__wch_jisB");
u00050 : constant Version_32 := 16#9ce1eefb#;
pragma Export (C, u00050, "system__wch_jisS");
u00051 : constant Version_32 := 16#64d7e8d2#;
pragma Export (C, u00051, "callback_proceduresB");
u00052 : constant Version_32 := 16#0bb57c0d#;
pragma Export (C, u00052, "callback_proceduresS");
u00053 : constant Version_32 := 16#adc843f0#;
pragma Export (C, u00053, "ada__real_timeB");
u00054 : constant Version_32 := 16#69ea8064#;
pragma Export (C, u00054, "ada__real_timeS");
u00055 : constant Version_32 := 16#c8eda0b7#;
pragma Export (C, u00055, "system__taskingB");
u00056 : constant Version_32 := 16#904e70c9#;
pragma Export (C, u00056, "system__taskingS");
u00057 : constant Version_32 := 16#fde20231#;
pragma Export (C, u00057, "system__task_primitivesS");
u00058 : constant Version_32 := 16#4a005d03#;
pragma Export (C, u00058, "system__os_interfaceB");
u00059 : constant Version_32 := 16#55598295#;
pragma Export (C, u00059, "system__os_interfaceS");
u00060 : constant Version_32 := 16#769e25e6#;
pragma Export (C, u00060, "interfaces__cB");
u00061 : constant Version_32 := 16#467817d8#;
pragma Export (C, u00061, "interfaces__cS");
u00062 : constant Version_32 := 16#1b8990a4#;
pragma Export (C, u00062, "interfaces__c__extensionsS");
u00063 : constant Version_32 := 16#54ea2fd2#;
pragma Export (C, u00063, "system__os_constantsS");
u00064 : constant Version_32 := 16#9690f83e#;
pragma Export (C, u00064, "system__task_primitives__operationsB");
u00065 : constant Version_32 := 16#bd0bc49c#;
pragma Export (C, u00065, "system__task_primitives__operationsS");
u00066 : constant Version_32 := 16#89b55e64#;
pragma Export (C, u00066, "system__interrupt_managementB");
u00067 : constant Version_32 := 16#1a73cd21#;
pragma Export (C, u00067, "system__interrupt_managementS");
u00068 : constant Version_32 := 16#f65595cf#;
pragma Export (C, u00068, "system__multiprocessorsB");
u00069 : constant Version_32 := 16#30f7f088#;
pragma Export (C, u00069, "system__multiprocessorsS");
u00070 : constant Version_32 := 16#2b2125d3#;
pragma Export (C, u00070, "system__os_primitivesB");
u00071 : constant Version_32 := 16#0fa60a0d#;
pragma Export (C, u00071, "system__os_primitivesS");
u00072 : constant Version_32 := 16#e0fce7f8#;
pragma Export (C, u00072, "system__task_infoB");
u00073 : constant Version_32 := 16#8841d2fa#;
pragma Export (C, u00073, "system__task_infoS");
u00074 : constant Version_32 := 16#1036f432#;
pragma Export (C, u00074, "system__tasking__debugB");
u00075 : constant Version_32 := 16#de1ac8b1#;
pragma Export (C, u00075, "system__tasking__debugS");
u00076 : constant Version_32 := 16#fd83e873#;
pragma Export (C, u00076, "system__concat_2B");
u00077 : constant Version_32 := 16#0afbb82b#;
pragma Export (C, u00077, "system__concat_2S");
u00078 : constant Version_32 := 16#2b70b149#;
pragma Export (C, u00078, "system__concat_3B");
u00079 : constant Version_32 := 16#032b335e#;
pragma Export (C, u00079, "system__concat_3S");
u00080 : constant Version_32 := 16#4e0ce0a1#;
pragma Export (C, u00080, "system__crtlS");
u00081 : constant Version_32 := 16#273384e4#;
pragma Export (C, u00081, "system__img_enum_newB");
u00082 : constant Version_32 := 16#6917693b#;
pragma Export (C, u00082, "system__img_enum_newS");
u00083 : constant Version_32 := 16#9dca6636#;
pragma Export (C, u00083, "system__img_lliB");
u00084 : constant Version_32 := 16#19143a2a#;
pragma Export (C, u00084, "system__img_lliS");
u00085 : constant Version_32 := 16#3cdd1378#;
pragma Export (C, u00085, "system__unsigned_typesS");
u00086 : constant Version_32 := 16#6ec3c867#;
pragma Export (C, u00086, "system__stack_usageB");
u00087 : constant Version_32 := 16#3a3ac346#;
pragma Export (C, u00087, "system__stack_usageS");
u00088 : constant Version_32 := 16#d7aac20c#;
pragma Export (C, u00088, "system__ioB");
u00089 : constant Version_32 := 16#961998b4#;
pragma Export (C, u00089, "system__ioS");
u00090 : constant Version_32 := 16#d398a95f#;
pragma Export (C, u00090, "ada__tagsB");
u00091 : constant Version_32 := 16#12a0afb8#;
pragma Export (C, u00091, "ada__tagsS");
u00092 : constant Version_32 := 16#796f31f1#;
pragma Export (C, u00092, "system__htableB");
u00093 : constant Version_32 := 16#8c99dc11#;
pragma Export (C, u00093, "system__htableS");
u00094 : constant Version_32 := 16#089f5cd0#;
pragma Export (C, u00094, "system__string_hashB");
u00095 : constant Version_32 := 16#2ec7b76f#;
pragma Export (C, u00095, "system__string_hashS");
u00096 : constant Version_32 := 16#afdbf393#;
pragma Export (C, u00096, "system__val_lluB");
u00097 : constant Version_32 := 16#462f440a#;
pragma Export (C, u00097, "system__val_lluS");
u00098 : constant Version_32 := 16#269742a9#;
pragma Export (C, u00098, "system__val_utilB");
u00099 : constant Version_32 := 16#a4fbd905#;
pragma Export (C, u00099, "system__val_utilS");
u00100 : constant Version_32 := 16#ec4d5631#;
pragma Export (C, u00100, "system__case_utilB");
u00101 : constant Version_32 := 16#378ed9af#;
pragma Export (C, u00101, "system__case_utilS");
u00102 : constant Version_32 := 16#9e3065b2#;
pragma Export (C, u00102, "exceptionsB");
u00103 : constant Version_32 := 16#bae1bad2#;
pragma Export (C, u00103, "exceptionsS");
u00104 : constant Version_32 := 16#920f3e36#;
pragma Export (C, u00104, "ada__task_identificationB");
u00105 : constant Version_32 := 16#a04f2339#;
pragma Export (C, u00105, "ada__task_identificationS");
u00106 : constant Version_32 := 16#1d5082e5#;
pragma Export (C, u00106, "system__tasking__utilitiesB");
u00107 : constant Version_32 := 16#ab3d060e#;
pragma Export (C, u00107, "system__tasking__utilitiesS");
u00108 : constant Version_32 := 16#0a98af1a#;
pragma Export (C, u00108, "system__tasking__initializationB");
u00109 : constant Version_32 := 16#f7885a93#;
pragma Export (C, u00109, "system__tasking__initializationS");
u00110 : constant Version_32 := 16#9f1b5cb1#;
pragma Export (C, u00110, "system__soft_links__taskingB");
u00111 : constant Version_32 := 16#e939497e#;
pragma Export (C, u00111, "system__soft_links__taskingS");
u00112 : constant Version_32 := 16#17d21067#;
pragma Export (C, u00112, "ada__exceptions__is_null_occurrenceB");
u00113 : constant Version_32 := 16#e1d7566f#;
pragma Export (C, u00113, "ada__exceptions__is_null_occurrenceS");
u00114 : constant Version_32 := 16#cde2b616#;
pragma Export (C, u00114, "system__tasking__task_attributesB");
u00115 : constant Version_32 := 16#4c40320c#;
pragma Export (C, u00115, "system__tasking__task_attributesS");
u00116 : constant Version_32 := 16#81b9d4a8#;
pragma Export (C, u00116, "system__tasking__queuingB");
u00117 : constant Version_32 := 16#c9e0262c#;
pragma Export (C, u00117, "system__tasking__queuingS");
u00118 : constant Version_32 := 16#9fcf5d7f#;
pragma Export (C, u00118, "system__tasking__protected_objectsB");
u00119 : constant Version_32 := 16#b15a1586#;
pragma Export (C, u00119, "system__tasking__protected_objectsS");
u00120 : constant Version_32 := 16#3d3c265e#;
pragma Export (C, u00120, "system__tasking__protected_objects__entriesB");
u00121 : constant Version_32 := 16#7daf93e7#;
pragma Export (C, u00121, "system__tasking__protected_objects__entriesS");
u00122 : constant Version_32 := 16#100eaf58#;
pragma Export (C, u00122, "system__restrictionsB");
u00123 : constant Version_32 := 16#4329b6aa#;
pragma Export (C, u00123, "system__restrictionsS");
u00124 : constant Version_32 := 16#86c56e5a#;
pragma Export (C, u00124, "ada__finalizationS");
u00125 : constant Version_32 := 16#10558b11#;
pragma Export (C, u00125, "ada__streamsB");
u00126 : constant Version_32 := 16#67e31212#;
pragma Export (C, u00126, "ada__streamsS");
u00127 : constant Version_32 := 16#92d882c5#;
pragma Export (C, u00127, "ada__io_exceptionsS");
u00128 : constant Version_32 := 16#95817ed8#;
pragma Export (C, u00128, "system__finalization_rootB");
u00129 : constant Version_32 := 16#47a91c6b#;
pragma Export (C, u00129, "system__finalization_rootS");
u00130 : constant Version_32 := 16#927a893f#;
pragma Export (C, u00130, "ada__text_ioB");
u00131 : constant Version_32 := 16#1ffab6e1#;
pragma Export (C, u00131, "ada__text_ioS");
u00132 : constant Version_32 := 16#73d2d764#;
pragma Export (C, u00132, "interfaces__c_streamsB");
u00133 : constant Version_32 := 16#b1330297#;
pragma Export (C, u00133, "interfaces__c_streamsS");
u00134 : constant Version_32 := 16#ec083f01#;
pragma Export (C, u00134, "system__file_ioB");
u00135 : constant Version_32 := 16#af2a8e9e#;
pragma Export (C, u00135, "system__file_ioS");
u00136 : constant Version_32 := 16#0f8892f9#;
pragma Export (C, u00136, "system__os_libB");
u00137 : constant Version_32 := 16#d8e681fb#;
pragma Export (C, u00137, "system__os_libS");
u00138 : constant Version_32 := 16#2a8e89ad#;
pragma Export (C, u00138, "system__stringsB");
u00139 : constant Version_32 := 16#684d436e#;
pragma Export (C, u00139, "system__stringsS");
u00140 : constant Version_32 := 16#f5c4f553#;
pragma Export (C, u00140, "system__file_control_blockS");
u00141 : constant Version_32 := 16#20095f7e#;
pragma Export (C, u00141, "generic_sliding_statisticsB");
u00142 : constant Version_32 := 16#bb10ab49#;
pragma Export (C, u00142, "generic_sliding_statisticsS");
u00143 : constant Version_32 := 16#98a387f5#;
pragma Export (C, u00143, "real_typeS");
u00144 : constant Version_32 := 16#cd2959fb#;
pragma Export (C, u00144, "ada__numericsS");
u00145 : constant Version_32 := 16#e5114ee9#;
pragma Export (C, u00145, "ada__numerics__auxB");
u00146 : constant Version_32 := 16#9f6e24ed#;
pragma Export (C, u00146, "ada__numerics__auxS");
u00147 : constant Version_32 := 16#0cccd408#;
pragma Export (C, u00147, "system__fat_llfS");
u00148 : constant Version_32 := 16#6533c8fa#;
pragma Export (C, u00148, "system__machine_codeS");
u00149 : constant Version_32 := 16#52f1910f#;
pragma Export (C, u00149, "system__assertionsB");
u00150 : constant Version_32 := 16#c5d6436f#;
pragma Export (C, u00150, "system__assertionsS");
u00151 : constant Version_32 := 16#b2a569d2#;
pragma Export (C, u00151, "system__exn_llfB");
u00152 : constant Version_32 := 16#b425d427#;
pragma Export (C, u00152, "system__exn_llfS");
u00153 : constant Version_32 := 16#761c7ae2#;
pragma Export (C, u00153, "system__fat_lfltS");
u00154 : constant Version_32 := 16#f86a0784#;
pragma Export (C, u00154, "graphics_configurationS");
u00155 : constant Version_32 := 16#a1e0f341#;
pragma Export (C, u00155, "glB");
u00156 : constant Version_32 := 16#3e6953e9#;
pragma Export (C, u00156, "glS");
u00157 : constant Version_32 := 16#7be628b8#;
pragma Export (C, u00157, "gl__extendedS");
u00158 : constant Version_32 := 16#27986d94#;
pragma Export (C, u00158, "interfaces__c__stringsB");
u00159 : constant Version_32 := 16#603c1c44#;
pragma Export (C, u00159, "interfaces__c__stringsS");
u00160 : constant Version_32 := 16#ef512720#;
pragma Export (C, u00160, "globe_3dB");
u00161 : constant Version_32 := 16#68f549e6#;
pragma Export (C, u00161, "globe_3dS");
u00162 : constant Version_32 := 16#5b4659fa#;
pragma Export (C, u00162, "ada__charactersS");
u00163 : constant Version_32 := 16#8f637df8#;
pragma Export (C, u00163, "ada__characters__handlingB");
u00164 : constant Version_32 := 16#3b3f6154#;
pragma Export (C, u00164, "ada__characters__handlingS");
u00165 : constant Version_32 := 16#4b7bb96a#;
pragma Export (C, u00165, "ada__characters__latin_1S");
u00166 : constant Version_32 := 16#e6d4fa36#;
pragma Export (C, u00166, "ada__stringsS");
u00167 : constant Version_32 := 16#96df1a3f#;
pragma Export (C, u00167, "ada__strings__mapsB");
u00168 : constant Version_32 := 16#1e526bec#;
pragma Export (C, u00168, "ada__strings__mapsS");
u00169 : constant Version_32 := 16#98e13b0e#;
pragma Export (C, u00169, "system__bit_opsB");
u00170 : constant Version_32 := 16#0765e3a3#;
pragma Export (C, u00170, "system__bit_opsS");
u00171 : constant Version_32 := 16#92f05f13#;
pragma Export (C, u00171, "ada__strings__maps__constantsS");
u00172 : constant Version_32 := 16#179d7d28#;
pragma Export (C, u00172, "ada__containersS");
u00173 : constant Version_32 := 16#adb6d201#;
pragma Export (C, u00173, "ada__strings__fixedB");
u00174 : constant Version_32 := 16#a86b22b3#;
pragma Export (C, u00174, "ada__strings__fixedS");
u00175 : constant Version_32 := 16#2eb48a6d#;
pragma Export (C, u00175, "ada__strings__searchB");
u00176 : constant Version_32 := 16#c1ab8667#;
pragma Export (C, u00176, "ada__strings__searchS");
u00177 : constant Version_32 := 16#9c2abfb0#;
pragma Export (C, u00177, "gl__errorsB");
u00178 : constant Version_32 := 16#51391c66#;
pragma Export (C, u00178, "gl__errorsS");
u00179 : constant Version_32 := 16#30237187#;
pragma Export (C, u00179, "gluB");
u00180 : constant Version_32 := 16#f8141e55#;
pragma Export (C, u00180, "gluS");
u00181 : constant Version_32 := 16#932a4690#;
pragma Export (C, u00181, "system__concat_4B");
u00182 : constant Version_32 := 16#763f44db#;
pragma Export (C, u00182, "system__concat_4S");
u00183 : constant Version_32 := 16#049d363d#;
pragma Export (C, u00183, "gl__skinsB");
u00184 : constant Version_32 := 16#2584189e#;
pragma Export (C, u00184, "gl__skinsS");
u00185 : constant Version_32 := 16#502e73ef#;
pragma Export (C, u00185, "system__fat_fltS");
u00186 : constant Version_32 := 16#5a895de2#;
pragma Export (C, u00186, "system__pool_globalB");
u00187 : constant Version_32 := 16#7141203e#;
pragma Export (C, u00187, "system__pool_globalS");
u00188 : constant Version_32 := 16#2323a8af#;
pragma Export (C, u00188, "system__memoryB");
u00189 : constant Version_32 := 16#512609cf#;
pragma Export (C, u00189, "system__memoryS");
u00190 : constant Version_32 := 16#6d4d969a#;
pragma Export (C, u00190, "system__storage_poolsB");
u00191 : constant Version_32 := 16#2bb6f156#;
pragma Export (C, u00191, "system__storage_poolsS");
u00192 : constant Version_32 := 16#2e260032#;
pragma Export (C, u00192, "system__storage_pools__subpoolsB");
u00193 : constant Version_32 := 16#cc5a1856#;
pragma Export (C, u00193, "system__storage_pools__subpoolsS");
u00194 : constant Version_32 := 16#d96e3c40#;
pragma Export (C, u00194, "system__finalization_mastersB");
u00195 : constant Version_32 := 16#53a75631#;
pragma Export (C, u00195, "system__finalization_mastersS");
u00196 : constant Version_32 := 16#7268f812#;
pragma Export (C, u00196, "system__img_boolB");
u00197 : constant Version_32 := 16#fd821e10#;
pragma Export (C, u00197, "system__img_boolS");
u00198 : constant Version_32 := 16#84042202#;
pragma Export (C, u00198, "system__storage_pools__subpools__finalizationB");
u00199 : constant Version_32 := 16#fe2f4b3a#;
pragma Export (C, u00199, "system__storage_pools__subpools__finalizationS");
u00200 : constant Version_32 := 16#837026c9#;
pragma Export (C, u00200, "gl__bufferB");
u00201 : constant Version_32 := 16#fcf76790#;
pragma Export (C, u00201, "gl__bufferS");
u00202 : constant Version_32 := 16#039168f8#;
pragma Export (C, u00202, "system__stream_attributesB");
u00203 : constant Version_32 := 16#8bc30a4e#;
pragma Export (C, u00203, "system__stream_attributesS");
u00204 : constant Version_32 := 16#e6b92a39#;
pragma Export (C, u00204, "gl__buffer__texture_coordsB");
u00205 : constant Version_32 := 16#ee91d95f#;
pragma Export (C, u00205, "gl__buffer__texture_coordsS");
u00206 : constant Version_32 := 16#9004b2de#;
pragma Export (C, u00206, "gl__buffer__generalB");
u00207 : constant Version_32 := 16#b07eab0a#;
pragma Export (C, u00207, "gl__buffer__generalS");
u00208 : constant Version_32 := 16#089a501d#;
pragma Export (C, u00208, "gl__geometryB");
u00209 : constant Version_32 := 16#1e8d36a3#;
pragma Export (C, u00209, "gl__geometryS");
u00210 : constant Version_32 := 16#457fb2da#;
pragma Export (C, u00210, "ada__strings__unboundedB");
u00211 : constant Version_32 := 16#f39c7224#;
pragma Export (C, u00211, "ada__strings__unboundedS");
u00212 : constant Version_32 := 16#acee74ad#;
pragma Export (C, u00212, "system__compare_array_unsigned_8B");
u00213 : constant Version_32 := 16#a1581e76#;
pragma Export (C, u00213, "system__compare_array_unsigned_8S");
u00214 : constant Version_32 := 16#a8025f3c#;
pragma Export (C, u00214, "system__address_operationsB");
u00215 : constant Version_32 := 16#1b57d1c8#;
pragma Export (C, u00215, "system__address_operationsS");
u00216 : constant Version_32 := 16#020a3f4d#;
pragma Export (C, u00216, "system__atomic_countersB");
u00217 : constant Version_32 := 16#bc074276#;
pragma Export (C, u00217, "system__atomic_countersS");
u00218 : constant Version_32 := 16#59ec45db#;
pragma Export (C, u00218, "gl__mathB");
u00219 : constant Version_32 := 16#a8dd0043#;
pragma Export (C, u00219, "gl__mathS");
u00220 : constant Version_32 := 16#d5f9759f#;
pragma Export (C, u00220, "ada__text_io__float_auxB");
u00221 : constant Version_32 := 16#48248c7b#;
pragma Export (C, u00221, "ada__text_io__float_auxS");
u00222 : constant Version_32 := 16#181dc502#;
pragma Export (C, u00222, "ada__text_io__generic_auxB");
u00223 : constant Version_32 := 16#16b3615d#;
pragma Export (C, u00223, "ada__text_io__generic_auxS");
u00224 : constant Version_32 := 16#8aa4f090#;
pragma Export (C, u00224, "system__img_realB");
u00225 : constant Version_32 := 16#cff33e19#;
pragma Export (C, u00225, "system__img_realS");
u00226 : constant Version_32 := 16#1b28662b#;
pragma Export (C, u00226, "system__float_controlB");
u00227 : constant Version_32 := 16#e8a72cc7#;
pragma Export (C, u00227, "system__float_controlS");
u00228 : constant Version_32 := 16#3e932977#;
pragma Export (C, u00228, "system__img_lluB");
u00229 : constant Version_32 := 16#751413bb#;
pragma Export (C, u00229, "system__img_lluS");
u00230 : constant Version_32 := 16#ec78c2bf#;
pragma Export (C, u00230, "system__img_unsB");
u00231 : constant Version_32 := 16#a3292f8f#;
pragma Export (C, u00231, "system__img_unsS");
u00232 : constant Version_32 := 16#582b098c#;
pragma Export (C, u00232, "system__powten_tableS");
u00233 : constant Version_32 := 16#c2ca0511#;
pragma Export (C, u00233, "system__val_realB");
u00234 : constant Version_32 := 16#f67218ea#;
pragma Export (C, u00234, "system__val_realS");
u00235 : constant Version_32 := 16#608e2cd1#;
pragma Export (C, u00235, "system__concat_5B");
u00236 : constant Version_32 := 16#8f052cd5#;
pragma Export (C, u00236, "system__concat_5S");
u00237 : constant Version_32 := 16#fafb0eca#;
pragma Export (C, u00237, "gl__texturesB");
u00238 : constant Version_32 := 16#91ca1c90#;
pragma Export (C, u00238, "gl__texturesS");
u00239 : constant Version_32 := 16#5c76d753#;
pragma Export (C, u00239, "gl__ioB");
u00240 : constant Version_32 := 16#daf3b9dd#;
pragma Export (C, u00240, "gl__ioS");
u00241 : constant Version_32 := 16#86ecf8ab#;
pragma Export (C, u00241, "system__strings__stream_opsB");
u00242 : constant Version_32 := 16#ec029138#;
pragma Export (C, u00242, "system__strings__stream_opsS");
u00243 : constant Version_32 := 16#db0aa7dc#;
pragma Export (C, u00243, "ada__streams__stream_ioB");
u00244 : constant Version_32 := 16#55e6e4b0#;
pragma Export (C, u00244, "ada__streams__stream_ioS");
u00245 : constant Version_32 := 16#5de653db#;
pragma Export (C, u00245, "system__communicationB");
u00246 : constant Version_32 := 16#113b3a29#;
pragma Export (C, u00246, "system__communicationS");
u00247 : constant Version_32 := 16#7f8879fc#;
pragma Export (C, u00247, "gl__materialsB");
u00248 : constant Version_32 := 16#65f2b4a3#;
pragma Export (C, u00248, "gl__materialsS");
u00249 : constant Version_32 := 16#33fd7c82#;
pragma Export (C, u00249, "globe_3d__mathB");
u00250 : constant Version_32 := 16#e3e98860#;
pragma Export (C, u00250, "globe_3d__mathS");
u00251 : constant Version_32 := 16#40c8be3a#;
pragma Export (C, u00251, "globe_3d__optionsB");
u00252 : constant Version_32 := 16#dc499730#;
pragma Export (C, u00252, "globe_3d__optionsS");
u00253 : constant Version_32 := 16#bd43c68c#;
pragma Export (C, u00253, "globe_3d__portalsB");
u00254 : constant Version_32 := 16#345614ab#;
pragma Export (C, u00254, "globe_3d__portalsS");
u00255 : constant Version_32 := 16#c861171e#;
pragma Export (C, u00255, "globe_3d__texturesB");
u00256 : constant Version_32 := 16#2a1c4756#;
pragma Export (C, u00256, "globe_3d__texturesS");
u00257 : constant Version_32 := 16#c164a034#;
pragma Export (C, u00257, "ada__containers__hash_tablesS");
u00258 : constant Version_32 := 16#bcec81df#;
pragma Export (C, u00258, "ada__containers__helpersB");
u00259 : constant Version_32 := 16#4adfc5eb#;
pragma Export (C, u00259, "ada__containers__helpersS");
u00260 : constant Version_32 := 16#c24eaf4d#;
pragma Export (C, u00260, "ada__containers__prime_numbersB");
u00261 : constant Version_32 := 16#6d3af8ed#;
pragma Export (C, u00261, "ada__containers__prime_numbersS");
u00262 : constant Version_32 := 16#217daf40#;
pragma Export (C, u00262, "ada__strings__unbounded__hashB");
u00263 : constant Version_32 := 16#f0232cad#;
pragma Export (C, u00263, "ada__strings__unbounded__hashS");
u00264 : constant Version_32 := 16#fa5081d0#;
pragma Export (C, u00264, "unzipB");
u00265 : constant Version_32 := 16#592613ef#;
pragma Export (C, u00265, "unzipS");
u00266 : constant Version_32 := 16#8bbf26e6#;
pragma Export (C, u00266, "unzip__decompressB");
u00267 : constant Version_32 := 16#ff9edbf7#;
pragma Export (C, u00267, "unzip__decompressS");
u00268 : constant Version_32 := 16#bf116e3f#;
pragma Export (C, u00268, "bzip2B");
u00269 : constant Version_32 := 16#951df2a7#;
pragma Export (C, u00269, "bzip2S");
u00270 : constant Version_32 := 16#297a02d7#;
pragma Export (C, u00270, "unzip__decompress__huffmanB");
u00271 : constant Version_32 := 16#3045b9d5#;
pragma Export (C, u00271, "unzip__decompress__huffmanS");
u00272 : constant Version_32 := 16#21f15937#;
pragma Export (C, u00272, "zipB");
u00273 : constant Version_32 := 16#a4865b30#;
pragma Export (C, u00273, "zipS");
u00274 : constant Version_32 := 16#ebb133b2#;
pragma Export (C, u00274, "zip__headersB");
u00275 : constant Version_32 := 16#17ef6cb6#;
pragma Export (C, u00275, "zip__headersS");
u00276 : constant Version_32 := 16#97991e4b#;
pragma Export (C, u00276, "zip_streamsB");
u00277 : constant Version_32 := 16#534a2c31#;
pragma Export (C, u00277, "zip_streamsS");
u00278 : constant Version_32 := 16#b8719323#;
pragma Export (C, u00278, "ada__calendarB");
u00279 : constant Version_32 := 16#41508869#;
pragma Export (C, u00279, "ada__calendarS");
u00280 : constant Version_32 := 16#397e9c9f#;
pragma Export (C, u00280, "zip__crcB");
u00281 : constant Version_32 := 16#06c4d47b#;
pragma Export (C, u00281, "zip__crcS");
u00282 : constant Version_32 := 16#8ec48dfb#;
pragma Export (C, u00282, "unzip__streamsB");
u00283 : constant Version_32 := 16#deb9bdf2#;
pragma Export (C, u00283, "unzip__streamsS");
u00284 : constant Version_32 := 16#46899fd1#;
pragma Export (C, u00284, "system__concat_7B");
u00285 : constant Version_32 := 16#f49c34e4#;
pragma Export (C, u00285, "system__concat_7S");
u00286 : constant Version_32 := 16#a83b7c85#;
pragma Export (C, u00286, "system__concat_6B");
u00287 : constant Version_32 := 16#da9c4249#;
pragma Export (C, u00287, "system__concat_6S");
u00288 : constant Version_32 := 16#46b1f5ea#;
pragma Export (C, u00288, "system__concat_8B");
u00289 : constant Version_32 := 16#eb5c222c#;
pragma Export (C, u00289, "system__concat_8S");
u00290 : constant Version_32 := 16#de0a8573#;
pragma Export (C, u00290, "gl__frustumsB");
u00291 : constant Version_32 := 16#2c4c19e2#;
pragma Export (C, u00291, "gl__frustumsS");
u00292 : constant Version_32 := 16#cd53cf3b#;
pragma Export (C, u00292, "gl__skinned_geometryB");
u00293 : constant Version_32 := 16#ec459e05#;
pragma Export (C, u00293, "gl__skinned_geometryS");
u00294 : constant Version_32 := 16#c62d8c42#;
pragma Export (C, u00294, "glut_2dB");
u00295 : constant Version_32 := 16#7eff0cd3#;
pragma Export (C, u00295, "glut_2dS");
u00296 : constant Version_32 := 16#e13e5087#;
pragma Export (C, u00296, "glutB");
u00297 : constant Version_32 := 16#6ee34171#;
pragma Export (C, u00297, "glutS");
u00298 : constant Version_32 := 16#01a73f89#;
pragma Export (C, u00298, "ada__command_lineB");
u00299 : constant Version_32 := 16#3cdef8c9#;
pragma Export (C, u00299, "ada__command_lineS");
u00300 : constant Version_32 := 16#8225628b#;
pragma Export (C, u00300, "ada__containers__red_black_treesS");
u00301 : constant Version_32 := 16#763b4fd7#;
pragma Export (C, u00301, "graphics_frameratesB");
u00302 : constant Version_32 := 16#e379c8e5#;
pragma Export (C, u00302, "graphics_frameratesS");
u00303 : constant Version_32 := 16#357666d8#;
pragma Export (C, u00303, "ada__calendar__delaysB");
u00304 : constant Version_32 := 16#a808adf5#;
pragma Export (C, u00304, "ada__calendar__delaysS");
u00305 : constant Version_32 := 16#9bd4ba92#;
pragma Export (C, u00305, "graphics_structuresS");
u00306 : constant Version_32 := 16#f2a9860d#;
pragma Export (C, u00306, "rotationsB");
u00307 : constant Version_32 := 16#f942fbb5#;
pragma Export (C, u00307, "rotationsS");
u00308 : constant Version_32 := 16#621b3e02#;
pragma Export (C, u00308, "matricesB");
u00309 : constant Version_32 := 16#48257de2#;
pragma Export (C, u00309, "matricesS");
u00310 : constant Version_32 := 16#dd900968#;
pragma Export (C, u00310, "quaternionsB");
u00311 : constant Version_32 := 16#504fbd0e#;
pragma Export (C, u00311, "quaternionsS");
u00312 : constant Version_32 := 16#3315000b#;
pragma Export (C, u00312, "vectors_3dB");
u00313 : constant Version_32 := 16#9351ec73#;
pragma Export (C, u00313, "vectors_3dS");
u00314 : constant Version_32 := 16#fe1ffede#;
pragma Export (C, u00314, "ada__strings__boundedB");
u00315 : constant Version_32 := 16#89c18940#;
pragma Export (C, u00315, "ada__strings__boundedS");
u00316 : constant Version_32 := 16#7ec26662#;
pragma Export (C, u00316, "ada__strings__superboundedB");
u00317 : constant Version_32 := 16#da6addee#;
pragma Export (C, u00317, "ada__strings__superboundedS");
u00318 : constant Version_32 := 16#35a52d91#;
pragma Export (C, u00318, "vectors_xdB");
u00319 : constant Version_32 := 16#4c943a4c#;
pragma Export (C, u00319, "vectors_xdS");
u00320 : constant Version_32 := 16#15404f33#;
pragma Export (C, u00320, "vectors_2d_nS");
u00321 : constant Version_32 := 16#ae860a75#;
pragma Export (C, u00321, "vectors_xd_iB");
u00322 : constant Version_32 := 16#32b570f3#;
pragma Export (C, u00322, "vectors_xd_iS");
u00323 : constant Version_32 := 16#99c5812a#;
pragma Export (C, u00323, "graphics_dataS");
u00324 : constant Version_32 := 16#9cceee23#;
pragma Export (C, u00324, "modelsB");
u00325 : constant Version_32 := 16#670c4a41#;
pragma Export (C, u00325, "modelsS");
u00326 : constant Version_32 := 16#407e14ab#;
pragma Export (C, u00326, "spaceship_pB");
u00327 : constant Version_32 := 16#de928fde#;
pragma Export (C, u00327, "spaceship_pS");
u00328 : constant Version_32 := 16#bfd27222#;
pragma Export (C, u00328, "sphere_pB");
u00329 : constant Version_32 := 16#a2350170#;
pragma Export (C, u00329, "sphere_pS");
u00330 : constant Version_32 := 16#ed26937f#;
pragma Export (C, u00330, "vectors_4dS");
u00331 : constant Version_32 := 16#bf77ef48#;
pragma Export (C, u00331, "graphics_openglB");
u00332 : constant Version_32 := 16#380aa6a1#;
pragma Export (C, u00332, "graphics_openglS");
u00333 : constant Version_32 := 16#d976e2b4#;
pragma Export (C, u00333, "ada__numerics__float_randomB");
u00334 : constant Version_32 := 16#62aa8dd2#;
pragma Export (C, u00334, "ada__numerics__float_randomS");
u00335 : constant Version_32 := 16#ec9cfed1#;
pragma Export (C, u00335, "system__random_numbersB");
u00336 : constant Version_32 := 16#cb43df61#;
pragma Export (C, u00336, "system__random_numbersS");
u00337 : constant Version_32 := 16#650caaea#;
pragma Export (C, u00337, "system__random_seedB");
u00338 : constant Version_32 := 16#534b46a0#;
pragma Export (C, u00338, "system__random_seedS");
u00339 : constant Version_32 := 16#1d9142a4#;
pragma Export (C, u00339, "system__val_unsB");
u00340 : constant Version_32 := 16#2c75fe43#;
pragma Export (C, u00340, "system__val_unsS");
u00341 : constant Version_32 := 16#ffa721d2#;
pragma Export (C, u00341, "globe_3d__stars_skyB");
u00342 : constant Version_32 := 16#60803aec#;
pragma Export (C, u00342, "globe_3d__stars_skyS");
u00343 : constant Version_32 := 16#9df65f1b#;
pragma Export (C, u00343, "graphics_setupB");
u00344 : constant Version_32 := 16#ae3cfa3a#;
pragma Export (C, u00344, "graphics_setupS");
u00345 : constant Version_32 := 16#03e83d1c#;
pragma Export (C, u00345, "ada__numerics__elementary_functionsB");
u00346 : constant Version_32 := 16#edc89b7f#;
pragma Export (C, u00346, "ada__numerics__elementary_functionsS");
u00347 : constant Version_32 := 16#748f0b17#;
pragma Export (C, u00347, "glut__devicesB");
u00348 : constant Version_32 := 16#c8f38135#;
pragma Export (C, u00348, "glut__devicesS");
u00349 : constant Version_32 := 16#da9d8aa7#;
pragma Export (C, u00349, "glut__windowsB");
u00350 : constant Version_32 := 16#75e2ce49#;
pragma Export (C, u00350, "glut__windowsS");
u00351 : constant Version_32 := 16#1a19ed33#;
pragma Export (C, u00351, "actorsB");
u00352 : constant Version_32 := 16#9c19e623#;
pragma Export (C, u00352, "actorsS");
u00353 : constant Version_32 := 16#d317e11b#;
pragma Export (C, u00353, "game_controlB");
u00354 : constant Version_32 := 16#5097ee25#;
pragma Export (C, u00354, "game_controlS");
u00355 : constant Version_32 := 16#c48063ce#;
pragma Export (C, u00355, "globe_3d__software_anti_aliasingB");
u00356 : constant Version_32 := 16#41a04269#;
pragma Export (C, u00356, "globe_3d__software_anti_aliasingS");
u00357 : constant Version_32 := 16#ecc4ed1f#;
pragma Export (C, u00357, "keyboardB");
u00358 : constant Version_32 := 16#e8d894be#;
pragma Export (C, u00358, "keyboardS");
u00359 : constant Version_32 := 16#339eba20#;
pragma Export (C, u00359, "screenshotsB");
u00360 : constant Version_32 := 16#fb6ddf6f#;
pragma Export (C, u00360, "screenshotsS");
u00361 : constant Version_32 := 16#4e9834aa#;
pragma Export (C, u00361, "swarm_configurationB");
u00362 : constant Version_32 := 16#58067b51#;
pragma Export (C, u00362, "swarm_configurationS");
u00363 : constant Version_32 := 16#844fe575#;
pragma Export (C, u00363, "swarm_configurationsB");
u00364 : constant Version_32 := 16#bf53612f#;
pragma Export (C, u00364, "swarm_configurationsS");
u00365 : constant Version_32 := 16#eea673f9#;
pragma Export (C, u00365, "swarm_structures_baseS");
u00366 : constant Version_32 := 16#118d926e#;
pragma Export (C, u00366, "generic_protectedB");
u00367 : constant Version_32 := 16#dac5157f#;
pragma Export (C, u00367, "generic_protectedS");
u00368 : constant Version_32 := 16#cc990476#;
pragma Export (C, u00368, "system__tasking__protected_objects__operationsB");
u00369 : constant Version_32 := 16#ba36ad85#;
pragma Export (C, u00369, "system__tasking__protected_objects__operationsS");
u00370 : constant Version_32 := 16#2db45322#;
pragma Export (C, u00370, "system__tasking__entry_callsB");
u00371 : constant Version_32 := 16#c7180c67#;
pragma Export (C, u00371, "system__tasking__entry_callsS");
u00372 : constant Version_32 := 16#624cb93c#;
pragma Export (C, u00372, "system__tasking__rendezvousB");
u00373 : constant Version_32 := 16#f242aaf9#;
pragma Export (C, u00373, "system__tasking__rendezvousS");
u00374 : constant Version_32 := 16#e582cfb0#;
pragma Export (C, u00374, "swarm_controlB");
u00375 : constant Version_32 := 16#23efe8fe#;
pragma Export (C, u00375, "swarm_controlS");
u00376 : constant Version_32 := 16#84d70551#;
pragma Export (C, u00376, "swarm_dataS");
u00377 : constant Version_32 := 16#a3e1fbc0#;
pragma Export (C, u00377, "swarm_structuresB");
u00378 : constant Version_32 := 16#87aa0ec8#;
pragma Export (C, u00378, "swarm_structuresS");
u00379 : constant Version_32 := 16#5aabc651#;
pragma Export (C, u00379, "barrier_typeB");
u00380 : constant Version_32 := 16#94192802#;
pragma Export (C, u00380, "barrier_typeS");
u00381 : constant Version_32 := 16#98ccd1c1#;
pragma Export (C, u00381, "generic_realtime_bufferB");
u00382 : constant Version_32 := 16#a4c755fe#;
pragma Export (C, u00382, "generic_realtime_bufferS");
u00383 : constant Version_32 := 16#710eed06#;
pragma Export (C, u00383, "vehicle_message_typeS");
u00384 : constant Version_32 := 16#5da508ef#;
pragma Export (C, u00384, "vehicle_task_typeB");
u00385 : constant Version_32 := 16#d9636149#;
pragma Export (C, u00385, "vehicle_task_typeS");
u00386 : constant Version_32 := 16#82b6184f#;
pragma Export (C, u00386, "system__tasking__stagesB");
u00387 : constant Version_32 := 16#1b9f5506#;
pragma Export (C, u00387, "system__tasking__stagesS");
u00388 : constant Version_32 := 16#b00860db#;
pragma Export (C, u00388, "vehicle_interfaceB");
u00389 : constant Version_32 := 16#72d0071b#;
pragma Export (C, u00389, "vehicle_interfaceS");
u00390 : constant Version_32 := 16#d51f6d70#;
pragma Export (C, u00390, "system__tasking__async_delaysB");
u00391 : constant Version_32 := 16#5faa1c14#;
pragma Export (C, u00391, "system__tasking__async_delaysS");
u00392 : constant Version_32 := 16#969cb1f9#;
pragma Export (C, u00392, "system__interrupt_management__operationsB");
u00393 : constant Version_32 := 16#19b909c9#;
pragma Export (C, u00393, "system__interrupt_management__operationsS");
u00394 : constant Version_32 := 16#a6d7988d#;
pragma Export (C, u00394, "vectors_3d_lfB");
u00395 : constant Version_32 := 16#abff4c19#;
pragma Export (C, u00395, "vectors_3d_lfS");
u00396 : constant Version_32 := 16#1e27852c#;
pragma Export (C, u00396, "vectors_conversionsB");
u00397 : constant Version_32 := 16#923ddf49#;
pragma Export (C, u00397, "vectors_conversionsS");
u00398 : constant Version_32 := 16#cdecf3e0#;
pragma Export (C, u00398, "vectors_2dS");
u00399 : constant Version_32 := 16#3b68dc9f#;
pragma Export (C, u00399, "vectors_2d_iS");
u00400 : constant Version_32 := 16#e9217b79#;
pragma Export (C, u00400, "vectors_2d_pS");
u00401 : constant Version_32 := 16#878e5819#;
pragma Export (C, u00401, "swarm_control_concurrent_genericB");
u00402 : constant Version_32 := 16#7d3a30dd#;
pragma Export (C, u00402, "swarm_control_concurrent_genericS");
-- BEGIN ELABORATION ORDER
-- ada%s
-- ada.characters%s
-- ada.characters.latin_1%s
-- interfaces%s
-- system%s
-- system.address_operations%s
-- system.address_operations%b
-- system.atomic_counters%s
-- system.atomic_counters%b
-- system.exn_llf%s
-- system.exn_llf%b
-- system.float_control%s
-- system.float_control%b
-- system.img_bool%s
-- system.img_bool%b
-- system.img_enum_new%s
-- system.img_enum_new%b
-- system.img_int%s
-- system.img_int%b
-- system.img_lli%s
-- system.img_lli%b
-- system.io%s
-- system.io%b
-- system.machine_code%s
-- system.os_primitives%s
-- system.os_primitives%b
-- system.parameters%s
-- system.parameters%b
-- system.crtl%s
-- interfaces.c_streams%s
-- interfaces.c_streams%b
-- system.powten_table%s
-- system.restrictions%s
-- system.restrictions%b
-- system.storage_elements%s
-- system.storage_elements%b
-- system.stack_checking%s
-- system.stack_checking%b
-- system.stack_usage%s
-- system.stack_usage%b
-- system.string_hash%s
-- system.string_hash%b
-- system.htable%s
-- system.htable%b
-- system.strings%s
-- system.strings%b
-- system.task_info%s
-- system.task_info%b
-- system.traceback_entries%s
-- system.traceback_entries%b
-- system.unsigned_types%s
-- system.img_llu%s
-- system.img_llu%b
-- system.img_uns%s
-- system.img_uns%b
-- system.wch_con%s
-- system.wch_con%b
-- system.wch_jis%s
-- system.wch_jis%b
-- system.wch_cnv%s
-- system.wch_cnv%b
-- system.compare_array_unsigned_8%s
-- system.compare_array_unsigned_8%b
-- system.concat_2%s
-- system.concat_2%b
-- system.concat_3%s
-- system.concat_3%b
-- system.concat_4%s
-- system.concat_4%b
-- system.concat_5%s
-- system.concat_5%b
-- system.concat_6%s
-- system.concat_6%b
-- system.concat_7%s
-- system.concat_7%b
-- system.concat_8%s
-- system.concat_8%b
-- system.traceback%s
-- system.traceback%b
-- system.wch_stw%s
-- system.standard_library%s
-- system.exceptions_debug%s
-- system.exceptions_debug%b
-- ada.exceptions%s
-- system.wch_stw%b
-- ada.exceptions.traceback%s
-- system.secondary_stack%s
-- system.address_image%s
-- system.soft_links%s
-- system.exception_table%s
-- system.exception_table%b
-- system.exceptions%s
-- system.exceptions%b
-- ada.exceptions.last_chance_handler%s
-- system.memory%s
-- system.memory%b
-- ada.exceptions.traceback%b
-- system.traceback.symbolic%s
-- system.traceback.symbolic%b
-- system.exceptions.machine%s
-- system.exceptions.machine%b
-- system.secondary_stack%b
-- system.address_image%b
-- system.soft_links.initialize%s
-- system.soft_links.initialize%b
-- system.soft_links%b
-- ada.exceptions.last_chance_handler%b
-- system.standard_library%b
-- ada.exceptions%b
-- ada.command_line%s
-- ada.command_line%b
-- ada.containers%s
-- ada.containers.prime_numbers%s
-- ada.containers.prime_numbers%b
-- ada.exceptions.is_null_occurrence%s
-- ada.exceptions.is_null_occurrence%b
-- ada.io_exceptions%s
-- ada.numerics%s
-- ada.strings%s
-- interfaces.c%s
-- interfaces.c%b
-- interfaces.c.extensions%s
-- interfaces.c.strings%s
-- interfaces.c.strings%b
-- system.case_util%s
-- system.case_util%b
-- system.fat_flt%s
-- system.fat_lflt%s
-- system.fat_llf%s
-- ada.numerics.aux%s
-- ada.numerics.aux%b
-- ada.numerics.elementary_functions%s
-- ada.numerics.elementary_functions%b
-- system.img_real%s
-- system.img_real%b
-- system.multiprocessors%s
-- system.multiprocessors%b
-- system.os_constants%s
-- system.os_interface%s
-- system.os_interface%b
-- system.interrupt_management%s
-- system.interrupt_management%b
-- system.os_lib%s
-- system.os_lib%b
-- system.task_primitives%s
-- system.tasking%s
-- system.task_primitives.operations%s
-- system.tasking.debug%s
-- system.tasking%b
-- system.task_primitives.operations%b
-- system.tasking.debug%b
-- system.val_util%s
-- system.val_util%b
-- system.val_llu%s
-- system.val_llu%b
-- ada.tags%s
-- ada.tags%b
-- ada.streams%s
-- ada.streams%b
-- system.communication%s
-- system.communication%b
-- system.file_control_block%s
-- system.finalization_root%s
-- system.finalization_root%b
-- ada.finalization%s
-- ada.containers.helpers%s
-- ada.containers.helpers%b
-- ada.containers.hash_tables%s
-- ada.containers.red_black_trees%s
-- system.file_io%s
-- system.file_io%b
-- ada.streams.stream_io%s
-- ada.streams.stream_io%b
-- system.storage_pools%s
-- system.storage_pools%b
-- system.finalization_masters%s
-- system.finalization_masters%b
-- system.storage_pools.subpools%s
-- system.storage_pools.subpools.finalization%s
-- system.storage_pools.subpools%b
-- system.storage_pools.subpools.finalization%b
-- system.stream_attributes%s
-- system.stream_attributes%b
-- system.val_real%s
-- system.val_real%b
-- system.val_uns%s
-- system.val_uns%b
-- ada.calendar%s
-- ada.calendar%b
-- ada.calendar.delays%s
-- ada.calendar.delays%b
-- ada.real_time%s
-- ada.real_time%b
-- ada.text_io%s
-- ada.text_io%b
-- ada.text_io.generic_aux%s
-- ada.text_io.generic_aux%b
-- ada.text_io.float_aux%s
-- ada.text_io.float_aux%b
-- system.assertions%s
-- system.assertions%b
-- system.bit_ops%s
-- system.bit_ops%b
-- ada.strings.maps%s
-- ada.strings.maps%b
-- ada.strings.maps.constants%s
-- ada.characters.handling%s
-- ada.characters.handling%b
-- ada.strings.search%s
-- ada.strings.search%b
-- ada.strings.fixed%s
-- ada.strings.fixed%b
-- ada.strings.superbounded%s
-- ada.strings.superbounded%b
-- ada.strings.bounded%s
-- ada.strings.bounded%b
-- ada.strings.unbounded%s
-- ada.strings.unbounded%b
-- ada.strings.unbounded.hash%s
-- ada.strings.unbounded.hash%b
-- system.interrupt_management.operations%s
-- system.interrupt_management.operations%b
-- system.pool_global%s
-- system.pool_global%b
-- system.random_seed%s
-- system.random_seed%b
-- system.random_numbers%s
-- system.random_numbers%b
-- ada.numerics.float_random%s
-- ada.numerics.float_random%b
-- system.soft_links.tasking%s
-- system.soft_links.tasking%b
-- system.strings.stream_ops%s
-- system.strings.stream_ops%b
-- system.tasking.initialization%s
-- system.tasking.task_attributes%s
-- system.tasking.initialization%b
-- system.tasking.task_attributes%b
-- system.tasking.protected_objects%s
-- system.tasking.protected_objects%b
-- system.tasking.protected_objects.entries%s
-- system.tasking.protected_objects.entries%b
-- system.tasking.queuing%s
-- system.tasking.queuing%b
-- system.tasking.utilities%s
-- system.tasking.utilities%b
-- ada.task_identification%s
-- ada.task_identification%b
-- system.tasking.entry_calls%s
-- system.tasking.rendezvous%s
-- system.tasking.protected_objects.operations%s
-- system.tasking.protected_objects.operations%b
-- system.tasking.entry_calls%b
-- system.tasking.rendezvous%b
-- system.tasking.stages%s
-- system.tasking.stages%b
-- system.tasking.async_delays%s
-- system.tasking.async_delays%b
-- barrier_type%s
-- barrier_type%b
-- bzip2%s
-- bzip2%b
-- exceptions%s
-- exceptions%b
-- generic_protected%s
-- generic_protected%b
-- generic_realtime_buffer%s
-- generic_realtime_buffer%b
-- gl%s
-- gl.extended%s
-- gl%b
-- gl.buffer%s
-- gl.buffer%b
-- gl.io%s
-- gl.io%b
-- gl.materials%s
-- gl.materials%b
-- gl.math%s
-- gl.math%b
-- gl.geometry%s
-- gl.geometry%b
-- gl.frustums%s
-- gl.frustums%b
-- glu%s
-- glu%b
-- gl.errors%s
-- gl.errors%b
-- gl.buffer.general%s
-- gl.buffer.general%b
-- gl.textures%s
-- gl.textures%b
-- gl.buffer.texture_coords%s
-- gl.buffer.texture_coords%b
-- gl.skins%s
-- gl.skins%b
-- gl.skinned_geometry%s
-- gl.skinned_geometry%b
-- glut%s
-- glut%b
-- glut_2d%s
-- glut_2d%b
-- real_type%s
-- generic_sliding_statistics%s
-- generic_sliding_statistics%b
-- graphics_framerates%s
-- graphics_framerates%b
-- matrices%s
-- matrices%b
-- quaternions%s
-- quaternions%b
-- screenshots%s
-- screenshots%b
-- vectors_xd%s
-- vectors_xd%b
-- vectors_2d%s
-- vectors_3d%s
-- vectors_3d%b
-- rotations%s
-- rotations%b
-- vectors_3d_lf%s
-- vectors_3d_lf%b
-- vectors_4d%s
-- vectors_xd_i%s
-- vectors_xd_i%b
-- vectors_2d_i%s
-- vectors_2d_n%s
-- vectors_2d_p%s
-- vectors_conversions%s
-- vectors_conversions%b
-- zip_streams%s
-- zip%s
-- zip_streams%b
-- zip.headers%s
-- zip.headers%b
-- zip%b
-- zip.crc%s
-- zip.crc%b
-- unzip%s
-- unzip.decompress%s
-- unzip.decompress.huffman%s
-- unzip.decompress.huffman%b
-- unzip%b
-- unzip.decompress%b
-- unzip.streams%s
-- unzip.streams%b
-- globe_3d%s
-- globe_3d.textures%s
-- globe_3d.portals%s
-- globe_3d.options%s
-- globe_3d.options%b
-- globe_3d.math%s
-- globe_3d.math%b
-- globe_3d.textures%b
-- globe_3d%b
-- globe_3d.portals%b
-- globe_3d.software_anti_aliasing%s
-- globe_3d.software_anti_aliasing%b
-- globe_3d.stars_sky%s
-- globe_3d.stars_sky%b
-- glut.devices%s
-- game_control%s
-- game_control%b
-- actors%s
-- actors%b
-- glut.windows%s
-- glut.windows%b
-- glut.devices%b
-- graphics_structures%s
-- graphics_configuration%s
-- keyboard%s
-- keyboard%b
-- spaceship_p%s
-- spaceship_p%b
-- sphere_p%s
-- sphere_p%b
-- models%s
-- models%b
-- graphics_data%s
-- graphics_setup%s
-- graphics_setup%b
-- graphics_opengl%s
-- graphics_opengl%b
-- swarm_structures_base%s
-- swarm_configurations%s
-- swarm_configurations%b
-- swarm_configuration%s
-- swarm_configuration%b
-- vehicle_task_type%s
-- vehicle_message_type%s
-- swarm_structures%s
-- swarm_structures%b
-- swarm_data%s
-- swarm_control%s
-- swarm_control%b
-- vehicle_interface%s
-- vehicle_interface%b
-- vehicle_task_type%b
-- swarm_control_concurrent_generic%s
-- swarm_control_concurrent_generic%b
-- callback_procedures%s
-- callback_procedures%b
-- swarm%b
-- END ELABORATION ORDER
end ada_main;
|
with
gel_demo_Services,
gel.Window.lumen,
gel.Applet.gui_World,
gel.World,
gel.Forge,
gel.Camera,
gel.Sprite,
float_Math,
ada.Text_IO,
ada.Exceptions;
package body gel_demo_Client
is
use ada.Text_IO;
package Math renames float_Math;
task body Item
is
use gel.Applet;
the_Applet : gel.Applet.gui_World.view;
begin
accept start;
the_Applet := gel.Forge.new_gui_Applet ("distributed Demo ~ Client", 1920, 1200);
-- the_Applet.gui_World.start;
-- Register the client world as a mirror of the server world.
--
the_Applet.gui_World.Gravity_is ((0.0, 0.0, 0.0));
the_Applet.gui_World.is_a_Mirror (of_world => gel_demo_Services.World);
gel_demo_Services.World.register (the_mirror => the_Applet.gui_World.all'Access,
mirror_as_observer => the_Applet.gui_World.all'Access);
-- Setup.
--
the_Applet.gui_Camera.Site_is ((0.0, 0.0, 20.0));
the_Applet.enable_simple_Dolly (1);
-- Begin processing.
--
while the_Applet.is_open
loop
the_Applet.gui_World.evolve (by => 1.0/60.0);
the_Applet.freshen;
end loop;
-- Close.
--
gel_demo_services.World.deregister (the_mirror => the_Applet.gui_World.all'access);
the_Applet.destroy;
-- Client_is_running := False;
put_Line ("Client done.");
exception
when E : others =>
put_Line ("Client unhandled exception ...");
put_Line (ada.exceptions.Exception_Information (E));
put_Line ("Client has terminated !");
end Item;
end gel_demo_Client;
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.